tencentcloud-webar 1.0.24 → 1.0.25-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.
- package/build-esm/450.js +1 -1
- package/build-esm/682.js +1 -1
- package/build-esm/avatar.js +1 -1
- package/build-esm/hand3d.js +1 -1
- package/build-esm/index.js +1 -1
- package/build-esm/sticker3d.js +1 -1
- package/build-umd/avatar.umd.js +1 -1
- package/build-umd/hand-3d.umd.3e2c014e921d153748f3.js +11 -0
- package/build-umd/stickers-3d.umd.js +4 -4
- package/build-umd/webar-sdk.umd.js +2 -2
- package/miniprogram_dist/core.js +1 -1
- package/miniprogram_dist/index.js +1 -1
- package/miniprogram_dist/plugin-3d.js +1 -1
- package/package.json +1 -1
- package/build-umd/hand-3d.umd.4ccf3e4517472282269a.js +0 -11
|
@@ -1 +1 @@
|
|
|
1
|
-
var self = wx;var t,e={3483:function(t){t.exports=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])})(e,n)};function e(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}var n=function(){return(n=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t}).apply(this,arguments)};function r(t,e){var n,r,i,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]},a={next:s(0),throw:s(1),return:s(2)};return"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function s(a){return function(s){var c=[a,s];if(n)throw new TypeError("Generator is already executing.");for(;o;)try{if(n=1,r&&(i=2&c[0]?r.return:c[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,c[1])).done)return i;switch(r=0,(c=i?[2&c[0],i.value]:c)[0]){case 0:case 1:i=c;break;case 4:return o.label++,{value:c[1],done:!1};case 5:o.label++,r=c[1],c=[0];continue;case 7:c=o.ops.pop(),o.trys.pop();continue;default:if(!((i=0<(i=o.trys).length&&i[i.length-1])||6!==c[0]&&2!==c[0])){o=0;continue}if(3===c[0]&&(!i||c[1]>i[0]&&c[1]<i[3]))o.label=c[1];else if(6===c[0]&&o.label<i[1])o.label=i[1],i=c;else{if(!(i&&o.label<i[2])){i[2]&&o.ops.pop(),o.trys.pop();continue}o.label=i[2],o.ops.push(c)}}c=e.call(t,o)}catch(s){c=[6,s],r=0}finally{n=i=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}}function i(){for(var t=0,e=0,n=arguments.length;e<n;e++)t+=arguments[e].length;var r=Array(t),i=0;for(e=0;e<n;e++)for(var o=arguments[e],a=0,s=o.length;a<s;a++,i++)r[i]=o[a];return r}Object.assign||Object.defineProperty(Object,"assign",{enumerable:!1,configurable:!0,writable:!0,value:function(t){if(null==t)throw new TypeError("Cannot convert first argument to object");for(var e=Object(t),n=1;n<arguments.length;n++)if(null!=(r=arguments[n]))for(var r=Object(r),i=Object.keys(Object(r)),o=0,a=i.length;o<a;o++){var s=i[o],c=Object.getOwnPropertyDescriptor(r,s);null!=c&&c.enumerable&&(e[s]=r[s])}return e}});var o=["ext1","ext2","ext3","level","trace","tag","seq","code"],a=(c.prototype.indexOf=function(t,e){for(var n=0;n<t.length;n++)if(t[n].callback===e)return n;return-1},c.prototype.on=function(t,e,n){var r;if(void 0===n&&(n=0),this)return(r=this.eventsList[t])||(this.eventsList[t]=[],r=this.eventsList[t]),-1===this.indexOf(r,e)&&r.push({name:t,type:n||0,callback:e}),this},c.prototype.one=function(t,e){this.on(t,e,1)},c.prototype.remove=function(t,e){if(this){var n=this.eventsList[t];if(n){if(e)return n.length&&(e=this.indexOf(n,e),n.splice(e,1)),this;try{delete this.eventsList[t]}catch(t){}}return null}},c.prototype.clear=function(){this.eventsList={}},c),s=function(t){if(!t||0===t.length)return"{}";t=Array.isArray(t)?t:[t];var e=Object.keys(t[0]),n={},r=(e.forEach((function(e){n[e]=t.map((function(t){return t[e]}))})),n.count=t.length,n);if("string"==typeof r)return r;try{return JSON.stringify(r,_())||"undefined"}catch(r){return"error happen when aegis stringify: \n "+r.message+" \n "+r.stack}};function c(){var t=this;this.emit=function(e,n){if(t){var r;if(null!=(i=t.eventsList[e])&&i.length)for(var i=i.slice(),o=0;o<i.length;o++){r=i[o];try{var a=r.callback.apply(t,[n]);if(1===r.type&&t.remove(e,r.callback),!1===a)break}catch(e){throw e}}return t}},this.eventsList={}}function l(t,e){return"string"==typeof t?t.split("?")[e?1:0]||"":t}function u(t){return"string"==typeof t&&t.startsWith("//")?"undefined"!=typeof location&&"https:"===location.protocol:/^https/.test(t)}function h(t,e,n){var r,i;try{if("function"==typeof(null==e?void 0:e.retCodeHandler))return{code:void 0===(o=(i=e.retCodeHandler(t,null==n?void 0:n.url,null==n?void 0:n.ctx)||{}).code)?"unknown":o,isErr:i.isErr};"string"==typeof t&&(t=JSON.parse(t)),"function"==typeof(null==(r=null==e?void 0:e.ret)?void 0:r.join)&&(v=[].concat(e.ret.map((function(t){return t.toLowerCase()}))));var o,a=Object.getOwnPropertyNames(t).filter((function(t){return-1!==v.indexOf(t.toLowerCase())}));return a.length?{code:""+(o=t[a[0]]),isErr:0!==o&&"0"!==o}:{code:"unknown",isErr:!1}}catch(t){return{code:"unknown",isErr:!1}}}function d(t,e){void 0===e&&(e=3);var n,r,i,o="";return Array.isArray(t)?(o+="[",n=t.length,t.forEach((function(t,r){var i,a;o=(o+="object"==typeof t&&1<e?d(t,e-1):(a="",a+="undefined"==(i=typeof t)||"symbol"==i||"function"==i?"null":"string"==i||"object"==i?'"'+t+'"':t))+(r===n-1?"":",")})),o+="]"):t instanceof Object?(o="{",r=Object.keys(t),i=r.length,r.forEach((function(n,a){var s,c,l;"object"==typeof t[n]&&1<e?o+='"'+n+'":'+d(t[n],e-1):o+=(l="","string"==(c=typeof(s=t[n]))||"object"==c?l+='"'+n+'":"'+s+'"':"function"==typeof s?l+='"'+n+'":"function '+s.name+'"':"symbol"==typeof s?l+='"'+n+'":"symbol"':"number"!=typeof s&&"boolean"!=c||(l+='"'+n+'": '+s),l),o+=a===i-1||a<i-1&&void 0===t[r[a+1]]?"":","})),o+="}"):o+=t,o}var f,p,g,m,y,v=["ret","retcode","code","errcode"],_=function(){var t=new WeakSet;return function(e,n){if(n instanceof Error)return"Error.message: "+n.message+" \n Error.stack: "+n.stack;if("object"==typeof n&&null!==n){if(t.has(n))return"[Circular "+(e||"root")+"]";t.add(n)}return n}},b=function(t){if("string"==typeof t)return t;try{return t instanceof Error?(JSON.stringify(t,_(),4)||"undefined").replace(/"/gim,""):JSON.stringify(t,_(),4)||"undefined"}catch(t){return"error happen when aegis stringify: \n "+t.message+" \n "+t.stack}};function x(t,e){var n,r=[],i=t.config;return t.lifeCycle.on("destroy",(function(){r.length=0})),function(o,a){Array.isArray(o)?r=r.concat(o):r.push(o),e&&r.length>=e||t.sendNow&&0<r.length?(r=U(r),a(r.splice(0,r.length)),n&&clearTimeout(n)):(n&&clearTimeout(n),n=setTimeout((function(){n=null,0<(r=U(r)).length&&a(r.splice(0,r.length))}),i.delay))}}function w(t,e){return Array.isArray(t)?e(t.map((function(t){return e=n(n({},t),{msg:"string"==typeof t.msg?t.msg:[].concat(t.msg).map(b).join(" ")}),o.forEach((function(t){e[t]||delete e[t]})),e;var e}))):e([n(n({},t),{msg:"string"==typeof t.msg?t.msg:b(t.msg)})])}function C(t,e){return function(r,i){var a,s,c,l=Array.isArray(r),u=l?r:[r],h=(t.lifeCycle.emit("beforeRequest",r),t.config.beforeRequest);(u="function"==typeof h?u.map((function(t){try{var n=h({logs:t,logType:e});return(null==n?void 0:n.logType)===e&&null!=n&&n.logs?n.logs:!1!==n&&t}catch(n){return t}})).filter((function(t){return!1!==t})):u).length&&(a=u,r=o,!Array.isArray(a)||a.length<=1||(s=[],c=[],!(c="string"==typeof r?[r]:r)||c.length<=0||(c.forEach((function(t){a.forEach((function(e){null!=e&&e[t]&&s.push(t)}))})),0<s.length&&(a=a.map((function(t){var e={};return s.forEach((function(t){e[t]=""})),n(n({},e),t)}))))),u=a,i(l?u:u[0]))}}function T(t){return function(e,n){t.lifeCycle.emit("modifyRequest",e);var r=t.config.modifyRequest;if("function"==typeof r)try{var i=r(e);"object"==typeof i&&"url"in i&&(e=i)}catch(e){console.error(e)}n(e)}}function S(t){return function(e,n){t.lifeCycle.emit("afterRequest",e);var r=t.config.afterRequest;"function"==typeof r&&!1===r(e)||n(e)}}function k(t){if(t&&t.reduce&&t.length)return 1===t.length?function(e,n){t[0](e,n||V)}:t.reduce((function(t,e){return function(n,r){return void 0===r&&(r=V),t(n,(function(t){return null==e?void 0:e(t,r)}))}}));throw new TypeError("createPipeline need at least one function param")}function E(t,e){Object.getOwnPropertyNames(t).forEach((function(n){"function"==typeof t[n]&&"constructor"!==n&&(e?e[n]="sendPipeline"===n?function(){return function(){}}:function(){}:t[n]=function(){})}))}function P(t){try{var e,n,r,i="";return i=t.pageUrl||(n=(e=getCurrentPages())[e.length-1]||{},o=n.options,r=Object.keys(o).length?"?"+Object.keys(o).map((function(t){return t+"="+o[t]})).join("&"):"",n.route?n.route+r:""),i="function"==typeof t.urlHandler?t.urlHandler():i}catch(t){return""}var o}function R(t,e){if("string"==typeof t&&"string"==typeof e){if(t===e)return 1;for(var n=t.split("."),r=e.split("."),i=Math.max(n.length,r.length),o=0;o<i;o++){var a=~~n[o],s=~~r[o];if(a<s)return;if(s<a)return 1}}}function O(t){return R(Y=Y||G.getSystemInfoSync().SDKVersion,"1.1.1")&&G.canIUse?G.canIUse(t):!!G[t]}function D(t){for(var e,n={unknown:/unknown|none/i,wifi:/wifi/i,net2g:/2g/i,net3g:/3g/i,net4g:/4g/i,net5g:/5g/i,net6g:/6g/i},r=g.unknown,i=0;i<Object.keys(n).length;i++){var o=Object.keys(n)[i];if(null!=(e=n[o])&&e.test(t)){r=g[o];break}}return r}function A(t){var e=t.apiName,n=et[e];n?n.hackCloudReq.addCallback(t):(n=tt.cloud[e],et[e]={hackCloudReq:new nt(t),originApi:n}),et[e]}function I(t){var e=t.apiName,n=it[e];n?n.hackReq.addCallback(t):(n=wx[e],it[e]={hackReq:new ot(t),originApi:n}),it[e]}(q=f=f||{}).INFO_ALL="-1",q.API_RESPONSE="1",q.INFO="2",q.ERROR="4",q.PROMISE_ERROR="8",q.AJAX_ERROR="16",q.SCRIPT_ERROR="32",q.IMAGE_ERROR="64",q.CSS_ERROR="128",q.CONSOLE_ERROR="256",q.MEDIA_ERROR="512",q.RET_ERROR="1024",q.REPORT="2048",q.PV="4096",q.EVENT="8192",q.PAGE_NOT_FOUND_ERROR="16384",q.WEBSOCKET_ERROR="32768",q.BRIDGE_ERROR="65536",(q=p=p||{})[q.android=1]="android",q[q.ios=2]="ios",q[q.windows=3]="windows",q[q.macos=4]="macos",q[q.linux=5]="linux",q[q.devtools=6]="devtools",q[q.other=100]="other",(q=g=g||{})[q.unknown=100]="unknown",q[q.wifi=1]="wifi",q[q.net2g=2]="net2g",q[q.net3g=3]="net3g",q[q.net4g=4]="net4g",q[q.net5g=5]="net5g",q[q.net6g=6]="net6g",(q=m=m||{}).LOG="log",q.SPEED="speed",q.PERFORMANCE="performance",q.OFFLINE="offline",q.WHITE_LIST="whiteList",q.VITALS="vitals",q.PV="pv",q.CUSTOM_PV="customPV",q.EVENT="event",q.CUSTOM="custom",q.SDK_ERROR="sdkError",q.SET_DATA="setData",q.LOAD_PACKAGE="loadPackage",(q=y=y||{}).production="production",q.development="development",q.gray="gray",q.pre="pre",q.daily="daily",q.local="local",q.test="test",q.others="others";var F,L,M,N,j,U=function(t){return t.filter((function(e,n){return"static"!==e.type||!t.find((function(t,r){return e.url===t.url&&200===e.status&&n<r}))}))},B=function(t){t.level===f.INFO_ALL&&(t.level=f.INFO)},z=function(t){return(Array.isArray(t)?t:[t]).map((function(t){return Object.getOwnPropertyNames(t).reduce((function(e,n){return"ctx"!==n&&(e[n]=t[n]),e}),{level:f.INFO,msg:""})}))},W=function(t){return function(e){return t.sendPipeline([function(e,n){return n({url:t.config.url||"",data:s(z(e)),method:"post",contentType:"application/json",type:m.LOG,log:e,requestConfig:{timeout:5e3},success:function(){var r=t.config.onReport;"function"==typeof r&&e.forEach((function(t){r(t)})),"function"==typeof n&&n([])},fail:function(e){"403 forbidden"===e&&t.destroy()}})}],m.LOG)(e)}},V=function(){},q=(Object.defineProperty(wt.prototype,"__version__",{get:function(){return console.warn("__version__ has discard, please use version"),"1.36.3"},enumerable:!1,configurable:!0}),Object.defineProperty(wt.prototype,"LogType",{get:function(){return console.warn("LogType has discard, please use logType"),f},enumerable:!1,configurable:!0}),wt.prototype.init=function(t){this.setConfig(t);for(var e=0;e<wt.installedPlugins.length;e++)try{wt.installedPlugins[e].patch(this)}catch(t){this.sendSDKError(t)}this.lifeCycle.emit("onInited")},wt.prototype.setConfig=function(t){Object.assign(this.config,t);var e=(t=this.config).id,n=t.uin,r=t.version,i=t.ext1,o=t.ext2,a=t.ext3,s=t.aid,c=void 0===(l=t.env)?"production":l,l=t.pageUrl;return t=this.bean.id!==e||this.bean.uin!==n||this.bean.aid!==s,this.bean.id=e||"",this.bean.uin=n||"",this.bean.version=r||"1.36.3",this.bean.aid=s||"",this.bean.env=function(){switch(c){case y.production:case y.development:case y.gray:case y.pre:case y.daily:case y.local:case y.test:case y.others:return 1;default:return}}()?c:y.others,l&&this.extendBean("from",encodeURIComponent(l)),i&&this.extendBean("ext1",encodeURIComponent(i)),o&&this.extendBean("ext2",encodeURIComponent(o)),a&&this.extendBean("ext3",encodeURIComponent(a)),t&&this.lifeCycle.emit("onConfigChange",this.config),this.config},wt.use=function(t){-1===wt.installedPlugins.indexOf(t)&&t.aegisPlugin&&wt.installedPlugins.push(t)},wt.unuse=function(t){-1!==(t=wt.installedPlugins.indexOf(t))&&wt.installedPlugins.splice(t,1)},wt.prototype.info=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var r={level:f.INFO,msg:t};1===t.length&&t[0].msg&&Object.assign(r,n({},t[0]),{level:f.INFO}),this.normalLogPipeline(r)},wt.prototype.infoAll=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var r={level:f.INFO_ALL,msg:t};1===t.length&&t[0].msg&&Object.assign(r,n({},t[0]),{level:f.INFO_ALL}),this.normalLogPipeline(r)},wt.prototype.report=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var r={level:f.REPORT,msg:t};1===t.length&&t[0].msg&&Object.assign(r,n({},t[0])),this.normalLogPipeline(r)},wt.prototype.error=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var r={level:f.ERROR,msg:t};1===t.length&&t[0].msg&&Object.assign(r,n({},t[0]),{level:f.ERROR}),this.normalLogPipeline(r)},wt.prototype.speedLogPipeline=function(t){throw new Error('You need to override "speedLogPipeline" method')},wt.prototype.reportPv=function(t){var e,n=this;t&&(console.warn("reportPv is deprecated, please use reportEvent"),e=""+Object.getOwnPropertyNames(this.bean).filter((function(t){return"id"!==t})).map((function(t){return t+"="+n.bean[t]})).join("&"),this.sendPipeline([function(r,i){i({url:n.config.url+"/"+t+"?"+e,addBean:!1,type:m.CUSTOM_PV,fail:function(t){"403 forbidden"===t&&n.destroy()}})}],m.CUSTOM_PV)(null))},wt.prototype.reportEvent=function(t){t&&((t="string"==typeof t?{name:t,ext1:this.config.ext1||"",ext2:this.config.ext2||"",ext3:this.config.ext3||""}:t).name?this.eventPipeline(t):console.warn("reportEvent params error"))},wt.prototype.reportTime=function(t,e){if("object"==typeof t)return this.reportT(t);"string"==typeof t?"number"==typeof e?e<0||6e4<e?console.warn("reportTime: duration must between 0 and 60000"):this.submitCustomTime(t,e):console.warn("reportTime: second param must be number"):console.warn("reportTime: first param must be a string")},wt.prototype.reportT=function(t){var e=t.name,n=t.duration,r=void 0===(r=t.ext1)?"":r,i=void 0===(i=t.ext2)?"":i,o=void 0===(o=t.ext3)?"":o;if(t=t.from,"string"==typeof e&&"number"==typeof n&&"string"==typeof r&&"string"==typeof i&&"string"==typeof o){if(!(n<0||6e4<n))return this.submitCustomTime(e,n,r,i,o,void 0===t?"":t);console.warn("reportTime: duration must between 0 and 60000")}else console.warn("reportTime: params error")},wt.prototype.time=function(t){"string"==typeof t?this.timeMap[t]?console.warn("Timer "+t+" already exists"):this.timeMap[t]=Date.now():console.warn("time: first param must be a string")},wt.prototype.timeEnd=function(t){"string"==typeof t?this.timeMap[t]?(this.submitCustomTime(t,Date.now()-this.timeMap[t]),delete this.timeMap[t]):console.warn("Timer "+t+" does not exist"):console.warn("timeEnd: first param must be a string")},wt.prototype.submitCustomTime=function(t,e,n,r,i,o){this.customTimePipeline({name:t,duration:e,ext1:n||this.config.ext1,ext2:r||this.config.ext2,ext3:i||this.config.ext3,from:o||void 0})},wt.prototype.extendBean=function(t,e){this.bean[t]=e},wt.prototype.sendPipeline=function(t,e){var n,r=this;return k(i([function(t,e){if("number"!=typeof n.config.random&&(console.warn("random must in [0, 1], default is 1."),n.config.random=1),!n.isHidden||!n.isGetSample)if(n.isGetSample)n.isHidden||e(t);else{if(n.isGetSample=!0,Math.random()<n.config.random)return n.isHidden=!1,e(t);n.isHidden=!0}},C(n=this,e)],t,[T(this),function(t,e){r.request(t,(function(){for(var n,o=[],a=0;a<arguments.length;a++)o[a]=arguments[a];r.failRequestCount=0,e({isErr:!1,result:o,logType:null==t?void 0:t.type,logs:null==t?void 0:t.log}),null!=(n=null==t?void 0:t.success)&&n.call.apply(n,i([t],o))}),(function(){for(var n,o=[],a=0;a<arguments.length;a++)o[a]=arguments[a];10<=++r.failRequestCount&&r.destroy(),e({isErr:!0,result:o,logType:null==t?void 0:t.type,logs:null==t?void 0:t.log}),null!=(n=null==t?void 0:t.fail)&&n.call.apply(n,i([t],o))}))},S(this)]))},wt.prototype.send=function(t,e,n){var r=this;return k([T(this),function(t,i){r.request(t,(function(){for(var n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];i({isErr:!1,result:n,logType:t.type,logs:t.log}),null!=e&&e.apply(void 0,n)}),(function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];i({isErr:!0,result:e,logType:t.type,logs:t.log}),null!=n&&n.apply(void 0,e)}))},S(this)])(t)},wt.prototype.ready=function(t,e,n){throw new Error('You need to override "ready" method')},wt.prototype.request=function(t,e,n){throw new Error('You need to override "request" method')},wt.prototype.sendSDKError=function(t){var e=this;this.sendPipeline([function(t,n){n({url:e.config.url+"?id=1085&msg[0]="+encodeURIComponent(b(t))+"&level[0]=2&from="+e.config.id+"&count=1&version="+e.config.id+"(1.36.3)",addBean:!1,method:"get",type:m.SDK_ERROR,log:t})}],m.SDK_ERROR)(t)},wt.prototype.destroy=function(t){void 0===t&&(t=!1);var e,n,r=wt.instances.indexOf(this);-1!==r&&wt.instances.splice(r,1);for(var i=wt.installedPlugins.length-1;0<=i;i--)try{wt.installedPlugins[i].unpatch(this)}catch(t){this.sendSDKError(t)}if(this.lifeCycle.emit("destroy"),this.lifeCycle.clear(),t)e=this,n=Object.getOwnPropertyDescriptors(e),Object.keys(n).forEach((function(t){n[t].writable&&(e[t]=null)})),Object.setPrototypeOf(this,null);else{for(var o=this;o.constructor!==Object&&E(o,this),o=Object.getPrototypeOf(o););0===wt.instances.length&&(E(r=Object.getPrototypeOf(this).constructor),E(wt))}},wt.version="1.36.3",wt.instances=[],wt.logType=f,wt.environment=y,wt.installedPlugins=[],wt),H=(xt.prototype.patch=function(t){this.canUse(t)&&this.exist(t)&&(this.instances.push(t),this.triggerInit(t),this.triggerOnNewAegis(t))},xt.prototype.unpatch=function(t){-1!==(t=this.instances.indexOf(t))&&(this.instances.splice(t,1),0===this.instances.length&&this.uninstall())},xt.prototype.countInstance=function(){return this.instances.length},xt.prototype.uninstall=function(){var t;null!=(t=null==(t=this.option)?void 0:t.destroy)&&t.apply(this)},xt.prototype.walk=function(t){var e=this;this.instances.forEach((function(n){var r=e.canUse(n);r&&t(n,r)}))},xt.prototype.canUse=function(t){return!(!(t=this.getConfig(t))||"object"!=typeof t)||!!t},xt.prototype.getConfig=function(t){return null==(t=t.config)?void 0:t[this.name]},xt.prototype.exist=function(t){return-1===this.instances.indexOf(t)},xt.prototype.triggerInit=function(t){var e;this.inited||(this.inited=!0,null!=(e=null==(e=this.option)?void 0:e.init)&&e.call(this.option,this.getConfig(t)))},xt.prototype.triggerOnNewAegis=function(t){var e;null!=(e=null==(e=this.option)?void 0:e.onNewAegis)&&e.call(this.option,t,this.getConfig(t))},xt),G=wx||qq,Y="",Z=new H({name:"offlineLog",onNewAegis:function(t){if(G.getFileSystemManager)try{var e=t.config,n=e.id,r=void 0===n?"":n,i=e.uin,o=void 0===i?0:i,a=e.offlineUrl,s=void 0===a?"":a,c=e.offlineLogLimit,l=new K({limit:c});t.lifeCycle.on("beforeWrite",(function(e){l.save2Offline(e=void 0===e?[]:e,t.config)})),l.ready((function(e){var n=(t.bean||{}).aid,i=void 0===n?"":n;!e&&r&&(o||i)&&t.send({url:s+"/offlineAuto",type:m.OFFLINE,log:m.OFFLINE},(function(n){var a=(null==n?void 0:n.data).secretKey;a&&!e&&l.getLogs({id:r,uin:o},(function(e,n){e?console.error(e):t.send({url:s+"/offlineLog",data:{logs:n,secretKey:a,id:r,uin:o,aid:i},method:"post",type:m.OFFLINE,log:n},(function(){l.clearLogs()}))}))}))}))}catch(t){console.error(t)}else console.warn("[aegis-mp-sdk]unsupport getFileSystemManager offline log not work!")}}),K=(bt.prototype.getLogs=function(t,e){var n=this.fileSystem,r=this.filePath;n.readFile({filePath:r,encoding:"utf8",fail:function(t){console.error(t)},success:function(t){t=(void 0===(t=t.data)?"":t).toString().split("\n").filter((function(t){return t})).map((function(t){return JSON.parse(t)})),e(null,t)}})},bt.prototype.checkLimit=function(t,e){void 0===e&&(e=function(){});var n=this.fileSystem,r=this.filePath,i=this.limitSize;n.readFile({filePath:r,encoding:"utf8",success:function(o){if((o=(o=void 0===(o=o.data)?"":o).toString()+t).length>i){for(var a=o.split("\n"),s="",c=a.length-1;0<=c&&!(a[c]&&(s=a[c]+"\n"+s).length>i);c--);n.writeFile({filePath:r,data:s,success:e})}else n.appendFile({data:t,filePath:r,encoding:"utf8",success:e,fail:function(t){console.error(t)}})}})},bt),X=new H({name:"device",onNewAegis:function(t){return e=this,o=function(){return r(this,(function(e){return this.setSystemInfo(t),this.refreshNetwork(t),this.setNetworkChange(t),[2]}))},new(i=(i=n=void 0)||Promise)((function(t,r){function a(t){try{c(o.next(t))}catch(t){r(t)}}function s(t){try{c(o.throw(t))}catch(t){r(t)}}function c(e){var n;e.done?t(e.value):((n=e.value)instanceof i?n:new i((function(t){t(n)}))).then(a,s)}c((o=o.apply(e,n||[])).next())}));var e,n,i,o},setSystemInfo:function(t){var e=this;try{O("getSystemInfo")&&G.getSystemInfo({success:function(n){var r=n.platform,i=n.model,o=n.windowHeight,a=n.windowWidth,s=void 0===(s=n.screenWidth)?0:s;n=void 0===(n=n.screenHeight)?0:n,t.extendBean("platform",e.getPlatFormType(r)),t.extendBean("model",i),t.extendBean("vp",Math.round(a)+" * "+Math.round(o)),t.extendBean("sr",Math.round(s)+" * "+Math.round(n))}})}catch(t){}},getPlatFormType:function(t){for(var e,n={android:/android/i,ios:/ios/i,windows:/windows/i,macos:/mac/i,devtools:/devtools/i},r=p.other,i=0;i<Object.keys(n).length;i++){var o=Object.keys(n)[i];if(null!=(e=n[o])&&e.test(t)){r=p[o];break}}return r},setNetworkChange:function(t){O("onNetworkStatusChange")&&G.onNetworkStatusChange((function(e){e=D(e.networkType),t.extendBean("netType",e)}))},setNetworkType:function(t){O("getNetworkType")&&G.getNetworkType({success:function(e){e=D(e.networkType),t.extendBean("netType",e)}})},refreshNetwork:function(t){var e=this;this.timer&&clearTimeout(this.timer),this.setNetworkType(t),this.timer=setTimeout((function(){e.refreshNetwork(t)}),1e4)}}),$=G.request,J=(e(_t,j=q),Object.defineProperty(_t.prototype,"getBean",{get:function(){var t=this;return this.bean?Object.getOwnPropertyNames(this.bean).map((function(e){return e+"="+t.bean[e]})).join("&")+"&from="+encodeURIComponent(P(this.config)):"from="+encodeURIComponent(P(this.config))},enumerable:!1,configurable:!0}),_t.prototype.initOfflineLog=function(){_t.use(Z)},_t.prototype.uploadLogs=function(t,e){this.lifeCycle.emit("uploadLogs",t=void 0===t?{}:t,e=void 0===e?{}:e)},_t.prototype.reportPv=function(t){var e,n=this;t&&(e=Object.getOwnPropertyNames(this.bean).filter((function(t){return"id"!==t})).map((function(t){return t+"="+n.bean[t]})).join("&")+"&from="+encodeURIComponent(P(this.config)),this.send({url:this.config.url+"/"+t+"?"+e,addBean:!1,type:m.CUSTOM_PV,log:m.CUSTOM_PV},(function(){}),(function(){})))},_t.sessionID="session-"+Date.now(),_t.asyncPluginIndex=0,q=_t,new H({name:"aid",onNewAegis:function(t){this.initAid((function(e){t.bean.aid=e,t.config.aid=e}))},initAid:function(t){G.getStorage({key:"AEGIS_ID",success:function(e){t(e.data)},fail:function(){var e="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(t){var e=16*Math.random()|0;return("x"===t?e:3&e|8).toString(16)}));G.setStorage({key:"AEGIS_ID",data:e,success:function(){t(e)}})}})}})),Q=(vt.prototype.addCallback=function(t){t&&this.callbacks.push(t)},vt.prototype.prefixHandler=function(t){return n(n({},t),{aegisRequestStartTime:+new Date})},vt.prototype.successHandler=function(t,e){var n;this.callbacks.forEach((function(n){var r;try{null!=(r=n.success)&&r.call(n,t,e)}catch(n){}})),null!=(n=e.success)&&n.call(e,t,e)},vt.prototype.failHandler=function(t,e){var n;this.callbacks.forEach((function(n){var r;try{null!=(r=n.fail)&&r.call(n,t,e)}catch(n){}})),null!=(n=e.fail)&&n.call(e,t,e)},vt.prototype.completeHandler=function(t,e){var n;this.callbacks.forEach((function(n){var r;try{null!=(r=n.complete)&&r.call(n,t,e)}catch(n){}})),null!=(n=e.complete)&&n.call(e,t,e)},vt.prototype.override=function(){try{this.defineApiProperty()}catch(t){console.warn("cannot override `"+this.apiName+"`, error is: "+t)}finally{this.isOverride=!0}},vt),tt=wx||qq,et={},nt=(e(yt,N=Q),yt.prototype.defineApiProperty=function(){var t=this;tt.cloud&&tt.cloud[this.apiName]&&Object.defineProperty(tt.cloud,this.apiName,{get:function(){return t.hackHandler.bind(t)}})},yt.prototype.hackHandler=function(t){var e=this,r=this.prefixHandler(t);return new Promise((function(t,i){var o=null==(o=et[e.apiName])?void 0:o.originApi;null!=o&&o(n(n({},r),{success:function(n){e.successHandler(n,r),t(n)},fail:function(t){e.failHandler(t,r),i(t)},complete:function(t){e.completeHandler(t,r)}}))}))},yt),rt=wx||qq,it={},ot=(e(mt,M=Q),mt.prototype.defineApiProperty=function(){var t=this;Object.defineProperty(rt,this.apiName,{get:function(){return t.hackHandler.bind(t)}})},mt.prototype.hackHandler=function(t){var e=this,r=this.prefixHandler(t);return null==(t=null==(t=it[this.apiName])?void 0:t.originApi)?void 0:t(n(n({},r),{success:function(t){e.successHandler(t,r)},fail:function(t){e.failHandler(t,r)},complete:function(t){e.completeHandler(t,r)}}))},mt),at=new H({name:"reportApiSpeed",override:!1,onNewAegis:function(t){this.override||(this.override=!0,this.hackRequest(t.config),this.overrideCallFunction(t.config),this.overrideCallContainer(t.config))},hackRequest:function(t){var e=this;I({apiName:"request",success:function(n,r){var i,o,a,s;t.hostUrl&&-1<r.url.indexOf(t.hostUrl)||(i={method:r.method||"get",url:l(r.url),duration:Date.now()-r.aegisRequestStartTime,status:n.statusCode||0,nextHopProtocol:"",isHttps:u(r.url),type:"fetch"},o=null==(o=t.api)?void 0:o.apiDetail,a=(s=h(n.data,t.api,{url:r.url,ctx:n})||{}).code,s=s.isErr,r="req url: "+i.url+" \n \nreq method: "+i.method+" \n \nreq param: "+(o?b(r.data):"")+" \n \nres duration: "+i.duration+"ms \n \nres status: "+(n.statusCode||0)+" \n \nres retcode: "+a+" \n \nres data: "+(o?d(n.data):""),e.publishNormalLog({msg:r,level:f.API_RESPONSE,ctx:n}),i.ret=a,i.isErr=+s,e.publishSpeedLog(i),s&&e.publishNormalLog({msg:r,level:f.RET_ERROR,ctx:n}))},fail:function(n,r){t.hostUrl&&-1<r.url.indexOf(t.hostUrl)||(r={method:r.method||"get",url:l(r.url),duration:Date.now()-r.aegisRequestStartTime,status:0,nextHopProtocol:"",isHttps:u(r.url),type:"fetch"},e.publishSpeedLog(r))}})},overrideCallFunction:function(t){var e=this;A({apiName:"callFunction",success:function(n,r){e.cloudSuccessCallback(t,r,n,"callFunction")},fail:function(t,n){n={method:"call",url:"wx.cloud.callFunction."+n.name,duration:Date.now()-n.aegisRequestStartTime,status:0,nextHopProtocol:"",type:"fetch",errMsg:t.errMsg,isHttps:!0},e.publishSpeedLog(n)}})},overrideCallContainer:function(t){var e=this;A({apiName:"callContainer",success:function(n,r){e.cloudSuccessCallback(t,r,n,"callContainer")},fail:function(t,n){n={method:"call",url:"wx.cloud.callContainer."+n.path,duration:Date.now()-n.aegisRequestStartTime,status:0,nextHopProtocol:"",type:"fetch",errMsg:t.errMsg,isHttps:!0},e.publishSpeedLog(n)}})},cloudSuccessCallback:function(t,e,n,r){var i="callFunction"===r?e.name:e.path,o="callFunction"===r?n.result:n.data,a=(i={method:"call",url:"wx.cloud."+r+"."+i,duration:Date.now()-e.aegisRequestStartTime,status:200,nextHopProtocol:"",type:"fetch",isHttps:!0},["apiName","aegisRequestStartTime","config","success","fail","complete"]),s=Object.keys(e).reduce((function(t,n){return a.includes(n)||(t[n]=e[n]),t}),{}),c=(r="callFunction"===r?(null==(r=n.data)?void 0:r.code)||0:n.statusCode,(l=h(o,t.api,{url:i.url,ctx:n})||{}).code),l=void 0!==(l=l.isErr)&&l;i.ret=c,i.isErr=+l,t=null==(c=t.api)?void 0:c.apiDetail,c="req url: "+i.url+"\n \nreq type: "+i.type+"\n \nreq params: "+(t?d(s):"")+"\n \nres status: "+r+"\n \nres retcode: "+i.ret+"\n \nres duration: "+i.duration+"ms \n \nres data: "+(t?d(o):"")+"\n ",this.publishNormalLog({msg:c,level:f.API_RESPONSE,ctx:n}),this.publishSpeedLog(i),l&&this.publishNormalLog({msg:c,level:f.RET_ERROR,ctx:n})},publishSpeedLog:function(t){this.$walk((function(e){e.speedLogPipeline(t)}))},publishNormalLog:function(t){this.$walk((function(e){e.normalLogPipeline(t)}))}}),st=wx||qq,ct=st.connectSocket,lt=(gt.prototype.addConfig=function(t){var e=t.send;t=t.onError,e&&this.sends.push(e),t&&this.onErrors.push(t)},gt.prototype.toHack=function(t){var e=this,r=(this.onErrors.forEach((function(e){t.onError(e)})),t.send);return Object.defineProperty(t,"send",{get:function(){return function(i){return new Promise((function(o){r.call(t,n(n({},i),{fail:function(t){e.sends.forEach((function(e){var n;null!=(n=e.fail)&&n.call(e,t,i)})),o(t)}}))}))}}}),t},gt),ut=(e(pt,L=Q),pt.prototype.addTaskConf=function(t){this.taskHack.addConfig(t)},pt.prototype.defineApiProperty=function(){var t=this;Object.defineProperty(st,"connectSocket",{get:function(){return t.hackHandler.bind(t)}})},pt.prototype.hackHandler=function(t){var e=this,r=this.prefixHandler(t);return t=ct(n(n({},r),{success:function(t){e.successHandler(t,r)},fail:function(t){e.failHandler(t,r)},complete:function(t){e.completeHandler(t,r)}})),this.taskHack.toHack(t),t},pt),ht=(Q=new H({name:"onError",onNewAegis:function(t){var e=G.getSystemInfoSync().SDKVersion;this.listenError(),this.hackNetWork(t),this.hackCloud(t),t.config.websocketHack&&R(e,"1.7.0")&&this.hackWsConnect()},listenError:function(){var t=this;"function"==typeof G.onError&&G.onError((function(e){e&&t.publishErrorLog({msg:e,level:f.ERROR})})),O("onUnhandledRejection")&&G.onUnhandledRejection((function(e){!(e=e.reason)||-1<JSON.stringify(e).indexOf("request:fail")||t.publishErrorLog({msg:e,level:f.PROMISE_ERROR})})),O("onPageNotFound")&&G.onPageNotFound((function(e){e&&t.publishErrorLog({msg:e,level:f.PAGE_NOT_FOUND_ERROR})}))},publishErrorLog:function(t){this.$walk((function(e){e.normalLogPipeline(t)}))},hackNetWork:function(t){for(var e=this,n=t.config,r=0,i=[{apiName:"request",complete:function(t,r){return e.requestCompleteError(t,r,n)}},{apiName:"uploadFile",complete:function(t,r){return e.uploadFileCompleteError(t,r,n)}},{apiName:"downloadFile",complete:function(t,r){return e.downloadFileCompleteError(t,r,n)}}];r<i.length;r++){var o;I({apiName:(o=i[r]).apiName,complete:o=o.complete})}},requestCompleteError:function(t,e,n){var r,i=t.errMsg,o=t.statusCode;n.hostUrl&&-1<(null==(r=e.url)?void 0:r.indexOf(n.hostUrl))||(r=this.getErrorType({errMsg:i,statusCode:o}))&&this.publishNetWorkError({apiName:"request",opts:e,res:t,config:n,type:r})},downloadFileCompleteError:function(t,e,n){var r=t.errMsg,i=t.statusCode,o=t.filePath,a=(t=t.tempFilePath,this.getErrorType({errMsg:r,statusCode:i}));a&&(n=null==(n=n.api)?void 0:n.apiDetail,this.publishErrorLog({msg:"AJAX_ERROR: downloadFile "+a+"\n \nres status: "+(i||0)+"\n \nres duration: "+(Date.now()-e.aegisRequestStartTime)+"ms\n \nres filePath: "+o+"\n \nres tempFilePath: "+t+"\n \nreq url: "+e.url+"\n \nreq method: "+(e.method||"get")+"\n \nreq param: "+(n?b(e.data):"")+"\n \nerrMsg: "+r.slice(0,1e3),level:f.AJAX_ERROR}))},uploadFileCompleteError:function(t,e,n){var r=t.errMsg,i=t.statusCode;(r=this.getErrorType({errMsg:r,statusCode:i}))&&this.publishNetWorkError({apiName:"uploadFile",opts:e,res:t,config:n,type:r})},hackCloud:function(t){for(var e=this,n=t.config,r=0,i=[{apiName:"callFunction",complete:function(t,r){return e.callFunctionCompleteError(t,r,n)}},{apiName:"callContainer",complete:function(t,r){return e.callContainerCompleteError(t,r,n)}}];r<i.length;r++){var o;A({apiName:(o=i[r]).apiName,complete:o=o.complete})}},callFunctionCompleteError:function(t,e,n){(-1<t.errMsg.indexOf("fail")||-1<t.errMsg.indexOf("timeout"))&&(n=null==(n=n.api)?void 0:n.apiDetail,this.publishErrorLog({msg:"AJAX_ERROR: cloud.callFunction:fail\n \nres status: 0\n \nres duration: "+(Date.now()-e.aegisRequestStartTime)+"ms\n \nres data: "+(n?b(t):"")+"\n \nreq url: cloud.callFunction."+e.name+"\n \nreq method: POST\n \nreq param: "+(n?b(e.data):"")+"\n \nerrMsg: "+t.errMsg.slice(0,1e3),level:f.AJAX_ERROR}))},callContainerCompleteError:function(t,e,n){var r=t.errMsg,i=t.statusCode;(400<=i||-1<r.indexOf("fail")||-1<r.indexOf("timeout"))&&(n=null==(n=n.api)?void 0:n.apiDetail,this.publishErrorLog({msg:"AJAX_ERROR: cloud.callContainer:fail\n \nres status: "+(i||0)+"\n \nres duration: "+(Date.now()-e.aegisRequestStartTime)+"ms\n \nres data: "+(n?b(t):"")+"\n \nreq url: "+e.path+"\n \nreq method: "+(e.method||"POST")+"\n \nreq param: "+(n?b(e.data):"")+"\n \nerrMsg: "+r.slice(0,1e3),level:f.AJAX_ERROR}))},publishNetWorkError:function(t){var e=t.apiName,n=t.opts,r=t.res,i=t.config,o=(t=t.type,r.errMsg),a=r.statusCode,s=r.data,c=null==(c=i.api)?void 0:c.apiDetail,l="wx.cloud.callFunction."+n.url;i=h(s,i.api,{url:l,ctx:r}).code,this.publishErrorLog({msg:"AJAX_ERROR: "+e+" "+t+"\n \nres status: "+(a||0)+"\n \nres retcode: "+i+"\n \nres duration: "+(Date.now()-n.aegisRequestStartTime)+"ms\n \nres data: "+(c?b(s):"")+"\n \nreq url: "+n.url+"\n \nreq method: "+(n.method||"get")+"\n \nreq param: "+(c?b(n.data):"")+"\n \nerrMsg: "+o.slice(0,1e3),level:f.AJAX_ERROR})},getErrorType:function(t){var e=t.errMsg,n=(t=t.statusCode,"");return-1<e.indexOf("timeout")||-1<e.indexOf("超时")?n="timeout":400<=t?n="error":(-1<e.indexOf("fail")||!t||t<0)&&(n="failed"),n},hackWsConnect:function(){var t,e,n=this;I({apiName:"sendSocketMessage",fail:function(t){n.publishSocketError(t)}}),t=(e={connectCallback:{fail:function(t){n.publishSocketError(t)}},taskOpt:{onError:function(t){n.publishSocketError(t)},send:{fail:function(t){n.publishSocketError(t)}}}}).connectCallback,e=e.taskOpt,F?F.addCallback(t):F=new ut(t),e&&F.addTaskConf(e)},publishSocketError:function(t){t&&this.publishErrorLog({msg:t.errMsg,level:f.WEBSOCKET_ERROR})}}),new H({name:"reportAssetSpeed",isStart:!1,onNewAegis:function(t){this.isStart||(this.isStart=!0,this.start(t))},start:function(){var t=this;G.getPerformance&&G.getPerformance().createObserver((function(e){null!=(e=e.getEntries())&&e.forEach((function(e){"number"!=typeof e.duration||e.duration<=0||t.publishAssetLog(e)}))})).observe({entryTypes:["resource"]})},generateLog:function(t){return{url:""+l(t.uri),method:"get",duration:Math.round(100*t.duration)/100,status:200,type:"static",isHttps:!0,urlQuery:"",nextHopProtocol:"",domainLookup:0,connectTime:0}},publishAssetLog:function(t){var e=this;this.$walk((function(n){n.speedLogPipeline(e.generateLog(t))}))}})),dt=["onLaunch","onHide","onError","onLoad","onReady","onShow","onUnload"],ft=new H({name:"pagePerformance",pageNavigationStartTime:{},onNewAegis:function(t){try{O("getPerformance")&&this.reportPerformance(t),this.setPagePV(t),this.reportSetDataTiming(t)}catch(t){}},reportPerformance:function(t){var e=this,n=null==(n=G.getPerformance())?void 0:n.createObserver((function(n){var r={},i=null==(i=n.getEntriesByName("appLaunch"))?void 0:i[0],o=null==(o=n.getEntriesByName("firstRender"))?void 0:o[0],a=null==(a=n.getEntriesByName("evaluateScript"))?void 0:a[0],s=null==(s=n.getEntriesByName("route"))?void 0:s[0],c=null==(c=null==(c=n.getEntriesByName("firstPaint"))?void 0:c[0])?void 0:c.startTime,l=null==(l=(null==(l=n.getEntriesByName("firstPaint"))?void 0:l[0])||(null==(l=n.getEntriesByName("route"))?void 0:l[0])||(null==(l=n.getEntriesByName("appLaunch"))?void 0:l[0]))?void 0:l.pageId,u=null==(n=(null==(u=n.getEntriesByName("route"))?void 0:u[0])||(null==(u=n.getEntriesByName("appLaunch"))?void 0:u[0]))?void 0:n.startTime;l&&(e.pageNavigationStartTime[l]=null,u&&(e.pageNavigationStartTime[l]=u)),i&&(r.appLaunch=i.duration),o&&(r.firstScreenTiming=o.duration),a&&(r.scriptEvaluateTiming=a.duration),s&&(r.pageRouteTiming=s.duration),c&&u?r.firstPaintTiming=Math.max(c-u,0):c&&e.pageNavigationStartTime[l]&&(r.firstPaintTiming=Math.max(c-e.pageNavigationStartTime[l],0)),e.publish(r,t)}));null!=n&&n.observe({entryTypes:["navigation","render","script"]})},publish:function(t,e){var n,r,i,o=[],a=e.config,s=-1===(null==(n=e.config.performanceUrl)?void 0:n.indexOf("?"))?"?":"&";for(r in t)o.push(r+"="+t[r]);"function"==typeof a.urlHandler?(i=a.urlHandler()||window.location.href,this.$walk((function(n){n.send({url:e.config.performanceUrl+s+o.join("&")+"&from="+encodeURIComponent(i),beanFilter:["from"],type:m.PERFORMANCE,log:t})}))):this.$walk((function(n){n.send({url:e.config.performanceUrl+s+o.join("&"),type:m.PERFORMANCE,log:t})}))},setPagePV:function(t){var e=this;G.onAppRoute&&G.onAppRoute((function(t){"appLaunch"!==t.openType&&(e.$walk((function(t){t.send({url:""+t.config.pvUrl,type:m.PV})})),e.reportPageLoaded(t))}))},reportPageLoaded:function(t){t="infoType: behaviorBacktracking\ndataType: pageLoadAndRoute\npageLoadedPath: "+t.path+"\nopenType: "+t.openType,this.publishNormalLog({msg:t,level:f.INFO})},publishNormalLog:function(t){this.$walk((function(e){e.normalLogPipeline(t)}))},reportSetDataTiming:function(t){var e,n,r,i,o,a,s,c,l,u,h=this;!0!==(u=(u=t.config).setDataReportConfig||(null==(u=u.pagePerformance)?void 0:u.setDataReportConfig)||{}).disabled&&(e=u.timeThreshold,n=!1!==u.withDataPaths,r=e&&0<+e?+e:30,i=k([x(t,10),function(e){e=e.map((function(t){return{type:m.SET_DATA,component:t.from,duration:t.duration,fields:t.dataPaths&&t.dataPaths.length?t.dataPaths.sort().join(";"):void 0,size:t.size}})),t.send({url:t.config.setDataReportUrl+"?payload="+encodeURIComponent(JSON.stringify({miniProgramData:e})),type:m.SET_DATA,log:e})}]),o=Page,a=Component,s=function(t,e){var n=0;return null!=t&&t.data?(e.forEach((function(e){for(var r=t.data[e[0]],i=1,o=e.length;i<o;i++)r[e[i]]&&(r=r[e[i]]);var a="";try{a=JSON.stringify(r)}catch(e){a=""}n+=2*(void 0===a?"":a).replace(/[\u4e00-\u9fa5]/g,"aa").length})),n=Math.min(n,10485760)):n},c=function(t,e){var o=e.updateStartTimestamp,a=e.updateEndTimestamp;e=void 0===(e=e.dataPaths)?[]:e,a-=o,isNaN(a)||a<r||(o={from:t.is,duration:a},n&&0<e.length&&Object.assign(o,{dataPaths:e.slice(0,30),size:s(t,e)}),i(o))},l=function(t){var e="infoType: behaviorBacktracking\ndataType: tapEvent"+Object.keys(t[0]).reduce((function(e,n){var r="";try{r=n+": "+JSON.stringify(t[0][n])}catch(e){r=""}return e+"\n"+r}),"");h.publishNormalLog({msg:e,level:f.INFO})},Page=function(t){var e=t.onReady;return t.onReady=function(){var t=this;return"function"==typeof this.setUpdatePerformanceListener&&this.setUpdatePerformanceListener({withDataPaths:n},(function(e){c(t,e)})),null==e?void 0:e.call(this)},Object.keys(t).forEach((function(e){var n;"function"!=typeof t[e]||dt.includes(e)||(n=t[e],t[e]=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return null!=t&&t[0]&&"tap"===t[0].type&&l(t),null==n?void 0:n.apply(this,t)})})),o(t)},Component=function(t){t.lifetimes&&t.lifetimes.attached?(e=t.lifetimes.attached,t.lifetimes.attached=function(){var t=this;return"function"==typeof this.setUpdatePerformanceListener&&this.setUpdatePerformanceListener({withDataPaths:n},(function(e){c(t,e)})),null==e?void 0:e.call(this)}):(r=t.attached,t.attached=function(){var t=this;return"function"==typeof this.setUpdatePerformanceListener&&this.setUpdatePerformanceListener({withDataPaths:n},(function(e){c(t,e)})),null==r?void 0:r.call(this)});var e,r,i=t.methods;return i&&"[object Object]"===Object.prototype.toString.call(i)&&Object.keys(i).forEach((function(t){var e;"function"==typeof i[t]&&(e=i[t],i[t]=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return null!=t&&t[0]&&"tap"===t[0].type&&l(t),null==e?void 0:e.apply(this,t)})})),a(t)})}});function pt(t){return(t=L.call(this,t)||this).taskHack=new lt,t}function gt(){this.onErrors=[],this.sends=[]}function mt(){return null!==M&&M.apply(this,arguments)||this}function yt(){return null!==N&&N.apply(this,arguments)||this}function vt(t){this.callbacks=[],this.isOverride=!1;var e=t.apiName;this.apiName=e,this.isOverride||this.override(),this.callbacks.push(t)}function _t(t){var e,r,i,o=j.call(this,t)||this;o.originRequest=$,o.speedLogPipeline=k([(r=o.config,i={},function(t,e){var n,o;r.speedSample?(o="object"==typeof r.repeat?r.repeat:{repeat:r.repeat},n=+o.speed||+o.repeat||5,Array.isArray(t)?(o=t.filter((function(t){var e=!i[t.url]||i[t.url]<n;return i[t.url]=1+~~i[t.url],e}))).length&&e(o):(!i[t.url]||i[t.url]<n)&&(i[t.url]=1+~~i[t.url],e(t))):e(t)}),x(o),function(t,n){O("getNetworkType")?G.getNetworkType({success:function(r){r=D(r.networkType),e.extendBean("netType",r),n(t)}}):n(t)},function(t,e){o.lifeCycle.emit("beforeReportSpeed",t);var n=o.config.beforeReportSpeed;if((t="function"==typeof n?t.filter((function(t){return!1!==n(t)})):t).length)return e(t)},C(e=o,m.SPEED),function(t){var e,r,i,a;o.send({url:""+o.config.speedUrl,method:"post",data:(e=o.bean,i={fetch:[],static:[],bridge:[]},a={},Array.isArray(t)?t.forEach((function(t){var e;null!=(e=i[t.type])&&e.push(t)})):null!=(r=i[t.type])&&r.push(t),a.payload=JSON.stringify(n({duration:i},e)),a)})}]),o.requestQueue=[],o.requesting=!1,o.request=function(t,e,r){if(t.url&&o.bean.id){var i,a,s,c,l;if(/^\w{8}-\w{4}-\w{4}-\w{4}-\w{12}$/.test(String(o.bean.aid))&&!(o.requesting||O("getNetworkType")&&void 0===o.bean.netType))return o.requesting=!0,i=t.url,o.config.whiteListUrl===i&&(a=e,e=function(t){null!=a&&a(JSON.stringify(t.data))}),!1!==t.addBean&&(i=i+(-1===i.indexOf("?")?"?":"&")+o.getBean),u=t.method||"get",s=function(){o.requesting=!1;var t=o.requestQueue.shift();t&&o.request(t.options,t.success,t.fail)},c=t,(c=(l=o.config.onBeforeRequest)?l(t,o):c)&&c.url?(l=o.config.enableHttp2||!1,"get"===u?(u=i,h=c.data,i="string"!=typeof u?"":"object"==typeof h&&h?(d=Object.getOwnPropertyNames(h).map((function(t){var e=h[t];return t+"="+("string"==typeof e?encodeURIComponent(e):encodeURIComponent(JSON.stringify(e)))})).join("&").replace(/eval/gi,"evaI"),u+(-1===u.indexOf("?")?"?":"&")+d):u,o.originRequest(n({url:i,enableHttp2:l,success:e,fail:r,complete:s},t.requestConfig))):("string"==typeof c.data&&(c.data=c.data.replace(/eval/gi,"evaI")),o.originRequest(n({url:i,enableHttp2:l,header:c.contentType?{"content-type":c.contentType}:void 0,method:"POST",data:c.data,success:e,fail:r,complete:s},t.requestConfig))),!0):(d="",c&&c.url||(d="Sending request blocked. Please handle the parameters reasonably, options.url is necessary",console.log(d)),null!=r&&r(d),s(),!1);o.requestQueue.push({options:t,success:e,fail:r})}var u,h,d};try{t.offlineLog&&o.initOfflineLog(),o.init(t),o.extendBean("sessionId",_t.sessionID),o.extendBean("referer",(O("getLaunchOptionsSync")?G.getLaunchOptionsSync():{scene:""}).scene||"")}catch(t){console.warn(t),console.log("%cThe above error occurred in the process of initializing Aegis, which will affect your normal use of Aegis.\nIt is recommended that you contact us for feedback and thank you for your support.","color: red"),o.sendSDKError(t)}return o}function bt(t){var e,n,r=this,i=void 0===(i=(t=void 0===t?{}:t).path)?"/.aegis.offline.log":i;t=void 0===(t=t.limit)?2e4:t,this.offlineBuffer=[],this.insertLog=(e=null,n=[],function(t){n=n.concat(t),e=e||setTimeout((function(){e=null;var t,i=r.fileSystem,o=r.filePath,a=n.map((function(t){return JSON.stringify(t)})).join("\n")+"\n";a&&(t=function(t){t?r.checkLimit(a,(function(){n=[]})):i.writeFile({data:a,filePath:o,encoding:"utf8",fail:function(t){console.error(t)},success:function(){n=[]}})},i.access({path:o,success:function(){t(!0)},fail:function(){t()}}))}),2e3)}),this.ready=function(t){r.fileSystem?setTimeout((function(){t(null)}),0):(t(new Error("getFileSystemManager file")),r.offlineLog=!1)},this.clearLogs=function(){var t=r.fileSystem,e=r.filePath;t.writeFile({filePath:e,data:"",fail:function(){t.unlinkSync(e)}})},this.save2Offline=function(t,e){t=(t=Array.isArray(t)?t:[t]).map((function(t){return"string"==typeof t&&(t={msg:t}),function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];if(0===t.length)throw new TypeError("Cannot convert undefined or null to object");for(var n=Object(t[0]),r=1;r<t.length;r++){var i=t[r];if(null!==i)for(var o in i)Object.prototype.hasOwnProperty.call(i,o)&&(n[o]=i[o])}return n}({id:e.id,uin:e.uin,time:+Date.now(),version:e.version,from:P(e)},t)})),r.fileSystem?r.insertLog(t):(r.fileSystem||r.offlineBuffer.length||r.ready((function(t){t?console.error(t):r.offlineBuffer.length&&(r.addLogs(r.offlineBuffer),r.offlineBuffer=[])})),r.offlineBuffer=r.offlineBuffer.concat(t))},this.addLogs=function(t){r.fileSystem&&r.insertLog(t)},this.filePath=G.env.USER_DATA_PATH+i,this.fileSystem=G.getFileSystemManager(),this.limitSize=t}function xt(t){this.aegisPlugin=!0,this.name="",this.instances=[],this.inited=!1,t.$walk=this.walk.bind(this),t.$getConfig=this.getConfig.bind(this),this.option=t,this.name=t.name}function wt(t){var e,n,r,i,o,s,c,l,u,h,d,p,g,y,v,_=this;this.isGetSample=!1,this.isHidden=!1,this.config={version:0,delay:1e3,onError:!0,repeat:5,random:1,aid:!0,device:!0,pagePerformance:!0,webVitals:!0,speedSample:!0,onClose:!0,hostUrl:"https://aegis.qq.com",websocketHack:!1,env:"production",url:"",offlineUrl:"",whiteListUrl:"",pvUrl:"",speedUrl:"",customTimeUrl:"",performanceUrl:"",webVitalsUrl:"",eventUrl:"",setDataReportUrl:"",reportImmediately:!0},this.isWhiteList=!1,this.lifeCycle=new a,this.bean={},this.normalLogPipeline=k([x(this,5),w,function(t,n){var r=e.config;n(t=t.map((function(t){var e,n=r.maxLength||204800;try{if(!t.msg||t.msg.length<=n)return t;t.msg=null==(e=t.msg)?void 0:e.substring(0,n)}catch(e){t.msg=b(t.msg).substring(0,r.maxLength)}return t})))},(y=(e=this).config,v={},function(t,e){var n="number"==typeof y.repeat?y.repeat:5;if(0===n)return e(t);e(t.filter((function(t){return t.level!==f.ERROR&&t.level!==f.PROMISE_ERROR&&t.level!==f.AJAX_ERROR&&t.level!==f.SCRIPT_ERROR&&t.level!==f.IMAGE_ERROR&&t.level!==f.CSS_ERROR&&t.level!==f.MEDIA_ERROR||(v[t.msg]=v[t.msg]||0,v[t.msg]+=1,!(v[t.msg]>n))})))}),(p=this.lifeCycle.emit,g=this.config,function(t,e){var n,r=g.logCreated;return"function"==typeof r?(n=t.filter((function(t){return!1!==r(t)})),p("beforeWrite",n),e(n)):(p("beforeWrite",t),e(t))}),(d=this,setTimeout((function(){var t=d.config.pvUrl,e=void 0===t?"":t;e&&d.sendPipeline([function(t,n){n({url:e,type:m.PV,fail:function(t){"403 forbidden"===t&&d.destroy()}})}],m.PV)(null)}),100),function(t,e){e(t)}),(u=l=c=!1,h=[],(o=this).lifeCycle.on("onConfigChange",(function(){s&&clearTimeout(s),s=setTimeout((function(){var t,e;!u&&o.config&&(u=!0,t=o.config.whiteListUrl,(e=void 0===t?"":t)&&o.sendPipeline([function(t,n){n({url:e,type:m.WHITE_LIST,success:function(t){l=!0;try{var e=t.data||JSON.parse(t),n=e.retcode,r=e.result,i=void 0===r?{}:r;if(0===n){if(c=i.is_in_white_list,o.isWhiteList=c,i.shutdown)return void o.destroy();0<=i.rate&&i.rate<=1&&(o.config.random=i.rate,o.isGetSample=!1)}o.isWhiteList&&h.length?W(o)(h.splice(0),(function(){})):!o.isWhiteList&&h.length&&(h.length=0);var a=o.config.onWhitelist;"function"==typeof a&&a(c)}catch(t){}},fail:function(t){"403 forbidden"===t&&o.destroy(),l=!0}})}],m.WHITE_LIST)(null),u=!1)}),o.config.uin?50:500)})),o.lifeCycle.on("destroy",(function(){h.length=0})),function(t,e){var n;c||null!=(n=null==(n=o.config)?void 0:n.api)&&n.reportRequest?e(t.concat(h.splice(0)).map((function(t){return B(t),t}))):(n=t.filter((function(t){return t.level!==f.INFO&&t.level!==f.API_RESPONSE?(B(t),!0):(l||(h.push(t),200<=h.length&&(h.length=200)),!1)}))).length&&e(n)}),function(t,e){try{var n=JSON.parse(JSON.stringify(t)),r=(_.lifeCycle.emit("beforeReport",n),_.config.beforeReport);(t="function"==typeof r?t.filter((function(t){return!1!==r(t)})):t).length&&e(t)}catch(t){}},W(this)]),this.eventPipeline=k([x(this,10),(i=this,function(t){i.sendPipeline([function(t,e){var n=t.map((function(t){return{name:t.name,ext1:t.ext1||i.config.ext1||"",ext2:t.ext2||i.config.ext2||"",ext3:t.ext3||i.config.ext3||""}}));e({url:i.config.eventUrl+"?payload="+encodeURIComponent(JSON.stringify(n)),type:m.EVENT,log:t,fail:function(t){"403 forbidden"===t&&i.destroy()}})}],m.EVENT)(t)})]),this.timeMap={},this.failRequestCount=0,this.customTimePipeline=k([x(this,10),(r=this,function(t){return r.sendPipeline([function(t,e){e({url:r.config.customTimeUrl+"?payload="+encodeURIComponent(JSON.stringify({custom:t})),type:m.CUSTOM,log:t,fail:function(t){"403 forbidden"===t&&r.destroy()}})}],m.CUSTOM)(t)})]),this.config=(n=this.config,void 0===(t=t.hostUrl)&&(t="https://aegis.qq.com"),n.url=n.url||t+"/collect",n.offlineUrl=n.offlineUrl||t+"/offline",n.whiteListUrl=n.whiteListUrl||t+"/collect/whitelist",n.pvUrl=n.pvUrl||t+"/collect/pv",n.eventUrl=n.eventUrl||t+"/collect/events",n.speedUrl=n.speedUrl||t+"/speed",n.customTimeUrl=n.customTimeUrl||t+"/speed/custom",n.performanceUrl=n.performanceUrl||t+"/speed/performance",n.webVitalsUrl=n.webVitalsUrl||t+"/speed/webvitals",n.setDataReportUrl=n.SetDataReportUrl||t+"/speed/miniProgramData",n),wt.instances.push(this)}return H=new H({name:"reportLoadPackageSpeed",isLoaded:!1,onNewAegis:function(t){this.isLoaded||(this.isLoaded=!0,this.start(t))},start:function(){var t=this;G.getPerformance&&G.getPerformance().createObserver((function(e){null!=(e=e.getEntries())&&e.forEach((function(e){"number"!=typeof e.duration||e.duration<=0||t.publishPackageLog(e)}))})).observe({entryTypes:["loadPackage"]})},generateLog:function(t){return[{type:m.LOAD_PACKAGE,packageName:t.packageName,size:Math.round(100*t.packageSize)/100,duration:Math.round(100*t.duration)/100}]},publishPackageLog:function(t){var e=this;this.$walk((function(n){var r=e.generateLog(t);n.send({url:n.config.setDataReportUrl+"?payload="+encodeURIComponent(JSON.stringify({miniProgramData:r})),type:m.LOAD_PACKAGE,log:r})}))}}),q.use(Q),q.use(at),q.use(J),q.use(ht),q.use(ft),q.use(H),q.use(X),q}()},1615:(t,e,n)=>{n.d(e,{Z:()=>wt});var r={};n.r(r),n.d(r,{Canvas:()=>O,Element:()=>k,HTMLElement:()=>E,HTMLMediaElement:()=>P,HTMLVideoElement:()=>R,Image:()=>j,MouseEvent:()=>$,PointerEvent:()=>V,Symbol:()=>tt,TouchEvent:()=>z,WebGLRenderingContext:()=>U,XMLHttpRequest:()=>lt,alert:()=>ht,blur:()=>ft,clearInterval:()=>yt,clearTimeout:()=>gt,devicePixelRatio:()=>d,focus:()=>dt,getComputedStyle:()=>ut,innerHeight:()=>p,innerWidth:()=>f,location:()=>et,navigator:()=>N,performance:()=>l,screen:()=>g,scrollX:()=>m,scrollY:()=>y,setInterval:()=>mt,setTimeout:()=>pt});const i={0:"animation-delay",1:"animation-direction",2:"animation-duration",3:"animation-fill-mode",4:"animation-iteration-count",5:"animation-name",6:"animation-play-state",7:"animation-timing-function",8:"background-attachment",9:"background-blend-mode",10:"background-clip",11:"background-color",12:"background-image",13:"background-origin",14:"background-position",15:"background-repeat",16:"background-size",17:"border-bottom-color",18:"border-bottom-left-radius",19:"border-bottom-right-radius",20:"border-bottom-style",21:"border-bottom-width",22:"border-collapse",23:"border-image-outset",24:"border-image-repeat",25:"border-image-slice",26:"border-image-source",27:"border-image-width",28:"border-left-color",29:"border-left-style",30:"border-left-width",31:"border-right-color",32:"border-right-style",33:"border-right-width",34:"border-top-color",35:"border-top-left-radius",36:"border-top-right-radius",37:"border-top-style",38:"border-top-width",39:"bottom",40:"box-shadow",41:"box-sizing",42:"break-after",43:"break-before",44:"break-inside",45:"caption-side",46:"clear",47:"clip",48:"color",49:"content",50:"cursor",51:"direction",52:"display",53:"empty-cells",54:"float",55:"font-family",56:"font-kerning",57:"font-size",58:"font-stretch",59:"font-style",60:"font-variant",61:"font-variant-ligatures",62:"font-variant-caps",63:"font-variant-numeric",64:"font-variant-east-asian",65:"font-weight",66:"height",67:"image-rendering",68:"isolation",69:"justify-items",70:"justify-self",71:"left",72:"letter-spacing",73:"line-height",74:"list-style-image",75:"list-style-position",76:"list-style-type",77:"margin-bottom",78:"margin-left",79:"margin-right",80:"margin-top",81:"max-height",82:"max-width",83:"min-height",84:"min-width",85:"mix-blend-mode",86:"object-fit",87:"object-position",88:"offset-distance",89:"offset-path",90:"offset-rotate",91:"opacity",92:"orphans",93:"outline-color",94:"outline-offset",95:"outline-style",96:"outline-width",97:"overflow-anchor",98:"overflow-wrap",99:"overflow-x",100:"overflow-y",101:"padding-bottom",102:"padding-left",103:"padding-right",104:"padding-top",105:"pointer-events",106:"position",107:"resize",108:"right",109:"scroll-behavior",110:"speak",111:"table-layout",112:"tab-size",113:"text-align",114:"text-align-last",115:"text-decoration",116:"text-decoration-line",117:"text-decoration-style",118:"text-decoration-color",119:"text-decoration-skip-ink",120:"text-underline-position",121:"text-indent",122:"text-rendering",123:"text-shadow",124:"text-size-adjust",125:"text-overflow",126:"text-transform",127:"top",128:"touch-action",129:"transition-delay",130:"transition-duration",131:"transition-property",132:"transition-timing-function",133:"unicode-bidi",134:"vertical-align",135:"visibility",136:"white-space",137:"widows",138:"width",139:"will-change",140:"word-break",141:"word-spacing",142:"word-wrap",143:"z-index",144:"zoom",145:"-webkit-appearance",146:"backface-visibility",147:"-webkit-border-horizontal-spacing",148:"-webkit-border-image",149:"-webkit-border-vertical-spacing",150:"-webkit-box-align",151:"-webkit-box-decoration-break",152:"-webkit-box-direction",153:"-webkit-box-flex",154:"-webkit-box-flex-group",155:"-webkit-box-lines",156:"-webkit-box-ordinal-group",157:"-webkit-box-orient",158:"-webkit-box-pack",159:"-webkit-box-reflect",160:"column-count",161:"column-gap",162:"column-rule-color",163:"column-rule-style",164:"column-rule-width",165:"column-span",166:"column-width",167:"align-content",168:"align-items",169:"align-self",170:"flex-basis",171:"flex-grow",172:"flex-shrink",173:"flex-direction",174:"flex-wrap",175:"justify-content",176:"-webkit-font-smoothing",177:"grid-auto-columns",178:"grid-auto-flow",179:"grid-auto-rows",180:"grid-column-end",181:"grid-column-start",182:"grid-template-areas",183:"grid-template-columns",184:"grid-template-rows",185:"grid-row-end",186:"grid-row-start",187:"grid-column-gap",188:"grid-row-gap",189:"-webkit-highlight",190:"hyphens",191:"-webkit-hyphenate-character",192:"-webkit-line-break",193:"-webkit-line-clamp",194:"-webkit-locale",195:"-webkit-margin-before-collapse",196:"-webkit-margin-after-collapse",197:"-webkit-mask-box-image",198:"-webkit-mask-box-image-outset",199:"-webkit-mask-box-image-repeat",200:"-webkit-mask-box-image-slice",201:"-webkit-mask-box-image-source",202:"-webkit-mask-box-image-width",203:"-webkit-mask-clip",204:"-webkit-mask-composite",205:"-webkit-mask-image",206:"-webkit-mask-origin",207:"-webkit-mask-position",208:"-webkit-mask-repeat",209:"-webkit-mask-size",210:"order",211:"perspective",212:"perspective-origin",213:"-webkit-print-color-adjust",214:"-webkit-rtl-ordering",215:"shape-outside",216:"shape-image-threshold",217:"shape-margin",218:"-webkit-tap-highlight-color",219:"-webkit-text-combine",220:"-webkit-text-decorations-in-effect",221:"-webkit-text-emphasis-color",222:"-webkit-text-emphasis-position",223:"-webkit-text-emphasis-style",224:"-webkit-text-fill-color",225:"-webkit-text-orientation",226:"-webkit-text-security",227:"-webkit-text-stroke-color",228:"-webkit-text-stroke-width",229:"transform",230:"transform-origin",231:"transform-style",232:"-webkit-user-drag",233:"-webkit-user-modify",234:"user-select",235:"-webkit-writing-mode",236:"-webkit-app-region",237:"buffered-rendering",238:"clip-path",239:"clip-rule",240:"mask",241:"filter",242:"flood-color",243:"flood-opacity",244:"lighting-color",245:"stop-color",246:"stop-opacity",247:"color-interpolation",248:"color-interpolation-filters",249:"color-rendering",250:"fill",251:"fill-opacity",252:"fill-rule",253:"marker-end",254:"marker-mid",255:"marker-start",256:"mask-type",257:"shape-rendering",258:"stroke",259:"stroke-dasharray",260:"stroke-dashoffset",261:"stroke-linecap",262:"stroke-linejoin",263:"stroke-miterlimit",264:"stroke-opacity",265:"stroke-width",266:"alignment-baseline",267:"baseline-shift",268:"dominant-baseline",269:"text-anchor",270:"writing-mode",271:"vector-effect",272:"paint-order",273:"d",274:"cx",275:"cy",276:"x",277:"y",278:"r",279:"rx",280:"ry",281:"caret-color",282:"line-break",display:"inline",dominantBaseline:"auto",emptyCells:"show",fill:"rgb(0, 0, 0)",fillOpacity:"1",fillRule:"nonzero",filter:"none",flex:"0 1 auto",flexBasis:"auto",flexDirection:"row",flexFlow:"row nowrap",flexGrow:"0",flexShrink:"1",flexWrap:"nowrap",float:"none",floodColor:"rgb(0, 0, 0)",floodOpacity:"1",font:'normal normal 400 normal 16px / normal "PingFang SC"',fontDisplay:"",fontFamily:'"PingFang SC"',fontFeatureSettings:"normal",fontKerning:"auto",fontSize:"16px",fontStretch:"100%",fontStyle:"normal",fontVariant:"normal",fontVariantCaps:"normal",fontVariantEastAsian:"normal",fontVariantLigatures:"normal",fontVariantNumeric:"normal",fontVariationSettings:"normal",fontWeight:"400",grid:"none / none / none / row / auto / auto",gridArea:"auto / auto / auto / auto",gridAutoColumns:"auto",gridAutoFlow:"row",gridAutoRows:"auto",gridColumn:"auto / auto",gridColumnEnd:"auto",gridColumnGap:"0px",gridColumnStart:"auto",gridGap:"0px 0px",gridRow:"auto / auto",gridRowEnd:"auto",gridRowGap:"0px",gridRowStart:"auto",gridTemplate:"none / none / none",gridTemplateAreas:"none",gridTemplateColumns:"none",gridTemplateRows:"none",height:"0px",hyphens:"manual",imageRendering:"auto",inlineSize:"0px",isolation:"auto",justifyContent:"normal",justifyItems:"normal",justifySelf:"auto",left:"auto",letterSpacing:"normal",lightingColor:"rgb(255, 255, 255)",lineBreak:"auto",lineHeight:"normal",listStyle:"disc outside none",listStyleImage:"none",listStylePosition:"outside",listStyleType:"disc",margin:"0px",marginBottom:"0px",marginLeft:"0px",marginRight:"0px",marginTop:"0px",marker:"",markerEnd:"none",markerMid:"none",markerStart:"none",mask:"none",maskType:"luminance",maxBlockSize:"none",maxHeight:"none",maxInlineSize:"none",maxWidth:"none",maxZoom:"",minBlockSize:"0px",minHeight:"0px",minInlineSize:"0px",minWidth:"0px",minZoom:"",mixBlendMode:"normal",objectFit:"fill",objectPosition:"50% 50%",offset:"none 0px auto 0deg",offsetDistance:"0px",offsetPath:"none",offsetRotate:"auto 0deg",opacity:"1",order:"0",orientation:"",orphans:"2",outline:"rgb(0, 0, 0) none 0px",outlineColor:"rgb(0, 0, 0)",outlineOffset:"0px",outlineStyle:"none",outlineWidth:"0px",overflow:"visible",overflowAnchor:"auto",overflowWrap:"normal",overflowX:"visible",overflowY:"visible",overscrollBehavior:"auto auto",overscrollBehaviorX:"auto",overscrollBehaviorY:"auto",padding:"0px",paddingBottom:"0px",paddingLeft:"0px",paddingRight:"0px",paddingTop:"0px",page:"",pageBreakAfter:"auto",pageBreakBefore:"auto",pageBreakInside:"auto",paintOrder:"fill stroke markers",perspective:"none",perspectiveOrigin:"0px 0px",placeContent:"normal normal",placeItems:"normal normal",placeSelf:"auto auto",pointerEvents:"auto",position:"static",quotes:"",r:"0px",resize:"none",right:"auto",rx:"auto",ry:"auto",scrollBehavior:"auto",shapeImageThreshold:"0",shapeMargin:"0px",shapeOutside:"none",shapeRendering:"auto",size:"",speak:"normal",src:"",stopColor:"rgb(0, 0, 0)",stopOpacity:"1",stroke:"none",strokeDasharray:"none",strokeDashoffset:"0px",strokeLinecap:"butt",strokeLinejoin:"miter",strokeMiterlimit:"4",strokeOpacity:"1",strokeWidth:"1px",tabSize:"8",tableLayout:"auto",textAlign:"start",textAlignLast:"auto",textAnchor:"start",textCombineUpright:"none",textDecoration:"none solid rgb(0, 0, 0)",textDecorationColor:"rgb(0, 0, 0)",textDecorationLine:"none",textDecorationSkipInk:"auto",textDecorationStyle:"solid",textIndent:"0px",textOrientation:"mixed",textOverflow:"clip",textRendering:"auto",textShadow:"none",textSizeAdjust:"auto",textTransform:"none",textUnderlinePosition:"auto",top:"auto",touchAction:"auto",transform:"none",transformBox:"view-box",transformOrigin:"0px 0px",transformStyle:"flat",transition:"all 0s ease 0s",transitionDelay:"0s",transitionDuration:"0s",transitionProperty:"all",transitionTimingFunction:"ease",unicodeBidi:"normal",unicodeRange:"",userSelect:"auto",userZoom:"",vectorEffect:"none",verticalAlign:"baseline",visibility:"visible",webkitAppRegion:"no-drag",webkitAppearance:"none",webkitBorderAfter:"0px none rgb(0, 0, 0)",webkitBorderAfterColor:"rgb(0, 0, 0)",webkitBorderAfterStyle:"none",webkitBorderAfterWidth:"0px",webkitBorderBefore:"0px none rgb(0, 0, 0)",webkitBorderBeforeColor:"rgb(0, 0, 0)",webkitBorderBeforeStyle:"none",webkitBorderBeforeWidth:"0px",webkitBorderEnd:"0px none rgb(0, 0, 0)",webkitBorderEndColor:"rgb(0, 0, 0)",webkitBorderEndStyle:"none",webkitBorderEndWidth:"0px",webkitBorderHorizontalSpacing:"0px",webkitBorderImage:"none",webkitBorderStart:"0px none rgb(0, 0, 0)",webkitBorderStartColor:"rgb(0, 0, 0)",webkitBorderStartStyle:"none",webkitBorderStartWidth:"0px",webkitBorderVerticalSpacing:"0px",webkitBoxAlign:"stretch",webkitBoxDecorationBreak:"slice",webkitBoxDirection:"normal",webkitBoxFlex:"0",webkitBoxFlexGroup:"1",webkitBoxLines:"single",webkitBoxOrdinalGroup:"1",webkitBoxOrient:"horizontal",webkitBoxPack:"start",webkitBoxReflect:"none",webkitColumnBreakAfter:"auto",webkitColumnBreakBefore:"auto",webkitColumnBreakInside:"auto",webkitFontSizeDelta:"",webkitFontSmoothing:"auto",webkitHighlight:"none",webkitHyphenateCharacter:"auto",webkitLineBreak:"auto",webkitLineClamp:"none",webkitLocale:"auto",webkitLogicalHeight:"0px",webkitLogicalWidth:"0px",webkitMarginAfter:"0px",webkitMarginAfterCollapse:"collapse",webkitMarginBefore:"0px",webkitMarginBeforeCollapse:"collapse",webkitMarginBottomCollapse:"collapse",webkitMarginCollapse:"",webkitMarginEnd:"0px",webkitMarginStart:"0px",webkitMarginTopCollapse:"collapse",webkitMask:"",webkitMaskBoxImage:"none",webkitMaskBoxImageOutset:"0px",webkitMaskBoxImageRepeat:"stretch",webkitMaskBoxImageSlice:"0 fill",webkitMaskBoxImageSource:"none",webkitMaskBoxImageWidth:"auto",webkitMaskClip:"border-box",webkitMaskComposite:"source-over",webkitMaskImage:"none",webkitMaskOrigin:"border-box",webkitMaskPosition:"0% 0%",webkitMaskPositionX:"0%",webkitMaskPositionY:"0%",webkitMaskRepeat:"repeat",webkitMaskRepeatX:"",webkitMaskRepeatY:"",webkitMaskSize:"auto",webkitMaxLogicalHeight:"none",webkitMaxLogicalWidth:"none",webkitMinLogicalHeight:"0px",webkitMinLogicalWidth:"0px",webkitPaddingAfter:"0px",webkitPaddingBefore:"0px",webkitPaddingEnd:"0px",webkitPaddingStart:"0px",webkitPerspectiveOriginX:"",webkitPerspectiveOriginY:"",webkitPrintColorAdjust:"economy",webkitRtlOrdering:"logical",webkitRubyPosition:"before",webkitTapHighlightColor:"rgba(0, 0, 0, 0.4)",webkitTextCombine:"none",webkitTextDecorationsInEffect:"none",webkitTextEmphasis:"",webkitTextEmphasisColor:"rgb(0, 0, 0)",webkitTextEmphasisPosition:"over right",webkitTextEmphasisStyle:"none",webkitTextFillColor:"rgb(0, 0, 0)",webkitTextOrientation:"vertical-right",webkitTextSecurity:"none",webkitTextStroke:"",webkitTextStrokeColor:"rgb(0, 0, 0)",webkitTextStrokeWidth:"0px",webkitTransformOriginX:"",webkitTransformOriginY:"",webkitTransformOriginZ:"",webkitUserDrag:"auto",webkitUserModify:"read-only",webkitWritingMode:"horizontal-tb",whiteSpace:"normal",widows:"2",width:"0px",willChange:"auto",wordBreak:"normal",wordSpacing:"0px",wordWrap:"normal",writingMode:"horizontal-tb",x:"0px",y:"0px",zIndex:"auto",zoom:"1"};const o=function(t){const e=t.width,n=t.height;return Object.assign(i,{display:"inline",position:"static",inlineSize:e+"px",perspectiveOrigin:e/2+"px "+n/2+"px",transformOrigin:e/2+"px "+n/2+"px",webkitLogicalWidth:e+"px",webkitLogicalHeight:n+"px",width:e+"px",height:n+"px"})};const a=function(t){const e=t.getBoundingClientRect();return Object.assign(i,{display:"inline",position:"static",inlineSize:e.width+"px",perspectiveOrigin:e.width/2+"px "+e.height/2+"px",transformOrigin:e.width/2+"px "+e.height/2+"px",webkitLogicalWidth:e.width+"px",webkitLogicalHeight:e.height+"px",width:e.width+"px",height:e.height+"px"})};function s(){}let c;if(wx.getPerformance){const{platform:t}=wx.getSystemInfoSync(),e=wx.getPerformance(),n=e.now(),r=Object.assign({},e,{now:function(){return(e.now()-n)/1e3}});c="devtools"===t?e:r}else c={timeOrigin:Date.now(),now:function(){return Date.now()-this.timeOrigin}};const l=c,{screenWidth:u,screenHeight:h,devicePixelRatio:d}=wx.getSystemInfoSync(),f=u,p=h,g={width:u,height:h,availWidth:f,availHeight:p,availLeft:0,availTop:0},m=0,y=0;function v(t,e){if(!("parentNode"in t)){let r;r=0===e?function(){return null}:1===e?function(){return(n.g.document||wx.window.document).documentElement}:function(){if(!n.g||!n.g.document||!wx.window.document)return;return(n.g.document||wx.window.document).body},Object.defineProperty(t,"parentNode",{enumerable:!0,get:r})}if(!("parentElement"in t)){let r;r=0===e?function(){return null}:1===e?function(){return document.documentElement}:function(){return(n.g.document||wx.window.document).body},Object.defineProperty(t,"parentElement",{enumerable:!0,get:r})}}function _(t){t.style=t.style||{},Object.assign(t.style,{top:"0px",left:"0px",width:f+"px",height:p+"px",margin:"0px",padding:"0px"})}function b(t,e){"clientLeft"in t||(t.clientLeft=t._left||0,t.clientTop=t._top||0),"clientWidth"in t||(t.clientWidth=t._width||f,t.clientHeight=t._height||p),"getBoundingClientRect"in t||(t.getBoundingClientRect=function(){const e={x:0,y:0,top:0,left:0,width:t._width||this.clientWidth,height:t._height||this.clientHeight};return e.right=e.width,e.bottom=e.height,e})}function x(t){"offsetLeft"in t||(t.offsetLeft=0,t.offsetTop=0),"offsetWidth"in t||(t.offsetWidth=f,t.offsetHeight=p)}function w(t){const e=function(){};t.classList=[],t.classList.add=e,t.classList.remove=e,t.classList.contains=e,t.classList.toggle=e}const C=new WeakMap;class T{constructor(){C.set(this,{})}addEventListener(t,e,n={}){let r=C.get(this);r||(r={},C.set(this,r)),r[t]||(r[t]=[]),r[t].push(e),n.capture,n.once,n.passive}removeEventListener(t,e,n={}){const r=C.get(this);if(r){const n=r[t];if(n&&n.length>0)for(let t=n.length;t--;t>0)if(n[t]===e){n.splice(t,1);break}}}dispatchEvent(t={}){const e=C.get(this)[t.type];if(e)for(let n=0;n<e.length;n++)e[n](t)}}class S extends T{constructor(){super(),this.childNodes=[]}appendChild(t){this.childNodes.push(t)}cloneNode(){const t=Object.create(this);return Object.assign(t,this),t}removeChild(t){const e=this.childNodes.findIndex((e=>e===t));return e>-1?this.childNodes.splice(e,1):null}}class k extends S{constructor(){super(),this.className="",this.children=[]}setAttribute(t,e){this[t]=e}getAttribute(t){return this[t]}setAttributeNS(t,e){this[t]=e}getAttributeNS(t){return this[t]}}class E extends k{constructor(t="",e){var n;super(),this.className="",this.children=[],this.focus=s,this.blur=s,this.insertBefore=s,this.appendChild=s,this.removeChild=s,this.remove=s,this.innerHTML="",this.tagName=t.toUpperCase(),v(this,e),_(this),w(this),b(this),x(this),"scrollLeft"in(n=this)||(n.scrollLeft=0,n.scrollTop=0),"scrollWidth"in n||(n.scrollWidth=f,n.scrollHeight=p)}}class P extends E{constructor(t){super(t)}addTextTrack(){}captureStream(){}fastSeek(){}load(){}pause(){}play(){}}class R extends P{constructor(){super("video")}}function O(t){let e=t;t||(e=wx.createOffscreenCanvas({type:"webgl"})),"tagName"in e||(e.tagName="CANVAS"),e.type="canvas",v(e),_(e),w(e),b(e),x(e),e.focus=function(){},e.blur=function(){};let n={};return e.addEventListener=function(t,e,r={}){void 0===n[t]&&(n[t]=[]),-1===n[t].indexOf(e)&&n[t].push(e)},e.removeEventListener=function(t,e){const r=n[t];if(void 0!==r){const t=r.indexOf(e);-1!==t&&r.splice(t,1)}},e.dispatchEvent=function(t={}){const e=n[t.type];if(void 0!==e){t.target=this;const n=e.slice(0);for(let e=0,r=n.length;e<r;e++)n[e].call(this,t)}},e}const D=wx.getSystemInfoSync(),A=D.system,I=D.platform,F=D.language,L=-1!==A.toLowerCase().indexOf("android")?"Android; CPU Android 6.0":"iPhone; CPU iPhone OS 10_3_1 like Mac OS X",M={platform:I,language:F,appVersion:`5.0 (${L}) AppleWebKit/601.1.46 (KHTML, like Gecko) Version/9.0 Mobile/13B143 Safari/601.1`,userAgent:`Mozilla/5.0 (${L}) AppleWebKit/603.1.30 (KHTML, like Gecko) Mobile/14E8301 MicroMessenger/6.6.0 MiniGame NetType/WIFI Language/${F}`,onLine:!0,geolocation:{getCurrentPosition:s,watchPosition:s,clearWatch:s}};wx.onNetworkStatusChange&&wx.onNetworkStatusChange((function(t){M.onLine=t.isConnected}));const N=M;function j(){try{let t;j._context;return wx&&wx.createCanvas&&(t=wx.createCanvas().createImage()),"tagName"in t||(t.tagName="IMG"),v(t),w(t),t.__proto__.__proto__=wx.createCanvas().createImage.prototype,t}catch(t){}}class U{constructor(){}}class B{constructor(t){this.cancelBubble=!1,this.cancelable=!1,this.target=null,this.currentTarget=null,this.preventDefault=s,this.stopPropagation=s,this.type=t,this.timeStamp=Date.now()}}class z extends B{constructor(t){super(t),this.touches=[],this.targetTouches=[],this.changedTouches=[],this.target=window.canvas,this.currentTarget=window.canvas}}function W(t){return e=>{const n=new z(t);n.changedTouches=e.changedTouches,n.touches=e.touches,n.targetTouches=Array.prototype.slice.call(e.touches),n.timeStamp=e.timeStamp,document.dispatchEvent(n)}}wx.onTouchStart&&wx.onTouchStart(W("touchstart")),wx.onTouchMove&&wx.onTouchMove(W("touchmove")),wx.onTouchEnd&&wx.onTouchEnd(W("touchend")),wx.onTouchCancel&&wx.onTouchCancel(W("touchcancel"));class V extends B{constructor(t){super(t)}}const q=["bubbles","cancelable","view","detail","screenX","screenY","clientX","clientY","ctrlKey","altKey","shiftKey","metaKey","button","relatedTarget","pointerId","width","height","pressure","tiltX","tiltY","pointerType","hwTimestamp","isPrimary","pageX","pageY","timeStamp"],H=[!1,!1,null,null,0,0,0,0,!1,!1,!1,!1,0,null,0,0,0,0,0,0,0,"",0,!1,0,0,0];function G(t,e,n){const r=new V(t);for(let t=0;t<q.length;t++){const n=q[t];r[n]=e[n]||H[t]}return r.type=t,r.target=window.canvas,r.currentTarget=window.canvas,r.buttons=function(t){let e=0;"touchstart"!==t&&"touchmove"!==t&&"pointerdown"!==t&&"pointermove"!==t||(e=1);return e}(t),r.which=r.buttons,r.pointerId=(e.identifier||0)+2,r.bubbles=!0,r.cancelable=!0,r.button=0,r.width=2*(e.radiusX||.5),r.height=2*(e.radiusY||.5),r.pressure=e.force||.5,r.isPrimary=function(t){return Y===t.identifier}(e),r.pointerType="touch",r.altKey=n.altKey,r.ctrlKey=n.ctrlKey,r.metaKey=n.metaKey,r.shiftKey=n.shiftKey,n.preventDefault&&(r.preventDefault=function(){n.preventDefault()}),r}let Y=null;function Z(t){null===Y&&(Y=t.identifier)}function K(t){Y===t.identifier&&(Y=null)}function X(t){return e=>{console.log("rawEvent",e);const n=e.changedTouches;for(let r=0;r<n.length;r++){const i=n[r];0===r&&"pointerdown"===t?Z(i):"pointerup"!==t&&"pointercancel"!==t||K(i);const o=G(t,i,e);console.log("event dispatch",o),document.dispatchEvent(o)}}}wx.onTouchStart&&wx.onTouchStart(X("pointerdown")),wx.onTouchMove&&wx.onTouchMove(X("pointermove")),wx.onTouchEnd&&wx.onTouchEnd(X("pointerup")),wx.onTouchCancel&&wx.onTouchCancel(X("pointercancel"));class $ extends B{constructor(t){super(t)}}let J=0;const Q=function(t){return`__${t}_${Math.floor(1e9*Math.random())}_${++J}__`};Q.iterator=Q("Symbol.iterator");const tt=Q,et={href:"clip.js",reload(){},replace(t){this.href=t}},nt=new WeakMap,rt=new WeakMap,it=new WeakMap,ot=new WeakMap,at=new WeakMap;function st(t,...e){"function"==typeof this[`on${t}`]&&this[`on${t}`].apply(this,e)}function ct(t){this.readyState=t,st.call(this,"readystatechange"),this.dispatchEvent("readystatechange")}class lt{static UNSEND=0;static OPENED=1;static HEADERS_RECEIVED=2;static LOADING=3;static DONE=4;onabort=null;onerror=null;onload=null;onloadstart=null;onprogress=null;ontimeout=null;onloadend=null;onreadystatechange=null;readyState=0;response=null;responseText=null;responseType="";responseXML=null;status=0;statusText="";upload={};withCredentials=!1;events={};constructor(){it.set(this,{"content-type":"application/x-www-form-urlencoded"}),ot.set(this,{})}abort(){const t=at.get(this);t&&t.abort()}getAllResponseHeaders(){const t=ot.get(this);return Object.keys(t).map((e=>`${e}: ${t[e]}`)).join("\n")}getResponseHeader(t){return ot.get(this)[t]}open(t,e){rt.set(this,t),nt.set(this,e),ct.call(this,lt.OPENED)}overrideMimeType(){}send(t=""){if(this.readyState!==lt.OPENED)throw new Error("Failed to execute 'send' on 'XMLHttpRequest': The object's state must be OPENED.");if(-1===nt.get(this).indexOf("http")){let t=n.g.resourceManager.stickerLoader.readJSONFile(nt.get(this)),e=200,r={};if("string"!=typeof t&&!(t instanceof ArrayBuffer))try{t=JSON.stringify(t)}catch(t){}if(this.status=e,ot.set(this,r),st.call(this,"loadstart"),this.dispatchEvent("loadstart"),ct.call(this,lt.HEADERS_RECEIVED),ct.call(this,lt.LOADING),this.response=t,t instanceof ArrayBuffer){this.responseText="";const e=new Uint8Array(t),n=e.byteLength;for(let t=0;t<n;t++)this.responseText+=String.fromCharCode(e[t])}else this.responseText=t;ct.call(this,lt.DONE),st.call(this,"load"),this.dispatchEvent("load"),st.call(this,"loadend"),this.dispatchEvent("loadend")}else wx.request({data:t,url:nt.get(this),method:rt.get(this),header:it.get(this),responseType:this.responseType,success:({data:t,statusCode:e,header:n})=>{if("string"!=typeof t&&!(t instanceof ArrayBuffer))try{t=JSON.stringify(t)}catch(t){}if(this.status=e,ot.set(this,n),st.call(this,"loadstart"),this.dispatchEvent("loadstart"),ct.call(this,lt.HEADERS_RECEIVED),ct.call(this,lt.LOADING),this.response=t,t instanceof ArrayBuffer){this.responseText="";const e=new Uint8Array(t),n=e.byteLength;for(let t=0;t<n;t++)this.responseText+=String.fromCharCode(e[t])}else this.responseText=t;ct.call(this,lt.DONE),st.call(this,"load"),this.dispatchEvent("load"),st.call(this,"loadend"),this.dispatchEvent("loadend")},fail:({errMsg:t})=>{-1!==t.indexOf("abort")?(st.call(this,"abort"),this.dispatchEvent("abort")):(st.call(this,"error",t),this.dispatchEvent("error",t)),st.call(this,"loadend"),this.dispatchEvent("loadend")}})}setRequestHeader(t,e){const n=it.get(this);n[t]=e,it.set(this,n)}addEventListener(t,e){this.events[t]||(this.events[t]=[]),this.events[t].push(e)}removeEventListener(t,e){const n=this.events[t];if(n&&n.length>0)for(let t=n.length;t--;t>0)if(n[t]===e){n.splice(t,1);break}}dispatchEvent(t,e={}){const n=this.events[t];if(n)for(let t=0;t<n.length;t++)n[t](e)}}function ut(t){const e=t.tagName;return"CANVAS"===e?a(t):"IMG"===e?o(t):i}function ht(t){console.log(t)}function dt(){}function ft(){}const pt=setTimeout,gt=clearTimeout,mt=setInterval,yt=clearInterval;const vt={},_t={readyState:"complete",visibilityState:"visible",hidden:!1,fullscreen:!0,location:et,scripts:[],style:{},ontouchstart:null,ontouchmove:null,ontouchend:null,onvisibilitychange:null,parentNode:null,parentElement:null,createElement:t=>"canvas"===(t=t.toLowerCase())?new O:"img"===t?new j:new E(t),createElementNS(t,e){return this.createElement(e)},createTextNode:t=>t,getElementById:t=>t===r.canvas.id?r.canvas:null,getElementsByTagName:t=>"head"===(t=t.toLowerCase())?[_t.head]:"body"===t?[_t.body]:"canvas"===t?[r.canvas]:[],getElementsByTagNameNS(t,e){return this.getElementsByTagName(e)},getElementsByName:t=>"head"===t?[_t.head]:"body"===t?[_t.body]:"canvas"===t?[r.canvas]:[],querySelector:t=>"head"===t?_t.head:"body"===t?_t.body:"canvas"===t||t===`#${r.canvas.id}`?r.canvas:null,querySelectorAll:t=>"head"===t?[_t.head]:"body"===t?[_t.body]:"canvas"===t?[r.canvas]:[],addEventListener(t,e){vt[t]||(vt[t]=[]),vt[t].push(e)},removeEventListener(t,e){const n=vt[t];if(n&&n.length>0)for(let t=n.length;t--;t>0)if(n[t]===e){n.splice(t,1);break}},dispatchEvent(t){const e=t.type,n=vt[e];if(n)for(let e=0;e<n.length;e++)n[e](t);t.target&&"function"==typeof t.target["on"+e]&&t.target["on"+e](t)}};function bt(t){return function(){_t.visibilityState=t?"visible":"hidden";const e=!t;if(_t.hidden===e)return;_t.hidden=e;const n=new B("visibilitychange");n.target=_t,n.timeStamp=Date.now(),_t.dispatchEvent(n)}}_t.documentElement=new class extends E{constructor(){super("html",0)}},_t.head=new E("head"),_t.body=new class extends E{constructor(){super("body",0)}},wx.onHide&&wx.onHide(bt(!1)),wx.onShow&&wx.onShow(bt(!0));const xt=_t;const wt=function(t){r.document=xt,r.addEventListener=(t,e)=>{r.document.addEventListener(t,e)},r.removeEventListener=(t,e)=>{r.document.removeEventListener(t,e)},r.dispatchEvent=function(t={}){},t.global={},t.global.wx={};for(const e in r)t[e]=r[e];t.window=r,t.document=r.document,t.global.window=r,t.Image._context=t,t.HTMLImageElement=t.global.wx.createImage}},9984:(t,e,n)=>{n.d(e,{nH:()=>c,pe:()=>l,sN:()=>s});var r=n(337),i=n(5127),o=n(6879);let a=new i.Y;async function s(t){return new Promise(((e,n)=>{let r=wx.getFileSystemManager();r.access({path:t,success:()=>{e(!0)},fail:n=>{r.mkdir({dirPath:t,success:()=>{e(!0)},fail:t=>{e(!1)}})}})}))}async function c(t){return new Promise(((e,n)=>{wx.getFileSystemManager().access({path:t,success:()=>{e(!0)},fail:t=>{e(!1)}})}))}async function l(t,e){return new Promise((async(n,i)=>{const l=`${wx.env.USER_DATA_PATH}/ar`,u=`${l}/${t}.zip`;await s(l),await c(u)?n():async function(t,e){return new Promise((async(n,i)=>{let a=wx.getFileSystemManager();console.log("加载资源",t,e);const s=`${t}.bin`,l=`${wx.env.USER_DATA_PATH}/ar/${s}`;await c(l)?(console.log("读取本地bin"),a.readFile({filePath:l,success:t=>{n(t.data)},fail:t=>{i({code:o.U.READ_FILE_CACHE_FAIL,message:r.Z.t("0011")}),console.log("read file cache error",t)}})):(console.log("拉取远程bin"),wx.request({url:e,responseType:"arrayBuffer",success:t=>{const{data:e}=t;a.writeFile({filePath:l,data:e,encoding:"binary",success:t=>{n(e)},fail:t=>{let e={code:o.U.REQUEST_FILE_FAIL,message:t.errMsg};t.errMsg.indexOf("maximum size")>-1&&(e.message=r.Z.t("0012")),i(e),console.log("wx cache write eroor",t)}})}}))}))}(t,e).then((e=>{let s=wx.getFileSystemManager(),c=new Uint8Array(e),u=c.length,h=c.slice(0,1024),d=c.slice(1024,u);a.init().then((()=>{let e=a.run(h,"");a.finish("");const c=new Uint8Array(u);c.set(e),c.set(d,e.length);let f=`${l}/${t}.zip`;s.writeFile({filePath:f,data:c.buffer,encoding:"binary",success:t=>{n(f)},fail:t=>{console.log(" temp zip write file error",t);let e={code:o.U.REQUEST_FILE_FAIL,message:t.errMsg};t.errMsg.indexOf("maximum size")>-1&&(e.message=r.Z.t("0012")),i(e)}})}))})).catch((e=>{i({msg:"fail",zip:t,error:e})}))}))}},7959:(t,e,n)=>{n.d(e,{s:()=>r});n(885);const r=new class{detectOnly;_config={beautify:!0,handLandmark:!1};get config(){return this._config}set config(t){this._config=t}constructor(t){t&&(this.config=t)}enableHandLandmark(){this.config.handLandmark=!0}checkEnabled(t){return!("beautify"!==t||!this.detectOnly)||("segmentation"!==t||!this.detectOnly)&&this.config[t]}setData(t){t&&(this.config=t)}}},5901:function(t,e,n){var r,i;!function(o){var a,s={};s.VERSION="1.6.1";var c={},l=function(t,e){return function(){return e.apply(t,arguments)}},u=function(){var t,e,n=arguments,r=n[0];for(e=1;e<n.length;e++)for(t in n[e])!(t in r)&&n[e].hasOwnProperty(t)&&(r[t]=n[e][t]);return r},h=function(t,e){return{value:t,name:e}};s.TRACE=h(1,"TRACE"),s.DEBUG=h(2,"DEBUG"),s.INFO=h(3,"INFO"),s.TIME=h(4,"TIME"),s.WARN=h(5,"WARN"),s.ERROR=h(8,"ERROR"),s.OFF=h(99,"OFF");var d=function(t){this.context=t,this.setLevel(t.filterLevel),this.log=this.info};d.prototype={setLevel:function(t){t&&"value"in t&&(this.context.filterLevel=t)},getLevel:function(){return this.context.filterLevel},enabledFor:function(t){var e=this.context.filterLevel;return t.value>=e.value},trace:function(){this.invoke(s.TRACE,arguments)},debug:function(){this.invoke(s.DEBUG,arguments)},info:function(){this.invoke(s.INFO,arguments)},warn:function(){this.invoke(s.WARN,arguments)},error:function(){this.invoke(s.ERROR,arguments)},time:function(t){"string"==typeof t&&t.length>0&&this.invoke(s.TIME,[t,"start"])},timeEnd:function(t){"string"==typeof t&&t.length>0&&this.invoke(s.TIME,[t,"end"])},invoke:function(t,e){a&&this.enabledFor(t)&&a(e,u({level:t},this.context))}};var f,p=new d({filterLevel:s.OFF});(f=s).enabledFor=l(p,p.enabledFor),f.trace=l(p,p.trace),f.debug=l(p,p.debug),f.time=l(p,p.time),f.timeEnd=l(p,p.timeEnd),f.info=l(p,p.info),f.warn=l(p,p.warn),f.error=l(p,p.error),f.log=f.info,s.setHandler=function(t){a=t},s.setLevel=function(t){for(var e in p.setLevel(t),c)c.hasOwnProperty(e)&&c[e].setLevel(t)},s.getLevel=function(){return p.getLevel()},s.get=function(t){return c[t]||(c[t]=new d(u({name:t},p.context)))},s.createDefaultHandler=function(t){(t=t||{}).formatter=t.formatter||function(t,e){e.name&&t.unshift("["+e.name+"]")};var e={},n=function(t,e){Function.prototype.apply.call(t,console,e)};return"undefined"==typeof console?function(){}:function(r,i){r=Array.prototype.slice.call(r);var o,a=console.log;i.level===s.TIME?(o=(i.name?"["+i.name+"] ":"")+r[0],"start"===r[1]?console.time?console.time(o):e[o]=(new Date).getTime():console.timeEnd?console.timeEnd(o):n(a,[o+": "+((new Date).getTime()-e[o])+"ms"])):(i.level===s.WARN&&console.warn?a=console.warn:i.level===s.ERROR&&console.error?a=console.error:i.level===s.INFO&&console.info?a=console.info:i.level===s.DEBUG&&console.debug?a=console.debug:i.level===s.TRACE&&console.trace&&(a=console.trace),t.formatter(r,i),n(a,r))}},s.useDefaults=function(t){s.setLevel(t&&t.defaultLevel||s.DEBUG),s.setHandler(s.createDefaultHandler(t))},s.setDefaults=s.useDefaults,void 0===(i="function"==typeof(r=s)?r.call(e,n,e,t):r)||(t.exports=i)}()},3125:(t,e,n)=>{n.d(e,{LE:()=>Q});var r=n(9043),i=n(7659),o=n(8306),a=n(1893),s=n(519),c=n(2064),l=n(8141),u=n(6340),h=n(1961),d=n(2794);n(4775);class f extends r.Geometry{constructor(t=!1){super(),this._buffer=new r.Buffer(null,t,!1),this._indexBuffer=new r.Buffer(null,t,!0),this.addAttribute("aVertexPosition",this._buffer,3,!1,i.vK.FLOAT).addAttribute("aTextureCoord",this._buffer,2,!1,i.vK.FLOAT).addAttribute("aColor",this._buffer,4,!0,i.vK.UNSIGNED_BYTE).addAttribute("aTextureId",this._buffer,1,!0,i.vK.FLOAT).addIndex(this._indexBuffer)}}class p{constructor(t,e=!0){p.prototype.__init.call(this),this.legacy=t,e&&(this.enabled=!0),this.legacy.proj=this}__init(){this._enabled=!1}get enabled(){return this._enabled}set enabled(t){this._enabled=t}clear(){}}var g,m;function y(t){const e=this.proj,n=this,r=t._worldID,i=n.localTransform,o=e.scaleAfterAffine&&e.affine>=2;n._localID!==n._currentLocalID&&(o?(i.a=n._cx,i.b=n._sx,i.c=n._cy,i.d=n._sy,i.tx=n.position._x,i.ty=n.position._y):(i.a=n._cx*n.scale._x,i.b=n._sx*n.scale._x,i.c=n._cy*n.scale._y,i.d=n._sy*n.scale._y,i.tx=n.position._x-(n.pivot._x*i.a+n.pivot._y*i.c),i.ty=n.position._y-(n.pivot._x*i.b+n.pivot._y*i.d)),n._currentLocalID=n._localID,e._currentProjID=-1);const a=e._projID;if(e._currentProjID!==a&&(e._currentProjID=a,e.updateLocalTransform(i),n._parentID=-1),n._parentID!==r){const i=t.proj;i&&!i._affine?e.world.setToMult(i.world,e.local):e.world.setToMultLegacy(t.worldTransform,e.local);const a=n.worldTransform;e.world.copyTo(a,e._affine,e.affinePreserveOrientation),o&&(a.a*=n.scale._x,a.b*=n.scale._x,a.c*=n.scale._y,a.d*=n.scale._y,a.tx-=n.pivot._x*a.a+n.pivot._y*a.c,a.ty-=n.pivot._x*a.b+n.pivot._y*a.d),n._parentID=r,n._worldID++}}!function(t){t[t.NONE=0]="NONE";t[t.BEFORE_PROJ=4]="BEFORE_PROJ";t[t.PROJ=5]="PROJ";t[t.ALL=9]="ALL"}(g||(g={})),function(t){t[t.NONE=0]="NONE";t[t.FREE=1]="FREE";t[t.AXIS_X=2]="AXIS_X";t[t.AXIS_Y=3]="AXIS_Y";t[t.POINT=4]="POINT";t[t.AXIS_XR=5]="AXIS_XR"}(m||(m={}));class v extends p{constructor(...t){super(...t),v.prototype.__init.call(this),v.prototype.__init2.call(this),v.prototype.__init3.call(this),v.prototype.__init4.call(this),v.prototype.__init5.call(this)}updateLocalTransform(t){}__init(){this._projID=0}__init2(){this._currentProjID=-1}__init3(){this._affine=m.NONE}__init4(){this.affinePreserveOrientation=!1}__init5(){this.scaleAfterAffine=!0}set affine(t){this._affine!==t&&(this._affine=t,this._currentProjID=-1,this.legacy._currentLocalID=-1)}get affine(){return this._affine}set enabled(t){t!==this._enabled&&(this._enabled=t,t?(this.legacy.updateTransform=y,this.legacy._parentID=-1):(this.legacy.updateTransform=a.wx.prototype.updateTransform,this.legacy._parentID=-1))}clear(){this._currentProjID=-1,this._projID=0}}class _ extends r.AbstractBatchRenderer{constructor(...t){super(...t),_.prototype.__init.call(this),_.prototype.__init2.call(this)}__init(){this.forceMaxTextures=0}getUniforms(t){return this.defUniforms}syncUniforms(t){if(!t)return;const e=this._shader;for(const n in t)e.uniforms[n]=t[n]}__init2(){this.defUniforms={}}buildDrawCalls(t,e,n){const i=this,{_bufferedElements:a,_attributeBuffer:s,_indexBuffer:c,vertexSize:l}=this,u=r.AbstractBatchRenderer._drawCallPool;let h=this._dcIndex,d=this._aIndex,f=this._iIndex,p=u[h];p.start=this._iIndex,p.texArray=t;for(let r=e;r<n;++r){const n=a[r],i=n._texture.baseTexture,g=o.YA[i.alphaMode?1:0][n.blendMode],m=this.getUniforms(n);a[r]=null,e<r&&(p.blend!==g||p.uniforms!==m)&&(p.size=f-p.start,e=r,p=u[++h],p.texArray=t,p.start=f),this.packInterleavedGeometry(n,s,c,d,f),d+=n.vertexData.length/2*l,f+=n.indices.length,p.blend=g,p.uniforms=m}e<n&&(p.size=f-p.start,++h),i._dcIndex=h,i._aIndex=d,i._iIndex=f}drawBatches(){const t=this._dcIndex,{gl:e,state:n,shader:i}=this.renderer,o=r.AbstractBatchRenderer._drawCallPool;let a=null,s=null;for(let r=0;r<t;r++){const{texArray:t,type:c,size:l,start:u,blend:h,uniforms:d}=o[r];s!==t&&(s=t,this.bindAndClearTexArray(t)),a!==d&&(a=d,this.syncUniforms(d),i.syncUniformGroup(this._shader.uniformGroup)),this.state.blendMode=h,n.set(this.state),e.drawElements(c,l,e.UNSIGNED_SHORT,2*u)}}contextChange(){if(!this.forceMaxTextures)return super.contextChange(),void this.syncUniforms(this.defUniforms);const t=this;t.MAX_TEXTURES=this.forceMaxTextures,this._shader=t.shaderGenerator.generateShader(this.MAX_TEXTURES),this.syncUniforms(this.defUniforms);for(let e=0;e<t._packedGeometryPoolSize;e++)t._packedGeometries[e]=new this.geometryClass;this.initFlushBuffers()}}r.Renderer.registerPlugin("batch2d",class{static create(t){const{vertex:e,fragment:n,vertexSize:i,geometryClass:a}=Object.assign({vertex:"precision highp float;\nattribute vec3 aVertexPosition;\nattribute vec2 aTextureCoord;\nattribute vec4 aColor;\nattribute float aTextureId;\n\nuniform mat3 projectionMatrix;\n\nvarying vec2 vTextureCoord;\nvarying vec4 vColor;\nvarying float vTextureId;\n\nvoid main(void){\ngl_Position.xyw = projectionMatrix * aVertexPosition;\ngl_Position.z = 0.0;\n\nvTextureCoord = aTextureCoord;\nvTextureId = aTextureId;\nvColor = aColor;\n}\n",fragment:"\nvarying vec2 vTextureCoord;\nvarying vec4 vColor;\nvarying float vTextureId;\nuniform sampler2D uSamplers[%count%];\n\nvoid main(void){\nvec4 color;\n%forloop%\ngl_FragColor = color * vColor;\n}",geometryClass:f,vertexSize:7},t);return class extends r.AbstractBatchRenderer{constructor(t){super(t),this.shaderGenerator=new r.BatchShaderGenerator(e,n),this.geometryClass=a,this.vertexSize=i}packInterleavedGeometry(t,e,n,r,i){const{uint32View:a,float32View:s}=e,c=r/this.vertexSize,l=t.uvs,u=t.indices,h=t.vertexData,d=t.vertexData2d,f=t._texture.baseTexture._batchLocation,p=Math.min(t.worldAlpha,1),g=p<1&&t._texture.baseTexture.alphaMode?(0,o.rA)(t._tintRGB,p):t._tintRGB+(255*p<<24);if(d){let t=0;for(let e=0;e<d.length;e+=3,t+=2)s[r++]=d[e],s[r++]=d[e+1],s[r++]=d[e+2],s[r++]=l[t],s[r++]=l[t+1],a[r++]=g,s[r++]=f}else for(let t=0;t<h.length;t+=2)s[r++]=h[t],s[r++]=h[t+1],s[r++]=1,s[r++]=l[t],s[r++]=l[t+1],a[r++]=g,s[r++]=f;for(let t=0;t<u.length;t++)n[i++]=c+u[t]}}}}.create({}));const b=[1,0,0,0,1,0,0,0,1];class x{static __initStatic(){this.IDENTITY=new x}static __initStatic2(){this.TEMP_MATRIX=new x}__init(){this.floatArray=null}constructor(t){x.prototype.__init.call(this),this.mat3=new Float64Array(t||b)}get a(){return this.mat3[0]/this.mat3[8]}set a(t){this.mat3[0]=t*this.mat3[8]}get b(){return this.mat3[1]/this.mat3[8]}set b(t){this.mat3[1]=t*this.mat3[8]}get c(){return this.mat3[3]/this.mat3[8]}set c(t){this.mat3[3]=t*this.mat3[8]}get d(){return this.mat3[4]/this.mat3[8]}set d(t){this.mat3[4]=t*this.mat3[8]}get tx(){return this.mat3[6]/this.mat3[8]}set tx(t){this.mat3[6]=t*this.mat3[8]}get ty(){return this.mat3[7]/this.mat3[8]}set ty(t){this.mat3[7]=t*this.mat3[8]}set(t,e,n,r,i,o){const a=this.mat3;return a[0]=t,a[1]=e,a[2]=0,a[3]=n,a[4]=r,a[5]=0,a[6]=i,a[7]=o,a[8]=1,this}toArray(t,e){this.floatArray||(this.floatArray=new Float32Array(9));const n=e||this.floatArray,r=this.mat3;return t?(n[0]=r[0],n[1]=r[1],n[2]=r[2],n[3]=r[3],n[4]=r[4],n[5]=r[5],n[6]=r[6],n[7]=r[7],n[8]=r[8]):(n[0]=r[0],n[1]=r[3],n[2]=r[6],n[3]=r[1],n[4]=r[4],n[5]=r[7],n[6]=r[2],n[7]=r[5],n[8]=r[8]),n}apply(t,e){e=e||new a.E9;const n=this.mat3,r=t.x,i=t.y,o=1/(n[2]*r+n[5]*i+n[8]);return e.x=o*(n[0]*r+n[3]*i+n[6]),e.y=o*(n[1]*r+n[4]*i+n[7]),e}translate(t,e){const n=this.mat3;return n[0]+=t*n[2],n[1]+=e*n[2],n[3]+=t*n[5],n[4]+=e*n[5],n[6]+=t*n[8],n[7]+=e*n[8],this}scale(t,e){const n=this.mat3;return n[0]*=t,n[1]*=e,n[3]*=t,n[4]*=e,n[6]*=t,n[7]*=e,this}scaleAndTranslate(t,e,n,r){const i=this.mat3;i[0]=t*i[0]+n*i[2],i[1]=e*i[1]+r*i[2],i[3]=t*i[3]+n*i[5],i[4]=e*i[4]+r*i[5],i[6]=t*i[6]+n*i[8],i[7]=e*i[7]+r*i[8]}applyInverse(t,e){e=e||new a.E9;const n=this.mat3,r=t.x,i=t.y,o=n[0],s=n[3],c=n[6],l=n[1],u=n[4],h=n[7],d=n[2],f=n[5],p=n[8],g=(p*u-h*f)*r+(-p*s+c*f)*i+(h*s-c*u),m=(-p*l+h*d)*r+(p*o-c*d)*i+(-h*o+c*l),y=(f*l-u*d)*r+(-f*o+s*d)*i+(u*o-s*l);return e.x=g/y,e.y=m/y,e}invert(){const t=this.mat3,e=t[0],n=t[1],r=t[2],i=t[3],o=t[4],a=t[5],s=t[6],c=t[7],l=t[8],u=l*o-a*c,h=-l*i+a*s,d=c*i-o*s;let f=e*u+n*h+r*d;return f?(f=1/f,t[0]=u*f,t[1]=(-l*n+r*c)*f,t[2]=(a*n-r*o)*f,t[3]=h*f,t[4]=(l*e-r*s)*f,t[5]=(-a*e+r*i)*f,t[6]=d*f,t[7]=(-c*e+n*s)*f,t[8]=(o*e-n*i)*f,this):this}identity(){const t=this.mat3;return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=1,t[5]=0,t[6]=0,t[7]=0,t[8]=1,this}clone(){return new x(this.mat3)}copyTo2dOr3d(t){const e=this.mat3,n=t.mat3;return n[0]=e[0],n[1]=e[1],n[2]=e[2],n[3]=e[3],n[4]=e[4],n[5]=e[5],n[6]=e[6],n[7]=e[7],n[8]=e[8],t}copyTo(t,e,n){const r=this.mat3,i=1/r[8],o=r[6]*i,a=r[7]*i;if(t.a=(r[0]-r[2]*o)*i,t.b=(r[1]-r[2]*a)*i,t.c=(r[3]-r[5]*o)*i,t.d=(r[4]-r[5]*a)*i,t.tx=o,t.ty=a,e>=2){let r=t.a*t.d-t.b*t.c;n||(r=Math.abs(r)),e===m.POINT?(r=r>0?1:-1,t.a=r,t.b=0,t.c=0,t.d=r):e===m.AXIS_X?(r/=Math.sqrt(t.b*t.b+t.d*t.d),t.c=0,t.d=r):e===m.AXIS_Y?(r/=Math.sqrt(t.a*t.a+t.c*t.c),t.a=r,t.c=0):e===m.AXIS_XR&&(t.a=t.d*r,t.c=-t.b*r)}return t}copyFrom(t){const e=this.mat3;return e[0]=t.a,e[1]=t.b,e[2]=0,e[3]=t.c,e[4]=t.d,e[5]=0,e[6]=t.tx,e[7]=t.ty,e[8]=1,this}setToMultLegacy(t,e){const n=this.mat3,r=e.mat3,i=t.a,o=t.b,a=t.c,s=t.d,c=t.tx,l=t.ty,u=r[0],h=r[1],d=r[2],f=r[3],p=r[4],g=r[5],m=r[6],y=r[7],v=r[8];return n[0]=u*i+h*a+d*c,n[1]=u*o+h*s+d*l,n[2]=d,n[3]=f*i+p*a+g*c,n[4]=f*o+p*s+g*l,n[5]=g,n[6]=m*i+y*a+v*c,n[7]=m*o+y*s+v*l,n[8]=v,this}setToMultLegacy2(t,e){const n=this.mat3,r=t.mat3,i=r[0],o=r[1],a=r[2],s=r[3],c=r[4],l=r[5],u=r[6],h=r[7],d=r[8],f=e.a,p=e.b,g=e.c,m=e.d,y=e.tx,v=e.ty;return n[0]=f*i+p*s,n[1]=f*o+p*c,n[2]=f*a+p*l,n[3]=g*i+m*s,n[4]=g*o+m*c,n[5]=g*a+m*l,n[6]=y*i+v*s+u,n[7]=y*o+v*c+h,n[8]=y*a+v*l+d,this}setToMult(t,e){const n=this.mat3,r=t.mat3,i=e.mat3,o=r[0],a=r[1],s=r[2],c=r[3],l=r[4],u=r[5],h=r[6],d=r[7],f=r[8],p=i[0],g=i[1],m=i[2],y=i[3],v=i[4],_=i[5],b=i[6],x=i[7],w=i[8];return n[0]=p*o+g*c+m*h,n[1]=p*a+g*l+m*d,n[2]=p*s+g*u+m*f,n[3]=y*o+v*c+_*h,n[4]=y*a+v*l+_*d,n[5]=y*s+v*u+_*f,n[6]=b*o+x*c+w*h,n[7]=b*a+x*l+w*d,n[8]=b*s+x*u+w*f,this}prepend(t){return t.mat3?this.setToMult(t,this):this.setToMultLegacy(t,this)}}x.__initStatic(),x.__initStatic2();const w="attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\n\nuniform mat3 projectionMatrix;\nuniform mat3 translationMatrix;\nuniform mat3 uTransform;\n\nvarying vec3 vTextureCoord;\n\nvoid main(void)\n{\ngl_Position.xyw = projectionMatrix * translationMatrix * vec3(aVertexPosition, 1.0);\n\nvTextureCoord = uTransform * vec3(aTextureCoord, 1.0);\n}\n",C=new x;class T extends r.ObjectRenderer{constructor(t){super(t),T.prototype.__init.call(this);const e={globals:this.renderer.globalUniforms};this.shader=r.Shader.from(w,"\nvarying vec3 vTextureCoord;\n\nuniform sampler2D uSampler;\nuniform vec4 uColor;\nuniform mat3 uMapCoord;\nuniform vec4 uClampFrame;\nuniform vec2 uClampOffset;\n\nvoid main(void)\n{\nvec2 coord = mod(vTextureCoord.xy / vTextureCoord.z - uClampOffset, vec2(1.0, 1.0)) + uClampOffset;\ncoord = (uMapCoord * vec3(coord, 1.0)).xy;\ncoord = clamp(coord, uClampFrame.xy, uClampFrame.zw);\n\nvec4 sample = texture2D(uSampler, coord);\ngl_FragColor = sample * uColor;\n}\n",e),this.simpleShader=r.Shader.from(w,"\nvarying vec3 vTextureCoord;\n\nuniform sampler2D uSampler;\nuniform vec4 uColor;\n\nvoid main(void)\n{\nvec4 sample = texture2D(uSampler, vTextureCoord.xy / vTextureCoord.z);\ngl_FragColor = sample * uColor;\n}\n",e)}__init(){this.quad=new r.QuadUv}render(t){const e=this.renderer,n=this.quad;let r=n.vertices;r[0]=r[6]=t._width*-t.anchor.x,r[1]=r[3]=t._height*-t.anchor.y,r[2]=r[4]=t._width*(1-t.anchor.x),r[5]=r[7]=t._height*(1-t.anchor.y),t.uvRespectAnchor&&(r=n.uvs,r[0]=r[6]=-t.anchor.x,r[1]=r[3]=-t.anchor.y,r[2]=r[4]=1-t.anchor.x,r[5]=r[7]=1-t.anchor.y),n.invalidate();const a=t._texture,s=a.baseTexture,c=t.tileProj.world,l=t.uvMatrix;let u=s.isPowerOfTwo&&a.frame.width===s.width&&a.frame.height===s.height;u&&(s._glTextures[e.CONTEXT_UID]?u=s.wrapMode!==i.Nt.CLAMP:s.wrapMode===i.Nt.CLAMP&&(s.wrapMode=i.Nt.REPEAT));const h=u?this.simpleShader:this.shader;C.identity(),C.scale(a.width,a.height),C.prepend(c),C.scale(1/t._width,1/t._height),C.invert(),u?C.prepend(l.mapCoord):(h.uniforms.uMapCoord=l.mapCoord.toArray(!0),h.uniforms.uClampFrame=l.uClampFrame,h.uniforms.uClampOffset=l.uClampOffset),h.uniforms.uTransform=C.toArray(!0),h.uniforms.uColor=(0,o.GT)(t.tint,t.worldAlpha,h.uniforms.uColor,s.premultiplyAlpha),h.uniforms.translationMatrix=t.worldTransform.toArray(!0),h.uniforms.uSampler=a,e.shader.bind(h,!1),e.geometry.bind(n,void 0),e.state.setBlendMode((0,o.D)(t.blendMode,s.premultiplyAlpha)),e.geometry.draw(i.lg.TRIANGLES,6,0)}}const S=new a.E9,k=[new a.E9,new a.E9,new a.E9,new a.E9],E=new a.Ae,P=new x;class R extends v{constructor(t,e){super(t,e),R.prototype.__init.call(this),R.prototype.__init2.call(this),R.prototype.__init3.call(this),this.local=new x,this.world=new x}__init(){this.matrix=new x}__init2(){this.pivot=new a.AB(this.onChange,this,0,0)}__init3(){this.reverseLocalOrder=!1}onChange(){const t=this.pivot,e=this.matrix.mat3;e[6]=-(t._x*e[0]+t._y*e[3]),e[7]=-(t._x*e[1]+t._y*e[4]),this._projID++}setAxisX(t,e=1){const n=t.x,r=t.y,i=Math.sqrt(n*n+r*r),o=this.matrix.mat3;o[0]=n/i,o[1]=r/i,o[2]=e/i,this.onChange()}setAxisY(t,e=1){const n=t.x,r=t.y,i=Math.sqrt(n*n+r*r),o=this.matrix.mat3;o[3]=n/i,o[4]=r/i,o[5]=e/i,this.onChange()}mapSprite(t,e){const n=t.texture;E.x=-t.anchor.x*n.orig.width,E.y=-t.anchor.y*n.orig.height,E.width=n.orig.width,E.height=n.orig.height,this.mapQuad(E,e)}mapQuad(t,e){k[0].set(t.x,t.y),k[1].set(t.x+t.width,t.y),k[2].set(t.x+t.width,t.y+t.height),k[3].set(t.x,t.y+t.height);let n=1,r=2,i=3;if(0===function(t,e,n,r,i){const o=e.x-t.x,a=n.x-r.x,s=n.x-t.x,c=e.y-t.y,l=n.y-r.y,u=n.y-t.y,h=o*l-c*a;if(Math.abs(h)<1e-7)return i.x=o,i.y=c,0;const d=(s*l-u*a)/h,f=(o*u-c*s)/h;return f<1e-6||f-1>-1e-6?-1:(i.x=t.x+d*(e.x-t.x),i.y=t.y+d*(e.y-t.y),1)}(e[0],e[2],e[1],e[3],S))return;n=1,r=3,i=2;const o=Math.sqrt((e[0].x-S.x)*(e[0].x-S.x)+(e[0].y-S.y)*(e[0].y-S.y)),a=Math.sqrt((e[n].x-S.x)*(e[n].x-S.x)+(e[n].y-S.y)*(e[n].y-S.y)),s=Math.sqrt((e[r].x-S.x)*(e[r].x-S.x)+(e[r].y-S.y)*(e[r].y-S.y)),c=Math.sqrt((e[i].x-S.x)*(e[i].x-S.x)+(e[i].y-S.y)*(e[i].y-S.y)),l=(o+c)/c,u=(a+s)/s,h=(a+s)/a;let d=this.matrix.mat3;d[0]=k[0].x*l,d[1]=k[0].y*l,d[2]=l,d[3]=k[n].x*u,d[4]=k[n].y*u,d[5]=u,d[6]=k[r].x*h,d[7]=k[r].y*h,d[8]=h,this.matrix.invert(),d=P.mat3,d[0]=e[0].x,d[1]=e[0].y,d[2]=1,d[3]=e[n].x,d[4]=e[n].y,d[5]=1,d[6]=e[r].x,d[7]=e[r].y,d[8]=1,this.matrix.setToMult(P,this.matrix),this._projID++}updateLocalTransform(t){0!==this._projID?this.reverseLocalOrder?this.local.setToMultLegacy2(this.matrix,t):this.local.setToMultLegacy(t,this.matrix):this.local.copyFrom(t)}clear(){super.clear(),this.matrix.identity(),this.pivot.set(0,0)}}function O(){return this.proj.affine?this.transform.worldTransform:this.proj.world}class D extends s.W2{constructor(){super(),this.proj=new R(this.transform)}toLocal(t,e,n,r,i=g.ALL){return e&&(t=e.toGlobal(t,n,r)),r||this._recursivePostUpdateTransform(),i>=g.PROJ?(r||this.displayObjectUpdateTransform(),this.proj.affine?this.transform.worldTransform.applyInverse(t,n):this.proj.world.applyInverse(t,n)):(this.parent?n=this.parent.worldTransform.applyInverse(t,n):(n.x=t.x,n.y=t.y),i===g.NONE?n:this.transform.localTransform.applyInverse(n,n))}get worldTransform(){return this.proj.affine?this.transform.worldTransform:this.proj.world}}const A=D.prototype.toLocal;class I extends l.Kj{static __initStatic(){this.defaultVertexShader="precision highp float;\nattribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\n\nuniform mat3 projectionMatrix;\nuniform mat3 translationMatrix;\nuniform mat3 uTextureMatrix;\n\nvarying vec2 vTextureCoord;\n\nvoid main(void)\n{\ngl_Position.xyw = projectionMatrix * translationMatrix * vec3(aVertexPosition, 1.0);\ngl_Position.z = 0.0;\n\nvTextureCoord = (uTextureMatrix * vec3(aTextureCoord, 1.0)).xy;\n}\n"}static __initStatic2(){this.defaultFragmentShader="\nvarying vec2 vTextureCoord;\nuniform vec4 uColor;\n\nuniform sampler2D uSampler;\n\nvoid main(void)\n{\ngl_FragColor = texture2D(uSampler, vTextureCoord) * uColor;\n}"}constructor(t,e,n,r){super(t,e,n,r),I.prototype.__init.call(this),this.proj=new R(this.transform)}__init(){this.vertexData2d=null}calculateVertices(){if(this.proj._affine)return this.vertexData2d=null,void super.calculateVertices();const t=this.geometry,e=t.buffers[0].data,n=this;if(t.vertexDirtyId===n.vertexDirty&&n._transformID===n.transform._worldID)return;n._transformID=n.transform._worldID,n.vertexData.length!==e.length&&(n.vertexData=new Float32Array(e.length)),this.vertexData2d&&this.vertexData2d.length===3*e.length/2||(this.vertexData2d=new Float32Array(3*e.length));const r=this.proj.world.mat3,i=this.vertexData2d,o=n.vertexData;for(let t=0;t<o.length/2;t++){const n=e[2*t],a=e[2*t+1],s=r[0]*n+r[3]*a+r[6],c=r[1]*n+r[4]*a+r[7],l=r[2]*n+r[5]*a+r[8];i[3*t]=s,i[3*t+1]=c,i[3*t+2]=l,o[2*t]=s/l,o[2*t+1]=c/l}n.vertexDirty=t.vertexDirtyId}_renderDefault(t){const e=this.shader;e.alpha=this.worldAlpha,e.update&&e.update(),t.batch.flush(),function(t){let e,n=t[0],r=1;for(;r<t.length;){const i=t[r],o=t[r+1];if(r+=2,("optionalAccess"===i||"optionalCall"===i)&&null==n)return;"access"===i||"optionalAccess"===i?(e=n,n=o(n)):"call"!==i&&"optionalCall"!==i||(n=o(((...t)=>n.call(e,...t))),e=void 0)}return n}([e,"access",t=>t.program,"access",t=>t.uniformData,"optionalAccess",t=>t.translationMatrix])&&(e.uniforms.translationMatrix=this.worldTransform.toArray(!0)),t.shader.bind(e,!1),t.state.set(this.state),t.geometry.bind(this.geometry,e),t.geometry.draw(this.drawMode,this.size,this.start,this.geometry.instanceCount)}toLocal(t,e,n,r,i=g.ALL){return A.call(this,t,e,n,r,i)}get worldTransform(){return this.proj.affine?this.transform.worldTransform:this.proj.world}}I.__initStatic(),I.__initStatic2();class F extends h.j{constructor(t){super(t),F.prototype.__init.call(this),this.proj=new R(this.transform),this.pluginName="batch2d"}__init(){this.vertexData2d=null}_calculateBounds(){this.calculateTrimmedVertices(),this._bounds.addQuad(this.vertexTrimmedData)}calculateVertices(){const t=this._texture;if(this.proj._affine)return this.vertexData2d=null,void super.calculateVertices();this.vertexData2d||(this.vertexData2d=new Float32Array(12));const e=this.transform._worldID,n=t._updateID;if(this._transformID===e&&this._textureID===n)return;this._textureID!==n&&(this.uvs=t._uvs.uvsFloat32),this._transformID=e,this._textureID=n;const r=this.proj.world.mat3,i=this.vertexData2d,o=this.vertexData,a=t.trim,s=t.orig,c=this._anchor;let l,u,h,d;a?(u=a.x-c._x*s.width,l=u+a.width,d=a.y-c._y*s.height,h=d+a.height):(u=-c._x*s.width,l=u+s.width,d=-c._y*s.height,h=d+s.height),i[0]=r[0]*u+r[3]*d+r[6],i[1]=r[1]*u+r[4]*d+r[7],i[2]=r[2]*u+r[5]*d+r[8],i[3]=r[0]*l+r[3]*d+r[6],i[4]=r[1]*l+r[4]*d+r[7],i[5]=r[2]*l+r[5]*d+r[8],i[6]=r[0]*l+r[3]*h+r[6],i[7]=r[1]*l+r[4]*h+r[7],i[8]=r[2]*l+r[5]*h+r[8],i[9]=r[0]*u+r[3]*h+r[6],i[10]=r[1]*u+r[4]*h+r[7],i[11]=r[2]*u+r[5]*h+r[8],o[0]=i[0]/i[2],o[1]=i[1]/i[2],o[2]=i[3]/i[5],o[3]=i[4]/i[5],o[4]=i[6]/i[8],o[5]=i[7]/i[8],o[6]=i[9]/i[11],o[7]=i[10]/i[11]}calculateTrimmedVertices(){if(this.proj._affine)return void super.calculateTrimmedVertices();const t=this.transform._worldID,e=this._texture._updateID,n=this;if(n.vertexTrimmedData){if(n._transformTrimmedID===t&&this._textureTrimmedID===e)return}else n.vertexTrimmedData=new Float32Array(8);n._transformTrimmedID=t,this._textureTrimmedID=e;const r=this._texture,i=n.vertexTrimmedData,o=r.orig,a=this.tileProj?this._width:o.width,s=this.tileProj?this._height:o.height,c=this._anchor,l=this.proj.world.mat3,u=-c._x*a,h=u+a,d=-c._y*s,f=d+s;let p=1/(l[2]*u+l[5]*d+l[8]);i[0]=p*(l[0]*u+l[3]*d+l[6]),i[1]=p*(l[1]*u+l[4]*d+l[7]),p=1/(l[2]*h+l[5]*d+l[8]),i[2]=p*(l[0]*h+l[3]*d+l[6]),i[3]=p*(l[1]*h+l[4]*d+l[7]),p=1/(l[2]*h+l[5]*f+l[8]),i[4]=p*(l[0]*h+l[3]*f+l[6]),i[5]=p*(l[1]*h+l[4]*f+l[7]),p=1/(l[2]*u+l[5]*f+l[8]),i[6]=p*(l[0]*u+l[3]*f+l[6]),i[7]=p*(l[1]*u+l[4]*f+l[7])}toLocal(t,e,n,r,i=g.ALL){return A.call(this,t,e,n,r,i)}get worldTransform(){return this.proj.affine?this.transform.worldTransform:this.proj.world}}const L=new a.wx;class M extends c.o{constructor(t,e,n){super(t,e,n),this.tileProj=new R(this.tileTransform),this.tileProj.reverseLocalOrder=!0,this.proj=new R(this.transform),this.pluginName="tilingSprite2d",this.uvRespectAnchor=!0}get worldTransform(){return this.proj.affine?this.transform.worldTransform:this.proj.world}toLocal(t,e,n,r,i=g.ALL){return A.call(this,t,e,n,r,i)}_render(t){const e=this._texture;e&&e.valid&&(this.tileTransform.updateTransform(L),this.uvMatrix.update(),t.batch.setObjectRenderer(t.plugins[this.pluginName]),t.plugins[this.pluginName].render(this))}}function N(){this.proj||(this.proj=new R(this.transform),this.toLocal=D.prototype.toLocal,Object.defineProperty(this,"worldTransform",{get:O,enumerable:!0,configurable:!0}))}s.W2.prototype.convertTo2d=N,h.j.prototype.convertTo2d=function(){this.proj||(this.calculateVertices=F.prototype.calculateVertices,this.calculateTrimmedVertices=F.prototype.calculateTrimmedVertices,this._calculateBounds=F.prototype._calculateBounds,this.pluginName="batch2d",N.call(this))},s.W2.prototype.convertSubtreeTo2d=function(){this.convertTo2d();for(let t=0;t<this.children.length;t++)this.children[t].convertSubtreeTo2d()},u.AL.prototype.convertTo2d=u.IE.prototype.convertTo2d=function(){this.proj||(this.calculateVertices=I.prototype.calculateVertices,this._renderDefault=I.prototype._renderDefault,"batch2d"!==this.material.pluginName&&(this.material=new l.rY(this.material.texture,{program:r.Program.from(I.defaultVertexShader,I.defaultFragmentShader),pluginName:"batch2d"})),N.call(this))},c.o.prototype.convertTo2d=function(){this.proj||(this.tileProj=new R(this.tileTransform),this.tileProj.reverseLocalOrder=!0,this.uvRespectAnchor=!0,this.calculateTrimmedVertices=F.prototype.calculateTrimmedVertices,this._calculateBounds=F.prototype._calculateBounds,this._render=M.prototype._render,this.pluginName="tilingSprite2d",N.call(this))};class j extends d.xv{constructor(t,e,n){super(t,e,n),j.prototype.__init.call(this),this.proj=new R(this.transform),this.pluginName="batch2d"}__init(){this.vertexData2d=null}get worldTransform(){return this.proj.affine?this.transform.worldTransform:this.proj.world}}j.prototype.calculateVertices=F.prototype.calculateVertices,j.prototype.calculateTrimmedVertices=F.prototype.calculateTrimmedVertices,j.prototype._calculateBounds=F.prototype._calculateBounds;const U=new x;class B extends r.Filter{constructor(t){super("\nattribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\n\nuniform mat3 projectionMatrix;\nuniform mat3 otherMatrix;\n\nvarying vec3 vMaskCoord;\nvarying vec2 vTextureCoord;\n\nvoid main(void)\n{\ngl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n\nvTextureCoord = aTextureCoord;\nvMaskCoord = otherMatrix * vec3( aTextureCoord, 1.0);\n}\n","\nvarying vec3 vMaskCoord;\nvarying vec2 vTextureCoord;\n\nuniform sampler2D uSampler;\nuniform sampler2D mask;\nuniform float alpha;\nuniform vec4 maskClamp;\n\nvoid main(void)\n{\nvec2 uv = vMaskCoord.xy / vMaskCoord.z;\n\nfloat clip = step(3.5,\n step(maskClamp.x, uv.x) +\n step(maskClamp.y, uv.y) +\n step(uv.x, maskClamp.z) +\n step(uv.y, maskClamp.w));\n\nvec4 original = texture2D(uSampler, vTextureCoord);\nvec4 masky = texture2D(mask, uv);\n\noriginal *= (masky.r * masky.a * alpha * clip);\n\ngl_FragColor = original;\n}\n"),B.prototype.__init.call(this),t.renderable=!1,this.maskSprite=t}__init(){this.maskMatrix=new x}apply(t,e,n,i){const o=this.maskSprite,a=this.maskSprite.texture;a.valid&&(a.uvMatrix||(a.uvMatrix=new r.TextureMatrix(a,0)),a.uvMatrix.update(),this.uniforms.npmAlpha=a.baseTexture.alphaMode?0:1,this.uniforms.mask=o.texture,this.uniforms.otherMatrix=B.calculateSpriteMatrix(e,this.maskMatrix,o).prepend(a.uvMatrix.mapCoord),this.uniforms.alpha=o.worldAlpha,this.uniforms.maskClamp=a.uvMatrix.uClampFrame,t.applyFilter(this,e,n,i))}static calculateSpriteMatrix(t,e,n){const r=n.proj,i=t.filterFrame,o=r&&!r._affine?r.world.copyTo2dOr3d(U):U.copyFrom(n.transform.worldTransform),a=n.texture.orig;return e.set(t.width,0,0,t.height,i.x,i.y),o.invert(),e.setToMult(o,e),e.scaleAndTranslate(1/a.width,1/a.height,n.anchor.x,n.anchor.y),e}}r.MaskSystem.prototype.pushSpriteMask=function(t){const{maskObject:e}=t,n=t._target;let r=this.alphaMaskPool[this.alphaMaskIndex];r||(r=this.alphaMaskPool[this.alphaMaskIndex]=[new B(e)]),r[0].resolution=this.renderer.resolution,r[0].maskSprite=e;const i=n.filterArea;n.filterArea=e.getBounds(!0),this.renderer.filter.push(n,r),n.filterArea=i,this.alphaMaskIndex++},r.Renderer.registerPlugin("tilingSprite2d",T);class z extends a.E9{constructor(t,e,n){super(t,e),this.z=n}set(t,e,n){return this.x=t||0,this.y=void 0===e?this.x:e||0,this.z=void 0===e?this.x:n||0,this}copyFrom(t){return this.set(t.x,t.y,t.z||0),this}copyTo(t){return t.set(this.x,this.y,this.z),t}}class W extends a.AB{constructor(...t){super(...t),W.prototype.__init.call(this)}__init(){this._z=0}get z(){return this._z}set z(t){this._z!==t&&(this._z=t,this.cb.call(this.scope))}set(t,e,n){const r=t||0,i=void 0===e?r:e||0,o=void 0===e?r:n||0;return this._x===r&&this._y===i&&this._z===o||(this._x=r,this._y=i,this._z=o,this.cb.call(this.scope)),this}copyFrom(t){return this.set(t.x,t.y,t.z||0),this}copyTo(t){return t.set(this._x,this._y,this._z),t}}class V{constructor(t,e,n){V.prototype.__init.call(this),V.prototype.__init2.call(this),V.prototype.__init3.call(this),this._x=t||0,this._y=e||0,this._z=n||0,this.quaternion=new Float64Array(4),this.quaternion[3]=1,this.update()}__init(){this._quatUpdateId=-1}__init2(){this._quatDirtyId=0}__init3(){this._sign=1}get x(){return this._x}set x(t){this._x!==t&&(this._x=t,this._quatDirtyId++)}get y(){return this._y}set y(t){this._y!==t&&(this._y=t,this._quatDirtyId++)}get z(){return this._z}set z(t){this._z!==t&&(this._z=t,this._quatDirtyId++)}get pitch(){return this._x}set pitch(t){this._x!==t&&(this._x=t,this._quatDirtyId++)}get yaw(){return this._y}set yaw(t){this._y!==t&&(this._y=t,this._quatDirtyId++)}get roll(){return this._z}set roll(t){this._z!==t&&(this._z=t,this._quatDirtyId++)}set(t,e,n){const r=t||0,i=e||0,o=n||0;this._x===r&&this._y===i&&this._z===o||(this._x=r,this._y=i,this._z=o,this._quatDirtyId++)}copyFrom(t){const e=t.x,n=t.y,r=t.z;return this._x===e&&this._y===n&&this._z===r||(this._x=e,this._y=n,this._z=r,this._quatDirtyId++),this}copyTo(t){return t.set(this._x,this._y,this._z),t}equals(t){return this._x===t.x&&this._y===t.y&&this._z===t.z}clone(){return new V(this._x,this._y,this._z)}update(){if(this._quatUpdateId===this._quatDirtyId)return!1;this._quatUpdateId=this._quatDirtyId;const t=Math.cos(this._x/2),e=Math.cos(this._y/2),n=Math.cos(this._z/2),r=this._sign,i=r*Math.sin(this._x/2),o=r*Math.sin(this._y/2),a=r*Math.sin(this._z/2),s=this.quaternion;return s[0]=i*e*n+t*o*a,s[1]=t*o*n-i*e*a,s[2]=t*e*a+i*o*n,s[3]=t*e*n-i*o*a,!0}}class q{constructor(t,e,n,r,i){this.cb=t,this.scope=e,q.prototype.__init.call(this),q.prototype.__init2.call(this),q.prototype.__init3.call(this),this._x=n||0,this._y=r||0,this._z=i||0,this.quaternion=new Float64Array(4),this.quaternion[3]=1,this.update()}__init(){this._quatUpdateId=-1}__init2(){this._quatDirtyId=0}__init3(){this._sign=1}get x(){return this._x}set x(t){this._x!==t&&(this._x=t,this._quatDirtyId++,this.cb.call(this.scope))}get y(){return this._y}set y(t){this._y!==t&&(this._y=t,this._quatDirtyId++,this.cb.call(this.scope))}get z(){return this._z}set z(t){this._z!==t&&(this._z=t,this._quatDirtyId++,this.cb.call(this.scope))}get pitch(){return this._x}set pitch(t){this._x!==t&&(this._x=t,this._quatDirtyId++,this.cb.call(this.scope))}get yaw(){return this._y}set yaw(t){this._y!==t&&(this._y=t,this._quatDirtyId++,this.cb.call(this.scope))}get roll(){return this._z}set roll(t){this._z!==t&&(this._z=t,this._quatDirtyId++,this.cb.call(this.scope))}set(t,e,n){const r=t||0,i=e||0,o=n||0;return this._x===r&&this._y===i&&this._z===o||(this._x=r,this._y=i,this._z=o,this._quatDirtyId++,this.cb.call(this.scope)),this}copyFrom(t){const e=t.x,n=t.y,r=t.z;return this._x===e&&this._y===n&&this._z===r||(this._x=e,this._y=n,this._z=r,this._quatDirtyId++,this.cb.call(this.scope)),this}copyTo(t){return t.set(this._x,this._y,this._z),t}equals(t){return this._x===t.x&&this._y===t.y&&this._z===t.z}clone(){return new V(this._x,this._y,this._z)}update(){if(this._quatUpdateId===this._quatDirtyId)return!1;this._quatUpdateId=this._quatDirtyId;const t=Math.cos(this._x/2),e=Math.cos(this._y/2),n=Math.cos(this._z/2),r=this._sign,i=r*Math.sin(this._x/2),o=r*Math.sin(this._y/2),a=r*Math.sin(this._z/2),s=this.quaternion;return s[0]=i*e*n+t*o*a,s[1]=t*o*n-i*e*a,s[2]=t*e*a+i*o*n,s[3]=t*e*n-i*o*a,!0}}const H=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];class G{static __initStatic(){this.IDENTITY=new G}static __initStatic2(){this.TEMP_MATRIX=new G}__init(){this.floatArray=null}__init2(){this._dirtyId=0}__init3(){this._updateId=-1}__init4(){this._mat4inv=null}__init5(){this.cacheInverse=!1}constructor(t){G.prototype.__init.call(this),G.prototype.__init2.call(this),G.prototype.__init3.call(this),G.prototype.__init4.call(this),G.prototype.__init5.call(this),this.mat4=new Float64Array(t||H)}get a(){return this.mat4[0]/this.mat4[15]}set a(t){this.mat4[0]=t*this.mat4[15]}get b(){return this.mat4[1]/this.mat4[15]}set b(t){this.mat4[1]=t*this.mat4[15]}get c(){return this.mat4[4]/this.mat4[15]}set c(t){this.mat4[4]=t*this.mat4[15]}get d(){return this.mat4[5]/this.mat4[15]}set d(t){this.mat4[5]=t*this.mat4[15]}get tx(){return this.mat4[12]/this.mat4[15]}set tx(t){this.mat4[12]=t*this.mat4[15]}get ty(){return this.mat4[13]/this.mat4[15]}set ty(t){this.mat4[13]=t*this.mat4[15]}set(t,e,n,r,i,o){const a=this.mat4;return a[0]=t,a[1]=e,a[2]=0,a[3]=0,a[4]=n,a[5]=r,a[6]=0,a[7]=0,a[8]=0,a[9]=0,a[10]=1,a[11]=0,a[12]=i,a[13]=o,a[14]=0,a[15]=1,this}toArray(t,e){this.floatArray||(this.floatArray=new Float32Array(9));const n=e||this.floatArray,r=this.mat4;return t?(n[0]=r[0],n[1]=r[1],n[2]=r[3],n[3]=r[4],n[4]=r[5],n[5]=r[7],n[6]=r[12],n[7]=r[13],n[8]=r[15]):(n[0]=r[0],n[1]=r[4],n[2]=r[12],n[3]=r[2],n[4]=r[6],n[5]=r[13],n[6]=r[3],n[7]=r[7],n[8]=r[15]),n}setToTranslation(t,e,n){const r=this.mat4;r[0]=1,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=1,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[10]=1,r[11]=0,r[12]=t,r[13]=e,r[14]=n,r[15]=1}setToRotationTranslationScale(t,e,n,r,i,o,a){const s=this.mat4,c=t[0],l=t[1],u=t[2],h=t[3],d=c+c,f=l+l,p=u+u,g=c*d,m=c*f,y=c*p,v=l*f,_=l*p,b=u*p,x=h*d,w=h*f,C=h*p;return s[0]=(1-(v+b))*i,s[1]=(m+C)*i,s[2]=(y-w)*i,s[3]=0,s[4]=(m-C)*o,s[5]=(1-(g+b))*o,s[6]=(_+x)*o,s[7]=0,s[8]=(y+w)*a,s[9]=(_-x)*a,s[10]=(1-(g+v))*a,s[11]=0,s[12]=e,s[13]=n,s[14]=r,s[15]=1,s}apply(t,e){e=e||new z;const n=this.mat4,r=t.x,i=t.y,o=t.z||0,a=1/(n[3]*r+n[7]*i+n[11]*o+n[15]);return e.x=a*(n[0]*r+n[4]*i+n[8]*o+n[12]),e.y=a*(n[1]*r+n[5]*i+n[9]*o+n[13]),e.z=a*(n[2]*r+n[6]*i+n[10]*o+n[14]),e}translate(t,e,n){const r=this.mat4;return r[12]=r[0]*t+r[4]*e+r[8]*n+r[12],r[13]=r[1]*t+r[5]*e+r[9]*n+r[13],r[14]=r[2]*t+r[6]*e+r[10]*n+r[14],r[15]=r[3]*t+r[7]*e+r[11]*n+r[15],this}scale(t,e,n){const r=this.mat4;return r[0]*=t,r[1]*=t,r[2]*=t,r[3]*=t,r[4]*=e,r[5]*=e,r[6]*=e,r[7]*=e,void 0!==n&&(r[8]*=n,r[9]*=n,r[10]*=n,r[11]*=n),this}scaleAndTranslate(t,e,n,r,i,o){const a=this.mat4;a[0]=t*a[0]+r*a[3],a[1]=e*a[1]+i*a[3],a[2]=n*a[2]+o*a[3],a[4]=t*a[4]+r*a[7],a[5]=e*a[5]+i*a[7],a[6]=n*a[6]+o*a[7],a[8]=t*a[8]+r*a[11],a[9]=e*a[9]+i*a[11],a[10]=n*a[10]+o*a[11],a[12]=t*a[12]+r*a[15],a[13]=e*a[13]+i*a[15],a[14]=n*a[14]+o*a[15]}applyInverse(t,e){e=e||new z,this._mat4inv||(this._mat4inv=new Float64Array(16));const n=this._mat4inv,r=this.mat4,i=t.x,o=t.y;let a=t.z||0;this.cacheInverse&&this._updateId===this._dirtyId||(this._updateId=this._dirtyId,G.glMatrixMat4Invert(n,r));const s=1/(n[3]*i+n[7]*o+n[11]*a+n[15]),c=s*(n[0]*i+n[4]*o+n[8]*a+n[12]),l=s*(n[1]*i+n[5]*o+n[9]*a+n[13]),u=s*(n[2]*i+n[6]*o+n[10]*a+n[14]);a+=1;const h=1/(n[3]*i+n[7]*o+n[11]*a+n[15]),d=h*(n[0]*i+n[4]*o+n[8]*a+n[12]),f=h*(n[1]*i+n[5]*o+n[9]*a+n[13]),p=h*(n[2]*i+n[6]*o+n[10]*a+n[14]);Math.abs(u-p)<1e-10&&e.set(NaN,NaN,0);const g=(0-u)/(p-u);return e.set((d-c)*g+c,(f-l)*g+l,0),e}invert(){return G.glMatrixMat4Invert(this.mat4,this.mat4),this}invertCopyTo(t){this._mat4inv||(this._mat4inv=new Float64Array(16));const e=this._mat4inv,n=this.mat4;this.cacheInverse&&this._updateId===this._dirtyId||(this._updateId=this._dirtyId,G.glMatrixMat4Invert(e,n)),t.mat4.set(e)}identity(){const t=this.mat4;return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}clone(){return new G(this.mat4)}copyTo3d(t){const e=this.mat4,n=t.mat4;return n[0]=e[0],n[1]=e[1],n[2]=e[2],n[3]=e[3],n[4]=e[4],n[5]=e[5],n[6]=e[6],n[7]=e[7],n[8]=e[8],t}copyTo2d(t){const e=this.mat4,n=t.mat3;return n[0]=e[0],n[1]=e[1],n[2]=e[3],n[3]=e[4],n[4]=e[5],n[5]=e[7],n[6]=e[12],n[7]=e[13],n[8]=e[15],t}copyTo2dOr3d(t){return t instanceof x?this.copyTo2d(t):this.copyTo3d(t)}copyTo(t,e,n){const r=this.mat4,i=1/r[15],o=r[12]*i,a=r[13]*i;if(t.a=(r[0]-r[3]*o)*i,t.b=(r[1]-r[3]*a)*i,t.c=(r[4]-r[7]*o)*i,t.d=(r[5]-r[7]*a)*i,t.tx=o,t.ty=a,e>=2){let r=t.a*t.d-t.b*t.c;n||(r=Math.abs(r)),e===m.POINT?(r=r>0?1:-1,t.a=r,t.b=0,t.c=0,t.d=r):e===m.AXIS_X?(r/=Math.sqrt(t.b*t.b+t.d*t.d),t.c=0,t.d=r):e===m.AXIS_Y&&(r/=Math.sqrt(t.a*t.a+t.c*t.c),t.a=r,t.c=0)}return t}copyFrom(t){const e=this.mat4;return e[0]=t.a,e[1]=t.b,e[2]=0,e[3]=0,e[4]=t.c,e[5]=t.d,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=1,e[11]=0,e[12]=t.tx,e[13]=t.ty,e[14]=0,e[15]=1,this._dirtyId++,this}setToMultLegacy(t,e){const n=this.mat4,r=e.mat4,i=t.a,o=t.b,a=t.c,s=t.d,c=t.tx,l=t.ty;let u=r[0],h=r[1],d=r[2],f=r[3];return n[0]=u*i+h*a+f*c,n[1]=u*o+h*s+f*l,n[2]=d,n[3]=f,u=r[4],h=r[5],d=r[6],f=r[7],n[4]=u*i+h*a+f*c,n[5]=u*o+h*s+f*l,n[6]=d,n[7]=f,u=r[8],h=r[9],d=r[10],f=r[11],n[8]=u*i+h*a+f*c,n[9]=u*o+h*s+f*l,n[10]=d,n[11]=f,u=r[12],h=r[13],d=r[14],f=r[15],n[12]=u*i+h*a+f*c,n[13]=u*o+h*s+f*l,n[14]=d,n[15]=f,this._dirtyId++,this}setToMultLegacy2(t,e){const n=this.mat4,r=t.mat4,i=r[0],o=r[1],a=r[2],s=r[3],c=r[4],l=r[5],u=r[6],h=r[7],d=e.a,f=e.b,p=e.c,g=e.d,m=e.tx,y=e.ty;return n[0]=d*i+f*c,n[1]=d*o+f*l,n[2]=d*a+f*u,n[3]=d*s+f*h,n[4]=p*i+g*c,n[5]=p*o+g*l,n[6]=p*a+g*u,n[7]=p*s+g*h,n[8]=r[8],n[9]=r[9],n[10]=r[10],n[11]=r[11],n[12]=m*i+y*c+r[12],n[13]=m*o+y*l+r[13],n[14]=m*a+y*u+r[14],n[15]=m*s+y*h+r[15],this._dirtyId++,this}setToMult(t,e){return G.glMatrixMat4Multiply(this.mat4,t.mat4,e.mat4),this._dirtyId++,this}prepend(t){t.mat4?this.setToMult(t,this):this.setToMultLegacy(t,this)}static glMatrixMat4Invert(t,e){const n=e[0],r=e[1],i=e[2],o=e[3],a=e[4],s=e[5],c=e[6],l=e[7],u=e[8],h=e[9],d=e[10],f=e[11],p=e[12],g=e[13],m=e[14],y=e[15],v=n*s-r*a,_=n*c-i*a,b=n*l-o*a,x=r*c-i*s,w=r*l-o*s,C=i*l-o*c,T=u*g-h*p,S=u*m-d*p,k=u*y-f*p,E=h*m-d*g,P=h*y-f*g,R=d*y-f*m;let O=v*R-_*P+b*E+x*k-w*S+C*T;return O?(O=1/O,t[0]=(s*R-c*P+l*E)*O,t[1]=(i*P-r*R-o*E)*O,t[2]=(g*C-m*w+y*x)*O,t[3]=(d*w-h*C-f*x)*O,t[4]=(c*k-a*R-l*S)*O,t[5]=(n*R-i*k+o*S)*O,t[6]=(m*b-p*C-y*_)*O,t[7]=(u*C-d*b+f*_)*O,t[8]=(a*P-s*k+l*T)*O,t[9]=(r*k-n*P-o*T)*O,t[10]=(p*w-g*b+y*v)*O,t[11]=(h*b-u*w-f*v)*O,t[12]=(s*S-a*E-c*T)*O,t[13]=(n*E-r*S+i*T)*O,t[14]=(g*_-p*x-m*v)*O,t[15]=(u*x-h*_+d*v)*O,t):null}static glMatrixMat4Multiply(t,e,n){const r=e[0],i=e[1],o=e[2],a=e[3],s=e[4],c=e[5],l=e[6],u=e[7],h=e[8],d=e[9],f=e[10],p=e[11],g=e[12],m=e[13],y=e[14],v=e[15];let _=n[0],b=n[1],x=n[2],w=n[3];return t[0]=_*r+b*s+x*h+w*g,t[1]=_*i+b*c+x*d+w*m,t[2]=_*o+b*l+x*f+w*y,t[3]=_*a+b*u+x*p+w*v,_=n[4],b=n[5],x=n[6],w=n[7],t[4]=_*r+b*s+x*h+w*g,t[5]=_*i+b*c+x*d+w*m,t[6]=_*o+b*l+x*f+w*y,t[7]=_*a+b*u+x*p+w*v,_=n[8],b=n[9],x=n[10],w=n[11],t[8]=_*r+b*s+x*h+w*g,t[9]=_*i+b*c+x*d+w*m,t[10]=_*o+b*l+x*f+w*y,t[11]=_*a+b*u+x*p+w*v,_=n[12],b=n[13],x=n[14],w=n[15],t[12]=_*r+b*s+x*h+w*g,t[13]=_*i+b*c+x*d+w*m,t[14]=_*o+b*l+x*f+w*y,t[15]=_*a+b*u+x*p+w*v,t}}G.__initStatic(),G.__initStatic2();const Y=new G;class Z extends v{constructor(t,e){super(t,e),Z.prototype.__init.call(this),Z.prototype.__init2.call(this),Z.prototype.__init3.call(this),Z.prototype.__init4.call(this),Z.prototype.__init5.call(this),Z.prototype.__init6.call(this),this.local=new G,this.world=new G,this.local.cacheInverse=!0,this.world.cacheInverse=!0,this.position._z=0,this.scale._z=1,this.pivot._z=0}__init(){this.cameraMatrix=null}__init2(){this._cameraMode=!1}get cameraMode(){return this._cameraMode}set cameraMode(t){this._cameraMode!==t&&(this._cameraMode=t,this.euler._sign=this._cameraMode?-1:1,this.euler._quatDirtyId++,t&&(this.cameraMatrix=new G))}__init3(){this.position=new W(this.onChange,this,0,0)}__init4(){this.scale=new W(this.onChange,this,1,1)}__init5(){this.euler=new q(this.onChange,this,0,0,0)}__init6(){this.pivot=new W(this.onChange,this,0,0)}onChange(){this._projID++}clear(){this.cameraMatrix&&this.cameraMatrix.identity(),this.position.set(0,0,0),this.scale.set(1,1,1),this.euler.set(0,0,0),this.pivot.set(0,0,0),super.clear()}updateLocalTransform(t){if(0===this._projID)return void this.local.copyFrom(t);const e=this.local,n=this.euler,r=this.position,i=this.scale,o=this.pivot;if(n.update(),!this.cameraMode)return e.setToRotationTranslationScale(n.quaternion,r._x,r._y,r._z,i._x,i._y,i._z),e.translate(-o._x,-o._y,-o._z),void e.setToMultLegacy(t,e);e.setToMultLegacy(t,this.cameraMatrix),e.translate(o._x,o._y,o._z),e.scale(1/i._x,1/i._y,1/i._z),Y.setToRotationTranslationScale(n.quaternion,0,0,0,1,1,1),e.setToMult(e,Y),e.translate(-r._x,-r._y,-r._z),this.local._dirtyId++}}class K extends s.W2{constructor(){super(),this.proj=new Z(this.transform)}isFrontFace(t=!1){t&&(this._recursivePostUpdateTransform(),this.displayObjectUpdateTransform());const e=this.proj.world.mat4,n=e[0]*e[15]-e[3]*e[12],r=e[1]*e[15]-e[3]*e[13],i=e[4]*e[15]-e[7]*e[12];return n*(e[5]*e[15]-e[7]*e[13])-i*r>0}getDepth(t=!1){t&&(this._recursivePostUpdateTransform(),this.displayObjectUpdateTransform());const e=this.proj.world.mat4;return e[14]/e[15]}toLocal(t,e,n,r,i=g.ALL){return e&&(t=e.toGlobal(t,n,r)),r||this._recursivePostUpdateTransform(),i===g.ALL?(r||this.displayObjectUpdateTransform(),this.proj.affine?this.transform.worldTransform.applyInverse(t,n):this.proj.world.applyInverse(t,n)):(this.parent?n=this.parent.worldTransform.applyInverse(t,n):(n.x=t.x,n.y=t.y,n.z=t.z),i===g.NONE||(n=this.transform.localTransform.applyInverse(n,n),i===g.PROJ&&this.proj.cameraMode&&(n=this.proj.cameraMatrix.applyInverse(n,n))),n)}get worldTransform(){return this.proj.affine?this.transform.worldTransform:this.proj.world}get position3d(){return this.proj.position}set position3d(t){this.proj.position.copyFrom(t)}get scale3d(){return this.proj.scale}set scale3d(t){this.proj.scale.copyFrom(t)}get euler(){return this.proj.euler}set euler(t){this.proj.euler.copyFrom(t)}get pivot3d(){return this.proj.pivot}set pivot3d(t){this.proj.pivot.copyFrom(t)}}const X=K.prototype.toLocal,$=K.prototype.getDepth,J=K.prototype.isFrontFace;class Q extends K{constructor(){super(),Q.prototype.__init.call(this),Q.prototype.__init2.call(this),Q.prototype.__init3.call(this),Q.prototype.__init4.call(this),this.proj.cameraMode=!0,this.setPlanes(400,10,1e4,!1)}__init(){this._far=0}__init2(){this._near=0}__init3(){this._focus=0}__init4(){this._orthographic=!1}get far(){return this._far}get near(){return this._near}get focus(){return this._focus}get ortographic(){return this._orthographic}setPlanes(t,e=10,n=1e4,r=!1){this._focus=t,this._near=e,this._far=n,this._orthographic=r;const i=this.proj,o=i.cameraMatrix.mat4;i._projID++,o[10]=1/(n-e),o[14]=(t-e)/(n-e),this._orthographic?o[11]=0:o[11]=1/t}}class tt extends l.Kj{constructor(t,e,n,r){super(t,e,n,r),tt.prototype.__init.call(this),this.proj=new Z(this.transform)}__init(){this.vertexData2d=null}calculateVertices(){if(this.proj._affine)return this.vertexData2d=null,void super.calculateVertices();const t=this.geometry,e=t.buffers[0].data,n=this;if(t.vertexDirtyId===n.vertexDirty&&n._transformID===n.transform._worldID)return;n._transformID=n.transform._worldID,n.vertexData.length!==e.length&&(n.vertexData=new Float32Array(e.length)),this.vertexData2d&&this.vertexData2d.length===3*e.length/2||(this.vertexData2d=new Float32Array(3*e.length));const r=this.proj.world.mat4,i=this.vertexData2d,o=n.vertexData;for(let t=0;t<o.length/2;t++){const n=e[2*t],a=e[2*t+1],s=r[0]*n+r[4]*a+r[12],c=r[1]*n+r[5]*a+r[13],l=r[3]*n+r[7]*a+r[15];i[3*t]=s,i[3*t+1]=c,i[3*t+2]=l,o[2*t]=s/l,o[2*t+1]=c/l}n.vertexDirty=t.vertexDirtyId}get worldTransform(){return this.proj.affine?this.transform.worldTransform:this.proj.world}toLocal(t,e,n,r,i=g.ALL){return X.call(this,t,e,n,r,i)}isFrontFace(t){return J.call(this,t)}getDepth(t){return $.call(this,t)}get position3d(){return this.proj.position}set position3d(t){this.proj.position.copyFrom(t)}get scale3d(){return this.proj.scale}set scale3d(t){this.proj.scale.copyFrom(t)}get euler(){return this.proj.euler}set euler(t){this.proj.euler.copyFrom(t)}get pivot3d(){return this.proj.pivot}set pivot3d(t){this.proj.pivot.copyFrom(t)}}tt.prototype._renderDefault=I.prototype._renderDefault;class et extends h.j{constructor(t){super(t),et.prototype.__init.call(this),et.prototype.__init2.call(this),et.prototype.__init3.call(this),this.proj=new Z(this.transform),this.pluginName="batch2d"}__init(){this.vertexData2d=null}__init2(){this.culledByFrustrum=!1}__init3(){this.trimmedCulledByFrustrum=!1}calculateVertices(){const t=this._texture;if(this.proj._affine)return this.vertexData2d=null,void super.calculateVertices();this.vertexData2d||(this.vertexData2d=new Float32Array(12));const e=this.transform._worldID,n=t._updateID;if(this._transformID===e&&this._textureID===n)return;this._textureID!==n&&(this.uvs=t._uvs.uvsFloat32),this._transformID=e,this._textureID=n;const r=this.proj.world.mat4,i=this.vertexData2d,o=this.vertexData,a=t.trim,s=t.orig,c=this._anchor;let l,u,h,d;a?(u=a.x-c._x*s.width,l=u+a.width,d=a.y-c._y*s.height,h=d+a.height):(u=-c._x*s.width,l=u+s.width,d=-c._y*s.height,h=d+s.height);let f,p=!1;i[0]=r[0]*u+r[4]*d+r[12],i[1]=r[1]*u+r[5]*d+r[13],f=r[2]*u+r[6]*d+r[14],i[2]=r[3]*u+r[7]*d+r[15],p=p||f<0,i[3]=r[0]*l+r[4]*d+r[12],i[4]=r[1]*l+r[5]*d+r[13],f=r[2]*l+r[6]*d+r[14],i[5]=r[3]*l+r[7]*d+r[15],p=p||f<0,i[6]=r[0]*l+r[4]*h+r[12],i[7]=r[1]*l+r[5]*h+r[13],f=r[2]*l+r[6]*h+r[14],i[8]=r[3]*l+r[7]*h+r[15],p=p||f<0,i[9]=r[0]*u+r[4]*h+r[12],i[10]=r[1]*u+r[5]*h+r[13],f=r[2]*u+r[6]*h+r[14],i[11]=r[3]*u+r[7]*h+r[15],p=p||f<0,this.culledByFrustrum=p,o[0]=i[0]/i[2],o[1]=i[1]/i[2],o[2]=i[3]/i[5],o[3]=i[4]/i[5],o[4]=i[6]/i[8],o[5]=i[7]/i[8],o[6]=i[9]/i[11],o[7]=i[10]/i[11]}calculateTrimmedVertices(){if(this.proj._affine)return void super.calculateTrimmedVertices();const t=this.transform._worldID,e=this._texture._updateID,n=this;if(n.vertexTrimmedData){if(n._transformTrimmedID===t&&this._textureTrimmedID===e)return}else n.vertexTrimmedData=new Float32Array(8);n._transformTrimmedID=t,this._textureTrimmedID=e;const r=this._texture,i=n.vertexTrimmedData,o=r.orig,a=this._anchor,s=this.proj.world.mat4,c=-a._x*o.width,l=c+o.width,u=-a._y*o.height,h=u+o.height;let d,f=!1,p=1/(s[3]*c+s[7]*u+s[15]);i[0]=p*(s[0]*c+s[4]*u+s[12]),i[1]=p*(s[1]*c+s[5]*u+s[13]),d=s[2]*c+s[6]*u+s[14],f=f||d<0,p=1/(s[3]*l+s[7]*u+s[15]),i[2]=p*(s[0]*l+s[4]*u+s[12]),i[3]=p*(s[1]*l+s[5]*u+s[13]),d=s[2]*l+s[6]*u+s[14],f=f||d<0,p=1/(s[3]*l+s[7]*h+s[15]),i[4]=p*(s[0]*l+s[4]*h+s[12]),i[5]=p*(s[1]*l+s[5]*h+s[13]),d=s[2]*l+s[6]*h+s[14],f=f||d<0,p=1/(s[3]*c+s[7]*h+s[15]),i[6]=p*(s[0]*c+s[4]*h+s[12]),i[7]=p*(s[1]*c+s[5]*h+s[13]),d=s[2]*c+s[6]*h+s[14],f=f||d<0,this.culledByFrustrum=f}_calculateBounds(){if(this.calculateVertices(),this.culledByFrustrum)return;const t=this._texture.trim,e=this._texture.orig;!t||t.width===e.width&&t.height===e.height?this._bounds.addQuad(this.vertexData):(this.calculateTrimmedVertices(),this.trimmedCulledByFrustrum||this._bounds.addQuad(this.vertexTrimmedData))}_render(t){this.calculateVertices(),this.culledByFrustrum||(t.batch.setObjectRenderer(t.plugins[this.pluginName]),t.plugins[this.pluginName].render(this))}containsPoint(t){return!this.culledByFrustrum&&super.containsPoint(t)}get worldTransform(){return this.proj.affine?this.transform.worldTransform:this.proj.world}toLocal(t,e,n,r,i=g.ALL){return X.call(this,t,e,n,r,i)}isFrontFace(t){return J.call(this,t)}getDepth(t){return $.call(this,t)}get position3d(){return this.proj.position}set position3d(t){this.proj.position.copyFrom(t)}get scale3d(){return this.proj.scale}set scale3d(t){this.proj.scale.copyFrom(t)}get euler(){return this.proj.euler}set euler(t){this.proj.euler.copyFrom(t)}get pivot3d(){return this.proj.pivot}set pivot3d(t){this.proj.pivot.copyFrom(t)}}const nt={worldTransform:{get:function(){return this.proj.affine?this.transform.worldTransform:this.proj.world},enumerable:!0,configurable:!0},position3d:{get(){return this.proj.position},set(t){this.proj.position.copy(t)}},scale3d:{get(){return this.proj.scale},set(t){this.proj.scale.copy(t)}},pivot3d:{get(){return this.proj.pivot},set(t){this.proj.pivot.copy(t)}},euler:{get(){return this.proj.euler},set(t){this.proj.euler.copy(t)}}};function rt(){this.proj||(this.proj=new Z(this.transform),this.toLocal=K.prototype.toLocal,this.isFrontFace=K.prototype.isFrontFace,this.getDepth=K.prototype.getDepth,Object.defineProperties(this,nt))}s.W2.prototype.convertTo3d=rt,h.j.prototype.convertTo3d=function(){this.proj||(this.calculateVertices=et.prototype.calculateVertices,this.calculateTrimmedVertices=et.prototype.calculateTrimmedVertices,this._calculateBounds=et.prototype._calculateBounds,this.containsPoint=et.prototype.containsPoint,this.pluginName="batch2d",rt.call(this))},s.W2.prototype.convertSubtreeTo3d=function(){this.convertTo3d();for(let t=0;t<this.children.length;t++)this.children[t].convertSubtreeTo3d()},u.AL.prototype.convertTo3d=u.IE.prototype.convertTo3d=function(){this.proj||(this.calculateVertices=tt.prototype.calculateVertices,this._renderDefault=tt.prototype._renderDefault,"batch2d"!==this.material.pluginName&&(this.material=new l.rY(this.material.texture,{program:r.Program.from(I.defaultVertexShader,I.defaultFragmentShader),pluginName:"batch2d"})),rt.call(this))};class it extends d.xv{constructor(t,e,n){super(t,e,n),it.prototype.__init.call(this),this.proj=new Z(this.transform),this.pluginName="batch2d"}__init(){this.vertexData2d=null}get worldTransform(){return this.proj.affine?this.transform.worldTransform:this.proj.world}toLocal(t,e,n,r,i=g.ALL){return X.call(this,t,e,n,r,i)}isFrontFace(t){return J.call(this,t)}getDepth(t){return $.call(this,t)}get position3d(){return this.proj.position}set position3d(t){this.proj.position.copyFrom(t)}get scale3d(){return this.proj.scale}set scale3d(t){this.proj.scale.copyFrom(t)}get euler(){return this.proj.euler}set euler(t){this.proj.euler.copyFrom(t)}get pivot3d(){return this.proj.pivot}set pivot3d(t){this.proj.pivot.copyFrom(t)}}var ot;it.prototype.calculateVertices=et.prototype.calculateVertices,it.prototype.calculateTrimmedVertices=et.prototype.calculateTrimmedVertices,it.prototype._calculateBounds=et.prototype._calculateBounds,it.prototype.containsPoint=et.prototype.containsPoint,it.prototype._render=et.prototype._render;class at extends r.Geometry{constructor(t=!1){super(),this._buffer=new r.Buffer(null,t,!1),this._indexBuffer=new r.Buffer(null,t,!0),this.addAttribute("aVertexPosition",this._buffer,2,!1,i.vK.FLOAT).addAttribute("aTrans1",this._buffer,3,!1,i.vK.FLOAT).addAttribute("aTrans2",this._buffer,3,!1,i.vK.FLOAT).addAttribute("aSamplerSize",this._buffer,2,!1,i.vK.FLOAT).addAttribute("aFrame",this._buffer,4,!1,i.vK.FLOAT).addAttribute("aColor",this._buffer,4,!0,i.vK.UNSIGNED_BYTE).addAttribute("aTextureId",this._buffer,1,!0,i.vK.FLOAT).addIndex(this._indexBuffer)}}const st=[new a.E9,new a.E9,new a.E9,new a.E9],ct=[0,0,0,0];class lt{constructor(){lt.prototype.__init.call(this),lt.prototype.__init2.call(this),lt.prototype.__init3.call(this),lt.prototype.__init4.call(this)}__init(){this.surfaceID="default"}__init2(){this._updateID=0}__init3(){this.vertexSrc=""}__init4(){this.fragmentSrc=""}fillUniforms(t){}clear(){}boundsQuad(t,e,n){let r=e[0],i=e[1],o=e[0],a=e[1];for(let t=2;t<8;t+=2)r>e[t]&&(r=e[t]),o<e[t]&&(o=e[t]),i>e[t+1]&&(i=e[t+1]),a<e[t+1]&&(a=e[t+1]);if(st[0].set(r,i),this.apply(st[0],st[0]),st[1].set(o,i),this.apply(st[1],st[1]),st[2].set(o,a),this.apply(st[2],st[2]),st[3].set(r,a),this.apply(st[3],st[3]),n)n.apply(st[0],st[0]),n.apply(st[1],st[1]),n.apply(st[2],st[2]),n.apply(st[3],st[3]),e[0]=st[0].x,e[1]=st[0].y,e[2]=st[1].x,e[3]=st[1].y,e[4]=st[2].x,e[5]=st[2].y,e[6]=st[3].x,e[7]=st[3].y;else{for(let t=1;t<=3;t++)if(st[t].y<st[0].y||st[t].y===st[0].y&&st[t].x<st[0].x){const e=st[0];st[0]=st[t],st[t]=e}for(let t=1;t<=3;t++)ct[t]=Math.atan2(st[t].y-st[0].y,st[t].x-st[0].x);for(let t=1;t<=3;t++)for(let e=t+1;e<=3;e++)if(ct[t]>ct[e]){const n=st[t];st[t]=st[e],st[e]=n;const r=ct[t];ct[t]=ct[e],ct[e]=r}if(e[0]=st[0].x,e[1]=st[0].y,e[2]=st[1].x,e[3]=st[1].y,e[4]=st[2].x,e[5]=st[2].y,e[6]=st[3].x,e[7]=st[3].y,(st[3].x-st[2].x)*(st[1].y-st[2].y)-(st[1].x-st[2].x)*(st[3].y-st[2].y)<0)return e[4]=st[3].x,void(e[5]=st[3].y)}}}const ut=new a.y3,ht=new a.Ae,dt=new a.E9;class ft extends lt{constructor(...t){super(...t),ft.prototype.__init.call(this)}__init(){this.distortion=new a.E9}clear(){this.distortion.set(0,0)}apply(t,e){e=e||new a.E9;const n=this.distortion,r=t.x*t.y;return e.x=t.x+n.x*r,e.y=t.y+n.y*r,e}applyInverse(t,e){e=e||new a.E9;const n=t.x,r=t.y,i=this.distortion.x,o=this.distortion.y;if(0===i)e.x=n,e.y=r/(1+o*n);else if(0===o)e.y=r,e.x=n/(1+i*r);else{const t=.5*(r*i-n*o+1)/o,a=t*t+n/o;if(a<=1e-5)return e.set(NaN,NaN),e;e.x=o>0?-t+Math.sqrt(a):-t-Math.sqrt(a),e.y=(n/e.x-1)/i}return e}mapSprite(t,e,n){const r=t.texture;return ht.x=-t.anchor.x*r.orig.width,ht.y=-t.anchor.y*r.orig.height,ht.width=r.orig.width,ht.height=r.orig.height,this.mapQuad(ht,e,n||t.transform)}mapQuad(t,e,n){const r=-t.x/t.width,i=-t.y/t.height,o=(1-t.x)/t.width,a=(1-t.y)/t.height,s=e[0].x*(1-r)+e[1].x*r,c=e[0].y*(1-r)+e[1].y*r,l=e[0].x*(1-o)+e[1].x*o,u=e[0].y*(1-o)+e[1].y*o,h=e[3].x*(1-r)+e[2].x*r,d=e[3].y*(1-r)+e[2].y*r,f=e[3].x*(1-o)+e[2].x*o,p=e[3].y*(1-o)+e[2].y*o,g=s*(1-i)+h*i,m=c*(1-i)+d*i,y=l*(1-i)+f*i,v=u*(1-i)+p*i,_=s*(1-a)+h*a,b=c*(1-a)+d*a,x=l*(1-a)+f*a,w=u*(1-a)+p*a,C=ut;return C.tx=g,C.ty=m,C.a=y-g,C.b=v-m,C.c=_-g,C.d=b-m,dt.set(x,w),C.applyInverse(dt,dt),this.distortion.set(dt.x-1,dt.y-1),n.setFromMatrix(C),this}fillUniforms(t){t.distortion=t.distortion||new Float32Array([0,0,0,0]);const e=Math.abs(this.distortion.x),n=Math.abs(this.distortion.y);t.distortion[0]=1e4*e<=n?0:this.distortion.x,t.distortion[1]=1e4*n<=e?0:this.distortion.y,t.distortion[2]=1/t.distortion[0],t.distortion[3]=1/t.distortion[1]}}const pt=a.wx.prototype.updateTransform;function gt(t){const e=this.proj,n=t.proj,r=this;return n?n._surface?(e._activeProjection=n,this.updateLocalTransform(),this.localTransform.copyTo(this.worldTransform),void(r._parentID<0&&++r._worldID)):(pt.call(this,t),void(e._activeProjection=n._activeProjection)):(pt.call(this,t),void(e._activeProjection=null))}class mt extends p{constructor(...t){super(...t),mt.prototype.__init.call(this),mt.prototype.__init2.call(this),mt.prototype.__init3.call(this),mt.prototype.__init4.call(this),mt.prototype.__init5.call(this)}__init(){this._surface=null}__init2(){this._activeProjection=null}set enabled(t){t!==this._enabled&&(this._enabled=t,t?(this.legacy.updateTransform=gt,this.legacy._parentID=-1):(this.legacy.updateTransform=a.wx.prototype.updateTransform,this.legacy._parentID=-1))}get surface(){return this._surface}set surface(t){this._surface!==t&&(this._surface=t||null,this.legacy._parentID=-1)}applyPartial(t,e){return null!==this._activeProjection?(e=this.legacy.worldTransform.apply(t,e),this._activeProjection.surface.apply(e,e)):null!==this._surface?this.surface.apply(t,e):this.legacy.worldTransform.apply(t,e)}apply(t,e){return null!==this._activeProjection?(e=this.legacy.worldTransform.apply(t,e),this._activeProjection.surface.apply(e,e),this._activeProjection.legacy.worldTransform.apply(e,e)):null!==this._surface?(e=this.surface.apply(t,e),this.legacy.worldTransform.apply(e,e)):this.legacy.worldTransform.apply(t,e)}applyInverse(t,e){return null!==this._activeProjection?(e=this._activeProjection.legacy.worldTransform.applyInverse(t,e),this._activeProjection._surface.applyInverse(e,e),this.legacy.worldTransform.applyInverse(e,e)):null!==this._surface?(e=this.legacy.worldTransform.applyInverse(t,e),this._surface.applyInverse(e,e)):this.legacy.worldTransform.applyInverse(t,e)}mapBilinearSprite(t,e){this._surface instanceof ft||(this.surface=new ft),this.surface.mapSprite(t,e,this.legacy)}__init3(){this._currentSurfaceID=-1}__init4(){this._currentLegacyID=-1}__init5(){this._lastUniforms=null}clear(){this.surface&&this.surface.clear()}get uniforms(){return this._currentLegacyID===this.legacy._worldID&&this._currentSurfaceID===this.surface._updateID||(this._lastUniforms=this._lastUniforms||{},this._lastUniforms.translationMatrix=this.legacy.worldTransform,this._surface.fillUniforms(this._lastUniforms)),this._lastUniforms}}class yt extends h.j{constructor(t){super(t),yt.prototype.__init.call(this),this.proj=new mt(this.transform),this.pluginName="batch_bilinear"}__init(){this.aTrans=new a.y3}_calculateBounds(){this.calculateTrimmedVertices(),this._bounds.addQuad(this.vertexTrimmedData)}calculateVertices(){const t=this.transform._worldID,e=this._texture._updateID;if(this._transformID===t&&this._textureID===e)return;this._transformID=t,this._textureID=e;const n=this._texture,i=this.vertexData,o=n.trim,a=n.orig,s=this._anchor;let c,l,u,h;if(o?(l=o.x-s._x*a.width,c=l+o.width,h=o.y-s._y*a.height,u=h+o.height):(l=-s._x*a.width,c=l+a.width,h=-s._y*a.height,u=h+a.height),this.proj._surface)i[0]=l,i[1]=h,i[2]=c,i[3]=h,i[4]=c,i[5]=u,i[6]=l,i[7]=u,this.proj._surface.boundsQuad(i,i);else{const t=this.transform.worldTransform,e=t.a,n=t.b,r=t.c,o=t.d,a=t.tx,s=t.ty;i[0]=e*l+r*h+a,i[1]=o*h+n*l+s,i[2]=e*c+r*h+a,i[3]=o*h+n*c+s,i[4]=e*c+r*u+a,i[5]=o*u+n*c+s,i[6]=e*l+r*u+a,i[7]=o*u+n*l+s,this.proj._activeProjection&&this.proj._activeProjection.surface.boundsQuad(i,i)}n.uvMatrix||(n.uvMatrix=new r.TextureMatrix(n)),n.uvMatrix.update();const d=this.aTrans;d.set(a.width,0,0,a.height,l,h),null===this.proj._surface&&d.prepend(this.transform.worldTransform),d.invert(),d.prepend(n.uvMatrix.mapCoord)}calculateTrimmedVertices(){const t=this.transform._worldID,e=this._texture._updateID,n=this;if(n.vertexTrimmedData){if(n._transformTrimmedID===t&&this._textureTrimmedID===e)return}else n.vertexTrimmedData=new Float32Array(8);n._transformTrimmedID=t,this._textureTrimmedID=e;const r=this._texture,i=n.vertexTrimmedData,o=r.orig,a=this._anchor,s=-a._x*o.width,c=s+o.width,l=-a._y*o.height,u=l+o.height;if(this.proj._surface)i[0]=s,i[1]=l,i[2]=c,i[3]=l,i[4]=c,i[5]=u,i[6]=s,i[7]=u,this.proj._surface.boundsQuad(i,i,this.transform.worldTransform);else{const t=this.transform.worldTransform,e=t.a,n=t.b,r=t.c,o=t.d,a=t.tx,h=t.ty;i[0]=e*s+r*l+a,i[1]=o*l+n*s+h,i[2]=e*c+r*l+a,i[3]=o*l+n*c+h,i[4]=e*c+r*u+a,i[5]=o*u+n*c+h,i[6]=e*s+r*u+a,i[7]=o*u+n*s+h,this.proj._activeProjection&&this.proj._activeProjection.surface.boundsQuad(i,i,this.proj._activeProjection.legacy.worldTransform)}}get worldTransform(){return this.proj}}h.j.prototype.convertTo2s=function(){this.proj||(this.pluginName="sprite_bilinear",this.aTrans=new a.y3,this.calculateVertices=yt.prototype.calculateVertices,this.calculateTrimmedVertices=yt.prototype.calculateTrimmedVertices,this._calculateBounds=yt.prototype._calculateBounds,s.W2.prototype.convertTo2s.call(this))},s.W2.prototype.convertTo2s=function(){this.proj||(this.proj=new mt(this.transform),Object.defineProperty(this,"worldTransform",{get(){return this.proj},enumerable:!0,configurable:!0}))},s.W2.prototype.convertSubtreeTo2s=function(){this.convertTo2s();for(let t=0;t<this.children.length;t++)this.children[t].convertSubtreeTo2s()};class vt extends d.xv{constructor(t,e,n){super(t,e,n),vt.prototype.__init.call(this),this.proj=new mt(this.transform),this.pluginName="batch_bilinear"}__init(){this.aTrans=new a.y3}get worldTransform(){return this.proj}}vt.prototype.calculateVertices=yt.prototype.calculateVertices,vt.prototype.calculateTrimmedVertices=yt.prototype.calculateTrimmedVertices,vt.prototype._calculateBounds=yt.prototype._calculateBounds,r.Renderer.registerPlugin("batch_bilinear",class{static create(t){const{vertex:e,fragment:n,vertexSize:i,geometryClass:s}=Object.assign({vertex:"precision highp float;\nattribute vec2 aVertexPosition;\nattribute vec3 aTrans1;\nattribute vec3 aTrans2;\nattribute vec2 aSamplerSize;\nattribute vec4 aFrame;\nattribute vec4 aColor;\nattribute float aTextureId;\n\nuniform mat3 projectionMatrix;\nuniform mat3 translationMatrix;\n\nvarying vec2 vertexPosition;\nvarying vec3 vTrans1;\nvarying vec3 vTrans2;\nvarying vec2 vSamplerSize;\nvarying vec4 vFrame;\nvarying vec4 vColor;\nvarying float vTextureId;\n\nvoid main(void){\ngl_Position.xyw = projectionMatrix * translationMatrix * vec3(aVertexPosition, 1.0);\ngl_Position.z = 0.0;\n\nvertexPosition = aVertexPosition;\nvTrans1 = aTrans1;\nvTrans2 = aTrans2;\nvTextureId = aTextureId;\nvColor = aColor;\nvSamplerSize = aSamplerSize;\nvFrame = aFrame;\n}\n",fragment:"precision highp float;\nvarying vec2 vertexPosition;\nvarying vec3 vTrans1;\nvarying vec3 vTrans2;\nvarying vec2 vSamplerSize;\nvarying vec4 vFrame;\nvarying vec4 vColor;\nvarying float vTextureId;\n\nuniform sampler2D uSamplers[%count%];\nuniform vec4 distortion;\n\nvoid main(void){\nvec2 surface;\nvec2 surface2;\n\nfloat vx = vertexPosition.x;\nfloat vy = vertexPosition.y;\nfloat dx = distortion.x;\nfloat dy = distortion.y;\nfloat revx = distortion.z;\nfloat revy = distortion.w;\n\nif (distortion.x == 0.0) {\nsurface.x = vx;\nsurface.y = vy / (1.0 + dy * vx);\nsurface2 = surface;\n} else\nif (distortion.y == 0.0) {\nsurface.y = vy;\nsurface.x = vx / (1.0 + dx * vy);\nsurface2 = surface;\n} else {\nfloat c = vy * dx - vx * dy;\nfloat b = (c + 1.0) * 0.5;\nfloat b2 = (-c + 1.0) * 0.5;\nfloat d = b * b + vx * dy;\nif (d < -0.00001) {\n discard;\n}\nd = sqrt(max(d, 0.0));\nsurface.x = (- b + d) * revy;\nsurface2.x = (- b - d) * revy;\nsurface.y = (- b2 + d) * revx;\nsurface2.y = (- b2 - d) * revx;\n}\n\nvec2 uv;\nuv.x = vTrans1.x * surface.x + vTrans1.y * surface.y + vTrans1.z;\nuv.y = vTrans2.x * surface.x + vTrans2.y * surface.y + vTrans2.z;\n\nvec2 pixels = uv * vSamplerSize;\n\nif (pixels.x < vFrame.x || pixels.x > vFrame.z ||\npixels.y < vFrame.y || pixels.y > vFrame.w) {\nuv.x = vTrans1.x * surface2.x + vTrans1.y * surface2.y + vTrans1.z;\nuv.y = vTrans2.x * surface2.x + vTrans2.y * surface2.y + vTrans2.z;\npixels = uv * vSamplerSize;\n\nif (pixels.x < vFrame.x || pixels.x > vFrame.z ||\n pixels.y < vFrame.y || pixels.y > vFrame.w) {\n discard;\n}\n}\n\nvec4 edge;\nedge.xy = clamp(pixels - vFrame.xy + 0.5, vec2(0.0, 0.0), vec2(1.0, 1.0));\nedge.zw = clamp(vFrame.zw - pixels + 0.5, vec2(0.0, 0.0), vec2(1.0, 1.0));\n\nfloat alpha = 1.0; //edge.x * edge.y * edge.z * edge.w;\nvec4 rColor = vColor * alpha;\n\nfloat textureId = floor(vTextureId+0.5);\nvec2 vTextureCoord = uv;\nvec4 color;\n%forloop%\ngl_FragColor = color * rColor;\n}",geometryClass:at,vertexSize:16},t);return ot=class extends _{constructor(t){super(t),ot.prototype.__init.call(this),ot.prototype.__init2.call(this),ot.prototype.__init3.call(this),this.shaderGenerator=new r.BatchShaderGenerator(e,n),this.geometryClass=s,this.vertexSize=i}__init(){this.defUniforms={translationMatrix:new a.y3,distortion:new Float32Array([0,0,1/0,1/0])}}__init2(){this.size=1e3}__init3(){this.forceMaxTextures=1}getUniforms(t){const{proj:e}=t;return null!==e.surface?e.uniforms:null!==e._activeProjection?e._activeProjection.uniforms:this.defUniforms}packInterleavedGeometry(t,e,n,r,i){const{uint32View:a,float32View:s}=e,c=r/this.vertexSize,l=t.indices,u=t.vertexData,h=t._texture._frame,d=t.aTrans,{_batchLocation:f,realWidth:p,realHeight:g,resolution:m}=t._texture.baseTexture,y=Math.min(t.worldAlpha,1),v=y<1&&t._texture.baseTexture.alphaMode?(0,o.rA)(t._tintRGB,y):t._tintRGB+(255*y<<24);for(let t=0;t<u.length;t+=2)s[r]=u[t],s[r+1]=u[t+1],s[r+2]=d.a,s[r+3]=d.c,s[r+4]=d.tx,s[r+5]=d.b,s[r+6]=d.d,s[r+7]=d.ty,s[r+8]=p,s[r+9]=g,s[r+10]=h.x*m,s[r+11]=h.y*m,s[r+12]=(h.x+h.width)*m,s[r+13]=(h.y+h.height)*m,a[r+14]=v,s[r+15]=f,r+=16;for(let t=0;t<l.length;t++)n[i++]=c+l[t]}},ot}}.create({}))},4504:(t,e,n)=>{n.d(e,{ry:()=>ct,Cz:()=>ht.BeautifyOptions,T$:()=>dt.a,Mj:()=>ht.Mj,UZ:()=>ht.UZ,bk:()=>ht.bk,Iq:()=>G,aR:()=>ut,_$:()=>at});var r=n(6878),i=n(1347),o=n(617);class a{constructor(){this._configCenter=new o.M}async init(){return new Promise(((t,e)=>{this.initDataMap(),wx.initFaceDetect({success(){t()},fail(n){console.log("wx init face fail",n);const{errMsg:r}=n;if(r.indexOf("already init")>-1)return t();e({errMsg:"wx init face fail"})}})}))}send(t){const{data:e,width:n,height:r}=t;new Date;wx.faceDetect({width:n,height:r,frameBuffer:e,enablePoint:!0,enableAngle:!0,success:e=>{const{x:o,y:a}=e,s=e.pointArray,c=e.angleArray;let l={yaw:-c.yaw*Math.PI/2,pitch:c.pitch,roll:c.roll};const u=(o-n/2)/n;l.yaw+=1.4*u;const h=(a-r/2)/(r/2);l.pitch-=h,this.angles=l,s.push(this.getCenterOfTwoPoints(s[96],s[97])),s.push(this.getCenterOfTwoPoints(s[96],s[103])),s.push(this.getCenterOfTwoPoints(s[100],s[99])),s.push(this.getCenterOfTwoPoints(s[100],s[101]));const d=this.getCenterOfTwoPoints(s[78],s[79]),f=1.5*(0,i.Sp)(s[44],s[49]),p=this.getSlope(d,s[49]),g=Math.atan(p),m={x:d.x-f*Math.cos(g)*(g/Math.abs(g)),y:d.y-f*Math.sin(Math.abs(g))};s.push(m);const y=s[0],v=y.y-y.x*p,_=m.y- -1/p*m.x,b=(_-v)/(p- -1/p),x={x:b,y:b*p+v},w=this.twoBezier(.14,m,x,y),C=this.twoBezier(.28,m,x,y),T=this.twoBezier(.42,m,x,y),S=this.twoBezier(.56,m,x,y),k=this.twoBezier(.7,m,x,y),E=this.twoBezier(.85,m,x,y),P=s[32],R=P.y-P.x*p,O={x:(_-R)/(p- -1/p),y:(_-R)/(p- -1/p)*p+R},D=this.twoBezier(.14,m,O,P),A=this.twoBezier(.28,m,O,P),I=this.twoBezier(.42,m,O,P),F=this.twoBezier(.56,m,O,P),L=this.twoBezier(.7,m,O,P),M=this.twoBezier(.85,m,O,P);s.push(w,C,T,D,A,I,S,F,E,k,M,L);const{meshVertex:N,lipVertex:j}=this.getMeshVertex(s);this.triggerResult({landmarks:s,angles:l,image:t,meshVertex:N,lipVertex:j})},fail:e=>{this.triggerResult({landmarks:[],angles:[],image:t,meshVertex:[],lipVertex:[]})}})}onResult(t){this.resultCb=t}triggerResult(t){this.vkstarted||(this.vkstarted=!0),this.detectId=null,this.resultCb&&this.resultCb(t)}twoBezier(t,e,n,r){const{x:i,y:o}=e,{x:a,y:s}=n,{x:c,y:l}=r;return{x:(1-t)*(1-t)*i+2*t*(1-t)*a+t*t*c,y:(1-t)*(1-t)*o+2*t*(1-t)*s+t*t*l}}destroy(){console.log("stopFaceDetect"),wx.stopFaceDetect({success(){console.log("face detect stopped")},fail(){console.log("face detect stop failed")}})}getCenterOfTwoPoints(t,e){return{x:(t.x+e.x)/2,y:(t.y+e.y)/2}}getDistanceOfTwoPoints(t,e){return Math.pow((t.x-e.x)*(t.x-e.x)+(t.y-e.y)*(t.y-e.y),.5)}getSlope(t,e){return e.x===t.x?Number.MAX_SAFE_INTEGER:(e.y-t.y)/(e.x-t.x)}getMeshVertex(t){const{triangulation:e,lipsTriangulation:n,KEY_POINTS:r,LIPS:i,MOUTH_UPPER:o}=this._dataMap,a=[],s=[];if(t){const o=[],l=[],u=this.processLipEdge(t);t.forEach(((t,e)=>{if(r.indexOf(e)>=0){const n=t;o.push([u[e].x,u[e].y]),i.indexOf(e)>=0&&l.push([n.x,n.y])}}));this.addOuterLandmarks(t).forEach(((t,e)=>{o.push([t.x,t.y])}));const h=e;for(var c=0;c<h.length;c+=3){const t=h[c],e=h[c+1],n=h[c+2];a.push(o[t][0]),a.push(o[t][1]),a.push(o[e][0]),a.push(o[e][1]),a.push(o[n][0]),a.push(o[n][1])}for(c=0;c<n.length;c+=3){const t=n[c],e=n[c+1],r=n[c+2];s.push(l[t][0]),s.push(l[t][1]),s.push(l[e][0]),s.push(l[e][1]),s.push(l[r][0]),s.push(l[r][1])}}return{meshVertex:a,lipVertex:s}}processLipEdge(t){const e=JSON.parse(JSON.stringify(t)),{MOUTH_UPPER:n,MOUTH_LOWER:r}=this._dataMap;return n.forEach(((t,n)=>{const i=e[t],o=e[r[n]],a={x:(i.x+o.x)/2,y:(i.y+o.y)/2};i.y=a.y,i.x=a.x,o.y=a.y,o.x=a.x})),e}getAngles(){return this.angles}addOuterLandmarks(t){const{OUTER_REFERENCE:e}=this._dataMap,n=(0,i.Sp)(t[32],t[0]),r=(0,i.Sp)(t[16],t[110]),o=[],a=this.getAngles(t),s=Math.cos(a.roll),c=Math.sin(a.roll),{yaw:l,pitch:u}=a;return e.forEach(((e,i)=>{e.forEach((e=>{let a,u;"object"==typeof e?(a=t[e.x],u=t[e.y]):(a=t[e],u=t[e]);const h=this.getSlope(t[16],t[110]),d=-1/h,f=a.y-a.x*h,p=(f-(u.y-u.x*d))/(d-h),g=p,m=p*h+f,y=[.5,.2];let v,_,b;0===i?(b=y[0]*r,v=g+b*c,_=m-b*Math.abs(s)):1===i?(b=.3*n,l>0&&(b*=Math.cos(2*l)),v=g+b*Math.abs(s),_=m+b*c):2===i?(b=y[1]*r,v=g-b*c,_=m+b*Math.abs(s)):(b=.3*n,l<0&&(b*=Math.cos(2*l)),v=g-b*Math.abs(s),_=m-b*c),o.push({x:v,y:_,z:0})}))})),o}initDataMap(){const t=this._configCenter.getConfigByKeys(["triangulation","OUTER_REFERENCE","POINTS_MAP","KEY_POINTS","LEFT_FACE_OVAL","RIGHT_FACE_OVAL","outer_offset_ratio","MOUTH_UPPER","MOUTH_LOWER","lipsTriangulation","LIPS"]);this._dataMap=t}}class s{setAlpha(t){(t<=0||t>1)&&console.log("alpha should be in (0.0., 1.0]"),this.a=t}constructor(t,e=0){this.y=this.s=e,this.setAlpha(t),this.initialized=!1}filter(t){var e;return this.initialized?e=this.a*t+(1-this.a)*this.s:(e=t,this.initialized=!0),this.y=t,this.s=e,e}filterWithAlpha(t,e){return this.setAlpha(e),this.filter(t)}hasLastRawValue(){return this.initialized}lastRawValue(){return this.y}reset(){this.initialized=!1}}const c=class{alpha(t){var e=1/this.freq;return 1/(1+1/(2*Math.PI*t)/e)}setFrequency(t){t<=0&&console.log("freq should be >0"),this.freq=t}setMinCutoff(t){t<=0&&console.log("mincutoff should be >0"),this.mincutoff=t}setBeta(t){this.beta_=t}setDerivateCutoff(t){t<=0&&console.log("dcutoff should be >0"),this.dcutoff=t}constructor(t,e=1,n=0,r=1){this.setFrequency(t),this.setMinCutoff(e),this.setBeta(n),this.setDerivateCutoff(r),this.x=new s(this.alpha(e)),this.dx=new s(this.alpha(r)),this.lasttime=void 0}reset(){this.x.reset(),this.dx.reset(),this.lasttime=void 0}filter(t,e){null!=this.lasttime&&null!=e&&e!==this.lasttime&&(this.freq=1/(e-this.lasttime)),this.lasttime=e;var n=this.x.hasLastRawValue()?(t-this.x.lastRawValue())*this.freq:0,r=this.dx.filterWithAlpha(n,this.alpha(this.dcutoff)),i=this.mincutoff+this.beta_*Math.abs(r);return this.x.filterWithAlpha(t,this.alpha(i))}};class l{frame0;cacheNum=2;frame1;frame2;frame3;constructor(){}filter(t){if(null===this.frame0||void 0===this.frame0)for(let e=0;e<this.cacheNum;e++)return this[`frame${e}`]=t,t;for(let t=this.cacheNum-1;t>0;t--)this[`frame${t}`]=this["frame"+(t-1)];return this.frame0=t,this.average()}average(){let t=0;for(let e=0;e<this.cacheNum;e++)t+=this[`frame${e}`]||0;return t/this.cacheNum}}class u{session;currentResult;vkstarted;_filterMap={};_angleMap={};taskPromises=[];constructor(t){this._configCenter=new o.M,this._options=t;for(let t=0;t<106;t++)this._filterMap[t+"_x"]=new c(60,.05,80,1),this._filterMap[t+"_y"]=new c(60,.05,80,1),this._filterMap[t+"_z"]=new c(60,.05,80,1);this._angleMap.pitch=new l,this._angleMap.yaw=new l,this._angleMap.roll=new l}async init(){this.initDataMap();const t=wx.createVKSession({track:{face:{mode:2}},version:"v1"});this.session=t,this.session.on("updateAnchors",(t=>{this.currentResult=t[0];const e=this.processData();e.image=this.frame,this.triggerResult(e)})),this.session.on("removeAnchors",(t=>{const e={landmarks:[],angles:{},meshVertex:[],lipVertex:[]};e.image=this.frame,this.triggerResult(e)})),this.session.start()}triggerResult(t){this.vkstarted||(this.vkstarted=!0),this.detectId=null;this.taskPromises.shift()?.(t)}processData(){const t=.01*(new Date).getTime(),e=this.currentResult,n=e.angle;n.pitch=this._angleMap.pitch.filter(n.pitch,t),n.yaw=this._angleMap.yaw.filter(n.yaw,t),n.roll=this._angleMap.roll.filter(n.roll,t),n.yaw=1.1*(n.yaw-.1),n.pitch=.93*(n.pitch+.18),this.angles=n;const r=e.points,{width:o,height:a}=this.detectSize,s=o/a,c=this._options.width/this._options.height;r.forEach(((e,n)=>{c<s?e.x=.5+(e.x-.5)*(this._options.height/a):c>s&&(e.y=.5+(e.y-.5)/(s/c)),this._filterMap[n+"_x"]&&(e.x=this._filterMap[n+"_x"].filter(e.x,t),e.y=this._filterMap[n+"_y"].filter(e.y,t),e.z=this._filterMap[n+"_z"].filter(e.z,t)),e.x*=this._options.width,e.y*=this._options.height})),r.push(this.getCenterOfTwoPoints(r[96],r[97])),r.push(this.getCenterOfTwoPoints(r[96],r[103])),r.push(this.getCenterOfTwoPoints(r[100],r[99])),r.push(this.getCenterOfTwoPoints(r[100],r[101]));const l=this.getCenterOfTwoPoints(r[78],r[79]),u=1.5*(0,i.Sp)(r[44],r[49]),h=this.getSlope(l,r[49]),d=Math.atan(h),f={x:l.x-u*Math.cos(d)*(d/Math.abs(d)),y:l.y-u*Math.sin(Math.abs(d))};r.push(f);const p=r[0],g=p.y-p.x*h,m=f.y- -1/h*f.x,y=(m-g)/(h- -1/h),v={x:y,y:y*h+g},_=this.twoBezier(.14,f,v,p),b=this.twoBezier(.28,f,v,p),x=this.twoBezier(.42,f,v,p),w=this.twoBezier(.56,f,v,p),C=this.twoBezier(.7,f,v,p),T=this.twoBezier(.85,f,v,p),S=r[32],k=S.y-S.x*h,E={x:(m-k)/(h- -1/h),y:(m-k)/(h- -1/h)*h+k},P=this.twoBezier(.14,f,E,S),R=this.twoBezier(.28,f,E,S),O=this.twoBezier(.42,f,E,S),D=this.twoBezier(.56,f,E,S),A=this.twoBezier(.7,f,E,S),I=this.twoBezier(.85,f,E,S);r.push(_,b,x,P,R,O,w,D,T,C,I,A);const{meshVertex:F,lipVertex:L}=this.getMeshVertex(r);return{landmarks:r,angles:this.angles,meshVertex:F,lipVertex:L}}send(t){return new Promise((e=>{if(this.vkstarted&&this.detectId)return;const{data:n,width:r,height:i}=t;this.detectId=+new Date,this.currentResult=null,this.frame=t,this.taskPromises.push(e),this.detectSize={width:r,height:i},this.session.detectFace({frameBuffer:n,width:r,height:i,scoreThreshold:.5,sourceType:0,modelMode:1})}))}twoBezier(t,e,n,r){const{x:i,y:o}=e,{x:a,y:s}=n,{x:c,y:l}=r;return{x:(1-t)*(1-t)*i+2*t*(1-t)*a+t*t*c,y:(1-t)*(1-t)*o+2*t*(1-t)*s+t*t*l}}destroy(){this.session&&(this.session=null),this.taskPromises=[]}getCenterOfTwoPoints(t,e){return{x:(t.x+e.x)/2,y:(t.y+e.y)/2}}getDistanceOfTwoPoints(t,e){return Math.pow((t.x-e.x)*(t.x-e.x)+(t.y-e.y)*(t.y-e.y),.5)}getSlope(t,e){return e.x===t.x?Number.MAX_SAFE_INTEGER:(e.y-t.y)/(e.x-t.x)}getMeshVertex(t){const{triangulation:e,lipsTriangulation:n,KEY_POINTS:r,LIPS:i,MOUTH_UPPER:o}=this._dataMap,a=[],s=[];if(t){const o=[],l=[],u=this.processLipEdge(t);t.forEach(((t,e)=>{if(r.indexOf(e)>=0){const n=t;o.push([u[e].x,u[e].y]),i.indexOf(e)>=0&&l.push([n.x,n.y])}}));this.addOuterLandmarks(t).forEach(((t,e)=>{o.push([t.x,t.y])}));const h=e;for(var c=0;c<h.length;c+=3){const t=h[c],e=h[c+1],n=h[c+2];a.push(o[t][0]),a.push(o[t][1]),a.push(o[e][0]),a.push(o[e][1]),a.push(o[n][0]),a.push(o[n][1])}for(c=0;c<n.length;c+=3){const t=n[c],e=n[c+1],r=n[c+2];s.push(l[t][0]),s.push(l[t][1]),s.push(l[e][0]),s.push(l[e][1]),s.push(l[r][0]),s.push(l[r][1])}}return{meshVertex:a,lipVertex:s}}processLipEdge(t){const e=JSON.parse(JSON.stringify(t)),{MOUTH_UPPER:n,MOUTH_LOWER:r}=this._dataMap;return n.forEach(((t,n)=>{const i=e[t],o=e[r[n]],a={x:(i.x+o.x)/2,y:(i.y+o.y)/2};i.y=a.y,i.x=a.x,o.y=a.y,o.x=a.x})),e}getAngles(){return this.angles}addOuterLandmarks(t){const{OUTER_REFERENCE:e}=this._dataMap,n=(0,i.Sp)(t[32],t[0]),r=(0,i.Sp)(t[16],t[110]),o=[],a=this.getAngles(t),s=Math.cos(a.roll),c=Math.sin(a.roll),{yaw:l,pitch:u}=a;return e.forEach(((e,i)=>{e.forEach((e=>{let a,u;"object"==typeof e?(a=t[e.x],u=t[e.y]):(a=t[e],u=t[e]);const h=this.getSlope(t[16],t[110]),d=-1/h,f=a.y-a.x*h,p=(f-(u.y-u.x*d))/(d-h),g=p,m=p*h+f,y=[.5,.2];let v,_,b;0===i?(b=y[0]*r,v=g+b*c,_=m-b*Math.abs(s)):1===i?(b=.3*n,l>0&&(b*=Math.cos(2*l)),v=g+b*Math.abs(s),_=m+b*c):2===i?(b=y[1]*r,v=g-b*c,_=m+b*Math.abs(s)):(b=.3*n,l<0&&(b*=Math.cos(2*l)),v=g-b*Math.abs(s),_=m-b*c),o.push({x:v,y:_,z:0})}))})),o}initDataMap(){const t=this._configCenter.getConfigByKeys(["triangulation","OUTER_REFERENCE","POINTS_MAP","KEY_POINTS","LEFT_FACE_OVAL","RIGHT_FACE_OVAL","outer_offset_ratio","MOUTH_UPPER","MOUTH_LOWER","lipsTriangulation","LIPS"]);this._dataMap=t}}var h=n(1206),d=n(337),f=n(6879);let p,g,m,y,v,_;if(null==g){p=wx.getSystemInfoSync();let{system:t,version:e}=p;y=e}if(null==g){p=wx.getSystemInfoSync();let{system:t}=p;v=p.SDKVersion,g=t.toLowerCase().indexOf("android")>-1,m=!g,_=parseFloat(v)>=2.25}const b=parseFloat(v)>=2.29;function x(){return p.screenWidth>p.screenHeight}class w extends r.Q4{sprite;options;pushBuffer;stage;tag=!0;realWidth=0;realHeight=0;constructor(t){super(),this.options=t;const e=this.getPusherContent();this.getRealSize(),this.createSprite();const n=e.createOffscreenCanvas({type:"webgl",width:this.realWidth,height:this.realHeight});this.gl=n.getContext("webgl"),m?(this.createFilter(),this.renderer=new h.Th({width:this.realWidth,height:this.realHeight,resolution:1,view:new wx.window.Canvas(n)})):this.initGl()}getRealSize(){const{width:t,height:e}=this.options;m?(this.realWidth=t,this.realHeight=e):(this.realWidth=t/4,this.realHeight=1.5*e)}createSprite(){const t=x(),{width:e,height:n}=this.options,r=this.getPusherContent();console.log(":::::::::画面尺寸",n,e);const i=r.createOffscreenCanvas({type:"2d",width:e,height:n});if(this.ctx2d=i.getContext("2d"),t){const t=n/e;this.ctx2d.translate(i.width/2,i.height/2),m?this.ctx2d.rotate(-Math.PI/2):this.ctx2d.rotate(Math.PI/2),this.ctx2d.translate(-i.height/2,-i.width/2),!m&&this.ctx2d.scale(t,1/t)}const o=h.xE.from(new wx.window.Canvas(i)),a=new h.jy(o);a.anchor.set(.5,.5),a.position.set(e/2,n/2);t?a.scale.set(m?1:-1,1):a.scale.set(m?-1:1.3333333333333333,-1),this.sprite=a,this.pushBuffer=m?new Uint8Array(e*n*4):new Uint8Array(e*n*1.5)}createFilter(){let t=new h.wn(null,"precision lowp float;varying vec2 vTextureCoord;uniform sampler2D uSampler;void main(void){ vec4 color = texture2D(uSampler, vTextureCoord); gl_FragColor = color.bgra;}");this.stage=new h.W2;const e=h.xE.from(new wx.window.Canvas(this.options.output));console.log("::::::::createFilter",this.realWidth,this.realHeight),this.pushSprite=new h.jy(e),this.pushSprite.anchor.set(.5,.5),this.pushSprite.position.set(this.realWidth/2,this.realHeight/2),this.pushSprite.width=this.realWidth,this.pushSprite.height=this.realHeight,this.pushSprite.scale.set(1,-1),this.pushSprite.filters=[t],this.stage.addChild(this.pushSprite)}initGl(){const t=this.gl,e=t.createShader(t.VERTEX_SHADER),n=t.createShader(t.FRAGMENT_SHADER);t.shaderSource(e,"attribute vec2 aVertex;attribute vec2 aUV;varying vec2 vTex;void main(void) { gl_Position = vec4(aVertex, 0.0, 1.0); vTex = aUV;}"),t.shaderSource(n,"\n precision mediump float;\n uniform sampler2D rgbaTexture;\n uniform float height;\n uniform float xUnit;\n varying vec2 vTex;\n \n void main() {\n vec4 coeffsY = vec4(0.299, 0.587, 0.114, 0.0);\n vec4 coeffsU = vec4(-0.14713, -0.28886, 0.436, 0.5);\n vec4 coeffsV = vec4(0.615, -0.515, -0.100, 0.5);\n \n const float V_DIVIDE_LINE = 5.0 / 6.0;\n const float U_DIVIDE_LINE = 1.0 / 1.5;\n \n if (vTex.y <= U_DIVIDE_LINE) {\n vec2 pos0 = vec2(vTex.x - 1.5 * xUnit, vTex.y * 1.5);\n gl_FragColor.r = coeffsY.a + dot(coeffsY.rgb, texture2D(rgbaTexture, pos0).rgb);\n \n vec2 pos1 = vec2(vTex.x - 0.5 * xUnit, vTex.y * 1.5);\n gl_FragColor.g = coeffsY.a + dot(coeffsY.rgb, texture2D(rgbaTexture, pos1).rgb);\n \n vec2 pos2 = vec2(vTex.x + 0.5 * xUnit, vTex.y * 1.5);\n gl_FragColor.b = coeffsY.a + dot(coeffsY.rgb, texture2D(rgbaTexture, pos2).rgb);\n \n vec2 pos3 = vec2(vTex.x + 1.5 * xUnit, vTex.y * 1.5);\n gl_FragColor.a = coeffsY.a + dot(coeffsY.rgb, texture2D(rgbaTexture, pos3).rgb);\n } else if (vTex.y <= V_DIVIDE_LINE) {\n float offsetY = 1.0 / 3.0 / height;\n vec2 texCoord;\n if (vTex.x <= 0.5) {\n texCoord = vec2(vTex.x * 2.0, (vTex.y - U_DIVIDE_LINE) * 2.0 * 3.0);\n } else {\n texCoord = vec2((vTex.x - 0.5) * 2.0, ((vTex.y - U_DIVIDE_LINE) * 2.0 + offsetY) * 3.0);\n }\n vec4 color0 = texture2D(rgbaTexture, texCoord);\n vec4 color1 = texture2D(rgbaTexture, texCoord + vec2(xUnit * 2.0, 0.));\n vec4 color2 = texture2D(rgbaTexture, texCoord + vec2(xUnit * 4.0, 0.));\n vec4 color3 = texture2D(rgbaTexture, texCoord + vec2(xUnit * 6.0, 0.));\n float u0 = coeffsU.a + dot(coeffsU.rgb, color0.rgb);\n float u1 = coeffsU.a + dot(coeffsU.rgb, color1.rgb);\n float u2 = coeffsU.a + dot(coeffsU.rgb, color2.rgb);\n float u3 = coeffsU.a + dot(coeffsU.rgb, color3.rgb);\n gl_FragColor = vec4(u0, u1, u2, u3);\n } else {\n float offsetY = 1.0 / 3.0 / height;\n vec2 texCoord;\n if (vTex.x <= 0.5) {\n texCoord = vec2(vTex.x * 2.0, (vTex.y - V_DIVIDE_LINE) * 2.0 * 3.0);\n } else {\n texCoord = vec2((vTex.x - 0.5) * 2.0, ((vTex.y - V_DIVIDE_LINE) * 2.0 + offsetY) * 3.0);\n }\n vec4 color0 = texture2D(rgbaTexture, texCoord);\n vec4 color1 = texture2D(rgbaTexture, texCoord + vec2(xUnit * 2.0, 0.));\n vec4 color2 = texture2D(rgbaTexture, texCoord + vec2(xUnit * 4.0, 0.));\n vec4 color3 = texture2D(rgbaTexture, texCoord + vec2(xUnit * 6.0, 0.));\n float u0 = coeffsV.a + dot(coeffsV.rgb, color0.rgb);\n float u1 = coeffsV.a + dot(coeffsV.rgb, color1.rgb);\n float u2 = coeffsV.a + dot(coeffsV.rgb, color2.rgb);\n float u3 = coeffsV.a + dot(coeffsV.rgb, color3.rgb);\n gl_FragColor = vec4(u0, u1, u2, u3);\n }\n return;\n }"),t.compileShader(e),t.compileShader(n);const r=t.createProgram();t.attachShader(r,e),t.attachShader(r,n),t.linkProgram(r),t.useProgram(r),t.progObj=r,t.viewport(0,0,this.realWidth,this.realHeight);const i=t.createBuffer();t.bindBuffer(t.ARRAY_BUFFER,i),t.bufferData(t.ARRAY_BUFFER,new Float32Array([-1,1,-1,-1,1,-1,1,1]),t.STATIC_DRAW),t.vertexBuff=i;const o=t.createBuffer();t.bindBuffer(t.ARRAY_BUFFER,o),t.bufferData(t.ARRAY_BUFFER,new Float32Array([0,1,0,0,1,0,1,1]),t.STATIC_DRAW),t.texBuff=o;const a=t.getAttribLocation(r,"aVertex"),s=t.getAttribLocation(r,"aUV"),c=t.getUniformLocation(r,"height"),l=t.getUniformLocation(r,"xUnit");t.uniform1f(c,this.options.height),t.uniform1f(l,1/this.options.width);const u=t.createTexture();t.bindTexture(t.TEXTURE_2D,u),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,this.options.output),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.NEAREST),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.NEAREST),t.tex=u,t.enableVertexAttribArray(a),t.bindBuffer(t.ARRAY_BUFFER,i),t.vertexAttribPointer(a,2,t.FLOAT,!1,0,0),t.enableVertexAttribArray(s),t.bindBuffer(t.ARRAY_BUFFER,o),t.bindTexture(t.TEXTURE_2D,u),t.vertexAttribPointer(s,2,t.FLOAT,!1,0,0)}getPusherContent(){if(this.options?.live?.pusherContext||(this.options.live.pusherContext=wx.createLivePusherContext()),!this.options.live.pusherContext)throw new Error("livepusherContext is not available");return this.options.live.pusherContext}async init(){await this.authorize(),this.start()}async authorize(){if(!wx.authorize)return;let t,e;t=await this.authScope("scope.record");const n=()=>{setTimeout((async r=>{e=await this.authScope("scope.camera"),""===e?n():t&&e||await this.openSetting()}),500)};n()}async openSetting(){return new Promise(((t,e)=>{wx.showModal({content:d.Z.t("0002"),confirmText:d.Z.t("0003"),showCancel:!1,success:e=>{e.confirm?wx.openSetting({success:e=>{console.log("wx auth setting",e),e.authSetting["scope.record"]&&e.authSetting["scope.camera"]&&r.Nd.trigger("error",{code:f.U.AUTH_NEED_RELOAD_PAGE,message:d.Z.t("0013")}),this.authorize().then((()=>{t()}))},fail:()=>{t()}}):e.cancel&&t()}})}))}async authScope(t){return new Promise((async e=>{const n=await this.getSetting();return"scope.camera"===t&&void 0===n[t]?e(""):n[t]?e(!0):void wx.authorize({scope:t,success(){e(!0)},fail(){e(!1)}})}))}async getSetting(){return new Promise(((t,e)=>{wx.getSetting({success:e=>{t(e.authSetting)},fail:()=>{e()}})}))}generatePusherData(){m?(this.pushSprite.texture.update(),this.renderer.render(this.stage)):(this.gl.texSubImage2D(this.gl.TEXTURE_2D,0,0,0,this.gl.RGBA,this.gl.UNSIGNED_BYTE,this.options.output),this.gl.drawArrays(this.gl.TRIANGLE_FAN,0,4)),this.gl.readPixels(0,0,this.realWidth,this.realHeight,this.gl.RGBA,this.gl.UNSIGNED_BYTE,this.pushBuffer),this.ready=!0}start(){const t=this.getPusherContent();t.onCustomRendererEvent("frame",(()=>{if(this.ctx2d.drawImage(t,0,0),this.sprite.texture.update(),this.ready)return this.pushBuffer.buffer}))}stop(){this.getPusherContent().onCustomRendererEvent("frame",null)}destroy(){this.sprite=null,this.stop(),this.generatePusherData=null}}class C extends r.Q4{sprite;listener;options;cameraContext;constructor(t){const e={...t,width:t.width/1,height:t.height/1};super(),this.options=e,this.cameraContext=t.camera?.cameraContext}async init(){await this.authorize(),await this.initCameraIns(),console.log("wx camera init done")}async authorize(){if(!wx.authorize)return;let t,e;t=await this.authScope("scope.record");const n=()=>{setTimeout((async r=>{e=await this.authScope("scope.camera"),""===e?n():t&&e||await this.openSetting()}),500)};n()}async openSetting(){return new Promise(((t,e)=>{wx.showModal({content:d.Z.t("0002"),confirmText:d.Z.t("0003"),showCancel:!1,success:e=>{e.confirm?wx.openSetting({success:e=>{console.log("wx auth setting",e),e.authSetting["scope.record"]&&e.authSetting["scope.camera"]&&r.Nd.trigger("error",{code:f.U.AUTH_NEED_RELOAD_PAGE,message:d.Z.t("0013")}),this.authorize().then((()=>{t()}))},fail:()=>{t()}}):e.cancel&&t()}})}))}async authScope(t){return new Promise((async e=>{const n=await this.getSetting();return"scope.camera"===t&&void 0===n[t]?e(""):n[t]?e(!0):void wx.authorize({scope:t,success(){e(!0)},fail(){e(!1)}})}))}async getSetting(){return new Promise(((t,e)=>{wx.getSetting({success:e=>{t(e.authSetting)},fail:()=>{e()}})}))}async initCameraIns(){this.cameraContext=this.cameraContext||wx.createCameraContext();const t=this.cameraContext.onCameraFrame((t=>{this.frame=t}));this.listener=t,this.start()}readPixels(){return this.frame}async startRecord(t){return this.recording=!0,new Promise(((e,n)=>{this.cameraContext.startRecord({timeoutCallback:t=>{console.log("camera start record timeout",t),this.trigger("timeout",t),this.recording=!1,e(t)},success:n=>{t&&t(),e(n)},fail:t=>{r.Nd.trigger("error",{code:f.U.START_REACORD_FAIL,message:d.Z.t("0009"),error:t})}})}))}async stopRecord(t=!1){return this.recording=!1,new Promise(((e,n)=>{this.cameraContext.stopRecord({compressed:t,success:t=>{e(t)},fail:t=>{r.Nd.trigger("error",{code:f.U.STOP_REACORD_FAIL,message:d.Z.t("0010"),error:t})}})}))}start(){this.listener.start()}stop(){this.listener.stop()}destroy(){this.listener&&(this.listener.stop(),this.listener=null),this.sprite&&(this.sprite=null),this.cameraContext&&(this.cameraContext=null)}}class T{options;frame;constructor(t){this.options=t,this.canvas=wx.createOffscreenCanvas({type:"2d"})}async init(){const t=this.options,{width:e,height:n,input:r}=t;if(r.src){if(!(r.src instanceof ArrayBuffer))return new Promise(((t,i)=>{this.canvas.width=e,this.canvas.height=n;const o=this.canvas.createImage();o.onload=()=>{const e=this.canvas.getContext("2d");e.drawImage(o,0,0);const{data:n}=e.getImageData(0,0,o.width,o.height);this.frame={data:n.buffer,width:o.width,height:o.height},o.src="",t()},o.src=r.src}));this.frame={data:r.src,width:e,height:n}}}readPixels(){return this.frame}destroy(){}}const S=wx.window;class k{canvas=null;_target=null;_input=null;constructor(t){const e={...t,width:t.width/1,height:t.height/1};if(this._options=e,!e.manual){const{width:t,height:n}=e;let r;r=wx.createCanvas(),r.width=t,r.height=n,this.pixels=new Uint8Array(t*n*4),this.canvas=new S.Canvas(r),this._target=new h.W2,this.renderer=new h.Th({view:this.canvas,width:e.width,height:e.height}),this.gl=this.renderer.gl,this._renderFunc=()=>{this.render()},h.vB.shared.add(this._renderFunc)}}render(){const t=this.input;if(t&&t.tick){if(!t.tick())return!1}return this.renderer.render(this._target),!0}set input(t){if(this._input=t,this._target&&t.sprite){this._target.children.forEach((t=>{this._target.removeChild(t)}));try{t.sprite.scale.x=t.sprite.scale.x/1,t.sprite.scale.y=t.sprite.scale.y/1,this._target.addChild(t.sprite)}catch(t){console.log("add child fail",t)}}}get input(){return this._input}async load(t){}destroy(){this._renderFunc&&h.vB.shared.remove(this._renderFunc),this.renderer&&this.renderer.destroy(!0),this._target&&this._target.destroy(!0),this.canvas&&(this.canvas=null)}init(t){}readPixels(){if(this.input.readPixels)return this.input.readPixels();const{width:t,height:e}=this._options;this.gl.readPixels(0,0,t,e,this.gl.RGBA,this.gl.UNSIGNED_BYTE,this.pixels);return{data:this.pixels.buffer,width:t,height:e}}typedArrayToBuffer(t){return t.buffer.slice(t.byteOffset,t.byteLength+t.byteOffset)}async getCanvasNode(){return new Promise((t=>{wx.createSelectorQuery().select("#input-canvas").node().exec((e=>{const n=e[0].node;t(n)}))}))}}var E=n(6237),P=n(401);class R{count=0;mediaContainer;videoRecorder;audioRecorder;audioPath;audioRecorderStarted=!1;recording=!1;options;constructor(t){this.options=t;const{canvas:e,fps:n,audio:r={}}=t;this.createRecorder(e);const{onStart:i,onStop:o}=r;this.audioRecorder=wx.getRecorderManager(),this.audioRecorder.onStop((t=>{this.audioPath=t.tempFilePath,this.audioRecorderStarted=!1,o&&o(t)})),this.audioRecorder.onStart((()=>{this.audioRecorderStarted=!0,i&&i()})),this.mediaContainer=wx.createMediaContainer()}createRecorder(t){try{let e={duration:600,fps:"offscreen"===P.iN||g?30:60,gop:12,timeUpdateInterval:"offscreen"===P.iN||g?30:60,cumulativeStamp:!1,videoBitsPerSecond:3e3};console.log("recorder options",e),this.videoRecorder&&this.videoRecorder.destroy().catch((t=>{}));const n=wx.createMediaRecorder(t,e);this.videoRecorder=n,n.on("start",(()=>{console.log("recorder start success")}))}catch(t){r.Nd.trigger("error",{code:f.U.START_REACORD_FAIL,message:d.Z.t("0008"),error:t})}}async start(){this.videoRecorder&&(await this.videoRecorder.start().catch((t=>{r.Nd.trigger("error",{code:f.U.START_REACORD_FAIL,message:d.Z.t("0009")}),console.error("recorder start error",t)})),await this.startAudioRecorder(),this.recordStartTime=+new Date,this.recording=!0)}async stop(t){if(!this.videoRecorder)return;let e,n;this.recording=!1,this.audioRecorder.stop();try{e=(await this.videoRecorder.stop()).tempFilePath}catch(e){t.destroy||r.Nd.trigger("error",{code:f.U.STOP_REACORD_FAIL,message:d.Z.t("0010"),error:e})}if(console.log("stop record",e),e)try{const{videoTrack:r}=await this.getTracks(e);let i=[r];if(t.musicPath){const{audioTrack:e}=await this.getTracks(t.musicPath).catch((t=>{console.log("music separation fail",t)}));console.log("musicTrack",e),e._audioType="music",i.push(e)}if(t.useOriginAudio){const t=await this.getAudioPath(),{audioTrack:e}=await this.getTracks(t).catch((t=>{}));i.push(e)}n=await this.mergeTracks(...i).catch((t=>{}))}catch(t){n={tempFilePath:e}}try{this.videoRecorder.destroy()}catch(t){console.log("videoRecorder destroy error",t)}try{this.mediaContainer.destroy()}catch(t){console.log("mediaContainer destroy error",t)}return this.videoRecorder=null,n}async startAudioRecorder(){const{audio:t}=this.options;return console.log("zy sdk startAudioRecorder",t),new Promise((e=>{let n,r=()=>{this.audioRecorderStarted?(e(this.audioRecorderStarted),n&&clearTimeout(n)):n=setTimeout(r,10)};this.audioRecorder.start({duration:6e5,format:"mp3",...t}),r()}))}getRecorder(){return this.videoRecorder}async loop(){this.recording&&this.videoRecorder&&this.audioRecorderStarted&&await this.videoRecorder.requestFrame()}async getTracks(t){return new Promise(((e,n)=>{this.mediaContainer.extractDataSource({source:t,success:async({tracks:t})=>{let n,r;for(let e=0;e<t.length;e++)"audio"===t[e].kind?r=t[e]:"video"===t[e].kind&&(n=t[e]);e({audioTrack:r,videoTrack:n})},fail(t){console.log("failed to separate audio track",t),n(t)}})}))}async mergeTracks(t,...e){return new Promise(((n,r)=>{this.mediaContainer.addTrack(t),t.slice(.06,t.duration),e.forEach((e=>{this.mediaContainer.addTrack(e),"music"!==e._audioType&&e.slice(e.duration-t.duration+.06,2*e.duration)})),this.mediaContainer.export({success:r=>{this.mediaContainer.removeTrack(t),e.forEach((t=>{this.mediaContainer.removeTrack(t)})),n(r)},fail:t=>{console.log("mediaContainer export fail",t),r(t)}})}))}async getAudioPath(){return new Promise((t=>{let e,n=()=>{this.audioPath?(t(this.audioPath),e&&clearTimeout(e),this.audioPath=null):e=setTimeout(n,20)};n()}))}}class O extends r.Q4{sprite;options;video;constructor(t){super(),this.options=t}destroy(){try{this.video&&this.video.destroy()}catch(t){}}async init(){if(!this.sprite)return this.getVideoDecoder(),await this.start().catch((t=>{throw new Error("decoder start fail")})),new Promise((async(t,e)=>{let n=async()=>{const e=await this.tick();if(console.log("input init res",e),e)return this._inited=!0,t();setTimeout((()=>{n()}),100)};await n()}))}read(){return this.video.getFrameData()}tick(){const t=this.video.getFrameData();if(!t)return!1;const{width:e,height:n,data:r}=t;if(this.sprite)this.sprite.texture.baseTexture.resource.data=new Uint8Array(r),this.sprite.texture.update();else{const t=h.xE.fromBuffer(new Uint8Array(r),e,n),i=new h.jy(t),o=Math.max(this.options.width/e,this.options.height/n);this.sprite=i,i.anchor.set(.5,.5),i.x=this.options.width/2,i.y=this.options.height/2;const a=wx.getSystemInfoSync();let{system:s}=a;-1===s.toLowerCase().indexOf("android")?i.scale.set(o,o):i.scale.set(o,-o)}return!0}getVideoDecoder(){const t=wx.createVideoDecoder();return this.video=t,t}async start(){return new Promise(((t,e)=>{const{input:n,width:r,height:i}=this.options;this.video.on("start",(()=>{console.log("decoder start success",n),t()})),this.video.on("bufferchange",(()=>{console.log("decoder buffer change")})),this.video.on("error",(t=>{console.log("decoder error",t),e({errMsg:"decoder error"})})),this.video.on("ended",(()=>{console.log("decoder decode ended"),this.trigger("ended")})),this.video.start({source:n,mode:1,abortAudio:!0})}))}async getFps(t){return new Promise(((e,n)=>{let r=wx.createVideoDecoder();r.on("error",(t=>{console.log("init fps error",t),e(30)})),r.on("start",(t=>{console.log("player init fps",t.fps),r&&r.stop().catch((t=>{})),e(t.fps)})),r.on("stop",(()=>{r&&r.remove().catch((()=>{})),r=null})),r.start({source:t,mode:1,abortAudio:!0})}))}stop(){this.video.stop()}destroy(){this.video.remove()}}var D=n(3120),A=n(6309),I=n(5127),F=n(3553),L=n(8586),M=n(6109),N=function(){return N=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},N.apply(this,arguments)},j=function(t,e,n,r){var i,o=arguments.length,a=o<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,n,r);else for(var s=t.length-1;s>=0;s--)(i=t[s])&&(a=(o<3?i(a):o>3?i(e,n,a):i(e,n))||a);return o>3&&a&&Object.defineProperty(e,n,a),a},U=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},B=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function a(t){try{c(r.next(t))}catch(t){o(t)}}function s(t){try{c(r.throw(t))}catch(t){o(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(a,s)}c((r=r.apply(t,e||[])).next())}))},z=function(t,e){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=a.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=e.call(t,a)}catch(t){o=[6,t],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}},W=(0,M.jl)("Auth"),V=(0,P.rR)("68,74,74,70,73,3a,2f,2f,77,65,62,61,72,2e,71,63,6c,6f,75,64,2e,63,6f,6d,2f,73,64,6b"),q=function(){function t(t,e,n,r,i){void 0===r&&(r=""),void 0===i&&(i=""),this.cd=new o.M,this.license=t,this.appid=e+"",this.authFunc=n,this.wechatAppId=r,this.c=new I.Y}return Object.defineProperty(t.prototype,"version",{get:function(){var t,e="1.0.24".split(".");return t=0==e[0]&&e[1]<3?"v0":0==e[0]&&3==e[1]&&e[2]<4?"v1":"v2",W.info("sdk version",t),t},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"language",{set:function(t){W.info("wx set language",t),d.Z.lang=t},enumerable:!1,configurable:!0}),t.prototype.exsureAuthData=function(){return B(this,void 0,void 0,(function(){return z(this,(function(t){switch(t.label){case 0:return"102"===this.appid&&(this.authFunc=this.getTemplateAuth.bind(this)),[4,this.authFunc()];case 1:return[2,t.sent()]}}))}))},t.prototype.exsurehad=function(){return B(this,void 0,void 0,(function(){var t,e,n;return z(this,(function(r){switch(r.label){case 0:return[4,this.c.init()];case 1:return r.sent(),[4,this._ts()];case 2:return t=r.sent(),[4,this.exsureAuthData()];case 3:return e=r.sent(),n=this.c.run2(t+"",this.wechatAppId,this.appid),[2,N(N({},e),{key:n,sdkts:t})]}}))}))},t.prototype._ts=function(){return B(this,void 0,void 0,(function(){var t,e,n=this;return z(this,(function(r){switch(r.label){case 0:return[4,this._uc()];case 1:return t=r.sent(),e="".concat(V).concat(t.ti),[2,new Promise((function(t,r){wx.request({url:e,method:"POST",header:{},success:function(e){var r=e.data,i=n.c.a_de(r),o=JSON.parse(i);t(o[(0,P.rR)(P.gz)])},fail:function(e){W.info("wx fetch error",e),t(e)}})}))]}}))}))},t.prototype.getTemplateAuth=function(){var t=this;return new Promise((function(e,n){wx.request({url:"https://1253707637-fkgh1gso7n-gz.scf.tencentcs.com",method:"GET",header:{},success:function(n){var r=n.data,i=t.c.a_de(r),o=JSON.parse(i);e(o)},fail:function(t){W.info("wx fetch error",t),e(t)}})}))},t.prototype._f=function(t,e){return B(this,void 0,void 0,(function(){var n,i,o,a,s,c,l,u,h,p,g,m,y,v=this;return z(this,(function(_){switch(_.label){case 0:return n="Preset"===e.Type&&JSON.stringify(e),this.had?[3,2]:(i=this,[4,this.exsurehad()]);case 1:i.had=_.sent(),_.label=2;case 2:return o=function(){return B(v,void 0,void 0,(function(){var n,r,i=this;return z(this,(function(o){switch(o.label){case 0:return e.Version=this.version,n=this.c.a_en(JSON.stringify(Object.assign({LicenseKey:this.license,AccountArea:"en"===d.Z.lang?1:0},e))),r={p:n},[4,new Promise((function(e,n){wx.request({url:t,method:"POST",header:{"content-type":"application/json",appid:i.appid,timestamp:i.had.timestamp,signature:i.had.signature,authorize:i.had.key,wechatappid:i.wechatAppId,sdktimestamp:i.had.sdkts+"",Language:"en"===d.Z.lang?"en-US":"zh-CN"},data:r,success:function(t){var n=t.data,r=i.c.a_de(n);e(JSON.parse(r))},fail:function(t){W.info("wx fetch error",t),e(t)}})}))];case 1:return[2,o.sent()]}}))}))},n?[3,3]:(s=!1,[3,6]);case 3:return"pending"!==F.Z.get(n)?[3,5]:(c=0,[4,new Promise((function(t,e){var r=function(){c++,a=setTimeout((function(){"pending"!==F.Z.get(n)?(clearTimeout(a),t(void 0),s=!0):c<10?r():(clearTimeout(a),t(void 0),s=!1)}),300)};r()}))]);case 4:return _.sent(),[3,6];case 5:F.Z.has(n)?(s=!0,l=F.Z.get(n),u=l[(0,P.rR)(P.Eh)],((h=+new Date)-1e3*u>6e5||1e3*u>h+6e5)&&(s=!1)):(F.Z.set(n,"pending"),s=!1),_.label=6;case 6:return s?(g=F.Z.get(n),[3,9]):[3,7];case 7:return[4,o()];case 8:g=_.sent(),_.label=9;case 9:return 101!=(p=g).Code?[3,12]:(m=this,[4,this.exsurehad()]);case 10:return m.had=_.sent(),[4,o()];case 11:return p=_.sent(),[3,16];case 12:return 106!=p.Code?[3,15]:(y=this,[4,this.exsurehad()]);case 13:return y.had=_.sent(),[4,o()];case 14:return p=_.sent(),[3,16];case 15:0!==p.Code&&(n&&F.Z.remove(n),101==p.Code?r.Nd.trigger("error",{code:f.U.SIGNATURE_TIMEOUT,message:"Signature timeout, retry failed."}):106==p.Code?r.Nd.trigger("error",{code:f.U.AUTHORIZE_TIMEOUT,message:"Authorize timeout, retry failed."}):r.Nd.trigger("error",{code:f.U.REQUEST_FAIL,message:p.Message})),_.label=16;case 16:return 0===p.Code?(p.WeChatAppId!==this.wechatAppId&&(r.Nd.trigger("error",{code:f.U.AUTH_FAIL,message:d.Z.t("0034")}),p={Code:-1,Data:{}}),n&&F.Z.set(n,p)):F.Z.remove(n),[2,p]}}))}))},t.prototype._uc=function(){return B(this,void 0,void 0,(function(){return z(this,(function(t){switch(t.label){case 0:return[4,this.cd.load()];case 1:return t.sent(),[2,this.cd.getDataConfig(30)]}}))}))},t.prototype._cuid=function(){return!("object"!=typeof navigator||"string"!=typeof navigator.userAgent||!/electron/i.test(navigator.userAgent)||location.host&&("string"!=typeof location.host||!location.host.startsWith("file://")))},t.prototype.go=function(){return B(this,void 0,void 0,(function(){var t,e,n,r,i,o;return z(this,(function(a){switch(a.label){case 0:return a.trys.push([0,3,,4]),[4,this._uc()];case 1:return t=a.sent(),[4,this._f("".concat(V).concat(t.au),{})];case 2:return e=a.sent(),n=(e.Data||{})[(0,P.rR)(P.hJ)]||[],r=[],i=Object.entries(P.ty),n.forEach((function(t){var e=(0,P.$G)(t),n=i.find((function(t){return t[1]===e}));r.push(n[0])})),F.Z.set((0,P.rR)(P.Ty),r),[2,e];case 3:return o=a.sent(),W.info("ar sdk fetch auth error",o),[2,new Error("fetch auth failed")];case 4:return[2]}}))}))},t.prototype.getAllEffectList=function(t){return void 0===t&&(t={}),B(this,void 0,void 0,(function(){var e,n,r,i;return z(this,(function(o){switch(o.label){case 0:return"Preset"===t.Type&&(void 0!==t.Label&&""!==t.Label||(t.Label=[d.Z.t("1001"),d.Z.t("1002")])),[4,this._uc()];case 1:return e=o.sent(),[4,this._f("".concat(V).concat(e.ae),N({Type:"Custom",PageNumber:0,PageSize:1e3},t))];case 2:return(n=o.sent())&&0==n.Code?(r=n.Data.EffectList,i=[],(i="Preset"===t.Type?r.filter((function(t){return!(t.Label.indexOf(d.Z.t("1004"))>-1&&!H("effect_sticker_3d")||t.Label.indexOf(d.Z.t("1005"))>-1&&!H("avatar_vr")||t.Label.indexOf(d.Z.t("1006"))>-1&&!H("avatar_ar"))})):r).forEach((function(t){F.Z.set(t.EffectId,t)})),[2,i]):[2,n]}}))}))},t.prototype.getEffect=function(t){return B(this,void 0,void 0,(function(){var e,n;return z(this,(function(r){switch(r.label){case 0:return F.Z.has(t.EffectId)?[2,F.Z.get(t.EffectId)]:[4,this._uc()];case 1:return e=r.sent(),[4,this._f("".concat(V).concat(e.ef),t)];case 2:return(n=r.sent())&&0==n.Code&&n.Data&&n.Data.Url?(F.Z.set(t.EffectId,n.Data),[2,n.Data]):n.Data&&!n.Data.Url?[2,{message:"invalid id"}]:[2,n]}}))}))},t.prototype.getEffectList=function(t){return void 0===t&&(t={}),B(this,void 0,void 0,(function(){var e;return z(this,(function(n){switch(n.label){case 0:return[4,this.getAllEffectList(t)];case 1:return(e=n.sent())&&e.OtherEffectList&&e.OtherEffectList.length&&r.Nd.trigger("error",{code:f.U.SDK_VERSION_LOW_ERROR,message:d.Z.t("0014")}),e&&e.EffectList?"Preset"===t.Type?[2,e.EffectList]:[2,e.EffectList.filter((function(t){return"Custom"===t.Type}))]:[2,e]}}))}))},t.prototype.getFilterList=function(){return B(this,void 0,void 0,(function(){var t;return z(this,(function(e){switch(e.label){case 0:return[4,this.getAllEffectList({Type:"Preset",Label:d.Z.t("1003")})];case 1:return(t=e.sent())&&t.EffectList?[2,t.EffectList]:[2,t]}}))}))},t.prototype.getAvatarList=function(t){return B(this,void 0,void 0,(function(){var e,n;return z(this,(function(r){switch(r.label){case 0:return e=d.Z.t("1006"),"VR"===t&&(e=d.Z.t("1005")),[4,this.getAllEffectList({Type:"Preset",Label:e})];case 1:return(n=r.sent())&&n.EffectList?[2,n.EffectList]:[2,n]}}))}))},t=j([L.e,U("design:paramtypes",[String,String,Function,String,String])],t)}(),H=function(t){var e=F.Z.get((0,P.rR)(P.Ty)),n=Object.entries(P.ty).find((function(e){return e[1]===(0,P.$G)(t)}));return!(!e||!e.find((function(t){return t===n[0]})))};function G(t,e,n,i){return B(this,void 0,void 0,(function(){var o,a,s,c;return z(this,(function(l){switch(l.label){case 0:return(0,r.E5)(),a=wx.getAccountInfoSync(),s=a.miniProgram.appId,o=new q(t,e,n,s),i&&(o.language=i),[4,o.go()];case 1:if(0!==(null==(c=l.sent())?void 0:c.Code))throw new Error(c);return[2,{getEffectList:o.getEffectList.bind(o),getFilterList:o.getFilterList.bind(o)}]}}))}))}var Y=n(3044),Z=n(3483),K=n.n(Z),X=!1;function $(t,e){!X&&t&&(X=!0,setTimeout((function(){new(K())({id:"1309122168"==t?"j4LDpiL2PlRmZ9ljaJ":"Gl3L4fE8vE5bqOVbV0",uin:t,ext1:t,ext2:e,reportApiSpeed:!0,spa:!1})}),1e3))}var J=n(4809),Q=n(9984);const tt=`${wx.env.USER_DATA_PATH}/ar`;class et extends r.Q4{background=null;stickers=[];filter=null;disabled=!1;constructor(t){super();let{auth:e,live:n}=t;const{licenseKey:i,appId:o,authFunc:a}=e,s=wx.getAccountInfoSync();this.auth=new q(i,o,a,s.miniProgram.appId),r.Nd.on("error",(t=>{this.trigger("error",t)})),$(o),this.checkReady=this.auth.go().then((t=>0===t.Code&&(this.trigger("created"),this.trigger("ready"),!0))).catch((()=>!1)),this.config=n}async clearStickers(){this.getPusherContent().clearStickers()}async resetStickers(){const t=this.getPusherContent();let e,n;return this.clearStickers(),this.background&&(e=new Promise(((e,n)=>{t.applySticker({type:"back",stickers:[{id:this.background.id,title:this.background.id,len:1,active:-1,path:this.background.path,segtype:0}],success:t=>{e(t)},fail:n})}))),this.stickers.length&&(n=new Promise(((e,n)=>{t.applySticker({type:"front",stickers:this.stickers.map((t=>({id:t.id,title:t.id,len:1,active:-1,pos:t.pos,path:t.path,segtype:0}))),success:t=>{e(t)},fail:n})}))),Promise.all([e,n])}async transSticker(t=[]){const e=t.map((async t=>{const[e,n]=this.getFilename(t.url);return t.id=e,t.path=await this.getZipDataPath(t.url,e,n),t}));return Promise.all(e)}async getEffect(t){if("debug"===t)return{Url:"https://webar-static.tencent-cloud.com/custom-effect/1309122168/1658976205287/effect.bin"};return await this.auth.getEffect({EffectId:t})}getPusherContent(){return this.config.pusherContext||(this.config.pusherContext=wx.createLivePusherContext()),this.config.pusherContext}getFilename(t=""){if(t instanceof ArrayBuffer)return["buffer"+Date.now(),"png"];const e=t.split("/"),n=e[e.length-1]||"test.png",r=parseInt((new Date).valueOf()/1e3);let[i="test",o="png"]=n.split(".");return i=i.replace(/[^a-zA-Z0-9]/g,"")+r,[i,o]}async getImageSize(t){return new Promise(((e,n)=>{wx.getImageInfo({src:t,success:t=>{e({width:t.width,height:t.height})},fail:n})}))}async preloadVcubeFile(t,e){await(0,Q.sN)(tt);const n=`${tt}/${t}`,r=await(0,Q.nH)(n),i=wx.getFileSystemManager();if(!r){const r=await(0,Q.pe)(t,e);await new Promise(((t,e)=>{i.unzip({zipFilePath:r,targetPath:n,success:t,fail:e,complete:()=>{i.unlink({filePath:r})}})}))}return new Promise(((t,e)=>{i.readFile({filePath:`${n}/content.json`,encoding:"utf8",success:({data:e})=>{const r=JSON.parse(e);t([n,r])},fail:e})}))}async download(t){return t instanceof ArrayBuffer?t:new Promise(((e,n)=>{wx.request({url:t,responseType:"arrayBuffer",success:t=>{const{data:n}=t;e(n)},fail:t=>{n(t)}})}))}async getZipDataPath(t,e,n){await(0,Q.sN)(tt);const r=`${tt}/${e}.zip`;if(await(0,Q.nH)(r))return r;const i=await this.download(t),o=new Uint8Array(i),a=(0,J.Xo)({[`${e}_0.${n}`]:o});return await new Promise(((t,e)=>{wx.getFileSystemManager().writeFile({filePath:r,data:a.buffer,encoding:"binary",success:()=>{t()},fail:t=>{e(t)}})})),r}async setBackground(t){t=t||{};const{type:e,src:n=""}=t;if("image"!==e&&n)return new Error("live mode is not supported");if(!n)return this.background=null,this.resetStickers();if(!await this.checkReady)throw this.trigger("error",{code:f.U.AUTH_FAIL,message:"Arsdk is not ready"}),new Error("Arsdk is not ready");return[this.background]=await this.transSticker([{url:n}]),this.resetStickers()}async clearFile(t){let e=wx.getFileSystemManager();return new Promise(((n,r)=>{e.unlink({filePath:t,success:n,fail:r})}))}async _setFilter(t,e=1){this.filter=[t,e];const n=this.getPusherContent();return new Promise(((r,i)=>{n.applyFilter({path:t,md5:"",alpha:e,success:r,fail:i})}))}async setWatermark(t=[]){if(!t?.length)return this.stickers=[],this.resetStickers();if(!await this.checkReady)throw this.trigger("error",{code:f.U.AUTH_FAIL,message:"Arsdk is not ready"}),new Error("Arsdk is not ready");return this.stickers=await this.transSticker(t),this.resetStickers()}async setFilter(t,e=1){if(!await this.checkReady)throw this.trigger("error",{code:f.U.AUTH_FAIL,message:"Arsdk is not ready"}),new Error("Arsdk is not ready");const{Url:n}=await this.getEffect(t),[r,i]=await this.preloadVcubeFile(t,n),o=`${r}/${i.filter[0].src}`;await(0,Q.nH)(o);return this._setFilter(o,e)}disable(){if(this.disabled)return;this.disabled=!0;const t=this.getPusherContent();t.clearStickers(),t.clearFilters()}async enable(){if(this.disabled)return this.disabled=!1,this.filter&&await this._setFilter(...this.filter),this.resetStickers()}destroy(){this.disable(),this.auth=null,this.stickers=[],this.filter=null,this.background=null}}const nt=0,rt=2,it=3,ot=4;function at(t){t&&(P.F3.defaultRoot=t.replace(/^\/|\/$/g,""))}const st={whiten:0,dermabrasion:0,lift:0,shave:0,eye:0,chin:0};class ct extends r.Q4{_input;_detector;_ready=!1;_renderer;_options;_renderFunc;renderSprite;outputCanvas;outputRenderer;lastestEffectIds=[];loadedIdMap=new Map;tickworker;input_type;count=0;flag_1=!1;flag_2=!1;disabled=!1;el=new A.e({});takePhotoPromises=[];get enableFaceDetect(){return!this.disabled&&(this.flag_1||this.flag_2)}disable(){this.disabled||(this.disabled=!0,this._renderer&&(this._renderer.disable(),this._renderer.disableExclusiveFilter()))}enable(){this.disabled&&(this.disabled=!1,this._renderer&&(this._renderer.enable(),this._renderer.enableExclusiveFilter()))}constructor(t){h.U1(),super();const{auth:e,input:n,live:i,camera:o,beautify:a,loading:s,output:c,plugin3d:l,language:u}=t;if((0,r.E5)(),d.Z.lang=u||"zh",n){if(!("string"==typeof n||n?.width&&n?.height))return void r.Nd.trigger("error",{message:d.Z.t("0004"),code:f.U.INPUT_ERROR});this.input_type=it}else if(o)this.input_type=nt;else{if(!i)return void r.Nd.trigger("error",{message:d.Z.t("0005"),code:f.U.INPUT_ERROR});if(this.input_type=ot,!b)throw new Error("The current WeChat version does not support it. Please upgrade and try again");if("native"===i.mode)return new et(t)}this.isReadyPromise=this.startAuth(e);const p={camera:o,input:n,live:i,mirror:this.input_type===nt&&o.mirror,beautify:a,plugin3d:l,output:new wx.window.Canvas(c)};s&&s.enable&&(p.enableLoadingIcon=s.enable,p.loadingIconOptions={size:s.size,lineWidth:s.lineWidth,strokeColor:s.strokeColor}),this._options=p,this.getAutoSize(n||o||i).then((({width:t,height:n})=>{this._options.width=t,this._options.height=n,"offscreen"===P.iN&&this.input_type!==ot&&(this.outputCanvas=new wx.window.Canvas(wx.createOffscreenCanvas({type:"webgl",width:this._options.width,height:this._options.height})),this.outputRenderer=new h.Th({view:this.outputCanvas,width:this._options.width,height:this._options.height,preserveDrawingBuffer:!0,antialias:!1})),this.init(),$(e.appId,e.sdkAppId)})),wx.onMemoryWarning?.((()=>{console.log("Out of memory!"),this.el.clearCache(),(0,Y.UI)()}))}async getAutoSize(t){if(this.input_type===ot){let e=t?.pushSize;return e?.realHeight&&e?.realWidth||(e=ct.getRealSize(720)),{width:e?.realWidth,height:e?.realHeight}}return this.input_type===nt?{width:t.width,height:t.height}:this.input_type===it?t.width&&t.height?{width:t.width,height:t.height}:new Promise(((e,n)=>{wx.getImageInfo({src:t,success:n=>{e({width:n.width,height:n.height}),this._options.input={src:t,...n}},fail:n})})):void 0}init(){wx.requestAnimationFrame=this._options.output.requestAnimationFrame,wx.cancelAnimationFrame=this._options.output.cancelAnimationFrame,this._detector=_?new u(this._options):new a,this._input=new k({...this._options,manual:this.input_type===nt||this.input_type===it}),this._renderer=new E.g(this._options),this.inputNode=this.getInputNode(),Promise.all([this.isReadyPromise.then((()=>this.trigger("created"))),this._initCommonResLoader(),this.inputNode.init(),this._detector.init(),this._renderer.addBeautyAsync("default",this._options.beautify||{})]).then((()=>{this._input.input=this.inputNode,this.checkIsBeauti(this._options.beautify),this._ready||(this.trigger("ready"),this._ready=!0),this._initMainLoop()})),r.Nd.on("error",(t=>{this.trigger("error",t)}))}_initMainLoop(){this._renderFunc=async()=>{let t="low"===this._options.live?.fps?4:2;this.input_type===it&&(t=10),this.count%t==0&&this.render().catch((t=>console.log("render fail",t))),this.count++,this.count>=4&&(this.count=0)},h.vB.shared.add(this._renderFunc)}logTime(t){const e=+new Date;console.log(`${t}时间:${e-this.currentTime}`),this.currentTime=e}async setInput(t){const{width:e,height:n}=await this.getAutoSize(t);this._options.width=e,this._options.height=n,this.outputCanvas.width=e,this.outputCanvas.height=n,this.outputRenderer.resize(n,n),this._options.input.src=t?.src||t,this._renderer.options={...this._options},await this.inputNode.init(),this._ready&&this.render()}async render(){if(this._destroyed)return;const t=this._input.readPixels();if(!t?.width)return!1;if(this.enableFaceDetect){const e=await this._detector.send(t),{landmarks:n,angles:r,meshVertex:i,lipVertex:o}=e;this._renderer.setMesh(i),this._renderer.setReshapeMarks(n),this._renderer.tick({landmarks:n,meshVertex:i,lipVertex:o,angles:r,image:this.input_type===ot?this._input.canvas:t,isLivePusher:this.input_type===ot})}else this._renderer.tick({landmarks:[],meshVertex:[],lipVertex:[],angles:{},image:this.input_type===ot?this._input.canvas:t,isLivePusher:this.input_type===ot});this.recordRender(),this._takePhoto(),this.transcodeLive()}recordRender(){if(this.recording)if("offscreen"===P.iN){if(this.ttt=new Date,this.renderSprite){this.renderSprite.texture.update()}else{let t=h.xE.from(this._renderer._canvas);this.renderSprite=new h.jy(t),this.renderSprite.anchor.set(.5,.5),this.renderSprite.position.x=this.renderSprite.width/2,this.renderSprite.position.y=this.renderSprite.height/2,!g||"8.0.28"!=y&&"8.0.29"!=y&&"8.0.30"!=y?this.renderSprite.scale.set(1,1):this.renderSprite.scale.set(1,-1)}this.outputRenderer.render(this.renderSprite),this.recordCanvasRendered||(this.recordCanvasRendered=!0)}else this.recorder.loop();else if(this.takingPhoto){const t=this._renderer.getPixels();this.cacheImage=t}}async startAuth(t){const{licenseKey:e,appId:n,authFunc:r}=t,i=wx.getAccountInfoSync();this._a=new q(e,n,r,i.miniProgram.appId);const o=await this._a.go();return 0!==o?.Code?Promise.reject(o.Message):o}async getEffectList(t={}){return await this._a.getEffectList(t)}async getEffect(t){if("debug"===t)return{Url:"https://webar-static.tencent-cloud.com/custom-effect/1309122168/1658976205287/effect.bin"};const e=await this._a.getEffect({EffectId:t});return e.Url?e:Promise.reject(e.message)}async getCommonFilter(){return await this._a.getFilterList()}async _initCommonResLoader(){const t=new D.KI;await t.init()}getInputNode(){if(this.input_type===it)return new T(this._options);if(this.input_type===rt){const t=new O(this._options);return t.on("ended",(()=>{this.trigger("ended")})),t}return this.input_type===ot?new w(this._options):new C(this._options)}checkIsBeauti(t){t=t||{},Object.keys(t).some((e=>"whiten"!==e&&"dermabrasion"!==e&&t[e]))?this.flag_1=!0:this.flag_1=!1}setBeautify(t){t=t||{},t={...st,...t},H("beautify")?(this.checkIsBeauti(t),this.checkReady().then((()=>{this._renderer.switchMode("Sticker"),this._renderer.updateBeauty("default",t)}))):this.trigger("error",{code:f.U.AUTH_API_FAIL,message:d.Z.t("0007")})}setEffect(t,e,n){if(!H("effect_makeup")||!H("effect_sticker_2d"))return void this.trigger("error",{code:f.U.AUTH_API_FAIL,message:d.Z.t("0007")});if(!this._renderer)return void this.trigger("error",{code:f.U.SET_EFFECT_ERROR,message:"no face detected"});t.length?this.flag_2=!0:this.flag_2=!1;let r=[],i=[],o=[];if(Array.isArray(t))t.forEach((t=>{if(t instanceof Object){r.push(t.id);let e=t.intensity;e=this._checkVoid(e)?1:e,i.push(t.intensity);let n=t.filterIntensity;o.push(this._checkVoid(n)?e:n)}else r.push(t),i.push(1),o.push(1)}));else if(t instanceof Object){r=[t.id];let e=t.intensity;e=this._checkVoid(e)?1:e,i=[e],i=[t.intensity];let n=t.filterIntensity;o=[this._checkVoid(n)?e:n]}else r=[t],i=[1],o=[1];this.setEffectInner(r,i,o,e,n)}_checkVoid(t){return null==t}setEffectInner(t,e,n,i,o){this.el.clearCache(),this.lastestEffectIds=t,this._renderer.showLoading(),Promise.all(t.map((t=>this.getEffect(t).then((t=>t.Url))))).then((async r=>{t.some((t=>-1===this.lastestEffectIds.indexOf(t)))||(await E.g.preloadEffects(r),this._renderer.hideLoading(),t.some((t=>-1===this.lastestEffectIds.indexOf(t)))||(i&&"function"==typeof i&&i(),this._renderer.switchMode("Sticker"),this._renderer.setEffect(r,e,n,(()=>!!H("effect_sticker_3d")||(this.trigger("error",{code:f.U.AUTH_API_FAIL,message:d.Z.t("0007")}),!1))).then((t=>{}))))})).catch((e=>{console.log("set effect error",t,e),r.Nd.trigger("error",{code:f.U.SET_EFFECT_ERROR,message:"set effect error",error:e}),this._renderer.hideLoading(),o&&"function"==typeof o&&o()}))}setFilter(t,e=1,n,i){H("filter")?this._renderer?t&&"none"!==t?(this.loadedIdMap.has(t)||this._renderer.showLoading(),this.getEffect(t).then((async r=>{this.loadedIdMap.has(t)||await E.g.preloadEffects([r.Url]),this._renderer.hideLoading(),this.loadedIdMap.set(t,r.Url),n&&"function"==typeof n&&n(),this._renderer.switchMode("Sticker"),this._renderer.setExclusiveFilter(r.Url,e)})).catch((t=>{r.Nd.trigger("error",{code:f.U.SET_FILTER_ERROR,message:"set filter error",error:t}),this._renderer.hideLoading(),i&&"function"==typeof i&&i()}))):this._renderer.removeExclusiveFilter():this.trigger("error",{code:f.U.SET_FILTER_ERROR,message:"no face detected"}):this.trigger("error",{code:f.U.AUTH_API_FAIL,message:d.Z.t("0007")})}async checkReady(){return new Promise((t=>{let e;const n=()=>{this._ready?(t(),e&&clearTimeout(e)):e=setTimeout(n,1e3)};n()}))}async startRecord(t={audio:{format:"mp3"},recordCamera:!1}){if(!this.recording){if(this.input_type===ot)throw new Error("record in live mode is not support");return this.recording=!0,this.recorder=new R({canvas:"offscreen"===P.iN?this.outputCanvas:this._options.output,...t}),await this.recorder.start(),this._startTime=+new Date,"offscreen"===P.iN&&(this.tickworker=wx.createWorker(`${P.F3.defaultRoot}/worker/tick.worker.js`),this.tickworker.onMessage((()=>{this.recorder.loop()})),this.tickworker.postMessage("start")),t.recordCamera&&this.inputNode.startRecord(),this.recorder}}async stopRecord(t={useOriginAudio:!1,destroy:!1,compressed:!1}){if(!this.recording)return;if(g){const t=3e3,e=t=>new Promise(((e,n)=>{console.log("wait time",t),setTimeout((()=>e()),t)}));await e(Math.max(0,t-(+new Date-this._startTime)))}this.tickworker.postMessage("stop"),this.tickworker.terminate();const e=await this.recorder.stop(t);if(this.recorder=null,this.recording=!1,this.inputNode.recording){const{tempVideoPath:n}=await this.inputNode.stopRecord(t.compressed);e.cameraVideoPath=n}return e}async getVideoInfo(t){return new Promise(((e,n)=>{wx.getVideoInfo({src:t,success:t=>{e(t)},fail:()=>{n({errMsg:"get video info fail"})}})}))}async takePhoto(t=!1){return new Promise((e=>{this.takePhotoPromises.push(e),t&&this.render()}))}_takePhoto(){const t=this.takePhotoPromises.shift();if(t){const c=this.cacheImage||this._renderer.getPixels(),{data:l,width:u,height:h}=c;for(var e=new Uint8ClampedArray(this.typedArrayToBuffer(l)),n=h/2|0,r=4*u,i=new Uint8ClampedArray(4*u),o=0;o<n;++o){var a=o*r,s=(h-o-1)*r;i.set(e.subarray(a,a+r)),e.copyWithin(a,s,s+r),e.set(i,s)}t({uint8ArrayData:e,width:u,height:h})}}typedArrayToBuffer(t){return t.buffer.slice(t.byteOffset,t.byteLength+t.byteOffset)}start(){h.vB.shared.start()}stop(){h.vB.shared.stop()}toggleOccluder(){this._renderer.app3d.toggleOccluder()}destroy(t=!0){this._a.had=void 0,this._destroyed=!0,(0,r.SZ)(),this._renderFunc&&h.vB.shared.remove(this._renderFunc),this._detector&&this._detector.destroy(),this._renderer&&this._renderer.destroy(),this._input&&this._input.destroy(),this.inputNode&&this.inputNode.destroy(),this.outputRenderer&&(this.outputRenderer.destroy(),this.renderSprite&&this.renderSprite.destroy(!0)),this.outputCanvas&&(this.outputCanvas=null),t&&async function(){wx.createCanvas=null;for(let t in h.P6.kN){const e=h.P6.kN[t];h.xE.removeFromCache(e),e.destroy(!0)}(0,Y.UI)(),new A.e({}).clearCache(),h.Ep(),h.vB.shared.stop()}()}static getRealSize(t=720){t=t||720;const{platform:e,pixelRatio:n}=p,r=x(),i=16/9;let o=Math.round(t*i);const a={width:"0",height:"0",showWidth:0,showHeight:0,realWidth:0,realHeight:0};function s(t,e=2){const r=Math.round(t*n);return r%e!=0?s(t-1,e):[t,r]}if("ios"===e)t=t%2?t-1:t,o=o%2?o-1:o,a.showWidth=a.realWidth=r?o:t,a.showHeight=a.realHeight=r?t:o;else{const e=Math.round(t/n),i=Math.round(o/n);[a.showWidth,a.realWidth]=s(r?i:e,4),[a.showHeight,a.realHeight]=s(r?e:i)}return a.width=a.showWidth+"px",a.height=a.showHeight+"px",a.ratio=r?.5625:i,a}checkPusherSize(t,e){const n=x();if(!n&&t>720)throw new Error(`live-pusher width cannot be greater than 720px,currently is ${t}px`);if(n&&e>720)throw new Error(`live-pusher height cannot be greater than 720px,currently is ${e}px`);if(g){if(t%4!=0||e%2!=0)throw new Error("live-pusher width or height is not support. please use Arsdk.getRealSize")}else if(t%2!=0||e%2!=0)throw new Error("live-pusher width or height cannot is not support. please use Arsdk.getRealSize")}transcodeLive(){this.input_type===ot&&this.inputNode?.generatePusherData()}changeLiveFps(t){if("high"!==t||"low"!==t)throw new Error("fps must be set to low or high");this._options.live.fps=t}}async function lt(t){return new Promise((async e=>{const n=await async function(){return new Promise(((t,e)=>{wx.getSetting({success:e=>{t(e.authSetting)},fail:()=>{e()}})}))}();if(n[t])return e(!0);wx.authorize({scope:t,success(){e(!0)},fail(){e(!1)}})}))}async function ut(){let t,e;t=await lt("scope.record"),e=await lt("scope.camera"),t&&e||await async function(){return new Promise(((t,e)=>{wx.showModal({content:d.Z.t("0002"),confirmText:d.Z.t("0003"),showCancel:!1,success:e=>{e.confirm?wx.openSetting({success:e=>{console.log("wx setting auth",e),ut().then((()=>{t()}))},fail:()=>{t()}}):e.cancel&&t()}})}))}()}var ht=n(885),dt=n(1730)},3553:(t,e,n)=>{n.d(e,{Z:()=>a});var r=n(401),i=function(t){var e="function"==typeof Symbol&&Symbol.iterator,n=e&&t[e],r=0;if(n)return n.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&r>=t.length&&(t=void 0),{value:t&&t[r++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},o=function(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var r,i,o=n.call(t),a=[];try{for(;(void 0===e||e-- >0)&&!(r=o.next()).done;)a.push(r.value)}catch(t){i={error:t}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return a};const a=new(function(){function t(){this.data=new Map,this.set("common-v3",{Url:(0,r.xb)()})}return t.prototype.set=function(t,e){this.data.set(t,e)},t.prototype.get=function(t){return this.data.get(t)},t.prototype.has=function(t){return this.data.has(t)},t.prototype.remove=function(t){this.data.delete(t)},t.prototype.clear=function(){this.data.clear()},t.prototype.findId=function(t){var e,n;try{for(var r=i(this.data),a=r.next();!a.done;a=r.next()){var s=o(a.value,2),c=s[0];s[1];if(this.data.get(c).Url===t)return c}}catch(t){e={error:t}}finally{try{a&&!a.done&&(n=r.return)&&n.call(r)}finally{if(e)throw e.error}}return null},t}())},3849:(t,e,n)=>{n.d(e,{t:()=>s});var r,i=n(6878),o=n(6109),a=(r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},r(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function n(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}),s=function(t){function e(){var e=t.call(this)||this;return e._options={},e._hairColor={r:56,g:0,b:100},e}return a(e,t),Object.defineProperty(e.prototype,"options",{get:function(){return this._options},enumerable:!1,configurable:!0}),e.prototype.getOptions=function(){return this._options},e.prototype.setOptions=function(t){void 0!==t.mirror&&t.mirror!==this._options.mirror&&(o.bH.log("mirrorchange",t.mirror),this.trigger("mirrorChange",{mirror:t.mirror})),this._options=t},Object.defineProperty(e.prototype,"hairColor",{get:function(){return this._hairColor},set:function(t){this._hairColor=this.getRGB(t)},enumerable:!1,configurable:!0}),e.prototype.getRGB=function(t){var e=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(t);return e?{r:parseInt(e[1],16),g:parseInt(e[2],16),b:parseInt(e[3],16)}:null},e.instance=new e,e}(i.Q4)},1077:(t,e,n)=>{n.d(e,{F:()=>R});var r,i=n(1206),o=n(5536),a=n(3120),s=(r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},r(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function n(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}),c=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function a(t){try{c(r.next(t))}catch(t){o(t)}}function s(t){try{c(r.throw(t))}catch(t){o(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(a,s)}c((r=r.apply(t,e||[])).next())}))},l=function(t,e){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=a.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=e.call(t,a)}catch(t){o=[6,t],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}},u=function(t){function e(e){var n=t.call(this)||this;return n._options=e,n}return s(e,t),e.prototype.getFilterInstance=function(t){return c(this,void 0,Promise,(function(){var e,n=this;return l(this,(function(r){switch(r.label){case 0:return[4,this.init()];case 1:return e=r.sent(),[2,this.loadImage(e).then((function(e){return e[a.RY].baseTexture.scaleMode=i.aH.LINEAR,e[a.RY].baseTexture.mipmap=i.KI.OFF,new o.f("lutSkin",n._options,{uniforms:{lut:e[a.RY],lutSize:[512,512],intensity:t}})}))]}}))}))},e}(a.KI),h=n(617);const d="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 }";var f=n(401),p=n(6109),g=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),m=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function a(t){try{c(r.next(t))}catch(t){o(t)}}function s(t){try{c(r.throw(t))}catch(t){o(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(a,s)}c((r=r.apply(t,e||[])).next())}))},y=function(t,e){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=a.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=e.call(t,a)}catch(t){o=[6,t],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}},v=function(){function t(t){this._options=t}return Object.defineProperty(t.prototype,"uniforms",{set:function(t){for(var e in t)this._filter.uniforms[e]=t[e]},enumerable:!1,configurable:!0}),t.prototype.applyTo=function(t){t.filters||(t.filters=[]),t.filters.indexOf(this._filter)>-1||(t.filters.push(this._filter),this._container=t)},t.prototype.removeFrom=function(t){if(t.filters&&-1!==t.filters.indexOf(this._filter)){var e=t.filters.indexOf(this._filter);t.filters.splice(e,1),this._container=null}},t.prototype.resize=function(t,e){this._options.width=t,this._options.height=e,this._filter&&this._filter.resize(t,e)},t}(),_=function(t){function e(e,n){var r=t.call(this,n)||this;return r.intensity=e,r}return g(e,t),Object.defineProperty(e.prototype,"intensity",{get:function(){return this._intensity},set:function(t){this._intensity=t,this._filter&&(this._filter.uniforms.intensity=t<.01?0:t)},enumerable:!1,configurable:!0}),e.prototype.init=function(){return m(this,void 0,Promise,(function(){var t;return y(this,(function(e){switch(e.label){case 0:return[4,new u(this._options).getFilterInstance(this.intensity)];case 1:return t=e.sent(),this._filter=t,t.uniforms.intensity=this._intensity<.01?0:this._intensity,[2]}}))}))},e}(v),b=function(t){function e(e,n){var r=t.call(this,n)||this,a=r._options,s=a.width,c=a.height,l=new i.jd({width:s,height:c});return r.renderTexture=new i.TI(l),r._filter=new o.f("dermabrasion",n,{uniforms:{intensity:e<.01?0:e,faceMask:r.renderTexture,enable:1}}),r.intensity=e,r}return g(e,t),Object.defineProperty(e.prototype,"renderer",{get:function(){return this._renderer},set:function(t){this._renderer=t},enumerable:!1,configurable:!0}),e.prototype.render=function(){if(this.geometry){if(!this.faceMesh){var t={mask:i.P6.kN[a.L4],intensity:1},e=i.ex.from(d,"precision mediump float;\nvarying vec2 vUvs;\nuniform sampler2D mask;\nuniform float intensity;\n\nvoid main() {\n vec4 color = texture2D(mask, vUvs);\n color = vec4(color.rgb, color.a) * intensity;\n gl_FragColor = color;\n}",t);this.faceMesh=new i.Kj(this.geometry,e)}this.renderer&&this.renderer.render(this.faceMesh,{renderTexture:this.renderTexture})}},e.prototype.resize=function(e,n){t.prototype.resize.call(this,e,n),this.renderTexture.resize(e,n)},e.prototype.applyTo=function(e){t.prototype.applyTo.call(this,e)},Object.defineProperty(e.prototype,"intensity",{get:function(){return this._intensity},set:function(t){this._intensity=t,this._intensity=.7*t,this._filter&&(this._filter.uniforms.intensity=this._intensity<.01?0:this._intensity)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"enable",{set:function(t){this._filter.uniforms.enable=t?1:0},enumerable:!1,configurable:!0}),e}(v),x=function(t){function e(e,n,r){var a=t.call(this,r)||this,s=a._options,c=s.width,l=s.height,u=new i.jd({width:c,height:l});return a.renderTexture=new i.TI(u),a._filter=new o.f("partialDermabrasion",r,{uniforms:{intensity:1,faceMask:a.renderTexture}}),a.intensityDarkCircle=e,a.intensityNasolabialFolds=n,a}return g(e,t),Object.defineProperty(e.prototype,"intensityDarkCircle",{get:function(){return this._intensityDarkCircle},set:function(t){this._intensityDarkCircle=t,this._shader&&(this._shader.uniforms.intensityDarkCircle=t<.01?0:t)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"intensityNasolabialFolds",{get:function(){return this._intensityNasolabialFolds},set:function(t){this._intensityNasolabialFolds=t,this._shader&&(this._shader.uniforms.intensityNasolabialFolds=t<.01?0:t)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"renderer",{get:function(){return this._renderer},set:function(t){this._renderer=t},enumerable:!1,configurable:!0}),e.prototype.render=function(){if(this.geometry){if(!this.faceMesh){var t={falingwen:i.P6.kN[a.F7],heiyanquan:i.P6.kN[a.B3],intensityDarkCircle:this.intensityDarkCircle,intensityNasolabialFolds:this.intensityNasolabialFolds},e=i.ex.from(d,"precision mediump float;\nvarying vec2 vUvs;\nuniform sampler2D falingwen;\nuniform sampler2D heiyanquan;\nuniform float intensityNasolabialFolds;\nuniform float intensityDarkCircle;\n\nvoid main() {\n vec4 color = texture2D(falingwen, vUvs) * intensityNasolabialFolds + texture2D(heiyanquan, vUvs) * intensityDarkCircle;\n \n gl_FragColor = vec4(color.a, 0.,0.,1.);\n}",t);this._shader=e,this.faceMesh=new i.Kj(this.geometry,e)}this.renderer&&this.renderer.render(this.faceMesh,{renderTexture:this.renderTexture})}},e.prototype.resize=function(e,n){t.prototype.resize.call(this,e,n),this.renderTexture.resize(e,n)},e}(v),w=function(t){function e(e,n){var r=t.call(this,n)||this;return r._filter=new o.f("usm",n,{intensity:e}),r.intensity=e,r}return g(e,t),Object.defineProperty(e.prototype,"intensity",{get:function(){return this._intensity},set:function(t){this._intensity=t,this._filter.uniforms.intensity=t<.01?0:t},enumerable:!1,configurable:!0}),e}(v),C=["left_eye_center","right_eye_center","nose_tip","contour_chin","nose_bridge5","contour_left4","contour_left9","contour_right4","contour_right9","contour_left10","contour_right10","mouth_lower_lip_bottom","nose_tip1","nose_bottom","nose_left1","nose_left2","nose_right1","nose_right2","lip_top_left","lip_top_right","lip_bottom_left","lip_bottom_right","lip_top_left_target","lip_top_right_target","lip_bottom_left_target","lip_bottom_right_target","lip_top_center","lip_top_center_target","lip_bottom_center","lip_bottom_center_target","lip_inner_top","lip_inner_bottom","forehead_top_center","eyebrow_center","forehead_left","left_eyebrow_center","forehead_right","right_eyebrow_center","right_eye_top","left_eye_top","right_eye_bottom","left_eye_bottom","contour_left3","contour_right3","nose_bridge6","nose_bridge4","nose_bridge3","nose_bridge2","nose_bridge1","chin_left","chin_right"],T=function(t){function e(e,n){var r=t.call(this,e)||this;return r._enable=0,r.intensities=n,r._keymap=(new h.M).getDataConfig(f.c4.POINTS_MAP),r}return g(e,t),Object.defineProperty(e.prototype,"landmarks",{set:function(t){if(t.length){var e=C,n=this._getCartesianPointsByKeys(t,e);this._keypoints={};for(var r=0;r<e.length;r++){var i=e[r];this._keypoints[i]=n[r]}this._updateFilter(this._keypoints)}},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"intensities",{get:function(){return this._intensity},set:function(t){t.enable=this._enable?t.enable:this._enable,this._intensity=t,this._updateFilter(t)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"enable",{set:function(t){var e=t?1:0;this._enable!==e&&(this._enable=e,this._updateFilter({enable:this._enable}))},enumerable:!1,configurable:!0}),e.prototype._updateFilter=function(t){var e,n;if(!this._filter){var r={};C.forEach((function(t){r[t]=[0,0]})),r.enable=this._enable,this._filter=new o.f("faceReshape",this._options,{uniforms:r})}for(var i in t)this._filter.uniforms[i]=t[i]||0;this._filter.uniforms.distortCenter1=(null===(e=this._keypoints)||void 0===e?void 0:e[this.intensities.distortCenter1])||[0,0],this._filter.uniforms.distortCenter2=(null===(n=this._keypoints)||void 0===n?void 0:n[this.intensities.distortCenter2])||[0,0]},e.prototype._getCartesianPointsByKeys=function(t,e){var n=this._keymap,r=[];return e.forEach((function(e){try{var i=t[n[e]],o={x:i.x,y:i.y};r.push([o.x,o.y])}catch(t){p.kg.error("err",e,n[e],t)}})),r},e}(v),S=function(){function t(t,e,n){this._beautify={whiten:0,dermabrasion:0,eyeWhiten:0,teethWhiten:0,darkCircle:0,nasolabialFolds:0,lift:0,shave:0,cheekbone:0,head:0,eyeBrightness:0,lip:0,forehead:0,nose:0,eye:0,chin:0,usm:0,distort1:0,distort2:0},this._detected=!1,this.id=t,this._target=e,this._options=n}return Object.defineProperty(t.prototype,"detected",{get:function(){return this._detected},set:function(t){if(this._detected!==t){if(this._detected=t,this._reshape){var e=this._beautify;this._reshape.intensities={lift:e.lift,shave:e.shave,cheekbone:e.cheekbone,head:e.head,eyeBrightness:e.eyeBrightness,lip:e.lip,forehead:e.forehead,nose:e.nose,eye:e.eye,chin:e.chin,darkCircle:e.darkCircle,nasolabialFolds:e.nasolabialFolds,distort1:e.distort1,distortCenter1:e.distortCenter1,distortMajorRadius1:e.distortMajorRadius1,distortMinorRadius1:e.distortMinorRadius1,distort2:e.distort2,distortCenter2:e.distortCenter2,distortMajorRadius2:e.distortMajorRadius2,distortMinorRadius2:e.distortMinorRadius2,enable:e.lift||e.shave||e.darkCircle||e.nasolabialFolds||e.cheekbone||e.head||e.eyeBrightness||e.lip||e.forehead||e.eye||e.chin||e.nose||e.distort1||e.distort2?1:0}}this._dermabrasion&&(this._dermabrasion.enable=t)}},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"beautify",{set:function(t){this._beautify=Object.assign(this._beautify,t);var e=this._beautify,n=e.whiten,r=e.dermabrasion,i=(e.eyeWhiten,e.teethWhiten,e.darkCircle),o=e.nasolabialFolds,a=e.lift,s=e.shave,c=e.cheekbone,l=e.head,u=e.eyeBrightness,h=e.lip,d=e.forehead,f=e.nose,p=e.eye,g=e.chin,m=e.usm,y=e.distort1,v=e.distortCenter1,_=e.distortMajorRadius1,b=e.distortMinorRadius1,x=e.distort2,w=e.distortCenter2,C=e.distortMajorRadius2,T=e.distortMinorRadius2;this._whiten&&(this._whiten.intensity=n),this._dermabrasion&&(this._dermabrasion.intensity=r),this._partialDermabrasion&&(this._partialDermabrasion.intensityDarkCircle=i,this._partialDermabrasion.intensityNasolabialFolds=o),this._usm&&(this._usm.intensity=m),this._reshape&&(this._reshape.intensities={lift:a,shave:s,cheekbone:c,head:l,eyeBrightness:u,lip:h,forehead:d,nose:f,eye:p,chin:g,darkCircle:i,nasolabialFolds:o,distort1:y,distortCenter1:v,distortMajorRadius1:_,distortMinorRadius1:b,distort2:x,distortCenter2:w,distortMajorRadius2:C,distortMinorRadius2:T,enable:a||s||c||l||u||h||d||p||g||o||o||f||y||x?1:0})},enumerable:!1,configurable:!0}),t.prototype.load=function(){return m(this,void 0,Promise,(function(){var t,e,n,r,i,o,a=this;return y(this,(function(s){switch(s.label){case 0:return this.loaded?[2]:(this.loaded=!0,this._config?[3,2]:(this._config=new h.M,[4,this._config.load()]));case 1:s.sent(),s.label=2;case 2:return t=Object.assign(this._beautify),e=void 0!==t.whiten&&null!==t.whiten?t.whiten:f.em,this._whiten=new _(e,this._options),n=void 0!==t.dermabrasion&&null!==t.dermabrasion?t.dermabrasion:f.Ss,this._dermabrasion=new b(n,this._options),r=void 0!==t.darkCircle&&null!==t.darkCircle?t.darkCircle:0,i=void 0!==t.nasolabialFolds&&null!==t.nasolabialFolds?t.nasolabialFolds:0,this._partialDermabrasion=new x(r,i,this._options),void 0!==t.eyeWhiten&&null!==t.eyeWhiten?t.eyeWhiten:0,void 0!==t.teethWhiten&&null!==t.teethWhiten?t.teethWhiten:0,this._usm=new w(t.usm||0,this._options),o={lift:t.lift,shave:t.shave,cheekbone:t.cheekbone,head:t.head,eyeBrightness:t.eyeBrightness,lip:t.lip,forehead:t.forehead,nose:t.nose,darkCircle:t.darkCircle,nasolabialFolds:t.nasolabialFolds,eye:t.eye,chin:t.chin,distort1:t.distort1,distortCenter1:t.distortCenter1,distortMajorRadius1:t.distortMajorRadius1,distortMinorRadius1:t.distortMinorRadius1,distort2:t.distort2,distortCenter2:t.distortCenter2,distortMajorRadius2:t.distortMajorRadius2,distortMinorRadius2:t.distortMinorRadius2,enable:t.lift||t.shave||t.darkCircle||t.nasolabialFolds||t.cheekbone||t.head||t.eyeBrightness||t.lip||t.forehead||t.nose||t.eye||t.chin||t.distort1||t.distort2?1:0},this._reshape=new T(this._options,o),[2,this._whiten.init().then((function(){a.apply()}))]}}))}))},t.prototype.setReshapeMarks=function(t){t&&t.length?this._reshape&&(this._reshape.landmarks=t,this._reshape.enable=!0):this._reshape.enable=!1},t.prototype.setMesh=function(t){if(t&&t.length){if(!this.geometry){var e=this._config.getDataConfig(26),n=(new i.wG).addAttribute("aVertexPosition",t).addAttribute("aUvs",e);this.geometry=n}this.geometry.getBuffer("aVertexPosition").update(t),this._dermabrasion&&(this._dermabrasion.geometry=this.geometry,this._partialDermabrasion.geometry=this.geometry,this._dermabrasion.render(),this._partialDermabrasion.render())}},t.prototype.setRenderer=function(t){var e,n=this,r=function(){n._dermabrasion&&n._partialDermabrasion?(n._dermabrasion.renderer=t,n._partialDermabrasion.renderer=t,clearTimeout(e)):e=setTimeout(r,30)};r()},t.prototype.resize=function(t,e){this._whiten&&this._whiten.resize(t,e),this._dermabrasion&&this._dermabrasion.resize(t,e),this._partialDermabrasion&&this._partialDermabrasion.resize(t,e),this._reshape&&this._reshape.resize(t,e),this._usm&&this._usm.resize(t,e)},t.prototype.remove=function(){this._active&&(this._whiten&&this._whiten.removeFrom(this._target),this._dermabrasion&&this._dermabrasion.removeFrom(this._target),this._partialDermabrasion&&this._partialDermabrasion.removeFrom(this._target),this._reshape&&this._reshape.removeFrom(this._target),this._usm&&this._usm.removeFrom(this._target),this._active=!1)},t.prototype.apply=function(){this._active||(this._whiten&&this._whiten.applyTo(this._target),this._dermabrasion&&this._dermabrasion.applyTo(this._target),this._partialDermabrasion&&this._partialDermabrasion.applyTo(this._target),this._reshape&&this._reshape.applyTo(this._target),this._usm&&this._usm.applyTo(this._target),this._active=!0)},t.prototype.destroy=function(){this.remove(),this._whiten=null,this._dermabrasion=null,this._partialDermabrasion=null,this._reshape=null},t}(),k=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function a(t){try{c(r.next(t))}catch(t){o(t)}}function s(t){try{c(r.throw(t))}catch(t){o(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(a,s)}c((r=r.apply(t,e||[])).next())}))},E=function(t,e){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=a.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=e.call(t,a)}catch(t){o=[6,t],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}},P=(0,p.jl)("beautify-controller"),R=function(){function t(t){this._beautifies={},this._detected=!1,this._options=t}return Object.defineProperty(t.prototype,"renderer",{get:function(){return this._renderer},set:function(t){this._renderer=t,this.setRenderer()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"detected",{get:function(){return this._detected},set:function(t){for(var e in this._detected=t,this._beautifies){this._beautifies[e].detected=t}},enumerable:!1,configurable:!0}),t.prototype.updateBeauty=function(t,e){this._beautifies[t]?this.setBeauty(t,e):this.addBeauty(t,e)},t.prototype.setBeauty=function(t,e){void 0===t&&(t="default");var n=this._beautifies[t];n&&(n.beautify=e)},t.prototype.addBeauty=function(t,e){void 0===t&&(t="default"),void 0===e&&(e={});var n=new S(t,this._target,this._options);n.detected=this.detected,e&&(n.beautify=e),this._beautifies[t]&&this.removeBeauty(t),n.loaded||(n.load(),n.setRenderer(this.renderer)),this._beautifies[t]=n},t.prototype.addBeautyAsync=function(t,e){return void 0===t&&(t="default"),void 0===e&&(e={}),k(this,void 0,void 0,(function(){var n,r;return E(this,(function(i){switch(i.label){case 0:return n=+new Date,P.info("addBeautyAsync",t,this._options),(r=new S(t,this._target,this._options)).detected=this.detected,e&&(r.beautify=e),[4,r.load()];case 1:return i.sent(),r.setRenderer(this.renderer),this._beautifies[t]&&this.removeBeauty(t),this._beautifies[t]=r,P.info("log::::input node addBeautyAsync finish",+new Date-n),[2]}}))}))},t.prototype.enable=function(){for(var t in this._beautifies)this._beautifies[t].apply()},t.prototype.disable=function(){for(var t in this._beautifies)P.info("disable beautify",t),this._beautifies[t].remove()},t.prototype.resize=function(t,e){for(var n in this._beautifies)this._beautifies[n].resize(t,e)},t.prototype.removeBeauty=function(t){this._beautifies[t].destroy(),delete this._beautifies[t]},t.prototype.removeEffectBeauties=function(){for(var t in this._beautifies)"default"!==t&&this.removeBeauty(t)},t.prototype.setReshapeMarks=function(t){for(var e in this._beautifies)this._beautifies[e].setReshapeMarks(t)},t.prototype.setMesh=function(t){for(var e in this._beautifies)this._beautifies[e].setMesh(t)},t.prototype.setRenderer=function(){for(var t in this._beautifies)this._beautifies[t].setRenderer(this.renderer)},t}()},5156:(t,e,n)=>{n.d(e,{Z:()=>a});var r,i=n(1206),o=(r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},r(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function n(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)});const a=function(t){function e(e){var n=t.call(this)||this;n.degreeStart=-90,n.degreeEnd=270,n.stepStart=14,n.stepEnd=2,n.isVisible=!1;var r;return r=wx.getSystemInfoSync().pixelRatio,n.size=(e.size||100)*r,n.radius=n.size/2,n.lineWidth=(e.lineWidth||8)*r,n.strokeStyle=e.strokeColor||4286945,n.queue={},n.graphics=new i.TC,n.graphics.scale.set(1/r,1/r),n.addChild(n.graphics),n._draw=n.draw.bind(n),n}return o(e,t),e.prototype.draw=function(){this.degreeStart=this.degreeStart+this.stepStart,this.degreeEnd=this.degreeEnd+this.stepEnd,this.degreeStart-360>this.degreeEnd&&(this.degreeStart-=720);var t=this.graphics;t.clear(),t.lineStyle(this.lineWidth,this.strokeStyle),t.arc(0,0,this.radius-this.lineWidth/2,(this.degreeStart<this.degreeEnd?this.degreeStart:this.degreeEnd)*Math.PI/180,(this.degreeStart<this.degreeEnd?this.degreeEnd:this.degreeStart)*Math.PI/180)},e.prototype.addTicker=function(){i.vB.shared.add(this._draw)},e.prototype.removeTicker=function(){i.vB.shared.remove(this._draw)},e.prototype.show=function(t){t&&(this.queue[t]=1),this.isVisible||(clearTimeout(this.t),this.graphics.visible=!0,this.draw(),this.addTicker(),this.isVisible=!0)},e.prototype.hide=function(t){if(t){this.queue[t]=void 0;var e=!0;for(var n in this.queue)this.queue[n]&&(e=!1);e&&this._hide()}else this._hide()},e.prototype._hide=function(){this.t&&clearTimeout(this.t),this.graphics.visible=!1,this.removeTicker(),this.isVisible=!1},e.prototype.destroy=function(){this._hide(),this.graphics.destroy(!0)},e}(i.W2)},3120:(t,e,n)=>{n.d(e,{B3:()=>h,F7:()=>u,KI:()=>p,L4:()=>c,RY:()=>d,X_:()=>f});var r=n(1206),i=n(3044),o=n(401),a=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function a(t){try{c(r.next(t))}catch(t){o(t)}}function s(t){try{c(r.throw(t))}catch(t){o(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(a,s)}c((r=r.apply(t,e||[])).next())}))},s=function(t,e){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=a.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=e.call(t,a)}catch(t){o=[6,t],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}},c="face.png",l="eye.png",u="falingwen.png",h="heiyanquan.png",d="whiten.png",f="lips-mask-wx2.png",p=function(){function t(){}return t.prototype.init=function(){return a(this,void 0,Promise,(function(){var t;return s(this,(function(e){switch(e.label){case 0:return[4,(t=new i.pF).init()];case 1:return e.sent(),[4,t.preload((0,o.xb)())];case 2:return e.sent(),[2,t.getIndeLoader()]}}))}))},t.prototype.loadImage=function(t){return a(this,void 0,Promise,(function(){return s(this,(function(e){return[2,new Promise((function(e,n){var i={};if(r.P6.kN[d]&&r.P6.kN[f]&&r.P6.kN[c]&&r.P6.kN[l]&&r.P6.kN[u]&&r.P6.kN[h])return i[d]=r.P6.kN[d],i[f]=r.P6.kN[f],i[c]=r.P6.kN[c],i[l]=r.P6.kN[l],i[u]=r.P6.kN[u],i[h]=r.P6.kN[h],e(i);t.add(d),t.add(f),t.add(c),t.add(l),t.add(u),t.add(h),t.load((function(t,n){return i[d]=r.P6.kN[d],i[f]=r.P6.kN[f],i[c]=r.P6.kN[c],i[l]=r.P6.kN[l],i[u]=r.P6.kN[u],i[h]=r.P6.kN[h],e(i)}))}))]}))}))},t}()},5536:(t,e,n)=>{n.d(e,{f:()=>s});var r=n(1206);var i,o=(i=function(t,e){return i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},i(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function n(){this.constructor=t}i(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}),a={mirror:{fragment:"\nuniform sampler2D uSampler;\nvarying vec2 vTextureCoord;\n\nvoid main() {\n vec2 p = vTextureCoord;\n p.x = 1.0 - p.x;\n vec4 color = texture2D(uSampler, p);\n gl_FragColor = color;\n}\n"},mirrorVertical:{fragment:"\nuniform sampler2D uSampler;\nvarying vec2 vTextureCoord;\n\nvoid main() {\n vec2 p = vTextureCoord;\n p.y = 1.0 - p.y;\n vec4 color = texture2D(uSampler, p);\n gl_FragColor = color;\n}\n"},lut:{fragment:"\nvarying vec2 vTextureCoord;\nuniform sampler2D uSampler;\nuniform sampler2D lut;\nuniform lowp float intensity;\nuniform lowp float parentIntensity;\n\nvoid main() {\n vec4 color = texture2D(uSampler, vTextureCoord.xy);\n\n highp float blueColor = color.b * 63.0;\n \n //向下取值\n highp vec2 quad1;\n quad1.y = floor(floor(blueColor) / 8.0); \n quad1.x = floor(blueColor) - (quad1.y * 8.0);\n \n //向上取值\n highp vec2 quad2;\n quad2.y = floor(ceil(blueColor) / 8.0); \n quad2.x = ceil(blueColor) - (quad2.y * 8.0);\n \n //根据小正方形格子和RG通道,获取纹理坐标,每个大格子的大小:1/8=0.125,每个小格子的大小:1/512\n highp vec2 texPos1;\n texPos1.x = (quad1.x * 0.125) + 0.5/512.0 + ((0.125 - 1.0/512.0) * color.r);\n texPos1.y = (quad1.y * 0.125) + 0.5/512.0 + ((0.125 - 1.0/512.0) * color.g);\n \n highp vec2 texPos2;\n texPos2.x = (quad2.x * 0.125) + 0.5/512.0 + ((0.125 - 1.0/512.0) * color.r);\n texPos2.y = (quad2.y * 0.125) + 0.5/512.0 + ((0.125 - 1.0/512.0) * color.g);\n \n lowp vec4 newColor1 = texture2D(lut, texPos1);\n lowp vec4 newColor2 = texture2D(lut, texPos2);\n \n lowp vec3 newColor = mix(newColor1.rgb, newColor2.rgb, fract(blueColor));\n\n vec3 textureColor = mix(color.rgb, newColor, intensity * parentIntensity * 1.0);\n\n gl_FragColor = vec4(textureColor, 1.0);\n}\n"},lutSkin:{fragment:"precision mediump float;\n#define dimension 64.0\nuniform sampler2D uSampler; // 底图\nvarying vec2 vTextureCoord;\n\nuniform sampler2D lut; // lut 图\nuniform float intensity; // 强度\nuniform vec2 lutSize; // lut 尺寸\nvoid main() {\n vec4 color = texture2D(uSampler, vTextureCoord);\n float row = floor(sqrt(dimension) + 0.5);\n float blueColor = color.b * (dimension - 1.0);\n vec2 quad1;\n quad1.y = floor(floor(blueColor) / row);\n quad1.x = floor(blueColor) - (quad1.y * row);\n vec2 quad2;\n quad2.y = floor(ceil(blueColor) / row);\n quad2.x = ceil(blueColor) - (quad2.y * row);;\n vec2 texPos1;\n texPos1.x = (quad1.x * (1.0/row)) + 0.5/lutSize.x + ((1.0/row - 1.0/lutSize.x) * color.r);\n texPos1.y = (quad1.y * (1.0/row)) + 0.5/lutSize.y + ((1.0/row - 1.0/lutSize.y) * color.g);\n vec2 texPos2;\n texPos2.x = (quad2.x * (1.0/row)) + 0.5/lutSize.x + ((1.0/row - 1.0/lutSize.x) * color.r);\n texPos2.y = (quad2.y * (1.0/row)) + 0.5/lutSize.y + ((1.0/row - 1.0/lutSize.y) * color.g);\n vec4 newColor1 = texture2D(lut, texPos1);\n vec4 newColor2 = texture2D(lut, texPos2);\n vec4 newColor = mix(newColor1, newColor2, fract(blueColor));\n vec4 finalColor = mix(color, vec4(newColor.rgb, color.a), intensity);\n gl_FragColor = finalColor;\n}\n"},partialLutSkin:{fragment:"precision mediump float;\nvarying highp vec2 vTextureCoord;\n\nuniform sampler2D uSampler; // 图像texture\nuniform sampler2D grayTexture; // 灰度查找表\nuniform sampler2D lookupTexture; // LUT\n\nuniform highp float levelRangeInv; // 范围\nuniform lowp float levelBlack; // 灰度level \n// uniform lowp float intensity; // 肤色程度 \nuniform sampler2D faceMask;\n\nvoid main() {\n float mask = texture2D(faceMask, vTextureCoord).a;\n lowp vec3 textureColor = texture2D(uSampler, vTextureCoord).rgb;\n\n \n // if (mask == 0.) {\n // gl_FragColor = vec4(textureColor, 1.0); \n // return;\n // };\n \n\n textureColor = clamp((textureColor - vec3(levelBlack, levelBlack, levelBlack)) * levelRangeInv, 0.0, 1.0);\n textureColor.r = texture2D(grayTexture, vec2(textureColor.r, 0.5)).r;\n textureColor.g = texture2D(grayTexture, vec2(textureColor.g, 0.5)).g;\n textureColor.b = texture2D(grayTexture, vec2(textureColor.b, 0.5)).b;\n\n mediump float blueColor = textureColor.b * 15.0;\n\n mediump vec2 quad1;\n quad1.y = floor(blueColor / 4.0);\n quad1.x = floor(blueColor) - (quad1.y * 4.0);\n\n mediump vec2 quad2;\n quad2.y = floor(ceil(blueColor) / 4.0);\n quad2.x = ceil(blueColor) - (quad2.y * 4.0);\n\n highp vec2 texPos1;\n texPos1.x = (quad1.x * 0.25) + 0.5 / 64.0 + ((0.25 - 1.0 / 64.0) * textureColor.r);\n texPos1.y = (quad1.y * 0.25) + 0.5 / 64.0 + ((0.25 - 1.0 / 64.0) * textureColor.g);\n\n highp vec2 texPos2;\n texPos2.x = (quad2.x * 0.25) + 0.5 / 64.0 + ((0.25 - 1.0 / 64.0) * textureColor.r);\n texPos2.y = (quad2.y * 0.25) + 0.5 / 64.0 + ((0.25 - 1.0 / 64.0) * textureColor.g);\n\n lowp vec4 newColor1 = texture2D(lookupTexture, texPos1);\n lowp vec4 newColor2 = texture2D(lookupTexture, texPos2);\n\n lowp vec3 newColor = mix(newColor1.rgb, newColor2.rgb, fract(blueColor));\n\n // textureColor = mix(textureColor, newColor, 1.0);\n textureColor = mix(textureColor, newColor, mask);\n\n gl_FragColor = vec4(textureColor, 1.0); \n}\n"},dermabrasion:{fragment:"precision lowp float;\nuniform sampler2D uSampler;\nvarying lowp vec2 vTextureCoord;\n\nuniform int width;\nuniform int height;\n\nuniform float intensity;\n\nvoid main() {\n vec3 centralColor;\n\n centralColor = texture2D(uSampler, vTextureCoord).rgb;\n \n // if(intensity < 0.01) {\n // gl_FragColor = vec4(centralColor, 1.0);\n // return;\n // }\n float x_a = float(width);\n float y_a = float(height);\n\n float mul_x = 2.0 / x_a;\n float mul_y = 2.0 / y_a;\n vec2 blurCoordinates0 = vTextureCoord + vec2(0.0 * mul_x, -10.0 * mul_y);\n vec2 blurCoordinates2 = vTextureCoord + vec2(8.0 * mul_x, -5.0 * mul_y);\n vec2 blurCoordinates4 = vTextureCoord + vec2(8.0 * mul_x, 5.0 * mul_y);\n vec2 blurCoordinates6 = vTextureCoord + vec2(0.0 * mul_x, 10.0 * mul_y);\n vec2 blurCoordinates8 = vTextureCoord + vec2(-8.0 * mul_x, 5.0 * mul_y);\n vec2 blurCoordinates10 = vTextureCoord + vec2(-8.0 * mul_x, -5.0 * mul_y);\n\n mul_x = 1.8 / x_a;\n mul_y = 1.8 / y_a;\n vec2 blurCoordinates1 = vTextureCoord + vec2(5.0 * mul_x, -8.0 * mul_y);\n vec2 blurCoordinates3 = vTextureCoord + vec2(10.0 * mul_x, 0.0 * mul_y);\n vec2 blurCoordinates5 = vTextureCoord + vec2(5.0 * mul_x, 8.0 * mul_y);\n vec2 blurCoordinates7 = vTextureCoord + vec2(-5.0 * mul_x, 8.0 * mul_y);\n vec2 blurCoordinates9 = vTextureCoord + vec2(-10.0 * mul_x, 0.0 * mul_y);\n vec2 blurCoordinates11 = vTextureCoord + vec2(-5.0 * mul_x, -8.0 * mul_y);\n\n mul_x = 1.6 / x_a;\n mul_y = 1.6 / y_a;\n vec2 blurCoordinates12 = vTextureCoord + vec2(0.0 * mul_x,-6.0 * mul_y);\n vec2 blurCoordinates14 = vTextureCoord + vec2(-6.0 * mul_x,0.0 * mul_y);\n // vec2 blurCoordinates16 = vTextureCoord + vec2(0.0 * mul_x,6.0 * mul_y);\n // vec2 blurCoordinates18 = vTextureCoord + vec2(6.0 * mul_x,0.0 * mul_y);\n\n mul_x = 1.4 / x_a;\n mul_y = 1.4 / y_a;\n vec2 blurCoordinates13 = vTextureCoord + vec2(-4.0 * mul_x,-4.0 * mul_y);\n vec2 blurCoordinates15 = vTextureCoord + vec2(-4.0 * mul_x,4.0 * mul_y);\n // vec2 blurCoordinates17 = vTextureCoord + vec2(4.0 * mul_x,4.0 * mul_y);\n // vec2 blurCoordinates19 = vTextureCoord + vec2(4.0 * mul_x,-4.0 * mul_y);\n\n float central;\n float gaussianWeightTotal;\n float sum;\n float sampler;\n float distanceFromCentralColor;\n float gaussianWeight;\n\n float distanceNormalizationFactor = 3.6;\n\n central = texture2D(uSampler, vTextureCoord).g;\n gaussianWeightTotal = 0.2;\n sum = central * 0.2;\n\n sampler = texture2D(uSampler, blurCoordinates0).g;\n distanceFromCentralColor = min(abs(central - sampler) * distanceNormalizationFactor, 1.0);\n gaussianWeight = 0.09 * (1.0 - distanceFromCentralColor);\n gaussianWeightTotal += gaussianWeight;\n sum += sampler * gaussianWeight;\n\n sampler = texture2D(uSampler, blurCoordinates1).g;\n distanceFromCentralColor = min(abs(central - sampler) * distanceNormalizationFactor, 1.0);\n gaussianWeight = 0.09 * (1.0 - distanceFromCentralColor);\n gaussianWeightTotal += gaussianWeight;\n sum += sampler * gaussianWeight;\n\n sampler = texture2D(uSampler, blurCoordinates2).g;\n distanceFromCentralColor = min(abs(central - sampler) * distanceNormalizationFactor, 1.0);\n gaussianWeight = 0.09 * (1.0 - distanceFromCentralColor);\n gaussianWeightTotal += gaussianWeight;\n sum += sampler * gaussianWeight;\n\n sampler = texture2D(uSampler, blurCoordinates3).g;\n distanceFromCentralColor = min(abs(central - sampler) * distanceNormalizationFactor, 1.0);\n gaussianWeight = 0.09 * (1.0 - distanceFromCentralColor);\n gaussianWeightTotal += gaussianWeight;\n sum += sampler * gaussianWeight;\n\n sampler = texture2D(uSampler, blurCoordinates4).g;\n distanceFromCentralColor = min(abs(central - sampler) * distanceNormalizationFactor, 1.0);\n gaussianWeight = 0.09 * (1.0 - distanceFromCentralColor);\n gaussianWeightTotal += gaussianWeight;\n sum += sampler * gaussianWeight;\n\n sampler = texture2D(uSampler, blurCoordinates5).g;\n distanceFromCentralColor = min(abs(central - sampler) * distanceNormalizationFactor, 1.0);\n gaussianWeight = 0.09 * (1.0 - distanceFromCentralColor);\n gaussianWeightTotal += gaussianWeight;\n sum += sampler * gaussianWeight;\n\n sampler = texture2D(uSampler, blurCoordinates6).g;\n distanceFromCentralColor = min(abs(central - sampler) * distanceNormalizationFactor, 1.0);\n gaussianWeight = 0.09 * (1.0 - distanceFromCentralColor);\n gaussianWeightTotal += gaussianWeight;\n sum += sampler * gaussianWeight;\n\n sampler = texture2D(uSampler, blurCoordinates7).g;\n distanceFromCentralColor = min(abs(central - sampler) * distanceNormalizationFactor, 1.0);\n gaussianWeight = 0.09 * (1.0 - distanceFromCentralColor);\n gaussianWeightTotal += gaussianWeight;\n sum += sampler * gaussianWeight;\n\n sampler = texture2D(uSampler, blurCoordinates8).g;\n distanceFromCentralColor = min(abs(central - sampler) * distanceNormalizationFactor, 1.0);\n gaussianWeight = 0.09 * (1.0 - distanceFromCentralColor);\n gaussianWeightTotal += gaussianWeight;\n sum += sampler * gaussianWeight;\n\n sampler = texture2D(uSampler, blurCoordinates9).g;\n distanceFromCentralColor = min(abs(central - sampler) * distanceNormalizationFactor, 1.0);\n gaussianWeight = 0.09 * (1.0 - distanceFromCentralColor);\n gaussianWeightTotal += gaussianWeight;\n sum += sampler * gaussianWeight;\n\n sampler = texture2D(uSampler, blurCoordinates10).g;\n distanceFromCentralColor = min(abs(central - sampler) * distanceNormalizationFactor, 1.0);\n gaussianWeight = 0.09 * (1.0 - distanceFromCentralColor);\n gaussianWeightTotal += gaussianWeight;\n sum += sampler * gaussianWeight;\n\n sampler = texture2D(uSampler, blurCoordinates11).g;\n distanceFromCentralColor = min(abs(central - sampler) * distanceNormalizationFactor, 1.0);\n gaussianWeight = 0.09 * (1.0 - distanceFromCentralColor);\n gaussianWeightTotal += gaussianWeight;\n sum += sampler * gaussianWeight;\n\n sampler = texture2D(uSampler, blurCoordinates12).g;\n distanceFromCentralColor = min(abs(central - sampler) * distanceNormalizationFactor, 1.0);\n gaussianWeight = 0.1 * (1.0 - distanceFromCentralColor);\n gaussianWeightTotal += gaussianWeight;\n sum += sampler * gaussianWeight;\n\n sampler = texture2D(uSampler, blurCoordinates13).g;\n distanceFromCentralColor = min(abs(central - sampler) * distanceNormalizationFactor, 1.0);\n gaussianWeight = 0.1 * (1.0 - distanceFromCentralColor);\n gaussianWeightTotal += gaussianWeight;\n sum += sampler * gaussianWeight;\n\n sampler = texture2D(uSampler, blurCoordinates14).g;\n distanceFromCentralColor = min(abs(central - sampler) * distanceNormalizationFactor, 1.0);\n gaussianWeight = 0.1 * (1.0 - distanceFromCentralColor);\n gaussianWeightTotal += gaussianWeight;\n sum += sampler * gaussianWeight;\n\n sampler = texture2D(uSampler, blurCoordinates15).g;\n distanceFromCentralColor = min(abs(central - sampler) * distanceNormalizationFactor, 1.0);\n gaussianWeight = 0.1 * (1.0 - distanceFromCentralColor);\n gaussianWeightTotal += gaussianWeight;\n sum += sampler * gaussianWeight;\n\n // sampler = texture2D(uSampler, blurCoordinates16).g;\n // distanceFromCentralColor = min(abs(central - sampler) * distanceNormalizationFactor, 1.0);\n // gaussianWeight = 0.1 * (1.0 - distanceFromCentralColor);\n // gaussianWeightTotal += gaussianWeight;\n // sum += sampler * gaussianWeight;\n\n // sampler = texture2D(uSampler, blurCoordinates17).g;\n // distanceFromCentralColor = min(abs(central - sampler) * distanceNormalizationFactor, 1.0);\n // gaussianWeight = 0.1 * (1.0 - distanceFromCentralColor);\n // gaussianWeightTotal += gaussianWeight;\n // sum += sampler * gaussianWeight;\n\n // sampler = texture2D(uSampler, blurCoordinates18).g;\n // distanceFromCentralColor = min(abs(central - sampler) * distanceNormalizationFactor, 1.0);\n // gaussianWeight = 0.1 * (1.0 - distanceFromCentralColor);\n // gaussianWeightTotal += gaussianWeight;\n // sum += sampler * gaussianWeight;\n\n // sampler = texture2D(uSampler, blurCoordinates19).g;\n // distanceFromCentralColor = min(abs(central - sampler) * distanceNormalizationFactor, 1.0);\n // gaussianWeight = 0.1 * (1.0 - distanceFromCentralColor);\n // gaussianWeightTotal += gaussianWeight;\n // sum += sampler * gaussianWeight;\n\n sum = sum/gaussianWeightTotal;\n\n sampler = centralColor.g - sum + 0.5;\n\n // 高反差保留\n for(int i = 0; i < 5; ++i) {\n sampler = mix(sampler * sampler * 2.0, 1.0 - ((1.0 - sampler)*(1.0 - sampler) * 2.0), step(0.5,sampler));\n // sampler = sampler <= 0.5 ? sampler * sampler * 2.0 : 1.0 - ((1.0 - sampler)*(1.0 - sampler) * 2.0);\n // if(sampler <= 0.5) {\n // sampler = sampler * sampler * 2.0;\n // } else {\n // sampler = 1.0 - ((1.0 - sampler)*(1.0 - sampler) * 2.0);\n // }\n }\n\n float aa = 1.0 + pow(sum, 0.3) * 0.09;\n vec3 smoothColor = centralColor * aa - vec3(sampler) * (aa - 1.0);\n smoothColor = clamp(smoothColor, vec3(0.0), vec3(1.0));\n\n smoothColor = mix(centralColor, smoothColor, pow(centralColor.g, 0.33));\n smoothColor = mix(centralColor, smoothColor, pow(centralColor.g, 0.39));\n\n smoothColor = mix(centralColor, smoothColor, intensity * 1.5);\n\n gl_FragColor = vec4(pow(smoothColor, vec3(0.96)), 1.0);\n \n }"},partialDermabrasion:{fragment:"precision lowp float;\nuniform sampler2D uSampler;\nuniform sampler2D faceMask;\nvarying lowp vec2 vTextureCoord;\n\nuniform int width;\nuniform int height;\n\n// uniform float intensity;\n\nfloat normpdf(in float x, in float sigma)\n{\n\treturn 0.39894*exp(-0.5*x*x/(sigma*sigma))/sigma;\n}\n\nfloat normpdf3(in vec3 v, in float sigma)\n{\n\treturn 0.39894*exp(-0.5*dot(v,v)/(sigma*sigma))/sigma;\n}\n\n\n// 双边滤波\nvec3 bilateral(in vec2 coordinate) {\n const float SIGMA = 16.;\n const float BSIGMA = 9.;\n // const int MSIZE = 5;\n const int mSize = 16;\n\n // float c = getMaskColor(coordinate).a;\n\n vec3 color = texture2D(uSampler, coordinate).rgb;\n const int kSize = (mSize-1)/2;\n float kernel[mSize];\n vec3 final_alpha =vec3(0.);\n float Z = 0.;\n\tfor (int j = 0; j <= kSize; ++j)\n\t{\n\t\tkernel[kSize+j] = kernel[kSize-j] = normpdf(float(j), SIGMA);\n\t}\n\n vec3 cc;\n\tfloat factor;\n\tfloat bZ = 1.0/normpdf(0.0, BSIGMA);\n\n\t//read out the texels\n\tfor (int i=-kSize; i <= kSize; ++i)\n\t{\n\t\tfor (int j=-kSize; j <= kSize; ++j)\n\t\t{\n vec3 ccc = texture2D(uSampler, coordinate + vec2( float(i) / float(width), float(j) / float(height) )).rgb;\n cc = ccc;\n\t\t\tfactor = normpdf3(cc-color, BSIGMA)*bZ*kernel[kSize+j]*kernel[kSize+i];\n\t\t\tZ += factor;\n final_alpha += factor * ccc;\n\t\t}\n\t}\n return final_alpha / Z;\n}\n\nvoid main() {\n float mask = texture2D(faceMask, vTextureCoord).r;\n\n float i = mask;\n vec3 original = texture2D(uSampler, vTextureCoord).rgb;\n\n // gl_FragColor.rgb = original * i;\n // return;\n if (i == 0.) {\n gl_FragColor = vec4(original, 1.0);\n return;\n }\n vec3 color = bilateral(vTextureCoord).rgb;\n \n vec3 res = color * i + original * (1. - i);\n gl_FragColor = vec4(res.rgb, 1.0);\n return;\n \n }"},faceReshape:{fragment:"precision highp float;\nvarying vec2 vTextureCoord;\nuniform sampler2D uSampler;\nuniform int width;\nuniform int height;\nuniform int enable;\n\nuniform vec2 left_eye_center;\nuniform vec2 right_eye_center;\nuniform vec2 nose_tip;\nuniform vec2 contour_chin;\n\nuniform vec2 nose_bridge5;\nuniform vec2 contour_left4;\nuniform vec2 contour_left9;\nuniform vec2 contour_right4;\nuniform vec2 contour_right9;\nuniform vec2 contour_left10;\nuniform vec2 contour_right10;\n// 鼻子\nuniform vec2 nose_left1;\nuniform vec2 nose_left2;\nuniform vec2 nose_right1;\nuniform vec2 nose_right2;\nuniform vec2 nose_tip1;\nuniform vec2 nose_bottom;\n// 嘴唇\nuniform vec2 lip_top_left;\nuniform vec2 lip_top_left_target;\nuniform vec2 lip_top_right;\nuniform vec2 lip_top_right_target;\nuniform vec2 lip_bottom_left;\nuniform vec2 lip_bottom_left_target;\nuniform vec2 lip_bottom_right;\nuniform vec2 lip_bottom_right_target;\nuniform vec2 lip_top_center;\nuniform vec2 lip_top_center_target;\nuniform vec2 lip_bottom_center;\nuniform vec2 lip_bottom_center_target;\nuniform vec2 lip_inner_top;\nuniform vec2 lip_inner_bottom;\n// 额头\nuniform vec2 forehead_top_center;\nuniform vec2 eyebrow_center;\nuniform vec2 forehead_left;\nuniform vec2 left_eyebrow_center;\nuniform vec2 forehead_right;\nuniform vec2 right_eyebrow_center;\n// 眼睛\nuniform vec2 right_eye_top;\nuniform vec2 left_eye_top;\nuniform vec2 right_eye_bottom;\nuniform vec2 left_eye_bottom;\n// 瘦颧骨\nuniform vec2 contour_left3;\nuniform vec2 contour_right3;\nuniform vec2 nose_bridge6;\n\nuniform vec2 nose_bridge4;\nuniform vec2 nose_bridge3;\nuniform vec2 nose_bridge2;\nuniform vec2 nose_bridge1;\n\nuniform vec2 mouth_lower_lip_bottom;\n\nuniform vec2 chin_left;\nuniform vec2 chin_right;\n\nuniform float cheekbone;\nuniform float lift; // 窄脸\nuniform float shave; // 下颌骨\nuniform float eye; // 大眼\nuniform float chin; // 下巴\nuniform float nose; // 鼻子\n// uniform float noseBridge;\nuniform float lip; // 嘴唇\nuniform float forehead; // 额头\nuniform float eyeBrightness; // 亮眼\nuniform float head; // 小头\n// 面部液化扭曲效果(最多支持两个点位配置)\nuniform float distort1;\nuniform vec2 distortCenter1;\nuniform float distortMajorRadius1;\nuniform float distortMinorRadius1;\n\nuniform float distort2;\nuniform vec2 distortCenter2;\nuniform float distortMajorRadius2;\nuniform float distortMinorRadius2;\n\n// 曲线形变处理\nvec2 curveWarp(vec2 textureCoord, vec2 originPosition, vec2 targetPosition, float radius)\n{\n vec2 offset = vec2(0.0);\n vec2 result = vec2(0.0);\n\n vec2 direction = targetPosition - originPosition;\n\n float infect = distance(textureCoord, originPosition)/radius;\n\n infect = 1.0 - infect;\n infect = clamp(infect, 0.0, 1.0);\n offset = direction * infect;\n\n result = textureCoord - offset;\n\n return result;\n}\n// usm\nvec4 gaussianBlur(vec2 uv, float size) {\n const float Pi = 6.28318530718; // Pi*2\n \n // GAUSSIAN BLUR SETTINGS {{{\n const float Directions = 16.0; // BLUR DIRECTIONS (Default 16.0 - More is better but slower)\n const float Quality = 4.0; // BLUR QUALITY (Default 4.0 - More is better but slower)\n float Size = size; // BLUR SIZE (Radius)\n // GAUSSIAN BLUR SETTINGS }}}\n \n vec2 Radius = Size/vec2(float(width), float(height));\n \n // Pixel colour\n vec4 Color = texture2D(uSampler, uv);\n \n // Blur calculations\n for( float d=0.0; d<Pi; d+=Pi/Directions)\n {\n for(float i=1.0/Quality; i<=1.0; i+=1.0/Quality)\n {\n Color += texture2D( uSampler, uv+vec2(cos(d),sin(d))*Radius*i);\n }\n }\n \n // Output to screen\n Color /= Quality * Directions;\n return Color;\n}\nvec4 usm(vec2 vTextureCoord, float factor) {\n vec4 originColor = texture2D(uSampler, vTextureCoord);\n // if (factor == 0.) {\n // return originColor;\n // }\n vec4 gaussianColor = gaussianBlur(vTextureCoord, 3.0);\n return gaussianColor * -factor + originColor * (1.0 + factor);\n}\n\n\n// 大眼处理\nvec2 enlargeEye(vec2 currentCoordinate, vec2 circleCenter, float radius, float intensity)\n{\n // todo:改成椭圆形的放大\n float currentDistance = distance(currentCoordinate, circleCenter);\n float weight = currentDistance / radius;\n weight = 1.0 - intensity * (1.0 - weight * weight);\n weight = clamp(weight, 0.0, 1.0);\n currentCoordinate = circleCenter + (currentCoordinate - circleCenter) * weight;\n\n return currentCoordinate;\n}\nvec2 enlargeEyeEllipse(vec2 currentCoordinate, vec2 eyeCenter, float majorRadius, float minorRadius, float intensity) {\n float currentDistance = distance(currentCoordinate, eyeCenter);\n\n float cosa = (currentCoordinate.x - eyeCenter.x) / currentDistance;\n float sina = (currentCoordinate.y - eyeCenter.y) / currentDistance;\n float m = pow(majorRadius * majorRadius *cosa*cosa + minorRadius * minorRadius * sina * sina, 0.5);\n\n float weight = currentDistance / m;\n // weight = clamp(weight, 0.0, 1.0); // 保证了只对椭圆区域内部的像素放大,外部像素不变\n weight = 1.0 - abs(intensity) * (1.0 - weight * weight); // 放大倍数,超过椭圆区域,weight 会大于 1.0\n weight = clamp(weight, 0.0, 1.0); // 保证了只对椭圆区域内部的像素放大,外部像素不变\n // currentCoordinate = eyeCenter + (currentCoordinate - eyeCenter) * weight;\n if(intensity > .0){\n currentCoordinate = (currentCoordinate - eyeCenter) * weight + eyeCenter;\n }else {\n currentCoordinate = (currentCoordinate - eyeCenter) * (2.0-weight) + eyeCenter;\n }\n\n return currentCoordinate;\n}\n// 面部液化效果,支持椭圆(原始方案)\nvec2 distortingMirrorOld(vec2 currentCoordinate, vec2 center, float majorRadius, float minorRadius, float intensity) {\n float currentDistance = distance(currentCoordinate, center);\n\n float cosa = (currentCoordinate.x - center.x) / currentDistance;\n float sina = (currentCoordinate.y - center.y) / currentDistance;\n float m = pow(majorRadius * majorRadius *cosa*cosa + minorRadius * minorRadius * sina * sina, 0.5);\n\n float weight = currentDistance / m;\n // weight = clamp(weight, 0.0, 1.0); // 保证了只对椭圆区域内部的像素放大,外部像素不变\n weight = 1.0 - abs(intensity) * (1.0 - weight * weight); // 放大倍数,超过椭圆区域,weight 会大于 1.0\n weight = clamp(weight, 0.0, 1.0); // 保证了只对椭圆区域内部的像素放大,外部像素不变\n // currentCoordinate = center + (currentCoordinate - center) * weight;\n if(intensity > .0){\n currentCoordinate = (currentCoordinate - center) * weight + center;\n }else {\n currentCoordinate = (currentCoordinate - center) * (2.0-weight) + center;\n }\n return currentCoordinate;\n}\n// 面部液化效果,支持椭圆(性能优化方案)\nvec2 distortingMirror(vec2 currentCoordinate, vec2 center, float majorRadius, float minorRadius, float intensity) {\n vec2 delta = currentCoordinate - center;\n float currentDistance = length(delta);\n\n float cosa = delta.x / currentDistance;\n float sina = delta.y / currentDistance;\n float m = sqrt(majorRadius * majorRadius * cosa * cosa + minorRadius * minorRadius * sina * sina);\n\n float weight = currentDistance / m;\n weight = 1.0 - abs(intensity) * (1.0 - weight * weight);\n weight = clamp(weight, 0.0, 1.0);\n\n // float blendFactor = intensity > 0.0 ? weight : (2.0 - weight);\n float blendFactor = mix(2.0 - weight, weight, step(0.0, intensity));\n currentCoordinate = center + delta * blendFactor;\n\n return currentCoordinate;\n}\n// 瘦脸\nvec2 faceLift(vec2 currentCoordinate, float faceLength)\n{\n vec2 coordinate = currentCoordinate;\n vec2 currentPoint = vec2(0.0);\n vec2 destPoint = vec2(0.0);\n float faceLiftScale = lift * 0.06;\n float radius = faceLength * 0.5;\n\n currentPoint = contour_left4;\n destPoint = currentPoint + (nose_bridge5 - currentPoint) * faceLiftScale;\n coordinate = curveWarp(coordinate, currentPoint, destPoint, radius);\n\n currentPoint = contour_right4;\n destPoint = currentPoint + (nose_bridge5 - currentPoint) * faceLiftScale;\n coordinate = curveWarp(coordinate, currentPoint, destPoint, radius);\n\n radius = radius * 0.8;\n currentPoint = contour_left9;\n destPoint = currentPoint + (nose_tip - currentPoint) * (faceLiftScale * 0.6);\n coordinate = curveWarp(coordinate, currentPoint, destPoint, radius);\n\n currentPoint = contour_right9;\n destPoint = currentPoint + (nose_tip - currentPoint) * (faceLiftScale * 0.6);\n coordinate = curveWarp(coordinate, currentPoint, destPoint, radius);\n\n return coordinate;\n}\n// 鼻子\nvec2 noseShave(vec2 currentCoordinate, float faceLength) {\n vec2 coordinate = currentCoordinate;\n vec2 currentPoint = vec2(0.0);\n vec2 destPoint = vec2(0.0);\n float scale = nose * 0.2;\n float radius = faceLength * 0.5;\n\n currentPoint = nose_left1; // 102\n destPoint = currentPoint + (nose_tip1 - currentPoint) * scale; // nose_tip1:1\n coordinate = curveWarp(coordinate, currentPoint, destPoint, radius);\n\n currentPoint = nose_left2; // 97\n destPoint = currentPoint + (nose_bottom - currentPoint) * scale; //nose_bottom: 2\n coordinate = curveWarp(coordinate, currentPoint, destPoint, radius);\n\n\n currentPoint = nose_right1; // 331\n destPoint = currentPoint + (nose_tip1 - currentPoint) * scale; // nose_tip1:1\n coordinate = curveWarp(coordinate, currentPoint, destPoint, radius);\n\n currentPoint = nose_right2; // 326\n destPoint = currentPoint + (nose_bottom - currentPoint) * scale; //nose_bottom: 2\n coordinate = curveWarp(coordinate, currentPoint, destPoint, radius);\n\n return coordinate;\n}\n// 嘴唇\nvec2 handleLip(vec2 currentCoordinate, float faceLength) {\n vec2 coordinate = currentCoordinate;\n vec2 currentPoint = vec2(0.0);\n vec2 destPoint = vec2(0.0);\n float scale = lip * 0.1;\n\n vec2 circleCenter = (lip_inner_top + lip_inner_bottom) / 2.0;\n // 当前点的距离\n float currentDistance = distance(currentCoordinate, circleCenter);\n\n // float radius = distance(lip_top_right, lip_top_left) * 0.6;\n // float radius = distance(lip_top_right, lip_top_left) * 0.6;\n float radiusy = distance(lip_inner_top, circleCenter) * 2.0;\n float radiusx = distance(lip_top_right, lip_top_left) / 2.0 * 2.0;\n float cosa = (currentCoordinate.x - circleCenter.x) / currentDistance;\n float sina = (currentCoordinate.y - circleCenter.y) / currentDistance;\n float m = pow(radiusx * radiusx*cosa*cosa + radiusy * radiusy * sina * sina, 0.5);\n\n \n float weight = currentDistance/m;\n\n weight = 1.0 - abs(scale) * (1.0 - weight);\n weight = clamp(weight, 0.0, 1.0);\n\n // 处理是放大还是缩小\n float neg = step(0.0,lip) * 2.0 -1.0;\n weight = pow(weight, neg);\n currentCoordinate = circleCenter + (currentCoordinate - circleCenter) * weight;\n \n return currentCoordinate;\n\n}\n// 发际线\nvec2 handleForehead(vec2 currentCoordinate, float faceLength) {\n vec2 coordinate = currentCoordinate;\n vec2 currentPoint = vec2(0.0);\n vec2 destPoint = vec2(0.0);\n float scale = forehead * 0.15;\n float radius = faceLength * 0.7;\n\n currentPoint = forehead_top_center + forehead_top_center - eyebrow_center; // 10\n destPoint = currentPoint + (eyebrow_center - currentPoint) * scale; // eyebrow_center:9\n destPoint.y = clamp(destPoint.y, 0.0, float(height));\n coordinate = curveWarp(coordinate, currentPoint, destPoint, radius);\n\n currentPoint = forehead_left + forehead_left - left_eyebrow_center; // 67\n destPoint = currentPoint + (left_eyebrow_center - currentPoint) * scale; // left_eyebrow_center:66\n destPoint.y = clamp(destPoint.y, 0.0, float(height));\n coordinate = curveWarp(coordinate, currentPoint, destPoint, radius);\n\n currentPoint = forehead_right + forehead_right - right_eyebrow_center; // 297\n destPoint = currentPoint + (right_eyebrow_center - currentPoint) * scale; // right_eyebrow_center:296\n destPoint.y = clamp(destPoint.y, 0.0, float(height));\n coordinate = curveWarp(coordinate, currentPoint, destPoint, radius);\n\n\n\n return coordinate;\n\n}\n// 削脸\nvec2 faceShave(vec2 currentCoordinate, float faceLength)\n{\n vec2 coordinate = currentCoordinate;\n vec2 currentPoint = vec2(0.0);\n vec2 destPoint = vec2(0.0);\n float faceShaveScale = shave * 0.09;\n float radius = faceLength * 1.0;\n\n // 下巴中心\n vec2 chinCenter = (contour_chin + mouth_lower_lip_bottom) * 0.5;\n currentPoint = contour_left10;\n destPoint = currentPoint + (chinCenter - currentPoint) * faceShaveScale;\n coordinate = curveWarp(coordinate, currentPoint, destPoint, radius);\n\n currentPoint = contour_right10;\n destPoint = currentPoint + (chinCenter - currentPoint) * faceShaveScale;\n coordinate = curveWarp(coordinate, currentPoint, destPoint, radius);\n\n return coordinate;\n}\n// 曲线形变处理\nvec2 curveWarpVertical(vec2 textureCoord, vec2 originPosition, vec2 targetPosition, float xRadius, float yRadius)\n{\n vec2 offset = vec2(0.0);\n vec2 result = vec2(0.0);\n\n vec2 direction = targetPosition - originPosition;\n\n float infect = (textureCoord.x - originPosition.x) * (textureCoord.x - originPosition.x) / (xRadius * xRadius) + \n (textureCoord.y - originPosition.y) * (textureCoord.y - originPosition.y) / (yRadius * yRadius);\n\n infect = 1.0 - infect;\n infect = clamp(infect, 0.0, 1.0);\n offset = direction * infect;\n\n result = textureCoord - offset;\n\n return result;\n}\n// 处理下巴\nvec2 chinChange(vec2 currentCoordinate, float faceLength)\n{\n vec2 coordinate = currentCoordinate;\n vec2 currentPoint = vec2(0.0);\n vec2 destPoint = vec2(0.0);\n float chinScale = -chin * 0.4;\n float radius = faceLength * 0.3;\n vec2 chinCenter = contour_chin + (mouth_lower_lip_bottom - contour_chin) * 0.2;\n // 下巴尖\n currentPoint = contour_chin;\n destPoint = currentPoint + (chinCenter - currentPoint) * chinScale;\n coordinate = curveWarp(coordinate, currentPoint, destPoint, radius);\n\n // 下巴尖左右各取一个点平滑下巴\n float r = 0.3 - 0.1 * step(0.0,chin);\n currentPoint = chin_left;\n destPoint = currentPoint + (chinCenter - currentPoint) * chinScale * r;\n coordinate = curveWarp(coordinate, currentPoint, destPoint, radius);\n\n currentPoint = chin_right;\n destPoint = currentPoint + (chinCenter - currentPoint) * chinScale * r;\n coordinate = curveWarp(coordinate, currentPoint, destPoint, radius);\n\n return coordinate;\n}\n\nvec2 scaleHead(vec2 currentCoordinate) {\n vec2 coordinate = currentCoordinate;\n float headRadius = distance(contour_chin, nose_bridge5) * 1.8;\n float isWithin = 1.0-step(headRadius, distance(currentCoordinate, nose_bridge5));\n // if (distance(currentCoordinate, nose_bridge5) <= headRadius) {\n float weight = isWithin * (1.0 - distance(currentCoordinate, nose_bridge5) / headRadius);\n \n coordinate = nose_bridge5 + (coordinate - nose_bridge5) * (1.0+weight * 0.12*head);\n // }\n \n \n return coordinate;\n}\n// 颧骨\nvec2 handleCheekbone(vec2 currentCoordinate, float faceLength) {\n vec2 coordinate = currentCoordinate;\n vec2 currentPoint = vec2(0.0);\n vec2 destPoint = vec2(0.0);\n float scale = cheekbone * 0.05;\n float radius = faceLength * 0.45;\n\n currentPoint = (contour_left4 + contour_left3) * 0.5;\n destPoint = currentPoint + (nose_bridge6 - currentPoint) * scale;\n coordinate = curveWarp(coordinate, currentPoint, destPoint, radius);\n\n currentPoint = (contour_right4 + contour_right3) * 0.5;\n destPoint = currentPoint + (nose_bridge6 - currentPoint) * scale;\n coordinate = curveWarp(coordinate, currentPoint, destPoint, radius);\n\n return coordinate;\n\n}\n\nvec4 eyeBright(vec2 currentCoordinate) {\n vec2 coordinate = currentCoordinate * vec2(float(width), float(height));\n\n float iris_size_size = distance(left_eye_top, left_eye_bottom);\n vec2 left_center = (left_eye_top + left_eye_bottom)/2.0;\n vec2 right_center = (right_eye_top + right_eye_bottom)/2.0;\n float flag = (1.0-step(iris_size_size, distance(coordinate, left_center))) + (1.0-step(iris_size_size, distance(coordinate, right_center)));\n // if ((distance(coordinate, left_center) <= iris_size_size || distance(coordinate, right_center) <= iris_size_size)) {\n return usm(currentCoordinate, flag * clamp(eyeBrightness,0.0,1.0));\n // return;\n // }\n // gl_FragColor = texture2D(uSampler, currentCoordinate);\n}\n\nvoid main()\n{\n vec2 coordinate = vTextureCoord.xy;\n \n // 禁用美型处理或者鼻子不在图像中,则直接绘制\n float enableFlag = step(1.0, float(enable)) * (step(0.03, nose_tip.x / float(width)) + step(0.03, nose_tip.y / float(height)));\n enableFlag = clamp(enableFlag, 0.0, 1.0);\n // if (enable == 0 || ((nose_tip.x / float(width) <= 0.03) || (nose_tip.y / float(height)) <= 0.03)) {\n vec4 color = texture2D(uSampler, coordinate);\n\n // gl_FragColor = color;\n // return;\n // }\n \n \n // 将坐标转成图像大小,这里是为了方便计算\n coordinate = vTextureCoord * vec2(float(width), float(height));\n\n // 两个瞳孔的距离\n float eyeDistance = distance(left_eye_center, right_eye_center); \n\n // 瘦脸\n coordinate = faceLift(coordinate, eyeDistance);\n\n // 削脸\n coordinate = faceShave(coordinate, eyeDistance);\n\n // 下巴\n coordinate = chinChange(coordinate, eyeDistance);\n\n // 鼻子\n coordinate = noseShave(coordinate,eyeDistance);\n\n // 嘴唇厚度\n coordinate = handleLip(coordinate,eyeDistance);\n\n // 发际线\n coordinate = handleForehead(coordinate,eyeDistance);\n\n // 颧骨\n coordinate = handleCheekbone(coordinate,eyeDistance);\n\n // 小头\n coordinate = scaleHead(coordinate);\n\n // 大眼\n float eyeEnlarge = eye * 0.16; // 放大倍数\n eyeEnlarge = clamp(eyeEnlarge, -1.0, 1.0);\n // if (eyeEnlarge > 0.0) {\n // float radius = eyeDistance * 0.33; // 眼睛放大半径\n // float radius = eyeDistance * 0.33; // 眼睛放大半径\n // coordinate = enlargeEye(coordinate, left_eye_center + (right_eye_center - left_eye_center) * 0.05, radius, eyeEnlarge);\n // coordinate = enlargeEye(coordinate, right_eye_center + (left_eye_center - right_eye_center) * 0.05, radius, eyeEnlarge);\n coordinate = enlargeEyeEllipse(coordinate, left_eye_center + (right_eye_center - left_eye_center) * 0.05, eyeDistance * 0.35, eyeDistance * 0.3, eyeEnlarge);\n coordinate = enlargeEyeEllipse(coordinate, right_eye_center + (left_eye_center - right_eye_center) * 0.05, eyeDistance * 0.35, eyeDistance * 0.3, eyeEnlarge);\n // }\n\n // 哈哈镜\n if(distort1 != 0.0){\n coordinate = distortingMirror(coordinate, distortCenter1, eyeDistance*distortMajorRadius1, eyeDistance*distortMinorRadius1, distort1);\n }\n if(distort2 != 0.0){\n coordinate = distortingMirror(coordinate, distortCenter2, eyeDistance*distortMajorRadius2, eyeDistance*distortMinorRadius2, distort2);\n }\n\n\n\n // 转变回原来的纹理坐标系\n coordinate = coordinate / vec2(float(width), float(height));\n\n // 输出图像带上明目效果\n vec4 dealedColor = eyeBright(coordinate);\n\n // 输出图像\n // gl_FragColor = texture2D(uSampler, coordinate);\n gl_FragColor = mix(color, dealedColor, enableFlag);\n}"},maskBlack:{fragment:"\nuniform sampler2D uSampler;\nvarying vec2 vTextureCoord;\n\nvoid main() {\n vec4 color = texture2D(uSampler, vTextureCoord);\n gl_FragColor = vec4(color.rgb,color.r);\n}\n"},usm:{fragment:"\n\nprecision lowp float;\nuniform sampler2D uSampler;\nvarying lowp vec2 vTextureCoord;\nuniform int width;\nuniform int height;\nuniform float intensity;\n\nvec4 gaussianBlur(vec2 uv, float size) {\n const float Pi = 6.28318530718; // Pi*2\n \n // GAUSSIAN BLUR SETTINGS {{{\n const float Directions = 16.0; // BLUR DIRECTIONS (Default 16.0 - More is better but slower)\n const float Quality = 4.0; // BLUR QUALITY (Default 4.0 - More is better but slower)\n float Size = size; // BLUR SIZE (Radius)\n // GAUSSIAN BLUR SETTINGS }}}\n \n vec2 Radius = Size/vec2(float(width), float(height));\n \n // Pixel colour\n vec4 Color = texture2D(uSampler, uv);\n \n // Blur calculations\n for( float d=0.0; d<Pi; d+=Pi/Directions)\n {\n for(float i=1.0/Quality; i<=1.0; i+=1.0/Quality)\n {\n Color += texture2D( uSampler, uv+vec2(cos(d),sin(d))*Radius*i);\n }\n }\n \n // Output to screen\n Color /= Quality * Directions;\n return Color;\n}\nvec4 usm(vec2 vTextureCoord, float factor) {\n vec4 originColor = texture2D(uSampler, vTextureCoord);\n // if (factor == 0.) {\n // return originColor;\n // }\n vec4 gaussianColor = gaussianBlur(vTextureCoord, 3.0);\n return gaussianColor * -factor + originColor * (1.0 + factor);\n}\n\n\nvoid main(void)\n{ \n\n gl_FragColor = usm(vTextureCoord, intensity);\n}\n"}},s=function(t){function e(e,n,r){var i=this,o=a[e];(i=t.call(this,o.vertex||"attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\nuniform mat3 projectionMatrix;\nvarying vec2 vTextureCoord;\n\nvoid main(void)\n{\n gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n vTextureCoord = aTextureCoord;\n}",o.fragment)||this).options=r||{};var s=i.options.uniforms;if(s)for(var c in s)i.uniforms[c]=s[c];var l=n.width,u=n.height;return i.uniforms.width=l,i.uniforms.height=u,i.uniforms.iResolution=[l,u],i}return o(e,t),e.prototype.resize=function(t,e){this.uniforms.width=t,this.uniforms.height=e,this.uniforms.iResolution=[t,e]},e.prototype.setUniforms=function(t,e){if("object"==typeof t)for(var n in t)this.uniforms[n]=t[n];else this.uniforms[t]!==e&&(this.uniforms[t]=e)},e}(r.wn)},1730:(t,e,n)=>{n.d(e,{a:()=>r,L:()=>i});var r;!function(t){t[t.NORMAL=0]="NORMAL",t[t.DARKEN=1]="DARKEN",t[t.MULTIPLY=2]="MULTIPLY",t[t.COLOR_BURN=3]="COLOR_BURN",t[t.LINEAR_BURN=4]="LINEAR_BURN",t[t.LIGHTEN=5]="LIGHTEN",t[t.SCREEN=6]="SCREEN",t[t.COLOR_DODGE=7]="COLOR_DODGE",t[t.LINEAR_DODGE=8]="LINEAR_DODGE",t[t.OVERLAY=9]="OVERLAY",t[t.SOFT_LIGHT=10]="SOFT_LIGHT",t[t.HARD_LIGHT=11]="HARD_LIGHT",t[t.VIVID_LIGHT=12]="VIVID_LIGHT",t[t.LINEAR_LIGHT=13]="LINEAR_LIGHT",t[t.PIN_LIGHT=14]="PIN_LIGHT",t[t.HARD_MIX=15]="HARD_MIX",t[t.DIFFERENCE=16]="DIFFERENCE",t[t.EXCLUSION=17]="EXCLUSION",t[t.SUBSTRACT=18]="SUBSTRACT"}(r||(r={}));var i=[{name:"普通",key:"Normal",shader:"vec3 blendNormal(vec3 base, vec3 blend) {\n\treturn blend;\n}\nfloat blendNormal(float base, float blend) {\n\treturn blend;\n}\n\nvec3 blendNormal(vec3 base, vec3 blend, float opacity) {\n\treturn (blendNormal(base, blend) * opacity + base * (1.0 - opacity));\n}\n\n\n"},{name:"变暗",key:"Darken",shader:"float blendDarken(float base, float blend) {\n\treturn min(blend,base);\n}\n\nvec3 blendDarken(vec3 base, vec3 blend) {\n\treturn vec3(blendDarken(base.r,blend.r),blendDarken(base.g,blend.g),blendDarken(base.b,blend.b));\n}\n\nvec3 blendDarken(vec3 base, vec3 blend, float opacity) {\n\treturn (blendDarken(base, blend) * opacity + base * (1.0 - opacity));\n}\n\n"},{name:"正片叠底",key:"Multiply",shader:"vec3 blendMultiply(vec3 base, vec3 blend) {\n\treturn base*blend;\n}\n\n\nvec3 blendMultiply(vec3 base, vec3 blend, float opacity) {\n\treturn (blendMultiply(base, blend) * opacity + base * (1.0 - opacity));\n}\n\n"},{name:"颜色加深",key:"ColorBurn",shader:"float blendColorBurn(float base, float blend) {\n\treturn (blend==0.0)?blend:max((1.0-((1.0-base)/blend)),0.0);\n}\n\nvec3 blendColorBurn(vec3 base, vec3 blend) {\n\treturn vec3((base.r,blend.r),blendColorBurn(base.g,blend.g),blendColorBurn(base.b,blend.b));\n}\n\n\nvec3 blendColorBurn(vec3 base, vec3 blend, float opacity) {\n\treturn (blendColorBurn(base, blend) * opacity + base * (1.0 - opacity));\n}\n\n"},{name:"线性加深",key:"LinearBurn",shader:"float blendLinearBurn(float base, float blend) {\n\t// Note : Same implementation as BlendSubtractf\n\treturn max(base+blend-1.0,0.0);\n}\n\n\nvec3 blendLinearBurn(vec3 base, vec3 blend) {\n\t// Note : Same implementation as BlendSubtract\n\treturn max(base+blend-vec3(1.0),vec3(0.0));\n}\n\nvec3 blendLinearBurn(vec3 base, vec3 blend, float opacity) {\n\treturn (blendLinearBurn(base, blend) * opacity + base * (1.0 - opacity));\n}\n\n"},{name:"变亮",key:"Lighten",shader:"float blendLighten(float base, float blend) {\n\treturn max(blend,base);\n}\n\nvec3 blendLighten(vec3 base, vec3 blend) {\n\treturn vec3(blendLighten(base.r,blend.r),blendLighten(base.g,blend.g),blendLighten(base.b,blend.b));\n}\n\nvec3 blendLighten(vec3 base, vec3 blend, float opacity) {\n\treturn (blendLighten(base, blend) * opacity + base * (1.0 - opacity));\n}\n\n"},{name:"滤色",key:"Screen",shader:"float blendScreen(float base, float blend) {\n\treturn 1.0-((1.0-base)*(1.0-blend));\n}\n\nvec3 blendScreen(vec3 base, vec3 blend) {\n\treturn vec3(blendScreen(base.r,blend.r),blendScreen(base.g,blend.g),blendScreen(base.b,blend.b));\n}\n\nvec3 blendScreen(vec3 base, vec3 blend, float opacity) {\n\treturn (blendScreen(base, blend) * opacity + base * (1.0 - opacity));\n}\n\n"},{name:"颜色减淡",key:"ColorDodge",shader:"float blendColorDodge(float base, float blend) {\n\treturn (blend==1.0)?blend:min(base/(1.0-blend),1.0);\n}\n\nvec3 blendColorDodge(vec3 base, vec3 blend) {\n\treturn vec3(blendColorDodge(base.r,blend.r),blendColorDodge(base.g,blend.g),blendColorDodge(base.b,blend.b));\n}\n\nvec3 blendColorDodge(vec3 base, vec3 blend, float opacity) {\n\treturn (blendColorDodge(base, blend) * opacity + base * (1.0 - opacity));\n}\n\n"},{name:"线性减淡",key:"LinearDodge",shader:"float blendLinearDodge(float base, float blend) {\n\t// Note : Same implementation as BlendAddf\n\treturn min(base+blend,1.0);\n}\n\nvec3 blendLinearDodge(vec3 base, vec3 blend) {\n\t// Note : Same implementation as BlendAdd\n\treturn min(base+blend,vec3(1.0));\n}\n\nvec3 blendLinearDodge(vec3 base, vec3 blend, float opacity) {\n\treturn (blendLinearDodge(base, blend) * opacity + base * (1.0 - opacity));\n}\n\n"},{name:"叠加",key:"Overlay",shader:"float blendOverlay(float base, float blend) {\n\treturn base<0.5?(2.0*base*blend):(1.0-2.0*(1.0-base)*(1.0-blend));\n}\n\nvec3 blendOverlay(vec3 base, vec3 blend) {\n\treturn vec3(blendOverlay(base.r,blend.r),blendOverlay(base.g,blend.g),blendOverlay(base.b,blend.b));\n}\n\nvec3 blendOverlay(vec3 base, vec3 blend, float opacity) {\n\treturn (blendOverlay(base, blend) * opacity + base * (1.0 - opacity));\n}\n\n"},{name:"柔光",key:"SoftLight",shader:"float blendSoftLight(float base, float blend) {\n\treturn (blend<0.5)?(2.0*base*blend+base*base*(1.0-2.0*blend)):(sqrt(base)*(2.0*blend-1.0)+2.0*base*(1.0-blend));\n}\n\nvec3 blendSoftLight(vec3 base, vec3 blend) {\n\treturn vec3(blendSoftLight(base.r,blend.r),blendSoftLight(base.g,blend.g),blendSoftLight(base.b,blend.b));\n}\n\n\nvec3 blendSoftLight(vec3 base, vec3 blend, float opacity) {\n\treturn (blendSoftLight(base, blend) * opacity + base * (1.0 - opacity));\n}\n\n"},{name:"强光",key:"HardLight",shader:"float blendOverlay(float base, float blend) {\n\treturn base<0.5?(2.0*base*blend):(1.0-2.0*(1.0-base)*(1.0-blend));\n}\nvec3 blendOverlay(vec3 base, vec3 blend) {\n\treturn vec3(blendOverlay(base.r,blend.r),blendOverlay(base.g,blend.g),blendOverlay(base.b,blend.b));\n}\nvec3 blendHardLight(vec3 base, vec3 blend) {\n\treturn blendOverlay(blend,base);\n}\n\nvec3 blendHardLight(vec3 base, vec3 blend, float opacity) {\n\treturn (blendHardLight(base, blend) * opacity + base * (1.0 - opacity));\n}\n\n"},{name:"亮光",key:"VividLight",shader:"float blendColorDodge(float base, float blend) {\n\treturn (blend==1.0)?blend:min(base/(1.0-blend),1.0);\n}\n\n\nfloat blendColorBurn(float base, float blend) {\n\treturn (blend==0.0)?blend:max((1.0-((1.0-base)/blend)),0.0);\n}\n\n\n\n\nfloat blendVividLight(float base, float blend) {\n\treturn (blend<0.5)?blendColorBurn(base,(2.0*blend)):blendColorDodge(base,(2.0*(blend-0.5)));\n}\n\nvec3 blendVividLight(vec3 base, vec3 blend) {\n\treturn vec3(blendVividLight(base.r,blend.r),blendVividLight(base.g,blend.g),blendVividLight(base.b,blend.b));\n}\n\nvec3 blendVividLight(vec3 base, vec3 blend, float opacity) {\n\treturn (blendVividLight(base, blend) * opacity + base * (1.0 - opacity));\n}\n\n"},{name:"线性光",key:"LinearLight",shader:"float blendLinearBurn(float base, float blend) {\n\t// Note : Same implementation as BlendSubtractf\n\treturn max(base+blend-1.0,0.0);\n}\n\nfloat blendLinearDodge(float base, float blend) {\n\t// Note : Same implementation as BlendAddf\n\treturn min(base+blend,1.0);\n}\n\n\nfloat blendLinearLight(float base, float blend) {\n\treturn blend<0.5?blendLinearBurn(base,(2.0*blend)):blendLinearDodge(base,(2.0*(blend-0.5)));\n}\n\nvec3 blendLinearLight(vec3 base, vec3 blend) {\n\treturn vec3(blendLinearLight(base.r,blend.r),blendLinearLight(base.g,blend.g),blendLinearLight(base.b,blend.b));\n}\n\nvec3 blendLinearLight(vec3 base, vec3 blend, float opacity) {\n\treturn (blendLinearLight(base, blend) * opacity + base * (1.0 - opacity));\n}\n\n"},{name:"点光",key:"PinLight",shader:"float blendLighten(float base, float blend) {\n\treturn max(blend,base);\n}\nfloat blendDarken(float base, float blend) {\n\treturn min(blend,base);\n}\nfloat blendPinLight(float base, float blend) {\n\treturn (blend<0.5)?blendDarken(base,(2.0*blend)):blendLighten(base,(2.0*(blend-0.5)));\n}\n\nvec3 blendPinLight(vec3 base, vec3 blend) {\n\treturn vec3(blendPinLight(base.r,blend.r),blendPinLight(base.g,blend.g),blendPinLight(base.b,blend.b));\n}\n\nvec3 blendPinLight(vec3 base, vec3 blend, float opacity) {\n\treturn (blendPinLight(base, blend) * opacity + base * (1.0 - opacity));\n}\n\n"},{name:"实色混合",key:"HardMix",shader:"float blendColorDodge(float base, float blend) {\n\treturn (blend==1.0)?blend:min(base/(1.0-blend),1.0);\n}\n\n\n\nfloat blendColorBurn(float base, float blend) {\n\treturn (blend==0.0)?blend:max((1.0-((1.0-base)/blend)),0.0);\n}\n\n\n\nfloat blendVividLight(float base, float blend) {\n\treturn (blend<0.5)?blendColorBurn(base,(2.0*blend)):blendColorDodge(base,(2.0*(blend-0.5)));\n}\n\n\n\nfloat blendHardMix(float base, float blend) {\n\treturn (blendVividLight(base,blend)<0.5)?0.0:1.0;\n}\n\nvec3 blendHardMix(vec3 base, vec3 blend) {\n\treturn vec3(blendHardMix(base.r,blend.r),blendHardMix(base.g,blend.g),blendHardMix(base.b,blend.b));\n}\n\nvec3 blendHardMix(vec3 base, vec3 blend, float opacity) {\n\treturn (blendHardMix(base, blend) * opacity + base * (1.0 - opacity));\n}\n\n"},{name:"差值",key:"Difference",shader:"vec3 blendDifference(vec3 base, vec3 blend) {\n\treturn abs(base-blend);\n}\n\nvec3 blendDifference(vec3 base, vec3 blend, float opacity) {\n\treturn (blendDifference(base, blend) * opacity + base * (1.0 - opacity));\n}\n\n"},{name:"排除",key:"Exclusion",shader:"vec3 blendExclusion(vec3 base, vec3 blend) {\n\treturn base+blend-2.0*base*blend;\n}\n\nvec3 blendExclusion(vec3 base, vec3 blend, float opacity) {\n\treturn (blendExclusion(base, blend) * opacity + base * (1.0 - opacity));\n}\n\n"},{name:"减去",key:"Substract",shader:"float blendSubstract(float base, float blend) {\n\treturn max(base+blend-1.0,0.0);\n}\n\nvec3 blendSubstract(vec3 base, vec3 blend) {\n\treturn max(base+blend-vec3(1.0),vec3(0.0));\n}\n\nvec3 blendSubstract(vec3 base, vec3 blend, float opacity) {\n\treturn (blendSubstract(base, blend) * opacity + blend * (1.0 - opacity));\n}\n\n"}]},9560:(t,e,n)=>{n.d(e,{Kg:()=>_,Lc:()=>l.L,jy:()=>m});var r,i=n(9043),o=(r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},r(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function n(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}),a=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.backdropUniformName=null,e._backdropActive=!1,e.clearColor=null,e}return o(e,t),e}(i.Filter),s=function(t){function e(e){var n=this,r="\nvarying vec2 vTextureCoord;\n\nuniform sampler2D uSampler;\nuniform sampler2D uBackdrop;\nuniform vec2 uBackdrop_flipY;\nuniform float intensity;\n\n%UNIFORM_CODE%\n%FUNC_CODE%\nvoid main(void)\n{\n vec2 backdropCoord = vec2(vTextureCoord.x, vTextureCoord.y);\n // vec2 backdropCoord = vec2(vTextureCoord.x, uBackdrop_flipY.x + uBackdrop_flipY.y * vTextureCoord.y);\n vec4 b_src = texture2D(uSampler, vTextureCoord); // 精灵\n vec4 b_dest = texture2D(uBackdrop, backdropCoord); // 底图\n vec4 b_res = b_src;\n\n\n // gl_FragColor = b_dest;\n // return;\n\n if (b_src.a == 0.0) {\n gl_FragColor = vec4(0.0,0.0,0.0,0.0);\n return;\n }\n if (b_dest.a == 0.0) {\n gl_FragColor = vec4(0.0,0.0,0.0,0.0);\n // gl_FragColor = b_src;\n return;\n }\n \n \n b_res.rgb = blend%FUNC_NAME%(b_dest.rgb / b_dest.a, b_src.rgb / b_src.a, intensity);\n gl_FragColor = vec4(b_res.rgb * b_src.a,b_src.a);\n\n}";return r=(r=(r=r.replace("%UNIFORM_CODE%",e.uniformCode||"")).replace("%FUNC_CODE%",e.funcCode||"")).replace("%FUNC_NAME%",e.funcName||""),(n=t.call(this,void 0,r,e.uniforms)||this).backdropUniformName="uBackdrop",n}return o(e,t),e}(a),c=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),l=(function(t){function e(e,n){var r=n||{};return r.flipY||(r.flipY=new Float32Array([0,1])),t.call(this,"\nattribute vec2 aVertexPosition;\n\nuniform mat3 projectionMatrix;\n\nvarying vec2 vTextureCoord;\n\nuniform vec4 inputSize;\nuniform vec4 outputFrame;\nuniform vec2 flipY;\n\nvec4 filterVertexPosition( void )\n{\n vec2 position = aVertexPosition * max(outputFrame.zw, vec2(0.)) + outputFrame.xy;\n\n return vec4((projectionMatrix * vec3(position, 1.0)).xy, 0.0, 1.0);\n}\n\nvec2 filterTextureCoord( void )\n{\n return aVertexPosition * (outputFrame.zw * inputSize.zw);\n}\n\nvoid main(void)\n{\n gl_Position = filterVertexPosition();\n vTextureCoord = filterTextureCoord();\n vTextureCoord.y = flipY.x + flipY.y * vTextureCoord.y;\n}\n\n",e,r)||this}c(e,t)}(i.Filter),n(1730)),u=[],h=[];function d(t,e){return void 0===e&&(e=1),void 0===t?null:(u[t]||(u[t]=new s({funcCode:l.L[t].shader,funcName:l.L[t].key,uniforms:{intensity:e}})),u[t])}function f(t,e){return void 0===e&&(e=1),void 0===t?null:(h[t]||(h[t]=[d(t,e)]),h[t][0].uniforms.intensity=e,h[t])}var p=n(1961),g=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),m=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return g(e,t),e.prototype._render=function(t){var e=this._texture;if(e&&e.valid){var n=f(this.blendMode_1);new Date;n&&(t.batch.flush(),!t.filter.pushWithCheck(this,n))||(+new Date,this.calculateVertices(),t.batch.setObjectRenderer(t.plugins[this.pluginName]),t.plugins[this.pluginName].render(this),n&&(t.batch.flush(),t.filter.pop()))}},e}(p.j),y=n(2901),v=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),_=function(t){function e(e,n){void 0===n&&(n=!0);var r=t.call(this,e[0]instanceof i.Texture?e[0]:e[0].texture)||this;return r._textures=null,r._durations=null,r._autoUpdate=n,r._isConnectedToTicker=!1,r.animationSpeed=1,r.loop=!0,r.updateAnchor=!1,r.onComplete=null,r.onFrameChange=null,r.onLoop=null,r._currentTime=0,r._playing=!1,r._previousFrame=null,r.textures=e,r}return v(e,t),e.prototype.stop=function(){this._playing&&(this._playing=!1,this._autoUpdate&&this._isConnectedToTicker&&(y.vB.shared.remove(this.update,this),this._isConnectedToTicker=!1))},e.prototype.play=function(){this._playing||(this._playing=!0,this._autoUpdate&&!this._isConnectedToTicker&&(y.vB.shared.add(this.update,this,y.uF.HIGH),this._isConnectedToTicker=!0))},e.prototype.gotoAndStop=function(t){this.stop();var e=this.currentFrame;this._currentTime=t,e!==this.currentFrame&&this.updateTexture()},e.prototype.gotoAndPlay=function(t){var e=this.currentFrame;this._currentTime=t,e!==this.currentFrame&&this.updateTexture(),this.play()},e.prototype.update=function(t){if(this._playing){var e=this.animationSpeed*t,n=this.currentFrame;if(null!==this._durations){var r=this._currentTime%1*this._durations[this.currentFrame];for(r+=e/60*1e3;r<0;)this._currentTime--,r+=this._durations[this.currentFrame];var i=Math.sign(this.animationSpeed*t);for(this._currentTime=Math.floor(this._currentTime);r>=this._durations[this.currentFrame];)r-=this._durations[this.currentFrame]*i,this._currentTime+=i;this._currentTime+=r/this._durations[this.currentFrame]}else this._currentTime+=e;this._currentTime<0&&!this.loop?(this.gotoAndStop(0),this.onComplete&&this.onComplete()):this._currentTime>=this._textures.length&&!this.loop?(this.gotoAndStop(this._textures.length-1),this.onComplete&&this.onComplete()):n!==this.currentFrame&&(this.loop&&this.onLoop&&(this.animationSpeed>0&&this.currentFrame<n||this.animationSpeed<0&&this.currentFrame>n)&&this.onLoop(),this.updateTexture())}},e.prototype.updateTexture=function(){var t=this.currentFrame;this._previousFrame!==t&&(this._previousFrame=t,this._texture=this._textures[t],this._textureID=-1,this._textureTrimmedID=-1,this._cachedTint=16777215,this.uvs=this._texture._uvs.uvsFloat32,this.updateAnchor&&this._anchor.copyFrom(this._texture.defaultAnchor),this.onFrameChange&&this.onFrameChange(this.currentFrame))},e.prototype.destroy=function(e){this.stop(),t.prototype.destroy.call(this,e),this.onComplete=null,this.onFrameChange=null,this.onLoop=null},e.fromFrames=function(t){for(var n=[],r=0;r<t.length;++r)n.push(i.Texture.from(t[r]));return new e(n)},e.fromImages=function(t){for(var n=[],r=0;r<t.length;++r)n.push(i.Texture.from(t[r]));return new e(n)},Object.defineProperty(e.prototype,"totalFrames",{get:function(){return this._textures.length},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"textures",{get:function(){return this._textures},set:function(t){if(t[0]instanceof i.Texture)this._textures=t,this._durations=null;else{this._textures=[],this._durations=[];for(var e=0;e<t.length;e++)this._textures.push(t[e].texture),this._durations.push(t[e].time)}this._previousFrame=null,this.gotoAndStop(0),this.updateTexture()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"currentFrame",{get:function(){var t=Math.floor(this._currentTime)%this._textures.length;return t<0&&(t+=this._textures.length),t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"playing",{get:function(){return this._playing},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"autoUpdate",{get:function(){return this._autoUpdate},set:function(t){t!==this._autoUpdate&&(this._autoUpdate=t,!this._autoUpdate&&this._isConnectedToTicker?(y.vB.shared.remove(this.update,this),this._isConnectedToTicker=!1):this._autoUpdate&&!this._isConnectedToTicker&&this._playing&&(y.vB.shared.add(this.update,this),this._isConnectedToTicker=!0))},enumerable:!1,configurable:!0}),e}(m),b=n(8141),x=n(7659),w=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),C=(function(t){function e(){return null!==t&&t.apply(this,arguments)||this}w(e,t),e.prototype._render=function(t){var n=f(this.blendMode_1,this.intensity);if(!n||(t.batch.flush(),t.filter.pushWithCheck(this,n))){var r=this.geometry.buffers[0].data;this.shader.batchable&&this.drawMode===x.lg.TRIANGLES&&r.length<2*e.BATCHABLE_SIZE?this._renderToBatch(t):this._renderDefault(t),n&&(t.batch.flush(),t.filter.pop())}}}(b.Kj),n(2064)),T=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),S=(function(t){function e(){return null!==t&&t.apply(this,arguments)||this}T(e,t),e.prototype._render=function(t){var e=this._texture;if(e&&e.valid){var n=f(this.blendMode_1);n&&(t.batch.flush(),!t.filter.pushWithCheck(this,n))||(this.tileTransform.updateLocalTransform(),this.uvMatrix.update(),t.batch.setObjectRenderer(t.plugins[this.pluginName]),t.plugins[this.pluginName].render(this),n&&(t.batch.flush(),t.filter.pop()))}}}(C.o),n(1893));function k(t,e){void 0===e&&(e=0);var n=this.gl;this.currentLocation!==e&&(this.currentLocation=e,n.activeTexture(n.TEXTURE0+e)),this.bind(t,e)}var E=new S.y3;function P(t,e,n){void 0===n&&(n=!0);for(var r=this.renderer,o=this.defaultFilterStack,a=this.statePool.pop()||new i.FilterState,s=this.renderer.renderTexture,c=e[0].resolution,l=e[0].padding,u=e[0].autoFit,h=e[0].legacy,d=1;d<e.length;d++){var f=e[d];c=Math.min(c,f.resolution),l=this.useMaxPadding?Math.max(l,f.padding):l+f.padding,u=u&&f.autoFit,h=h||f.legacy}1===o.length&&(this.defaultFilterStack[0].renderTexture=s.current),o.push(a),a.resolution=c,a.legacy=h,a.target=t,a.sourceFrame.copyFrom(t.filterArea||t.getBounds(!0)),a.sourceFrame.pad(l);var p,g,m,y,v,_,b=!0;if(u){var x=this.tempRect.copyFrom(s.sourceFrame);r.projection.transform&&this.transformAABB(E.copyFrom(r.projection.transform).invert(),x),a.sourceFrame.fit(x)}else p=this.renderer.renderTexture.sourceFrame,g=a.sourceFrame,m=g.x+g.width,y=g.y+g.height,v=p.x+p.width,_=p.y+p.height,b=g.x>=p.x&&g.x<=v&&g.y>=p.y&&g.y<=_&&m>=p.x&&m<=v&&y>=p.y&&y<=_;if(n&&a.sourceFrame.width<=1&&a.sourceFrame.height<=1)return o.pop(),a.clear(),this.statePool.push(a),!1;this.roundFrame(a.sourceFrame,s.current?s.current.resolution:r.resolution,s.sourceFrame,s.destinationFrame,r.projection.transform),a.sourceFrame.ceil(c);new Date;if(b){var w=null,C=null;for(d=0;d<e.length;d++){var T=e[d].backdropUniformName;if(T){var S=e[d].uniforms;S[T+"_flipY"]||(S[T+"_flipY"]=new Float32Array([0,1]));var k=S[T+"_flipY"];null===w?(w=this.prepareBackdrop(a.sourceFrame,k),C=k):(k[0]=C[0],k[1]=C[1]),S[T]=w,w&&(e[d]._backdropActive=!0)}}w&&(c=a.resolution=w.resolution)}a.renderTexture=this.getOptimalFilterTexture(a.sourceFrame.width,a.sourceFrame.height,c),a.filters=e,a.destinationFrame.width=a.renderTexture.width,a.destinationFrame.height=a.renderTexture.height;var P=this.tempRect;P.x=0,P.y=0,P.width=a.sourceFrame.width,P.height=a.sourceFrame.height,a.renderTexture.filterFrame=a.sourceFrame,a.bindingSourceFrame.copyFrom(s.sourceFrame),a.bindingDestinationFrame.copyFrom(s.destinationFrame),a.transform=r.projection.transform,r.projection.transform=null,s.bind(a.renderTexture,a.sourceFrame,P);var R=e[e.length-1].clearColor;return R?r.framebuffer.clear(R[0],R[1],R[2],R[3]):r.framebuffer.clear(0,0,0,0),!0}function R(t,e){return this.pushWithCheck(t,e,!1)}function O(){var t=this.defaultFilterStack,e=t.pop(),n=e.filters;this.activeState=e;var r=this.globalUniforms.uniforms;r.outputFrame=e.sourceFrame,r.resolution=e.resolution;var i=r.inputSize,o=r.inputPixel,a=r.inputClamp;if(i[0]=e.destinationFrame.width,i[1]=e.destinationFrame.height,i[2]=1/i[0],i[3]=1/i[1],o[0]=i[0]*e.resolution,o[1]=i[1]*e.resolution,o[2]=1/o[0],o[3]=1/o[1],a[0]=.5*o[2],a[1]=.5*o[3],a[2]=e.sourceFrame.width*i[2]-.5*o[2],a[3]=e.sourceFrame.height*i[3]-.5*o[3],e.legacy){var s=r.filterArea;s[0]=e.destinationFrame.width,s[1]=e.destinationFrame.height,s[2]=e.sourceFrame.x,s[3]=e.sourceFrame.y,r.filterClamp=r.inputClamp}this.globalUniforms.update();var c=t[t.length-1];if(e.renderTexture.framebuffer.multisample>1&&this.renderer.framebuffer.blit(),1===n.length)n[0].apply(this,e.renderTexture,c.renderTexture,x.yl.BLEND,e),this.returnFilterTexture(e.renderTexture);else{var l=e.renderTexture,u=this.getOptimalFilterTexture(l.width,l.height,e.resolution);u.filterFrame=l.filterFrame;var h=0;for(h=0;h<n.length-1;++h){n[h].apply(this,l,u,x.yl.CLEAR,e);var d=l;l=u,u=d}n[h].apply(this,l,c.renderTexture,x.yl.BLEND,e),this.returnFilterTexture(l),this.returnFilterTexture(u)}var f=!1;for(h=0;h<n.length;h++)if(n[h]._backdropActive){var p=n[h].backdropUniformName;f||(this.returnFilterTexture(n[h].uniforms[p]),f=!0),n[h].uniforms[p]=null,n[h]._backdropActive=!1}e.clear(),this.statePool.push(e)}var D=!1;function A(t,e){var n=this.renderer,r=n.renderTexture.current,i=this.renderer.renderTexture.sourceFrame,o=n.projection.transform||S.y3.IDENTITY,a=1;if(r)a=r.baseTexture.resolution,e[1]=1;else{if(!n.useContextAlpha)return D||(D=!0,console.warn("pixi-picture: you are trying to use Blend Filter on main framebuffer! That wont work.")),null;a=n.resolution,e[1]=-1}var s=Math.round((t.x-i.x+o.tx)*a),c=t.y-i.y+o.ty,l=Math.round((e[1]<0?i.height-(c+t.height):c)*a),u=Math.round(t.width*a),h=Math.round(t.height*a),d=n.gl,f=this.getOptimalFilterTexture(u,h,1);e[1]<0&&(e[0]=h/f.height),f.filterFrame=i,f.setResolution(a),n.texture.bindForceLocation(f.baseTexture,0);new Date;return d.copyTexSubImage2D(d.TEXTURE_2D,0,0,0,s,l,u,h),f}i.TextureSystem.prototype.bindForceLocation=k,i.FilterSystem.prototype.push=R,i.FilterSystem.prototype.pushWithCheck=P,i.FilterSystem.prototype.pop=O,i.FilterSystem.prototype.prepareBackdrop=A},401:(t,e,n)=>{n.d(e,{$G:()=>v,Cb:()=>u,Eh:()=>p,F3:()=>b,Gb:()=>h,Jp:()=>l,Ss:()=>s,Ty:()=>d,c4:()=>o,c9:()=>r,em:()=>a,gz:()=>f,hJ:()=>g,iN:()=>_,jw:()=>c,rR:()=>y,ty:()=>m,xb:()=>i});var r="c30849f08b1b4841a759a7c7534a2f0c.bin";function i(){return"".concat("https://webar-static.tencent-cloud.com/ar-sdk/resources","/").concat("1.0.24","/").concat(r)}var o={POINTS_MAP:23,KEY_POINTS:24,LEFT_FACE_OVAL:8,LEFT_FACE_OVAL2:9,LEFT_FACE_OVAL3:10,RIGHT_FACE_OVAL:11,RIGHT_FACE_OVAL2:12,RIGHT_FACE_OVAL3:13,MOUTH_UPPER:19,MOUTH_LOWER:20,OUTER_REFERENCE:18,outer_offset_ratio:27,triangulation:25,auvs:26,LEFT_IRIS:7,RIGHT_IRIS:6,LEFT_EYE_ORDER:14,RIGHT_EYE_ORDER:15,lipsTriangulation:28,lipsAuvs:29,LIPS:5},a=0,s=0,c=356,l=[0,32],u="64,65,63,72,79,70,74",h="61,75,74,68",d="61,6c,6c,6f,77,46,75,6e,63,4c,69,73,74",f="54,69,6d,65,73,74,61,6d,70",p="57,65,62,54,69,6d,65,73,74,61,6d,70",g="4b,65,79,4c,69,73,74",m={bu:"62,65,61,75,74,69,66,79",mu:"65,66,66,65,63,74,5f,6d,61,6b,65,75,70",s:"65,66,66,65,63,74,5f,73,74,69,63,6b,65,72,5f,32,64",s3:"65,66,66,65,63,74,5f,73,74,69,63,6b,65,72,5f,33,64",f:"66,69,6c,74,65,72",bg:"62,61,63,6b,67,72,6f,75,6e,64",a:"61,76,61,74,61,72,5f,61,72",av:"61,76,61,74,61,72,5f,76,72"};function y(t){for(var e="",n=t.split(","),r=0;r<n.length;r++)e+=String.fromCharCode(parseInt(n[r],16));return e}function v(t){for(var e="",n=0;n<t.length;n++)""==e?e=t.charCodeAt(n).toString(16):e+=","+t.charCodeAt(n).toString(16);return e}var _="offscreen",b={defaultRoot:"miniprogram_npm/tencentcloud-webar"}},3044:(t,e,n)=>{n.d(e,{UI:()=>f,iV:()=>d,pF:()=>p});var r=n(6309),i=n(1206),o=n(4809),a=n(8586),s=n(201),c=function(t,e,n,r){var i,o=arguments.length,a=o<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,n,r);else for(var s=t.length-1;s>=0;s--)(i=t[s])&&(a=(o<3?i(a):o>3?i(e,n,a):i(e,n))||a);return o>3&&a&&Object.defineProperty(e,n,a),a},l=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},u=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function a(t){try{c(r.next(t))}catch(t){o(t)}}function s(t){try{c(r.throw(t))}catch(t){o(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(a,s)}c((r=r.apply(t,e||[])).next())}))},h=function(t,e){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=a.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=e.call(t,a)}catch(t){o=[6,t],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}},d={};function f(){d={}}var p=function(){function t(){this._inited=!1,this._initing=!1}return t.prototype.getLoader=function(){return this._loader},t.prototype.getIndeLoader=function(){return this._initLoader()},t.prototype.readJSON=function(t,e){var n=this.encLoader.getFileFromCache(t,e).file;if(n&&n.length)return JSON.parse((0,o.T8)(n))},t.prototype._initLoader=function(){var t=this,e=new i.aN,n=this.getPreMiddleware();return e.pre(n),e.use((function(n,r){if("json"!==n.extension){var o=n.data;if(i.P6.kN[n.name])r();else{var a=i.xE.fromBuffer(o.file,o.width,o.height,{alphaMode:i.iw.UNPACK,resolution:(0,s.u)()});i.VL.addToCache(a.baseTexture,n.name),i.xE.addToCache(a,n.name),r()}}else t.handleSpriteSheet(e,n,r)})),e},t.prototype.removeFromCache=function(t){this.encLoader&&this.encLoader.removeFromCache(t)},t.prototype.init=function(){return u(this,void 0,Promise,(function(){var t=this;return h(this,(function(e){return this._inited?[2,Promise.resolve()]:this._initing?[2,new Promise((function(e,n){var r,i=function(){t._inited?(e(),clearTimeout(r)):r=setTimeout(i,50)};r=setTimeout(i,50)}))]:(this._initing=!0,[2,new Promise((function(e,n){var i=new r.e({});i.init().then((function(){t._inited=!0,t._initing=!1,t.encLoader=i,t._loader=t._initLoader(),e()})).catch((function(t){}))}))])}))}))},t.prototype.preload=function(t){return u(this,void 0,void 0,(function(){var e;return h(this,(function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),[4,this.encLoader.preload(t)];case 1:return n.sent(),[3,3];case 2:return e=n.sent(),[2,Promise.reject(e)];case 3:return[2]}}))}))},t.prototype.getPreMiddleware=function(){var t=this;return function(e,n){if(i.P6.kN&&e&&i.P6.kN[e.name])n();else{var r=e.url,a=t.encLoader.getFileFromCache(r),s=a.zip,c=a.file,l=e.name;if(l.indexOf("https")>-1&&l.indexOf("|")>-1){var u=l.split("|")[0],h=t.encLoader.getFileFromCache(r,u);s=h.zip,c=h.file}if(/\.(json)$/i.test(r))return e.data=JSON.parse((0,o.T8)(c)),e.complete(),void n();/\.(gif|jpe?g|tiff?|png|webp|bmp)$/i.test(r)?(e.data={file:c,width:s.__config[r]?s.__config[r].width:800,height:s.__config[r]?s.__config[r].height:800},e.complete(),n()):(e.data={file:c},e.complete(),n())}}},t.prototype.handleSpriteSheet=function(t,e,n){var r="".concat(e.name,"_image");if(e.data&&e.data.frames&&!t.resources[r]&&!i.P6.kN[r]){var o={crossOrigin:e.crossOrigin,metadata:e.data.meta},a=e.data.meta.image,c=e.url.split("/");c.pop(),c.push(a),a=c.join("/");var l=this.getLoader();l.add(r,a,o,(function(t){var r=i.xE.fromBuffer(t.data.file,t.data.width,t.data.height,{alphaMode:i.iw.UNPACK}),o=new i.c2(r,e.data,e.url+"@".concat((0,s.u)(),"x"));o.parse((function(){e.spritesheet=o,e.textures=o.textures,d[e.name]=e,n()}))})),l.load((function(t,e){}))}else n()},t=c([a.e,l("design:paramtypes",[])],t)}()},6309:(t,e,n)=>{n.d(e,{e:()=>b});var r=n(4809),i=n(5127),o=n(8586),a=n(3553),s=n(6878);const c=function(){function t(){this.projectName="webar-db",this.objectStoreName="webar-object-store","undefined"!=typeof self&&self?this.window=self:"undefined"!=typeof window&&window&&(this.window=window)}return t.prototype.checkSupport=function(){var t=this.window;return!(void 0===t||!t||!t.indexedDB)},t.prototype.init=function(){var t=this;return new Promise((function(e,n){if(t.checkSupport()){if(t.db)return void e(t.db);var r=t.window.indexedDB.open(t.projectName,1);r.onsuccess=function(n){t.db=n.target.result,e(t)},r.onupgradeneeded=function(e){var n=e.target.result;n.objectStoreNames.contains(t.objectStoreName)||n.createObjectStore(t.objectStoreName)},r.onerror=function(t){n(t)}}else n()}))},t.prototype.getItem=function(t){var e=this;return new Promise((function(n,r){if(e.db){var i=e.db.transaction(e.objectStoreName).objectStore(e.objectStoreName).get(t);i.onsuccess=function(){return n(i.result)},i.onerror=function(){return r()}}else r()}))},t.prototype.setItem=function(t,e){var n=this;return new Promise((function(r,i){if(n.db){var o=n.db.transaction(n.objectStoreName,"readwrite").objectStore(n.objectStoreName).put(e,t);o.onsuccess=function(){return r(e)},o.onerror=function(){return i()}}else i()}))},t.prototype.removeItem=function(t){var e=this;return new Promise((function(n,r){if(e.db){var i=e.db.transaction(e.objectStoreName,"readwrite").objectStore(e.objectStoreName).delete(t);i.onsuccess=function(){return n(null)},i.onerror=function(){return r()}}else r()}))},t.prototype.keys=function(){var t=this;return new Promise((function(e,n){if(!t.db)return n();var r=t.db.transaction(t.objectStoreName).objectStore(t.objectStoreName).getAllKeys();r.onsuccess=function(){return e(r.result)},r.onerror=function(){return n()}}))},t.prototype.clear=function(){var t=this;return new Promise((function(e,n){if(!t.db)return n();var r=t.db.transaction(t.objectStoreName,"readwrite").objectStore(t.objectStoreName).clear();r.onsuccess=function(){return e(null)},r.onerror=function(){return n()}}))},t}();var l=n(401),u=n(6109),h=n(9984),d=function(t,e,n,r){var i,o=arguments.length,a=o<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,n,r);else for(var s=t.length-1;s>=0;s--)(i=t[s])&&(a=(o<3?i(a):o>3?i(e,n,a):i(e,n))||a);return o>3&&a&&Object.defineProperty(e,n,a),a},f=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},p=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function a(t){try{c(r.next(t))}catch(t){o(t)}}function s(t){try{c(r.throw(t))}catch(t){o(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(a,s)}c((r=r.apply(t,e||[])).next())}))},g=function(t,e){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=a.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=e.call(t,a)}catch(t){o=[6,t],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}},m=function(t){var e="function"==typeof Symbol&&Symbol.iterator,n=e&&t[e],r=0;if(n)return n.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&r>=t.length&&(t=void 0),{value:t&&t[r++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},y=function(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var r,i,o=n.call(t),a=[];try{for(;(void 0===e||e-- >0)&&!(r=o.next()).done;)a.push(r.value)}catch(t){i={error:t}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return a},v=function(t,e,n){if(n||2===arguments.length)for(var r,i=0,o=e.length;i<o;i++)!r&&i in e||(r||(r=Array.prototype.slice.call(e,0,i)),r[i]=e[i]);return t.concat(r||Array.prototype.slice.call(e))};var _=function(){function t(t){this.id=Math.floor(1e8*Math.random()),this.size=t,this.data=new Map}return t.prototype.put=function(t,e){if(u.D4.info("put",t,this.data.keys(),this.id),t.indexOf(l.c9)>-1&&(this.common_cache=e,this.common_cache_domain=t),this.data.has(t))return u.D4.info("replace key",t),this.data.delete(t),void this.data.set(t,e);if(u.D4.info("check need remove old",this.data.size,this.size),this.data.size>=this.size){var n=this.data.keys().next().value;u.D4.info("delete key",n),this.data.delete(n)}u.D4.info("set key",t),this.data.set(t,e)},t.prototype.get=function(t){if(t.indexOf(l.c9)>-1)return this.common_cache;if(!this.data.has(t))return!1;var e=this.data.get(t);return this.data.delete(t),this.data.set(t,e),e},Object.defineProperty(t.prototype,"keys",{get:function(){return Array.from(this.data.keys()).concat([this.common_cache_domain])},enumerable:!1,configurable:!0}),t.prototype.delete=function(t){this.data.delete(t)},t.prototype.clear=function(){this.data.clear()},t=d([o.e,f("design:paramtypes",[Number])],t)}(),b=function(){function t(t){this._inited=!1,this._initing=!1,this.id=Math.floor(1e8*Math.random()),this._cache=new _(7),this._loadingMap={},t=t||{},this.config=t,this.arCacheStorage=new c}return t.prototype.init=function(){return p(this,void 0,Promise,(function(){var t=this;return g(this,(function(e){return this._inited?[2,Promise.resolve()]:this._initing?[2,new Promise((function(e,n){var r,i=function(){t._inited?(e(),clearTimeout(r)):r=setTimeout(i,50)};r=setTimeout(i,50)}))]:(this._initing=!0,this._c=new i.Y,[2,this._c.init().then((function(){t._inited=!0,t._initing=!1,setTimeout((function(){t.checkAndClearOldFileCache()}),9999)}))])}))}))},t.prototype.getSingletonWorker=function(){var t=this;return this.worker||(this.worker=new Worker,this.worker.onmessage=function(e){var n=e.data,i=n.p1,o=n.p2,a=n.length,s=(n.i,n.u),c=n.error;if(c)t._error=new Error(c.message);else{var l=new Uint8Array(a);l.set(i),l.set(o,i.length),t.setFileCache(s,l);var h=t._c,d=h.run(i,"");h.finish("");var f=new Uint8Array(a);f.set(d),f.set(o,d.length);var p=(0,r.GZ)(f);u.D4.info("preload finish:",s),t._setConfig(p).then((function(){t._cache.put(s,p),delete t._loadingMap[s]}))}}),this.worker},t.prototype.preload=function(t,e,n){return void 0===e&&(e=!0),void 0===n&&(n=1),p(this,void 0,Promise,(function(){var n,r,i=this;return g(this,(function(o){if(this._loadingMap[t])return[2,this.waitUntilPreload(t)];for(n in this._loadingMap[t]=!0,this._loadingMap)n!==t&&(this._loadingMap[n]=!1);return this._cache.get(t)?(delete this._loadingMap[t],[2,Promise.resolve()]):(r=a.Z.findId(t)||+new Date,[2,new Promise((function(n,o){return p(i,void 0,void 0,(function(){var i,o,a,c=this;return g(this,(function(l){switch(l.label){case 0:return[4,(0,h.pe)(r,t).catch((function(t){s.Nd.trigger("error",t)}))];case 1:return l.sent(),i=wx.getFileSystemManager(),o={},a="".concat(wx.env.USER_DATA_PATH,"/ar/").concat(r,".zip"),console.log("zip 处理",a),i.readZipEntry({filePath:a,entries:"all",success:function(a){var s=a.entries;for(var l in s)o[l]=new Uint8Array(s[l].data);c._cache.put(t,o),delete c._loadingMap[t],c._setConfig(o).then((function(){e||i.unlink({filePath:"".concat(wx.env.USER_DATA_PATH,"/ar/").concat(r,".bin"),success:function(){},fail:function(t){console.log("delete local cache fail",t)}}),n()}))},fail:function(t){console.log(t.errMsg)}}),[2]}}))}))}))])}))}))},t.prototype.getFileFromCache=function(t,e){var n=this._find(t,e);return{zip:n.c,file:n.f}},t.prototype.getGroupFromCache=function(t){return this._cache.get(t)},t.prototype._find=function(t,e){var n,r,i,o,a=this._cache,s=t;if(e){var c=a.get(e);return c&&(o=c[s]),{c,f:o}}var l=a.keys.reverse();try{for(var u=m(l),h=u.next();!h.done;h=u.next()){var d=h.value;if(o=(i=a.get(d))[s])break}}catch(t){n={error:t}}finally{try{h&&!h.done&&(r=u.return)&&r.call(u)}finally{if(n)throw n.error}}return{c:i,f:o}},t.prototype._setConfig=function(t){return p(this,void 0,Promise,(function(){return g(this,(function(e){return[2,new Promise((function(e){if(t.__config)e();else{var n=t["__config.json"];if(n){var i=JSON.parse((0,r.T8)(n));t.__config=i,e()}else e()}}))]}))}))},t.prototype.waitUntilPreload=function(t){var e=this;return new Promise((function(n,r){var i=setInterval((function(){e._cache.get(t)&&(clearInterval(i),n())}),50)}))},t.prototype.loadScript=function(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];return p(this,void 0,Promise,(function(){var n=this;return g(this,(function(i){return[2,new Promise((function(i,o){var a=n._cache.keys,s=t.split("/").pop();return a.forEach((function(t){var o=n._cache.get(t),a=o[s];if(o[s]){var c=(0,r.T8)(a),l=new Function(""+c),u=l.call.apply(l,v([null],y(e),!1));return i(u)}})),u.kg.info("this._cache",n.id,n._cache),o({message:"file not found in cache",url:t})}))]}))}))},t.prototype.hijackFetch=function(t,e,n){var r,i=this;return void 0===n&&(n=!1),e&&"string"==typeof e&&(r=e),new Promise((function(e){var o,a=i._cache.keys;if(o=n?t:t.split("/").pop(),r){var s=i._cache.get(r)[o];return s?e(s):e()}a.forEach((function(t){var n=i._cache.get(t)[o];if(n)return e(n)}))}))},t.prototype.removeFromCache=function(t){this._cache.delete(t)},t.prototype.clearCache=function(){console.trace("clearCache"),this._cache.clear(),this.worker&&(this.worker.terminate(),this.worker=null)},t.prototype.clearCacheTmp=function(t){var e,n;void 0===t&&(t=[]);try{for(var r=m(this._cache.keys),i=r.next();!i.done;i=r.next()){var o=i.value;-1===t.indexOf(o)&&this._cache.delete(o)}}catch(t){e={error:t}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(e)throw e.error}}},t.prototype.fetchWithSubPackage=function(t,e){return p(this,void 0,void 0,(function(){var n,r,i,o,a,s;return g(this,(function(c){switch(c.label){case 0:if(!(e>1&&Blob.prototype.arrayBuffer))return[3,3];for(r=1048576,i=[],o=function(e){var n=e*r,o=n+r-1,a="bytes=".concat(n,"-").concat(o),s=new Promise((function(n,r){fetch("".concat(t,"?id=00").concat(e),{method:"GET",mode:"cors",headers:{range:a}}).then((function(t){return t.arrayBuffer()})).then((function(t){n(t)}))}));i.push(s)},a=0;a<e;a++)o(a);return[4,Promise.all(i)];case 1:return s=c.sent(),[4,new Blob(s).arrayBuffer()];case 2:return n=c.sent(),[3,6];case 3:return[4,fetch(t,{method:"GET",mode:"cors"}).catch((function(t){}))];case 4:return[4,c.sent().arrayBuffer().catch((function(t){u.kg.error("get arraybuffer error",t)}))];case 5:n=c.sent(),c.label=6;case 6:return[2,n]}}))}))},t.prototype.checkFileCacheBlackList=function(t){return!!{"effect.bin":!0}[t]},t.prototype.setFileCache=function(t,e){var n=this;try{this.arCacheStorage.checkSupport()&&this.arCacheStorage.init().then((function(){var r=t.split("/").pop();if(!n.checkFileCacheBlackList(r)){var i="".concat("1.0.24","/").concat(r);n.arCacheStorage.setItem(i,e)}}))}catch(t){}},t.prototype.fetchFromFileCache=function(t){var e=this;return new Promise((function(n,r){e.arCacheStorage.checkSupport()?e.arCacheStorage.init().then((function(){var r=t.split("/").pop(),i="".concat("1.0.24","/").concat(r);e.checkFileCacheBlackList(r)?n(null):e.arCacheStorage.getItem(i).then((function(t){n(t||null)}))})).catch((function(){n(null)})):n(null)}))},t.prototype.checkAndClearOldFileCache=function(){var t=this;this.arCacheStorage.checkSupport()&&this.arCacheStorage.init().then((function(){t.arCacheStorage.keys().then((function(e){if(e&&e.length)for(var n="".concat("1.0.24"),r=0;r<e.length;r++){var i=e[r];i&&i.indexOf(n)<0&&t.arCacheStorage.removeItem(i)}}))})).catch((function(){}))},t=d([o.e,f("design:paramtypes",[Object])],t)}()},337:(t,e,n)=>{n.d(e,{Z:()=>o});const r={"0001":"当前环境不支持","0002":"请先开启摄像头及麦克风权限","0003":"去设置","0004":"输入不合法","0005":"缺少输入, 请设置input或camera参数","0006":"输入图片不合法","0007":"无权访问此接口,请确认License版本信息","0008":"创建录制器失败","0009":"录制启动失败","0010":"录制器停止失败","0011":"小程序读取缓存失败","0012":"存储空间不足,前往设置-通用-存储空间,清除缓存","0013":"需要重新进入页面使授权生效","0014":"当前SDK版本过低,部分特效无法正确显示,请升级SDK版本","0015":"intensity 的值超出范围(0-1),默认为 1","0016":"输入不合法, 远程链接只支持输入图片类型","0018":"当前浏览器特性支持不足,可能会出现卡顿情况,请使用新版 Chrome/Safari/微信体验","0019":"当前浏览器不支持,请使用新版 Chrome/Safari/微信体验","0020":"当前浏览器不支持,若Chrome请开启浏览器硬件加速","0021":"缺少鉴权参数licenseKey","0022":"缺少鉴权参数appId","0023":"输入不合法, 请传input或camera参数","0024":"无权访问此接口,请确认License版本信息","0025":"基础库加载失败","0026":"上下文丢失,请重新初始化","0027":"渲染耗时大,请尝试减小分辨率或刷新页面","0028":"未捕获异常","0029":"没有摄像头权限,请到设置-隐私中开启相关权限","0030":"调起用户摄像头失败","0031":"摄像头或麦克风中断,请手动刷新页面","0032":"分辨率变化导致特效丢失,请重新设置","0033":"特效加载失败","0034":"无法解析的数据","0035":"已授权,仍无法访问摄像头或麦克风设备","0036":"没有麦克风权限,请到设置-隐私中开启相关权限",1001:"美妆",1002:"贴纸",1003:"滤镜",1004:"3D特效",1005:"VR人像",1006:"头像"},i={"0001":"Unsupported environment","0002":"Please enable the camera and microphone permissions","0003":"Setting","0004":"Invalid input","0005":'Require "input" or "camera" paramate',"0006":"Invalid image input","0007":"API not accessible, Please confirm the License version","0008":"Failed to create the recorder","0009":"Failed to start recording","0010":"Failed to stop the recorder","0011":"Failed to read WX file cache data","0012":"Out of storage space, go to Settings - General-Storage Space and clear the cache","0013":"Need to enter the page again for the license to take effect","0014":"SDK version is too old, some features are not available. Please update the SDK","0015":'Require a valid value (0-1) for "intensity" (the default value is 1)',"0016":'Invalid "input" value, Only the image type can be entered for remote links',"0018":"This browser offers limited support for the SDK, and stutter may occur. Please use the latest version of Chrome, Safari, or WeChat","0019":"This browser is not supported. Please use the latest version of Chrome, Safari, or WeChat","0020":"This browser is not supported. If Chrome is used, enable hardware acceleration for the browser","0021":'The authentication parameter "licenseKey" is missing',"0022":'The authentication parameter "appId" is missing',"0023":'Require "input" or "camera" parameter',"0024":"The interface is not accessible. Please check the License version","0025":"Failed to load the basic libraries","0026":"The context is lost. Please reinitialize the SDK again","0027":"The rendering took too long. Try reducing the resolution or refreshing the page","0028":"No errors captured","0029":"This browser does not have camera permission, please go to Settings - Privacy turn Camera on","0030":"Failed to start the camera","0031":"The camera or microphone is disconnected. Please refresh","0032":"Resolution changes cause effects to be lost, Please reset","0033":"Failed to load the effects","0034":"Unrecognized response data","0035":"Authorized, but still unable to access camera or microphone device","0036":"This browser does not have microphone permission, please go to Settings - Privacy turn Microphone on",1001:"Makeup",1002:"Sticker",1003:"Filter",1004:"3D Effect",1005:"VR",1006:"AR"};const o=new(function(){function t(t){void 0===t&&(t="zh"),this._lang=t}return Object.defineProperty(t.prototype,"lang",{get:function(){return this._lang},set:function(t){this._lang=t},enumerable:!1,configurable:!0}),t.prototype.t=function(t){return"zh"===this._lang?r[t]:i[t]},t}())},885:(t,e,n)=>{var r,i,o;n.d(e,{Mj:()=>c,UZ:()=>o,bk:()=>a}),function(t){t[t.Default=0]="Default",t[t.Preview=1]="Preview"}(r||(r={})),function(t){t["2D"]="2d",t["3D"]="3d"}(i||(i={})),function(t){t[t.CAMERA=0]="CAMERA",t[t.VIDEO=1]="VIDEO",t[t.CANVAS=2]="CANVAS",t[t.IMAGE=3]="IMAGE",t[t.MEDIA_STREAM=4]="MEDIA_STREAM"}(o||(o={}));var a,s,c={CAMERA:0,CANVAS2D:2,IMAGE:3};!function(t){t[t.CAMERA=0]="CAMERA",t[t.VIDEO=1]="VIDEO",t[t.CANVAS=2]="CANVAS",t[t.IMAGE=3]="IMAGE",t[t.MEDIA_STREAM=4]="MEDIA_STREAM"}(a||(a={})),function(t){t[t.WORKER=0]="WORKER",t[t.DEFAULT=1]="DEFAULT"}(s||(s={}))},1084:(t,e,n)=>{n.d(e,{M:()=>a,o:()=>s});var r=n(6109),i=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function a(t){try{c(r.next(t))}catch(t){o(t)}}function s(t){try{c(r.throw(t))}catch(t){o(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(a,s)}c((r=r.apply(t,e||[])).next())}))},o=function(t,e){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=a.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=e.call(t,a)}catch(t){o=[6,t],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}};function a(t){return function(e,n,a){var s=a.value;return"AsyncFunction"===s.constructor.name?a.value=function(){for(var e=[],a=0;a<arguments.length;a++)e[a]=arguments[a];return i(this,void 0,void 0,(function(){return o(this,(function(i){switch(i.label){case 0:return[4,s.apply(this,e).catch((function(e){r.kg.info("".concat(t,".").concat(n," call failed"),e)}))];case 1:return[2,i.sent()]}}))}))}:a.value=function(){for(var e=[],i=0;i<arguments.length;i++)e[i]=arguments[i];try{var o=s.apply(this,e);return o}catch(e){r.kg.info("".concat(t,".").concat(n," call failed"),e)}},a}}function s(t){return function(e,n,a){var s=a.value;return a.value=function(){for(var e=[],a=0;a<arguments.length;a++)e[a]=arguments[a];return i(this,void 0,void 0,(function(){return o(this,(function(i){switch(i.label){case 0:return[4,s.apply(this,e).catch((function(e){r.kg.info("".concat(t,".").concat(n," call failed"),e)}))];case 1:return[2,i.sent()]}}))}))},a}}},5127:(t,e,n)=>{n.d(e,{Y:()=>p});var r=n(337),i=n(6878),o=n(8586),a=n(401),s=n(4809),c=n(6879),l=function(t,e,n,r){var i,o=arguments.length,a=o<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,n,r);else for(var s=t.length-1;s>=0;s--)(i=t[s])&&(a=(o<3?i(a):o>3?i(e,n,a):i(e,n))||a);return o>3&&a&&Object.defineProperty(e,n,a),a},u=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},h=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function a(t){try{c(r.next(t))}catch(t){o(t)}}function s(t){try{c(r.throw(t))}catch(t){o(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(a,s)}c((r=r.apply(t,e||[])).next())}))},d=function(t,e){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=a.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=e.call(t,a)}catch(t){o=[6,t],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}};"undefined"==typeof WXWebAssembly&&i.Nd.trigger("error",{code:c.U.ENVIRAONMENT_NOT_COMPATIBLE,message:r.Z.t("0019")});var f=WXWebAssembly,p=function(){function t(){this._inited=!1,this._initing=!1}return t.prototype.init=function(){return h(this,void 0,Promise,(function(){var t=this;return d(this,(function(e){return this._inited?[2,Promise.resolve()]:this._initing?[2,new Promise((function(e,n){var r,i=function(){t._inited?(e(),clearTimeout(r)):r=setTimeout(i,100)};r=setTimeout(i,100)}))]:(this._initing=!0,[2,new Promise((function(e,n){f.instantiate("/".concat(a.F3.defaultRoot,"/0.wasm.br"),{}).then((function(n){t._wasm=n.instance.exports,t._initWasmWrapper(),t._inited=!0,t._initing=!1,e()})).catch((function(t){console.log("wasm instantiate error",t)}))}))])}))}))},t.prototype._initWasmWrapper=function(){var t,e=this._wasm,n=e.memory,r=e.__wbindgen_malloc,i=e.__wbindgen_realloc;function o(){return null!=t&&t.buffer===n.buffer||(t=new Uint8Array(n.buffer)),t}var c,l,u=0;function h(t){for(var e=t.length,n=r(e),a=o(),s=0;s<e;s++){var l=t.charCodeAt(s);if(l>127)break;a[n+s]=l}if(s!==e){0!==s&&(t=t.slice(s)),n=i(n,e,e=s+3*t.length);var h=o().subarray(n+s,n+e);s+=c(t,h).written}return u=s,n}function d(){return null!=l&&l.buffer===n.buffer||(l=new Int32Array(n.buffer)),l}function f(t,e){return(0,s.T8)(o().subarray(t,t+e))}c=function(t,e){var n,r,i=new Array;n=t.length;for(var o=0;o<n;o++)(r=t.charCodeAt(o))>=65536&&r<=1114111?(i.push(r>>18&7|240),i.push(r>>12&63|128),i.push(r>>6&63|128),i.push(63&r|128)):r>=2048&&r<=65535?(i.push(r>>12&15|224),i.push(r>>6&63|128),i.push(63&r|128)):r>=128&&r<=2047?(i.push(r>>6&31|192),i.push(63&r|128)):i.push(255&r);var a=new Int8Array(i.length);for(var o in i)a[o]=i[o];return e.set(a),{read:t.length,written:a.length}},this.run=function(t,n){var i,s,c=e[(0,a.rR)(a.Cb)],l=e.__wbindgen_free,f=(s=r(1*(i=t).length),o().set(i,s/1),u=i.length,s),p=u;try{c(8,f,p,h(n),u);var g=d(),m=function(t,e){return o().subarray(t/1,t/1+e)}(g[2],g[3]).slice();return l(g[2],1*g[3]),m}finally{t.set(o().subarray(f/1,f/1+p)),l(f,1*p)}},this.finish=function(t){(0,e.finish)(h(t),u)},this.run2=function(t,n,r){var i=e.__wbindgen_free,o=(e[(0,a.rR)(a.Gb)](8,h(t),u,h(n),u,h(r),u),d()),s=f(o[2],o[3]).slice();return i(o[2],1*o[3]),s},this.a_de=function(t){var n=e.__wbindgen_free,r=(e.a_de(8,h(t),u),d()),i=f(r[2],r[3]).slice();return n(r[2],1*r[3]),i},this.a_en=function(t){var n=e.__wbindgen_free,r=(e.a_en(8,h(t),u),d()),i=f(r[2],r[3]).slice();return n(r[2],1*r[3]),i}},t=l([o.e,u("design:paramtypes",[])],t)}()},6879:(t,e,n)=>{n.d(e,{U:()=>r});var r={ENVIRAONMENT_NOT_COMPATIBLE:10000001,ENVIRAONMENT_NOT_FAST:10000006,WEBGL_CONTEXT_LOST:10000002,RENDER_SLOW:10000003,INPUT_ERROR:10000005,PRELOAD_EFFECT_ERROR:10000101,SET_EFFECT_ERROR:10001101,SET_FILTER_ERROR:10001102,SET_INTENSITY_ERROR:10001103,SDK_DISABLED:10001104,INVALID_EFFECT:10001105,GET_CAMERA_ERROR:10001201,MEDIA_INTERRUPT_ERROR:10001202,GET_CAMERA_NOT_ALLOWED:10001203,GET_MEDIA_NOT_FOUND:10001204,GET_MICROPHONE_NOT_ALLOWED:10001205,MEDIA_SIZE_ERROR:10001206,EFFECT_LOAD_ERROR:10003001,CORE_LOAD_ERROR:10003002,AUTH_NEED_RELOAD_PAGE:10004001,AUTH_LICENSEKEY_MISS:20002001,AUTH_APPID_MISS:20002001,AUTH_FAIL:20001001,REQUEST_FAIL:20001002,AUTH_API_FAIL:20001003,SIGNATURE_TIMEOUT:20001004,AUTHORIZE_TIMEOUT:20001005,START_REACORD_FAIL:30000001,STOP_REACORD_FAIL:30000002,READ_FILE_CACHE_FAIL:30000003,REQUEST_FILE_FAIL:30000004,UNCAUGHT_ERROR:4e7,SDK_VERSION_LOW_ERROR:40000001,SEGMENTATION_NOT_AVAILABLE:40000002,INPUT_NODE_RESIZE:50000001,RESIZE_EFFECT_LOST:50000002}},6878:(t,e,n)=>{n.d(e,{E5:()=>o,Nd:()=>r,Q4:()=>i,SZ:()=>a});var r,i=function(){function t(){this._events={}}return t.prototype.clear=function(){this._events={}},t.prototype.on=function(t,e){return this._events[t]||(this._events[t]=[]),this._events[t].push(e)-1},t.prototype.trigger=function(t,e,n){var r=this;if(void 0===n&&(n=!1),"error"!==t){var i=this._events[t];i&&i.length&&i.forEach((function(t){t(e)}))}else setTimeout((function(n){var i=r._events[t];i&&i.length&&i.forEach((function(t){t(e)}))}),100)},t.prototype.off=function(t,e,n){var r=this._events[t];if(r&&r.length)if(void 0!==n)r.splice(n,1);else{var i=r.findIndex((function(t){return t===e}));i>-1&&r.splice(i,1)}},t.prototype.once=function(t,e){var n,r=this;this._events[t]||(this._events[t]=[]);var i=function(o){e(o),r.off(t,i,n)};n=this.on(t,i)},t}(),o=function(){return r||(r=new i),r},a=function(){r=null}},6109:(t,e,n)=>{n.d(e,{D4:()=>l,bH:()=>u,b_:()=>c,jl:()=>s,kg:()=>a});var r=n(5901),i=n.n(r);i().useDefaults(),i().setLevel(i().INFO);var o=new Set,a=i();function s(t){return o.add(t),i().get(t)}var c=s("set-effect"),l=s("resource-load"),u=s("debug");s("gl-pipeline")},1347:(t,e,n)=>{function r(t,e){t.z=t.z||0,e.z=e.z||0;var n=Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2)+Math.pow(t.z-e.z,2);return Math.pow(n,.5)}n.d(e,{Sp:()=>r})},201:(t,e,n)=>{n.d(e,{u:()=>r});QualityManager.instance.gpu_detector.level;var r=function(){return 1}},8586:(t,e,n)=>{n.d(e,{e:()=>i});var r=Symbol(),i=function(t){return new Proxy(t,{construct:function(t,e,n){return t.prototype!==n.prototype?Reflect.construct(t,e,n):(t[r]||(t[r]=Reflect.construct(t,e,n)),t[r])}})}},617:(t,e,n)=>{n.d(e,{M:()=>N});var r={};n.r(r),n.d(r,{FC:()=>l,CV:()=>s,rp:()=>c,HN:()=>C,X2:()=>g,Ej:()=>w,Nj:()=>f,Bb:()=>d,dE:()=>u,oC:()=>x,MX:()=>b,aj:()=>y,G4:()=>v,m1:()=>_,sP:()=>o,dO:()=>a,bb:()=>m,Ed:()=>p,he:()=>h,aV:()=>E,AE:()=>S,aW:()=>O,zk:()=>R,Op:()=>P,Cg:()=>T,Fx:()=>k,mw:()=>i});const i={au:"/r",ti:"/m",ef:"/t",ae:"/c"},o=[61,62,76,63,58,59,75,60],a=[42,71,70,69,68,41,40,39,38],s=[52,57,73,56,55,54,72,53],c=[33,64,65,66,67,34,35,36,37],l=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,121,122,118,116,115,114,110,111,112,113,117,120,119],u=[84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,106,107,108,109],h=[474,475,476,477],d=[469,470,471,472],f=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15],p=[332,284,251,389,356,454,323,361,288,397,365,379,378],g=[52,57,73,56,55,54,72,53],m=[61,62,76,63,58,59,75,60],y=[80,82,47,48,49,50,51,81,83],v=[43,44,45,46],_=[[{y:120,x:0},{y:112,x:112},110,{y:115,x:115},{y:122,x:32}],[{y:110,x:122},{y:121,x:121},{y:28,x:32},{y:24,x:25},{y:16,x:21}],[{y:19,x:21},16,{y:13,x:11}],[{y:110,x:120},{y:119,x:119},{y:4,x:0},{y:8,x:7},{y:16,x:11}]],b=[96,106,97,98,99,108,100],x=[96,107,103,102,101,109,100],w=[52,53,72,54,55],C=[52,57,73,56,55],T={contour_left1:0,contour_left2:0,contour_left3:0,contour_left4:2,contour_left5:0,contour_left6:0,contour_left7:0,contour_left8:0,contour_left9:9,contour_left10:9,contour_left11:0,contour_left12:0,contour_right1:0,contour_right2:0,contour_right3:0,contour_right4:30,contour_right5:0,contour_right6:0,contour_right7:0,contour_right8:0,contour_right9:23,contour_right10:23,contour_right11:0,contour_right12:0,contour_left_limit_point:0,contour_right_limit_point:0,contour_chin:16,mouth_lower_lip_bottom:43,left_eye_left_corner:52,left_eye_right_corner:55,left_eye_top:72,left_eye_bottom:73,left_eye_center:74,right_eye_left_corner:58,right_eye_right_corner:61,right_eye_top:75,right_eye_bottom:76,right_eye_center:77,nose_bridge1:0,nose_bridge2:0,nose_bridge3:0,nose_bridge4:43,nose_bridge5:44,nose_bridge6:45,nose_bridge7:46,nose_tip:47,nose_left1:82,nose_left2:48,nose_right1:83,nose_right2:50,nose_tip1:46,nose_bottom:49,lip_top_left:84,lip_top_left_target:57,lip_top_right:90,lip_top_right_target:24,lip_top_center:87,lip_top_center_target:49,lip_bottom_left:94,lip_bottom_left_target:13,lip_bottom_right:92,lip_bottom_right_target:18,lip_bottom_center:93,lip_bottom_center_target:16,lip_inner_top:98,lip_inner_bottom:102,forehead_top_center:10,eyebrow_center:43,forehead_left:113,left_eyebrow_center:35,forehead_right:116,right_eyebrow_center:40,chin_left:13,chin_right:19},S=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122],k=[43,44,79,43,78,44,44,58,79,80,45,44,44,81,58,58,59,79,79,68,43,81,63,58,58,63,59,78,55,44,59,68,79,67,54,78,78,54,55,45,81,44,67,78,43,63,105,59,59,69,68,77,105,63,76,77,63,37,67,43,60,75,105,105,75,59,81,76,63,54,56,55,55,80,44,69,38,68,68,38,43,56,80,55,45,46,81,80,46,45,70,69,75,75,69,59,38,37,43,72,104,54,54,104,56,56,73,80,72,54,66,104,74,56,66,54,67,104,53,74,76,62,77,77,60,105,28,62,76,62,60,77,57,73,74,74,73,56,51,83,81,81,83,76,37,66,67,70,39,69,69,39,38,111,36,37,73,82,80,80,48,46,50,51,81,50,81,46,49,50,46,60,70,75,71,70,60,110,37,38,37,36,66,53,104,72,53,57,74,47,48,80,30,61,62,62,61,60,48,49,46,82,47,80,53,72,65,73,4,82,65,72,66,36,65,66,53,52,57,70,40,39,112,35,36,41,40,70,64,52,53,84,47,82,61,71,60,36,35,65,65,64,53,110,38,114,86,49,48,87,88,49,49,88,50,50,89,51,85,48,47,85,86,48,85,84,96,86,87,49,71,41,70,108,89,99,88,89,50,51,90,83,29,30,62,34,64,65,86,98,87,99,89,88,106,85,96,32,42,61,61,42,71,71,42,41,99,98,101,89,90,51,99,88,98,99,109,108,108,100,89,98,88,87,99,101,109,35,34,65,64,33,52,109,100,108,100,90,89,102,98,103,97,98,86,98,102,101,85,97,86,107,103,97,97,103,98,85,47,84,85,106,97,96,107,106,106,107,97,114,39,115,114,38,39,35,113,34,115,40,116,115,39,40,84,82,7,4,73,57,34,33,64,52,2,57,116,40,41,109,91,100,100,91,90,101,91,109,92,91,101,92,101,102,110,111,37,120,119,33,29,62,28,28,76,83,30,31,61,27,83,26,27,28,83,107,95,103,103,94,102,96,95,107,84,95,96,111,112,36,31,32,61,42,122,41,32,121,42,93,92,102,118,116,41,115,127,114,26,83,25,95,94,103,94,93,102,121,122,42,129,122,121,1,2,52,2,3,57,84,11,95,0,1,52,3,4,57,25,83,90,25,90,24,117,113,123,112,113,35,33,0,52,119,0,33,120,33,34,4,5,82,122,118,41,117,120,34,119,137,0,24,90,23,5,6,82,95,12,94,113,117,34,23,90,22,6,7,82,22,90,21,90,91,21,7,8,84,21,91,20,8,9,84,94,15,93,9,10,84,20,91,19,91,92,19,10,11,84,19,92,18,11,12,95,18,92,17,12,13,94,17,92,93,13,14,94,16,17,93,14,15,94,15,16,93,31,129,32,32,129,121,122,128,118,130,129,31,130,31,30,130,30,29,130,29,28,130,28,27,130,27,131,27,26,131,26,25,131,131,24,132,131,25,24,24,23,132,23,22,132,136,137,120,120,137,119,0,137,1,1,138,2,2,138,3,3,138,4,4,138,5,5,139,6,6,139,7,7,139,8,8,140,9,132,21,133,132,22,21,21,20,133,137,138,1,9,140,10,10,140,11,11,135,12,138,139,5,12,135,13,13,135,14,129,128,122,118,127,116,116,127,115,114,126,110,133,20,19,133,19,18,133,18,17,123,136,117,117,136,120,123,113,112,123,112,111,134,17,16,134,133,17,134,16,15,135,15,14,139,140,8,140,135,11,128,127,118,124,123,111,135,134,15,124,111,110,127,126,114,126,125,110,125,124,110],E=[.488189826866528,.46679085,.488189826866528,.50658295,.516143625,.471960025,.488189826866528,.46679085,.4599979375,.4717894375,.488189826866528,.50658295,.488189826866528,.50658295,.5447991249999999,.48110985,.516143625,.471960025,.4410622,.565803525,.488189826866528,.5462991,.488189826866528,.50658295,.488189826866528,.50658295,.5369319124999999,.5654357875,.5447991249999999,.48110985,.5447991249999999,.48110985,.5602547125,.46035325,.516143625,.471960025,.516143625,.471960025,.542807575,.42128374999999996,.488189826866528,.46679085,.5369319124999999,.5654357875,.568110275,.48251628750000003,.5447991249999999,.48110985,.5447991249999999,.48110985,.568110275,.48251628750000003,.5602547125,.46035325,.4599979375,.4717894375,.42883299999999996,.48068869999999997,.488189826866528,.50658295,.5602547125,.46035325,.542807575,.42128374999999996,.516143625,.471960025,.434630275,.421406325,.4135695,.4596802125,.4599979375,.4717894375,.4599979375,.4717894375,.4135695,.4596802125,.42883299999999996,.48068869999999997,.488189826866528,.5462991,.5369319124999999,.5654357875,.488189826866528,.50658295,.434630275,.421406325,.4599979375,.4717894375,.488189826866528,.46679085,.568110275,.48251628750000003,.5865549125,.4657776625,.5602547125,.46035325,.5602547125,.46035325,.57607715,.4146392875,.542807575,.42128374999999996,.588454125,.46861568750000004,.5865549125,.4657776625,.568110275,.48251628750000003,.5915551,.4831601,.588454125,.46861568750000004,.568110275,.48251628750000003,.4365127125,.40153225,.434630275,.421406325,.488189826866528,.46679085,.6097423125,.4507424125,.5838801625,.449976875,.5865549125,.4657776625,.5865549125,.4657776625,.5838801625,.449976875,.5602547125,.46035325,.5369319124999999,.5654357875,.5915551,.4831601,.568110275,.48251628750000003,.4135695,.4596802125,.40557155,.48211937499999996,.42883299999999996,.48068869999999997,.42883299999999996,.48068869999999997,.4410622,.565803525,.488189826866528,.50658295,.57607715,.4146392875,.5406618125,.40061935,.542807575,.42128374999999996,.542807575,.42128374999999996,.5406618125,.40061935,.488189826866528,.46679085,.40557155,.48211937499999996,.4410622,.565803525,.42883299999999996,.48068869999999997,.488189826866528,.5462991,.488189826866528,.58580675,.5369319124999999,.5654357875,.4410622,.565803525,.488189826866528,.58580675,.488189826866528,.5462991,.60990175,.4109925,.57607715,.4146392875,.5838801625,.449976875,.5838801625,.449976875,.57607715,.4146392875,.5602547125,.46035325,.5406618125,.40061935,.4365127125,.40153225,.488189826866528,.46679085,.38991549999999997,.4494414125,.3875146875,.465458025,.4135695,.4596802125,.4135695,.4596802125,.3875146875,.465458025,.40557155,.48211937499999996,.40557155,.48211937499999996,.38226482500000003,.4827557,.4410622,.565803525,.38991549999999997,.4494414125,.4135695,.4596802125,.4020055,.415060875,.3875146875,.465458025,.385898325,.46785316250000003,.40557155,.48211937499999996,.4020055,.415060875,.4135695,.4596802125,.434630275,.421406325,.3875146875,.465458025,.3640840875,.45055124999999996,.385898325,.46785316250000003,.5915551,.4831601,.6139756,.476639975,.588454125,.46861568750000004,.588454125,.46861568750000004,.6097423125,.4507424125,.5865549125,.4657776625,.6986649375,.5627347125,.6139756,.476639975,.5915551,.4831601,.6139756,.476639975,.6097423125,.4507424125,.588454125,.46861568750000004,.3599488125,.47632687500000004,.38226482500000003,.4827557,.385898325,.46785316250000003,.385898325,.46785316250000003,.38226482500000003,.4827557,.40557155,.48211937499999996,.537402425,.6126665875,.5512806,.592975125,.5369319124999999,.5654357875,.5369319124999999,.5654357875,.5512806,.592975125,.5915551,.4831601,.4365127125,.40153225,.4020055,.415060875,.434630275,.421406325,.60990175,.4109925,.5750593125000001,.39081712500000004,.57607715,.4146392875,.57607715,.4146392875,.5750593125000001,.39081712500000004,.5406618125,.40061935,.4196925125,.2953909749999999,.4028723125,.3915063125,.4365127125,.40153225,.38226482500000003,.4827557,.427124375,.59353005,.4410622,.565803525,.4410622,.565803525,.46482735,.617807575,.488189826866528,.58580675,.5135869249999999,.617646025,.537402425,.6126665875,.5369319124999999,.5654357875,.5135869249999999,.617646025,.5369319124999999,.5654357875,.488189826866528,.58580675,.488189826866528,.622551,.5135869249999999,.617646025,.488189826866528,.58580675,.6097423125,.4507424125,.60990175,.4109925,.5838801625,.449976875,.64358425,.412451125,.60990175,.4109925,.6097423125,.4507424125,.488189826866528,.2883909749999999,.4365127125,.40153225,.5406618125,.40061935,.4365127125,.40153225,.4028723125,.3915063125,.4020055,.415060875,.3640840875,.45055124999999996,.3875146875,.465458025,.38991549999999997,.4494414125,.3640840875,.45055124999999996,.3599488125,.47632687500000004,.385898325,.46785316250000003,.44135155,.61300865,.46482735,.617807575,.4410622,.565803525,.7079557,.5055197499999999,.6325640875,.46274605,.6139756,.476639975,.6139756,.476639975,.6325640875,.46274605,.6097423125,.4507424125,.46482735,.617807575,.488189826866528,.622551,.488189826866528,.58580675,.427124375,.59353005,.44135155,.61300865,.4410622,.565803525,.3640840875,.45055124999999996,.38991549999999997,.4494414125,.368784175,.41131387500000005,.38226482500000003,.4827557,.282695775,.5610828375,.427124375,.59353005,.368784175,.41131387500000005,.38991549999999997,.4494414125,.4020055,.415060875,.4028723125,.3915063125,.368784175,.41131387500000005,.4020055,.415060875,.3640840875,.45055124999999996,.3412266875,.462774925,.3599488125,.47632687500000004,.60990175,.4109925,.6109665,.3861959125,.5750593125000001,.39081712500000004,.38542595,.3023909749999999,.3679795875,.3866262,.4028723125,.3915063125,.6464699500000001,.39127456250000003,.6109665,.3861959125,.60990175,.4109925,.33567349999999996,.4124759625,.3412266875,.462774925,.3640840875,.45055124999999996,.40563065000000004,.66605925,.44135155,.61300865,.427124375,.59353005,.6325640875,.46274605,.64358425,.412451125,.6097423125,.4507424125,.4028723125,.3915063125,.3679795875,.3866262,.368784175,.41131387500000005,.368784175,.41131387500000005,.33567349999999996,.4124759625,.3640840875,.45055124999999996,.488189826866528,.2883909749999999,.5406618125,.40061935,.5578605625,.2953909749999999,.467591,.6554576874999999,.488189826866528,.622551,.46482735,.617807575,.488189826866528,.660130075,.505873625,.6556971749999999,.488189826866528,.622551,.488189826866528,.622551,.505873625,.6556971749999999,.5135869249999999,.617646025,.5135869249999999,.617646025,.537864,.66081345,.537402425,.6126665875,.436492575,.659831,.46482735,.617807575,.44135155,.61300865,.436492575,.659831,.467591,.6554576874999999,.46482735,.617807575,.436492575,.659831,.40563065000000004,.66605925,.4149069625,.6694827499999999,.467591,.6554576874999999,.488189826866528,.660130075,.488189826866528,.622551,.64358425,.412451125,.6464699500000001,.39127456250000003,.60990175,.4109925,.54207058125,.6724125624999999,.537864,.66081345,.523628625,.6757999375,.505873625,.6556971749999999,.537864,.66081345,.5135869249999999,.617646025,.537402425,.6126665875,.5699740624999999,.665637625,.5512806,.592975125,.7040264999999999,.5342099,.7079557,.5055197499999999,.6139756,.476639975,.33314059999999995,.3906893125,.33567349999999996,.4124759625,.368784175,.41131387500000005,.467591,.6554576874999999,.488189826866528,.679725375,.488189826866528,.660130075,.523628625,.6757999375,.537864,.66081345,.505873625,.6556971749999999,.43286249374999997,.6727749375,.436492575,.659831,.4149069625,.6694827499999999,.7120584999999999,.4479282,.67428775,.41762,.6325640875,.46274605,.6325640875,.46274605,.67428775,.41762,.64358425,.412451125,.64358425,.412451125,.67428775,.41762,.6464699500000001,.39127456250000003,0,0,0,0,0,0,.537864,.66081345,.5699740624999999,.665637625,.537402425,.6126665875,.523628625,.6757999375,.505873625,.6556971749999999,.488189826866528,.679725375,0,0,0,0,0,0,.54207058125,.6724125624999999,.5605125375,.6690251875,.537864,.66081345,.488189826866528,.679725375,.505873625,.6556971749999999,.488189826866528,.660130075,0,0,0,0,0,0,.3679795875,.3866262,.33314059999999995,.3906893125,.368784175,.41131387500000005,.33567349999999996,.4124759625,.305216575,.4170092,.3412266875,.462774925,0,0,0,0,0,0,.5605125375,.6690251875,.5699740624999999,.665637625,.537864,.66081345,0,0,0,0,0,0,.450818025,.676067125,.488189826866528,.679725375,.467591,.6554576874999999,0,0,0,0,0,0,.436492575,.659831,.450818025,.676067125,.467591,.6554576874999999,0,0,0,0,0,0,0,0,0,0,0,0,.436492575,.659831,.44135155,.61300865,.40563065000000004,.66605925,.436492575,.659831,.43286249374999997,.6727749375,.450818025,.676067125,0,0,0,0,0,0,0,0,0,0,0,0,.5578605625,.2953909749999999,.5750593125000001,.39081712500000004,.59301290625,.3023909749999999,.5578605625,.2953909749999999,.5406618125,.40061935,.5750593125000001,.39081712500000004,.3679795875,.3866262,.35056009374999997,.3093909749999999,.33314059999999995,.3906893125,.59301290625,.3023909749999999,.6109665,.3861959125,.6287182250000001,.3093909749999999,.59301290625,.3023909749999999,.5750593125000001,.39081712500000004,.6109665,.3861959125,.40563065000000004,.66605925,.427124375,.59353005,.3030863625,.64445225,.282695775,.5610828375,.38226482500000003,.4827557,.3599488125,.47632687500000004,.33314059999999995,.3906893125,.305216575,.4170092,.33567349999999996,.4124759625,.3412266875,.462774925,.2733915,.50383525,.3599488125,.47632687500000004,.6287182250000001,.3093909749999999,.6109665,.3861959125,.6464699500000001,.39127456250000003,.54208226875,.67264515625,.5469159375,.6879962500000001,.5605125375,.6690251875,.5605125375,.6690251875,.5469159375,.6879962500000001,.5699740624999999,.665637625,.523652,.676265125,.5469159375,.6879962500000001,.54208226875,.67264515625,.5189354375,.7045858749999999,.5469159375,.6879962500000001,.523652,.676265125,.5189354375,.7045858749999999,.523652,.676265125,.488189826866528,.6814735375,.488189826866528,.2883909749999999,.4196925125,.2953909749999999,.4365127125,.40153225,.28182385833333334,.3866262,.27597567916666665,.4170092,.305216575,.4170092,.7040264999999999,.5342099,.6139756,.476639975,.6986649375,.5627347125,.6986649375,.5627347125,.5915551,.4831601,.5512806,.592975125,.7079557,.5055197499999999,.71060725,.476442525,.6325640875,.46274605,.692903125,.5908523999999999,.5512806,.592975125,.6857991250000001,.618673825,.692903125,.5908523999999999,.6986649375,.5627347125,.5512806,.592975125,.43282999375,.673484,.42734125,.6891803,.450753025,.67748525,.450753025,.67748525,.4548121625,.7055647999999999,.488189826866528,.6814735375,.4149069625,.6694827499999999,.42734125,.6891803,.43282999375,.673484,.40563065000000004,.66605925,.42734125,.6891803,.4149069625,.6694827499999999,.4196925125,.2953909749999999,.38542595,.3023909749999999,.4028723125,.3915063125,.71060725,.476442525,.7120584999999999,.4479282,.6325640875,.46274605,.67428775,.41762,.6994682499999999,.3861959125,.6464699500000001,.39127456250000003,.7120584999999999,.4479282,.705763375,.41762,.67428775,.41762,.488189826866528,.7103383750000001,.5189354375,.7045858749999999,.488189826866528,.6814735375,.67428775,.33039097499999986,.6287182250000001,.3093909749999999,.6464699500000001,.39127456250000003,.59301290625,.3023909749999999,.7120584999999999,.13003558749999994,.5578605625,.2953909749999999,.6857991250000001,.618673825,.5512806,.592975125,.6774095,.6461884999999999,.42734125,.6891803,.4548121625,.7055647999999999,.450753025,.67748525,.4548121625,.7055647999999999,.488189826866528,.7103383750000001,.488189826866528,.6814735375,.705763375,.41762,.6994682499999999,.3861959125,.67428775,.41762,.8383426749999999,.41762,.6994682499999999,.3861959125,.705763375,.41762,.2711788125,.475080675,.2733915,.50383525,.3412266875,.462774925,.2733915,.50383525,.27736215000000003,.53252975,.3599488125,.47632687500000004,.40563065000000004,.66605925,.364313,.738966,.42734125,.6891803,.2701275,.446433525,.2711788125,.475080675,.3412266875,.462774925,.27736215000000003,.53252975,.282695775,.5610828375,.3599488125,.47632687500000004,.6774095,.6461884999999999,.5512806,.592975125,.5699740624999999,.665637625,.6774095,.6461884999999999,.5699740624999999,.665637625,.66662155,.6725830875,.305216575,.33039097499999986,.35056009374999997,.3093909749999999,.2701275,.1304658749999999,.38542595,.3023909749999999,.35056009374999997,.3093909749999999,.3679795875,.3866262,.305216575,.4170092,.2701275,.446433525,.3412266875,.462774925,.27597567916666665,.4170092,.2701275,.446433525,.305216575,.4170092,.28182385833333334,.3866262,.305216575,.4170092,.33314059999999995,.3906893125,.282695775,.5610828375,.28838671250000003,.58901565,.427124375,.59353005,.6994682499999999,.3861959125,.67428775,.33039097499999986,.6464699500000001,.39127456250000003,.305216575,.33039097499999986,.28182385833333334,.3866262,.33314059999999995,.3906893125,.27597567916666665,.4170092,.1433963791666667,.4170092,.2701275,.446433525,.66662155,.6725830875,.5699740624999999,.665637625,.652230375,.6970854125,.28838671250000003,.58901565,.29503317500000004,.6170379625,.427124375,.59353005,.42734125,.6891803,.38528327500000004,.7581624625000001,.4548121625,.7055647999999999,.35056009374999997,.3093909749999999,.305216575,.33039097499999986,.33314059999999995,.3906893125,.652230375,.6970854125,.5699740624999999,.665637625,.6349819999999999,.719920125,.29503317500000004,.6170379625,.3030863625,.64445225,.427124375,.59353005,.6349819999999999,.719920125,.5699740624999999,.665637625,.615452575,.7405493125,.5699740624999999,.665637625,.5469159375,.6879962500000001,.615452575,.7405493125,.3030863625,.64445225,.3134811625,.6709578,.40563065000000004,.66605925,.615452575,.7405493125,.5469159375,.6879962500000001,.5944185000000001,.7597992000000001,.3134811625,.6709578,.327658,.6954898125,.40563065000000004,.66605925,.4548121625,.7055647999999999,.46111278749999995,.797688125,.488189826866528,.7103383750000001,.327658,.6954898125,.3447950375,.7185136249999999,.40563065000000004,.66605925,.5944185000000001,.7597992000000001,.5469159375,.6879962500000001,.57167145,.777034625,.5469159375,.6879962500000001,.5189354375,.7045858749999999,.57167145,.777034625,.3447950375,.7185136249999999,.364313,.738966,.40563065000000004,.66605925,.57167145,.777034625,.5189354375,.7045858749999999,.54608605,.79034725,.364313,.738966,.38528327500000004,.7581624625000001,.42734125,.6891803,.54608605,.79034725,.5189354375,.7045858749999999,.5180748375,.798073,.38528327500000004,.7581624625000001,.4080183375,.7756525375,.4548121625,.7055647999999999,.5180748375,.798073,.5189354375,.7045858749999999,.488189826866528,.7103383750000001,.4080183375,.7756525375,.43323218750000003,.78937325,.4548121625,.7055647999999999,.488189826866528,.800711625,.5180748375,.798073,.488189826866528,.7103383750000001,.43323218750000003,.78937325,.46111278749999995,.797688125,.4548121625,.7055647999999999,.46111278749999995,.797688125,.488189826866528,.800711625,.488189826866528,.7103383750000001,.71060725,.476442525,.8383426749999999,.41762,.7120584999999999,.4479282,.7120584999999999,.4479282,.8383426749999999,.41762,.705763375,.41762,.6994682499999999,.3861959125,.8320475499999999,.2883909749999999,.67428775,.33039097499999986,.8446377999999999,.5627347125,.8383426749999999,.41762,.71060725,.476442525,.8446377999999999,.5627347125,.71060725,.476442525,.7079557,.5055197499999999,.8446377999999999,.5627347125,.7079557,.5055197499999999,.7040264999999999,.5342099,.8446377999999999,.5627347125,.7040264999999999,.5342099,.6986649375,.5627347125,.8446377999999999,.5627347125,.6986649375,.5627347125,.692903125,.5908523999999999,.8446377999999999,.5627347125,.692903125,.5908523999999999,.8099888,.6725830875,.692903125,.5908523999999999,.6857991250000001,.618673825,.8099888,.6725830875,.6857991250000001,.618673825,.6774095,.6461884999999999,.8099888,.6725830875,.8099888,.6725830875,.66662155,.6725830875,.7480318749999999,.800711625,.8099888,.6725830875,.6774095,.6461884999999999,.66662155,.6725830875,.66662155,.6725830875,.652230375,.6970854125,.7480318749999999,.800711625,.652230375,.6970854125,.6349819999999999,.719920125,.7480318749999999,.800711625,.1492445583333334,.2883909749999999,.1433963791666667,.4170092,.28182385833333334,.3866262,.28182385833333334,.3866262,.1433963791666667,.4170092,.27597567916666665,.4170092,.2701275,.446433525,.1433963791666667,.4170092,.2711788125,.475080675,.2711788125,.475080675,.13754820000000006,.5610828375,.2733915,.50383525,.2733915,.50383525,.13754820000000006,.5610828375,.27736215000000003,.53252975,.27736215000000003,.53252975,.13754820000000006,.5610828375,.282695775,.5610828375,.282695775,.5610828375,.13754820000000006,.5610828375,.28838671250000003,.58901565,.28838671250000003,.58901565,.17050706250000003,.6709578,.29503317500000004,.6170379625,.29503317500000004,.6170379625,.17050706250000003,.6709578,.3030863625,.64445225,.3030863625,.64445225,.17050706250000003,.6709578,.3134811625,.6709578,.3134811625,.6709578,.23173370000000004,.800711625,.327658,.6954898125,.7480318749999999,.800711625,.615452575,.7405493125,.615452575,.879498755,.7480318749999999,.800711625,.6349819999999999,.719920125,.615452575,.7405493125,.615452575,.7405493125,.5944185000000001,.7597992000000001,.615452575,.879498755,.1433963791666667,.4170092,.13754820000000006,.5610828375,.2711788125,.475080675,.327658,.6954898125,.23173370000000004,.800711625,.3447950375,.7185136249999999,.3447950375,.7185136249999999,.23173370000000004,.800711625,.364313,.738966,.364313,.738966,.364313,.8781166675000001,.38528327500000004,.7581624625000001,.13754820000000006,.5610828375,.17050706250000003,.6709578,.28838671250000003,.58901565,.38528327500000004,.7581624625000001,.364313,.8781166675000001,.4080183375,.7756525375,.4080183375,.7756525375,.364313,.8781166675000001,.43323218750000003,.78937325,.8383426749999999,.41762,.8320475499999999,.2883909749999999,.6994682499999999,.3861959125,.67428775,.33039097499999986,.7120584999999999,.13003558749999994,.6287182250000001,.3093909749999999,.6287182250000001,.3093909749999999,.7120584999999999,.13003558749999994,.59301290625,.3023909749999999,.5578605625,.2953909749999999,.59301290625,.04623064999999982,.488189826866528,.2883909749999999,.615452575,.879498755,.5944185000000001,.7597992000000001,.57167145,.777034625,.615452575,.879498755,.57167145,.777034625,.54608605,.79034725,.615452575,.879498755,.54608605,.79034725,.5180748375,.798073,.2701275,.1304658749999999,.1492445583333334,.2883909749999999,.305216575,.33039097499999986,.305216575,.33039097499999986,.1492445583333334,.2883909749999999,.28182385833333334,.3866262,.2701275,.1304658749999999,.35056009374999997,.3093909749999999,.38542595,.3023909749999999,.2701275,.1304658749999999,.38542595,.3023909749999999,.4196925125,.2953909749999999,.4895560875,.9031757550000001,.5180748375,.798073,.488189826866528,.800711625,.4895560875,.9031757550000001,.615452575,.879498755,.5180748375,.798073,.4895560875,.9031757550000001,.488189826866528,.800711625,.46111278749999995,.797688125,.364313,.8781166675000001,.46111278749999995,.797688125,.43323218750000003,.78937325,.17050706250000003,.6709578,.23173370000000004,.800711625,.3134811625,.6709578,.23173370000000004,.800711625,.364313,.8781166675000001,.364313,.738966,.8320475499999999,.2883909749999999,.7120584999999999,.13003558749999994,.67428775,.33039097499999986,.38542595,.04623064999999982,.2701275,.1304658749999999,.4196925125,.2953909749999999,.364313,.8781166675000001,.4895560875,.9031757550000001,.46111278749999995,.797688125,.38542595,.04623064999999982,.4196925125,.2953909749999999,.488189826866528,.2883909749999999,.7120584999999999,.13003558749999994,.59301290625,.04623064999999982,.5578605625,.2953909749999999,.59301290625,.04623064999999982,.488446575,.032230649999999805,.488189826866528,.2883909749999999,.488446575,.032230649999999805,.38542595,.04623064999999982,.488189826866528,.2883909749999999],P=[-.08,-.05,-.03,0,0,.01,.015,.01,.01,-.01,-.03,-.05,-.06],R=[18,14,19,14,13,19,14,2,13,14,3,2,20,21,13,13,21,19,1,20,13,11,10,19,19,10,18,2,1,13,21,11,19,12,11,21,3,4,2,14,4,3,15,4,14,10,9,18,17,15,14,17,14,18,8,17,18,1,12,20,20,12,21,9,8,18,1,0,12,12,0,11,23,15,17,22,5,15,15,5,4,7,23,17,23,22,15,8,7,17,23,16,22,7,16,23,22,16,5,7,6,16,16,6,5],O=[.4994956625,.614281425,.49966255,.60233525,.46424221250000003,.6089815000000001,.49966255,.60233525,.465096475,.5992760874999999,.46424221250000003,.6089815000000001,.49966255,.60233525,.4818877,.5826464124999999,.465096475,.5992760874999999,.49966255,.60233525,.49910775,.5864197875,.4818877,.5826464124999999,.4479978375,.5976933312499999,.44757070625,.6025460375,.465096475,.5992760874999999,.465096475,.5992760874999999,.44757070625,.6025460375,.46424221250000003,.6089815000000001,.451843375,.5873581250000001,.4479978375,.5976933312499999,.465096475,.5992760874999999,.44207625,.6199760875,.46743702499999995,.6409725000000001,.46424221250000003,.6089815000000001,.46424221250000003,.6089815000000001,.46743702499999995,.6409725000000001,.4994956625,.614281425,.4818877,.5826464124999999,.451843375,.5873581250000001,.465096475,.5992760874999999,.44757070625,.6025460375,.44207625,.6199760875,.46424221250000003,.6089815000000001,.4308992,.596110575,.44207625,.6199760875,.44757070625,.6025460375,.49910775,.5864197875,.5163774999999999,.5825469625,.4818877,.5826464124999999,.49966255,.60233525,.5163774999999999,.5825469625,.49910775,.5864197875,.5342254625,.5992902,.5163774999999999,.5825469625,.49966255,.60233525,.46743702499999995,.6409725000000001,.4997823375,.64841675,.4994956625,.614281425,.535219575,.609022,.5342254625,.5992902,.49966255,.60233525,.535219575,.609022,.49966255,.60233525,.4994956625,.614281425,.53258415,.64137075,.535219575,.609022,.4994956625,.614281425,.451843375,.5873581250000001,.4308992,.596110575,.4479978375,.5976933312499999,.4479978375,.5976933312499999,.4308992,.596110575,.44757070625,.6025460375,.4997823375,.64841675,.53258415,.64137075,.4994956625,.614281425,.451843375,.5873581250000001,.422608125,.5931778375,.4308992,.596110575,.4308992,.596110575,.422608125,.5931778375,.44207625,.6199760875,.5518993,.60231035625,.5342254625,.5992902,.535219575,.609022,.55140224375,.59744445625,.546885375,.5874255749999999,.5342254625,.5992902,.5342254625,.5992902,.546885375,.5874255749999999,.5163774999999999,.5825469625,.5581709625,.620002975,.5518993,.60231035625,.535219575,.609022,.5518993,.60231035625,.55140224375,.59744445625,.5342254625,.5992902,.53258415,.64137075,.5581709625,.620002975,.535219575,.609022,.5518993,.60231035625,.568579025,.5955987125,.55140224375,.59744445625,.5581709625,.620002975,.568579025,.5955987125,.5518993,.60231035625,.55140224375,.59744445625,.568579025,.5955987125,.546885375,.5874255749999999,.5581709625,.620002975,.576995375,.5925833125,.568579025,.5955987125,.568579025,.5955987125,.576995375,.5925833125,.546885375,.5874255749999999];var D=n(401),A=n(8586),I=function(t,e,n,r){var i,o=arguments.length,a=o<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,n,r);else for(var s=t.length-1;s>=0;s--)(i=t[s])&&(a=(o<3?i(a):o>3?i(e,n,a):i(e,n))||a);return o>3&&a&&Object.defineProperty(e,n,a),a},F=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function a(t){try{c(r.next(t))}catch(t){o(t)}}function s(t){try{c(r.throw(t))}catch(t){o(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(a,s)}c((r=r.apply(t,e||[])).next())}))},L=function(t,e){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=a.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=e.call(t,a)}catch(t){o=[6,t],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}},M=function(t){var e="function"==typeof Symbol&&Symbol.iterator,n=e&&t[e],r=0;if(n)return n.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&r>=t.length&&(t=void 0),{value:t&&t[r++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")};var N=function(){function t(){}return t.prototype.load=function(){return F(this,void 0,void 0,(function(){return L(this,(function(t){return[2,Promise.resolve()]}))}))},t.prototype.getDataConfig=function(t){return function(t){switch(t){case 0:return o;case 1:return a;case 2:return s;case 3:return c;case 4:return l;case 5:return u;case 6:return h;case 7:return d;case 8:return f;case 9:return r.LEFT_FACE_OVAL2;case 10:return r.LEFT_FACE_OVAL3;case 11:return p;case 12:return r.RIGHT_FACE_OVAL2;case 13:return r.RIGHT_FACE_OVAL3;case 14:return g;case 15:return m;case 16:return y;case 17:return v;case 18:return _;case 19:return b;case 20:return x;case 21:return w;case 22:return C;case 23:return T;case 24:return S;case 25:return k;case 26:return E;case 27:return P;case 28:return R;case 29:return O;case 30:return i;default:return""}}(t)},t.prototype.getConfigByKeys=function(t){var e,n,r={};try{for(var i=M(t),o=i.next();!o.done;o=i.next()){var a=o.value,s=D.c4[a];r[a]=this.getDataConfig(s)}}catch(t){e={error:t}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(e)throw e.error}}return r},t=I([A.e],t)}()},4809:(t,e,n)=>{var r=n(7872),i=Uint8Array,o=Uint16Array,a=Uint32Array,s=new i([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),c=new i([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),l=new i([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),u=function(t,e){for(var n=new o(31),r=0;r<31;++r)n[r]=e+=1<<t[r-1];var i=new a(n[30]);for(r=1;r<30;++r)for(var s=n[r];s<n[r+1];++s)i[s]=s-n[r]<<5|r;return[n,i]},h=u(s,2),d=h[0],f=h[1];d[28]=258,f[258]=28;for(var p=u(c,0),g=p[0],m=p[1],y=new o(32768),v=0;v<32768;++v){var _=(43690&v)>>>1|(21845&v)<<1;_=(61680&(_=(52428&_)>>>2|(13107&_)<<2))>>>4|(3855&_)<<4,y[v]=((65280&_)>>>8|(255&_)<<8)>>>1}var b=function(t,e,n){for(var r=t.length,i=0,a=new o(e);i<r;++i)++a[t[i]-1];var s,c=new o(e);for(i=0;i<e;++i)c[i]=c[i-1]+a[i-1]<<1;if(n){s=new o(1<<e);var l=15-e;for(i=0;i<r;++i)if(t[i])for(var u=i<<4|t[i],h=e-t[i],d=c[t[i]-1]++<<h,f=d|(1<<h)-1;d<=f;++d)s[y[d]>>>l]=u}else for(s=new o(r),i=0;i<r;++i)t[i]&&(s[i]=y[c[t[i]-1]++]>>>15-t[i]);return s},x=new i(288);for(v=0;v<144;++v)x[v]=8;for(v=144;v<256;++v)x[v]=9;for(v=256;v<280;++v)x[v]=7;for(v=280;v<288;++v)x[v]=8;var w=new i(32);for(v=0;v<32;++v)w[v]=5;var C=b(x,9,0),T=b(x,9,1),S=b(w,5,0),k=b(w,5,1),E=function(t){for(var e=t[0],n=1;n<t.length;++n)t[n]>e&&(e=t[n]);return e},P=function(t,e,n){var r=e/8|0;return(t[r]|t[r+1]<<8)>>(7&e)&n},R=function(t,e){var n=e/8|0;return(t[n]|t[n+1]<<8|t[n+2]<<16)>>(7&e)},O=function(t){return(t+7)/8|0},D=function(t,e,n){(null==e||e<0)&&(e=0),(null==n||n>t.length)&&(n=t.length);var r=new(t instanceof o?o:t instanceof a?a:i)(n-e);return r.set(t.subarray(e,n)),r};var A=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],I=function(t,e,n){var r=new Error(e||A[t]);if(r.code=t,Error.captureStackTrace&&Error.captureStackTrace(r,I),!n)throw r;return r},F=function(t,e,n){var r=t.length;if(!r||n&&n.f&&!n.l)return e||new i(0);var o=!e||n,a=!n||n.i;n||(n={}),e||(e=new i(3*r));var u=function(t){var n=e.length;if(t>n){var r=new i(Math.max(2*n,t));r.set(e),e=r}},h=n.f||0,f=n.p||0,p=n.b||0,m=n.l,y=n.d,v=n.m,_=n.n,x=8*r;do{if(!m){h=P(t,f,1);var w=P(t,f+1,3);if(f+=3,!w){var C=t[(W=O(f)+4)-4]|t[W-3]<<8,S=W+C;if(S>r){a&&I(0);break}o&&u(p+C),e.set(t.subarray(W,S),p),n.b=p+=C,n.p=f=8*S,n.f=h;continue}if(1==w)m=T,y=k,v=9,_=5;else if(2==w){var A=P(t,f,31)+257,F=P(t,f+10,15)+4,L=A+P(t,f+5,31)+1;f+=14;for(var M=new i(L),N=new i(19),j=0;j<F;++j)N[l[j]]=P(t,f+3*j,7);f+=3*F;var U=E(N),B=(1<<U)-1,z=b(N,U,1);for(j=0;j<L;){var W,V=z[P(t,f,B)];if(f+=15&V,(W=V>>>4)<16)M[j++]=W;else{var q=0,H=0;for(16==W?(H=3+P(t,f,3),f+=2,q=M[j-1]):17==W?(H=3+P(t,f,7),f+=3):18==W&&(H=11+P(t,f,127),f+=7);H--;)M[j++]=q}}var G=M.subarray(0,A),Y=M.subarray(A);v=E(G),_=E(Y),m=b(G,v,1),y=b(Y,_,1)}else I(1);if(f>x){a&&I(0);break}}o&&u(p+131072);for(var Z=(1<<v)-1,K=(1<<_)-1,X=f;;X=f){var $=(q=m[R(t,f)&Z])>>>4;if((f+=15&q)>x){a&&I(0);break}if(q||I(2),$<256)e[p++]=$;else{if(256==$){X=f,m=null;break}var J=$-254;if($>264){var Q=s[j=$-257];J=P(t,f,(1<<Q)-1)+d[j],f+=Q}var tt=y[R(t,f)&K],et=tt>>>4;tt||I(3),f+=15&tt;Y=g[et];if(et>3){Q=c[et];Y+=R(t,f)&(1<<Q)-1,f+=Q}if(f>x){a&&I(0);break}o&&u(p+131072);for(var nt=p+J;p<nt;p+=4)e[p]=e[p-Y],e[p+1]=e[p+1-Y],e[p+2]=e[p+2-Y],e[p+3]=e[p+3-Y];p=nt}}n.l=m,n.p=X,n.b=p,n.f=h,m&&(h=1,n.m=v,n.d=y,n.n=_)}while(!h);return p==e.length?e:D(e,0,p)},L=function(t,e,n){n<<=7&e;var r=e/8|0;t[r]|=n,t[r+1]|=n>>>8},M=function(t,e,n){n<<=7&e;var r=e/8|0;t[r]|=n,t[r+1]|=n>>>8,t[r+2]|=n>>>16},N=function(t,e){for(var n=[],r=0;r<t.length;++r)t[r]&&n.push({s:r,f:t[r]});var a=n.length,s=n.slice();if(!a)return[q,0];if(1==a){var c=new i(n[0].s+1);return c[n[0].s]=1,[c,1]}n.sort((function(t,e){return t.f-e.f})),n.push({s:-1,f:25001});var l=n[0],u=n[1],h=0,d=1,f=2;for(n[0]={s:-1,f:l.f+u.f,l,r:u};d!=a-1;)l=n[n[h].f<n[f].f?h++:f++],u=n[h!=d&&n[h].f<n[f].f?h++:f++],n[d++]={s:-1,f:l.f+u.f,l,r:u};var p=s[0].s;for(r=1;r<a;++r)s[r].s>p&&(p=s[r].s);var g=new o(p+1),m=j(n[d-1],g,0);if(m>e){r=0;var y=0,v=m-e,_=1<<v;for(s.sort((function(t,e){return g[e.s]-g[t.s]||t.f-e.f}));r<a;++r){var b=s[r].s;if(!(g[b]>e))break;y+=_-(1<<m-g[b]),g[b]=e}for(y>>>=v;y>0;){var x=s[r].s;g[x]<e?y-=1<<e-g[x]++-1:++r}for(;r>=0&&y;--r){var w=s[r].s;g[w]==e&&(--g[w],++y)}m=e}return[new i(g),m]},j=function(t,e,n){return-1==t.s?Math.max(j(t.l,e,n+1),j(t.r,e,n+1)):e[t.s]=n},U=function(t){for(var e=t.length;e&&!t[--e];);for(var n=new o(++e),r=0,i=t[0],a=1,s=function(t){n[r++]=t},c=1;c<=e;++c)if(t[c]==i&&c!=e)++a;else{if(!i&&a>2){for(;a>138;a-=138)s(32754);a>2&&(s(a>10?a-11<<5|28690:a-3<<5|12305),a=0)}else if(a>3){for(s(i),--a;a>6;a-=6)s(8304);a>2&&(s(a-3<<5|8208),a=0)}for(;a--;)s(i);a=1,i=t[c]}return[n.subarray(0,r),e]},B=function(t,e){for(var n=0,r=0;r<e.length;++r)n+=t[r]*e[r];return n},z=function(t,e,n){var r=n.length,i=O(e+2);t[i]=255&r,t[i+1]=r>>>8,t[i+2]=255^t[i],t[i+3]=255^t[i+1];for(var o=0;o<r;++o)t[i+o+4]=n[o];return 8*(i+4+r)},W=function(t,e,n,r,i,a,u,h,d,f,p){L(e,p++,n),++i[256];for(var g=N(i,15),m=g[0],y=g[1],v=N(a,15),_=v[0],T=v[1],k=U(m),E=k[0],P=k[1],R=U(_),O=R[0],D=R[1],A=new o(19),I=0;I<E.length;++I)A[31&E[I]]++;for(I=0;I<O.length;++I)A[31&O[I]]++;for(var F=N(A,7),j=F[0],W=F[1],V=19;V>4&&!j[l[V-1]];--V);var q,H,G,Y,Z=f+5<<3,K=B(i,x)+B(a,w)+u,X=B(i,m)+B(a,_)+u+14+3*V+B(A,j)+(2*A[16]+3*A[17]+7*A[18]);if(Z<=K&&Z<=X)return z(e,p,t.subarray(d,d+f));if(L(e,p,1+(X<K)),p+=2,X<K){q=b(m,y,0),H=m,G=b(_,T,0),Y=_;var $=b(j,W,0);L(e,p,P-257),L(e,p+5,D-1),L(e,p+10,V-4),p+=14;for(I=0;I<V;++I)L(e,p+3*I,j[l[I]]);p+=3*V;for(var J=[E,O],Q=0;Q<2;++Q){var tt=J[Q];for(I=0;I<tt.length;++I){var et=31&tt[I];L(e,p,$[et]),p+=j[et],et>15&&(L(e,p,tt[I]>>>5&127),p+=tt[I]>>>12)}}}else q=C,H=x,G=S,Y=w;for(I=0;I<h;++I)if(r[I]>255){et=r[I]>>>18&31;M(e,p,q[et+257]),p+=H[et+257],et>7&&(L(e,p,r[I]>>>23&31),p+=s[et]);var nt=31&r[I];M(e,p,G[nt]),p+=Y[nt],nt>3&&(M(e,p,r[I]>>>5&8191),p+=c[nt])}else M(e,p,q[r[I]]),p+=H[r[I]];return M(e,p,q[256]),p+H[256]},V=new a([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),q=new i(0),H=function(t,e,n,r,l,u){var h=t.length,d=new i(r+h+5*(1+Math.ceil(h/7e3))+l),p=d.subarray(r,d.length-l),g=0;if(!e||h<8)for(var y=0;y<=h;y+=65535){var v=y+65535;v<h?g=z(p,g,t.subarray(y,v)):(p[y]=u,g=z(p,g,t.subarray(y,h)))}else{for(var _=V[e-1],b=_>>>13,x=8191&_,w=(1<<n)-1,C=new o(32768),T=new o(w+1),S=Math.ceil(n/3),k=2*S,E=function(e){return(t[e]^t[e+1]<<S^t[e+2]<<k)&w},P=new a(25e3),R=new o(288),A=new o(32),I=0,F=0,L=(y=0,0),M=0,N=0;y<h;++y){var j=E(y),U=32767&y,B=T[j];if(C[U]=B,T[j]=U,M<=y){var H=h-y;if((I>7e3||L>24576)&&H>423){g=W(t,p,0,P,R,A,F,L,N,y-N,g),L=I=F=0,N=y;for(var G=0;G<286;++G)R[G]=0;for(G=0;G<30;++G)A[G]=0}var Y=2,Z=0,K=x,X=U-B&32767;if(H>2&&j==E(y-X))for(var $=Math.min(b,H)-1,J=Math.min(32767,y),Q=Math.min(258,H);X<=J&&--K&&U!=B;){if(t[y+Y]==t[y+Y-X]){for(var tt=0;tt<Q&&t[y+tt]==t[y+tt-X];++tt);if(tt>Y){if(Y=tt,Z=X,tt>$)break;var et=Math.min(X,tt-2),nt=0;for(G=0;G<et;++G){var rt=y-X+G+32768&32767,it=rt-C[rt]+32768&32767;it>nt&&(nt=it,B=rt)}}}X+=(U=B)-(B=C[U])+32768&32767}if(Z){P[L++]=268435456|f[Y]<<18|m[Z];var ot=31&f[Y],at=31&m[Z];F+=s[ot]+c[at],++R[257+ot],++A[at],M=y+Y,++I}else P[L++]=t[y],++R[t[y]]}}g=W(t,p,u,P,R,A,F,L,N,y-N,g),!u&&7&g&&(g=z(p,g+1,q))}return D(d,0,r+O(g)+l)},G=function(){for(var t=new Int32Array(256),e=0;e<256;++e){for(var n=e,r=9;--r;)n=(1&n&&-306674912)^n>>>1;t[e]=n}return t}(),Y=function(){var t=-1;return{p:function(e){for(var n=t,r=0;r<e.length;++r)n=G[255&n^e[r]]^n>>>8;t=n},d:function(){return~t}}},Z=function(){var t=1,e=0;return{p:function(n){for(var r=t,i=e,o=0|n.length,a=0;a!=o;){for(var s=Math.min(a+2655,o);a<s;++a)i+=r+=n[a];r=(65535&r)+15*(r>>16),i=(65535&i)+15*(i>>16)}t=r,e=i},d:function(){return(255&(t%=65521))<<24|t>>>8<<16|(255&(e%=65521))<<8|e>>>8}}},K=function(t,e,n,r,i){return H(t,null==e.level?6:e.level,null==e.mem?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(t.length)))):12+e.mem,n,r,!i)},X=function(t,e){var n={};for(var r in t)n[r]=t[r];for(var r in e)n[r]=e[r];return n},$=function(t,e,n){for(var r=t(),i=t.toString(),o=i.slice(i.indexOf("[")+1,i.lastIndexOf("]")).replace(/ /g,"").split(","),a=0;a<r.length;++a){var s=r[a],c=o[a];if("function"==typeof s){e+=";"+c+"=";var l=s.toString();if(s.prototype)if(-1!=l.indexOf("[native code]")){var u=l.indexOf(" ",8)+1;e+=l.slice(u,l.indexOf("(",u))}else for(var h in e+=l,s.prototype)e+=";"+c+".prototype."+h+"="+s.prototype[h].toString();else e+=l}else n[c]=s}return[e,n]},J=[],Q=function(t,e,n,s){var c;if(!J[n]){for(var l="",u={},h=t.length-1,d=0;d<h;++d)l=(c=$(t[d],l,u))[0],u=c[1];J[n]=$(t[h],l,u)}var f=X({},J[n][1]);return r.default(J[n][0]+";onmessage=function(e){for(var k in e.data)self[k]=e.data[k];onmessage="+e.toString()+"}",n,f,function(t){var e=[];for(var n in t)(t[n]instanceof i||t[n]instanceof o||t[n]instanceof a)&&e.push((t[n]=new t[n].constructor(t[n])).buffer);return e}(f),s)},tt=function(){return[i,o,a,s,c,l,d,g,T,k,y,A,b,E,P,R,O,D,I,F,Rt,at,st]},et=function(){return[i,o,a,s,c,l,f,m,C,x,S,w,y,V,q,b,L,M,N,j,U,B,z,W,O,D,H,K,St,at]},nt=function(){return[gt,vt,pt,Y,G]},rt=function(){return[mt,yt]},it=function(){return[_t,pt,Z]},ot=function(){return[bt]},at=function(t){return postMessage(t,[t.buffer])},st=function(t){return t&&t.size&&new i(t.size)},ct=function(t,e,n,r,i,o){var a=Q(n,r,i,(function(t,e){a.terminate(),o(t,e)}));return a.postMessage([t,e],e.consume?[t.buffer]:[]),function(){a.terminate()}},lt=function(t){return t.ondata=function(t,e){return postMessage([t,e],[t.buffer])},function(e){return t.push(e.data[0],e.data[1])}},ut=function(t,e,n,r,i){var o,a=Q(t,r,i,(function(t,n){t?(a.terminate(),e.ondata.call(e,t)):(n[1]&&a.terminate(),e.ondata.call(e,t,n[0],n[1]))}));a.postMessage(n),e.push=function(t,n){e.ondata||I(5),o&&e.ondata(I(4,0,1),null,!!n),a.postMessage([t,o=n],[t.buffer])},e.terminate=function(){a.terminate()}},ht=function(t,e){return t[e]|t[e+1]<<8},dt=function(t,e){return(t[e]|t[e+1]<<8|t[e+2]<<16|t[e+3]<<24)>>>0},ft=function(t,e){return dt(t,e)+4294967296*dt(t,e+4)},pt=function(t,e,n){for(;n;++e)t[e]=n,n>>>=8},gt=function(t,e){var n=e.filename;if(t[0]=31,t[1]=139,t[2]=8,t[8]=e.level<2?4:9==e.level?2:0,t[9]=3,0!=e.mtime&&pt(t,4,Math.floor(new Date(e.mtime||Date.now())/1e3)),n){t[3]=8;for(var r=0;r<=n.length;++r)t[r+10]=n.charCodeAt(r)}},mt=function(t){31==t[0]&&139==t[1]&&8==t[2]||I(6,"invalid gzip data");var e=t[3],n=10;4&e&&(n+=t[10]|2+(t[11]<<8));for(var r=(e>>3&1)+(e>>4&1);r>0;r-=!t[n++]);return n+(2&e)},yt=function(t){var e=t.length;return(t[e-4]|t[e-3]<<8|t[e-2]<<16|t[e-1]<<24)>>>0},vt=function(t){return 10+(t.filename&&t.filename.length+1||0)},_t=function(t,e){var n=e.level,r=0==n?0:n<6?1:9==n?3:2;t[0]=120,t[1]=r<<6|(r?32-2*r:1)},bt=function(t){(8!=(15&t[0])||t[0]>>>4>7||(t[0]<<8|t[1])%31)&&I(6,"invalid zlib data"),32&t[1]&&I(6,"invalid zlib data: preset dictionaries not supported")};function xt(t,e){return e||"function"!=typeof t||(e=t,t={}),this.ondata=e,t}var wt=function(){function t(t,e){e||"function"!=typeof t||(e=t,t={}),this.ondata=e,this.o=t||{}}return t.prototype.p=function(t,e){this.ondata(K(t,this.o,0,0,!e),e)},t.prototype.push=function(t,e){this.ondata||I(5),this.d&&I(4),this.d=e,this.p(t,e||!1)},t}();var Ct=function(){return function(t,e){ut([et,function(){return[lt,wt]}],this,xt.call(this,t,e),(function(t){var e=new wt(t.data);onmessage=lt(e)}),6)}}();function Tt(t,e,n){return n||(n=e,e={}),"function"!=typeof n&&I(7),ct(t,e,[et],(function(t){return at(St(t.data[0],t.data[1]))}),0,n)}function St(t,e){return K(t,e||{},0,0)}var kt=function(){function t(t){this.s={},this.p=new i(0),this.ondata=t}return t.prototype.e=function(t){this.ondata||I(5),this.d&&I(4);var e=this.p.length,n=new i(e+t.length);n.set(this.p),n.set(t,e),this.p=n},t.prototype.c=function(t){this.d=this.s.i=t||!1;var e=this.s.b,n=F(this.p,this.o,this.s);this.ondata(D(n,e,this.s.b),this.d),this.o=D(n,this.s.b-32768),this.s.b=this.o.length,this.p=D(this.p,this.s.p/8|0),this.s.p&=7},t.prototype.push=function(t,e){this.e(t),this.c(e)},t}();var Et=function(){return function(t){this.ondata=t,ut([tt,function(){return[lt,kt]}],this,0,(function(){var t=new kt;onmessage=lt(t)}),7)}}();function Pt(t,e,n){return n||(n=e,e={}),"function"!=typeof n&&I(7),ct(t,e,[tt],(function(t){return at(Rt(t.data[0],st(t.data[1])))}),1,n)}function Rt(t,e){return F(t,e)}var Ot=function(){function t(t,e){this.c=Y(),this.l=0,this.v=1,wt.call(this,t,e)}return t.prototype.push=function(t,e){wt.prototype.push.call(this,t,e)},t.prototype.p=function(t,e){this.c.p(t),this.l+=t.length;var n=K(t,this.o,this.v&&vt(this.o),e&&8,!e);this.v&&(gt(n,this.o),this.v=0),e&&(pt(n,n.length-8,this.c.d()),pt(n,n.length-4,this.l)),this.ondata(n,e)},t}();var Dt=function(){return function(t,e){ut([et,nt,function(){return[lt,wt,Ot]}],this,xt.call(this,t,e),(function(t){var e=new Ot(t.data);onmessage=lt(e)}),8)}}();function At(t,e,n){return n||(n=e,e={}),"function"!=typeof n&&I(7),ct(t,e,[et,nt,function(){return[It]}],(function(t){return at(It(t.data[0],t.data[1]))}),2,n)}function It(t,e){e||(e={});var n=Y(),r=t.length;n.p(t);var i=K(t,e,vt(e),8),o=i.length;return gt(i,e),pt(i,o-8,n.d()),pt(i,o-4,r),i}var Ft=function(){function t(t){this.v=1,kt.call(this,t)}return t.prototype.push=function(t,e){if(kt.prototype.e.call(this,t),this.v){var n=this.p.length>3?mt(this.p):4;if(n>=this.p.length&&!e)return;this.p=this.p.subarray(n),this.v=0}e&&(this.p.length<8&&I(6,"invalid gzip data"),this.p=this.p.subarray(0,-8)),kt.prototype.c.call(this,e)},t}();var Lt=function(){return function(t){this.ondata=t,ut([tt,rt,function(){return[lt,kt,Ft]}],this,0,(function(){var t=new Ft;onmessage=lt(t)}),9)}}();function Mt(t,e,n){return n||(n=e,e={}),"function"!=typeof n&&I(7),ct(t,e,[tt,rt,function(){return[Nt]}],(function(t){return at(Nt(t.data[0]))}),3,n)}function Nt(t,e){return F(t.subarray(mt(t),-8),e||new i(yt(t)))}var jt=function(){function t(t,e){this.c=Z(),this.v=1,wt.call(this,t,e)}return t.prototype.push=function(t,e){wt.prototype.push.call(this,t,e)},t.prototype.p=function(t,e){this.c.p(t);var n=K(t,this.o,this.v&&2,e&&4,!e);this.v&&(_t(n,this.o),this.v=0),e&&pt(n,n.length-4,this.c.d()),this.ondata(n,e)},t}();function Ut(t,e){e||(e={});var n=Z();n.p(t);var r=K(t,e,2,4);return _t(r,e),pt(r,r.length-4,n.d()),r}var Bt=function(){function t(t){this.v=1,kt.call(this,t)}return t.prototype.push=function(t,e){if(kt.prototype.e.call(this,t),this.v){if(this.p.length<2&&!e)return;this.p=this.p.subarray(2),this.v=0}e&&(this.p.length<4&&I(6,"invalid zlib data"),this.p=this.p.subarray(0,-4)),kt.prototype.c.call(this,e)},t}();var zt=function(){return function(t){this.ondata=t,ut([tt,ot,function(){return[lt,kt,Bt]}],this,0,(function(){var t=new Bt;onmessage=lt(t)}),11)}}();function Wt(t,e,n){return n||(n=e,e={}),"function"!=typeof n&&I(7),ct(t,e,[tt,ot,function(){return[Vt]}],(function(t){return at(Vt(t.data[0],st(t.data[1])))}),5,n)}function Vt(t,e){return F((bt(t),t.subarray(2,-4)),e)}var qt=function(){function t(t){this.G=Ft,this.I=kt,this.Z=Bt,this.ondata=t}return t.prototype.push=function(t,e){if(this.ondata||I(5),this.s)this.s.push(t,e);else{if(this.p&&this.p.length){var n=new i(this.p.length+t.length);n.set(this.p),n.set(t,this.p.length)}else this.p=t;if(this.p.length>2){var r=this,o=function(){r.ondata.apply(r,arguments)};this.s=31==this.p[0]&&139==this.p[1]&&8==this.p[2]?new this.G(o):8!=(15&this.p[0])||this.p[0]>>4>7||(this.p[0]<<8|this.p[1])%31?new this.I(o):new this.Z(o),this.s.push(this.p,e),this.p=null}}},t}();var Ht=function(t,e,n,r){for(var o in t){var a=t[o],s=e+o;a instanceof i?n[s]=[a,r]:Array.isArray(a)?n[s]=[a[0],X(r,a[1])]:Ht(a,s+"/",n,r)}},Gt="undefined"!=typeof TextEncoder&&new TextEncoder,Yt="undefined"!=typeof TextDecoder&&new TextDecoder,Zt=0;try{Yt.decode(q,{stream:!0}),Zt=1}catch(t){}var Kt=function(t){for(var e="",n=0;;){var r=t[n++],i=(r>127)+(r>223)+(r>239);if(n+i>t.length)return[e,D(t,n-1)];i?3==i?(r=((15&r)<<18|(63&t[n++])<<12|(63&t[n++])<<6|63&t[n++])-65536,e+=String.fromCharCode(55296|r>>10,56320|1023&r)):e+=1&i?String.fromCharCode((31&r)<<6|63&t[n++]):String.fromCharCode((15&r)<<12|(63&t[n++])<<6|63&t[n++]):e+=String.fromCharCode(r)}},Xt=function(){function t(t){this.ondata=t,Zt?this.t=new TextDecoder:this.p=q}return t.prototype.push=function(t,e){if(this.ondata||I(5),e=!!e,this.t)return this.ondata(this.t.decode(t,{stream:!0}),e),void(e&&(this.t.decode().length&&I(8),this.t=null));this.p||I(4);var n=new i(this.p.length+t.length);n.set(this.p),n.set(t,this.p.length);var r=Kt(n),o=r[0],a=r[1];e?(a.length&&I(8),this.p=null):this.p=a,this.ondata(o,e)},t}();function $t(t,e){if(e){for(var n=new i(t.length),r=0;r<t.length;++r)n[r]=t.charCodeAt(r);return n}if(Gt)return Gt.encode(t);var o=t.length,a=new i(t.length+(t.length>>1)),s=0,c=function(t){a[s++]=t};for(r=0;r<o;++r){if(s+5>a.length){var l=new i(s+8+(o-r<<1));l.set(a),a=l}var u=t.charCodeAt(r);u<128||e?c(u):u<2048?(c(192|u>>6),c(128|63&u)):u>55295&&u<57344?(c(240|(u=65536+(1047552&u)|1023&t.charCodeAt(++r))>>18),c(128|u>>12&63),c(128|u>>6&63),c(128|63&u)):(c(224|u>>12),c(128|u>>6&63),c(128|63&u))}return D(a,0,s)}function Jt(t,e){if(e){for(var n="",r=0;r<t.length;r+=16384)n+=String.fromCharCode.apply(null,t.subarray(r,r+16384));return n}if(Yt)return Yt.decode(t);var i=Kt(t),o=i[0];return i[1].length&&I(8),o}e.T8=Jt;var Qt=function(t){return 1==t?3:t<6?2:9==t?1:0},te=function(t,e){return e+30+ht(t,e+26)+ht(t,e+28)},ee=function(t,e,n){var r=ht(t,e+28),i=Jt(t.subarray(e+46,e+46+r),!(2048&ht(t,e+8))),o=e+46+r,a=dt(t,e+20),s=n&&4294967295==a?ne(t,o):[a,dt(t,e+24),dt(t,e+42)],c=s[0],l=s[1],u=s[2];return[ht(t,e+10),c,l,i,o+ht(t,e+30)+ht(t,e+32),u]},ne=function(t,e){for(;1!=ht(t,e);e+=4+ht(t,e+2));return[ft(t,e+12),ft(t,e+4),ft(t,e+20)]},re=function(t){var e=0;if(t)for(var n in t){var r=t[n].length;r>65535&&I(9),e+=r+4}return e},ie=function(t,e,n,r,i,o,a,s){var c=r.length,l=n.extra,u=s&&s.length,h=re(l);pt(t,e,null!=a?33639248:67324752),e+=4,null!=a&&(t[e++]=20,t[e++]=n.os),t[e]=20,e+=2,t[e++]=n.flag<<1|(null==o&&8),t[e++]=i&&8,t[e++]=255&n.cpr,t[e++]=n.cpr>>8;var d=new Date(null==n.mtime?Date.now():n.mtime),f=d.getFullYear()-1980;if((f<0||f>119)&&I(10),pt(t,e,f<<25|d.getMonth()+1<<21|d.getDate()<<16|d.getHours()<<11|d.getMinutes()<<5|d.getSeconds()>>>1),e+=4,null!=o&&(pt(t,e,n.crc),pt(t,e+4,o),pt(t,e+8,n.size)),pt(t,e+12,c),pt(t,e+14,h),e+=16,null!=a&&(pt(t,e,u),pt(t,e+6,n.attrs),pt(t,e+10,a),e+=14),t.set(r,e),e+=c,h)for(var p in l){var g=l[p],m=g.length;pt(t,e,+p),pt(t,e+2,m),t.set(g,e+4),e+=4+m}return u&&(t.set(s,e),e+=u),e},oe=function(t,e,n,r,i){pt(t,e,101010256),pt(t,e+8,n),pt(t,e+10,n),pt(t,e+12,r),pt(t,e+16,i)},ae=function(){function t(t){this.filename=t,this.c=Y(),this.size=0,this.cpr=0}return t.prototype.process=function(t,e){this.ondata(null,t,e)},t.prototype.push=function(t,e){this.ondata||I(5),this.c.p(t),this.size+=t.length,e&&(this.crc=this.c.d()),this.process(t,e||!1)},t}();var se=function(){function t(t,e){var n=this;e||(e={}),ae.call(this,t),this.d=new Ct(e,(function(t,e,r){n.ondata(t,e,r)})),this.cpr=8,this.flag=Qt(e.level),this.terminate=this.d.terminate}return t.prototype.process=function(t,e){this.d.push(t,e)},t.prototype.push=function(t,e){ae.prototype.push.call(this,t,e)},t}();var ce=function(){function t(t){this.ondata=t,this.u=[],this.d=1}return t.prototype.add=function(t){var e=this;if(this.ondata||I(5),2&this.d)this.ondata(I(4+8*(1&this.d),0,1),null,!1);else{var n=$t(t.filename),r=n.length,o=t.comment,a=o&&$t(o),s=r!=t.filename.length||a&&o.length!=a.length,c=r+re(t.extra)+30;r>65535&&this.ondata(I(11,0,1),null,!1);var l=new i(c);ie(l,0,t,n,s);var u=[l],h=function(){for(var t=0,n=u;t<n.length;t++){var r=n[t];e.ondata(null,r,!1)}u=[]},d=this.d;this.d=0;var f=this.u.length,p=X(t,{f:n,u:s,o:a,t:function(){t.terminate&&t.terminate()},r:function(){if(h(),d){var t=e.u[f+1];t?t.r():e.d=1}d=1}}),g=0;t.ondata=function(n,r,o){if(n)e.ondata(n,r,o),e.terminate();else if(g+=r.length,u.push(r),o){var a=new i(16);pt(a,0,134695760),pt(a,4,t.crc),pt(a,8,g),pt(a,12,t.size),u.push(a),p.c=g,p.b=c+g+16,p.crc=t.crc,p.size=t.size,d&&p.r(),d=1}else d&&h()},this.u.push(p)}},t.prototype.end=function(){var t=this;2&this.d?this.ondata(I(4+8*(1&this.d),0,1),null,!0):(this.d?this.e():this.u.push({r:function(){1&t.d&&(t.u.splice(-1,1),t.e())},t:function(){}}),this.d=3)},t.prototype.e=function(){for(var t=0,e=0,n=0,r=0,o=this.u;r<o.length;r++){n+=46+(l=o[r]).f.length+re(l.extra)+(l.o?l.o.length:0)}for(var a=new i(n+22),s=0,c=this.u;s<c.length;s++){var l=c[s];ie(a,t,l,l.f,l.u,l.c,e,l.o),t+=46+l.f.length+re(l.extra)+(l.o?l.o.length:0),e+=l.b}oe(a,t,this.u.length,n,e),this.ondata(null,a,!0),this.d=2},t.prototype.terminate=function(){for(var t=0,e=this.u;t<e.length;t++){e[t].t()}this.d=2},t}();e.Xo=function(t,e){e||(e={});var n={},r=[];Ht(t,"",n,e);var o=0,a=0;for(var s in n){var c=n[s],l=c[0],u=c[1],h=0==u.level?0:8,d=(T=$t(s)).length,f=u.comment,p=f&&$t(f),g=p&&p.length,m=re(u.extra);d>65535&&I(11);var y=h?St(l,u):l,v=y.length,_=Y();_.p(l),r.push(X(u,{size:l.length,crc:_.d(),c:y,f:T,m:p,u:d!=s.length||p&&f.length!=g,o,cpr:h})),o+=30+d+m+v,a+=76+2*(d+m)+(g||0)+v}for(var b=new i(a+22),x=o,w=a-o,C=0;C<r.length;++C){var T=r[C];ie(b,T.o,T,T.f,T.u,T.c.length);var S=30+T.f.length+re(T.extra);b.set(T.c,T.o+S),ie(b,o,T,T.f,T.u,T.c.length,T.o,T.m),o+=16+S+(T.m?T.m.length:0)}return oe(b,o,r.length,w,x),b};var le=function(){function t(){}return t.prototype.push=function(t,e){this.ondata(null,t,e)},t.cpr=0,t}();var ue=function(){function t(t,e){var n=this;e<32e4?this.i=new kt((function(t,e){n.ondata(null,t,e)})):(this.i=new Et((function(t,e,r){n.ondata(t,e,r)})),this.terminate=this.i.terminate)}return t.prototype.push=function(t,e){this.i.terminate&&(t=D(t,0)),this.i.push(t,e)},t.cpr=8,t}();var he=function(){function t(t){this.onfile=t,this.k=[],this.o={0:le},this.p=q}return t.prototype.push=function(t,e){var n=this;if(this.onfile||I(5),this.p||I(4),this.c>0){var r=Math.min(this.c,t.length),o=t.subarray(0,r);if(this.c-=r,this.d?this.d.push(o,!this.c):this.k[0].push(o),(t=t.subarray(r)).length)return this.push(t,e)}else{var a=0,s=0,c=void 0,l=void 0;this.p.length?t.length?((l=new i(this.p.length+t.length)).set(this.p),l.set(t,this.p.length)):l=this.p:l=t;for(var u=l.length,h=this.c,d=h&&this.d,f=function(){var t,e=dt(l,s);if(67324752==e){a=1,c=s,p.d=null,p.c=0;var r=ht(l,s+6),i=ht(l,s+8),o=2048&r,d=8&r,f=ht(l,s+26),g=ht(l,s+28);if(u>s+30+f+g){var m=[];p.k.unshift(m),a=2;var y,v=dt(l,s+18),_=dt(l,s+22),b=Jt(l.subarray(s+30,s+=30+f),!o);4294967295==v?(t=d?[-2]:ne(l,s),v=t[0],_=t[1]):d&&(v=-1),s+=g,p.c=v;var x={name:b,cpr:i,start:function(){if(x.ondata||I(5),v){var t=n.o[i];t||x.ondata(I(14,"unknown cpr type "+i,1),null,!1),(y=v<0?new t(b):new t(b,v,_)).ondata=function(t,e,n){x.ondata(t,e,n)};for(var e=0,r=m;e<r.length;e++){var o=r[e];y.push(o,!1)}n.k[0]==m&&n.c?n.d=y:y.push(q,!0)}else x.ondata(null,q,!0)},terminate:function(){y&&y.terminate&&y.terminate()}};v>=0&&(x.size=v,x.ors=_),p.onfile(x)}return"break"}if(h){if(134695760==e)return c=s+=12+(-2==h&&8),a=3,p.c=0,"break";if(33639248==e)return c=s-=4,a=3,p.c=0,"break"}},p=this;s<u-4;++s){if("break"===f())break}if(this.p=q,h<0){var g=a?l.subarray(0,c-12-(-2==h&&8)-(134695760==dt(l,c-16)&&4)):l.subarray(0,s);d?d.push(g,!!a):this.k[+(2==a)].push(g)}if(2&a)return this.push(l.subarray(s),e);this.p=l.subarray(s)}e&&(this.c&&I(13),this.p=null)},t.prototype.register=function(t){this.o[t.cpr]=t},t}();var de="function"==typeof queueMicrotask?queueMicrotask:"function"==typeof setTimeout?setTimeout:function(t){t()};e.GZ=function(t,e){for(var n={},r=t.length-22;101010256!=dt(t,r);--r)(!r||t.length-r>65558)&&I(13);var o=ht(t,r+8);if(!o)return{};var a=dt(t,r+16),s=4294967295==a;s&&(r=dt(t,r-12),101075792!=dt(t,r)&&I(13),o=dt(t,r+32),a=dt(t,r+48));for(var c=e&&e.filter,l=0;l<o;++l){var u=ee(t,a,s),h=u[0],d=u[1],f=u[2],p=u[3],g=u[4],m=u[5],y=te(t,m);a=g,c&&!c({name:p,size:d,ors:f,cpr:h})||(h?8==h?n[p]=Rt(t.subarray(y,y+d),new i(f)):I(14,"unknown cpr type "+h):n[p]=D(t,y,y+d))}return n}},7872:(t,e)=>{var n={};e.default=function(t,e,r,i,o){var a=new Worker(n[e]||(n[e]=URL.createObjectURL(new Blob([t+';addEventListener("error",function(e){e=e.error;postMessage({$e$:[e.message,e.code,e.stack]})})'],{type:"text/javascript"}))));return a.onmessage=function(t){var e=t.data,n=e.$e$;if(n){var r=new Error(n[0]);r.code=n[1],r.stack=n[2],o(r,null)}else o(null,e)},a.postMessage(r,i),a}}},n={};function r(t){var i=n[t];if(void 0!==i)return i.exports;var o=n[t]={id:t,loaded:!1,exports:{}};return e[t].call(o.exports,o,o.exports,r),o.loaded=!0,o.exports}r.m=e,t=[],r.O=(e,n,i,o)=>{if(!n){var a=1/0;for(u=0;u<t.length;u++){for(var[n,i,o]=t[u],s=!0,c=0;c<n.length;c++)(!1&o||a>=o)&&Object.keys(r.O).every((t=>r.O[t](n[c])))?n.splice(c--,1):(s=!1,o<a&&(a=o));if(s){t.splice(u--,1);var l=i();void 0!==l&&(e=l)}}return e}o=o||0;for(var u=t.length;u>0&&t[u-1][2]>o;u--)t[u]=t[u-1];t[u]=[n,i,o]},r.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return r.d(e,{a:e}),e},r.d=(t,e)=>{for(var n in e)r.o(e,n)&&!r.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},r.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),r.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.nmd=t=>(t.paths=[],t.children||(t.children=[]),t),(()=>{var t={826:0};r.O.j=e=>0===t[e];var e=(e,n)=>{var i,o,[a,s,c]=n,l=0;if(a.some((e=>0!==t[e]))){for(i in s)r.o(s,i)&&(r.m[i]=s[i]);if(c)var u=c(r)}for(e&&e(n);l<a.length;l++)o=a[l],r.o(t,o)&&t[o]&&t[o][0](),t[o]=0;return r.O(u)},n=self.webpackChunktencentcloud_webar=self.webpackChunktencentcloud_webar||[];n.forEach(e.bind(null,0)),n.push=e.bind(null,n.push.bind(n))})();var i=r.O(void 0,[647,321],(()=>r(4504))),o=(i=r.O(i)).ry,a=i.Cz,s=i.T$,c=i.Mj,l=i.UZ,u=i.bk,h=i.Iq,d=i.aR,f=i._$;export{o as ArSdk,a as BEAUTIFY_OPTIONS,s as BLEND_MODES,c as ENTRY_TYPES,l as EntryType,u as OUTPUT_TYPES,h as authorize,d as authorizeWxCamera,f as setRootPath};
|
|
1
|
+
var self = wx;var t,e={3483:function(t){t.exports=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])})(e,n)};function e(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}var n=function(){return(n=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t}).apply(this,arguments)};function r(t,e){var n,r,i,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]},a={next:s(0),throw:s(1),return:s(2)};return"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function s(a){return function(s){var c=[a,s];if(n)throw new TypeError("Generator is already executing.");for(;o;)try{if(n=1,r&&(i=2&c[0]?r.return:c[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,c[1])).done)return i;switch(r=0,(c=i?[2&c[0],i.value]:c)[0]){case 0:case 1:i=c;break;case 4:return o.label++,{value:c[1],done:!1};case 5:o.label++,r=c[1],c=[0];continue;case 7:c=o.ops.pop(),o.trys.pop();continue;default:if(!((i=0<(i=o.trys).length&&i[i.length-1])||6!==c[0]&&2!==c[0])){o=0;continue}if(3===c[0]&&(!i||c[1]>i[0]&&c[1]<i[3]))o.label=c[1];else if(6===c[0]&&o.label<i[1])o.label=i[1],i=c;else{if(!(i&&o.label<i[2])){i[2]&&o.ops.pop(),o.trys.pop();continue}o.label=i[2],o.ops.push(c)}}c=e.call(t,o)}catch(s){c=[6,s],r=0}finally{n=i=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}}function i(){for(var t=0,e=0,n=arguments.length;e<n;e++)t+=arguments[e].length;var r=Array(t),i=0;for(e=0;e<n;e++)for(var o=arguments[e],a=0,s=o.length;a<s;a++,i++)r[i]=o[a];return r}Object.assign||Object.defineProperty(Object,"assign",{enumerable:!1,configurable:!0,writable:!0,value:function(t){if(null==t)throw new TypeError("Cannot convert first argument to object");for(var e=Object(t),n=1;n<arguments.length;n++)if(null!=(r=arguments[n]))for(var r=Object(r),i=Object.keys(Object(r)),o=0,a=i.length;o<a;o++){var s=i[o],c=Object.getOwnPropertyDescriptor(r,s);null!=c&&c.enumerable&&(e[s]=r[s])}return e}});var o=["ext1","ext2","ext3","level","trace","tag","seq","code"],a=(c.prototype.indexOf=function(t,e){for(var n=0;n<t.length;n++)if(t[n].callback===e)return n;return-1},c.prototype.on=function(t,e,n){var r;if(void 0===n&&(n=0),this)return(r=this.eventsList[t])||(this.eventsList[t]=[],r=this.eventsList[t]),-1===this.indexOf(r,e)&&r.push({name:t,type:n||0,callback:e}),this},c.prototype.one=function(t,e){this.on(t,e,1)},c.prototype.remove=function(t,e){if(this){var n=this.eventsList[t];if(n){if(e)return n.length&&(e=this.indexOf(n,e),n.splice(e,1)),this;try{delete this.eventsList[t]}catch(t){}}return null}},c.prototype.clear=function(){this.eventsList={}},c),s=function(t){if(!t||0===t.length)return"{}";t=Array.isArray(t)?t:[t];var e=Object.keys(t[0]),n={},r=(e.forEach((function(e){n[e]=t.map((function(t){return t[e]}))})),n.count=t.length,n);if("string"==typeof r)return r;try{return JSON.stringify(r,_())||"undefined"}catch(r){return"error happen when aegis stringify: \n "+r.message+" \n "+r.stack}};function c(){var t=this;this.emit=function(e,n){if(t){var r;if(null!=(i=t.eventsList[e])&&i.length)for(var i=i.slice(),o=0;o<i.length;o++){r=i[o];try{var a=r.callback.apply(t,[n]);if(1===r.type&&t.remove(e,r.callback),!1===a)break}catch(e){throw e}}return t}},this.eventsList={}}function l(t,e){return"string"==typeof t?t.split("?")[e?1:0]||"":t}function u(t){return"string"==typeof t&&t.startsWith("//")?"undefined"!=typeof location&&"https:"===location.protocol:/^https/.test(t)}function h(t,e,n){var r,i;try{if("function"==typeof(null==e?void 0:e.retCodeHandler))return{code:void 0===(o=(i=e.retCodeHandler(t,null==n?void 0:n.url,null==n?void 0:n.ctx)||{}).code)?"unknown":o,isErr:i.isErr};"string"==typeof t&&(t=JSON.parse(t)),"function"==typeof(null==(r=null==e?void 0:e.ret)?void 0:r.join)&&(v=[].concat(e.ret.map((function(t){return t.toLowerCase()}))));var o,a=Object.getOwnPropertyNames(t).filter((function(t){return-1!==v.indexOf(t.toLowerCase())}));return a.length?{code:""+(o=t[a[0]]),isErr:0!==o&&"0"!==o}:{code:"unknown",isErr:!1}}catch(t){return{code:"unknown",isErr:!1}}}function d(t,e){void 0===e&&(e=3);var n,r,i,o="";return Array.isArray(t)?(o+="[",n=t.length,t.forEach((function(t,r){var i,a;o=(o+="object"==typeof t&&1<e?d(t,e-1):(a="",a+="undefined"==(i=typeof t)||"symbol"==i||"function"==i?"null":"string"==i||"object"==i?'"'+t+'"':t))+(r===n-1?"":",")})),o+="]"):t instanceof Object?(o="{",r=Object.keys(t),i=r.length,r.forEach((function(n,a){var s,c,l;"object"==typeof t[n]&&1<e?o+='"'+n+'":'+d(t[n],e-1):o+=(l="","string"==(c=typeof(s=t[n]))||"object"==c?l+='"'+n+'":"'+s+'"':"function"==typeof s?l+='"'+n+'":"function '+s.name+'"':"symbol"==typeof s?l+='"'+n+'":"symbol"':"number"!=typeof s&&"boolean"!=c||(l+='"'+n+'": '+s),l),o+=a===i-1||a<i-1&&void 0===t[r[a+1]]?"":","})),o+="}"):o+=t,o}var f,p,g,m,y,v=["ret","retcode","code","errcode"],_=function(){var t=new WeakSet;return function(e,n){if(n instanceof Error)return"Error.message: "+n.message+" \n Error.stack: "+n.stack;if("object"==typeof n&&null!==n){if(t.has(n))return"[Circular "+(e||"root")+"]";t.add(n)}return n}},b=function(t){if("string"==typeof t)return t;try{return t instanceof Error?(JSON.stringify(t,_(),4)||"undefined").replace(/"/gim,""):JSON.stringify(t,_(),4)||"undefined"}catch(t){return"error happen when aegis stringify: \n "+t.message+" \n "+t.stack}};function x(t,e){var n,r=[],i=t.config;return t.lifeCycle.on("destroy",(function(){r.length=0})),function(o,a){Array.isArray(o)?r=r.concat(o):r.push(o),e&&r.length>=e||t.sendNow&&0<r.length?(r=U(r),a(r.splice(0,r.length)),n&&clearTimeout(n)):(n&&clearTimeout(n),n=setTimeout((function(){n=null,0<(r=U(r)).length&&a(r.splice(0,r.length))}),i.delay))}}function w(t,e){return Array.isArray(t)?e(t.map((function(t){return e=n(n({},t),{msg:"string"==typeof t.msg?t.msg:[].concat(t.msg).map(b).join(" ")}),o.forEach((function(t){e[t]||delete e[t]})),e;var e}))):e([n(n({},t),{msg:"string"==typeof t.msg?t.msg:b(t.msg)})])}function C(t,e){return function(r,i){var a,s,c,l=Array.isArray(r),u=l?r:[r],h=(t.lifeCycle.emit("beforeRequest",r),t.config.beforeRequest);(u="function"==typeof h?u.map((function(t){try{var n=h({logs:t,logType:e});return(null==n?void 0:n.logType)===e&&null!=n&&n.logs?n.logs:!1!==n&&t}catch(n){return t}})).filter((function(t){return!1!==t})):u).length&&(a=u,r=o,!Array.isArray(a)||a.length<=1||(s=[],c=[],!(c="string"==typeof r?[r]:r)||c.length<=0||(c.forEach((function(t){a.forEach((function(e){null!=e&&e[t]&&s.push(t)}))})),0<s.length&&(a=a.map((function(t){var e={};return s.forEach((function(t){e[t]=""})),n(n({},e),t)}))))),u=a,i(l?u:u[0]))}}function T(t){return function(e,n){t.lifeCycle.emit("modifyRequest",e);var r=t.config.modifyRequest;if("function"==typeof r)try{var i=r(e);"object"==typeof i&&"url"in i&&(e=i)}catch(e){console.error(e)}n(e)}}function S(t){return function(e,n){t.lifeCycle.emit("afterRequest",e);var r=t.config.afterRequest;"function"==typeof r&&!1===r(e)||n(e)}}function k(t){if(t&&t.reduce&&t.length)return 1===t.length?function(e,n){t[0](e,n||V)}:t.reduce((function(t,e){return function(n,r){return void 0===r&&(r=V),t(n,(function(t){return null==e?void 0:e(t,r)}))}}));throw new TypeError("createPipeline need at least one function param")}function E(t,e){Object.getOwnPropertyNames(t).forEach((function(n){"function"==typeof t[n]&&"constructor"!==n&&(e?e[n]="sendPipeline"===n?function(){return function(){}}:function(){}:t[n]=function(){})}))}function P(t){try{var e,n,r,i="";return i=t.pageUrl||(n=(e=getCurrentPages())[e.length-1]||{},o=n.options,r=Object.keys(o).length?"?"+Object.keys(o).map((function(t){return t+"="+o[t]})).join("&"):"",n.route?n.route+r:""),i="function"==typeof t.urlHandler?t.urlHandler():i}catch(t){return""}var o}function R(t,e){if("string"==typeof t&&"string"==typeof e){if(t===e)return 1;for(var n=t.split("."),r=e.split("."),i=Math.max(n.length,r.length),o=0;o<i;o++){var a=~~n[o],s=~~r[o];if(a<s)return;if(s<a)return 1}}}function O(t){return R(Y=Y||G.getSystemInfoSync().SDKVersion,"1.1.1")&&G.canIUse?G.canIUse(t):!!G[t]}function D(t){for(var e,n={unknown:/unknown|none/i,wifi:/wifi/i,net2g:/2g/i,net3g:/3g/i,net4g:/4g/i,net5g:/5g/i,net6g:/6g/i},r=g.unknown,i=0;i<Object.keys(n).length;i++){var o=Object.keys(n)[i];if(null!=(e=n[o])&&e.test(t)){r=g[o];break}}return r}function A(t){var e=t.apiName,n=et[e];n?n.hackCloudReq.addCallback(t):(n=tt.cloud[e],et[e]={hackCloudReq:new nt(t),originApi:n}),et[e]}function I(t){var e=t.apiName,n=it[e];n?n.hackReq.addCallback(t):(n=wx[e],it[e]={hackReq:new ot(t),originApi:n}),it[e]}(q=f=f||{}).INFO_ALL="-1",q.API_RESPONSE="1",q.INFO="2",q.ERROR="4",q.PROMISE_ERROR="8",q.AJAX_ERROR="16",q.SCRIPT_ERROR="32",q.IMAGE_ERROR="64",q.CSS_ERROR="128",q.CONSOLE_ERROR="256",q.MEDIA_ERROR="512",q.RET_ERROR="1024",q.REPORT="2048",q.PV="4096",q.EVENT="8192",q.PAGE_NOT_FOUND_ERROR="16384",q.WEBSOCKET_ERROR="32768",q.BRIDGE_ERROR="65536",(q=p=p||{})[q.android=1]="android",q[q.ios=2]="ios",q[q.windows=3]="windows",q[q.macos=4]="macos",q[q.linux=5]="linux",q[q.devtools=6]="devtools",q[q.other=100]="other",(q=g=g||{})[q.unknown=100]="unknown",q[q.wifi=1]="wifi",q[q.net2g=2]="net2g",q[q.net3g=3]="net3g",q[q.net4g=4]="net4g",q[q.net5g=5]="net5g",q[q.net6g=6]="net6g",(q=m=m||{}).LOG="log",q.SPEED="speed",q.PERFORMANCE="performance",q.OFFLINE="offline",q.WHITE_LIST="whiteList",q.VITALS="vitals",q.PV="pv",q.CUSTOM_PV="customPV",q.EVENT="event",q.CUSTOM="custom",q.SDK_ERROR="sdkError",q.SET_DATA="setData",q.LOAD_PACKAGE="loadPackage",(q=y=y||{}).production="production",q.development="development",q.gray="gray",q.pre="pre",q.daily="daily",q.local="local",q.test="test",q.others="others";var F,L,M,N,j,U=function(t){return t.filter((function(e,n){return"static"!==e.type||!t.find((function(t,r){return e.url===t.url&&200===e.status&&n<r}))}))},B=function(t){t.level===f.INFO_ALL&&(t.level=f.INFO)},z=function(t){return(Array.isArray(t)?t:[t]).map((function(t){return Object.getOwnPropertyNames(t).reduce((function(e,n){return"ctx"!==n&&(e[n]=t[n]),e}),{level:f.INFO,msg:""})}))},W=function(t){return function(e){return t.sendPipeline([function(e,n){return n({url:t.config.url||"",data:s(z(e)),method:"post",contentType:"application/json",type:m.LOG,log:e,requestConfig:{timeout:5e3},success:function(){var r=t.config.onReport;"function"==typeof r&&e.forEach((function(t){r(t)})),"function"==typeof n&&n([])},fail:function(e){"403 forbidden"===e&&t.destroy()}})}],m.LOG)(e)}},V=function(){},q=(Object.defineProperty(wt.prototype,"__version__",{get:function(){return console.warn("__version__ has discard, please use version"),"1.36.3"},enumerable:!1,configurable:!0}),Object.defineProperty(wt.prototype,"LogType",{get:function(){return console.warn("LogType has discard, please use logType"),f},enumerable:!1,configurable:!0}),wt.prototype.init=function(t){this.setConfig(t);for(var e=0;e<wt.installedPlugins.length;e++)try{wt.installedPlugins[e].patch(this)}catch(t){this.sendSDKError(t)}this.lifeCycle.emit("onInited")},wt.prototype.setConfig=function(t){Object.assign(this.config,t);var e=(t=this.config).id,n=t.uin,r=t.version,i=t.ext1,o=t.ext2,a=t.ext3,s=t.aid,c=void 0===(l=t.env)?"production":l,l=t.pageUrl;return t=this.bean.id!==e||this.bean.uin!==n||this.bean.aid!==s,this.bean.id=e||"",this.bean.uin=n||"",this.bean.version=r||"1.36.3",this.bean.aid=s||"",this.bean.env=function(){switch(c){case y.production:case y.development:case y.gray:case y.pre:case y.daily:case y.local:case y.test:case y.others:return 1;default:return}}()?c:y.others,l&&this.extendBean("from",encodeURIComponent(l)),i&&this.extendBean("ext1",encodeURIComponent(i)),o&&this.extendBean("ext2",encodeURIComponent(o)),a&&this.extendBean("ext3",encodeURIComponent(a)),t&&this.lifeCycle.emit("onConfigChange",this.config),this.config},wt.use=function(t){-1===wt.installedPlugins.indexOf(t)&&t.aegisPlugin&&wt.installedPlugins.push(t)},wt.unuse=function(t){-1!==(t=wt.installedPlugins.indexOf(t))&&wt.installedPlugins.splice(t,1)},wt.prototype.info=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var r={level:f.INFO,msg:t};1===t.length&&t[0].msg&&Object.assign(r,n({},t[0]),{level:f.INFO}),this.normalLogPipeline(r)},wt.prototype.infoAll=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var r={level:f.INFO_ALL,msg:t};1===t.length&&t[0].msg&&Object.assign(r,n({},t[0]),{level:f.INFO_ALL}),this.normalLogPipeline(r)},wt.prototype.report=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var r={level:f.REPORT,msg:t};1===t.length&&t[0].msg&&Object.assign(r,n({},t[0])),this.normalLogPipeline(r)},wt.prototype.error=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var r={level:f.ERROR,msg:t};1===t.length&&t[0].msg&&Object.assign(r,n({},t[0]),{level:f.ERROR}),this.normalLogPipeline(r)},wt.prototype.speedLogPipeline=function(t){throw new Error('You need to override "speedLogPipeline" method')},wt.prototype.reportPv=function(t){var e,n=this;t&&(console.warn("reportPv is deprecated, please use reportEvent"),e=""+Object.getOwnPropertyNames(this.bean).filter((function(t){return"id"!==t})).map((function(t){return t+"="+n.bean[t]})).join("&"),this.sendPipeline([function(r,i){i({url:n.config.url+"/"+t+"?"+e,addBean:!1,type:m.CUSTOM_PV,fail:function(t){"403 forbidden"===t&&n.destroy()}})}],m.CUSTOM_PV)(null))},wt.prototype.reportEvent=function(t){t&&((t="string"==typeof t?{name:t,ext1:this.config.ext1||"",ext2:this.config.ext2||"",ext3:this.config.ext3||""}:t).name?this.eventPipeline(t):console.warn("reportEvent params error"))},wt.prototype.reportTime=function(t,e){if("object"==typeof t)return this.reportT(t);"string"==typeof t?"number"==typeof e?e<0||6e4<e?console.warn("reportTime: duration must between 0 and 60000"):this.submitCustomTime(t,e):console.warn("reportTime: second param must be number"):console.warn("reportTime: first param must be a string")},wt.prototype.reportT=function(t){var e=t.name,n=t.duration,r=void 0===(r=t.ext1)?"":r,i=void 0===(i=t.ext2)?"":i,o=void 0===(o=t.ext3)?"":o;if(t=t.from,"string"==typeof e&&"number"==typeof n&&"string"==typeof r&&"string"==typeof i&&"string"==typeof o){if(!(n<0||6e4<n))return this.submitCustomTime(e,n,r,i,o,void 0===t?"":t);console.warn("reportTime: duration must between 0 and 60000")}else console.warn("reportTime: params error")},wt.prototype.time=function(t){"string"==typeof t?this.timeMap[t]?console.warn("Timer "+t+" already exists"):this.timeMap[t]=Date.now():console.warn("time: first param must be a string")},wt.prototype.timeEnd=function(t){"string"==typeof t?this.timeMap[t]?(this.submitCustomTime(t,Date.now()-this.timeMap[t]),delete this.timeMap[t]):console.warn("Timer "+t+" does not exist"):console.warn("timeEnd: first param must be a string")},wt.prototype.submitCustomTime=function(t,e,n,r,i,o){this.customTimePipeline({name:t,duration:e,ext1:n||this.config.ext1,ext2:r||this.config.ext2,ext3:i||this.config.ext3,from:o||void 0})},wt.prototype.extendBean=function(t,e){this.bean[t]=e},wt.prototype.sendPipeline=function(t,e){var n,r=this;return k(i([function(t,e){if("number"!=typeof n.config.random&&(console.warn("random must in [0, 1], default is 1."),n.config.random=1),!n.isHidden||!n.isGetSample)if(n.isGetSample)n.isHidden||e(t);else{if(n.isGetSample=!0,Math.random()<n.config.random)return n.isHidden=!1,e(t);n.isHidden=!0}},C(n=this,e)],t,[T(this),function(t,e){r.request(t,(function(){for(var n,o=[],a=0;a<arguments.length;a++)o[a]=arguments[a];r.failRequestCount=0,e({isErr:!1,result:o,logType:null==t?void 0:t.type,logs:null==t?void 0:t.log}),null!=(n=null==t?void 0:t.success)&&n.call.apply(n,i([t],o))}),(function(){for(var n,o=[],a=0;a<arguments.length;a++)o[a]=arguments[a];10<=++r.failRequestCount&&r.destroy(),e({isErr:!0,result:o,logType:null==t?void 0:t.type,logs:null==t?void 0:t.log}),null!=(n=null==t?void 0:t.fail)&&n.call.apply(n,i([t],o))}))},S(this)]))},wt.prototype.send=function(t,e,n){var r=this;return k([T(this),function(t,i){r.request(t,(function(){for(var n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];i({isErr:!1,result:n,logType:t.type,logs:t.log}),null!=e&&e.apply(void 0,n)}),(function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];i({isErr:!0,result:e,logType:t.type,logs:t.log}),null!=n&&n.apply(void 0,e)}))},S(this)])(t)},wt.prototype.ready=function(t,e,n){throw new Error('You need to override "ready" method')},wt.prototype.request=function(t,e,n){throw new Error('You need to override "request" method')},wt.prototype.sendSDKError=function(t){var e=this;this.sendPipeline([function(t,n){n({url:e.config.url+"?id=1085&msg[0]="+encodeURIComponent(b(t))+"&level[0]=2&from="+e.config.id+"&count=1&version="+e.config.id+"(1.36.3)",addBean:!1,method:"get",type:m.SDK_ERROR,log:t})}],m.SDK_ERROR)(t)},wt.prototype.destroy=function(t){void 0===t&&(t=!1);var e,n,r=wt.instances.indexOf(this);-1!==r&&wt.instances.splice(r,1);for(var i=wt.installedPlugins.length-1;0<=i;i--)try{wt.installedPlugins[i].unpatch(this)}catch(t){this.sendSDKError(t)}if(this.lifeCycle.emit("destroy"),this.lifeCycle.clear(),t)e=this,n=Object.getOwnPropertyDescriptors(e),Object.keys(n).forEach((function(t){n[t].writable&&(e[t]=null)})),Object.setPrototypeOf(this,null);else{for(var o=this;o.constructor!==Object&&E(o,this),o=Object.getPrototypeOf(o););0===wt.instances.length&&(E(r=Object.getPrototypeOf(this).constructor),E(wt))}},wt.version="1.36.3",wt.instances=[],wt.logType=f,wt.environment=y,wt.installedPlugins=[],wt),H=(xt.prototype.patch=function(t){this.canUse(t)&&this.exist(t)&&(this.instances.push(t),this.triggerInit(t),this.triggerOnNewAegis(t))},xt.prototype.unpatch=function(t){-1!==(t=this.instances.indexOf(t))&&(this.instances.splice(t,1),0===this.instances.length&&this.uninstall())},xt.prototype.countInstance=function(){return this.instances.length},xt.prototype.uninstall=function(){var t;null!=(t=null==(t=this.option)?void 0:t.destroy)&&t.apply(this)},xt.prototype.walk=function(t){var e=this;this.instances.forEach((function(n){var r=e.canUse(n);r&&t(n,r)}))},xt.prototype.canUse=function(t){return!(!(t=this.getConfig(t))||"object"!=typeof t)||!!t},xt.prototype.getConfig=function(t){return null==(t=t.config)?void 0:t[this.name]},xt.prototype.exist=function(t){return-1===this.instances.indexOf(t)},xt.prototype.triggerInit=function(t){var e;this.inited||(this.inited=!0,null!=(e=null==(e=this.option)?void 0:e.init)&&e.call(this.option,this.getConfig(t)))},xt.prototype.triggerOnNewAegis=function(t){var e;null!=(e=null==(e=this.option)?void 0:e.onNewAegis)&&e.call(this.option,t,this.getConfig(t))},xt),G=wx||qq,Y="",Z=new H({name:"offlineLog",onNewAegis:function(t){if(G.getFileSystemManager)try{var e=t.config,n=e.id,r=void 0===n?"":n,i=e.uin,o=void 0===i?0:i,a=e.offlineUrl,s=void 0===a?"":a,c=e.offlineLogLimit,l=new K({limit:c});t.lifeCycle.on("beforeWrite",(function(e){l.save2Offline(e=void 0===e?[]:e,t.config)})),l.ready((function(e){var n=(t.bean||{}).aid,i=void 0===n?"":n;!e&&r&&(o||i)&&t.send({url:s+"/offlineAuto",type:m.OFFLINE,log:m.OFFLINE},(function(n){var a=(null==n?void 0:n.data).secretKey;a&&!e&&l.getLogs({id:r,uin:o},(function(e,n){e?console.error(e):t.send({url:s+"/offlineLog",data:{logs:n,secretKey:a,id:r,uin:o,aid:i},method:"post",type:m.OFFLINE,log:n},(function(){l.clearLogs()}))}))}))}))}catch(t){console.error(t)}else console.warn("[aegis-mp-sdk]unsupport getFileSystemManager offline log not work!")}}),K=(bt.prototype.getLogs=function(t,e){var n=this.fileSystem,r=this.filePath;n.readFile({filePath:r,encoding:"utf8",fail:function(t){console.error(t)},success:function(t){t=(void 0===(t=t.data)?"":t).toString().split("\n").filter((function(t){return t})).map((function(t){return JSON.parse(t)})),e(null,t)}})},bt.prototype.checkLimit=function(t,e){void 0===e&&(e=function(){});var n=this.fileSystem,r=this.filePath,i=this.limitSize;n.readFile({filePath:r,encoding:"utf8",success:function(o){if((o=(o=void 0===(o=o.data)?"":o).toString()+t).length>i){for(var a=o.split("\n"),s="",c=a.length-1;0<=c&&!(a[c]&&(s=a[c]+"\n"+s).length>i);c--);n.writeFile({filePath:r,data:s,success:e})}else n.appendFile({data:t,filePath:r,encoding:"utf8",success:e,fail:function(t){console.error(t)}})}})},bt),X=new H({name:"device",onNewAegis:function(t){return e=this,o=function(){return r(this,(function(e){return this.setSystemInfo(t),this.refreshNetwork(t),this.setNetworkChange(t),[2]}))},new(i=(i=n=void 0)||Promise)((function(t,r){function a(t){try{c(o.next(t))}catch(t){r(t)}}function s(t){try{c(o.throw(t))}catch(t){r(t)}}function c(e){var n;e.done?t(e.value):((n=e.value)instanceof i?n:new i((function(t){t(n)}))).then(a,s)}c((o=o.apply(e,n||[])).next())}));var e,n,i,o},setSystemInfo:function(t){var e=this;try{O("getSystemInfo")&&G.getSystemInfo({success:function(n){var r=n.platform,i=n.model,o=n.windowHeight,a=n.windowWidth,s=void 0===(s=n.screenWidth)?0:s;n=void 0===(n=n.screenHeight)?0:n,t.extendBean("platform",e.getPlatFormType(r)),t.extendBean("model",i),t.extendBean("vp",Math.round(a)+" * "+Math.round(o)),t.extendBean("sr",Math.round(s)+" * "+Math.round(n))}})}catch(t){}},getPlatFormType:function(t){for(var e,n={android:/android/i,ios:/ios/i,windows:/windows/i,macos:/mac/i,devtools:/devtools/i},r=p.other,i=0;i<Object.keys(n).length;i++){var o=Object.keys(n)[i];if(null!=(e=n[o])&&e.test(t)){r=p[o];break}}return r},setNetworkChange:function(t){O("onNetworkStatusChange")&&G.onNetworkStatusChange((function(e){e=D(e.networkType),t.extendBean("netType",e)}))},setNetworkType:function(t){O("getNetworkType")&&G.getNetworkType({success:function(e){e=D(e.networkType),t.extendBean("netType",e)}})},refreshNetwork:function(t){var e=this;this.timer&&clearTimeout(this.timer),this.setNetworkType(t),this.timer=setTimeout((function(){e.refreshNetwork(t)}),1e4)}}),$=G.request,J=(e(_t,j=q),Object.defineProperty(_t.prototype,"getBean",{get:function(){var t=this;return this.bean?Object.getOwnPropertyNames(this.bean).map((function(e){return e+"="+t.bean[e]})).join("&")+"&from="+encodeURIComponent(P(this.config)):"from="+encodeURIComponent(P(this.config))},enumerable:!1,configurable:!0}),_t.prototype.initOfflineLog=function(){_t.use(Z)},_t.prototype.uploadLogs=function(t,e){this.lifeCycle.emit("uploadLogs",t=void 0===t?{}:t,e=void 0===e?{}:e)},_t.prototype.reportPv=function(t){var e,n=this;t&&(e=Object.getOwnPropertyNames(this.bean).filter((function(t){return"id"!==t})).map((function(t){return t+"="+n.bean[t]})).join("&")+"&from="+encodeURIComponent(P(this.config)),this.send({url:this.config.url+"/"+t+"?"+e,addBean:!1,type:m.CUSTOM_PV,log:m.CUSTOM_PV},(function(){}),(function(){})))},_t.sessionID="session-"+Date.now(),_t.asyncPluginIndex=0,q=_t,new H({name:"aid",onNewAegis:function(t){this.initAid((function(e){t.bean.aid=e,t.config.aid=e}))},initAid:function(t){G.getStorage({key:"AEGIS_ID",success:function(e){t(e.data)},fail:function(){var e="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(t){var e=16*Math.random()|0;return("x"===t?e:3&e|8).toString(16)}));G.setStorage({key:"AEGIS_ID",data:e,success:function(){t(e)}})}})}})),Q=(vt.prototype.addCallback=function(t){t&&this.callbacks.push(t)},vt.prototype.prefixHandler=function(t){return n(n({},t),{aegisRequestStartTime:+new Date})},vt.prototype.successHandler=function(t,e){var n;this.callbacks.forEach((function(n){var r;try{null!=(r=n.success)&&r.call(n,t,e)}catch(n){}})),null!=(n=e.success)&&n.call(e,t,e)},vt.prototype.failHandler=function(t,e){var n;this.callbacks.forEach((function(n){var r;try{null!=(r=n.fail)&&r.call(n,t,e)}catch(n){}})),null!=(n=e.fail)&&n.call(e,t,e)},vt.prototype.completeHandler=function(t,e){var n;this.callbacks.forEach((function(n){var r;try{null!=(r=n.complete)&&r.call(n,t,e)}catch(n){}})),null!=(n=e.complete)&&n.call(e,t,e)},vt.prototype.override=function(){try{this.defineApiProperty()}catch(t){console.warn("cannot override `"+this.apiName+"`, error is: "+t)}finally{this.isOverride=!0}},vt),tt=wx||qq,et={},nt=(e(yt,N=Q),yt.prototype.defineApiProperty=function(){var t=this;tt.cloud&&tt.cloud[this.apiName]&&Object.defineProperty(tt.cloud,this.apiName,{get:function(){return t.hackHandler.bind(t)}})},yt.prototype.hackHandler=function(t){var e=this,r=this.prefixHandler(t);return new Promise((function(t,i){var o=null==(o=et[e.apiName])?void 0:o.originApi;null!=o&&o(n(n({},r),{success:function(n){e.successHandler(n,r),t(n)},fail:function(t){e.failHandler(t,r),i(t)},complete:function(t){e.completeHandler(t,r)}}))}))},yt),rt=wx||qq,it={},ot=(e(mt,M=Q),mt.prototype.defineApiProperty=function(){var t=this;Object.defineProperty(rt,this.apiName,{get:function(){return t.hackHandler.bind(t)}})},mt.prototype.hackHandler=function(t){var e=this,r=this.prefixHandler(t);return null==(t=null==(t=it[this.apiName])?void 0:t.originApi)?void 0:t(n(n({},r),{success:function(t){e.successHandler(t,r)},fail:function(t){e.failHandler(t,r)},complete:function(t){e.completeHandler(t,r)}}))},mt),at=new H({name:"reportApiSpeed",override:!1,onNewAegis:function(t){this.override||(this.override=!0,this.hackRequest(t.config),this.overrideCallFunction(t.config),this.overrideCallContainer(t.config))},hackRequest:function(t){var e=this;I({apiName:"request",success:function(n,r){var i,o,a,s;t.hostUrl&&-1<r.url.indexOf(t.hostUrl)||(i={method:r.method||"get",url:l(r.url),duration:Date.now()-r.aegisRequestStartTime,status:n.statusCode||0,nextHopProtocol:"",isHttps:u(r.url),type:"fetch"},o=null==(o=t.api)?void 0:o.apiDetail,a=(s=h(n.data,t.api,{url:r.url,ctx:n})||{}).code,s=s.isErr,r="req url: "+i.url+" \n \nreq method: "+i.method+" \n \nreq param: "+(o?b(r.data):"")+" \n \nres duration: "+i.duration+"ms \n \nres status: "+(n.statusCode||0)+" \n \nres retcode: "+a+" \n \nres data: "+(o?d(n.data):""),e.publishNormalLog({msg:r,level:f.API_RESPONSE,ctx:n}),i.ret=a,i.isErr=+s,e.publishSpeedLog(i),s&&e.publishNormalLog({msg:r,level:f.RET_ERROR,ctx:n}))},fail:function(n,r){t.hostUrl&&-1<r.url.indexOf(t.hostUrl)||(r={method:r.method||"get",url:l(r.url),duration:Date.now()-r.aegisRequestStartTime,status:0,nextHopProtocol:"",isHttps:u(r.url),type:"fetch"},e.publishSpeedLog(r))}})},overrideCallFunction:function(t){var e=this;A({apiName:"callFunction",success:function(n,r){e.cloudSuccessCallback(t,r,n,"callFunction")},fail:function(t,n){n={method:"call",url:"wx.cloud.callFunction."+n.name,duration:Date.now()-n.aegisRequestStartTime,status:0,nextHopProtocol:"",type:"fetch",errMsg:t.errMsg,isHttps:!0},e.publishSpeedLog(n)}})},overrideCallContainer:function(t){var e=this;A({apiName:"callContainer",success:function(n,r){e.cloudSuccessCallback(t,r,n,"callContainer")},fail:function(t,n){n={method:"call",url:"wx.cloud.callContainer."+n.path,duration:Date.now()-n.aegisRequestStartTime,status:0,nextHopProtocol:"",type:"fetch",errMsg:t.errMsg,isHttps:!0},e.publishSpeedLog(n)}})},cloudSuccessCallback:function(t,e,n,r){var i="callFunction"===r?e.name:e.path,o="callFunction"===r?n.result:n.data,a=(i={method:"call",url:"wx.cloud."+r+"."+i,duration:Date.now()-e.aegisRequestStartTime,status:200,nextHopProtocol:"",type:"fetch",isHttps:!0},["apiName","aegisRequestStartTime","config","success","fail","complete"]),s=Object.keys(e).reduce((function(t,n){return a.includes(n)||(t[n]=e[n]),t}),{}),c=(r="callFunction"===r?(null==(r=n.data)?void 0:r.code)||0:n.statusCode,(l=h(o,t.api,{url:i.url,ctx:n})||{}).code),l=void 0!==(l=l.isErr)&&l;i.ret=c,i.isErr=+l,t=null==(c=t.api)?void 0:c.apiDetail,c="req url: "+i.url+"\n \nreq type: "+i.type+"\n \nreq params: "+(t?d(s):"")+"\n \nres status: "+r+"\n \nres retcode: "+i.ret+"\n \nres duration: "+i.duration+"ms \n \nres data: "+(t?d(o):"")+"\n ",this.publishNormalLog({msg:c,level:f.API_RESPONSE,ctx:n}),this.publishSpeedLog(i),l&&this.publishNormalLog({msg:c,level:f.RET_ERROR,ctx:n})},publishSpeedLog:function(t){this.$walk((function(e){e.speedLogPipeline(t)}))},publishNormalLog:function(t){this.$walk((function(e){e.normalLogPipeline(t)}))}}),st=wx||qq,ct=st.connectSocket,lt=(gt.prototype.addConfig=function(t){var e=t.send;t=t.onError,e&&this.sends.push(e),t&&this.onErrors.push(t)},gt.prototype.toHack=function(t){var e=this,r=(this.onErrors.forEach((function(e){t.onError(e)})),t.send);return Object.defineProperty(t,"send",{get:function(){return function(i){return new Promise((function(o){r.call(t,n(n({},i),{fail:function(t){e.sends.forEach((function(e){var n;null!=(n=e.fail)&&n.call(e,t,i)})),o(t)}}))}))}}}),t},gt),ut=(e(pt,L=Q),pt.prototype.addTaskConf=function(t){this.taskHack.addConfig(t)},pt.prototype.defineApiProperty=function(){var t=this;Object.defineProperty(st,"connectSocket",{get:function(){return t.hackHandler.bind(t)}})},pt.prototype.hackHandler=function(t){var e=this,r=this.prefixHandler(t);return t=ct(n(n({},r),{success:function(t){e.successHandler(t,r)},fail:function(t){e.failHandler(t,r)},complete:function(t){e.completeHandler(t,r)}})),this.taskHack.toHack(t),t},pt),ht=(Q=new H({name:"onError",onNewAegis:function(t){var e=G.getSystemInfoSync().SDKVersion;this.listenError(),this.hackNetWork(t),this.hackCloud(t),t.config.websocketHack&&R(e,"1.7.0")&&this.hackWsConnect()},listenError:function(){var t=this;"function"==typeof G.onError&&G.onError((function(e){e&&t.publishErrorLog({msg:e,level:f.ERROR})})),O("onUnhandledRejection")&&G.onUnhandledRejection((function(e){!(e=e.reason)||-1<JSON.stringify(e).indexOf("request:fail")||t.publishErrorLog({msg:e,level:f.PROMISE_ERROR})})),O("onPageNotFound")&&G.onPageNotFound((function(e){e&&t.publishErrorLog({msg:e,level:f.PAGE_NOT_FOUND_ERROR})}))},publishErrorLog:function(t){this.$walk((function(e){e.normalLogPipeline(t)}))},hackNetWork:function(t){for(var e=this,n=t.config,r=0,i=[{apiName:"request",complete:function(t,r){return e.requestCompleteError(t,r,n)}},{apiName:"uploadFile",complete:function(t,r){return e.uploadFileCompleteError(t,r,n)}},{apiName:"downloadFile",complete:function(t,r){return e.downloadFileCompleteError(t,r,n)}}];r<i.length;r++){var o;I({apiName:(o=i[r]).apiName,complete:o=o.complete})}},requestCompleteError:function(t,e,n){var r,i=t.errMsg,o=t.statusCode;n.hostUrl&&-1<(null==(r=e.url)?void 0:r.indexOf(n.hostUrl))||(r=this.getErrorType({errMsg:i,statusCode:o}))&&this.publishNetWorkError({apiName:"request",opts:e,res:t,config:n,type:r})},downloadFileCompleteError:function(t,e,n){var r=t.errMsg,i=t.statusCode,o=t.filePath,a=(t=t.tempFilePath,this.getErrorType({errMsg:r,statusCode:i}));a&&(n=null==(n=n.api)?void 0:n.apiDetail,this.publishErrorLog({msg:"AJAX_ERROR: downloadFile "+a+"\n \nres status: "+(i||0)+"\n \nres duration: "+(Date.now()-e.aegisRequestStartTime)+"ms\n \nres filePath: "+o+"\n \nres tempFilePath: "+t+"\n \nreq url: "+e.url+"\n \nreq method: "+(e.method||"get")+"\n \nreq param: "+(n?b(e.data):"")+"\n \nerrMsg: "+r.slice(0,1e3),level:f.AJAX_ERROR}))},uploadFileCompleteError:function(t,e,n){var r=t.errMsg,i=t.statusCode;(r=this.getErrorType({errMsg:r,statusCode:i}))&&this.publishNetWorkError({apiName:"uploadFile",opts:e,res:t,config:n,type:r})},hackCloud:function(t){for(var e=this,n=t.config,r=0,i=[{apiName:"callFunction",complete:function(t,r){return e.callFunctionCompleteError(t,r,n)}},{apiName:"callContainer",complete:function(t,r){return e.callContainerCompleteError(t,r,n)}}];r<i.length;r++){var o;A({apiName:(o=i[r]).apiName,complete:o=o.complete})}},callFunctionCompleteError:function(t,e,n){(-1<t.errMsg.indexOf("fail")||-1<t.errMsg.indexOf("timeout"))&&(n=null==(n=n.api)?void 0:n.apiDetail,this.publishErrorLog({msg:"AJAX_ERROR: cloud.callFunction:fail\n \nres status: 0\n \nres duration: "+(Date.now()-e.aegisRequestStartTime)+"ms\n \nres data: "+(n?b(t):"")+"\n \nreq url: cloud.callFunction."+e.name+"\n \nreq method: POST\n \nreq param: "+(n?b(e.data):"")+"\n \nerrMsg: "+t.errMsg.slice(0,1e3),level:f.AJAX_ERROR}))},callContainerCompleteError:function(t,e,n){var r=t.errMsg,i=t.statusCode;(400<=i||-1<r.indexOf("fail")||-1<r.indexOf("timeout"))&&(n=null==(n=n.api)?void 0:n.apiDetail,this.publishErrorLog({msg:"AJAX_ERROR: cloud.callContainer:fail\n \nres status: "+(i||0)+"\n \nres duration: "+(Date.now()-e.aegisRequestStartTime)+"ms\n \nres data: "+(n?b(t):"")+"\n \nreq url: "+e.path+"\n \nreq method: "+(e.method||"POST")+"\n \nreq param: "+(n?b(e.data):"")+"\n \nerrMsg: "+r.slice(0,1e3),level:f.AJAX_ERROR}))},publishNetWorkError:function(t){var e=t.apiName,n=t.opts,r=t.res,i=t.config,o=(t=t.type,r.errMsg),a=r.statusCode,s=r.data,c=null==(c=i.api)?void 0:c.apiDetail,l="wx.cloud.callFunction."+n.url;i=h(s,i.api,{url:l,ctx:r}).code,this.publishErrorLog({msg:"AJAX_ERROR: "+e+" "+t+"\n \nres status: "+(a||0)+"\n \nres retcode: "+i+"\n \nres duration: "+(Date.now()-n.aegisRequestStartTime)+"ms\n \nres data: "+(c?b(s):"")+"\n \nreq url: "+n.url+"\n \nreq method: "+(n.method||"get")+"\n \nreq param: "+(c?b(n.data):"")+"\n \nerrMsg: "+o.slice(0,1e3),level:f.AJAX_ERROR})},getErrorType:function(t){var e=t.errMsg,n=(t=t.statusCode,"");return-1<e.indexOf("timeout")||-1<e.indexOf("超时")?n="timeout":400<=t?n="error":(-1<e.indexOf("fail")||!t||t<0)&&(n="failed"),n},hackWsConnect:function(){var t,e,n=this;I({apiName:"sendSocketMessage",fail:function(t){n.publishSocketError(t)}}),t=(e={connectCallback:{fail:function(t){n.publishSocketError(t)}},taskOpt:{onError:function(t){n.publishSocketError(t)},send:{fail:function(t){n.publishSocketError(t)}}}}).connectCallback,e=e.taskOpt,F?F.addCallback(t):F=new ut(t),e&&F.addTaskConf(e)},publishSocketError:function(t){t&&this.publishErrorLog({msg:t.errMsg,level:f.WEBSOCKET_ERROR})}}),new H({name:"reportAssetSpeed",isStart:!1,onNewAegis:function(t){this.isStart||(this.isStart=!0,this.start(t))},start:function(){var t=this;G.getPerformance&&G.getPerformance().createObserver((function(e){null!=(e=e.getEntries())&&e.forEach((function(e){"number"!=typeof e.duration||e.duration<=0||t.publishAssetLog(e)}))})).observe({entryTypes:["resource"]})},generateLog:function(t){return{url:""+l(t.uri),method:"get",duration:Math.round(100*t.duration)/100,status:200,type:"static",isHttps:!0,urlQuery:"",nextHopProtocol:"",domainLookup:0,connectTime:0}},publishAssetLog:function(t){var e=this;this.$walk((function(n){n.speedLogPipeline(e.generateLog(t))}))}})),dt=["onLaunch","onHide","onError","onLoad","onReady","onShow","onUnload"],ft=new H({name:"pagePerformance",pageNavigationStartTime:{},onNewAegis:function(t){try{O("getPerformance")&&this.reportPerformance(t),this.setPagePV(t),this.reportSetDataTiming(t)}catch(t){}},reportPerformance:function(t){var e=this,n=null==(n=G.getPerformance())?void 0:n.createObserver((function(n){var r={},i=null==(i=n.getEntriesByName("appLaunch"))?void 0:i[0],o=null==(o=n.getEntriesByName("firstRender"))?void 0:o[0],a=null==(a=n.getEntriesByName("evaluateScript"))?void 0:a[0],s=null==(s=n.getEntriesByName("route"))?void 0:s[0],c=null==(c=null==(c=n.getEntriesByName("firstPaint"))?void 0:c[0])?void 0:c.startTime,l=null==(l=(null==(l=n.getEntriesByName("firstPaint"))?void 0:l[0])||(null==(l=n.getEntriesByName("route"))?void 0:l[0])||(null==(l=n.getEntriesByName("appLaunch"))?void 0:l[0]))?void 0:l.pageId,u=null==(n=(null==(u=n.getEntriesByName("route"))?void 0:u[0])||(null==(u=n.getEntriesByName("appLaunch"))?void 0:u[0]))?void 0:n.startTime;l&&(e.pageNavigationStartTime[l]=null,u&&(e.pageNavigationStartTime[l]=u)),i&&(r.appLaunch=i.duration),o&&(r.firstScreenTiming=o.duration),a&&(r.scriptEvaluateTiming=a.duration),s&&(r.pageRouteTiming=s.duration),c&&u?r.firstPaintTiming=Math.max(c-u,0):c&&e.pageNavigationStartTime[l]&&(r.firstPaintTiming=Math.max(c-e.pageNavigationStartTime[l],0)),e.publish(r,t)}));null!=n&&n.observe({entryTypes:["navigation","render","script"]})},publish:function(t,e){var n,r,i,o=[],a=e.config,s=-1===(null==(n=e.config.performanceUrl)?void 0:n.indexOf("?"))?"?":"&";for(r in t)o.push(r+"="+t[r]);"function"==typeof a.urlHandler?(i=a.urlHandler()||window.location.href,this.$walk((function(n){n.send({url:e.config.performanceUrl+s+o.join("&")+"&from="+encodeURIComponent(i),beanFilter:["from"],type:m.PERFORMANCE,log:t})}))):this.$walk((function(n){n.send({url:e.config.performanceUrl+s+o.join("&"),type:m.PERFORMANCE,log:t})}))},setPagePV:function(t){var e=this;G.onAppRoute&&G.onAppRoute((function(t){"appLaunch"!==t.openType&&(e.$walk((function(t){t.send({url:""+t.config.pvUrl,type:m.PV})})),e.reportPageLoaded(t))}))},reportPageLoaded:function(t){t="infoType: behaviorBacktracking\ndataType: pageLoadAndRoute\npageLoadedPath: "+t.path+"\nopenType: "+t.openType,this.publishNormalLog({msg:t,level:f.INFO})},publishNormalLog:function(t){this.$walk((function(e){e.normalLogPipeline(t)}))},reportSetDataTiming:function(t){var e,n,r,i,o,a,s,c,l,u,h=this;!0!==(u=(u=t.config).setDataReportConfig||(null==(u=u.pagePerformance)?void 0:u.setDataReportConfig)||{}).disabled&&(e=u.timeThreshold,n=!1!==u.withDataPaths,r=e&&0<+e?+e:30,i=k([x(t,10),function(e){e=e.map((function(t){return{type:m.SET_DATA,component:t.from,duration:t.duration,fields:t.dataPaths&&t.dataPaths.length?t.dataPaths.sort().join(";"):void 0,size:t.size}})),t.send({url:t.config.setDataReportUrl+"?payload="+encodeURIComponent(JSON.stringify({miniProgramData:e})),type:m.SET_DATA,log:e})}]),o=Page,a=Component,s=function(t,e){var n=0;return null!=t&&t.data?(e.forEach((function(e){for(var r=t.data[e[0]],i=1,o=e.length;i<o;i++)r[e[i]]&&(r=r[e[i]]);var a="";try{a=JSON.stringify(r)}catch(e){a=""}n+=2*(void 0===a?"":a).replace(/[\u4e00-\u9fa5]/g,"aa").length})),n=Math.min(n,10485760)):n},c=function(t,e){var o=e.updateStartTimestamp,a=e.updateEndTimestamp;e=void 0===(e=e.dataPaths)?[]:e,a-=o,isNaN(a)||a<r||(o={from:t.is,duration:a},n&&0<e.length&&Object.assign(o,{dataPaths:e.slice(0,30),size:s(t,e)}),i(o))},l=function(t){var e="infoType: behaviorBacktracking\ndataType: tapEvent"+Object.keys(t[0]).reduce((function(e,n){var r="";try{r=n+": "+JSON.stringify(t[0][n])}catch(e){r=""}return e+"\n"+r}),"");h.publishNormalLog({msg:e,level:f.INFO})},Page=function(t){var e=t.onReady;return t.onReady=function(){var t=this;return"function"==typeof this.setUpdatePerformanceListener&&this.setUpdatePerformanceListener({withDataPaths:n},(function(e){c(t,e)})),null==e?void 0:e.call(this)},Object.keys(t).forEach((function(e){var n;"function"!=typeof t[e]||dt.includes(e)||(n=t[e],t[e]=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return null!=t&&t[0]&&"tap"===t[0].type&&l(t),null==n?void 0:n.apply(this,t)})})),o(t)},Component=function(t){t.lifetimes&&t.lifetimes.attached?(e=t.lifetimes.attached,t.lifetimes.attached=function(){var t=this;return"function"==typeof this.setUpdatePerformanceListener&&this.setUpdatePerformanceListener({withDataPaths:n},(function(e){c(t,e)})),null==e?void 0:e.call(this)}):(r=t.attached,t.attached=function(){var t=this;return"function"==typeof this.setUpdatePerformanceListener&&this.setUpdatePerformanceListener({withDataPaths:n},(function(e){c(t,e)})),null==r?void 0:r.call(this)});var e,r,i=t.methods;return i&&"[object Object]"===Object.prototype.toString.call(i)&&Object.keys(i).forEach((function(t){var e;"function"==typeof i[t]&&(e=i[t],i[t]=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return null!=t&&t[0]&&"tap"===t[0].type&&l(t),null==e?void 0:e.apply(this,t)})})),a(t)})}});function pt(t){return(t=L.call(this,t)||this).taskHack=new lt,t}function gt(){this.onErrors=[],this.sends=[]}function mt(){return null!==M&&M.apply(this,arguments)||this}function yt(){return null!==N&&N.apply(this,arguments)||this}function vt(t){this.callbacks=[],this.isOverride=!1;var e=t.apiName;this.apiName=e,this.isOverride||this.override(),this.callbacks.push(t)}function _t(t){var e,r,i,o=j.call(this,t)||this;o.originRequest=$,o.speedLogPipeline=k([(r=o.config,i={},function(t,e){var n,o;r.speedSample?(o="object"==typeof r.repeat?r.repeat:{repeat:r.repeat},n=+o.speed||+o.repeat||5,Array.isArray(t)?(o=t.filter((function(t){var e=!i[t.url]||i[t.url]<n;return i[t.url]=1+~~i[t.url],e}))).length&&e(o):(!i[t.url]||i[t.url]<n)&&(i[t.url]=1+~~i[t.url],e(t))):e(t)}),x(o),function(t,n){O("getNetworkType")?G.getNetworkType({success:function(r){r=D(r.networkType),e.extendBean("netType",r),n(t)}}):n(t)},function(t,e){o.lifeCycle.emit("beforeReportSpeed",t);var n=o.config.beforeReportSpeed;if((t="function"==typeof n?t.filter((function(t){return!1!==n(t)})):t).length)return e(t)},C(e=o,m.SPEED),function(t){var e,r,i,a;o.send({url:""+o.config.speedUrl,method:"post",data:(e=o.bean,i={fetch:[],static:[],bridge:[]},a={},Array.isArray(t)?t.forEach((function(t){var e;null!=(e=i[t.type])&&e.push(t)})):null!=(r=i[t.type])&&r.push(t),a.payload=JSON.stringify(n({duration:i},e)),a)})}]),o.requestQueue=[],o.requesting=!1,o.request=function(t,e,r){if(t.url&&o.bean.id){var i,a,s,c,l;if(/^\w{8}-\w{4}-\w{4}-\w{4}-\w{12}$/.test(String(o.bean.aid))&&!(o.requesting||O("getNetworkType")&&void 0===o.bean.netType))return o.requesting=!0,i=t.url,o.config.whiteListUrl===i&&(a=e,e=function(t){null!=a&&a(JSON.stringify(t.data))}),!1!==t.addBean&&(i=i+(-1===i.indexOf("?")?"?":"&")+o.getBean),u=t.method||"get",s=function(){o.requesting=!1;var t=o.requestQueue.shift();t&&o.request(t.options,t.success,t.fail)},c=t,(c=(l=o.config.onBeforeRequest)?l(t,o):c)&&c.url?(l=o.config.enableHttp2||!1,"get"===u?(u=i,h=c.data,i="string"!=typeof u?"":"object"==typeof h&&h?(d=Object.getOwnPropertyNames(h).map((function(t){var e=h[t];return t+"="+("string"==typeof e?encodeURIComponent(e):encodeURIComponent(JSON.stringify(e)))})).join("&").replace(/eval/gi,"evaI"),u+(-1===u.indexOf("?")?"?":"&")+d):u,o.originRequest(n({url:i,enableHttp2:l,success:e,fail:r,complete:s},t.requestConfig))):("string"==typeof c.data&&(c.data=c.data.replace(/eval/gi,"evaI")),o.originRequest(n({url:i,enableHttp2:l,header:c.contentType?{"content-type":c.contentType}:void 0,method:"POST",data:c.data,success:e,fail:r,complete:s},t.requestConfig))),!0):(d="",c&&c.url||(d="Sending request blocked. Please handle the parameters reasonably, options.url is necessary",console.log(d)),null!=r&&r(d),s(),!1);o.requestQueue.push({options:t,success:e,fail:r})}var u,h,d};try{t.offlineLog&&o.initOfflineLog(),o.init(t),o.extendBean("sessionId",_t.sessionID),o.extendBean("referer",(O("getLaunchOptionsSync")?G.getLaunchOptionsSync():{scene:""}).scene||"")}catch(t){console.warn(t),console.log("%cThe above error occurred in the process of initializing Aegis, which will affect your normal use of Aegis.\nIt is recommended that you contact us for feedback and thank you for your support.","color: red"),o.sendSDKError(t)}return o}function bt(t){var e,n,r=this,i=void 0===(i=(t=void 0===t?{}:t).path)?"/.aegis.offline.log":i;t=void 0===(t=t.limit)?2e4:t,this.offlineBuffer=[],this.insertLog=(e=null,n=[],function(t){n=n.concat(t),e=e||setTimeout((function(){e=null;var t,i=r.fileSystem,o=r.filePath,a=n.map((function(t){return JSON.stringify(t)})).join("\n")+"\n";a&&(t=function(t){t?r.checkLimit(a,(function(){n=[]})):i.writeFile({data:a,filePath:o,encoding:"utf8",fail:function(t){console.error(t)},success:function(){n=[]}})},i.access({path:o,success:function(){t(!0)},fail:function(){t()}}))}),2e3)}),this.ready=function(t){r.fileSystem?setTimeout((function(){t(null)}),0):(t(new Error("getFileSystemManager file")),r.offlineLog=!1)},this.clearLogs=function(){var t=r.fileSystem,e=r.filePath;t.writeFile({filePath:e,data:"",fail:function(){t.unlinkSync(e)}})},this.save2Offline=function(t,e){t=(t=Array.isArray(t)?t:[t]).map((function(t){return"string"==typeof t&&(t={msg:t}),function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];if(0===t.length)throw new TypeError("Cannot convert undefined or null to object");for(var n=Object(t[0]),r=1;r<t.length;r++){var i=t[r];if(null!==i)for(var o in i)Object.prototype.hasOwnProperty.call(i,o)&&(n[o]=i[o])}return n}({id:e.id,uin:e.uin,time:+Date.now(),version:e.version,from:P(e)},t)})),r.fileSystem?r.insertLog(t):(r.fileSystem||r.offlineBuffer.length||r.ready((function(t){t?console.error(t):r.offlineBuffer.length&&(r.addLogs(r.offlineBuffer),r.offlineBuffer=[])})),r.offlineBuffer=r.offlineBuffer.concat(t))},this.addLogs=function(t){r.fileSystem&&r.insertLog(t)},this.filePath=G.env.USER_DATA_PATH+i,this.fileSystem=G.getFileSystemManager(),this.limitSize=t}function xt(t){this.aegisPlugin=!0,this.name="",this.instances=[],this.inited=!1,t.$walk=this.walk.bind(this),t.$getConfig=this.getConfig.bind(this),this.option=t,this.name=t.name}function wt(t){var e,n,r,i,o,s,c,l,u,h,d,p,g,y,v,_=this;this.isGetSample=!1,this.isHidden=!1,this.config={version:0,delay:1e3,onError:!0,repeat:5,random:1,aid:!0,device:!0,pagePerformance:!0,webVitals:!0,speedSample:!0,onClose:!0,hostUrl:"https://aegis.qq.com",websocketHack:!1,env:"production",url:"",offlineUrl:"",whiteListUrl:"",pvUrl:"",speedUrl:"",customTimeUrl:"",performanceUrl:"",webVitalsUrl:"",eventUrl:"",setDataReportUrl:"",reportImmediately:!0},this.isWhiteList=!1,this.lifeCycle=new a,this.bean={},this.normalLogPipeline=k([x(this,5),w,function(t,n){var r=e.config;n(t=t.map((function(t){var e,n=r.maxLength||204800;try{if(!t.msg||t.msg.length<=n)return t;t.msg=null==(e=t.msg)?void 0:e.substring(0,n)}catch(e){t.msg=b(t.msg).substring(0,r.maxLength)}return t})))},(y=(e=this).config,v={},function(t,e){var n="number"==typeof y.repeat?y.repeat:5;if(0===n)return e(t);e(t.filter((function(t){return t.level!==f.ERROR&&t.level!==f.PROMISE_ERROR&&t.level!==f.AJAX_ERROR&&t.level!==f.SCRIPT_ERROR&&t.level!==f.IMAGE_ERROR&&t.level!==f.CSS_ERROR&&t.level!==f.MEDIA_ERROR||(v[t.msg]=v[t.msg]||0,v[t.msg]+=1,!(v[t.msg]>n))})))}),(p=this.lifeCycle.emit,g=this.config,function(t,e){var n,r=g.logCreated;return"function"==typeof r?(n=t.filter((function(t){return!1!==r(t)})),p("beforeWrite",n),e(n)):(p("beforeWrite",t),e(t))}),(d=this,setTimeout((function(){var t=d.config.pvUrl,e=void 0===t?"":t;e&&d.sendPipeline([function(t,n){n({url:e,type:m.PV,fail:function(t){"403 forbidden"===t&&d.destroy()}})}],m.PV)(null)}),100),function(t,e){e(t)}),(u=l=c=!1,h=[],(o=this).lifeCycle.on("onConfigChange",(function(){s&&clearTimeout(s),s=setTimeout((function(){var t,e;!u&&o.config&&(u=!0,t=o.config.whiteListUrl,(e=void 0===t?"":t)&&o.sendPipeline([function(t,n){n({url:e,type:m.WHITE_LIST,success:function(t){l=!0;try{var e=t.data||JSON.parse(t),n=e.retcode,r=e.result,i=void 0===r?{}:r;if(0===n){if(c=i.is_in_white_list,o.isWhiteList=c,i.shutdown)return void o.destroy();0<=i.rate&&i.rate<=1&&(o.config.random=i.rate,o.isGetSample=!1)}o.isWhiteList&&h.length?W(o)(h.splice(0),(function(){})):!o.isWhiteList&&h.length&&(h.length=0);var a=o.config.onWhitelist;"function"==typeof a&&a(c)}catch(t){}},fail:function(t){"403 forbidden"===t&&o.destroy(),l=!0}})}],m.WHITE_LIST)(null),u=!1)}),o.config.uin?50:500)})),o.lifeCycle.on("destroy",(function(){h.length=0})),function(t,e){var n;c||null!=(n=null==(n=o.config)?void 0:n.api)&&n.reportRequest?e(t.concat(h.splice(0)).map((function(t){return B(t),t}))):(n=t.filter((function(t){return t.level!==f.INFO&&t.level!==f.API_RESPONSE?(B(t),!0):(l||(h.push(t),200<=h.length&&(h.length=200)),!1)}))).length&&e(n)}),function(t,e){try{var n=JSON.parse(JSON.stringify(t)),r=(_.lifeCycle.emit("beforeReport",n),_.config.beforeReport);(t="function"==typeof r?t.filter((function(t){return!1!==r(t)})):t).length&&e(t)}catch(t){}},W(this)]),this.eventPipeline=k([x(this,10),(i=this,function(t){i.sendPipeline([function(t,e){var n=t.map((function(t){return{name:t.name,ext1:t.ext1||i.config.ext1||"",ext2:t.ext2||i.config.ext2||"",ext3:t.ext3||i.config.ext3||""}}));e({url:i.config.eventUrl+"?payload="+encodeURIComponent(JSON.stringify(n)),type:m.EVENT,log:t,fail:function(t){"403 forbidden"===t&&i.destroy()}})}],m.EVENT)(t)})]),this.timeMap={},this.failRequestCount=0,this.customTimePipeline=k([x(this,10),(r=this,function(t){return r.sendPipeline([function(t,e){e({url:r.config.customTimeUrl+"?payload="+encodeURIComponent(JSON.stringify({custom:t})),type:m.CUSTOM,log:t,fail:function(t){"403 forbidden"===t&&r.destroy()}})}],m.CUSTOM)(t)})]),this.config=(n=this.config,void 0===(t=t.hostUrl)&&(t="https://aegis.qq.com"),n.url=n.url||t+"/collect",n.offlineUrl=n.offlineUrl||t+"/offline",n.whiteListUrl=n.whiteListUrl||t+"/collect/whitelist",n.pvUrl=n.pvUrl||t+"/collect/pv",n.eventUrl=n.eventUrl||t+"/collect/events",n.speedUrl=n.speedUrl||t+"/speed",n.customTimeUrl=n.customTimeUrl||t+"/speed/custom",n.performanceUrl=n.performanceUrl||t+"/speed/performance",n.webVitalsUrl=n.webVitalsUrl||t+"/speed/webvitals",n.setDataReportUrl=n.SetDataReportUrl||t+"/speed/miniProgramData",n),wt.instances.push(this)}return H=new H({name:"reportLoadPackageSpeed",isLoaded:!1,onNewAegis:function(t){this.isLoaded||(this.isLoaded=!0,this.start(t))},start:function(){var t=this;G.getPerformance&&G.getPerformance().createObserver((function(e){null!=(e=e.getEntries())&&e.forEach((function(e){"number"!=typeof e.duration||e.duration<=0||t.publishPackageLog(e)}))})).observe({entryTypes:["loadPackage"]})},generateLog:function(t){return[{type:m.LOAD_PACKAGE,packageName:t.packageName,size:Math.round(100*t.packageSize)/100,duration:Math.round(100*t.duration)/100}]},publishPackageLog:function(t){var e=this;this.$walk((function(n){var r=e.generateLog(t);n.send({url:n.config.setDataReportUrl+"?payload="+encodeURIComponent(JSON.stringify({miniProgramData:r})),type:m.LOAD_PACKAGE,log:r})}))}}),q.use(Q),q.use(at),q.use(J),q.use(ht),q.use(ft),q.use(H),q.use(X),q}()},1615:(t,e,n)=>{n.d(e,{Z:()=>wt});var r={};n.r(r),n.d(r,{Canvas:()=>O,Element:()=>k,HTMLElement:()=>E,HTMLMediaElement:()=>P,HTMLVideoElement:()=>R,Image:()=>j,MouseEvent:()=>$,PointerEvent:()=>V,Symbol:()=>tt,TouchEvent:()=>z,WebGLRenderingContext:()=>U,XMLHttpRequest:()=>lt,alert:()=>ht,blur:()=>ft,clearInterval:()=>yt,clearTimeout:()=>gt,devicePixelRatio:()=>d,focus:()=>dt,getComputedStyle:()=>ut,innerHeight:()=>p,innerWidth:()=>f,location:()=>et,navigator:()=>N,performance:()=>l,screen:()=>g,scrollX:()=>m,scrollY:()=>y,setInterval:()=>mt,setTimeout:()=>pt});const i={0:"animation-delay",1:"animation-direction",2:"animation-duration",3:"animation-fill-mode",4:"animation-iteration-count",5:"animation-name",6:"animation-play-state",7:"animation-timing-function",8:"background-attachment",9:"background-blend-mode",10:"background-clip",11:"background-color",12:"background-image",13:"background-origin",14:"background-position",15:"background-repeat",16:"background-size",17:"border-bottom-color",18:"border-bottom-left-radius",19:"border-bottom-right-radius",20:"border-bottom-style",21:"border-bottom-width",22:"border-collapse",23:"border-image-outset",24:"border-image-repeat",25:"border-image-slice",26:"border-image-source",27:"border-image-width",28:"border-left-color",29:"border-left-style",30:"border-left-width",31:"border-right-color",32:"border-right-style",33:"border-right-width",34:"border-top-color",35:"border-top-left-radius",36:"border-top-right-radius",37:"border-top-style",38:"border-top-width",39:"bottom",40:"box-shadow",41:"box-sizing",42:"break-after",43:"break-before",44:"break-inside",45:"caption-side",46:"clear",47:"clip",48:"color",49:"content",50:"cursor",51:"direction",52:"display",53:"empty-cells",54:"float",55:"font-family",56:"font-kerning",57:"font-size",58:"font-stretch",59:"font-style",60:"font-variant",61:"font-variant-ligatures",62:"font-variant-caps",63:"font-variant-numeric",64:"font-variant-east-asian",65:"font-weight",66:"height",67:"image-rendering",68:"isolation",69:"justify-items",70:"justify-self",71:"left",72:"letter-spacing",73:"line-height",74:"list-style-image",75:"list-style-position",76:"list-style-type",77:"margin-bottom",78:"margin-left",79:"margin-right",80:"margin-top",81:"max-height",82:"max-width",83:"min-height",84:"min-width",85:"mix-blend-mode",86:"object-fit",87:"object-position",88:"offset-distance",89:"offset-path",90:"offset-rotate",91:"opacity",92:"orphans",93:"outline-color",94:"outline-offset",95:"outline-style",96:"outline-width",97:"overflow-anchor",98:"overflow-wrap",99:"overflow-x",100:"overflow-y",101:"padding-bottom",102:"padding-left",103:"padding-right",104:"padding-top",105:"pointer-events",106:"position",107:"resize",108:"right",109:"scroll-behavior",110:"speak",111:"table-layout",112:"tab-size",113:"text-align",114:"text-align-last",115:"text-decoration",116:"text-decoration-line",117:"text-decoration-style",118:"text-decoration-color",119:"text-decoration-skip-ink",120:"text-underline-position",121:"text-indent",122:"text-rendering",123:"text-shadow",124:"text-size-adjust",125:"text-overflow",126:"text-transform",127:"top",128:"touch-action",129:"transition-delay",130:"transition-duration",131:"transition-property",132:"transition-timing-function",133:"unicode-bidi",134:"vertical-align",135:"visibility",136:"white-space",137:"widows",138:"width",139:"will-change",140:"word-break",141:"word-spacing",142:"word-wrap",143:"z-index",144:"zoom",145:"-webkit-appearance",146:"backface-visibility",147:"-webkit-border-horizontal-spacing",148:"-webkit-border-image",149:"-webkit-border-vertical-spacing",150:"-webkit-box-align",151:"-webkit-box-decoration-break",152:"-webkit-box-direction",153:"-webkit-box-flex",154:"-webkit-box-flex-group",155:"-webkit-box-lines",156:"-webkit-box-ordinal-group",157:"-webkit-box-orient",158:"-webkit-box-pack",159:"-webkit-box-reflect",160:"column-count",161:"column-gap",162:"column-rule-color",163:"column-rule-style",164:"column-rule-width",165:"column-span",166:"column-width",167:"align-content",168:"align-items",169:"align-self",170:"flex-basis",171:"flex-grow",172:"flex-shrink",173:"flex-direction",174:"flex-wrap",175:"justify-content",176:"-webkit-font-smoothing",177:"grid-auto-columns",178:"grid-auto-flow",179:"grid-auto-rows",180:"grid-column-end",181:"grid-column-start",182:"grid-template-areas",183:"grid-template-columns",184:"grid-template-rows",185:"grid-row-end",186:"grid-row-start",187:"grid-column-gap",188:"grid-row-gap",189:"-webkit-highlight",190:"hyphens",191:"-webkit-hyphenate-character",192:"-webkit-line-break",193:"-webkit-line-clamp",194:"-webkit-locale",195:"-webkit-margin-before-collapse",196:"-webkit-margin-after-collapse",197:"-webkit-mask-box-image",198:"-webkit-mask-box-image-outset",199:"-webkit-mask-box-image-repeat",200:"-webkit-mask-box-image-slice",201:"-webkit-mask-box-image-source",202:"-webkit-mask-box-image-width",203:"-webkit-mask-clip",204:"-webkit-mask-composite",205:"-webkit-mask-image",206:"-webkit-mask-origin",207:"-webkit-mask-position",208:"-webkit-mask-repeat",209:"-webkit-mask-size",210:"order",211:"perspective",212:"perspective-origin",213:"-webkit-print-color-adjust",214:"-webkit-rtl-ordering",215:"shape-outside",216:"shape-image-threshold",217:"shape-margin",218:"-webkit-tap-highlight-color",219:"-webkit-text-combine",220:"-webkit-text-decorations-in-effect",221:"-webkit-text-emphasis-color",222:"-webkit-text-emphasis-position",223:"-webkit-text-emphasis-style",224:"-webkit-text-fill-color",225:"-webkit-text-orientation",226:"-webkit-text-security",227:"-webkit-text-stroke-color",228:"-webkit-text-stroke-width",229:"transform",230:"transform-origin",231:"transform-style",232:"-webkit-user-drag",233:"-webkit-user-modify",234:"user-select",235:"-webkit-writing-mode",236:"-webkit-app-region",237:"buffered-rendering",238:"clip-path",239:"clip-rule",240:"mask",241:"filter",242:"flood-color",243:"flood-opacity",244:"lighting-color",245:"stop-color",246:"stop-opacity",247:"color-interpolation",248:"color-interpolation-filters",249:"color-rendering",250:"fill",251:"fill-opacity",252:"fill-rule",253:"marker-end",254:"marker-mid",255:"marker-start",256:"mask-type",257:"shape-rendering",258:"stroke",259:"stroke-dasharray",260:"stroke-dashoffset",261:"stroke-linecap",262:"stroke-linejoin",263:"stroke-miterlimit",264:"stroke-opacity",265:"stroke-width",266:"alignment-baseline",267:"baseline-shift",268:"dominant-baseline",269:"text-anchor",270:"writing-mode",271:"vector-effect",272:"paint-order",273:"d",274:"cx",275:"cy",276:"x",277:"y",278:"r",279:"rx",280:"ry",281:"caret-color",282:"line-break",display:"inline",dominantBaseline:"auto",emptyCells:"show",fill:"rgb(0, 0, 0)",fillOpacity:"1",fillRule:"nonzero",filter:"none",flex:"0 1 auto",flexBasis:"auto",flexDirection:"row",flexFlow:"row nowrap",flexGrow:"0",flexShrink:"1",flexWrap:"nowrap",float:"none",floodColor:"rgb(0, 0, 0)",floodOpacity:"1",font:'normal normal 400 normal 16px / normal "PingFang SC"',fontDisplay:"",fontFamily:'"PingFang SC"',fontFeatureSettings:"normal",fontKerning:"auto",fontSize:"16px",fontStretch:"100%",fontStyle:"normal",fontVariant:"normal",fontVariantCaps:"normal",fontVariantEastAsian:"normal",fontVariantLigatures:"normal",fontVariantNumeric:"normal",fontVariationSettings:"normal",fontWeight:"400",grid:"none / none / none / row / auto / auto",gridArea:"auto / auto / auto / auto",gridAutoColumns:"auto",gridAutoFlow:"row",gridAutoRows:"auto",gridColumn:"auto / auto",gridColumnEnd:"auto",gridColumnGap:"0px",gridColumnStart:"auto",gridGap:"0px 0px",gridRow:"auto / auto",gridRowEnd:"auto",gridRowGap:"0px",gridRowStart:"auto",gridTemplate:"none / none / none",gridTemplateAreas:"none",gridTemplateColumns:"none",gridTemplateRows:"none",height:"0px",hyphens:"manual",imageRendering:"auto",inlineSize:"0px",isolation:"auto",justifyContent:"normal",justifyItems:"normal",justifySelf:"auto",left:"auto",letterSpacing:"normal",lightingColor:"rgb(255, 255, 255)",lineBreak:"auto",lineHeight:"normal",listStyle:"disc outside none",listStyleImage:"none",listStylePosition:"outside",listStyleType:"disc",margin:"0px",marginBottom:"0px",marginLeft:"0px",marginRight:"0px",marginTop:"0px",marker:"",markerEnd:"none",markerMid:"none",markerStart:"none",mask:"none",maskType:"luminance",maxBlockSize:"none",maxHeight:"none",maxInlineSize:"none",maxWidth:"none",maxZoom:"",minBlockSize:"0px",minHeight:"0px",minInlineSize:"0px",minWidth:"0px",minZoom:"",mixBlendMode:"normal",objectFit:"fill",objectPosition:"50% 50%",offset:"none 0px auto 0deg",offsetDistance:"0px",offsetPath:"none",offsetRotate:"auto 0deg",opacity:"1",order:"0",orientation:"",orphans:"2",outline:"rgb(0, 0, 0) none 0px",outlineColor:"rgb(0, 0, 0)",outlineOffset:"0px",outlineStyle:"none",outlineWidth:"0px",overflow:"visible",overflowAnchor:"auto",overflowWrap:"normal",overflowX:"visible",overflowY:"visible",overscrollBehavior:"auto auto",overscrollBehaviorX:"auto",overscrollBehaviorY:"auto",padding:"0px",paddingBottom:"0px",paddingLeft:"0px",paddingRight:"0px",paddingTop:"0px",page:"",pageBreakAfter:"auto",pageBreakBefore:"auto",pageBreakInside:"auto",paintOrder:"fill stroke markers",perspective:"none",perspectiveOrigin:"0px 0px",placeContent:"normal normal",placeItems:"normal normal",placeSelf:"auto auto",pointerEvents:"auto",position:"static",quotes:"",r:"0px",resize:"none",right:"auto",rx:"auto",ry:"auto",scrollBehavior:"auto",shapeImageThreshold:"0",shapeMargin:"0px",shapeOutside:"none",shapeRendering:"auto",size:"",speak:"normal",src:"",stopColor:"rgb(0, 0, 0)",stopOpacity:"1",stroke:"none",strokeDasharray:"none",strokeDashoffset:"0px",strokeLinecap:"butt",strokeLinejoin:"miter",strokeMiterlimit:"4",strokeOpacity:"1",strokeWidth:"1px",tabSize:"8",tableLayout:"auto",textAlign:"start",textAlignLast:"auto",textAnchor:"start",textCombineUpright:"none",textDecoration:"none solid rgb(0, 0, 0)",textDecorationColor:"rgb(0, 0, 0)",textDecorationLine:"none",textDecorationSkipInk:"auto",textDecorationStyle:"solid",textIndent:"0px",textOrientation:"mixed",textOverflow:"clip",textRendering:"auto",textShadow:"none",textSizeAdjust:"auto",textTransform:"none",textUnderlinePosition:"auto",top:"auto",touchAction:"auto",transform:"none",transformBox:"view-box",transformOrigin:"0px 0px",transformStyle:"flat",transition:"all 0s ease 0s",transitionDelay:"0s",transitionDuration:"0s",transitionProperty:"all",transitionTimingFunction:"ease",unicodeBidi:"normal",unicodeRange:"",userSelect:"auto",userZoom:"",vectorEffect:"none",verticalAlign:"baseline",visibility:"visible",webkitAppRegion:"no-drag",webkitAppearance:"none",webkitBorderAfter:"0px none rgb(0, 0, 0)",webkitBorderAfterColor:"rgb(0, 0, 0)",webkitBorderAfterStyle:"none",webkitBorderAfterWidth:"0px",webkitBorderBefore:"0px none rgb(0, 0, 0)",webkitBorderBeforeColor:"rgb(0, 0, 0)",webkitBorderBeforeStyle:"none",webkitBorderBeforeWidth:"0px",webkitBorderEnd:"0px none rgb(0, 0, 0)",webkitBorderEndColor:"rgb(0, 0, 0)",webkitBorderEndStyle:"none",webkitBorderEndWidth:"0px",webkitBorderHorizontalSpacing:"0px",webkitBorderImage:"none",webkitBorderStart:"0px none rgb(0, 0, 0)",webkitBorderStartColor:"rgb(0, 0, 0)",webkitBorderStartStyle:"none",webkitBorderStartWidth:"0px",webkitBorderVerticalSpacing:"0px",webkitBoxAlign:"stretch",webkitBoxDecorationBreak:"slice",webkitBoxDirection:"normal",webkitBoxFlex:"0",webkitBoxFlexGroup:"1",webkitBoxLines:"single",webkitBoxOrdinalGroup:"1",webkitBoxOrient:"horizontal",webkitBoxPack:"start",webkitBoxReflect:"none",webkitColumnBreakAfter:"auto",webkitColumnBreakBefore:"auto",webkitColumnBreakInside:"auto",webkitFontSizeDelta:"",webkitFontSmoothing:"auto",webkitHighlight:"none",webkitHyphenateCharacter:"auto",webkitLineBreak:"auto",webkitLineClamp:"none",webkitLocale:"auto",webkitLogicalHeight:"0px",webkitLogicalWidth:"0px",webkitMarginAfter:"0px",webkitMarginAfterCollapse:"collapse",webkitMarginBefore:"0px",webkitMarginBeforeCollapse:"collapse",webkitMarginBottomCollapse:"collapse",webkitMarginCollapse:"",webkitMarginEnd:"0px",webkitMarginStart:"0px",webkitMarginTopCollapse:"collapse",webkitMask:"",webkitMaskBoxImage:"none",webkitMaskBoxImageOutset:"0px",webkitMaskBoxImageRepeat:"stretch",webkitMaskBoxImageSlice:"0 fill",webkitMaskBoxImageSource:"none",webkitMaskBoxImageWidth:"auto",webkitMaskClip:"border-box",webkitMaskComposite:"source-over",webkitMaskImage:"none",webkitMaskOrigin:"border-box",webkitMaskPosition:"0% 0%",webkitMaskPositionX:"0%",webkitMaskPositionY:"0%",webkitMaskRepeat:"repeat",webkitMaskRepeatX:"",webkitMaskRepeatY:"",webkitMaskSize:"auto",webkitMaxLogicalHeight:"none",webkitMaxLogicalWidth:"none",webkitMinLogicalHeight:"0px",webkitMinLogicalWidth:"0px",webkitPaddingAfter:"0px",webkitPaddingBefore:"0px",webkitPaddingEnd:"0px",webkitPaddingStart:"0px",webkitPerspectiveOriginX:"",webkitPerspectiveOriginY:"",webkitPrintColorAdjust:"economy",webkitRtlOrdering:"logical",webkitRubyPosition:"before",webkitTapHighlightColor:"rgba(0, 0, 0, 0.4)",webkitTextCombine:"none",webkitTextDecorationsInEffect:"none",webkitTextEmphasis:"",webkitTextEmphasisColor:"rgb(0, 0, 0)",webkitTextEmphasisPosition:"over right",webkitTextEmphasisStyle:"none",webkitTextFillColor:"rgb(0, 0, 0)",webkitTextOrientation:"vertical-right",webkitTextSecurity:"none",webkitTextStroke:"",webkitTextStrokeColor:"rgb(0, 0, 0)",webkitTextStrokeWidth:"0px",webkitTransformOriginX:"",webkitTransformOriginY:"",webkitTransformOriginZ:"",webkitUserDrag:"auto",webkitUserModify:"read-only",webkitWritingMode:"horizontal-tb",whiteSpace:"normal",widows:"2",width:"0px",willChange:"auto",wordBreak:"normal",wordSpacing:"0px",wordWrap:"normal",writingMode:"horizontal-tb",x:"0px",y:"0px",zIndex:"auto",zoom:"1"};const o=function(t){const e=t.width,n=t.height;return Object.assign(i,{display:"inline",position:"static",inlineSize:e+"px",perspectiveOrigin:e/2+"px "+n/2+"px",transformOrigin:e/2+"px "+n/2+"px",webkitLogicalWidth:e+"px",webkitLogicalHeight:n+"px",width:e+"px",height:n+"px"})};const a=function(t){const e=t.getBoundingClientRect();return Object.assign(i,{display:"inline",position:"static",inlineSize:e.width+"px",perspectiveOrigin:e.width/2+"px "+e.height/2+"px",transformOrigin:e.width/2+"px "+e.height/2+"px",webkitLogicalWidth:e.width+"px",webkitLogicalHeight:e.height+"px",width:e.width+"px",height:e.height+"px"})};function s(){}let c;if(wx.getPerformance){const{platform:t}=wx.getSystemInfoSync(),e=wx.getPerformance(),n=e.now(),r=Object.assign({},e,{now:function(){return(e.now()-n)/1e3}});c="devtools"===t?e:r}else c={timeOrigin:Date.now(),now:function(){return Date.now()-this.timeOrigin}};const l=c,{screenWidth:u,screenHeight:h,devicePixelRatio:d}=wx.getSystemInfoSync(),f=u,p=h,g={width:u,height:h,availWidth:f,availHeight:p,availLeft:0,availTop:0},m=0,y=0;function v(t,e){if(!("parentNode"in t)){let r;r=0===e?function(){return null}:1===e?function(){return(n.g.document||wx.window.document).documentElement}:function(){if(!n.g||!n.g.document||!wx.window.document)return;return(n.g.document||wx.window.document).body},Object.defineProperty(t,"parentNode",{enumerable:!0,get:r})}if(!("parentElement"in t)){let r;r=0===e?function(){return null}:1===e?function(){return document.documentElement}:function(){return(n.g.document||wx.window.document).body},Object.defineProperty(t,"parentElement",{enumerable:!0,get:r})}}function _(t){t.style=t.style||{},Object.assign(t.style,{top:"0px",left:"0px",width:f+"px",height:p+"px",margin:"0px",padding:"0px"})}function b(t,e){"clientLeft"in t||(t.clientLeft=t._left||0,t.clientTop=t._top||0),"clientWidth"in t||(t.clientWidth=t._width||f,t.clientHeight=t._height||p),"getBoundingClientRect"in t||(t.getBoundingClientRect=function(){const e={x:0,y:0,top:0,left:0,width:t._width||this.clientWidth,height:t._height||this.clientHeight};return e.right=e.width,e.bottom=e.height,e})}function x(t){"offsetLeft"in t||(t.offsetLeft=0,t.offsetTop=0),"offsetWidth"in t||(t.offsetWidth=f,t.offsetHeight=p)}function w(t){const e=function(){};t.classList=[],t.classList.add=e,t.classList.remove=e,t.classList.contains=e,t.classList.toggle=e}const C=new WeakMap;class T{constructor(){C.set(this,{})}addEventListener(t,e,n={}){let r=C.get(this);r||(r={},C.set(this,r)),r[t]||(r[t]=[]),r[t].push(e),n.capture,n.once,n.passive}removeEventListener(t,e,n={}){const r=C.get(this);if(r){const n=r[t];if(n&&n.length>0)for(let t=n.length;t--;t>0)if(n[t]===e){n.splice(t,1);break}}}dispatchEvent(t={}){const e=C.get(this)[t.type];if(e)for(let n=0;n<e.length;n++)e[n](t)}}class S extends T{constructor(){super(),this.childNodes=[]}appendChild(t){this.childNodes.push(t)}cloneNode(){const t=Object.create(this);return Object.assign(t,this),t}removeChild(t){const e=this.childNodes.findIndex((e=>e===t));return e>-1?this.childNodes.splice(e,1):null}}class k extends S{constructor(){super(),this.className="",this.children=[]}setAttribute(t,e){this[t]=e}getAttribute(t){return this[t]}setAttributeNS(t,e){this[t]=e}getAttributeNS(t){return this[t]}}class E extends k{constructor(t="",e){var n;super(),this.className="",this.children=[],this.focus=s,this.blur=s,this.insertBefore=s,this.appendChild=s,this.removeChild=s,this.remove=s,this.innerHTML="",this.tagName=t.toUpperCase(),v(this,e),_(this),w(this),b(this),x(this),"scrollLeft"in(n=this)||(n.scrollLeft=0,n.scrollTop=0),"scrollWidth"in n||(n.scrollWidth=f,n.scrollHeight=p)}}class P extends E{constructor(t){super(t)}addTextTrack(){}captureStream(){}fastSeek(){}load(){}pause(){}play(){}}class R extends P{constructor(){super("video")}}function O(t){let e=t;t||(e=wx.createOffscreenCanvas({type:"webgl"})),"tagName"in e||(e.tagName="CANVAS"),e.type="canvas",v(e),_(e),w(e),b(e),x(e),e.focus=function(){},e.blur=function(){};let n={};return e.addEventListener=function(t,e,r={}){void 0===n[t]&&(n[t]=[]),-1===n[t].indexOf(e)&&n[t].push(e)},e.removeEventListener=function(t,e){const r=n[t];if(void 0!==r){const t=r.indexOf(e);-1!==t&&r.splice(t,1)}},e.dispatchEvent=function(t={}){const e=n[t.type];if(void 0!==e){t.target=this;const n=e.slice(0);for(let e=0,r=n.length;e<r;e++)n[e].call(this,t)}},e}const D=wx.getSystemInfoSync(),A=D.system,I=D.platform,F=D.language,L=-1!==A.toLowerCase().indexOf("android")?"Android; CPU Android 6.0":"iPhone; CPU iPhone OS 10_3_1 like Mac OS X",M={platform:I,language:F,appVersion:`5.0 (${L}) AppleWebKit/601.1.46 (KHTML, like Gecko) Version/9.0 Mobile/13B143 Safari/601.1`,userAgent:`Mozilla/5.0 (${L}) AppleWebKit/603.1.30 (KHTML, like Gecko) Mobile/14E8301 MicroMessenger/6.6.0 MiniGame NetType/WIFI Language/${F}`,onLine:!0,geolocation:{getCurrentPosition:s,watchPosition:s,clearWatch:s}};wx.onNetworkStatusChange&&wx.onNetworkStatusChange((function(t){M.onLine=t.isConnected}));const N=M;function j(){try{let t;j._context;return wx&&wx.createCanvas&&(t=wx.createCanvas().createImage()),"tagName"in t||(t.tagName="IMG"),v(t),w(t),t.__proto__.__proto__=wx.createCanvas().createImage.prototype,t}catch(t){}}class U{constructor(){}}class B{constructor(t){this.cancelBubble=!1,this.cancelable=!1,this.target=null,this.currentTarget=null,this.preventDefault=s,this.stopPropagation=s,this.type=t,this.timeStamp=Date.now()}}class z extends B{constructor(t){super(t),this.touches=[],this.targetTouches=[],this.changedTouches=[],this.target=window.canvas,this.currentTarget=window.canvas}}function W(t){return e=>{const n=new z(t);n.changedTouches=e.changedTouches,n.touches=e.touches,n.targetTouches=Array.prototype.slice.call(e.touches),n.timeStamp=e.timeStamp,document.dispatchEvent(n)}}wx.onTouchStart&&wx.onTouchStart(W("touchstart")),wx.onTouchMove&&wx.onTouchMove(W("touchmove")),wx.onTouchEnd&&wx.onTouchEnd(W("touchend")),wx.onTouchCancel&&wx.onTouchCancel(W("touchcancel"));class V extends B{constructor(t){super(t)}}const q=["bubbles","cancelable","view","detail","screenX","screenY","clientX","clientY","ctrlKey","altKey","shiftKey","metaKey","button","relatedTarget","pointerId","width","height","pressure","tiltX","tiltY","pointerType","hwTimestamp","isPrimary","pageX","pageY","timeStamp"],H=[!1,!1,null,null,0,0,0,0,!1,!1,!1,!1,0,null,0,0,0,0,0,0,0,"",0,!1,0,0,0];function G(t,e,n){const r=new V(t);for(let t=0;t<q.length;t++){const n=q[t];r[n]=e[n]||H[t]}return r.type=t,r.target=window.canvas,r.currentTarget=window.canvas,r.buttons=function(t){let e=0;"touchstart"!==t&&"touchmove"!==t&&"pointerdown"!==t&&"pointermove"!==t||(e=1);return e}(t),r.which=r.buttons,r.pointerId=(e.identifier||0)+2,r.bubbles=!0,r.cancelable=!0,r.button=0,r.width=2*(e.radiusX||.5),r.height=2*(e.radiusY||.5),r.pressure=e.force||.5,r.isPrimary=function(t){return Y===t.identifier}(e),r.pointerType="touch",r.altKey=n.altKey,r.ctrlKey=n.ctrlKey,r.metaKey=n.metaKey,r.shiftKey=n.shiftKey,n.preventDefault&&(r.preventDefault=function(){n.preventDefault()}),r}let Y=null;function Z(t){null===Y&&(Y=t.identifier)}function K(t){Y===t.identifier&&(Y=null)}function X(t){return e=>{console.log("rawEvent",e);const n=e.changedTouches;for(let r=0;r<n.length;r++){const i=n[r];0===r&&"pointerdown"===t?Z(i):"pointerup"!==t&&"pointercancel"!==t||K(i);const o=G(t,i,e);console.log("event dispatch",o),document.dispatchEvent(o)}}}wx.onTouchStart&&wx.onTouchStart(X("pointerdown")),wx.onTouchMove&&wx.onTouchMove(X("pointermove")),wx.onTouchEnd&&wx.onTouchEnd(X("pointerup")),wx.onTouchCancel&&wx.onTouchCancel(X("pointercancel"));class $ extends B{constructor(t){super(t)}}let J=0;const Q=function(t){return`__${t}_${Math.floor(1e9*Math.random())}_${++J}__`};Q.iterator=Q("Symbol.iterator");const tt=Q,et={href:"clip.js",reload(){},replace(t){this.href=t}},nt=new WeakMap,rt=new WeakMap,it=new WeakMap,ot=new WeakMap,at=new WeakMap;function st(t,...e){"function"==typeof this[`on${t}`]&&this[`on${t}`].apply(this,e)}function ct(t){this.readyState=t,st.call(this,"readystatechange"),this.dispatchEvent("readystatechange")}class lt{static UNSEND=0;static OPENED=1;static HEADERS_RECEIVED=2;static LOADING=3;static DONE=4;onabort=null;onerror=null;onload=null;onloadstart=null;onprogress=null;ontimeout=null;onloadend=null;onreadystatechange=null;readyState=0;response=null;responseText=null;responseType="";responseXML=null;status=0;statusText="";upload={};withCredentials=!1;events={};constructor(){it.set(this,{"content-type":"application/x-www-form-urlencoded"}),ot.set(this,{})}abort(){const t=at.get(this);t&&t.abort()}getAllResponseHeaders(){const t=ot.get(this);return Object.keys(t).map((e=>`${e}: ${t[e]}`)).join("\n")}getResponseHeader(t){return ot.get(this)[t]}open(t,e){rt.set(this,t),nt.set(this,e),ct.call(this,lt.OPENED)}overrideMimeType(){}send(t=""){if(this.readyState!==lt.OPENED)throw new Error("Failed to execute 'send' on 'XMLHttpRequest': The object's state must be OPENED.");if(-1===nt.get(this).indexOf("http")){let t=n.g.resourceManager.stickerLoader.readJSONFile(nt.get(this)),e=200,r={};if("string"!=typeof t&&!(t instanceof ArrayBuffer))try{t=JSON.stringify(t)}catch(t){}if(this.status=e,ot.set(this,r),st.call(this,"loadstart"),this.dispatchEvent("loadstart"),ct.call(this,lt.HEADERS_RECEIVED),ct.call(this,lt.LOADING),this.response=t,t instanceof ArrayBuffer){this.responseText="";const e=new Uint8Array(t),n=e.byteLength;for(let t=0;t<n;t++)this.responseText+=String.fromCharCode(e[t])}else this.responseText=t;ct.call(this,lt.DONE),st.call(this,"load"),this.dispatchEvent("load"),st.call(this,"loadend"),this.dispatchEvent("loadend")}else wx.request({data:t,url:nt.get(this),method:rt.get(this),header:it.get(this),responseType:this.responseType,success:({data:t,statusCode:e,header:n})=>{if("string"!=typeof t&&!(t instanceof ArrayBuffer))try{t=JSON.stringify(t)}catch(t){}if(this.status=e,ot.set(this,n),st.call(this,"loadstart"),this.dispatchEvent("loadstart"),ct.call(this,lt.HEADERS_RECEIVED),ct.call(this,lt.LOADING),this.response=t,t instanceof ArrayBuffer){this.responseText="";const e=new Uint8Array(t),n=e.byteLength;for(let t=0;t<n;t++)this.responseText+=String.fromCharCode(e[t])}else this.responseText=t;ct.call(this,lt.DONE),st.call(this,"load"),this.dispatchEvent("load"),st.call(this,"loadend"),this.dispatchEvent("loadend")},fail:({errMsg:t})=>{-1!==t.indexOf("abort")?(st.call(this,"abort"),this.dispatchEvent("abort")):(st.call(this,"error",t),this.dispatchEvent("error",t)),st.call(this,"loadend"),this.dispatchEvent("loadend")}})}setRequestHeader(t,e){const n=it.get(this);n[t]=e,it.set(this,n)}addEventListener(t,e){this.events[t]||(this.events[t]=[]),this.events[t].push(e)}removeEventListener(t,e){const n=this.events[t];if(n&&n.length>0)for(let t=n.length;t--;t>0)if(n[t]===e){n.splice(t,1);break}}dispatchEvent(t,e={}){const n=this.events[t];if(n)for(let t=0;t<n.length;t++)n[t](e)}}function ut(t){const e=t.tagName;return"CANVAS"===e?a(t):"IMG"===e?o(t):i}function ht(t){console.log(t)}function dt(){}function ft(){}const pt=setTimeout,gt=clearTimeout,mt=setInterval,yt=clearInterval;const vt={},_t={readyState:"complete",visibilityState:"visible",hidden:!1,fullscreen:!0,location:et,scripts:[],style:{},ontouchstart:null,ontouchmove:null,ontouchend:null,onvisibilitychange:null,parentNode:null,parentElement:null,createElement:t=>"canvas"===(t=t.toLowerCase())?new O:"img"===t?new j:new E(t),createElementNS(t,e){return this.createElement(e)},createTextNode:t=>t,getElementById:t=>t===r.canvas.id?r.canvas:null,getElementsByTagName:t=>"head"===(t=t.toLowerCase())?[_t.head]:"body"===t?[_t.body]:"canvas"===t?[r.canvas]:[],getElementsByTagNameNS(t,e){return this.getElementsByTagName(e)},getElementsByName:t=>"head"===t?[_t.head]:"body"===t?[_t.body]:"canvas"===t?[r.canvas]:[],querySelector:t=>"head"===t?_t.head:"body"===t?_t.body:"canvas"===t||t===`#${r.canvas.id}`?r.canvas:null,querySelectorAll:t=>"head"===t?[_t.head]:"body"===t?[_t.body]:"canvas"===t?[r.canvas]:[],addEventListener(t,e){vt[t]||(vt[t]=[]),vt[t].push(e)},removeEventListener(t,e){const n=vt[t];if(n&&n.length>0)for(let t=n.length;t--;t>0)if(n[t]===e){n.splice(t,1);break}},dispatchEvent(t){const e=t.type,n=vt[e];if(n)for(let e=0;e<n.length;e++)n[e](t);t.target&&"function"==typeof t.target["on"+e]&&t.target["on"+e](t)}};function bt(t){return function(){_t.visibilityState=t?"visible":"hidden";const e=!t;if(_t.hidden===e)return;_t.hidden=e;const n=new B("visibilitychange");n.target=_t,n.timeStamp=Date.now(),_t.dispatchEvent(n)}}_t.documentElement=new class extends E{constructor(){super("html",0)}},_t.head=new E("head"),_t.body=new class extends E{constructor(){super("body",0)}},wx.onHide&&wx.onHide(bt(!1)),wx.onShow&&wx.onShow(bt(!0));const xt=_t;const wt=function(t){r.document=xt,r.addEventListener=(t,e)=>{r.document.addEventListener(t,e)},r.removeEventListener=(t,e)=>{r.document.removeEventListener(t,e)},r.dispatchEvent=function(t={}){},t.global={},t.global.wx={};for(const e in r)t[e]=r[e];t.window=r,t.document=r.document,t.global.window=r,t.Image._context=t,t.HTMLImageElement=t.global.wx.createImage}},9984:(t,e,n)=>{n.d(e,{nH:()=>c,pe:()=>l,sN:()=>s});var r=n(337),i=n(5127),o=n(6879);let a=new i.Y;async function s(t){return new Promise(((e,n)=>{let r=wx.getFileSystemManager();r.access({path:t,success:()=>{e(!0)},fail:n=>{r.mkdir({dirPath:t,success:()=>{e(!0)},fail:t=>{e(!1)}})}})}))}async function c(t){return new Promise(((e,n)=>{wx.getFileSystemManager().access({path:t,success:()=>{e(!0)},fail:t=>{e(!1)}})}))}async function l(t,e){return new Promise((async(n,i)=>{const l=`${wx.env.USER_DATA_PATH}/ar`,u=`${l}/${t}.zip`;await s(l),await c(u)?n():async function(t,e){return new Promise((async(n,i)=>{let a=wx.getFileSystemManager();console.log("加载资源",t,e);const s=`${t}.bin`,l=`${wx.env.USER_DATA_PATH}/ar/${s}`;await c(l)?(console.log("读取本地bin"),a.readFile({filePath:l,success:t=>{n(t.data)},fail:t=>{i({code:o.U.READ_FILE_CACHE_FAIL,message:r.Z.t("0011")}),console.log("read file cache error",t)}})):(console.log("拉取远程bin"),wx.request({url:e,responseType:"arrayBuffer",success:t=>{const{data:e}=t;a.writeFile({filePath:l,data:e,encoding:"binary",success:t=>{n(e)},fail:t=>{let e={code:o.U.REQUEST_FILE_FAIL,message:t.errMsg};t.errMsg.indexOf("maximum size")>-1&&(e.message=r.Z.t("0012")),i(e),console.log("wx cache write eroor",t)}})}}))}))}(t,e).then((e=>{let s=wx.getFileSystemManager(),c=new Uint8Array(e),u=c.length,h=c.slice(0,1024),d=c.slice(1024,u);a.init().then((()=>{let e=a.run(h,"");a.finish("");const c=new Uint8Array(u);c.set(e),c.set(d,e.length);let f=`${l}/${t}.zip`;s.writeFile({filePath:f,data:c.buffer,encoding:"binary",success:t=>{n(f)},fail:t=>{console.log(" temp zip write file error",t);let e={code:o.U.REQUEST_FILE_FAIL,message:t.errMsg};t.errMsg.indexOf("maximum size")>-1&&(e.message=r.Z.t("0012")),i(e)}})}))})).catch((e=>{i({msg:"fail",zip:t,error:e})}))}))}},7959:(t,e,n)=>{n.d(e,{s:()=>r});n(885);const r=new class{detectOnly;_config={beautify:!0,handLandmark:!1};get config(){return this._config}set config(t){this._config=t}constructor(t){t&&(this.config=t)}enableHandLandmark(){this.config.handLandmark=!0}checkEnabled(t){return!("beautify"!==t||!this.detectOnly)||("segmentation"!==t||!this.detectOnly)&&this.config[t]}setData(t){t&&(this.config=t)}}},5901:function(t,e,n){var r,i;!function(o){var a,s={};s.VERSION="1.6.1";var c={},l=function(t,e){return function(){return e.apply(t,arguments)}},u=function(){var t,e,n=arguments,r=n[0];for(e=1;e<n.length;e++)for(t in n[e])!(t in r)&&n[e].hasOwnProperty(t)&&(r[t]=n[e][t]);return r},h=function(t,e){return{value:t,name:e}};s.TRACE=h(1,"TRACE"),s.DEBUG=h(2,"DEBUG"),s.INFO=h(3,"INFO"),s.TIME=h(4,"TIME"),s.WARN=h(5,"WARN"),s.ERROR=h(8,"ERROR"),s.OFF=h(99,"OFF");var d=function(t){this.context=t,this.setLevel(t.filterLevel),this.log=this.info};d.prototype={setLevel:function(t){t&&"value"in t&&(this.context.filterLevel=t)},getLevel:function(){return this.context.filterLevel},enabledFor:function(t){var e=this.context.filterLevel;return t.value>=e.value},trace:function(){this.invoke(s.TRACE,arguments)},debug:function(){this.invoke(s.DEBUG,arguments)},info:function(){this.invoke(s.INFO,arguments)},warn:function(){this.invoke(s.WARN,arguments)},error:function(){this.invoke(s.ERROR,arguments)},time:function(t){"string"==typeof t&&t.length>0&&this.invoke(s.TIME,[t,"start"])},timeEnd:function(t){"string"==typeof t&&t.length>0&&this.invoke(s.TIME,[t,"end"])},invoke:function(t,e){a&&this.enabledFor(t)&&a(e,u({level:t},this.context))}};var f,p=new d({filterLevel:s.OFF});(f=s).enabledFor=l(p,p.enabledFor),f.trace=l(p,p.trace),f.debug=l(p,p.debug),f.time=l(p,p.time),f.timeEnd=l(p,p.timeEnd),f.info=l(p,p.info),f.warn=l(p,p.warn),f.error=l(p,p.error),f.log=f.info,s.setHandler=function(t){a=t},s.setLevel=function(t){for(var e in p.setLevel(t),c)c.hasOwnProperty(e)&&c[e].setLevel(t)},s.getLevel=function(){return p.getLevel()},s.get=function(t){return c[t]||(c[t]=new d(u({name:t},p.context)))},s.createDefaultHandler=function(t){(t=t||{}).formatter=t.formatter||function(t,e){e.name&&t.unshift("["+e.name+"]")};var e={},n=function(t,e){Function.prototype.apply.call(t,console,e)};return"undefined"==typeof console?function(){}:function(r,i){r=Array.prototype.slice.call(r);var o,a=console.log;i.level===s.TIME?(o=(i.name?"["+i.name+"] ":"")+r[0],"start"===r[1]?console.time?console.time(o):e[o]=(new Date).getTime():console.timeEnd?console.timeEnd(o):n(a,[o+": "+((new Date).getTime()-e[o])+"ms"])):(i.level===s.WARN&&console.warn?a=console.warn:i.level===s.ERROR&&console.error?a=console.error:i.level===s.INFO&&console.info?a=console.info:i.level===s.DEBUG&&console.debug?a=console.debug:i.level===s.TRACE&&console.trace&&(a=console.trace),t.formatter(r,i),n(a,r))}},s.useDefaults=function(t){s.setLevel(t&&t.defaultLevel||s.DEBUG),s.setHandler(s.createDefaultHandler(t))},s.setDefaults=s.useDefaults,void 0===(i="function"==typeof(r=s)?r.call(e,n,e,t):r)||(t.exports=i)}()},3125:(t,e,n)=>{n.d(e,{LE:()=>Q});var r=n(9043),i=n(7659),o=n(8306),a=n(1893),s=n(519),c=n(2064),l=n(8141),u=n(6340),h=n(1961),d=n(2794);n(4775);class f extends r.Geometry{constructor(t=!1){super(),this._buffer=new r.Buffer(null,t,!1),this._indexBuffer=new r.Buffer(null,t,!0),this.addAttribute("aVertexPosition",this._buffer,3,!1,i.vK.FLOAT).addAttribute("aTextureCoord",this._buffer,2,!1,i.vK.FLOAT).addAttribute("aColor",this._buffer,4,!0,i.vK.UNSIGNED_BYTE).addAttribute("aTextureId",this._buffer,1,!0,i.vK.FLOAT).addIndex(this._indexBuffer)}}class p{constructor(t,e=!0){p.prototype.__init.call(this),this.legacy=t,e&&(this.enabled=!0),this.legacy.proj=this}__init(){this._enabled=!1}get enabled(){return this._enabled}set enabled(t){this._enabled=t}clear(){}}var g,m;function y(t){const e=this.proj,n=this,r=t._worldID,i=n.localTransform,o=e.scaleAfterAffine&&e.affine>=2;n._localID!==n._currentLocalID&&(o?(i.a=n._cx,i.b=n._sx,i.c=n._cy,i.d=n._sy,i.tx=n.position._x,i.ty=n.position._y):(i.a=n._cx*n.scale._x,i.b=n._sx*n.scale._x,i.c=n._cy*n.scale._y,i.d=n._sy*n.scale._y,i.tx=n.position._x-(n.pivot._x*i.a+n.pivot._y*i.c),i.ty=n.position._y-(n.pivot._x*i.b+n.pivot._y*i.d)),n._currentLocalID=n._localID,e._currentProjID=-1);const a=e._projID;if(e._currentProjID!==a&&(e._currentProjID=a,e.updateLocalTransform(i),n._parentID=-1),n._parentID!==r){const i=t.proj;i&&!i._affine?e.world.setToMult(i.world,e.local):e.world.setToMultLegacy(t.worldTransform,e.local);const a=n.worldTransform;e.world.copyTo(a,e._affine,e.affinePreserveOrientation),o&&(a.a*=n.scale._x,a.b*=n.scale._x,a.c*=n.scale._y,a.d*=n.scale._y,a.tx-=n.pivot._x*a.a+n.pivot._y*a.c,a.ty-=n.pivot._x*a.b+n.pivot._y*a.d),n._parentID=r,n._worldID++}}!function(t){t[t.NONE=0]="NONE";t[t.BEFORE_PROJ=4]="BEFORE_PROJ";t[t.PROJ=5]="PROJ";t[t.ALL=9]="ALL"}(g||(g={})),function(t){t[t.NONE=0]="NONE";t[t.FREE=1]="FREE";t[t.AXIS_X=2]="AXIS_X";t[t.AXIS_Y=3]="AXIS_Y";t[t.POINT=4]="POINT";t[t.AXIS_XR=5]="AXIS_XR"}(m||(m={}));class v extends p{constructor(...t){super(...t),v.prototype.__init.call(this),v.prototype.__init2.call(this),v.prototype.__init3.call(this),v.prototype.__init4.call(this),v.prototype.__init5.call(this)}updateLocalTransform(t){}__init(){this._projID=0}__init2(){this._currentProjID=-1}__init3(){this._affine=m.NONE}__init4(){this.affinePreserveOrientation=!1}__init5(){this.scaleAfterAffine=!0}set affine(t){this._affine!==t&&(this._affine=t,this._currentProjID=-1,this.legacy._currentLocalID=-1)}get affine(){return this._affine}set enabled(t){t!==this._enabled&&(this._enabled=t,t?(this.legacy.updateTransform=y,this.legacy._parentID=-1):(this.legacy.updateTransform=a.wx.prototype.updateTransform,this.legacy._parentID=-1))}clear(){this._currentProjID=-1,this._projID=0}}class _ extends r.AbstractBatchRenderer{constructor(...t){super(...t),_.prototype.__init.call(this),_.prototype.__init2.call(this)}__init(){this.forceMaxTextures=0}getUniforms(t){return this.defUniforms}syncUniforms(t){if(!t)return;const e=this._shader;for(const n in t)e.uniforms[n]=t[n]}__init2(){this.defUniforms={}}buildDrawCalls(t,e,n){const i=this,{_bufferedElements:a,_attributeBuffer:s,_indexBuffer:c,vertexSize:l}=this,u=r.AbstractBatchRenderer._drawCallPool;let h=this._dcIndex,d=this._aIndex,f=this._iIndex,p=u[h];p.start=this._iIndex,p.texArray=t;for(let r=e;r<n;++r){const n=a[r],i=n._texture.baseTexture,g=o.YA[i.alphaMode?1:0][n.blendMode],m=this.getUniforms(n);a[r]=null,e<r&&(p.blend!==g||p.uniforms!==m)&&(p.size=f-p.start,e=r,p=u[++h],p.texArray=t,p.start=f),this.packInterleavedGeometry(n,s,c,d,f),d+=n.vertexData.length/2*l,f+=n.indices.length,p.blend=g,p.uniforms=m}e<n&&(p.size=f-p.start,++h),i._dcIndex=h,i._aIndex=d,i._iIndex=f}drawBatches(){const t=this._dcIndex,{gl:e,state:n,shader:i}=this.renderer,o=r.AbstractBatchRenderer._drawCallPool;let a=null,s=null;for(let r=0;r<t;r++){const{texArray:t,type:c,size:l,start:u,blend:h,uniforms:d}=o[r];s!==t&&(s=t,this.bindAndClearTexArray(t)),a!==d&&(a=d,this.syncUniforms(d),i.syncUniformGroup(this._shader.uniformGroup)),this.state.blendMode=h,n.set(this.state),e.drawElements(c,l,e.UNSIGNED_SHORT,2*u)}}contextChange(){if(!this.forceMaxTextures)return super.contextChange(),void this.syncUniforms(this.defUniforms);const t=this;t.MAX_TEXTURES=this.forceMaxTextures,this._shader=t.shaderGenerator.generateShader(this.MAX_TEXTURES),this.syncUniforms(this.defUniforms);for(let e=0;e<t._packedGeometryPoolSize;e++)t._packedGeometries[e]=new this.geometryClass;this.initFlushBuffers()}}r.Renderer.registerPlugin("batch2d",class{static create(t){const{vertex:e,fragment:n,vertexSize:i,geometryClass:a}=Object.assign({vertex:"precision highp float;\nattribute vec3 aVertexPosition;\nattribute vec2 aTextureCoord;\nattribute vec4 aColor;\nattribute float aTextureId;\n\nuniform mat3 projectionMatrix;\n\nvarying vec2 vTextureCoord;\nvarying vec4 vColor;\nvarying float vTextureId;\n\nvoid main(void){\ngl_Position.xyw = projectionMatrix * aVertexPosition;\ngl_Position.z = 0.0;\n\nvTextureCoord = aTextureCoord;\nvTextureId = aTextureId;\nvColor = aColor;\n}\n",fragment:"\nvarying vec2 vTextureCoord;\nvarying vec4 vColor;\nvarying float vTextureId;\nuniform sampler2D uSamplers[%count%];\n\nvoid main(void){\nvec4 color;\n%forloop%\ngl_FragColor = color * vColor;\n}",geometryClass:f,vertexSize:7},t);return class extends r.AbstractBatchRenderer{constructor(t){super(t),this.shaderGenerator=new r.BatchShaderGenerator(e,n),this.geometryClass=a,this.vertexSize=i}packInterleavedGeometry(t,e,n,r,i){const{uint32View:a,float32View:s}=e,c=r/this.vertexSize,l=t.uvs,u=t.indices,h=t.vertexData,d=t.vertexData2d,f=t._texture.baseTexture._batchLocation,p=Math.min(t.worldAlpha,1),g=p<1&&t._texture.baseTexture.alphaMode?(0,o.rA)(t._tintRGB,p):t._tintRGB+(255*p<<24);if(d){let t=0;for(let e=0;e<d.length;e+=3,t+=2)s[r++]=d[e],s[r++]=d[e+1],s[r++]=d[e+2],s[r++]=l[t],s[r++]=l[t+1],a[r++]=g,s[r++]=f}else for(let t=0;t<h.length;t+=2)s[r++]=h[t],s[r++]=h[t+1],s[r++]=1,s[r++]=l[t],s[r++]=l[t+1],a[r++]=g,s[r++]=f;for(let t=0;t<u.length;t++)n[i++]=c+u[t]}}}}.create({}));const b=[1,0,0,0,1,0,0,0,1];class x{static __initStatic(){this.IDENTITY=new x}static __initStatic2(){this.TEMP_MATRIX=new x}__init(){this.floatArray=null}constructor(t){x.prototype.__init.call(this),this.mat3=new Float64Array(t||b)}get a(){return this.mat3[0]/this.mat3[8]}set a(t){this.mat3[0]=t*this.mat3[8]}get b(){return this.mat3[1]/this.mat3[8]}set b(t){this.mat3[1]=t*this.mat3[8]}get c(){return this.mat3[3]/this.mat3[8]}set c(t){this.mat3[3]=t*this.mat3[8]}get d(){return this.mat3[4]/this.mat3[8]}set d(t){this.mat3[4]=t*this.mat3[8]}get tx(){return this.mat3[6]/this.mat3[8]}set tx(t){this.mat3[6]=t*this.mat3[8]}get ty(){return this.mat3[7]/this.mat3[8]}set ty(t){this.mat3[7]=t*this.mat3[8]}set(t,e,n,r,i,o){const a=this.mat3;return a[0]=t,a[1]=e,a[2]=0,a[3]=n,a[4]=r,a[5]=0,a[6]=i,a[7]=o,a[8]=1,this}toArray(t,e){this.floatArray||(this.floatArray=new Float32Array(9));const n=e||this.floatArray,r=this.mat3;return t?(n[0]=r[0],n[1]=r[1],n[2]=r[2],n[3]=r[3],n[4]=r[4],n[5]=r[5],n[6]=r[6],n[7]=r[7],n[8]=r[8]):(n[0]=r[0],n[1]=r[3],n[2]=r[6],n[3]=r[1],n[4]=r[4],n[5]=r[7],n[6]=r[2],n[7]=r[5],n[8]=r[8]),n}apply(t,e){e=e||new a.E9;const n=this.mat3,r=t.x,i=t.y,o=1/(n[2]*r+n[5]*i+n[8]);return e.x=o*(n[0]*r+n[3]*i+n[6]),e.y=o*(n[1]*r+n[4]*i+n[7]),e}translate(t,e){const n=this.mat3;return n[0]+=t*n[2],n[1]+=e*n[2],n[3]+=t*n[5],n[4]+=e*n[5],n[6]+=t*n[8],n[7]+=e*n[8],this}scale(t,e){const n=this.mat3;return n[0]*=t,n[1]*=e,n[3]*=t,n[4]*=e,n[6]*=t,n[7]*=e,this}scaleAndTranslate(t,e,n,r){const i=this.mat3;i[0]=t*i[0]+n*i[2],i[1]=e*i[1]+r*i[2],i[3]=t*i[3]+n*i[5],i[4]=e*i[4]+r*i[5],i[6]=t*i[6]+n*i[8],i[7]=e*i[7]+r*i[8]}applyInverse(t,e){e=e||new a.E9;const n=this.mat3,r=t.x,i=t.y,o=n[0],s=n[3],c=n[6],l=n[1],u=n[4],h=n[7],d=n[2],f=n[5],p=n[8],g=(p*u-h*f)*r+(-p*s+c*f)*i+(h*s-c*u),m=(-p*l+h*d)*r+(p*o-c*d)*i+(-h*o+c*l),y=(f*l-u*d)*r+(-f*o+s*d)*i+(u*o-s*l);return e.x=g/y,e.y=m/y,e}invert(){const t=this.mat3,e=t[0],n=t[1],r=t[2],i=t[3],o=t[4],a=t[5],s=t[6],c=t[7],l=t[8],u=l*o-a*c,h=-l*i+a*s,d=c*i-o*s;let f=e*u+n*h+r*d;return f?(f=1/f,t[0]=u*f,t[1]=(-l*n+r*c)*f,t[2]=(a*n-r*o)*f,t[3]=h*f,t[4]=(l*e-r*s)*f,t[5]=(-a*e+r*i)*f,t[6]=d*f,t[7]=(-c*e+n*s)*f,t[8]=(o*e-n*i)*f,this):this}identity(){const t=this.mat3;return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=1,t[5]=0,t[6]=0,t[7]=0,t[8]=1,this}clone(){return new x(this.mat3)}copyTo2dOr3d(t){const e=this.mat3,n=t.mat3;return n[0]=e[0],n[1]=e[1],n[2]=e[2],n[3]=e[3],n[4]=e[4],n[5]=e[5],n[6]=e[6],n[7]=e[7],n[8]=e[8],t}copyTo(t,e,n){const r=this.mat3,i=1/r[8],o=r[6]*i,a=r[7]*i;if(t.a=(r[0]-r[2]*o)*i,t.b=(r[1]-r[2]*a)*i,t.c=(r[3]-r[5]*o)*i,t.d=(r[4]-r[5]*a)*i,t.tx=o,t.ty=a,e>=2){let r=t.a*t.d-t.b*t.c;n||(r=Math.abs(r)),e===m.POINT?(r=r>0?1:-1,t.a=r,t.b=0,t.c=0,t.d=r):e===m.AXIS_X?(r/=Math.sqrt(t.b*t.b+t.d*t.d),t.c=0,t.d=r):e===m.AXIS_Y?(r/=Math.sqrt(t.a*t.a+t.c*t.c),t.a=r,t.c=0):e===m.AXIS_XR&&(t.a=t.d*r,t.c=-t.b*r)}return t}copyFrom(t){const e=this.mat3;return e[0]=t.a,e[1]=t.b,e[2]=0,e[3]=t.c,e[4]=t.d,e[5]=0,e[6]=t.tx,e[7]=t.ty,e[8]=1,this}setToMultLegacy(t,e){const n=this.mat3,r=e.mat3,i=t.a,o=t.b,a=t.c,s=t.d,c=t.tx,l=t.ty,u=r[0],h=r[1],d=r[2],f=r[3],p=r[4],g=r[5],m=r[6],y=r[7],v=r[8];return n[0]=u*i+h*a+d*c,n[1]=u*o+h*s+d*l,n[2]=d,n[3]=f*i+p*a+g*c,n[4]=f*o+p*s+g*l,n[5]=g,n[6]=m*i+y*a+v*c,n[7]=m*o+y*s+v*l,n[8]=v,this}setToMultLegacy2(t,e){const n=this.mat3,r=t.mat3,i=r[0],o=r[1],a=r[2],s=r[3],c=r[4],l=r[5],u=r[6],h=r[7],d=r[8],f=e.a,p=e.b,g=e.c,m=e.d,y=e.tx,v=e.ty;return n[0]=f*i+p*s,n[1]=f*o+p*c,n[2]=f*a+p*l,n[3]=g*i+m*s,n[4]=g*o+m*c,n[5]=g*a+m*l,n[6]=y*i+v*s+u,n[7]=y*o+v*c+h,n[8]=y*a+v*l+d,this}setToMult(t,e){const n=this.mat3,r=t.mat3,i=e.mat3,o=r[0],a=r[1],s=r[2],c=r[3],l=r[4],u=r[5],h=r[6],d=r[7],f=r[8],p=i[0],g=i[1],m=i[2],y=i[3],v=i[4],_=i[5],b=i[6],x=i[7],w=i[8];return n[0]=p*o+g*c+m*h,n[1]=p*a+g*l+m*d,n[2]=p*s+g*u+m*f,n[3]=y*o+v*c+_*h,n[4]=y*a+v*l+_*d,n[5]=y*s+v*u+_*f,n[6]=b*o+x*c+w*h,n[7]=b*a+x*l+w*d,n[8]=b*s+x*u+w*f,this}prepend(t){return t.mat3?this.setToMult(t,this):this.setToMultLegacy(t,this)}}x.__initStatic(),x.__initStatic2();const w="attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\n\nuniform mat3 projectionMatrix;\nuniform mat3 translationMatrix;\nuniform mat3 uTransform;\n\nvarying vec3 vTextureCoord;\n\nvoid main(void)\n{\ngl_Position.xyw = projectionMatrix * translationMatrix * vec3(aVertexPosition, 1.0);\n\nvTextureCoord = uTransform * vec3(aTextureCoord, 1.0);\n}\n",C=new x;class T extends r.ObjectRenderer{constructor(t){super(t),T.prototype.__init.call(this);const e={globals:this.renderer.globalUniforms};this.shader=r.Shader.from(w,"\nvarying vec3 vTextureCoord;\n\nuniform sampler2D uSampler;\nuniform vec4 uColor;\nuniform mat3 uMapCoord;\nuniform vec4 uClampFrame;\nuniform vec2 uClampOffset;\n\nvoid main(void)\n{\nvec2 coord = mod(vTextureCoord.xy / vTextureCoord.z - uClampOffset, vec2(1.0, 1.0)) + uClampOffset;\ncoord = (uMapCoord * vec3(coord, 1.0)).xy;\ncoord = clamp(coord, uClampFrame.xy, uClampFrame.zw);\n\nvec4 sample = texture2D(uSampler, coord);\ngl_FragColor = sample * uColor;\n}\n",e),this.simpleShader=r.Shader.from(w,"\nvarying vec3 vTextureCoord;\n\nuniform sampler2D uSampler;\nuniform vec4 uColor;\n\nvoid main(void)\n{\nvec4 sample = texture2D(uSampler, vTextureCoord.xy / vTextureCoord.z);\ngl_FragColor = sample * uColor;\n}\n",e)}__init(){this.quad=new r.QuadUv}render(t){const e=this.renderer,n=this.quad;let r=n.vertices;r[0]=r[6]=t._width*-t.anchor.x,r[1]=r[3]=t._height*-t.anchor.y,r[2]=r[4]=t._width*(1-t.anchor.x),r[5]=r[7]=t._height*(1-t.anchor.y),t.uvRespectAnchor&&(r=n.uvs,r[0]=r[6]=-t.anchor.x,r[1]=r[3]=-t.anchor.y,r[2]=r[4]=1-t.anchor.x,r[5]=r[7]=1-t.anchor.y),n.invalidate();const a=t._texture,s=a.baseTexture,c=t.tileProj.world,l=t.uvMatrix;let u=s.isPowerOfTwo&&a.frame.width===s.width&&a.frame.height===s.height;u&&(s._glTextures[e.CONTEXT_UID]?u=s.wrapMode!==i.Nt.CLAMP:s.wrapMode===i.Nt.CLAMP&&(s.wrapMode=i.Nt.REPEAT));const h=u?this.simpleShader:this.shader;C.identity(),C.scale(a.width,a.height),C.prepend(c),C.scale(1/t._width,1/t._height),C.invert(),u?C.prepend(l.mapCoord):(h.uniforms.uMapCoord=l.mapCoord.toArray(!0),h.uniforms.uClampFrame=l.uClampFrame,h.uniforms.uClampOffset=l.uClampOffset),h.uniforms.uTransform=C.toArray(!0),h.uniforms.uColor=(0,o.GT)(t.tint,t.worldAlpha,h.uniforms.uColor,s.premultiplyAlpha),h.uniforms.translationMatrix=t.worldTransform.toArray(!0),h.uniforms.uSampler=a,e.shader.bind(h,!1),e.geometry.bind(n,void 0),e.state.setBlendMode((0,o.D)(t.blendMode,s.premultiplyAlpha)),e.geometry.draw(i.lg.TRIANGLES,6,0)}}const S=new a.E9,k=[new a.E9,new a.E9,new a.E9,new a.E9],E=new a.Ae,P=new x;class R extends v{constructor(t,e){super(t,e),R.prototype.__init.call(this),R.prototype.__init2.call(this),R.prototype.__init3.call(this),this.local=new x,this.world=new x}__init(){this.matrix=new x}__init2(){this.pivot=new a.AB(this.onChange,this,0,0)}__init3(){this.reverseLocalOrder=!1}onChange(){const t=this.pivot,e=this.matrix.mat3;e[6]=-(t._x*e[0]+t._y*e[3]),e[7]=-(t._x*e[1]+t._y*e[4]),this._projID++}setAxisX(t,e=1){const n=t.x,r=t.y,i=Math.sqrt(n*n+r*r),o=this.matrix.mat3;o[0]=n/i,o[1]=r/i,o[2]=e/i,this.onChange()}setAxisY(t,e=1){const n=t.x,r=t.y,i=Math.sqrt(n*n+r*r),o=this.matrix.mat3;o[3]=n/i,o[4]=r/i,o[5]=e/i,this.onChange()}mapSprite(t,e){const n=t.texture;E.x=-t.anchor.x*n.orig.width,E.y=-t.anchor.y*n.orig.height,E.width=n.orig.width,E.height=n.orig.height,this.mapQuad(E,e)}mapQuad(t,e){k[0].set(t.x,t.y),k[1].set(t.x+t.width,t.y),k[2].set(t.x+t.width,t.y+t.height),k[3].set(t.x,t.y+t.height);let n=1,r=2,i=3;if(0===function(t,e,n,r,i){const o=e.x-t.x,a=n.x-r.x,s=n.x-t.x,c=e.y-t.y,l=n.y-r.y,u=n.y-t.y,h=o*l-c*a;if(Math.abs(h)<1e-7)return i.x=o,i.y=c,0;const d=(s*l-u*a)/h,f=(o*u-c*s)/h;return f<1e-6||f-1>-1e-6?-1:(i.x=t.x+d*(e.x-t.x),i.y=t.y+d*(e.y-t.y),1)}(e[0],e[2],e[1],e[3],S))return;n=1,r=3,i=2;const o=Math.sqrt((e[0].x-S.x)*(e[0].x-S.x)+(e[0].y-S.y)*(e[0].y-S.y)),a=Math.sqrt((e[n].x-S.x)*(e[n].x-S.x)+(e[n].y-S.y)*(e[n].y-S.y)),s=Math.sqrt((e[r].x-S.x)*(e[r].x-S.x)+(e[r].y-S.y)*(e[r].y-S.y)),c=Math.sqrt((e[i].x-S.x)*(e[i].x-S.x)+(e[i].y-S.y)*(e[i].y-S.y)),l=(o+c)/c,u=(a+s)/s,h=(a+s)/a;let d=this.matrix.mat3;d[0]=k[0].x*l,d[1]=k[0].y*l,d[2]=l,d[3]=k[n].x*u,d[4]=k[n].y*u,d[5]=u,d[6]=k[r].x*h,d[7]=k[r].y*h,d[8]=h,this.matrix.invert(),d=P.mat3,d[0]=e[0].x,d[1]=e[0].y,d[2]=1,d[3]=e[n].x,d[4]=e[n].y,d[5]=1,d[6]=e[r].x,d[7]=e[r].y,d[8]=1,this.matrix.setToMult(P,this.matrix),this._projID++}updateLocalTransform(t){0!==this._projID?this.reverseLocalOrder?this.local.setToMultLegacy2(this.matrix,t):this.local.setToMultLegacy(t,this.matrix):this.local.copyFrom(t)}clear(){super.clear(),this.matrix.identity(),this.pivot.set(0,0)}}function O(){return this.proj.affine?this.transform.worldTransform:this.proj.world}class D extends s.W2{constructor(){super(),this.proj=new R(this.transform)}toLocal(t,e,n,r,i=g.ALL){return e&&(t=e.toGlobal(t,n,r)),r||this._recursivePostUpdateTransform(),i>=g.PROJ?(r||this.displayObjectUpdateTransform(),this.proj.affine?this.transform.worldTransform.applyInverse(t,n):this.proj.world.applyInverse(t,n)):(this.parent?n=this.parent.worldTransform.applyInverse(t,n):(n.x=t.x,n.y=t.y),i===g.NONE?n:this.transform.localTransform.applyInverse(n,n))}get worldTransform(){return this.proj.affine?this.transform.worldTransform:this.proj.world}}const A=D.prototype.toLocal;class I extends l.Kj{static __initStatic(){this.defaultVertexShader="precision highp float;\nattribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\n\nuniform mat3 projectionMatrix;\nuniform mat3 translationMatrix;\nuniform mat3 uTextureMatrix;\n\nvarying vec2 vTextureCoord;\n\nvoid main(void)\n{\ngl_Position.xyw = projectionMatrix * translationMatrix * vec3(aVertexPosition, 1.0);\ngl_Position.z = 0.0;\n\nvTextureCoord = (uTextureMatrix * vec3(aTextureCoord, 1.0)).xy;\n}\n"}static __initStatic2(){this.defaultFragmentShader="\nvarying vec2 vTextureCoord;\nuniform vec4 uColor;\n\nuniform sampler2D uSampler;\n\nvoid main(void)\n{\ngl_FragColor = texture2D(uSampler, vTextureCoord) * uColor;\n}"}constructor(t,e,n,r){super(t,e,n,r),I.prototype.__init.call(this),this.proj=new R(this.transform)}__init(){this.vertexData2d=null}calculateVertices(){if(this.proj._affine)return this.vertexData2d=null,void super.calculateVertices();const t=this.geometry,e=t.buffers[0].data,n=this;if(t.vertexDirtyId===n.vertexDirty&&n._transformID===n.transform._worldID)return;n._transformID=n.transform._worldID,n.vertexData.length!==e.length&&(n.vertexData=new Float32Array(e.length)),this.vertexData2d&&this.vertexData2d.length===3*e.length/2||(this.vertexData2d=new Float32Array(3*e.length));const r=this.proj.world.mat3,i=this.vertexData2d,o=n.vertexData;for(let t=0;t<o.length/2;t++){const n=e[2*t],a=e[2*t+1],s=r[0]*n+r[3]*a+r[6],c=r[1]*n+r[4]*a+r[7],l=r[2]*n+r[5]*a+r[8];i[3*t]=s,i[3*t+1]=c,i[3*t+2]=l,o[2*t]=s/l,o[2*t+1]=c/l}n.vertexDirty=t.vertexDirtyId}_renderDefault(t){const e=this.shader;e.alpha=this.worldAlpha,e.update&&e.update(),t.batch.flush(),function(t){let e,n=t[0],r=1;for(;r<t.length;){const i=t[r],o=t[r+1];if(r+=2,("optionalAccess"===i||"optionalCall"===i)&&null==n)return;"access"===i||"optionalAccess"===i?(e=n,n=o(n)):"call"!==i&&"optionalCall"!==i||(n=o(((...t)=>n.call(e,...t))),e=void 0)}return n}([e,"access",t=>t.program,"access",t=>t.uniformData,"optionalAccess",t=>t.translationMatrix])&&(e.uniforms.translationMatrix=this.worldTransform.toArray(!0)),t.shader.bind(e,!1),t.state.set(this.state),t.geometry.bind(this.geometry,e),t.geometry.draw(this.drawMode,this.size,this.start,this.geometry.instanceCount)}toLocal(t,e,n,r,i=g.ALL){return A.call(this,t,e,n,r,i)}get worldTransform(){return this.proj.affine?this.transform.worldTransform:this.proj.world}}I.__initStatic(),I.__initStatic2();class F extends h.j{constructor(t){super(t),F.prototype.__init.call(this),this.proj=new R(this.transform),this.pluginName="batch2d"}__init(){this.vertexData2d=null}_calculateBounds(){this.calculateTrimmedVertices(),this._bounds.addQuad(this.vertexTrimmedData)}calculateVertices(){const t=this._texture;if(this.proj._affine)return this.vertexData2d=null,void super.calculateVertices();this.vertexData2d||(this.vertexData2d=new Float32Array(12));const e=this.transform._worldID,n=t._updateID;if(this._transformID===e&&this._textureID===n)return;this._textureID!==n&&(this.uvs=t._uvs.uvsFloat32),this._transformID=e,this._textureID=n;const r=this.proj.world.mat3,i=this.vertexData2d,o=this.vertexData,a=t.trim,s=t.orig,c=this._anchor;let l,u,h,d;a?(u=a.x-c._x*s.width,l=u+a.width,d=a.y-c._y*s.height,h=d+a.height):(u=-c._x*s.width,l=u+s.width,d=-c._y*s.height,h=d+s.height),i[0]=r[0]*u+r[3]*d+r[6],i[1]=r[1]*u+r[4]*d+r[7],i[2]=r[2]*u+r[5]*d+r[8],i[3]=r[0]*l+r[3]*d+r[6],i[4]=r[1]*l+r[4]*d+r[7],i[5]=r[2]*l+r[5]*d+r[8],i[6]=r[0]*l+r[3]*h+r[6],i[7]=r[1]*l+r[4]*h+r[7],i[8]=r[2]*l+r[5]*h+r[8],i[9]=r[0]*u+r[3]*h+r[6],i[10]=r[1]*u+r[4]*h+r[7],i[11]=r[2]*u+r[5]*h+r[8],o[0]=i[0]/i[2],o[1]=i[1]/i[2],o[2]=i[3]/i[5],o[3]=i[4]/i[5],o[4]=i[6]/i[8],o[5]=i[7]/i[8],o[6]=i[9]/i[11],o[7]=i[10]/i[11]}calculateTrimmedVertices(){if(this.proj._affine)return void super.calculateTrimmedVertices();const t=this.transform._worldID,e=this._texture._updateID,n=this;if(n.vertexTrimmedData){if(n._transformTrimmedID===t&&this._textureTrimmedID===e)return}else n.vertexTrimmedData=new Float32Array(8);n._transformTrimmedID=t,this._textureTrimmedID=e;const r=this._texture,i=n.vertexTrimmedData,o=r.orig,a=this.tileProj?this._width:o.width,s=this.tileProj?this._height:o.height,c=this._anchor,l=this.proj.world.mat3,u=-c._x*a,h=u+a,d=-c._y*s,f=d+s;let p=1/(l[2]*u+l[5]*d+l[8]);i[0]=p*(l[0]*u+l[3]*d+l[6]),i[1]=p*(l[1]*u+l[4]*d+l[7]),p=1/(l[2]*h+l[5]*d+l[8]),i[2]=p*(l[0]*h+l[3]*d+l[6]),i[3]=p*(l[1]*h+l[4]*d+l[7]),p=1/(l[2]*h+l[5]*f+l[8]),i[4]=p*(l[0]*h+l[3]*f+l[6]),i[5]=p*(l[1]*h+l[4]*f+l[7]),p=1/(l[2]*u+l[5]*f+l[8]),i[6]=p*(l[0]*u+l[3]*f+l[6]),i[7]=p*(l[1]*u+l[4]*f+l[7])}toLocal(t,e,n,r,i=g.ALL){return A.call(this,t,e,n,r,i)}get worldTransform(){return this.proj.affine?this.transform.worldTransform:this.proj.world}}const L=new a.wx;class M extends c.o{constructor(t,e,n){super(t,e,n),this.tileProj=new R(this.tileTransform),this.tileProj.reverseLocalOrder=!0,this.proj=new R(this.transform),this.pluginName="tilingSprite2d",this.uvRespectAnchor=!0}get worldTransform(){return this.proj.affine?this.transform.worldTransform:this.proj.world}toLocal(t,e,n,r,i=g.ALL){return A.call(this,t,e,n,r,i)}_render(t){const e=this._texture;e&&e.valid&&(this.tileTransform.updateTransform(L),this.uvMatrix.update(),t.batch.setObjectRenderer(t.plugins[this.pluginName]),t.plugins[this.pluginName].render(this))}}function N(){this.proj||(this.proj=new R(this.transform),this.toLocal=D.prototype.toLocal,Object.defineProperty(this,"worldTransform",{get:O,enumerable:!0,configurable:!0}))}s.W2.prototype.convertTo2d=N,h.j.prototype.convertTo2d=function(){this.proj||(this.calculateVertices=F.prototype.calculateVertices,this.calculateTrimmedVertices=F.prototype.calculateTrimmedVertices,this._calculateBounds=F.prototype._calculateBounds,this.pluginName="batch2d",N.call(this))},s.W2.prototype.convertSubtreeTo2d=function(){this.convertTo2d();for(let t=0;t<this.children.length;t++)this.children[t].convertSubtreeTo2d()},u.AL.prototype.convertTo2d=u.IE.prototype.convertTo2d=function(){this.proj||(this.calculateVertices=I.prototype.calculateVertices,this._renderDefault=I.prototype._renderDefault,"batch2d"!==this.material.pluginName&&(this.material=new l.rY(this.material.texture,{program:r.Program.from(I.defaultVertexShader,I.defaultFragmentShader),pluginName:"batch2d"})),N.call(this))},c.o.prototype.convertTo2d=function(){this.proj||(this.tileProj=new R(this.tileTransform),this.tileProj.reverseLocalOrder=!0,this.uvRespectAnchor=!0,this.calculateTrimmedVertices=F.prototype.calculateTrimmedVertices,this._calculateBounds=F.prototype._calculateBounds,this._render=M.prototype._render,this.pluginName="tilingSprite2d",N.call(this))};class j extends d.xv{constructor(t,e,n){super(t,e,n),j.prototype.__init.call(this),this.proj=new R(this.transform),this.pluginName="batch2d"}__init(){this.vertexData2d=null}get worldTransform(){return this.proj.affine?this.transform.worldTransform:this.proj.world}}j.prototype.calculateVertices=F.prototype.calculateVertices,j.prototype.calculateTrimmedVertices=F.prototype.calculateTrimmedVertices,j.prototype._calculateBounds=F.prototype._calculateBounds;const U=new x;class B extends r.Filter{constructor(t){super("\nattribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\n\nuniform mat3 projectionMatrix;\nuniform mat3 otherMatrix;\n\nvarying vec3 vMaskCoord;\nvarying vec2 vTextureCoord;\n\nvoid main(void)\n{\ngl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n\nvTextureCoord = aTextureCoord;\nvMaskCoord = otherMatrix * vec3( aTextureCoord, 1.0);\n}\n","\nvarying vec3 vMaskCoord;\nvarying vec2 vTextureCoord;\n\nuniform sampler2D uSampler;\nuniform sampler2D mask;\nuniform float alpha;\nuniform vec4 maskClamp;\n\nvoid main(void)\n{\nvec2 uv = vMaskCoord.xy / vMaskCoord.z;\n\nfloat clip = step(3.5,\n step(maskClamp.x, uv.x) +\n step(maskClamp.y, uv.y) +\n step(uv.x, maskClamp.z) +\n step(uv.y, maskClamp.w));\n\nvec4 original = texture2D(uSampler, vTextureCoord);\nvec4 masky = texture2D(mask, uv);\n\noriginal *= (masky.r * masky.a * alpha * clip);\n\ngl_FragColor = original;\n}\n"),B.prototype.__init.call(this),t.renderable=!1,this.maskSprite=t}__init(){this.maskMatrix=new x}apply(t,e,n,i){const o=this.maskSprite,a=this.maskSprite.texture;a.valid&&(a.uvMatrix||(a.uvMatrix=new r.TextureMatrix(a,0)),a.uvMatrix.update(),this.uniforms.npmAlpha=a.baseTexture.alphaMode?0:1,this.uniforms.mask=o.texture,this.uniforms.otherMatrix=B.calculateSpriteMatrix(e,this.maskMatrix,o).prepend(a.uvMatrix.mapCoord),this.uniforms.alpha=o.worldAlpha,this.uniforms.maskClamp=a.uvMatrix.uClampFrame,t.applyFilter(this,e,n,i))}static calculateSpriteMatrix(t,e,n){const r=n.proj,i=t.filterFrame,o=r&&!r._affine?r.world.copyTo2dOr3d(U):U.copyFrom(n.transform.worldTransform),a=n.texture.orig;return e.set(t.width,0,0,t.height,i.x,i.y),o.invert(),e.setToMult(o,e),e.scaleAndTranslate(1/a.width,1/a.height,n.anchor.x,n.anchor.y),e}}r.MaskSystem.prototype.pushSpriteMask=function(t){const{maskObject:e}=t,n=t._target;let r=this.alphaMaskPool[this.alphaMaskIndex];r||(r=this.alphaMaskPool[this.alphaMaskIndex]=[new B(e)]),r[0].resolution=this.renderer.resolution,r[0].maskSprite=e;const i=n.filterArea;n.filterArea=e.getBounds(!0),this.renderer.filter.push(n,r),n.filterArea=i,this.alphaMaskIndex++},r.Renderer.registerPlugin("tilingSprite2d",T);class z extends a.E9{constructor(t,e,n){super(t,e),this.z=n}set(t,e,n){return this.x=t||0,this.y=void 0===e?this.x:e||0,this.z=void 0===e?this.x:n||0,this}copyFrom(t){return this.set(t.x,t.y,t.z||0),this}copyTo(t){return t.set(this.x,this.y,this.z),t}}class W extends a.AB{constructor(...t){super(...t),W.prototype.__init.call(this)}__init(){this._z=0}get z(){return this._z}set z(t){this._z!==t&&(this._z=t,this.cb.call(this.scope))}set(t,e,n){const r=t||0,i=void 0===e?r:e||0,o=void 0===e?r:n||0;return this._x===r&&this._y===i&&this._z===o||(this._x=r,this._y=i,this._z=o,this.cb.call(this.scope)),this}copyFrom(t){return this.set(t.x,t.y,t.z||0),this}copyTo(t){return t.set(this._x,this._y,this._z),t}}class V{constructor(t,e,n){V.prototype.__init.call(this),V.prototype.__init2.call(this),V.prototype.__init3.call(this),this._x=t||0,this._y=e||0,this._z=n||0,this.quaternion=new Float64Array(4),this.quaternion[3]=1,this.update()}__init(){this._quatUpdateId=-1}__init2(){this._quatDirtyId=0}__init3(){this._sign=1}get x(){return this._x}set x(t){this._x!==t&&(this._x=t,this._quatDirtyId++)}get y(){return this._y}set y(t){this._y!==t&&(this._y=t,this._quatDirtyId++)}get z(){return this._z}set z(t){this._z!==t&&(this._z=t,this._quatDirtyId++)}get pitch(){return this._x}set pitch(t){this._x!==t&&(this._x=t,this._quatDirtyId++)}get yaw(){return this._y}set yaw(t){this._y!==t&&(this._y=t,this._quatDirtyId++)}get roll(){return this._z}set roll(t){this._z!==t&&(this._z=t,this._quatDirtyId++)}set(t,e,n){const r=t||0,i=e||0,o=n||0;this._x===r&&this._y===i&&this._z===o||(this._x=r,this._y=i,this._z=o,this._quatDirtyId++)}copyFrom(t){const e=t.x,n=t.y,r=t.z;return this._x===e&&this._y===n&&this._z===r||(this._x=e,this._y=n,this._z=r,this._quatDirtyId++),this}copyTo(t){return t.set(this._x,this._y,this._z),t}equals(t){return this._x===t.x&&this._y===t.y&&this._z===t.z}clone(){return new V(this._x,this._y,this._z)}update(){if(this._quatUpdateId===this._quatDirtyId)return!1;this._quatUpdateId=this._quatDirtyId;const t=Math.cos(this._x/2),e=Math.cos(this._y/2),n=Math.cos(this._z/2),r=this._sign,i=r*Math.sin(this._x/2),o=r*Math.sin(this._y/2),a=r*Math.sin(this._z/2),s=this.quaternion;return s[0]=i*e*n+t*o*a,s[1]=t*o*n-i*e*a,s[2]=t*e*a+i*o*n,s[3]=t*e*n-i*o*a,!0}}class q{constructor(t,e,n,r,i){this.cb=t,this.scope=e,q.prototype.__init.call(this),q.prototype.__init2.call(this),q.prototype.__init3.call(this),this._x=n||0,this._y=r||0,this._z=i||0,this.quaternion=new Float64Array(4),this.quaternion[3]=1,this.update()}__init(){this._quatUpdateId=-1}__init2(){this._quatDirtyId=0}__init3(){this._sign=1}get x(){return this._x}set x(t){this._x!==t&&(this._x=t,this._quatDirtyId++,this.cb.call(this.scope))}get y(){return this._y}set y(t){this._y!==t&&(this._y=t,this._quatDirtyId++,this.cb.call(this.scope))}get z(){return this._z}set z(t){this._z!==t&&(this._z=t,this._quatDirtyId++,this.cb.call(this.scope))}get pitch(){return this._x}set pitch(t){this._x!==t&&(this._x=t,this._quatDirtyId++,this.cb.call(this.scope))}get yaw(){return this._y}set yaw(t){this._y!==t&&(this._y=t,this._quatDirtyId++,this.cb.call(this.scope))}get roll(){return this._z}set roll(t){this._z!==t&&(this._z=t,this._quatDirtyId++,this.cb.call(this.scope))}set(t,e,n){const r=t||0,i=e||0,o=n||0;return this._x===r&&this._y===i&&this._z===o||(this._x=r,this._y=i,this._z=o,this._quatDirtyId++,this.cb.call(this.scope)),this}copyFrom(t){const e=t.x,n=t.y,r=t.z;return this._x===e&&this._y===n&&this._z===r||(this._x=e,this._y=n,this._z=r,this._quatDirtyId++,this.cb.call(this.scope)),this}copyTo(t){return t.set(this._x,this._y,this._z),t}equals(t){return this._x===t.x&&this._y===t.y&&this._z===t.z}clone(){return new V(this._x,this._y,this._z)}update(){if(this._quatUpdateId===this._quatDirtyId)return!1;this._quatUpdateId=this._quatDirtyId;const t=Math.cos(this._x/2),e=Math.cos(this._y/2),n=Math.cos(this._z/2),r=this._sign,i=r*Math.sin(this._x/2),o=r*Math.sin(this._y/2),a=r*Math.sin(this._z/2),s=this.quaternion;return s[0]=i*e*n+t*o*a,s[1]=t*o*n-i*e*a,s[2]=t*e*a+i*o*n,s[3]=t*e*n-i*o*a,!0}}const H=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];class G{static __initStatic(){this.IDENTITY=new G}static __initStatic2(){this.TEMP_MATRIX=new G}__init(){this.floatArray=null}__init2(){this._dirtyId=0}__init3(){this._updateId=-1}__init4(){this._mat4inv=null}__init5(){this.cacheInverse=!1}constructor(t){G.prototype.__init.call(this),G.prototype.__init2.call(this),G.prototype.__init3.call(this),G.prototype.__init4.call(this),G.prototype.__init5.call(this),this.mat4=new Float64Array(t||H)}get a(){return this.mat4[0]/this.mat4[15]}set a(t){this.mat4[0]=t*this.mat4[15]}get b(){return this.mat4[1]/this.mat4[15]}set b(t){this.mat4[1]=t*this.mat4[15]}get c(){return this.mat4[4]/this.mat4[15]}set c(t){this.mat4[4]=t*this.mat4[15]}get d(){return this.mat4[5]/this.mat4[15]}set d(t){this.mat4[5]=t*this.mat4[15]}get tx(){return this.mat4[12]/this.mat4[15]}set tx(t){this.mat4[12]=t*this.mat4[15]}get ty(){return this.mat4[13]/this.mat4[15]}set ty(t){this.mat4[13]=t*this.mat4[15]}set(t,e,n,r,i,o){const a=this.mat4;return a[0]=t,a[1]=e,a[2]=0,a[3]=0,a[4]=n,a[5]=r,a[6]=0,a[7]=0,a[8]=0,a[9]=0,a[10]=1,a[11]=0,a[12]=i,a[13]=o,a[14]=0,a[15]=1,this}toArray(t,e){this.floatArray||(this.floatArray=new Float32Array(9));const n=e||this.floatArray,r=this.mat4;return t?(n[0]=r[0],n[1]=r[1],n[2]=r[3],n[3]=r[4],n[4]=r[5],n[5]=r[7],n[6]=r[12],n[7]=r[13],n[8]=r[15]):(n[0]=r[0],n[1]=r[4],n[2]=r[12],n[3]=r[2],n[4]=r[6],n[5]=r[13],n[6]=r[3],n[7]=r[7],n[8]=r[15]),n}setToTranslation(t,e,n){const r=this.mat4;r[0]=1,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=1,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[10]=1,r[11]=0,r[12]=t,r[13]=e,r[14]=n,r[15]=1}setToRotationTranslationScale(t,e,n,r,i,o,a){const s=this.mat4,c=t[0],l=t[1],u=t[2],h=t[3],d=c+c,f=l+l,p=u+u,g=c*d,m=c*f,y=c*p,v=l*f,_=l*p,b=u*p,x=h*d,w=h*f,C=h*p;return s[0]=(1-(v+b))*i,s[1]=(m+C)*i,s[2]=(y-w)*i,s[3]=0,s[4]=(m-C)*o,s[5]=(1-(g+b))*o,s[6]=(_+x)*o,s[7]=0,s[8]=(y+w)*a,s[9]=(_-x)*a,s[10]=(1-(g+v))*a,s[11]=0,s[12]=e,s[13]=n,s[14]=r,s[15]=1,s}apply(t,e){e=e||new z;const n=this.mat4,r=t.x,i=t.y,o=t.z||0,a=1/(n[3]*r+n[7]*i+n[11]*o+n[15]);return e.x=a*(n[0]*r+n[4]*i+n[8]*o+n[12]),e.y=a*(n[1]*r+n[5]*i+n[9]*o+n[13]),e.z=a*(n[2]*r+n[6]*i+n[10]*o+n[14]),e}translate(t,e,n){const r=this.mat4;return r[12]=r[0]*t+r[4]*e+r[8]*n+r[12],r[13]=r[1]*t+r[5]*e+r[9]*n+r[13],r[14]=r[2]*t+r[6]*e+r[10]*n+r[14],r[15]=r[3]*t+r[7]*e+r[11]*n+r[15],this}scale(t,e,n){const r=this.mat4;return r[0]*=t,r[1]*=t,r[2]*=t,r[3]*=t,r[4]*=e,r[5]*=e,r[6]*=e,r[7]*=e,void 0!==n&&(r[8]*=n,r[9]*=n,r[10]*=n,r[11]*=n),this}scaleAndTranslate(t,e,n,r,i,o){const a=this.mat4;a[0]=t*a[0]+r*a[3],a[1]=e*a[1]+i*a[3],a[2]=n*a[2]+o*a[3],a[4]=t*a[4]+r*a[7],a[5]=e*a[5]+i*a[7],a[6]=n*a[6]+o*a[7],a[8]=t*a[8]+r*a[11],a[9]=e*a[9]+i*a[11],a[10]=n*a[10]+o*a[11],a[12]=t*a[12]+r*a[15],a[13]=e*a[13]+i*a[15],a[14]=n*a[14]+o*a[15]}applyInverse(t,e){e=e||new z,this._mat4inv||(this._mat4inv=new Float64Array(16));const n=this._mat4inv,r=this.mat4,i=t.x,o=t.y;let a=t.z||0;this.cacheInverse&&this._updateId===this._dirtyId||(this._updateId=this._dirtyId,G.glMatrixMat4Invert(n,r));const s=1/(n[3]*i+n[7]*o+n[11]*a+n[15]),c=s*(n[0]*i+n[4]*o+n[8]*a+n[12]),l=s*(n[1]*i+n[5]*o+n[9]*a+n[13]),u=s*(n[2]*i+n[6]*o+n[10]*a+n[14]);a+=1;const h=1/(n[3]*i+n[7]*o+n[11]*a+n[15]),d=h*(n[0]*i+n[4]*o+n[8]*a+n[12]),f=h*(n[1]*i+n[5]*o+n[9]*a+n[13]),p=h*(n[2]*i+n[6]*o+n[10]*a+n[14]);Math.abs(u-p)<1e-10&&e.set(NaN,NaN,0);const g=(0-u)/(p-u);return e.set((d-c)*g+c,(f-l)*g+l,0),e}invert(){return G.glMatrixMat4Invert(this.mat4,this.mat4),this}invertCopyTo(t){this._mat4inv||(this._mat4inv=new Float64Array(16));const e=this._mat4inv,n=this.mat4;this.cacheInverse&&this._updateId===this._dirtyId||(this._updateId=this._dirtyId,G.glMatrixMat4Invert(e,n)),t.mat4.set(e)}identity(){const t=this.mat4;return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}clone(){return new G(this.mat4)}copyTo3d(t){const e=this.mat4,n=t.mat4;return n[0]=e[0],n[1]=e[1],n[2]=e[2],n[3]=e[3],n[4]=e[4],n[5]=e[5],n[6]=e[6],n[7]=e[7],n[8]=e[8],t}copyTo2d(t){const e=this.mat4,n=t.mat3;return n[0]=e[0],n[1]=e[1],n[2]=e[3],n[3]=e[4],n[4]=e[5],n[5]=e[7],n[6]=e[12],n[7]=e[13],n[8]=e[15],t}copyTo2dOr3d(t){return t instanceof x?this.copyTo2d(t):this.copyTo3d(t)}copyTo(t,e,n){const r=this.mat4,i=1/r[15],o=r[12]*i,a=r[13]*i;if(t.a=(r[0]-r[3]*o)*i,t.b=(r[1]-r[3]*a)*i,t.c=(r[4]-r[7]*o)*i,t.d=(r[5]-r[7]*a)*i,t.tx=o,t.ty=a,e>=2){let r=t.a*t.d-t.b*t.c;n||(r=Math.abs(r)),e===m.POINT?(r=r>0?1:-1,t.a=r,t.b=0,t.c=0,t.d=r):e===m.AXIS_X?(r/=Math.sqrt(t.b*t.b+t.d*t.d),t.c=0,t.d=r):e===m.AXIS_Y&&(r/=Math.sqrt(t.a*t.a+t.c*t.c),t.a=r,t.c=0)}return t}copyFrom(t){const e=this.mat4;return e[0]=t.a,e[1]=t.b,e[2]=0,e[3]=0,e[4]=t.c,e[5]=t.d,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=1,e[11]=0,e[12]=t.tx,e[13]=t.ty,e[14]=0,e[15]=1,this._dirtyId++,this}setToMultLegacy(t,e){const n=this.mat4,r=e.mat4,i=t.a,o=t.b,a=t.c,s=t.d,c=t.tx,l=t.ty;let u=r[0],h=r[1],d=r[2],f=r[3];return n[0]=u*i+h*a+f*c,n[1]=u*o+h*s+f*l,n[2]=d,n[3]=f,u=r[4],h=r[5],d=r[6],f=r[7],n[4]=u*i+h*a+f*c,n[5]=u*o+h*s+f*l,n[6]=d,n[7]=f,u=r[8],h=r[9],d=r[10],f=r[11],n[8]=u*i+h*a+f*c,n[9]=u*o+h*s+f*l,n[10]=d,n[11]=f,u=r[12],h=r[13],d=r[14],f=r[15],n[12]=u*i+h*a+f*c,n[13]=u*o+h*s+f*l,n[14]=d,n[15]=f,this._dirtyId++,this}setToMultLegacy2(t,e){const n=this.mat4,r=t.mat4,i=r[0],o=r[1],a=r[2],s=r[3],c=r[4],l=r[5],u=r[6],h=r[7],d=e.a,f=e.b,p=e.c,g=e.d,m=e.tx,y=e.ty;return n[0]=d*i+f*c,n[1]=d*o+f*l,n[2]=d*a+f*u,n[3]=d*s+f*h,n[4]=p*i+g*c,n[5]=p*o+g*l,n[6]=p*a+g*u,n[7]=p*s+g*h,n[8]=r[8],n[9]=r[9],n[10]=r[10],n[11]=r[11],n[12]=m*i+y*c+r[12],n[13]=m*o+y*l+r[13],n[14]=m*a+y*u+r[14],n[15]=m*s+y*h+r[15],this._dirtyId++,this}setToMult(t,e){return G.glMatrixMat4Multiply(this.mat4,t.mat4,e.mat4),this._dirtyId++,this}prepend(t){t.mat4?this.setToMult(t,this):this.setToMultLegacy(t,this)}static glMatrixMat4Invert(t,e){const n=e[0],r=e[1],i=e[2],o=e[3],a=e[4],s=e[5],c=e[6],l=e[7],u=e[8],h=e[9],d=e[10],f=e[11],p=e[12],g=e[13],m=e[14],y=e[15],v=n*s-r*a,_=n*c-i*a,b=n*l-o*a,x=r*c-i*s,w=r*l-o*s,C=i*l-o*c,T=u*g-h*p,S=u*m-d*p,k=u*y-f*p,E=h*m-d*g,P=h*y-f*g,R=d*y-f*m;let O=v*R-_*P+b*E+x*k-w*S+C*T;return O?(O=1/O,t[0]=(s*R-c*P+l*E)*O,t[1]=(i*P-r*R-o*E)*O,t[2]=(g*C-m*w+y*x)*O,t[3]=(d*w-h*C-f*x)*O,t[4]=(c*k-a*R-l*S)*O,t[5]=(n*R-i*k+o*S)*O,t[6]=(m*b-p*C-y*_)*O,t[7]=(u*C-d*b+f*_)*O,t[8]=(a*P-s*k+l*T)*O,t[9]=(r*k-n*P-o*T)*O,t[10]=(p*w-g*b+y*v)*O,t[11]=(h*b-u*w-f*v)*O,t[12]=(s*S-a*E-c*T)*O,t[13]=(n*E-r*S+i*T)*O,t[14]=(g*_-p*x-m*v)*O,t[15]=(u*x-h*_+d*v)*O,t):null}static glMatrixMat4Multiply(t,e,n){const r=e[0],i=e[1],o=e[2],a=e[3],s=e[4],c=e[5],l=e[6],u=e[7],h=e[8],d=e[9],f=e[10],p=e[11],g=e[12],m=e[13],y=e[14],v=e[15];let _=n[0],b=n[1],x=n[2],w=n[3];return t[0]=_*r+b*s+x*h+w*g,t[1]=_*i+b*c+x*d+w*m,t[2]=_*o+b*l+x*f+w*y,t[3]=_*a+b*u+x*p+w*v,_=n[4],b=n[5],x=n[6],w=n[7],t[4]=_*r+b*s+x*h+w*g,t[5]=_*i+b*c+x*d+w*m,t[6]=_*o+b*l+x*f+w*y,t[7]=_*a+b*u+x*p+w*v,_=n[8],b=n[9],x=n[10],w=n[11],t[8]=_*r+b*s+x*h+w*g,t[9]=_*i+b*c+x*d+w*m,t[10]=_*o+b*l+x*f+w*y,t[11]=_*a+b*u+x*p+w*v,_=n[12],b=n[13],x=n[14],w=n[15],t[12]=_*r+b*s+x*h+w*g,t[13]=_*i+b*c+x*d+w*m,t[14]=_*o+b*l+x*f+w*y,t[15]=_*a+b*u+x*p+w*v,t}}G.__initStatic(),G.__initStatic2();const Y=new G;class Z extends v{constructor(t,e){super(t,e),Z.prototype.__init.call(this),Z.prototype.__init2.call(this),Z.prototype.__init3.call(this),Z.prototype.__init4.call(this),Z.prototype.__init5.call(this),Z.prototype.__init6.call(this),this.local=new G,this.world=new G,this.local.cacheInverse=!0,this.world.cacheInverse=!0,this.position._z=0,this.scale._z=1,this.pivot._z=0}__init(){this.cameraMatrix=null}__init2(){this._cameraMode=!1}get cameraMode(){return this._cameraMode}set cameraMode(t){this._cameraMode!==t&&(this._cameraMode=t,this.euler._sign=this._cameraMode?-1:1,this.euler._quatDirtyId++,t&&(this.cameraMatrix=new G))}__init3(){this.position=new W(this.onChange,this,0,0)}__init4(){this.scale=new W(this.onChange,this,1,1)}__init5(){this.euler=new q(this.onChange,this,0,0,0)}__init6(){this.pivot=new W(this.onChange,this,0,0)}onChange(){this._projID++}clear(){this.cameraMatrix&&this.cameraMatrix.identity(),this.position.set(0,0,0),this.scale.set(1,1,1),this.euler.set(0,0,0),this.pivot.set(0,0,0),super.clear()}updateLocalTransform(t){if(0===this._projID)return void this.local.copyFrom(t);const e=this.local,n=this.euler,r=this.position,i=this.scale,o=this.pivot;if(n.update(),!this.cameraMode)return e.setToRotationTranslationScale(n.quaternion,r._x,r._y,r._z,i._x,i._y,i._z),e.translate(-o._x,-o._y,-o._z),void e.setToMultLegacy(t,e);e.setToMultLegacy(t,this.cameraMatrix),e.translate(o._x,o._y,o._z),e.scale(1/i._x,1/i._y,1/i._z),Y.setToRotationTranslationScale(n.quaternion,0,0,0,1,1,1),e.setToMult(e,Y),e.translate(-r._x,-r._y,-r._z),this.local._dirtyId++}}class K extends s.W2{constructor(){super(),this.proj=new Z(this.transform)}isFrontFace(t=!1){t&&(this._recursivePostUpdateTransform(),this.displayObjectUpdateTransform());const e=this.proj.world.mat4,n=e[0]*e[15]-e[3]*e[12],r=e[1]*e[15]-e[3]*e[13],i=e[4]*e[15]-e[7]*e[12];return n*(e[5]*e[15]-e[7]*e[13])-i*r>0}getDepth(t=!1){t&&(this._recursivePostUpdateTransform(),this.displayObjectUpdateTransform());const e=this.proj.world.mat4;return e[14]/e[15]}toLocal(t,e,n,r,i=g.ALL){return e&&(t=e.toGlobal(t,n,r)),r||this._recursivePostUpdateTransform(),i===g.ALL?(r||this.displayObjectUpdateTransform(),this.proj.affine?this.transform.worldTransform.applyInverse(t,n):this.proj.world.applyInverse(t,n)):(this.parent?n=this.parent.worldTransform.applyInverse(t,n):(n.x=t.x,n.y=t.y,n.z=t.z),i===g.NONE||(n=this.transform.localTransform.applyInverse(n,n),i===g.PROJ&&this.proj.cameraMode&&(n=this.proj.cameraMatrix.applyInverse(n,n))),n)}get worldTransform(){return this.proj.affine?this.transform.worldTransform:this.proj.world}get position3d(){return this.proj.position}set position3d(t){this.proj.position.copyFrom(t)}get scale3d(){return this.proj.scale}set scale3d(t){this.proj.scale.copyFrom(t)}get euler(){return this.proj.euler}set euler(t){this.proj.euler.copyFrom(t)}get pivot3d(){return this.proj.pivot}set pivot3d(t){this.proj.pivot.copyFrom(t)}}const X=K.prototype.toLocal,$=K.prototype.getDepth,J=K.prototype.isFrontFace;class Q extends K{constructor(){super(),Q.prototype.__init.call(this),Q.prototype.__init2.call(this),Q.prototype.__init3.call(this),Q.prototype.__init4.call(this),this.proj.cameraMode=!0,this.setPlanes(400,10,1e4,!1)}__init(){this._far=0}__init2(){this._near=0}__init3(){this._focus=0}__init4(){this._orthographic=!1}get far(){return this._far}get near(){return this._near}get focus(){return this._focus}get ortographic(){return this._orthographic}setPlanes(t,e=10,n=1e4,r=!1){this._focus=t,this._near=e,this._far=n,this._orthographic=r;const i=this.proj,o=i.cameraMatrix.mat4;i._projID++,o[10]=1/(n-e),o[14]=(t-e)/(n-e),this._orthographic?o[11]=0:o[11]=1/t}}class tt extends l.Kj{constructor(t,e,n,r){super(t,e,n,r),tt.prototype.__init.call(this),this.proj=new Z(this.transform)}__init(){this.vertexData2d=null}calculateVertices(){if(this.proj._affine)return this.vertexData2d=null,void super.calculateVertices();const t=this.geometry,e=t.buffers[0].data,n=this;if(t.vertexDirtyId===n.vertexDirty&&n._transformID===n.transform._worldID)return;n._transformID=n.transform._worldID,n.vertexData.length!==e.length&&(n.vertexData=new Float32Array(e.length)),this.vertexData2d&&this.vertexData2d.length===3*e.length/2||(this.vertexData2d=new Float32Array(3*e.length));const r=this.proj.world.mat4,i=this.vertexData2d,o=n.vertexData;for(let t=0;t<o.length/2;t++){const n=e[2*t],a=e[2*t+1],s=r[0]*n+r[4]*a+r[12],c=r[1]*n+r[5]*a+r[13],l=r[3]*n+r[7]*a+r[15];i[3*t]=s,i[3*t+1]=c,i[3*t+2]=l,o[2*t]=s/l,o[2*t+1]=c/l}n.vertexDirty=t.vertexDirtyId}get worldTransform(){return this.proj.affine?this.transform.worldTransform:this.proj.world}toLocal(t,e,n,r,i=g.ALL){return X.call(this,t,e,n,r,i)}isFrontFace(t){return J.call(this,t)}getDepth(t){return $.call(this,t)}get position3d(){return this.proj.position}set position3d(t){this.proj.position.copyFrom(t)}get scale3d(){return this.proj.scale}set scale3d(t){this.proj.scale.copyFrom(t)}get euler(){return this.proj.euler}set euler(t){this.proj.euler.copyFrom(t)}get pivot3d(){return this.proj.pivot}set pivot3d(t){this.proj.pivot.copyFrom(t)}}tt.prototype._renderDefault=I.prototype._renderDefault;class et extends h.j{constructor(t){super(t),et.prototype.__init.call(this),et.prototype.__init2.call(this),et.prototype.__init3.call(this),this.proj=new Z(this.transform),this.pluginName="batch2d"}__init(){this.vertexData2d=null}__init2(){this.culledByFrustrum=!1}__init3(){this.trimmedCulledByFrustrum=!1}calculateVertices(){const t=this._texture;if(this.proj._affine)return this.vertexData2d=null,void super.calculateVertices();this.vertexData2d||(this.vertexData2d=new Float32Array(12));const e=this.transform._worldID,n=t._updateID;if(this._transformID===e&&this._textureID===n)return;this._textureID!==n&&(this.uvs=t._uvs.uvsFloat32),this._transformID=e,this._textureID=n;const r=this.proj.world.mat4,i=this.vertexData2d,o=this.vertexData,a=t.trim,s=t.orig,c=this._anchor;let l,u,h,d;a?(u=a.x-c._x*s.width,l=u+a.width,d=a.y-c._y*s.height,h=d+a.height):(u=-c._x*s.width,l=u+s.width,d=-c._y*s.height,h=d+s.height);let f,p=!1;i[0]=r[0]*u+r[4]*d+r[12],i[1]=r[1]*u+r[5]*d+r[13],f=r[2]*u+r[6]*d+r[14],i[2]=r[3]*u+r[7]*d+r[15],p=p||f<0,i[3]=r[0]*l+r[4]*d+r[12],i[4]=r[1]*l+r[5]*d+r[13],f=r[2]*l+r[6]*d+r[14],i[5]=r[3]*l+r[7]*d+r[15],p=p||f<0,i[6]=r[0]*l+r[4]*h+r[12],i[7]=r[1]*l+r[5]*h+r[13],f=r[2]*l+r[6]*h+r[14],i[8]=r[3]*l+r[7]*h+r[15],p=p||f<0,i[9]=r[0]*u+r[4]*h+r[12],i[10]=r[1]*u+r[5]*h+r[13],f=r[2]*u+r[6]*h+r[14],i[11]=r[3]*u+r[7]*h+r[15],p=p||f<0,this.culledByFrustrum=p,o[0]=i[0]/i[2],o[1]=i[1]/i[2],o[2]=i[3]/i[5],o[3]=i[4]/i[5],o[4]=i[6]/i[8],o[5]=i[7]/i[8],o[6]=i[9]/i[11],o[7]=i[10]/i[11]}calculateTrimmedVertices(){if(this.proj._affine)return void super.calculateTrimmedVertices();const t=this.transform._worldID,e=this._texture._updateID,n=this;if(n.vertexTrimmedData){if(n._transformTrimmedID===t&&this._textureTrimmedID===e)return}else n.vertexTrimmedData=new Float32Array(8);n._transformTrimmedID=t,this._textureTrimmedID=e;const r=this._texture,i=n.vertexTrimmedData,o=r.orig,a=this._anchor,s=this.proj.world.mat4,c=-a._x*o.width,l=c+o.width,u=-a._y*o.height,h=u+o.height;let d,f=!1,p=1/(s[3]*c+s[7]*u+s[15]);i[0]=p*(s[0]*c+s[4]*u+s[12]),i[1]=p*(s[1]*c+s[5]*u+s[13]),d=s[2]*c+s[6]*u+s[14],f=f||d<0,p=1/(s[3]*l+s[7]*u+s[15]),i[2]=p*(s[0]*l+s[4]*u+s[12]),i[3]=p*(s[1]*l+s[5]*u+s[13]),d=s[2]*l+s[6]*u+s[14],f=f||d<0,p=1/(s[3]*l+s[7]*h+s[15]),i[4]=p*(s[0]*l+s[4]*h+s[12]),i[5]=p*(s[1]*l+s[5]*h+s[13]),d=s[2]*l+s[6]*h+s[14],f=f||d<0,p=1/(s[3]*c+s[7]*h+s[15]),i[6]=p*(s[0]*c+s[4]*h+s[12]),i[7]=p*(s[1]*c+s[5]*h+s[13]),d=s[2]*c+s[6]*h+s[14],f=f||d<0,this.culledByFrustrum=f}_calculateBounds(){if(this.calculateVertices(),this.culledByFrustrum)return;const t=this._texture.trim,e=this._texture.orig;!t||t.width===e.width&&t.height===e.height?this._bounds.addQuad(this.vertexData):(this.calculateTrimmedVertices(),this.trimmedCulledByFrustrum||this._bounds.addQuad(this.vertexTrimmedData))}_render(t){this.calculateVertices(),this.culledByFrustrum||(t.batch.setObjectRenderer(t.plugins[this.pluginName]),t.plugins[this.pluginName].render(this))}containsPoint(t){return!this.culledByFrustrum&&super.containsPoint(t)}get worldTransform(){return this.proj.affine?this.transform.worldTransform:this.proj.world}toLocal(t,e,n,r,i=g.ALL){return X.call(this,t,e,n,r,i)}isFrontFace(t){return J.call(this,t)}getDepth(t){return $.call(this,t)}get position3d(){return this.proj.position}set position3d(t){this.proj.position.copyFrom(t)}get scale3d(){return this.proj.scale}set scale3d(t){this.proj.scale.copyFrom(t)}get euler(){return this.proj.euler}set euler(t){this.proj.euler.copyFrom(t)}get pivot3d(){return this.proj.pivot}set pivot3d(t){this.proj.pivot.copyFrom(t)}}const nt={worldTransform:{get:function(){return this.proj.affine?this.transform.worldTransform:this.proj.world},enumerable:!0,configurable:!0},position3d:{get(){return this.proj.position},set(t){this.proj.position.copy(t)}},scale3d:{get(){return this.proj.scale},set(t){this.proj.scale.copy(t)}},pivot3d:{get(){return this.proj.pivot},set(t){this.proj.pivot.copy(t)}},euler:{get(){return this.proj.euler},set(t){this.proj.euler.copy(t)}}};function rt(){this.proj||(this.proj=new Z(this.transform),this.toLocal=K.prototype.toLocal,this.isFrontFace=K.prototype.isFrontFace,this.getDepth=K.prototype.getDepth,Object.defineProperties(this,nt))}s.W2.prototype.convertTo3d=rt,h.j.prototype.convertTo3d=function(){this.proj||(this.calculateVertices=et.prototype.calculateVertices,this.calculateTrimmedVertices=et.prototype.calculateTrimmedVertices,this._calculateBounds=et.prototype._calculateBounds,this.containsPoint=et.prototype.containsPoint,this.pluginName="batch2d",rt.call(this))},s.W2.prototype.convertSubtreeTo3d=function(){this.convertTo3d();for(let t=0;t<this.children.length;t++)this.children[t].convertSubtreeTo3d()},u.AL.prototype.convertTo3d=u.IE.prototype.convertTo3d=function(){this.proj||(this.calculateVertices=tt.prototype.calculateVertices,this._renderDefault=tt.prototype._renderDefault,"batch2d"!==this.material.pluginName&&(this.material=new l.rY(this.material.texture,{program:r.Program.from(I.defaultVertexShader,I.defaultFragmentShader),pluginName:"batch2d"})),rt.call(this))};class it extends d.xv{constructor(t,e,n){super(t,e,n),it.prototype.__init.call(this),this.proj=new Z(this.transform),this.pluginName="batch2d"}__init(){this.vertexData2d=null}get worldTransform(){return this.proj.affine?this.transform.worldTransform:this.proj.world}toLocal(t,e,n,r,i=g.ALL){return X.call(this,t,e,n,r,i)}isFrontFace(t){return J.call(this,t)}getDepth(t){return $.call(this,t)}get position3d(){return this.proj.position}set position3d(t){this.proj.position.copyFrom(t)}get scale3d(){return this.proj.scale}set scale3d(t){this.proj.scale.copyFrom(t)}get euler(){return this.proj.euler}set euler(t){this.proj.euler.copyFrom(t)}get pivot3d(){return this.proj.pivot}set pivot3d(t){this.proj.pivot.copyFrom(t)}}var ot;it.prototype.calculateVertices=et.prototype.calculateVertices,it.prototype.calculateTrimmedVertices=et.prototype.calculateTrimmedVertices,it.prototype._calculateBounds=et.prototype._calculateBounds,it.prototype.containsPoint=et.prototype.containsPoint,it.prototype._render=et.prototype._render;class at extends r.Geometry{constructor(t=!1){super(),this._buffer=new r.Buffer(null,t,!1),this._indexBuffer=new r.Buffer(null,t,!0),this.addAttribute("aVertexPosition",this._buffer,2,!1,i.vK.FLOAT).addAttribute("aTrans1",this._buffer,3,!1,i.vK.FLOAT).addAttribute("aTrans2",this._buffer,3,!1,i.vK.FLOAT).addAttribute("aSamplerSize",this._buffer,2,!1,i.vK.FLOAT).addAttribute("aFrame",this._buffer,4,!1,i.vK.FLOAT).addAttribute("aColor",this._buffer,4,!0,i.vK.UNSIGNED_BYTE).addAttribute("aTextureId",this._buffer,1,!0,i.vK.FLOAT).addIndex(this._indexBuffer)}}const st=[new a.E9,new a.E9,new a.E9,new a.E9],ct=[0,0,0,0];class lt{constructor(){lt.prototype.__init.call(this),lt.prototype.__init2.call(this),lt.prototype.__init3.call(this),lt.prototype.__init4.call(this)}__init(){this.surfaceID="default"}__init2(){this._updateID=0}__init3(){this.vertexSrc=""}__init4(){this.fragmentSrc=""}fillUniforms(t){}clear(){}boundsQuad(t,e,n){let r=e[0],i=e[1],o=e[0],a=e[1];for(let t=2;t<8;t+=2)r>e[t]&&(r=e[t]),o<e[t]&&(o=e[t]),i>e[t+1]&&(i=e[t+1]),a<e[t+1]&&(a=e[t+1]);if(st[0].set(r,i),this.apply(st[0],st[0]),st[1].set(o,i),this.apply(st[1],st[1]),st[2].set(o,a),this.apply(st[2],st[2]),st[3].set(r,a),this.apply(st[3],st[3]),n)n.apply(st[0],st[0]),n.apply(st[1],st[1]),n.apply(st[2],st[2]),n.apply(st[3],st[3]),e[0]=st[0].x,e[1]=st[0].y,e[2]=st[1].x,e[3]=st[1].y,e[4]=st[2].x,e[5]=st[2].y,e[6]=st[3].x,e[7]=st[3].y;else{for(let t=1;t<=3;t++)if(st[t].y<st[0].y||st[t].y===st[0].y&&st[t].x<st[0].x){const e=st[0];st[0]=st[t],st[t]=e}for(let t=1;t<=3;t++)ct[t]=Math.atan2(st[t].y-st[0].y,st[t].x-st[0].x);for(let t=1;t<=3;t++)for(let e=t+1;e<=3;e++)if(ct[t]>ct[e]){const n=st[t];st[t]=st[e],st[e]=n;const r=ct[t];ct[t]=ct[e],ct[e]=r}if(e[0]=st[0].x,e[1]=st[0].y,e[2]=st[1].x,e[3]=st[1].y,e[4]=st[2].x,e[5]=st[2].y,e[6]=st[3].x,e[7]=st[3].y,(st[3].x-st[2].x)*(st[1].y-st[2].y)-(st[1].x-st[2].x)*(st[3].y-st[2].y)<0)return e[4]=st[3].x,void(e[5]=st[3].y)}}}const ut=new a.y3,ht=new a.Ae,dt=new a.E9;class ft extends lt{constructor(...t){super(...t),ft.prototype.__init.call(this)}__init(){this.distortion=new a.E9}clear(){this.distortion.set(0,0)}apply(t,e){e=e||new a.E9;const n=this.distortion,r=t.x*t.y;return e.x=t.x+n.x*r,e.y=t.y+n.y*r,e}applyInverse(t,e){e=e||new a.E9;const n=t.x,r=t.y,i=this.distortion.x,o=this.distortion.y;if(0===i)e.x=n,e.y=r/(1+o*n);else if(0===o)e.y=r,e.x=n/(1+i*r);else{const t=.5*(r*i-n*o+1)/o,a=t*t+n/o;if(a<=1e-5)return e.set(NaN,NaN),e;e.x=o>0?-t+Math.sqrt(a):-t-Math.sqrt(a),e.y=(n/e.x-1)/i}return e}mapSprite(t,e,n){const r=t.texture;return ht.x=-t.anchor.x*r.orig.width,ht.y=-t.anchor.y*r.orig.height,ht.width=r.orig.width,ht.height=r.orig.height,this.mapQuad(ht,e,n||t.transform)}mapQuad(t,e,n){const r=-t.x/t.width,i=-t.y/t.height,o=(1-t.x)/t.width,a=(1-t.y)/t.height,s=e[0].x*(1-r)+e[1].x*r,c=e[0].y*(1-r)+e[1].y*r,l=e[0].x*(1-o)+e[1].x*o,u=e[0].y*(1-o)+e[1].y*o,h=e[3].x*(1-r)+e[2].x*r,d=e[3].y*(1-r)+e[2].y*r,f=e[3].x*(1-o)+e[2].x*o,p=e[3].y*(1-o)+e[2].y*o,g=s*(1-i)+h*i,m=c*(1-i)+d*i,y=l*(1-i)+f*i,v=u*(1-i)+p*i,_=s*(1-a)+h*a,b=c*(1-a)+d*a,x=l*(1-a)+f*a,w=u*(1-a)+p*a,C=ut;return C.tx=g,C.ty=m,C.a=y-g,C.b=v-m,C.c=_-g,C.d=b-m,dt.set(x,w),C.applyInverse(dt,dt),this.distortion.set(dt.x-1,dt.y-1),n.setFromMatrix(C),this}fillUniforms(t){t.distortion=t.distortion||new Float32Array([0,0,0,0]);const e=Math.abs(this.distortion.x),n=Math.abs(this.distortion.y);t.distortion[0]=1e4*e<=n?0:this.distortion.x,t.distortion[1]=1e4*n<=e?0:this.distortion.y,t.distortion[2]=1/t.distortion[0],t.distortion[3]=1/t.distortion[1]}}const pt=a.wx.prototype.updateTransform;function gt(t){const e=this.proj,n=t.proj,r=this;return n?n._surface?(e._activeProjection=n,this.updateLocalTransform(),this.localTransform.copyTo(this.worldTransform),void(r._parentID<0&&++r._worldID)):(pt.call(this,t),void(e._activeProjection=n._activeProjection)):(pt.call(this,t),void(e._activeProjection=null))}class mt extends p{constructor(...t){super(...t),mt.prototype.__init.call(this),mt.prototype.__init2.call(this),mt.prototype.__init3.call(this),mt.prototype.__init4.call(this),mt.prototype.__init5.call(this)}__init(){this._surface=null}__init2(){this._activeProjection=null}set enabled(t){t!==this._enabled&&(this._enabled=t,t?(this.legacy.updateTransform=gt,this.legacy._parentID=-1):(this.legacy.updateTransform=a.wx.prototype.updateTransform,this.legacy._parentID=-1))}get surface(){return this._surface}set surface(t){this._surface!==t&&(this._surface=t||null,this.legacy._parentID=-1)}applyPartial(t,e){return null!==this._activeProjection?(e=this.legacy.worldTransform.apply(t,e),this._activeProjection.surface.apply(e,e)):null!==this._surface?this.surface.apply(t,e):this.legacy.worldTransform.apply(t,e)}apply(t,e){return null!==this._activeProjection?(e=this.legacy.worldTransform.apply(t,e),this._activeProjection.surface.apply(e,e),this._activeProjection.legacy.worldTransform.apply(e,e)):null!==this._surface?(e=this.surface.apply(t,e),this.legacy.worldTransform.apply(e,e)):this.legacy.worldTransform.apply(t,e)}applyInverse(t,e){return null!==this._activeProjection?(e=this._activeProjection.legacy.worldTransform.applyInverse(t,e),this._activeProjection._surface.applyInverse(e,e),this.legacy.worldTransform.applyInverse(e,e)):null!==this._surface?(e=this.legacy.worldTransform.applyInverse(t,e),this._surface.applyInverse(e,e)):this.legacy.worldTransform.applyInverse(t,e)}mapBilinearSprite(t,e){this._surface instanceof ft||(this.surface=new ft),this.surface.mapSprite(t,e,this.legacy)}__init3(){this._currentSurfaceID=-1}__init4(){this._currentLegacyID=-1}__init5(){this._lastUniforms=null}clear(){this.surface&&this.surface.clear()}get uniforms(){return this._currentLegacyID===this.legacy._worldID&&this._currentSurfaceID===this.surface._updateID||(this._lastUniforms=this._lastUniforms||{},this._lastUniforms.translationMatrix=this.legacy.worldTransform,this._surface.fillUniforms(this._lastUniforms)),this._lastUniforms}}class yt extends h.j{constructor(t){super(t),yt.prototype.__init.call(this),this.proj=new mt(this.transform),this.pluginName="batch_bilinear"}__init(){this.aTrans=new a.y3}_calculateBounds(){this.calculateTrimmedVertices(),this._bounds.addQuad(this.vertexTrimmedData)}calculateVertices(){const t=this.transform._worldID,e=this._texture._updateID;if(this._transformID===t&&this._textureID===e)return;this._transformID=t,this._textureID=e;const n=this._texture,i=this.vertexData,o=n.trim,a=n.orig,s=this._anchor;let c,l,u,h;if(o?(l=o.x-s._x*a.width,c=l+o.width,h=o.y-s._y*a.height,u=h+o.height):(l=-s._x*a.width,c=l+a.width,h=-s._y*a.height,u=h+a.height),this.proj._surface)i[0]=l,i[1]=h,i[2]=c,i[3]=h,i[4]=c,i[5]=u,i[6]=l,i[7]=u,this.proj._surface.boundsQuad(i,i);else{const t=this.transform.worldTransform,e=t.a,n=t.b,r=t.c,o=t.d,a=t.tx,s=t.ty;i[0]=e*l+r*h+a,i[1]=o*h+n*l+s,i[2]=e*c+r*h+a,i[3]=o*h+n*c+s,i[4]=e*c+r*u+a,i[5]=o*u+n*c+s,i[6]=e*l+r*u+a,i[7]=o*u+n*l+s,this.proj._activeProjection&&this.proj._activeProjection.surface.boundsQuad(i,i)}n.uvMatrix||(n.uvMatrix=new r.TextureMatrix(n)),n.uvMatrix.update();const d=this.aTrans;d.set(a.width,0,0,a.height,l,h),null===this.proj._surface&&d.prepend(this.transform.worldTransform),d.invert(),d.prepend(n.uvMatrix.mapCoord)}calculateTrimmedVertices(){const t=this.transform._worldID,e=this._texture._updateID,n=this;if(n.vertexTrimmedData){if(n._transformTrimmedID===t&&this._textureTrimmedID===e)return}else n.vertexTrimmedData=new Float32Array(8);n._transformTrimmedID=t,this._textureTrimmedID=e;const r=this._texture,i=n.vertexTrimmedData,o=r.orig,a=this._anchor,s=-a._x*o.width,c=s+o.width,l=-a._y*o.height,u=l+o.height;if(this.proj._surface)i[0]=s,i[1]=l,i[2]=c,i[3]=l,i[4]=c,i[5]=u,i[6]=s,i[7]=u,this.proj._surface.boundsQuad(i,i,this.transform.worldTransform);else{const t=this.transform.worldTransform,e=t.a,n=t.b,r=t.c,o=t.d,a=t.tx,h=t.ty;i[0]=e*s+r*l+a,i[1]=o*l+n*s+h,i[2]=e*c+r*l+a,i[3]=o*l+n*c+h,i[4]=e*c+r*u+a,i[5]=o*u+n*c+h,i[6]=e*s+r*u+a,i[7]=o*u+n*s+h,this.proj._activeProjection&&this.proj._activeProjection.surface.boundsQuad(i,i,this.proj._activeProjection.legacy.worldTransform)}}get worldTransform(){return this.proj}}h.j.prototype.convertTo2s=function(){this.proj||(this.pluginName="sprite_bilinear",this.aTrans=new a.y3,this.calculateVertices=yt.prototype.calculateVertices,this.calculateTrimmedVertices=yt.prototype.calculateTrimmedVertices,this._calculateBounds=yt.prototype._calculateBounds,s.W2.prototype.convertTo2s.call(this))},s.W2.prototype.convertTo2s=function(){this.proj||(this.proj=new mt(this.transform),Object.defineProperty(this,"worldTransform",{get(){return this.proj},enumerable:!0,configurable:!0}))},s.W2.prototype.convertSubtreeTo2s=function(){this.convertTo2s();for(let t=0;t<this.children.length;t++)this.children[t].convertSubtreeTo2s()};class vt extends d.xv{constructor(t,e,n){super(t,e,n),vt.prototype.__init.call(this),this.proj=new mt(this.transform),this.pluginName="batch_bilinear"}__init(){this.aTrans=new a.y3}get worldTransform(){return this.proj}}vt.prototype.calculateVertices=yt.prototype.calculateVertices,vt.prototype.calculateTrimmedVertices=yt.prototype.calculateTrimmedVertices,vt.prototype._calculateBounds=yt.prototype._calculateBounds,r.Renderer.registerPlugin("batch_bilinear",class{static create(t){const{vertex:e,fragment:n,vertexSize:i,geometryClass:s}=Object.assign({vertex:"precision highp float;\nattribute vec2 aVertexPosition;\nattribute vec3 aTrans1;\nattribute vec3 aTrans2;\nattribute vec2 aSamplerSize;\nattribute vec4 aFrame;\nattribute vec4 aColor;\nattribute float aTextureId;\n\nuniform mat3 projectionMatrix;\nuniform mat3 translationMatrix;\n\nvarying vec2 vertexPosition;\nvarying vec3 vTrans1;\nvarying vec3 vTrans2;\nvarying vec2 vSamplerSize;\nvarying vec4 vFrame;\nvarying vec4 vColor;\nvarying float vTextureId;\n\nvoid main(void){\ngl_Position.xyw = projectionMatrix * translationMatrix * vec3(aVertexPosition, 1.0);\ngl_Position.z = 0.0;\n\nvertexPosition = aVertexPosition;\nvTrans1 = aTrans1;\nvTrans2 = aTrans2;\nvTextureId = aTextureId;\nvColor = aColor;\nvSamplerSize = aSamplerSize;\nvFrame = aFrame;\n}\n",fragment:"precision highp float;\nvarying vec2 vertexPosition;\nvarying vec3 vTrans1;\nvarying vec3 vTrans2;\nvarying vec2 vSamplerSize;\nvarying vec4 vFrame;\nvarying vec4 vColor;\nvarying float vTextureId;\n\nuniform sampler2D uSamplers[%count%];\nuniform vec4 distortion;\n\nvoid main(void){\nvec2 surface;\nvec2 surface2;\n\nfloat vx = vertexPosition.x;\nfloat vy = vertexPosition.y;\nfloat dx = distortion.x;\nfloat dy = distortion.y;\nfloat revx = distortion.z;\nfloat revy = distortion.w;\n\nif (distortion.x == 0.0) {\nsurface.x = vx;\nsurface.y = vy / (1.0 + dy * vx);\nsurface2 = surface;\n} else\nif (distortion.y == 0.0) {\nsurface.y = vy;\nsurface.x = vx / (1.0 + dx * vy);\nsurface2 = surface;\n} else {\nfloat c = vy * dx - vx * dy;\nfloat b = (c + 1.0) * 0.5;\nfloat b2 = (-c + 1.0) * 0.5;\nfloat d = b * b + vx * dy;\nif (d < -0.00001) {\n discard;\n}\nd = sqrt(max(d, 0.0));\nsurface.x = (- b + d) * revy;\nsurface2.x = (- b - d) * revy;\nsurface.y = (- b2 + d) * revx;\nsurface2.y = (- b2 - d) * revx;\n}\n\nvec2 uv;\nuv.x = vTrans1.x * surface.x + vTrans1.y * surface.y + vTrans1.z;\nuv.y = vTrans2.x * surface.x + vTrans2.y * surface.y + vTrans2.z;\n\nvec2 pixels = uv * vSamplerSize;\n\nif (pixels.x < vFrame.x || pixels.x > vFrame.z ||\npixels.y < vFrame.y || pixels.y > vFrame.w) {\nuv.x = vTrans1.x * surface2.x + vTrans1.y * surface2.y + vTrans1.z;\nuv.y = vTrans2.x * surface2.x + vTrans2.y * surface2.y + vTrans2.z;\npixels = uv * vSamplerSize;\n\nif (pixels.x < vFrame.x || pixels.x > vFrame.z ||\n pixels.y < vFrame.y || pixels.y > vFrame.w) {\n discard;\n}\n}\n\nvec4 edge;\nedge.xy = clamp(pixels - vFrame.xy + 0.5, vec2(0.0, 0.0), vec2(1.0, 1.0));\nedge.zw = clamp(vFrame.zw - pixels + 0.5, vec2(0.0, 0.0), vec2(1.0, 1.0));\n\nfloat alpha = 1.0; //edge.x * edge.y * edge.z * edge.w;\nvec4 rColor = vColor * alpha;\n\nfloat textureId = floor(vTextureId+0.5);\nvec2 vTextureCoord = uv;\nvec4 color;\n%forloop%\ngl_FragColor = color * rColor;\n}",geometryClass:at,vertexSize:16},t);return ot=class extends _{constructor(t){super(t),ot.prototype.__init.call(this),ot.prototype.__init2.call(this),ot.prototype.__init3.call(this),this.shaderGenerator=new r.BatchShaderGenerator(e,n),this.geometryClass=s,this.vertexSize=i}__init(){this.defUniforms={translationMatrix:new a.y3,distortion:new Float32Array([0,0,1/0,1/0])}}__init2(){this.size=1e3}__init3(){this.forceMaxTextures=1}getUniforms(t){const{proj:e}=t;return null!==e.surface?e.uniforms:null!==e._activeProjection?e._activeProjection.uniforms:this.defUniforms}packInterleavedGeometry(t,e,n,r,i){const{uint32View:a,float32View:s}=e,c=r/this.vertexSize,l=t.indices,u=t.vertexData,h=t._texture._frame,d=t.aTrans,{_batchLocation:f,realWidth:p,realHeight:g,resolution:m}=t._texture.baseTexture,y=Math.min(t.worldAlpha,1),v=y<1&&t._texture.baseTexture.alphaMode?(0,o.rA)(t._tintRGB,y):t._tintRGB+(255*y<<24);for(let t=0;t<u.length;t+=2)s[r]=u[t],s[r+1]=u[t+1],s[r+2]=d.a,s[r+3]=d.c,s[r+4]=d.tx,s[r+5]=d.b,s[r+6]=d.d,s[r+7]=d.ty,s[r+8]=p,s[r+9]=g,s[r+10]=h.x*m,s[r+11]=h.y*m,s[r+12]=(h.x+h.width)*m,s[r+13]=(h.y+h.height)*m,a[r+14]=v,s[r+15]=f,r+=16;for(let t=0;t<l.length;t++)n[i++]=c+l[t]}},ot}}.create({}))},4504:(t,e,n)=>{n.d(e,{ry:()=>ct,Cz:()=>ht.BeautifyOptions,T$:()=>dt.a,Mj:()=>ht.Mj,UZ:()=>ht.UZ,bk:()=>ht.bk,Iq:()=>G,aR:()=>ut,_$:()=>at});var r=n(6878),i=n(1347),o=n(617);class a{constructor(){this._configCenter=new o.M}async init(){return new Promise(((t,e)=>{this.initDataMap(),wx.initFaceDetect({success(){t()},fail(n){console.log("wx init face fail",n);const{errMsg:r}=n;if(r.indexOf("already init")>-1)return t();e({errMsg:"wx init face fail"})}})}))}send(t){const{data:e,width:n,height:r}=t;new Date;wx.faceDetect({width:n,height:r,frameBuffer:e,enablePoint:!0,enableAngle:!0,success:e=>{const{x:o,y:a}=e,s=e.pointArray,c=e.angleArray;let l={yaw:-c.yaw*Math.PI/2,pitch:c.pitch,roll:c.roll};const u=(o-n/2)/n;l.yaw+=1.4*u;const h=(a-r/2)/(r/2);l.pitch-=h,this.angles=l,s.push(this.getCenterOfTwoPoints(s[96],s[97])),s.push(this.getCenterOfTwoPoints(s[96],s[103])),s.push(this.getCenterOfTwoPoints(s[100],s[99])),s.push(this.getCenterOfTwoPoints(s[100],s[101]));const d=this.getCenterOfTwoPoints(s[78],s[79]),f=1.5*(0,i.Sp)(s[44],s[49]),p=this.getSlope(d,s[49]),g=Math.atan(p),m={x:d.x-f*Math.cos(g)*(g/Math.abs(g)),y:d.y-f*Math.sin(Math.abs(g))};s.push(m);const y=s[0],v=y.y-y.x*p,_=m.y- -1/p*m.x,b=(_-v)/(p- -1/p),x={x:b,y:b*p+v},w=this.twoBezier(.14,m,x,y),C=this.twoBezier(.28,m,x,y),T=this.twoBezier(.42,m,x,y),S=this.twoBezier(.56,m,x,y),k=this.twoBezier(.7,m,x,y),E=this.twoBezier(.85,m,x,y),P=s[32],R=P.y-P.x*p,O={x:(_-R)/(p- -1/p),y:(_-R)/(p- -1/p)*p+R},D=this.twoBezier(.14,m,O,P),A=this.twoBezier(.28,m,O,P),I=this.twoBezier(.42,m,O,P),F=this.twoBezier(.56,m,O,P),L=this.twoBezier(.7,m,O,P),M=this.twoBezier(.85,m,O,P);s.push(w,C,T,D,A,I,S,F,E,k,M,L);const{meshVertex:N,lipVertex:j}=this.getMeshVertex(s);this.triggerResult({landmarks:s,angles:l,image:t,meshVertex:N,lipVertex:j})},fail:e=>{this.triggerResult({landmarks:[],angles:[],image:t,meshVertex:[],lipVertex:[]})}})}onResult(t){this.resultCb=t}triggerResult(t){this.vkstarted||(this.vkstarted=!0),this.detectId=null,this.resultCb&&this.resultCb(t)}twoBezier(t,e,n,r){const{x:i,y:o}=e,{x:a,y:s}=n,{x:c,y:l}=r;return{x:(1-t)*(1-t)*i+2*t*(1-t)*a+t*t*c,y:(1-t)*(1-t)*o+2*t*(1-t)*s+t*t*l}}destroy(){console.log("stopFaceDetect"),wx.stopFaceDetect({success(){console.log("face detect stopped")},fail(){console.log("face detect stop failed")}})}getCenterOfTwoPoints(t,e){return{x:(t.x+e.x)/2,y:(t.y+e.y)/2}}getDistanceOfTwoPoints(t,e){return Math.pow((t.x-e.x)*(t.x-e.x)+(t.y-e.y)*(t.y-e.y),.5)}getSlope(t,e){return e.x===t.x?Number.MAX_SAFE_INTEGER:(e.y-t.y)/(e.x-t.x)}getMeshVertex(t){const{triangulation:e,lipsTriangulation:n,KEY_POINTS:r,LIPS:i,MOUTH_UPPER:o}=this._dataMap,a=[],s=[];if(t){const o=[],l=[],u=this.processLipEdge(t);t.forEach(((t,e)=>{if(r.indexOf(e)>=0){const n=t;o.push([u[e].x,u[e].y]),i.indexOf(e)>=0&&l.push([n.x,n.y])}}));this.addOuterLandmarks(t).forEach(((t,e)=>{o.push([t.x,t.y])}));const h=e;for(var c=0;c<h.length;c+=3){const t=h[c],e=h[c+1],n=h[c+2];a.push(o[t][0]),a.push(o[t][1]),a.push(o[e][0]),a.push(o[e][1]),a.push(o[n][0]),a.push(o[n][1])}for(c=0;c<n.length;c+=3){const t=n[c],e=n[c+1],r=n[c+2];s.push(l[t][0]),s.push(l[t][1]),s.push(l[e][0]),s.push(l[e][1]),s.push(l[r][0]),s.push(l[r][1])}}return{meshVertex:a,lipVertex:s}}processLipEdge(t){const e=JSON.parse(JSON.stringify(t)),{MOUTH_UPPER:n,MOUTH_LOWER:r}=this._dataMap;return n.forEach(((t,n)=>{const i=e[t],o=e[r[n]],a={x:(i.x+o.x)/2,y:(i.y+o.y)/2};i.y=a.y,i.x=a.x,o.y=a.y,o.x=a.x})),e}getAngles(){return this.angles}addOuterLandmarks(t){const{OUTER_REFERENCE:e}=this._dataMap,n=(0,i.Sp)(t[32],t[0]),r=(0,i.Sp)(t[16],t[110]),o=[],a=this.getAngles(t),s=Math.cos(a.roll),c=Math.sin(a.roll),{yaw:l,pitch:u}=a;return e.forEach(((e,i)=>{e.forEach((e=>{let a,u;"object"==typeof e?(a=t[e.x],u=t[e.y]):(a=t[e],u=t[e]);const h=this.getSlope(t[16],t[110]),d=-1/h,f=a.y-a.x*h,p=(f-(u.y-u.x*d))/(d-h),g=p,m=p*h+f,y=[.5,.2];let v,_,b;0===i?(b=y[0]*r,v=g+b*c,_=m-b*Math.abs(s)):1===i?(b=.3*n,l>0&&(b*=Math.cos(2*l)),v=g+b*Math.abs(s),_=m+b*c):2===i?(b=y[1]*r,v=g-b*c,_=m+b*Math.abs(s)):(b=.3*n,l<0&&(b*=Math.cos(2*l)),v=g-b*Math.abs(s),_=m-b*c),o.push({x:v,y:_,z:0})}))})),o}initDataMap(){const t=this._configCenter.getConfigByKeys(["triangulation","OUTER_REFERENCE","POINTS_MAP","KEY_POINTS","LEFT_FACE_OVAL","RIGHT_FACE_OVAL","outer_offset_ratio","MOUTH_UPPER","MOUTH_LOWER","lipsTriangulation","LIPS"]);this._dataMap=t}}class s{setAlpha(t){(t<=0||t>1)&&console.log("alpha should be in (0.0., 1.0]"),this.a=t}constructor(t,e=0){this.y=this.s=e,this.setAlpha(t),this.initialized=!1}filter(t){var e;return this.initialized?e=this.a*t+(1-this.a)*this.s:(e=t,this.initialized=!0),this.y=t,this.s=e,e}filterWithAlpha(t,e){return this.setAlpha(e),this.filter(t)}hasLastRawValue(){return this.initialized}lastRawValue(){return this.y}reset(){this.initialized=!1}}const c=class{alpha(t){var e=1/this.freq;return 1/(1+1/(2*Math.PI*t)/e)}setFrequency(t){t<=0&&console.log("freq should be >0"),this.freq=t}setMinCutoff(t){t<=0&&console.log("mincutoff should be >0"),this.mincutoff=t}setBeta(t){this.beta_=t}setDerivateCutoff(t){t<=0&&console.log("dcutoff should be >0"),this.dcutoff=t}constructor(t,e=1,n=0,r=1){this.setFrequency(t),this.setMinCutoff(e),this.setBeta(n),this.setDerivateCutoff(r),this.x=new s(this.alpha(e)),this.dx=new s(this.alpha(r)),this.lasttime=void 0}reset(){this.x.reset(),this.dx.reset(),this.lasttime=void 0}filter(t,e){null!=this.lasttime&&null!=e&&e!==this.lasttime&&(this.freq=1/(e-this.lasttime)),this.lasttime=e;var n=this.x.hasLastRawValue()?(t-this.x.lastRawValue())*this.freq:0,r=this.dx.filterWithAlpha(n,this.alpha(this.dcutoff)),i=this.mincutoff+this.beta_*Math.abs(r);return this.x.filterWithAlpha(t,this.alpha(i))}};class l{frame0;cacheNum=2;frame1;frame2;frame3;constructor(){}filter(t){if(null===this.frame0||void 0===this.frame0)for(let e=0;e<this.cacheNum;e++)return this[`frame${e}`]=t,t;for(let t=this.cacheNum-1;t>0;t--)this[`frame${t}`]=this["frame"+(t-1)];return this.frame0=t,this.average()}average(){let t=0;for(let e=0;e<this.cacheNum;e++)t+=this[`frame${e}`]||0;return t/this.cacheNum}}class u{session;currentResult;vkstarted;_filterMap={};_angleMap={};taskPromises=[];constructor(t){this._configCenter=new o.M,this._options=t;for(let t=0;t<106;t++)this._filterMap[t+"_x"]=new c(60,.05,80,1),this._filterMap[t+"_y"]=new c(60,.05,80,1),this._filterMap[t+"_z"]=new c(60,.05,80,1);this._angleMap.pitch=new l,this._angleMap.yaw=new l,this._angleMap.roll=new l}async init(){this.initDataMap();const t=wx.createVKSession({track:{face:{mode:2}},version:"v1"});this.session=t,this.session.on("updateAnchors",(t=>{this.currentResult=t[0];const e=this.processData();e.image=this.frame,this.triggerResult(e)})),this.session.on("removeAnchors",(t=>{const e={landmarks:[],angles:{},meshVertex:[],lipVertex:[]};e.image=this.frame,this.triggerResult(e)})),this.session.start()}triggerResult(t){this.vkstarted||(this.vkstarted=!0),this.detectId=null;this.taskPromises.shift()?.(t)}processData(){const t=.01*(new Date).getTime(),e=this.currentResult,n=e.angle;n.pitch=this._angleMap.pitch.filter(n.pitch,t),n.yaw=this._angleMap.yaw.filter(n.yaw,t),n.roll=this._angleMap.roll.filter(n.roll,t),n.yaw=1.1*(n.yaw-.1),n.pitch=.93*(n.pitch+.18),this.angles=n;const r=e.points,{width:o,height:a}=this.detectSize,s=o/a,c=this._options.width/this._options.height;r.forEach(((e,n)=>{c<s?e.x=.5+(e.x-.5)*(this._options.height/a):c>s&&(e.y=.5+(e.y-.5)/(s/c)),this._filterMap[n+"_x"]&&(e.x=this._filterMap[n+"_x"].filter(e.x,t),e.y=this._filterMap[n+"_y"].filter(e.y,t),e.z=this._filterMap[n+"_z"].filter(e.z,t)),e.x*=this._options.width,e.y*=this._options.height})),r.push(this.getCenterOfTwoPoints(r[96],r[97])),r.push(this.getCenterOfTwoPoints(r[96],r[103])),r.push(this.getCenterOfTwoPoints(r[100],r[99])),r.push(this.getCenterOfTwoPoints(r[100],r[101]));const l=this.getCenterOfTwoPoints(r[78],r[79]),u=1.5*(0,i.Sp)(r[44],r[49]),h=this.getSlope(l,r[49]),d=Math.atan(h),f={x:l.x-u*Math.cos(d)*(d/Math.abs(d)),y:l.y-u*Math.sin(Math.abs(d))};r.push(f);const p=r[0],g=p.y-p.x*h,m=f.y- -1/h*f.x,y=(m-g)/(h- -1/h),v={x:y,y:y*h+g},_=this.twoBezier(.14,f,v,p),b=this.twoBezier(.28,f,v,p),x=this.twoBezier(.42,f,v,p),w=this.twoBezier(.56,f,v,p),C=this.twoBezier(.7,f,v,p),T=this.twoBezier(.85,f,v,p),S=r[32],k=S.y-S.x*h,E={x:(m-k)/(h- -1/h),y:(m-k)/(h- -1/h)*h+k},P=this.twoBezier(.14,f,E,S),R=this.twoBezier(.28,f,E,S),O=this.twoBezier(.42,f,E,S),D=this.twoBezier(.56,f,E,S),A=this.twoBezier(.7,f,E,S),I=this.twoBezier(.85,f,E,S);r.push(_,b,x,P,R,O,w,D,T,C,I,A);const{meshVertex:F,lipVertex:L}=this.getMeshVertex(r);return{landmarks:r,angles:this.angles,meshVertex:F,lipVertex:L}}send(t){return new Promise((e=>{if(this.vkstarted&&this.detectId)return;const{data:n,width:r,height:i}=t;this.detectId=+new Date,this.currentResult=null,this.frame=t,this.taskPromises.push(e),this.detectSize={width:r,height:i},this.session.detectFace({frameBuffer:n,width:r,height:i,scoreThreshold:.5,sourceType:0,modelMode:1})}))}twoBezier(t,e,n,r){const{x:i,y:o}=e,{x:a,y:s}=n,{x:c,y:l}=r;return{x:(1-t)*(1-t)*i+2*t*(1-t)*a+t*t*c,y:(1-t)*(1-t)*o+2*t*(1-t)*s+t*t*l}}destroy(){this.session&&(this.session=null),this.taskPromises=[]}getCenterOfTwoPoints(t,e){return{x:(t.x+e.x)/2,y:(t.y+e.y)/2}}getDistanceOfTwoPoints(t,e){return Math.pow((t.x-e.x)*(t.x-e.x)+(t.y-e.y)*(t.y-e.y),.5)}getSlope(t,e){return e.x===t.x?Number.MAX_SAFE_INTEGER:(e.y-t.y)/(e.x-t.x)}getMeshVertex(t){const{triangulation:e,lipsTriangulation:n,KEY_POINTS:r,LIPS:i,MOUTH_UPPER:o}=this._dataMap,a=[],s=[];if(t){const o=[],l=[],u=this.processLipEdge(t);t.forEach(((t,e)=>{if(r.indexOf(e)>=0){const n=t;o.push([u[e].x,u[e].y]),i.indexOf(e)>=0&&l.push([n.x,n.y])}}));this.addOuterLandmarks(t).forEach(((t,e)=>{o.push([t.x,t.y])}));const h=e;for(var c=0;c<h.length;c+=3){const t=h[c],e=h[c+1],n=h[c+2];a.push(o[t][0]),a.push(o[t][1]),a.push(o[e][0]),a.push(o[e][1]),a.push(o[n][0]),a.push(o[n][1])}for(c=0;c<n.length;c+=3){const t=n[c],e=n[c+1],r=n[c+2];s.push(l[t][0]),s.push(l[t][1]),s.push(l[e][0]),s.push(l[e][1]),s.push(l[r][0]),s.push(l[r][1])}}return{meshVertex:a,lipVertex:s}}processLipEdge(t){const e=JSON.parse(JSON.stringify(t)),{MOUTH_UPPER:n,MOUTH_LOWER:r}=this._dataMap;return n.forEach(((t,n)=>{const i=e[t],o=e[r[n]],a={x:(i.x+o.x)/2,y:(i.y+o.y)/2};i.y=a.y,i.x=a.x,o.y=a.y,o.x=a.x})),e}getAngles(){return this.angles}addOuterLandmarks(t){const{OUTER_REFERENCE:e}=this._dataMap,n=(0,i.Sp)(t[32],t[0]),r=(0,i.Sp)(t[16],t[110]),o=[],a=this.getAngles(t),s=Math.cos(a.roll),c=Math.sin(a.roll),{yaw:l,pitch:u}=a;return e.forEach(((e,i)=>{e.forEach((e=>{let a,u;"object"==typeof e?(a=t[e.x],u=t[e.y]):(a=t[e],u=t[e]);const h=this.getSlope(t[16],t[110]),d=-1/h,f=a.y-a.x*h,p=(f-(u.y-u.x*d))/(d-h),g=p,m=p*h+f,y=[.5,.2];let v,_,b;0===i?(b=y[0]*r,v=g+b*c,_=m-b*Math.abs(s)):1===i?(b=.3*n,l>0&&(b*=Math.cos(2*l)),v=g+b*Math.abs(s),_=m+b*c):2===i?(b=y[1]*r,v=g-b*c,_=m+b*Math.abs(s)):(b=.3*n,l<0&&(b*=Math.cos(2*l)),v=g-b*Math.abs(s),_=m-b*c),o.push({x:v,y:_,z:0})}))})),o}initDataMap(){const t=this._configCenter.getConfigByKeys(["triangulation","OUTER_REFERENCE","POINTS_MAP","KEY_POINTS","LEFT_FACE_OVAL","RIGHT_FACE_OVAL","outer_offset_ratio","MOUTH_UPPER","MOUTH_LOWER","lipsTriangulation","LIPS"]);this._dataMap=t}}var h=n(1206),d=n(337),f=n(6879);let p,g,m,y,v,_;if(null==g){p=wx.getSystemInfoSync();let{system:t,version:e}=p;y=e}if(null==g){p=wx.getSystemInfoSync();let{system:t}=p;v=p.SDKVersion,g=t.toLowerCase().indexOf("android")>-1,m=!g,_=parseFloat(v)>=2.25}const b=parseFloat(v)>=2.29;function x(){return p.screenWidth>p.screenHeight}class w extends r.Q4{sprite;options;pushBuffer;stage;tag=!0;realWidth=0;realHeight=0;constructor(t){super(),this.options=t;const e=this.getPusherContent();this.getRealSize(),this.createSprite();const n=e.createOffscreenCanvas({type:"webgl",width:this.realWidth,height:this.realHeight});this.gl=n.getContext("webgl"),m?(this.createFilter(),this.renderer=new h.Th({width:this.realWidth,height:this.realHeight,resolution:1,view:new wx.window.Canvas(n)})):this.initGl()}getRealSize(){const{width:t,height:e}=this.options;m?(this.realWidth=t,this.realHeight=e):(this.realWidth=t/4,this.realHeight=1.5*e)}createSprite(){const t=x(),{width:e,height:n}=this.options,r=this.getPusherContent();console.log(":::::::::画面尺寸",n,e);const i=r.createOffscreenCanvas({type:"2d",width:e,height:n});if(this.ctx2d=i.getContext("2d"),t){const t=n/e;this.ctx2d.translate(i.width/2,i.height/2),m?this.ctx2d.rotate(-Math.PI/2):this.ctx2d.rotate(Math.PI/2),this.ctx2d.translate(-i.height/2,-i.width/2),!m&&this.ctx2d.scale(t,1/t)}const o=h.xE.from(new wx.window.Canvas(i)),a=new h.jy(o);a.anchor.set(.5,.5),a.position.set(e/2,n/2);t?a.scale.set(m?1:-1,1):a.scale.set(m?-1:1.3333333333333333,-1),this.sprite=a,this.pushBuffer=m?new Uint8Array(e*n*4):new Uint8Array(e*n*1.5)}createFilter(){let t=new h.wn(null,"precision lowp float;varying vec2 vTextureCoord;uniform sampler2D uSampler;void main(void){ vec4 color = texture2D(uSampler, vTextureCoord); gl_FragColor = color.bgra;}");this.stage=new h.W2;const e=h.xE.from(new wx.window.Canvas(this.options.output));console.log("::::::::createFilter",this.realWidth,this.realHeight),this.pushSprite=new h.jy(e),this.pushSprite.anchor.set(.5,.5),this.pushSprite.position.set(this.realWidth/2,this.realHeight/2),this.pushSprite.width=this.realWidth,this.pushSprite.height=this.realHeight,this.pushSprite.scale.set(1,-1),this.pushSprite.filters=[t],this.stage.addChild(this.pushSprite)}initGl(){const t=this.gl,e=t.createShader(t.VERTEX_SHADER),n=t.createShader(t.FRAGMENT_SHADER);t.shaderSource(e,"attribute vec2 aVertex;attribute vec2 aUV;varying vec2 vTex;void main(void) { gl_Position = vec4(aVertex, 0.0, 1.0); vTex = aUV;}"),t.shaderSource(n,"\n precision mediump float;\n uniform sampler2D rgbaTexture;\n uniform float height;\n uniform float xUnit;\n varying vec2 vTex;\n \n void main() {\n vec4 coeffsY = vec4(0.299, 0.587, 0.114, 0.0);\n vec4 coeffsU = vec4(-0.14713, -0.28886, 0.436, 0.5);\n vec4 coeffsV = vec4(0.615, -0.515, -0.100, 0.5);\n \n const float V_DIVIDE_LINE = 5.0 / 6.0;\n const float U_DIVIDE_LINE = 1.0 / 1.5;\n \n if (vTex.y <= U_DIVIDE_LINE) {\n vec2 pos0 = vec2(vTex.x - 1.5 * xUnit, vTex.y * 1.5);\n gl_FragColor.r = coeffsY.a + dot(coeffsY.rgb, texture2D(rgbaTexture, pos0).rgb);\n \n vec2 pos1 = vec2(vTex.x - 0.5 * xUnit, vTex.y * 1.5);\n gl_FragColor.g = coeffsY.a + dot(coeffsY.rgb, texture2D(rgbaTexture, pos1).rgb);\n \n vec2 pos2 = vec2(vTex.x + 0.5 * xUnit, vTex.y * 1.5);\n gl_FragColor.b = coeffsY.a + dot(coeffsY.rgb, texture2D(rgbaTexture, pos2).rgb);\n \n vec2 pos3 = vec2(vTex.x + 1.5 * xUnit, vTex.y * 1.5);\n gl_FragColor.a = coeffsY.a + dot(coeffsY.rgb, texture2D(rgbaTexture, pos3).rgb);\n } else if (vTex.y <= V_DIVIDE_LINE) {\n float offsetY = 1.0 / 3.0 / height;\n vec2 texCoord;\n if (vTex.x <= 0.5) {\n texCoord = vec2(vTex.x * 2.0, (vTex.y - U_DIVIDE_LINE) * 2.0 * 3.0);\n } else {\n texCoord = vec2((vTex.x - 0.5) * 2.0, ((vTex.y - U_DIVIDE_LINE) * 2.0 + offsetY) * 3.0);\n }\n vec4 color0 = texture2D(rgbaTexture, texCoord);\n vec4 color1 = texture2D(rgbaTexture, texCoord + vec2(xUnit * 2.0, 0.));\n vec4 color2 = texture2D(rgbaTexture, texCoord + vec2(xUnit * 4.0, 0.));\n vec4 color3 = texture2D(rgbaTexture, texCoord + vec2(xUnit * 6.0, 0.));\n float u0 = coeffsU.a + dot(coeffsU.rgb, color0.rgb);\n float u1 = coeffsU.a + dot(coeffsU.rgb, color1.rgb);\n float u2 = coeffsU.a + dot(coeffsU.rgb, color2.rgb);\n float u3 = coeffsU.a + dot(coeffsU.rgb, color3.rgb);\n gl_FragColor = vec4(u0, u1, u2, u3);\n } else {\n float offsetY = 1.0 / 3.0 / height;\n vec2 texCoord;\n if (vTex.x <= 0.5) {\n texCoord = vec2(vTex.x * 2.0, (vTex.y - V_DIVIDE_LINE) * 2.0 * 3.0);\n } else {\n texCoord = vec2((vTex.x - 0.5) * 2.0, ((vTex.y - V_DIVIDE_LINE) * 2.0 + offsetY) * 3.0);\n }\n vec4 color0 = texture2D(rgbaTexture, texCoord);\n vec4 color1 = texture2D(rgbaTexture, texCoord + vec2(xUnit * 2.0, 0.));\n vec4 color2 = texture2D(rgbaTexture, texCoord + vec2(xUnit * 4.0, 0.));\n vec4 color3 = texture2D(rgbaTexture, texCoord + vec2(xUnit * 6.0, 0.));\n float u0 = coeffsV.a + dot(coeffsV.rgb, color0.rgb);\n float u1 = coeffsV.a + dot(coeffsV.rgb, color1.rgb);\n float u2 = coeffsV.a + dot(coeffsV.rgb, color2.rgb);\n float u3 = coeffsV.a + dot(coeffsV.rgb, color3.rgb);\n gl_FragColor = vec4(u0, u1, u2, u3);\n }\n return;\n }"),t.compileShader(e),t.compileShader(n);const r=t.createProgram();t.attachShader(r,e),t.attachShader(r,n),t.linkProgram(r),t.useProgram(r),t.progObj=r,t.viewport(0,0,this.realWidth,this.realHeight);const i=t.createBuffer();t.bindBuffer(t.ARRAY_BUFFER,i),t.bufferData(t.ARRAY_BUFFER,new Float32Array([-1,1,-1,-1,1,-1,1,1]),t.STATIC_DRAW),t.vertexBuff=i;const o=t.createBuffer();t.bindBuffer(t.ARRAY_BUFFER,o),t.bufferData(t.ARRAY_BUFFER,new Float32Array([0,1,0,0,1,0,1,1]),t.STATIC_DRAW),t.texBuff=o;const a=t.getAttribLocation(r,"aVertex"),s=t.getAttribLocation(r,"aUV"),c=t.getUniformLocation(r,"height"),l=t.getUniformLocation(r,"xUnit");t.uniform1f(c,this.options.height),t.uniform1f(l,1/this.options.width);const u=t.createTexture();t.bindTexture(t.TEXTURE_2D,u),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,this.options.output),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.NEAREST),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.NEAREST),t.tex=u,t.enableVertexAttribArray(a),t.bindBuffer(t.ARRAY_BUFFER,i),t.vertexAttribPointer(a,2,t.FLOAT,!1,0,0),t.enableVertexAttribArray(s),t.bindBuffer(t.ARRAY_BUFFER,o),t.bindTexture(t.TEXTURE_2D,u),t.vertexAttribPointer(s,2,t.FLOAT,!1,0,0)}getPusherContent(){if(this.options?.live?.pusherContext||(this.options.live.pusherContext=wx.createLivePusherContext()),!this.options.live.pusherContext)throw new Error("livepusherContext is not available");return this.options.live.pusherContext}async init(){await this.authorize(),this.start()}async authorize(){if(!wx.authorize)return;let t,e;t=await this.authScope("scope.record");const n=()=>{setTimeout((async r=>{e=await this.authScope("scope.camera"),""===e?n():t&&e||await this.openSetting()}),500)};n()}async openSetting(){return new Promise(((t,e)=>{wx.showModal({content:d.Z.t("0002"),confirmText:d.Z.t("0003"),showCancel:!1,success:e=>{e.confirm?wx.openSetting({success:e=>{console.log("wx auth setting",e),e.authSetting["scope.record"]&&e.authSetting["scope.camera"]&&r.Nd.trigger("error",{code:f.U.AUTH_NEED_RELOAD_PAGE,message:d.Z.t("0013")}),this.authorize().then((()=>{t()}))},fail:()=>{t()}}):e.cancel&&t()}})}))}async authScope(t){return new Promise((async e=>{const n=await this.getSetting();return"scope.camera"===t&&void 0===n[t]?e(""):n[t]?e(!0):void wx.authorize({scope:t,success(){e(!0)},fail(){e(!1)}})}))}async getSetting(){return new Promise(((t,e)=>{wx.getSetting({success:e=>{t(e.authSetting)},fail:()=>{e()}})}))}generatePusherData(){m?(this.pushSprite.texture.update(),this.renderer.render(this.stage)):(this.gl.texSubImage2D(this.gl.TEXTURE_2D,0,0,0,this.gl.RGBA,this.gl.UNSIGNED_BYTE,this.options.output),this.gl.drawArrays(this.gl.TRIANGLE_FAN,0,4)),this.gl.readPixels(0,0,this.realWidth,this.realHeight,this.gl.RGBA,this.gl.UNSIGNED_BYTE,this.pushBuffer),this.ready=!0}start(){const t=this.getPusherContent();t.onCustomRendererEvent("frame",(()=>{if(this.ctx2d.drawImage(t,0,0),this.sprite.texture.update(),this.ready)return this.pushBuffer.buffer}))}stop(){this.getPusherContent().onCustomRendererEvent("frame",null)}destroy(){this.sprite=null,this.stop(),this.generatePusherData=null}}class C extends r.Q4{sprite;listener;options;cameraContext;constructor(t){const e={...t,width:t.width/1,height:t.height/1};super(),this.options=e,this.cameraContext=t.camera?.cameraContext}async init(){await this.authorize(),await this.initCameraIns(),console.log("wx camera init done")}async authorize(){if(!wx.authorize)return;let t,e;t=await this.authScope("scope.record");const n=()=>{setTimeout((async r=>{e=await this.authScope("scope.camera"),""===e?n():t&&e||await this.openSetting()}),500)};n()}async openSetting(){return new Promise(((t,e)=>{wx.showModal({content:d.Z.t("0002"),confirmText:d.Z.t("0003"),showCancel:!1,success:e=>{e.confirm?wx.openSetting({success:e=>{console.log("wx auth setting",e),e.authSetting["scope.record"]&&e.authSetting["scope.camera"]&&r.Nd.trigger("error",{code:f.U.AUTH_NEED_RELOAD_PAGE,message:d.Z.t("0013")}),this.authorize().then((()=>{t()}))},fail:()=>{t()}}):e.cancel&&t()}})}))}async authScope(t){return new Promise((async e=>{const n=await this.getSetting();return"scope.camera"===t&&void 0===n[t]?e(""):n[t]?e(!0):void wx.authorize({scope:t,success(){e(!0)},fail(){e(!1)}})}))}async getSetting(){return new Promise(((t,e)=>{wx.getSetting({success:e=>{t(e.authSetting)},fail:()=>{e()}})}))}async initCameraIns(){this.cameraContext=this.cameraContext||wx.createCameraContext();const t=this.cameraContext.onCameraFrame((t=>{this.frame=t}));this.listener=t,this.start()}readPixels(){return this.frame}async startRecord(t){return this.recording=!0,new Promise(((e,n)=>{this.cameraContext.startRecord({timeoutCallback:t=>{console.log("camera start record timeout",t),this.trigger("timeout",t),this.recording=!1,e(t)},success:n=>{t&&t(),e(n)},fail:t=>{r.Nd.trigger("error",{code:f.U.START_REACORD_FAIL,message:d.Z.t("0009"),error:t})}})}))}async stopRecord(t=!1){return this.recording=!1,new Promise(((e,n)=>{this.cameraContext.stopRecord({compressed:t,success:t=>{e(t)},fail:t=>{r.Nd.trigger("error",{code:f.U.STOP_REACORD_FAIL,message:d.Z.t("0010"),error:t})}})}))}start(){this.listener.start()}stop(){this.listener.stop()}destroy(){this.listener&&(this.listener.stop(),this.listener=null),this.sprite&&(this.sprite=null),this.cameraContext&&(this.cameraContext=null)}}class T{options;frame;constructor(t){this.options=t,this.canvas=wx.createOffscreenCanvas({type:"2d"})}async init(){const t=this.options,{width:e,height:n,input:r}=t;if(r.src){if(!(r.src instanceof ArrayBuffer))return new Promise(((t,i)=>{this.canvas.width=e,this.canvas.height=n;const o=this.canvas.createImage();o.onload=()=>{const e=this.canvas.getContext("2d");e.drawImage(o,0,0);const{data:n}=e.getImageData(0,0,o.width,o.height);this.frame={data:n.buffer,width:o.width,height:o.height},o.src="",t()},o.src=r.src}));this.frame={data:r.src,width:e,height:n}}}readPixels(){return this.frame}destroy(){}}const S=wx.window;class k{canvas=null;_target=null;_input=null;constructor(t){const e={...t,width:t.width/1,height:t.height/1};if(this._options=e,!e.manual){const{width:t,height:n}=e;let r;r=wx.createCanvas(),r.width=t,r.height=n,this.pixels=new Uint8Array(t*n*4),this.canvas=new S.Canvas(r),this._target=new h.W2,this.renderer=new h.Th({view:this.canvas,width:e.width,height:e.height}),this.gl=this.renderer.gl,this._renderFunc=()=>{this.render()},h.vB.shared.add(this._renderFunc)}}render(){const t=this.input;if(t&&t.tick){if(!t.tick())return!1}return this.renderer.render(this._target),!0}set input(t){if(this._input=t,this._target&&t.sprite){this._target.children.forEach((t=>{this._target.removeChild(t)}));try{t.sprite.scale.x=t.sprite.scale.x/1,t.sprite.scale.y=t.sprite.scale.y/1,this._target.addChild(t.sprite)}catch(t){console.log("add child fail",t)}}}get input(){return this._input}async load(t){}destroy(){this._renderFunc&&h.vB.shared.remove(this._renderFunc),this.renderer&&this.renderer.destroy(!0),this._target&&this._target.destroy(!0),this.canvas&&(this.canvas=null)}init(t){}readPixels(){if(this.input.readPixels)return this.input.readPixels();const{width:t,height:e}=this._options;this.gl.readPixels(0,0,t,e,this.gl.RGBA,this.gl.UNSIGNED_BYTE,this.pixels);return{data:this.pixels.buffer,width:t,height:e}}typedArrayToBuffer(t){return t.buffer.slice(t.byteOffset,t.byteLength+t.byteOffset)}async getCanvasNode(){return new Promise((t=>{wx.createSelectorQuery().select("#input-canvas").node().exec((e=>{const n=e[0].node;t(n)}))}))}}var E=n(6237),P=n(401);class R{count=0;mediaContainer;videoRecorder;audioRecorder;audioPath;audioRecorderStarted=!1;recording=!1;options;constructor(t){this.options=t;const{canvas:e,fps:n,audio:r={}}=t;this.createRecorder(e);const{onStart:i,onStop:o}=r;this.audioRecorder=wx.getRecorderManager(),this.audioRecorder.onStop((t=>{this.audioPath=t.tempFilePath,this.audioRecorderStarted=!1,o&&o(t)})),this.audioRecorder.onStart((()=>{this.audioRecorderStarted=!0,i&&i()})),this.mediaContainer=wx.createMediaContainer()}createRecorder(t){try{let e={duration:600,fps:"offscreen"===P.iN||g?30:60,gop:12,timeUpdateInterval:"offscreen"===P.iN||g?30:60,cumulativeStamp:!1,videoBitsPerSecond:3e3};console.log("recorder options",e),this.videoRecorder&&this.videoRecorder.destroy().catch((t=>{}));const n=wx.createMediaRecorder(t,e);this.videoRecorder=n,n.on("start",(()=>{console.log("recorder start success")}))}catch(t){r.Nd.trigger("error",{code:f.U.START_REACORD_FAIL,message:d.Z.t("0008"),error:t})}}async start(){this.videoRecorder&&(await this.videoRecorder.start().catch((t=>{r.Nd.trigger("error",{code:f.U.START_REACORD_FAIL,message:d.Z.t("0009")}),console.error("recorder start error",t)})),await this.startAudioRecorder(),this.recordStartTime=+new Date,this.recording=!0)}async stop(t){if(!this.videoRecorder)return;let e,n;this.recording=!1,this.audioRecorder.stop();try{e=(await this.videoRecorder.stop()).tempFilePath}catch(e){t.destroy||r.Nd.trigger("error",{code:f.U.STOP_REACORD_FAIL,message:d.Z.t("0010"),error:e})}if(console.log("stop record",e),e)try{const{videoTrack:r}=await this.getTracks(e);let i=[r];if(t.musicPath){const{audioTrack:e}=await this.getTracks(t.musicPath).catch((t=>{console.log("music separation fail",t)}));console.log("musicTrack",e),e._audioType="music",i.push(e)}if(t.useOriginAudio){const t=await this.getAudioPath(),{audioTrack:e}=await this.getTracks(t).catch((t=>{}));i.push(e)}n=await this.mergeTracks(...i).catch((t=>{}))}catch(t){n={tempFilePath:e}}try{this.videoRecorder.destroy()}catch(t){console.log("videoRecorder destroy error",t)}try{this.mediaContainer.destroy()}catch(t){console.log("mediaContainer destroy error",t)}return this.videoRecorder=null,n}async startAudioRecorder(){const{audio:t}=this.options;return console.log("zy sdk startAudioRecorder",t),new Promise((e=>{let n,r=()=>{this.audioRecorderStarted?(e(this.audioRecorderStarted),n&&clearTimeout(n)):n=setTimeout(r,10)};this.audioRecorder.start({duration:6e5,format:"mp3",...t}),r()}))}getRecorder(){return this.videoRecorder}async loop(){this.recording&&this.videoRecorder&&this.audioRecorderStarted&&await this.videoRecorder.requestFrame()}async getTracks(t){return new Promise(((e,n)=>{this.mediaContainer.extractDataSource({source:t,success:async({tracks:t})=>{let n,r;for(let e=0;e<t.length;e++)"audio"===t[e].kind?r=t[e]:"video"===t[e].kind&&(n=t[e]);e({audioTrack:r,videoTrack:n})},fail(t){console.log("failed to separate audio track",t),n(t)}})}))}async mergeTracks(t,...e){return new Promise(((n,r)=>{this.mediaContainer.addTrack(t),t.slice(.06,t.duration),e.forEach((e=>{this.mediaContainer.addTrack(e),"music"!==e._audioType&&e.slice(e.duration-t.duration+.06,2*e.duration)})),this.mediaContainer.export({success:r=>{this.mediaContainer.removeTrack(t),e.forEach((t=>{this.mediaContainer.removeTrack(t)})),n(r)},fail:t=>{console.log("mediaContainer export fail",t),r(t)}})}))}async getAudioPath(){return new Promise((t=>{let e,n=()=>{this.audioPath?(t(this.audioPath),e&&clearTimeout(e),this.audioPath=null):e=setTimeout(n,20)};n()}))}}class O extends r.Q4{sprite;options;video;constructor(t){super(),this.options=t}destroy(){try{this.video&&this.video.destroy()}catch(t){}}async init(){if(!this.sprite)return this.getVideoDecoder(),await this.start().catch((t=>{throw new Error("decoder start fail")})),new Promise((async(t,e)=>{let n=async()=>{const e=await this.tick();if(console.log("input init res",e),e)return this._inited=!0,t();setTimeout((()=>{n()}),100)};await n()}))}read(){return this.video.getFrameData()}tick(){const t=this.video.getFrameData();if(!t)return!1;const{width:e,height:n,data:r}=t;if(this.sprite)this.sprite.texture.baseTexture.resource.data=new Uint8Array(r),this.sprite.texture.update();else{const t=h.xE.fromBuffer(new Uint8Array(r),e,n),i=new h.jy(t),o=Math.max(this.options.width/e,this.options.height/n);this.sprite=i,i.anchor.set(.5,.5),i.x=this.options.width/2,i.y=this.options.height/2;const a=wx.getSystemInfoSync();let{system:s}=a;-1===s.toLowerCase().indexOf("android")?i.scale.set(o,o):i.scale.set(o,-o)}return!0}getVideoDecoder(){const t=wx.createVideoDecoder();return this.video=t,t}async start(){return new Promise(((t,e)=>{const{input:n,width:r,height:i}=this.options;this.video.on("start",(()=>{console.log("decoder start success",n),t()})),this.video.on("bufferchange",(()=>{console.log("decoder buffer change")})),this.video.on("error",(t=>{console.log("decoder error",t),e({errMsg:"decoder error"})})),this.video.on("ended",(()=>{console.log("decoder decode ended"),this.trigger("ended")})),this.video.start({source:n,mode:1,abortAudio:!0})}))}async getFps(t){return new Promise(((e,n)=>{let r=wx.createVideoDecoder();r.on("error",(t=>{console.log("init fps error",t),e(30)})),r.on("start",(t=>{console.log("player init fps",t.fps),r&&r.stop().catch((t=>{})),e(t.fps)})),r.on("stop",(()=>{r&&r.remove().catch((()=>{})),r=null})),r.start({source:t,mode:1,abortAudio:!0})}))}stop(){this.video.stop()}destroy(){this.video.remove()}}var D=n(3120),A=n(6309),I=n(5127),F=n(3553),L=n(8586),M=n(6109),N=function(){return N=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},N.apply(this,arguments)},j=function(t,e,n,r){var i,o=arguments.length,a=o<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,n,r);else for(var s=t.length-1;s>=0;s--)(i=t[s])&&(a=(o<3?i(a):o>3?i(e,n,a):i(e,n))||a);return o>3&&a&&Object.defineProperty(e,n,a),a},U=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},B=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function a(t){try{c(r.next(t))}catch(t){o(t)}}function s(t){try{c(r.throw(t))}catch(t){o(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(a,s)}c((r=r.apply(t,e||[])).next())}))},z=function(t,e){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=a.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=e.call(t,a)}catch(t){o=[6,t],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}},W=(0,M.jl)("Auth"),V=(0,P.rR)("68,74,74,70,73,3a,2f,2f,77,65,62,61,72,2e,71,63,6c,6f,75,64,2e,63,6f,6d,2f,73,64,6b"),q=function(){function t(t,e,n,r,i){void 0===r&&(r=""),void 0===i&&(i=""),this.cd=new o.M,this.license=t,this.appid=e+"",this.authFunc=n,this.wechatAppId=r,this.c=new I.Y}return Object.defineProperty(t.prototype,"version",{get:function(){var t,e="1.0.25-0".split(".");return t=0==e[0]&&e[1]<3?"v0":0==e[0]&&3==e[1]&&e[2]<4?"v1":"v2",W.info("sdk version",t),t},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"language",{set:function(t){W.info("wx set language",t),d.Z.lang=t},enumerable:!1,configurable:!0}),t.prototype.exsureAuthData=function(){return B(this,void 0,void 0,(function(){return z(this,(function(t){switch(t.label){case 0:return"102"===this.appid&&(this.authFunc=this.getTemplateAuth.bind(this)),[4,this.authFunc()];case 1:return[2,t.sent()]}}))}))},t.prototype.exsurehad=function(){return B(this,void 0,void 0,(function(){var t,e,n;return z(this,(function(r){switch(r.label){case 0:return[4,this.c.init()];case 1:return r.sent(),[4,this._ts()];case 2:return t=r.sent(),[4,this.exsureAuthData()];case 3:return e=r.sent(),n=this.c.run2(t+"",this.wechatAppId,this.appid),[2,N(N({},e),{key:n,sdkts:t})]}}))}))},t.prototype._ts=function(){return B(this,void 0,void 0,(function(){var t,e,n=this;return z(this,(function(r){switch(r.label){case 0:return[4,this._uc()];case 1:return t=r.sent(),e="".concat(V).concat(t.ti),[2,new Promise((function(t,r){wx.request({url:e,method:"POST",header:{},success:function(e){var r=e.data,i=n.c.a_de(r),o=JSON.parse(i);t(o[(0,P.rR)(P.gz)])},fail:function(e){W.info("wx fetch error",e),t(e)}})}))]}}))}))},t.prototype.getTemplateAuth=function(){var t=this;return new Promise((function(e,n){wx.request({url:"https://1253707637-fkgh1gso7n-gz.scf.tencentcs.com",method:"GET",header:{},success:function(n){var r=n.data,i=t.c.a_de(r),o=JSON.parse(i);e(o)},fail:function(t){W.info("wx fetch error",t),e(t)}})}))},t.prototype._f=function(t,e){return B(this,void 0,void 0,(function(){var n,i,o,a,s,c,l,u,h,p,g,m,y,v=this;return z(this,(function(_){switch(_.label){case 0:return n="Preset"===e.Type&&JSON.stringify(e),this.had?[3,2]:(i=this,[4,this.exsurehad()]);case 1:i.had=_.sent(),_.label=2;case 2:return o=function(){return B(v,void 0,void 0,(function(){var n,r,i=this;return z(this,(function(o){switch(o.label){case 0:return e.Version=this.version,n=this.c.a_en(JSON.stringify(Object.assign({LicenseKey:this.license,AccountArea:"en"===d.Z.lang?1:0},e))),r={p:n},[4,new Promise((function(e,n){wx.request({url:t,method:"POST",header:{"content-type":"application/json",appid:i.appid,timestamp:i.had.timestamp,signature:i.had.signature,authorize:i.had.key,wechatappid:i.wechatAppId,sdktimestamp:i.had.sdkts+"",Language:"en"===d.Z.lang?"en-US":"zh-CN"},data:r,success:function(t){var n=t.data,r=i.c.a_de(n);e(JSON.parse(r))},fail:function(t){W.info("wx fetch error",t),e(t)}})}))];case 1:return[2,o.sent()]}}))}))},n?[3,3]:(s=!1,[3,6]);case 3:return"pending"!==F.Z.get(n)?[3,5]:(c=0,[4,new Promise((function(t,e){var r=function(){c++,a=setTimeout((function(){"pending"!==F.Z.get(n)?(clearTimeout(a),t(void 0),s=!0):c<10?r():(clearTimeout(a),t(void 0),s=!1)}),300)};r()}))]);case 4:return _.sent(),[3,6];case 5:F.Z.has(n)?(s=!0,l=F.Z.get(n),u=l[(0,P.rR)(P.Eh)],((h=+new Date)-1e3*u>6e5||1e3*u>h+6e5)&&(s=!1)):(F.Z.set(n,"pending"),s=!1),_.label=6;case 6:return s?(g=F.Z.get(n),[3,9]):[3,7];case 7:return[4,o()];case 8:g=_.sent(),_.label=9;case 9:return 101!=(p=g).Code?[3,12]:(m=this,[4,this.exsurehad()]);case 10:return m.had=_.sent(),[4,o()];case 11:return p=_.sent(),[3,16];case 12:return 106!=p.Code?[3,15]:(y=this,[4,this.exsurehad()]);case 13:return y.had=_.sent(),[4,o()];case 14:return p=_.sent(),[3,16];case 15:0!==p.Code&&(n&&F.Z.remove(n),101==p.Code?r.Nd.trigger("error",{code:f.U.SIGNATURE_TIMEOUT,message:"Signature timeout, retry failed."}):106==p.Code?r.Nd.trigger("error",{code:f.U.AUTHORIZE_TIMEOUT,message:"Authorize timeout, retry failed."}):r.Nd.trigger("error",{code:f.U.REQUEST_FAIL,message:p.Message})),_.label=16;case 16:return 0===p.Code?(p.WeChatAppId!==this.wechatAppId&&(r.Nd.trigger("error",{code:f.U.AUTH_FAIL,message:d.Z.t("0034")}),p={Code:-1,Data:{}}),n&&F.Z.set(n,p)):F.Z.remove(n),[2,p]}}))}))},t.prototype._uc=function(){return B(this,void 0,void 0,(function(){return z(this,(function(t){switch(t.label){case 0:return[4,this.cd.load()];case 1:return t.sent(),[2,this.cd.getDataConfig(30)]}}))}))},t.prototype._cuid=function(){return!("object"!=typeof navigator||"string"!=typeof navigator.userAgent||!/electron/i.test(navigator.userAgent)||location.host&&("string"!=typeof location.host||!location.host.startsWith("file://")))},t.prototype.go=function(){return B(this,void 0,void 0,(function(){var t,e,n,r,i,o;return z(this,(function(a){switch(a.label){case 0:return a.trys.push([0,3,,4]),[4,this._uc()];case 1:return t=a.sent(),[4,this._f("".concat(V).concat(t.au),{})];case 2:return e=a.sent(),n=(e.Data||{})[(0,P.rR)(P.hJ)]||[],r=[],i=Object.entries(P.ty),n.forEach((function(t){var e=(0,P.$G)(t),n=i.find((function(t){return t[1]===e}));r.push(n[0])})),F.Z.set((0,P.rR)(P.Ty),r),[2,e];case 3:return o=a.sent(),W.info("ar sdk fetch auth error",o),[2,new Error("fetch auth failed")];case 4:return[2]}}))}))},t.prototype.getAllEffectList=function(t){return void 0===t&&(t={}),B(this,void 0,void 0,(function(){var e,n,r,i;return z(this,(function(o){switch(o.label){case 0:return"Preset"===t.Type&&(void 0!==t.Label&&""!==t.Label||(t.Label=[d.Z.t("1001"),d.Z.t("1002")])),[4,this._uc()];case 1:return e=o.sent(),[4,this._f("".concat(V).concat(e.ae),N({Type:"Custom",PageNumber:0,PageSize:1e3},t))];case 2:return(n=o.sent())&&0==n.Code?(r=n.Data.EffectList,i=[],(i="Preset"===t.Type?r.filter((function(t){return!(t.Label.indexOf(d.Z.t("1004"))>-1&&!H("effect_sticker_3d")||t.Label.indexOf(d.Z.t("1005"))>-1&&!H("avatar_vr")||t.Label.indexOf(d.Z.t("1006"))>-1&&!H("avatar_ar"))})):r).forEach((function(t){F.Z.set(t.EffectId,t)})),[2,i]):[2,n]}}))}))},t.prototype.getEffect=function(t){return B(this,void 0,void 0,(function(){var e,n;return z(this,(function(r){switch(r.label){case 0:return F.Z.has(t.EffectId)?[2,F.Z.get(t.EffectId)]:[4,this._uc()];case 1:return e=r.sent(),[4,this._f("".concat(V).concat(e.ef),t)];case 2:return(n=r.sent())&&0==n.Code&&n.Data&&n.Data.Url?(F.Z.set(t.EffectId,n.Data),[2,n.Data]):n.Data&&!n.Data.Url?[2,{message:"invalid id"}]:[2,n]}}))}))},t.prototype.getEffectList=function(t){return void 0===t&&(t={}),B(this,void 0,void 0,(function(){var e;return z(this,(function(n){switch(n.label){case 0:return[4,this.getAllEffectList(t)];case 1:return(e=n.sent())&&e.OtherEffectList&&e.OtherEffectList.length&&r.Nd.trigger("error",{code:f.U.SDK_VERSION_LOW_ERROR,message:d.Z.t("0014")}),e&&e.EffectList?"Preset"===t.Type?[2,e.EffectList]:[2,e.EffectList.filter((function(t){return"Custom"===t.Type}))]:[2,e]}}))}))},t.prototype.getFilterList=function(){return B(this,void 0,void 0,(function(){var t;return z(this,(function(e){switch(e.label){case 0:return[4,this.getAllEffectList({Type:"Preset",Label:d.Z.t("1003")})];case 1:return(t=e.sent())&&t.EffectList?[2,t.EffectList]:[2,t]}}))}))},t.prototype.getAvatarList=function(t){return B(this,void 0,void 0,(function(){var e,n;return z(this,(function(r){switch(r.label){case 0:return e=d.Z.t("1006"),"VR"===t&&(e=d.Z.t("1005")),[4,this.getAllEffectList({Type:"Preset",Label:e})];case 1:return(n=r.sent())&&n.EffectList?[2,n.EffectList]:[2,n]}}))}))},t=j([L.e,U("design:paramtypes",[String,String,Function,String,String])],t)}(),H=function(t){var e=F.Z.get((0,P.rR)(P.Ty)),n=Object.entries(P.ty).find((function(e){return e[1]===(0,P.$G)(t)}));return!(!e||!e.find((function(t){return t===n[0]})))};function G(t,e,n,i){return B(this,void 0,void 0,(function(){var o,a,s,c;return z(this,(function(l){switch(l.label){case 0:return(0,r.E5)(),a=wx.getAccountInfoSync(),s=a.miniProgram.appId,o=new q(t,e,n,s),i&&(o.language=i),[4,o.go()];case 1:if(0!==(null==(c=l.sent())?void 0:c.Code))throw new Error(c);return[2,{getEffectList:o.getEffectList.bind(o),getFilterList:o.getFilterList.bind(o)}]}}))}))}var Y=n(3044),Z=n(3483),K=n.n(Z),X=!1;function $(t,e){!X&&t&&(X=!0,setTimeout((function(){new(K())({id:"1309122168"==t?"j4LDpiL2PlRmZ9ljaJ":"Gl3L4fE8vE5bqOVbV0",uin:t,ext1:t,ext2:e,reportApiSpeed:!0,spa:!1})}),1e3))}var J=n(4809),Q=n(9984);const tt=`${wx.env.USER_DATA_PATH}/ar`;class et extends r.Q4{background=null;stickers=[];filter=null;disabled=!1;constructor(t){super();let{auth:e,live:n}=t;const{licenseKey:i,appId:o,authFunc:a}=e,s=wx.getAccountInfoSync();this.auth=new q(i,o,a,s.miniProgram.appId),r.Nd.on("error",(t=>{this.trigger("error",t)})),$(o),this.checkReady=this.auth.go().then((t=>0===t.Code&&(this.trigger("created"),this.trigger("ready"),!0))).catch((()=>!1)),this.config=n}async clearStickers(){this.getPusherContent().clearStickers()}async resetStickers(){const t=this.getPusherContent();let e,n;return this.clearStickers(),this.background&&(e=new Promise(((e,n)=>{t.applySticker({type:"back",stickers:[{id:this.background.id,title:this.background.id,len:1,active:-1,path:this.background.path,segtype:0}],success:t=>{e(t)},fail:n})}))),this.stickers.length&&(n=new Promise(((e,n)=>{t.applySticker({type:"front",stickers:this.stickers.map((t=>({id:t.id,title:t.id,len:1,active:-1,pos:t.pos,path:t.path,segtype:0}))),success:t=>{e(t)},fail:n})}))),Promise.all([e,n])}async transSticker(t=[]){const e=t.map((async t=>{const[e,n]=this.getFilename(t.url);return t.id=e,t.path=await this.getZipDataPath(t.url,e,n),t}));return Promise.all(e)}async getEffect(t){if("debug"===t)return{Url:"https://webar-static.tencent-cloud.com/custom-effect/1309122168/1658976205287/effect.bin"};return await this.auth.getEffect({EffectId:t})}getPusherContent(){return this.config.pusherContext||(this.config.pusherContext=wx.createLivePusherContext()),this.config.pusherContext}getFilename(t=""){if(t instanceof ArrayBuffer)return["buffer"+Date.now(),"png"];const e=t.split("/"),n=e[e.length-1]||"test.png",r=parseInt((new Date).valueOf()/1e3);let[i="test",o="png"]=n.split(".");return i=i.replace(/[^a-zA-Z0-9]/g,"")+r,[i,o]}async getImageSize(t){return new Promise(((e,n)=>{wx.getImageInfo({src:t,success:t=>{e({width:t.width,height:t.height})},fail:n})}))}async preloadVcubeFile(t,e){await(0,Q.sN)(tt);const n=`${tt}/${t}`,r=await(0,Q.nH)(n),i=wx.getFileSystemManager();if(!r){const r=await(0,Q.pe)(t,e);await new Promise(((t,e)=>{i.unzip({zipFilePath:r,targetPath:n,success:t,fail:e,complete:()=>{i.unlink({filePath:r})}})}))}return new Promise(((t,e)=>{i.readFile({filePath:`${n}/content.json`,encoding:"utf8",success:({data:e})=>{const r=JSON.parse(e);t([n,r])},fail:e})}))}async download(t){return t instanceof ArrayBuffer?t:new Promise(((e,n)=>{wx.request({url:t,responseType:"arrayBuffer",success:t=>{const{data:n}=t;e(n)},fail:t=>{n(t)}})}))}async getZipDataPath(t,e,n){await(0,Q.sN)(tt);const r=`${tt}/${e}.zip`;if(await(0,Q.nH)(r))return r;const i=await this.download(t),o=new Uint8Array(i),a=(0,J.Xo)({[`${e}_0.${n}`]:o});return await new Promise(((t,e)=>{wx.getFileSystemManager().writeFile({filePath:r,data:a.buffer,encoding:"binary",success:()=>{t()},fail:t=>{e(t)}})})),r}async setBackground(t){t=t||{};const{type:e,src:n=""}=t;if("image"!==e&&n)return new Error("live mode is not supported");if(!n)return this.background=null,this.resetStickers();if(!await this.checkReady)throw this.trigger("error",{code:f.U.AUTH_FAIL,message:"Arsdk is not ready"}),new Error("Arsdk is not ready");return[this.background]=await this.transSticker([{url:n}]),this.resetStickers()}async clearFile(t){let e=wx.getFileSystemManager();return new Promise(((n,r)=>{e.unlink({filePath:t,success:n,fail:r})}))}async _setFilter(t,e=1){this.filter=[t,e];const n=this.getPusherContent();return new Promise(((r,i)=>{n.applyFilter({path:t,md5:"",alpha:e,success:r,fail:i})}))}async setWatermark(t=[]){if(!t?.length)return this.stickers=[],this.resetStickers();if(!await this.checkReady)throw this.trigger("error",{code:f.U.AUTH_FAIL,message:"Arsdk is not ready"}),new Error("Arsdk is not ready");return this.stickers=await this.transSticker(t),this.resetStickers()}async setFilter(t,e=1){if(!await this.checkReady)throw this.trigger("error",{code:f.U.AUTH_FAIL,message:"Arsdk is not ready"}),new Error("Arsdk is not ready");const{Url:n}=await this.getEffect(t),[r,i]=await this.preloadVcubeFile(t,n),o=`${r}/${i.filter[0].src}`;await(0,Q.nH)(o);return this._setFilter(o,e)}disable(){if(this.disabled)return;this.disabled=!0;const t=this.getPusherContent();t.clearStickers(),t.clearFilters()}async enable(){if(this.disabled)return this.disabled=!1,this.filter&&await this._setFilter(...this.filter),this.resetStickers()}destroy(){this.disable(),this.auth=null,this.stickers=[],this.filter=null,this.background=null}}const nt=0,rt=2,it=3,ot=4;function at(t){t&&(P.F3.defaultRoot=t.replace(/^\/|\/$/g,""))}const st={whiten:0,dermabrasion:0,lift:0,shave:0,eye:0,chin:0};class ct extends r.Q4{_input;_detector;_ready=!1;_renderer;_options;_renderFunc;renderSprite;outputCanvas;outputRenderer;lastestEffectIds=[];loadedIdMap=new Map;tickworker;input_type;count=0;flag_1=!1;flag_2=!1;disabled=!1;el=new A.e({});takePhotoPromises=[];get enableFaceDetect(){return!this.disabled&&(this.flag_1||this.flag_2)}disable(){this.disabled||(this.disabled=!0,this._renderer&&(this._renderer.disable(),this._renderer.disableExclusiveFilter()))}enable(){this.disabled&&(this.disabled=!1,this._renderer&&(this._renderer.enable(),this._renderer.enableExclusiveFilter()))}constructor(t){h.U1(),super();const{auth:e,input:n,live:i,camera:o,beautify:a,loading:s,output:c,plugin3d:l,language:u}=t;if((0,r.E5)(),d.Z.lang=u||"zh",n){if(!("string"==typeof n||n?.width&&n?.height))return void r.Nd.trigger("error",{message:d.Z.t("0004"),code:f.U.INPUT_ERROR});this.input_type=it}else if(o)this.input_type=nt;else{if(!i)return void r.Nd.trigger("error",{message:d.Z.t("0005"),code:f.U.INPUT_ERROR});if(this.input_type=ot,!b)throw new Error("The current WeChat version does not support it. Please upgrade and try again");if("native"===i.mode)return new et(t)}this.isReadyPromise=this.startAuth(e);const p={camera:o,input:n,live:i,mirror:this.input_type===nt&&o.mirror,beautify:a,plugin3d:l,output:new wx.window.Canvas(c)};s&&s.enable&&(p.enableLoadingIcon=s.enable,p.loadingIconOptions={size:s.size,lineWidth:s.lineWidth,strokeColor:s.strokeColor}),this._options=p,this.getAutoSize(n||o||i).then((({width:t,height:n})=>{this._options.width=t,this._options.height=n,"offscreen"===P.iN&&this.input_type!==ot&&(this.outputCanvas=new wx.window.Canvas(wx.createOffscreenCanvas({type:"webgl",width:this._options.width,height:this._options.height})),this.outputRenderer=new h.Th({view:this.outputCanvas,width:this._options.width,height:this._options.height,preserveDrawingBuffer:!0,antialias:!1})),this.init(),$(e.appId,e.sdkAppId)})),wx.onMemoryWarning?.((()=>{console.log("Out of memory!"),this.el.clearCache(),(0,Y.UI)()}))}async getAutoSize(t){if(this.input_type===ot){let e=t?.pushSize;return e?.realHeight&&e?.realWidth||(e=ct.getRealSize(720)),{width:e?.realWidth,height:e?.realHeight}}return this.input_type===nt?{width:t.width,height:t.height}:this.input_type===it?t.width&&t.height?{width:t.width,height:t.height}:new Promise(((e,n)=>{wx.getImageInfo({src:t,success:n=>{e({width:n.width,height:n.height}),this._options.input={src:t,...n}},fail:n})})):void 0}init(){wx.requestAnimationFrame=this._options.output.requestAnimationFrame,wx.cancelAnimationFrame=this._options.output.cancelAnimationFrame,this._detector=_?new u(this._options):new a,this._input=new k({...this._options,manual:this.input_type===nt||this.input_type===it}),this._renderer=new E.g(this._options),this.inputNode=this.getInputNode(),Promise.all([this.isReadyPromise.then((()=>this.trigger("created"))),this._initCommonResLoader(),this.inputNode.init(),this._detector.init(),this._renderer.addBeautyAsync("default",this._options.beautify||{})]).then((()=>{this._input.input=this.inputNode,this.checkIsBeauti(this._options.beautify),this._ready||(this.trigger("ready"),this._ready=!0),this._initMainLoop()})),r.Nd.on("error",(t=>{this.trigger("error",t)}))}_initMainLoop(){this._renderFunc=async()=>{let t="low"===this._options.live?.fps?4:2;this.input_type===it&&(t=10),this.count%t==0&&this.render().catch((t=>console.log("render fail",t))),this.count++,this.count>=4&&(this.count=0)},h.vB.shared.add(this._renderFunc)}logTime(t){const e=+new Date;console.log(`${t}时间:${e-this.currentTime}`),this.currentTime=e}async setInput(t){const{width:e,height:n}=await this.getAutoSize(t);this._options.width=e,this._options.height=n,this.outputCanvas.width=e,this.outputCanvas.height=n,this.outputRenderer.resize(n,n),this._options.input.src=t?.src||t,this._renderer.options={...this._options},await this.inputNode.init(),this._ready&&this.render()}async render(){if(this._destroyed)return;const t=this._input.readPixels();if(!t?.width)return!1;if(this.enableFaceDetect){const e=await this._detector.send(t),{landmarks:n,angles:r,meshVertex:i,lipVertex:o}=e;this._renderer.setMesh(i),this._renderer.setReshapeMarks(n),this._renderer.tick({landmarks:n,meshVertex:i,lipVertex:o,angles:r,image:this.input_type===ot?this._input.canvas:t,isLivePusher:this.input_type===ot})}else this._renderer.tick({landmarks:[],meshVertex:[],lipVertex:[],angles:{},image:this.input_type===ot?this._input.canvas:t,isLivePusher:this.input_type===ot});this.recordRender(),this._takePhoto(),this.transcodeLive()}recordRender(){if(this.recording)if("offscreen"===P.iN){if(this.ttt=new Date,this.renderSprite){this.renderSprite.texture.update()}else{let t=h.xE.from(this._renderer._canvas);this.renderSprite=new h.jy(t),this.renderSprite.anchor.set(.5,.5),this.renderSprite.position.x=this.renderSprite.width/2,this.renderSprite.position.y=this.renderSprite.height/2,!g||"8.0.28"!=y&&"8.0.29"!=y&&"8.0.30"!=y?this.renderSprite.scale.set(1,1):this.renderSprite.scale.set(1,-1)}this.outputRenderer.render(this.renderSprite),this.recordCanvasRendered||(this.recordCanvasRendered=!0)}else this.recorder.loop();else if(this.takingPhoto){const t=this._renderer.getPixels();this.cacheImage=t}}async startAuth(t){const{licenseKey:e,appId:n,authFunc:r}=t,i=wx.getAccountInfoSync();this._a=new q(e,n,r,i.miniProgram.appId);const o=await this._a.go();return 0!==o?.Code?Promise.reject(o.Message):o}async getEffectList(t={}){return await this._a.getEffectList(t)}async getEffect(t){if("debug"===t)return{Url:"https://webar-static.tencent-cloud.com/custom-effect/1309122168/1658976205287/effect.bin"};const e=await this._a.getEffect({EffectId:t});return e.Url?e:Promise.reject(e.message)}async getCommonFilter(){return await this._a.getFilterList()}async _initCommonResLoader(){const t=new D.KI;await t.init()}getInputNode(){if(this.input_type===it)return new T(this._options);if(this.input_type===rt){const t=new O(this._options);return t.on("ended",(()=>{this.trigger("ended")})),t}return this.input_type===ot?new w(this._options):new C(this._options)}checkIsBeauti(t){t=t||{},Object.keys(t).some((e=>"whiten"!==e&&"dermabrasion"!==e&&t[e]))?this.flag_1=!0:this.flag_1=!1}setBeautify(t){t=t||{},t={...st,...t},H("beautify")?(this.checkIsBeauti(t),this.checkReady().then((()=>{this._renderer.switchMode("Sticker"),this._renderer.updateBeauty("default",t)}))):this.trigger("error",{code:f.U.AUTH_API_FAIL,message:d.Z.t("0007")})}setEffect(t,e,n){if(!H("effect_makeup")||!H("effect_sticker_2d"))return void this.trigger("error",{code:f.U.AUTH_API_FAIL,message:d.Z.t("0007")});if(!this._renderer)return void this.trigger("error",{code:f.U.SET_EFFECT_ERROR,message:"no face detected"});t.length?this.flag_2=!0:this.flag_2=!1;let r=[],i=[],o=[];if(Array.isArray(t))t.forEach((t=>{if(t instanceof Object){r.push(t.id);let e=t.intensity;e=this._checkVoid(e)?1:e,i.push(t.intensity);let n=t.filterIntensity;o.push(this._checkVoid(n)?e:n)}else r.push(t),i.push(1),o.push(1)}));else if(t instanceof Object){r=[t.id];let e=t.intensity;e=this._checkVoid(e)?1:e,i=[e],i=[t.intensity];let n=t.filterIntensity;o=[this._checkVoid(n)?e:n]}else r=[t],i=[1],o=[1];this.setEffectInner(r,i,o,e,n)}_checkVoid(t){return null==t}setEffectInner(t,e,n,i,o){this.el.clearCache(),this.lastestEffectIds=t,this._renderer.showLoading(),Promise.all(t.map((t=>this.getEffect(t).then((t=>t.Url))))).then((async r=>{t.some((t=>-1===this.lastestEffectIds.indexOf(t)))||(await E.g.preloadEffects(r),this._renderer.hideLoading(),t.some((t=>-1===this.lastestEffectIds.indexOf(t)))||(i&&"function"==typeof i&&i(),this._renderer.switchMode("Sticker"),this._renderer.setEffect(r,e,n,(()=>!!H("effect_sticker_3d")||(this.trigger("error",{code:f.U.AUTH_API_FAIL,message:d.Z.t("0007")}),!1))).then((t=>{}))))})).catch((e=>{console.log("set effect error",t,e),r.Nd.trigger("error",{code:f.U.SET_EFFECT_ERROR,message:"set effect error",error:e}),this._renderer.hideLoading(),o&&"function"==typeof o&&o()}))}setFilter(t,e=1,n,i){H("filter")?this._renderer?t&&"none"!==t?(this.loadedIdMap.has(t)||this._renderer.showLoading(),this.getEffect(t).then((async r=>{this.loadedIdMap.has(t)||await E.g.preloadEffects([r.Url]),this._renderer.hideLoading(),this.loadedIdMap.set(t,r.Url),n&&"function"==typeof n&&n(),this._renderer.switchMode("Sticker"),this._renderer.setExclusiveFilter(r.Url,e)})).catch((t=>{r.Nd.trigger("error",{code:f.U.SET_FILTER_ERROR,message:"set filter error",error:t}),this._renderer.hideLoading(),i&&"function"==typeof i&&i()}))):this._renderer.removeExclusiveFilter():this.trigger("error",{code:f.U.SET_FILTER_ERROR,message:"no face detected"}):this.trigger("error",{code:f.U.AUTH_API_FAIL,message:d.Z.t("0007")})}async checkReady(){return new Promise((t=>{let e;const n=()=>{this._ready?(t(),e&&clearTimeout(e)):e=setTimeout(n,1e3)};n()}))}async startRecord(t={audio:{format:"mp3"},recordCamera:!1}){if(!this.recording){if(this.input_type===ot)throw new Error("record in live mode is not support");return this.recording=!0,this.recorder=new R({canvas:"offscreen"===P.iN?this.outputCanvas:this._options.output,...t}),await this.recorder.start(),this._startTime=+new Date,"offscreen"===P.iN&&(this.tickworker=wx.createWorker(`${P.F3.defaultRoot}/worker/tick.worker.js`),this.tickworker.onMessage((()=>{this.recorder.loop()})),this.tickworker.postMessage("start")),t.recordCamera&&this.inputNode.startRecord(),this.recorder}}async stopRecord(t={useOriginAudio:!1,destroy:!1,compressed:!1}){if(!this.recording)return;if(g){const t=3e3,e=t=>new Promise(((e,n)=>{console.log("wait time",t),setTimeout((()=>e()),t)}));await e(Math.max(0,t-(+new Date-this._startTime)))}this.tickworker.postMessage("stop"),this.tickworker.terminate();const e=await this.recorder.stop(t);if(this.recorder=null,this.recording=!1,this.inputNode.recording){const{tempVideoPath:n}=await this.inputNode.stopRecord(t.compressed);e.cameraVideoPath=n}return e}async getVideoInfo(t){return new Promise(((e,n)=>{wx.getVideoInfo({src:t,success:t=>{e(t)},fail:()=>{n({errMsg:"get video info fail"})}})}))}async takePhoto(t=!1){return new Promise((e=>{this.takePhotoPromises.push(e),t&&this.render()}))}_takePhoto(){const t=this.takePhotoPromises.shift();if(t){const c=this.cacheImage||this._renderer.getPixels(),{data:l,width:u,height:h}=c;for(var e=new Uint8ClampedArray(this.typedArrayToBuffer(l)),n=h/2|0,r=4*u,i=new Uint8ClampedArray(4*u),o=0;o<n;++o){var a=o*r,s=(h-o-1)*r;i.set(e.subarray(a,a+r)),e.copyWithin(a,s,s+r),e.set(i,s)}t({uint8ArrayData:e,width:u,height:h})}}typedArrayToBuffer(t){return t.buffer.slice(t.byteOffset,t.byteLength+t.byteOffset)}start(){h.vB.shared.start()}stop(){h.vB.shared.stop()}toggleOccluder(){this._renderer.app3d.toggleOccluder()}destroy(t=!0){this._a.had=void 0,this._destroyed=!0,(0,r.SZ)(),this._renderFunc&&h.vB.shared.remove(this._renderFunc),this._detector&&this._detector.destroy(),this._renderer&&this._renderer.destroy(),this._input&&this._input.destroy(),this.inputNode&&this.inputNode.destroy(),this.outputRenderer&&(this.outputRenderer.destroy(),this.renderSprite&&this.renderSprite.destroy(!0)),this.outputCanvas&&(this.outputCanvas=null),t&&async function(){wx.createCanvas=null;for(let t in h.P6.kN){const e=h.P6.kN[t];h.xE.removeFromCache(e),e.destroy(!0)}(0,Y.UI)(),new A.e({}).clearCache(),h.Ep(),h.vB.shared.stop()}()}static getRealSize(t=720){t=t||720;const{platform:e,pixelRatio:n}=p,r=x(),i=16/9;let o=Math.round(t*i);const a={width:"0",height:"0",showWidth:0,showHeight:0,realWidth:0,realHeight:0};function s(t,e=2){const r=Math.round(t*n);return r%e!=0?s(t-1,e):[t,r]}if("ios"===e)t=t%2?t-1:t,o=o%2?o-1:o,a.showWidth=a.realWidth=r?o:t,a.showHeight=a.realHeight=r?t:o;else{const e=Math.round(t/n),i=Math.round(o/n);[a.showWidth,a.realWidth]=s(r?i:e,4),[a.showHeight,a.realHeight]=s(r?e:i)}return a.width=a.showWidth+"px",a.height=a.showHeight+"px",a.ratio=r?.5625:i,a}checkPusherSize(t,e){const n=x();if(!n&&t>720)throw new Error(`live-pusher width cannot be greater than 720px,currently is ${t}px`);if(n&&e>720)throw new Error(`live-pusher height cannot be greater than 720px,currently is ${e}px`);if(g){if(t%4!=0||e%2!=0)throw new Error("live-pusher width or height is not support. please use Arsdk.getRealSize")}else if(t%2!=0||e%2!=0)throw new Error("live-pusher width or height cannot is not support. please use Arsdk.getRealSize")}transcodeLive(){this.input_type===ot&&this.inputNode?.generatePusherData()}changeLiveFps(t){if("high"!==t||"low"!==t)throw new Error("fps must be set to low or high");this._options.live.fps=t}}async function lt(t){return new Promise((async e=>{const n=await async function(){return new Promise(((t,e)=>{wx.getSetting({success:e=>{t(e.authSetting)},fail:()=>{e()}})}))}();if(n[t])return e(!0);wx.authorize({scope:t,success(){e(!0)},fail(){e(!1)}})}))}async function ut(){let t,e;t=await lt("scope.record"),e=await lt("scope.camera"),t&&e||await async function(){return new Promise(((t,e)=>{wx.showModal({content:d.Z.t("0002"),confirmText:d.Z.t("0003"),showCancel:!1,success:e=>{e.confirm?wx.openSetting({success:e=>{console.log("wx setting auth",e),ut().then((()=>{t()}))},fail:()=>{t()}}):e.cancel&&t()}})}))}()}var ht=n(885),dt=n(1730)},3553:(t,e,n)=>{n.d(e,{Z:()=>a});var r=n(401),i=function(t){var e="function"==typeof Symbol&&Symbol.iterator,n=e&&t[e],r=0;if(n)return n.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&r>=t.length&&(t=void 0),{value:t&&t[r++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},o=function(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var r,i,o=n.call(t),a=[];try{for(;(void 0===e||e-- >0)&&!(r=o.next()).done;)a.push(r.value)}catch(t){i={error:t}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return a};const a=new(function(){function t(){this.data=new Map,this.set("common-v3",{Url:(0,r.xb)()})}return t.prototype.set=function(t,e){this.data.set(t,e)},t.prototype.get=function(t){return this.data.get(t)},t.prototype.has=function(t){return this.data.has(t)},t.prototype.remove=function(t){this.data.delete(t)},t.prototype.clear=function(){this.data.clear()},t.prototype.findId=function(t){var e,n;try{for(var r=i(this.data),a=r.next();!a.done;a=r.next()){var s=o(a.value,2),c=s[0];s[1];if(this.data.get(c).Url===t)return c}}catch(t){e={error:t}}finally{try{a&&!a.done&&(n=r.return)&&n.call(r)}finally{if(e)throw e.error}}return null},t}())},3849:(t,e,n)=>{n.d(e,{t:()=>s});var r,i=n(6878),o=n(6109),a=(r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},r(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function n(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}),s=function(t){function e(){var e=t.call(this)||this;return e._options={},e._hairColor={r:56,g:0,b:100},e}return a(e,t),Object.defineProperty(e.prototype,"options",{get:function(){return this._options},enumerable:!1,configurable:!0}),e.prototype.getOptions=function(){return this._options},e.prototype.setOptions=function(t){void 0!==t.mirror&&t.mirror!==this._options.mirror&&(o.bH.log("mirrorchange",t.mirror),this.trigger("mirrorChange",{mirror:t.mirror})),this._options=t},Object.defineProperty(e.prototype,"hairColor",{get:function(){return this._hairColor},set:function(t){this._hairColor=this.getRGB(t)},enumerable:!1,configurable:!0}),e.prototype.getRGB=function(t){var e=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(t);return e?{r:parseInt(e[1],16),g:parseInt(e[2],16),b:parseInt(e[3],16)}:null},e.instance=new e,e}(i.Q4)},1077:(t,e,n)=>{n.d(e,{F:()=>R});var r,i=n(1206),o=n(5536),a=n(3120),s=(r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},r(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function n(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}),c=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function a(t){try{c(r.next(t))}catch(t){o(t)}}function s(t){try{c(r.throw(t))}catch(t){o(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(a,s)}c((r=r.apply(t,e||[])).next())}))},l=function(t,e){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=a.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=e.call(t,a)}catch(t){o=[6,t],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}},u=function(t){function e(e){var n=t.call(this)||this;return n._options=e,n}return s(e,t),e.prototype.getFilterInstance=function(t){return c(this,void 0,Promise,(function(){var e,n=this;return l(this,(function(r){switch(r.label){case 0:return[4,this.init()];case 1:return e=r.sent(),[2,this.loadImage(e).then((function(e){return e[a.RY].baseTexture.scaleMode=i.aH.LINEAR,e[a.RY].baseTexture.mipmap=i.KI.OFF,new o.f("lutSkin",n._options,{uniforms:{lut:e[a.RY],lutSize:[512,512],intensity:t}})}))]}}))}))},e}(a.KI),h=n(617);const d="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 }";var f=n(401),p=n(6109),g=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),m=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function a(t){try{c(r.next(t))}catch(t){o(t)}}function s(t){try{c(r.throw(t))}catch(t){o(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(a,s)}c((r=r.apply(t,e||[])).next())}))},y=function(t,e){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=a.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=e.call(t,a)}catch(t){o=[6,t],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}},v=function(){function t(t){this._options=t}return Object.defineProperty(t.prototype,"uniforms",{set:function(t){for(var e in t)this._filter.uniforms[e]=t[e]},enumerable:!1,configurable:!0}),t.prototype.applyTo=function(t){t.filters||(t.filters=[]),t.filters.indexOf(this._filter)>-1||(t.filters.push(this._filter),this._container=t)},t.prototype.removeFrom=function(t){if(t.filters&&-1!==t.filters.indexOf(this._filter)){var e=t.filters.indexOf(this._filter);t.filters.splice(e,1),this._container=null}},t.prototype.resize=function(t,e){this._options.width=t,this._options.height=e,this._filter&&this._filter.resize(t,e)},t}(),_=function(t){function e(e,n){var r=t.call(this,n)||this;return r.intensity=e,r}return g(e,t),Object.defineProperty(e.prototype,"intensity",{get:function(){return this._intensity},set:function(t){this._intensity=t,this._filter&&(this._filter.uniforms.intensity=t<.01?0:t)},enumerable:!1,configurable:!0}),e.prototype.init=function(){return m(this,void 0,Promise,(function(){var t;return y(this,(function(e){switch(e.label){case 0:return[4,new u(this._options).getFilterInstance(this.intensity)];case 1:return t=e.sent(),this._filter=t,t.uniforms.intensity=this._intensity<.01?0:this._intensity,[2]}}))}))},e}(v),b=function(t){function e(e,n){var r=t.call(this,n)||this,a=r._options,s=a.width,c=a.height,l=new i.jd({width:s,height:c});return r.renderTexture=new i.TI(l),r._filter=new o.f("dermabrasion",n,{uniforms:{intensity:e<.01?0:e,faceMask:r.renderTexture,enable:1}}),r.intensity=e,r}return g(e,t),Object.defineProperty(e.prototype,"renderer",{get:function(){return this._renderer},set:function(t){this._renderer=t},enumerable:!1,configurable:!0}),e.prototype.render=function(){if(this.geometry){if(!this.faceMesh){var t={mask:i.P6.kN[a.L4],intensity:1},e=i.ex.from(d,"precision mediump float;\nvarying vec2 vUvs;\nuniform sampler2D mask;\nuniform float intensity;\n\nvoid main() {\n vec4 color = texture2D(mask, vUvs);\n color = vec4(color.rgb, color.a) * intensity;\n gl_FragColor = color;\n}",t);this.faceMesh=new i.Kj(this.geometry,e)}this.renderer&&this.renderer.render(this.faceMesh,{renderTexture:this.renderTexture})}},e.prototype.resize=function(e,n){t.prototype.resize.call(this,e,n),this.renderTexture.resize(e,n)},e.prototype.applyTo=function(e){t.prototype.applyTo.call(this,e)},Object.defineProperty(e.prototype,"intensity",{get:function(){return this._intensity},set:function(t){this._intensity=t,this._intensity=.7*t,this._filter&&(this._filter.uniforms.intensity=this._intensity<.01?0:this._intensity)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"enable",{set:function(t){this._filter.uniforms.enable=t?1:0},enumerable:!1,configurable:!0}),e}(v),x=function(t){function e(e,n,r){var a=t.call(this,r)||this,s=a._options,c=s.width,l=s.height,u=new i.jd({width:c,height:l});return a.renderTexture=new i.TI(u),a._filter=new o.f("partialDermabrasion",r,{uniforms:{intensity:1,faceMask:a.renderTexture}}),a.intensityDarkCircle=e,a.intensityNasolabialFolds=n,a}return g(e,t),Object.defineProperty(e.prototype,"intensityDarkCircle",{get:function(){return this._intensityDarkCircle},set:function(t){this._intensityDarkCircle=t,this._shader&&(this._shader.uniforms.intensityDarkCircle=t<.01?0:t)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"intensityNasolabialFolds",{get:function(){return this._intensityNasolabialFolds},set:function(t){this._intensityNasolabialFolds=t,this._shader&&(this._shader.uniforms.intensityNasolabialFolds=t<.01?0:t)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"renderer",{get:function(){return this._renderer},set:function(t){this._renderer=t},enumerable:!1,configurable:!0}),e.prototype.render=function(){if(this.geometry){if(!this.faceMesh){var t={falingwen:i.P6.kN[a.F7],heiyanquan:i.P6.kN[a.B3],intensityDarkCircle:this.intensityDarkCircle,intensityNasolabialFolds:this.intensityNasolabialFolds},e=i.ex.from(d,"precision mediump float;\nvarying vec2 vUvs;\nuniform sampler2D falingwen;\nuniform sampler2D heiyanquan;\nuniform float intensityNasolabialFolds;\nuniform float intensityDarkCircle;\n\nvoid main() {\n vec4 color = texture2D(falingwen, vUvs) * intensityNasolabialFolds + texture2D(heiyanquan, vUvs) * intensityDarkCircle;\n \n gl_FragColor = vec4(color.a, 0.,0.,1.);\n}",t);this._shader=e,this.faceMesh=new i.Kj(this.geometry,e)}this.renderer&&this.renderer.render(this.faceMesh,{renderTexture:this.renderTexture})}},e.prototype.resize=function(e,n){t.prototype.resize.call(this,e,n),this.renderTexture.resize(e,n)},e}(v),w=function(t){function e(e,n){var r=t.call(this,n)||this;return r._filter=new o.f("usm",n,{intensity:e}),r.intensity=e,r}return g(e,t),Object.defineProperty(e.prototype,"intensity",{get:function(){return this._intensity},set:function(t){this._intensity=t,this._filter.uniforms.intensity=t<.01?0:t},enumerable:!1,configurable:!0}),e}(v),C=["left_eye_center","right_eye_center","nose_tip","contour_chin","nose_bridge5","contour_left4","contour_left9","contour_right4","contour_right9","contour_left10","contour_right10","mouth_lower_lip_bottom","nose_tip1","nose_bottom","nose_left1","nose_left2","nose_right1","nose_right2","lip_top_left","lip_top_right","lip_bottom_left","lip_bottom_right","lip_top_left_target","lip_top_right_target","lip_bottom_left_target","lip_bottom_right_target","lip_top_center","lip_top_center_target","lip_bottom_center","lip_bottom_center_target","lip_inner_top","lip_inner_bottom","forehead_top_center","eyebrow_center","forehead_left","left_eyebrow_center","forehead_right","right_eyebrow_center","right_eye_top","left_eye_top","right_eye_bottom","left_eye_bottom","contour_left3","contour_right3","nose_bridge6","nose_bridge4","nose_bridge3","nose_bridge2","nose_bridge1","chin_left","chin_right"],T=function(t){function e(e,n){var r=t.call(this,e)||this;return r._enable=0,r.intensities=n,r._keymap=(new h.M).getDataConfig(f.c4.POINTS_MAP),r}return g(e,t),Object.defineProperty(e.prototype,"landmarks",{set:function(t){if(t.length){var e=C,n=this._getCartesianPointsByKeys(t,e);this._keypoints={};for(var r=0;r<e.length;r++){var i=e[r];this._keypoints[i]=n[r]}this._updateFilter(this._keypoints)}},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"intensities",{get:function(){return this._intensity},set:function(t){t.enable=this._enable?t.enable:this._enable,this._intensity=t,this._updateFilter(t)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"enable",{set:function(t){var e=t?1:0;this._enable!==e&&(this._enable=e,this._updateFilter({enable:this._enable}))},enumerable:!1,configurable:!0}),e.prototype._updateFilter=function(t){var e,n;if(!this._filter){var r={};C.forEach((function(t){r[t]=[0,0]})),r.enable=this._enable,this._filter=new o.f("faceReshape",this._options,{uniforms:r})}for(var i in t)this._filter.uniforms[i]=t[i]||0;this._filter.uniforms.distortCenter1=(null===(e=this._keypoints)||void 0===e?void 0:e[this.intensities.distortCenter1])||[0,0],this._filter.uniforms.distortCenter2=(null===(n=this._keypoints)||void 0===n?void 0:n[this.intensities.distortCenter2])||[0,0]},e.prototype._getCartesianPointsByKeys=function(t,e){var n=this._keymap,r=[];return e.forEach((function(e){try{var i=t[n[e]],o={x:i.x,y:i.y};r.push([o.x,o.y])}catch(t){p.kg.error("err",e,n[e],t)}})),r},e}(v),S=function(){function t(t,e,n){this._beautify={whiten:0,dermabrasion:0,eyeWhiten:0,teethWhiten:0,darkCircle:0,nasolabialFolds:0,lift:0,shave:0,cheekbone:0,head:0,eyeBrightness:0,lip:0,forehead:0,nose:0,eye:0,chin:0,usm:0,distort1:0,distort2:0},this._detected=!1,this.id=t,this._target=e,this._options=n}return Object.defineProperty(t.prototype,"detected",{get:function(){return this._detected},set:function(t){if(this._detected!==t){if(this._detected=t,this._reshape){var e=this._beautify;this._reshape.intensities={lift:e.lift,shave:e.shave,cheekbone:e.cheekbone,head:e.head,eyeBrightness:e.eyeBrightness,lip:e.lip,forehead:e.forehead,nose:e.nose,eye:e.eye,chin:e.chin,darkCircle:e.darkCircle,nasolabialFolds:e.nasolabialFolds,distort1:e.distort1,distortCenter1:e.distortCenter1,distortMajorRadius1:e.distortMajorRadius1,distortMinorRadius1:e.distortMinorRadius1,distort2:e.distort2,distortCenter2:e.distortCenter2,distortMajorRadius2:e.distortMajorRadius2,distortMinorRadius2:e.distortMinorRadius2,enable:e.lift||e.shave||e.darkCircle||e.nasolabialFolds||e.cheekbone||e.head||e.eyeBrightness||e.lip||e.forehead||e.eye||e.chin||e.nose||e.distort1||e.distort2?1:0}}this._dermabrasion&&(this._dermabrasion.enable=t)}},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"beautify",{set:function(t){this._beautify=Object.assign(this._beautify,t);var e=this._beautify,n=e.whiten,r=e.dermabrasion,i=(e.eyeWhiten,e.teethWhiten,e.darkCircle),o=e.nasolabialFolds,a=e.lift,s=e.shave,c=e.cheekbone,l=e.head,u=e.eyeBrightness,h=e.lip,d=e.forehead,f=e.nose,p=e.eye,g=e.chin,m=e.usm,y=e.distort1,v=e.distortCenter1,_=e.distortMajorRadius1,b=e.distortMinorRadius1,x=e.distort2,w=e.distortCenter2,C=e.distortMajorRadius2,T=e.distortMinorRadius2;this._whiten&&(this._whiten.intensity=n),this._dermabrasion&&(this._dermabrasion.intensity=r),this._partialDermabrasion&&(this._partialDermabrasion.intensityDarkCircle=i,this._partialDermabrasion.intensityNasolabialFolds=o),this._usm&&(this._usm.intensity=m),this._reshape&&(this._reshape.intensities={lift:a,shave:s,cheekbone:c,head:l,eyeBrightness:u,lip:h,forehead:d,nose:f,eye:p,chin:g,darkCircle:i,nasolabialFolds:o,distort1:y,distortCenter1:v,distortMajorRadius1:_,distortMinorRadius1:b,distort2:x,distortCenter2:w,distortMajorRadius2:C,distortMinorRadius2:T,enable:a||s||c||l||u||h||d||p||g||o||o||f||y||x?1:0})},enumerable:!1,configurable:!0}),t.prototype.load=function(){return m(this,void 0,Promise,(function(){var t,e,n,r,i,o,a=this;return y(this,(function(s){switch(s.label){case 0:return this.loaded?[2]:(this.loaded=!0,this._config?[3,2]:(this._config=new h.M,[4,this._config.load()]));case 1:s.sent(),s.label=2;case 2:return t=Object.assign(this._beautify),e=void 0!==t.whiten&&null!==t.whiten?t.whiten:f.em,this._whiten=new _(e,this._options),n=void 0!==t.dermabrasion&&null!==t.dermabrasion?t.dermabrasion:f.Ss,this._dermabrasion=new b(n,this._options),r=void 0!==t.darkCircle&&null!==t.darkCircle?t.darkCircle:0,i=void 0!==t.nasolabialFolds&&null!==t.nasolabialFolds?t.nasolabialFolds:0,this._partialDermabrasion=new x(r,i,this._options),void 0!==t.eyeWhiten&&null!==t.eyeWhiten?t.eyeWhiten:0,void 0!==t.teethWhiten&&null!==t.teethWhiten?t.teethWhiten:0,this._usm=new w(t.usm||0,this._options),o={lift:t.lift,shave:t.shave,cheekbone:t.cheekbone,head:t.head,eyeBrightness:t.eyeBrightness,lip:t.lip,forehead:t.forehead,nose:t.nose,darkCircle:t.darkCircle,nasolabialFolds:t.nasolabialFolds,eye:t.eye,chin:t.chin,distort1:t.distort1,distortCenter1:t.distortCenter1,distortMajorRadius1:t.distortMajorRadius1,distortMinorRadius1:t.distortMinorRadius1,distort2:t.distort2,distortCenter2:t.distortCenter2,distortMajorRadius2:t.distortMajorRadius2,distortMinorRadius2:t.distortMinorRadius2,enable:t.lift||t.shave||t.darkCircle||t.nasolabialFolds||t.cheekbone||t.head||t.eyeBrightness||t.lip||t.forehead||t.nose||t.eye||t.chin||t.distort1||t.distort2?1:0},this._reshape=new T(this._options,o),[2,this._whiten.init().then((function(){a.apply()}))]}}))}))},t.prototype.setReshapeMarks=function(t){t&&t.length?this._reshape&&(this._reshape.landmarks=t,this._reshape.enable=!0):this._reshape.enable=!1},t.prototype.setMesh=function(t){if(t&&t.length){if(!this.geometry){var e=this._config.getDataConfig(26),n=(new i.wG).addAttribute("aVertexPosition",t).addAttribute("aUvs",e);this.geometry=n}this.geometry.getBuffer("aVertexPosition").update(t),this._dermabrasion&&(this._dermabrasion.geometry=this.geometry,this._partialDermabrasion.geometry=this.geometry,this._dermabrasion.render(),this._partialDermabrasion.render())}},t.prototype.setRenderer=function(t){var e,n=this,r=function(){n._dermabrasion&&n._partialDermabrasion?(n._dermabrasion.renderer=t,n._partialDermabrasion.renderer=t,clearTimeout(e)):e=setTimeout(r,30)};r()},t.prototype.resize=function(t,e){this._whiten&&this._whiten.resize(t,e),this._dermabrasion&&this._dermabrasion.resize(t,e),this._partialDermabrasion&&this._partialDermabrasion.resize(t,e),this._reshape&&this._reshape.resize(t,e),this._usm&&this._usm.resize(t,e)},t.prototype.remove=function(){this._active&&(this._whiten&&this._whiten.removeFrom(this._target),this._dermabrasion&&this._dermabrasion.removeFrom(this._target),this._partialDermabrasion&&this._partialDermabrasion.removeFrom(this._target),this._reshape&&this._reshape.removeFrom(this._target),this._usm&&this._usm.removeFrom(this._target),this._active=!1)},t.prototype.apply=function(){this._active||(this._whiten&&this._whiten.applyTo(this._target),this._dermabrasion&&this._dermabrasion.applyTo(this._target),this._partialDermabrasion&&this._partialDermabrasion.applyTo(this._target),this._reshape&&this._reshape.applyTo(this._target),this._usm&&this._usm.applyTo(this._target),this._active=!0)},t.prototype.destroy=function(){this.remove(),this._whiten=null,this._dermabrasion=null,this._partialDermabrasion=null,this._reshape=null},t}(),k=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function a(t){try{c(r.next(t))}catch(t){o(t)}}function s(t){try{c(r.throw(t))}catch(t){o(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(a,s)}c((r=r.apply(t,e||[])).next())}))},E=function(t,e){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=a.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=e.call(t,a)}catch(t){o=[6,t],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}},P=(0,p.jl)("beautify-controller"),R=function(){function t(t){this._beautifies={},this._detected=!1,this._options=t}return Object.defineProperty(t.prototype,"renderer",{get:function(){return this._renderer},set:function(t){this._renderer=t,this.setRenderer()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"detected",{get:function(){return this._detected},set:function(t){for(var e in this._detected=t,this._beautifies){this._beautifies[e].detected=t}},enumerable:!1,configurable:!0}),t.prototype.updateBeauty=function(t,e){this._beautifies[t]?this.setBeauty(t,e):this.addBeauty(t,e)},t.prototype.setBeauty=function(t,e){void 0===t&&(t="default");var n=this._beautifies[t];n&&(n.beautify=e)},t.prototype.addBeauty=function(t,e){void 0===t&&(t="default"),void 0===e&&(e={});var n=new S(t,this._target,this._options);n.detected=this.detected,e&&(n.beautify=e),this._beautifies[t]&&this.removeBeauty(t),n.loaded||(n.load(),n.setRenderer(this.renderer)),this._beautifies[t]=n},t.prototype.addBeautyAsync=function(t,e){return void 0===t&&(t="default"),void 0===e&&(e={}),k(this,void 0,void 0,(function(){var n,r;return E(this,(function(i){switch(i.label){case 0:return n=+new Date,P.info("addBeautyAsync",t,this._options),(r=new S(t,this._target,this._options)).detected=this.detected,e&&(r.beautify=e),[4,r.load()];case 1:return i.sent(),r.setRenderer(this.renderer),this._beautifies[t]&&this.removeBeauty(t),this._beautifies[t]=r,P.info("log::::input node addBeautyAsync finish",+new Date-n),[2]}}))}))},t.prototype.enable=function(){for(var t in this._beautifies)this._beautifies[t].apply()},t.prototype.disable=function(){for(var t in this._beautifies)P.info("disable beautify",t),this._beautifies[t].remove()},t.prototype.resize=function(t,e){for(var n in this._beautifies)this._beautifies[n].resize(t,e)},t.prototype.removeBeauty=function(t){this._beautifies[t].destroy(),delete this._beautifies[t]},t.prototype.removeEffectBeauties=function(){for(var t in this._beautifies)"default"!==t&&this.removeBeauty(t)},t.prototype.setReshapeMarks=function(t){for(var e in this._beautifies)this._beautifies[e].setReshapeMarks(t)},t.prototype.setMesh=function(t){for(var e in this._beautifies)this._beautifies[e].setMesh(t)},t.prototype.setRenderer=function(){for(var t in this._beautifies)this._beautifies[t].setRenderer(this.renderer)},t}()},5156:(t,e,n)=>{n.d(e,{Z:()=>a});var r,i=n(1206),o=(r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},r(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function n(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)});const a=function(t){function e(e){var n=t.call(this)||this;n.degreeStart=-90,n.degreeEnd=270,n.stepStart=14,n.stepEnd=2,n.isVisible=!1;var r;return r=wx.getSystemInfoSync().pixelRatio,n.size=(e.size||100)*r,n.radius=n.size/2,n.lineWidth=(e.lineWidth||8)*r,n.strokeStyle=e.strokeColor||4286945,n.queue={},n.graphics=new i.TC,n.graphics.scale.set(1/r,1/r),n.addChild(n.graphics),n._draw=n.draw.bind(n),n}return o(e,t),e.prototype.draw=function(){this.degreeStart=this.degreeStart+this.stepStart,this.degreeEnd=this.degreeEnd+this.stepEnd,this.degreeStart-360>this.degreeEnd&&(this.degreeStart-=720);var t=this.graphics;t.clear(),t.lineStyle(this.lineWidth,this.strokeStyle),t.arc(0,0,this.radius-this.lineWidth/2,(this.degreeStart<this.degreeEnd?this.degreeStart:this.degreeEnd)*Math.PI/180,(this.degreeStart<this.degreeEnd?this.degreeEnd:this.degreeStart)*Math.PI/180)},e.prototype.addTicker=function(){i.vB.shared.add(this._draw)},e.prototype.removeTicker=function(){i.vB.shared.remove(this._draw)},e.prototype.show=function(t){t&&(this.queue[t]=1),this.isVisible||(clearTimeout(this.t),this.graphics.visible=!0,this.draw(),this.addTicker(),this.isVisible=!0)},e.prototype.hide=function(t){if(t){this.queue[t]=void 0;var e=!0;for(var n in this.queue)this.queue[n]&&(e=!1);e&&this._hide()}else this._hide()},e.prototype._hide=function(){this.t&&clearTimeout(this.t),this.graphics.visible=!1,this.removeTicker(),this.isVisible=!1},e.prototype.destroy=function(){this._hide(),this.graphics.destroy(!0)},e}(i.W2)},3120:(t,e,n)=>{n.d(e,{B3:()=>h,F7:()=>u,KI:()=>p,L4:()=>c,RY:()=>d,X_:()=>f});var r=n(1206),i=n(3044),o=n(401),a=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function a(t){try{c(r.next(t))}catch(t){o(t)}}function s(t){try{c(r.throw(t))}catch(t){o(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(a,s)}c((r=r.apply(t,e||[])).next())}))},s=function(t,e){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=a.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=e.call(t,a)}catch(t){o=[6,t],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}},c="face.png",l="eye.png",u="falingwen.png",h="heiyanquan.png",d="whiten.png",f="lips-mask-wx2.png",p=function(){function t(){}return t.prototype.init=function(){return a(this,void 0,Promise,(function(){var t;return s(this,(function(e){switch(e.label){case 0:return[4,(t=new i.pF).init()];case 1:return e.sent(),[4,t.preload((0,o.xb)())];case 2:return e.sent(),[2,t.getIndeLoader()]}}))}))},t.prototype.loadImage=function(t){return a(this,void 0,Promise,(function(){return s(this,(function(e){return[2,new Promise((function(e,n){var i={};if(r.P6.kN[d]&&r.P6.kN[f]&&r.P6.kN[c]&&r.P6.kN[l]&&r.P6.kN[u]&&r.P6.kN[h])return i[d]=r.P6.kN[d],i[f]=r.P6.kN[f],i[c]=r.P6.kN[c],i[l]=r.P6.kN[l],i[u]=r.P6.kN[u],i[h]=r.P6.kN[h],e(i);t.add(d),t.add(f),t.add(c),t.add(l),t.add(u),t.add(h),t.load((function(t,n){return i[d]=r.P6.kN[d],i[f]=r.P6.kN[f],i[c]=r.P6.kN[c],i[l]=r.P6.kN[l],i[u]=r.P6.kN[u],i[h]=r.P6.kN[h],e(i)}))}))]}))}))},t}()},5536:(t,e,n)=>{n.d(e,{f:()=>s});var r=n(1206);var i,o=(i=function(t,e){return i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},i(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function n(){this.constructor=t}i(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}),a={mirror:{fragment:"\nuniform sampler2D uSampler;\nvarying vec2 vTextureCoord;\n\nvoid main() {\n vec2 p = vTextureCoord;\n p.x = 1.0 - p.x;\n vec4 color = texture2D(uSampler, p);\n gl_FragColor = color;\n}\n"},mirrorVertical:{fragment:"\nuniform sampler2D uSampler;\nvarying vec2 vTextureCoord;\n\nvoid main() {\n vec2 p = vTextureCoord;\n p.y = 1.0 - p.y;\n vec4 color = texture2D(uSampler, p);\n gl_FragColor = color;\n}\n"},lut:{fragment:"\nvarying vec2 vTextureCoord;\nuniform sampler2D uSampler;\nuniform sampler2D lut;\nuniform lowp float intensity;\nuniform lowp float parentIntensity;\n\nvoid main() {\n vec4 color = texture2D(uSampler, vTextureCoord.xy);\n\n highp float blueColor = color.b * 63.0;\n \n //向下取值\n highp vec2 quad1;\n quad1.y = floor(floor(blueColor) / 8.0); \n quad1.x = floor(blueColor) - (quad1.y * 8.0);\n \n //向上取值\n highp vec2 quad2;\n quad2.y = floor(ceil(blueColor) / 8.0); \n quad2.x = ceil(blueColor) - (quad2.y * 8.0);\n \n //根据小正方形格子和RG通道,获取纹理坐标,每个大格子的大小:1/8=0.125,每个小格子的大小:1/512\n highp vec2 texPos1;\n texPos1.x = (quad1.x * 0.125) + 0.5/512.0 + ((0.125 - 1.0/512.0) * color.r);\n texPos1.y = (quad1.y * 0.125) + 0.5/512.0 + ((0.125 - 1.0/512.0) * color.g);\n \n highp vec2 texPos2;\n texPos2.x = (quad2.x * 0.125) + 0.5/512.0 + ((0.125 - 1.0/512.0) * color.r);\n texPos2.y = (quad2.y * 0.125) + 0.5/512.0 + ((0.125 - 1.0/512.0) * color.g);\n \n lowp vec4 newColor1 = texture2D(lut, texPos1);\n lowp vec4 newColor2 = texture2D(lut, texPos2);\n \n lowp vec3 newColor = mix(newColor1.rgb, newColor2.rgb, fract(blueColor));\n\n vec3 textureColor = mix(color.rgb, newColor, intensity * parentIntensity * 1.0);\n\n gl_FragColor = vec4(textureColor, 1.0);\n}\n"},lutSkin:{fragment:"precision mediump float;\n#define dimension 64.0\nuniform sampler2D uSampler; // 底图\nvarying vec2 vTextureCoord;\n\nuniform sampler2D lut; // lut 图\nuniform float intensity; // 强度\nuniform vec2 lutSize; // lut 尺寸\nvoid main() {\n vec4 color = texture2D(uSampler, vTextureCoord);\n float row = floor(sqrt(dimension) + 0.5);\n float blueColor = color.b * (dimension - 1.0);\n vec2 quad1;\n quad1.y = floor(floor(blueColor) / row);\n quad1.x = floor(blueColor) - (quad1.y * row);\n vec2 quad2;\n quad2.y = floor(ceil(blueColor) / row);\n quad2.x = ceil(blueColor) - (quad2.y * row);;\n vec2 texPos1;\n texPos1.x = (quad1.x * (1.0/row)) + 0.5/lutSize.x + ((1.0/row - 1.0/lutSize.x) * color.r);\n texPos1.y = (quad1.y * (1.0/row)) + 0.5/lutSize.y + ((1.0/row - 1.0/lutSize.y) * color.g);\n vec2 texPos2;\n texPos2.x = (quad2.x * (1.0/row)) + 0.5/lutSize.x + ((1.0/row - 1.0/lutSize.x) * color.r);\n texPos2.y = (quad2.y * (1.0/row)) + 0.5/lutSize.y + ((1.0/row - 1.0/lutSize.y) * color.g);\n vec4 newColor1 = texture2D(lut, texPos1);\n vec4 newColor2 = texture2D(lut, texPos2);\n vec4 newColor = mix(newColor1, newColor2, fract(blueColor));\n vec4 finalColor = mix(color, vec4(newColor.rgb, color.a), intensity);\n gl_FragColor = finalColor;\n}\n"},partialLutSkin:{fragment:"precision mediump float;\nvarying highp vec2 vTextureCoord;\n\nuniform sampler2D uSampler; // 图像texture\nuniform sampler2D grayTexture; // 灰度查找表\nuniform sampler2D lookupTexture; // LUT\n\nuniform highp float levelRangeInv; // 范围\nuniform lowp float levelBlack; // 灰度level \n// uniform lowp float intensity; // 肤色程度 \nuniform sampler2D faceMask;\n\nvoid main() {\n float mask = texture2D(faceMask, vTextureCoord).a;\n lowp vec3 textureColor = texture2D(uSampler, vTextureCoord).rgb;\n\n \n // if (mask == 0.) {\n // gl_FragColor = vec4(textureColor, 1.0); \n // return;\n // };\n \n\n textureColor = clamp((textureColor - vec3(levelBlack, levelBlack, levelBlack)) * levelRangeInv, 0.0, 1.0);\n textureColor.r = texture2D(grayTexture, vec2(textureColor.r, 0.5)).r;\n textureColor.g = texture2D(grayTexture, vec2(textureColor.g, 0.5)).g;\n textureColor.b = texture2D(grayTexture, vec2(textureColor.b, 0.5)).b;\n\n mediump float blueColor = textureColor.b * 15.0;\n\n mediump vec2 quad1;\n quad1.y = floor(blueColor / 4.0);\n quad1.x = floor(blueColor) - (quad1.y * 4.0);\n\n mediump vec2 quad2;\n quad2.y = floor(ceil(blueColor) / 4.0);\n quad2.x = ceil(blueColor) - (quad2.y * 4.0);\n\n highp vec2 texPos1;\n texPos1.x = (quad1.x * 0.25) + 0.5 / 64.0 + ((0.25 - 1.0 / 64.0) * textureColor.r);\n texPos1.y = (quad1.y * 0.25) + 0.5 / 64.0 + ((0.25 - 1.0 / 64.0) * textureColor.g);\n\n highp vec2 texPos2;\n texPos2.x = (quad2.x * 0.25) + 0.5 / 64.0 + ((0.25 - 1.0 / 64.0) * textureColor.r);\n texPos2.y = (quad2.y * 0.25) + 0.5 / 64.0 + ((0.25 - 1.0 / 64.0) * textureColor.g);\n\n lowp vec4 newColor1 = texture2D(lookupTexture, texPos1);\n lowp vec4 newColor2 = texture2D(lookupTexture, texPos2);\n\n lowp vec3 newColor = mix(newColor1.rgb, newColor2.rgb, fract(blueColor));\n\n // textureColor = mix(textureColor, newColor, 1.0);\n textureColor = mix(textureColor, newColor, mask);\n\n gl_FragColor = vec4(textureColor, 1.0); \n}\n"},dermabrasion:{fragment:"precision lowp float;\nuniform sampler2D uSampler;\nvarying lowp vec2 vTextureCoord;\n\nuniform int width;\nuniform int height;\n\nuniform float intensity;\n\nvoid main() {\n vec3 centralColor;\n\n centralColor = texture2D(uSampler, vTextureCoord).rgb;\n \n // if(intensity < 0.01) {\n // gl_FragColor = vec4(centralColor, 1.0);\n // return;\n // }\n float x_a = float(width);\n float y_a = float(height);\n\n float mul_x = 2.0 / x_a;\n float mul_y = 2.0 / y_a;\n vec2 blurCoordinates0 = vTextureCoord + vec2(0.0 * mul_x, -10.0 * mul_y);\n vec2 blurCoordinates2 = vTextureCoord + vec2(8.0 * mul_x, -5.0 * mul_y);\n vec2 blurCoordinates4 = vTextureCoord + vec2(8.0 * mul_x, 5.0 * mul_y);\n vec2 blurCoordinates6 = vTextureCoord + vec2(0.0 * mul_x, 10.0 * mul_y);\n vec2 blurCoordinates8 = vTextureCoord + vec2(-8.0 * mul_x, 5.0 * mul_y);\n vec2 blurCoordinates10 = vTextureCoord + vec2(-8.0 * mul_x, -5.0 * mul_y);\n\n mul_x = 1.8 / x_a;\n mul_y = 1.8 / y_a;\n vec2 blurCoordinates1 = vTextureCoord + vec2(5.0 * mul_x, -8.0 * mul_y);\n vec2 blurCoordinates3 = vTextureCoord + vec2(10.0 * mul_x, 0.0 * mul_y);\n vec2 blurCoordinates5 = vTextureCoord + vec2(5.0 * mul_x, 8.0 * mul_y);\n vec2 blurCoordinates7 = vTextureCoord + vec2(-5.0 * mul_x, 8.0 * mul_y);\n vec2 blurCoordinates9 = vTextureCoord + vec2(-10.0 * mul_x, 0.0 * mul_y);\n vec2 blurCoordinates11 = vTextureCoord + vec2(-5.0 * mul_x, -8.0 * mul_y);\n\n mul_x = 1.6 / x_a;\n mul_y = 1.6 / y_a;\n vec2 blurCoordinates12 = vTextureCoord + vec2(0.0 * mul_x,-6.0 * mul_y);\n vec2 blurCoordinates14 = vTextureCoord + vec2(-6.0 * mul_x,0.0 * mul_y);\n // vec2 blurCoordinates16 = vTextureCoord + vec2(0.0 * mul_x,6.0 * mul_y);\n // vec2 blurCoordinates18 = vTextureCoord + vec2(6.0 * mul_x,0.0 * mul_y);\n\n mul_x = 1.4 / x_a;\n mul_y = 1.4 / y_a;\n vec2 blurCoordinates13 = vTextureCoord + vec2(-4.0 * mul_x,-4.0 * mul_y);\n vec2 blurCoordinates15 = vTextureCoord + vec2(-4.0 * mul_x,4.0 * mul_y);\n // vec2 blurCoordinates17 = vTextureCoord + vec2(4.0 * mul_x,4.0 * mul_y);\n // vec2 blurCoordinates19 = vTextureCoord + vec2(4.0 * mul_x,-4.0 * mul_y);\n\n float central;\n float gaussianWeightTotal;\n float sum;\n float sampler;\n float distanceFromCentralColor;\n float gaussianWeight;\n\n float distanceNormalizationFactor = 3.6;\n\n central = texture2D(uSampler, vTextureCoord).g;\n gaussianWeightTotal = 0.2;\n sum = central * 0.2;\n\n sampler = texture2D(uSampler, blurCoordinates0).g;\n distanceFromCentralColor = min(abs(central - sampler) * distanceNormalizationFactor, 1.0);\n gaussianWeight = 0.09 * (1.0 - distanceFromCentralColor);\n gaussianWeightTotal += gaussianWeight;\n sum += sampler * gaussianWeight;\n\n sampler = texture2D(uSampler, blurCoordinates1).g;\n distanceFromCentralColor = min(abs(central - sampler) * distanceNormalizationFactor, 1.0);\n gaussianWeight = 0.09 * (1.0 - distanceFromCentralColor);\n gaussianWeightTotal += gaussianWeight;\n sum += sampler * gaussianWeight;\n\n sampler = texture2D(uSampler, blurCoordinates2).g;\n distanceFromCentralColor = min(abs(central - sampler) * distanceNormalizationFactor, 1.0);\n gaussianWeight = 0.09 * (1.0 - distanceFromCentralColor);\n gaussianWeightTotal += gaussianWeight;\n sum += sampler * gaussianWeight;\n\n sampler = texture2D(uSampler, blurCoordinates3).g;\n distanceFromCentralColor = min(abs(central - sampler) * distanceNormalizationFactor, 1.0);\n gaussianWeight = 0.09 * (1.0 - distanceFromCentralColor);\n gaussianWeightTotal += gaussianWeight;\n sum += sampler * gaussianWeight;\n\n sampler = texture2D(uSampler, blurCoordinates4).g;\n distanceFromCentralColor = min(abs(central - sampler) * distanceNormalizationFactor, 1.0);\n gaussianWeight = 0.09 * (1.0 - distanceFromCentralColor);\n gaussianWeightTotal += gaussianWeight;\n sum += sampler * gaussianWeight;\n\n sampler = texture2D(uSampler, blurCoordinates5).g;\n distanceFromCentralColor = min(abs(central - sampler) * distanceNormalizationFactor, 1.0);\n gaussianWeight = 0.09 * (1.0 - distanceFromCentralColor);\n gaussianWeightTotal += gaussianWeight;\n sum += sampler * gaussianWeight;\n\n sampler = texture2D(uSampler, blurCoordinates6).g;\n distanceFromCentralColor = min(abs(central - sampler) * distanceNormalizationFactor, 1.0);\n gaussianWeight = 0.09 * (1.0 - distanceFromCentralColor);\n gaussianWeightTotal += gaussianWeight;\n sum += sampler * gaussianWeight;\n\n sampler = texture2D(uSampler, blurCoordinates7).g;\n distanceFromCentralColor = min(abs(central - sampler) * distanceNormalizationFactor, 1.0);\n gaussianWeight = 0.09 * (1.0 - distanceFromCentralColor);\n gaussianWeightTotal += gaussianWeight;\n sum += sampler * gaussianWeight;\n\n sampler = texture2D(uSampler, blurCoordinates8).g;\n distanceFromCentralColor = min(abs(central - sampler) * distanceNormalizationFactor, 1.0);\n gaussianWeight = 0.09 * (1.0 - distanceFromCentralColor);\n gaussianWeightTotal += gaussianWeight;\n sum += sampler * gaussianWeight;\n\n sampler = texture2D(uSampler, blurCoordinates9).g;\n distanceFromCentralColor = min(abs(central - sampler) * distanceNormalizationFactor, 1.0);\n gaussianWeight = 0.09 * (1.0 - distanceFromCentralColor);\n gaussianWeightTotal += gaussianWeight;\n sum += sampler * gaussianWeight;\n\n sampler = texture2D(uSampler, blurCoordinates10).g;\n distanceFromCentralColor = min(abs(central - sampler) * distanceNormalizationFactor, 1.0);\n gaussianWeight = 0.09 * (1.0 - distanceFromCentralColor);\n gaussianWeightTotal += gaussianWeight;\n sum += sampler * gaussianWeight;\n\n sampler = texture2D(uSampler, blurCoordinates11).g;\n distanceFromCentralColor = min(abs(central - sampler) * distanceNormalizationFactor, 1.0);\n gaussianWeight = 0.09 * (1.0 - distanceFromCentralColor);\n gaussianWeightTotal += gaussianWeight;\n sum += sampler * gaussianWeight;\n\n sampler = texture2D(uSampler, blurCoordinates12).g;\n distanceFromCentralColor = min(abs(central - sampler) * distanceNormalizationFactor, 1.0);\n gaussianWeight = 0.1 * (1.0 - distanceFromCentralColor);\n gaussianWeightTotal += gaussianWeight;\n sum += sampler * gaussianWeight;\n\n sampler = texture2D(uSampler, blurCoordinates13).g;\n distanceFromCentralColor = min(abs(central - sampler) * distanceNormalizationFactor, 1.0);\n gaussianWeight = 0.1 * (1.0 - distanceFromCentralColor);\n gaussianWeightTotal += gaussianWeight;\n sum += sampler * gaussianWeight;\n\n sampler = texture2D(uSampler, blurCoordinates14).g;\n distanceFromCentralColor = min(abs(central - sampler) * distanceNormalizationFactor, 1.0);\n gaussianWeight = 0.1 * (1.0 - distanceFromCentralColor);\n gaussianWeightTotal += gaussianWeight;\n sum += sampler * gaussianWeight;\n\n sampler = texture2D(uSampler, blurCoordinates15).g;\n distanceFromCentralColor = min(abs(central - sampler) * distanceNormalizationFactor, 1.0);\n gaussianWeight = 0.1 * (1.0 - distanceFromCentralColor);\n gaussianWeightTotal += gaussianWeight;\n sum += sampler * gaussianWeight;\n\n // sampler = texture2D(uSampler, blurCoordinates16).g;\n // distanceFromCentralColor = min(abs(central - sampler) * distanceNormalizationFactor, 1.0);\n // gaussianWeight = 0.1 * (1.0 - distanceFromCentralColor);\n // gaussianWeightTotal += gaussianWeight;\n // sum += sampler * gaussianWeight;\n\n // sampler = texture2D(uSampler, blurCoordinates17).g;\n // distanceFromCentralColor = min(abs(central - sampler) * distanceNormalizationFactor, 1.0);\n // gaussianWeight = 0.1 * (1.0 - distanceFromCentralColor);\n // gaussianWeightTotal += gaussianWeight;\n // sum += sampler * gaussianWeight;\n\n // sampler = texture2D(uSampler, blurCoordinates18).g;\n // distanceFromCentralColor = min(abs(central - sampler) * distanceNormalizationFactor, 1.0);\n // gaussianWeight = 0.1 * (1.0 - distanceFromCentralColor);\n // gaussianWeightTotal += gaussianWeight;\n // sum += sampler * gaussianWeight;\n\n // sampler = texture2D(uSampler, blurCoordinates19).g;\n // distanceFromCentralColor = min(abs(central - sampler) * distanceNormalizationFactor, 1.0);\n // gaussianWeight = 0.1 * (1.0 - distanceFromCentralColor);\n // gaussianWeightTotal += gaussianWeight;\n // sum += sampler * gaussianWeight;\n\n sum = sum/gaussianWeightTotal;\n\n sampler = centralColor.g - sum + 0.5;\n\n // 高反差保留\n for(int i = 0; i < 5; ++i) {\n sampler = mix(sampler * sampler * 2.0, 1.0 - ((1.0 - sampler)*(1.0 - sampler) * 2.0), step(0.5,sampler));\n // sampler = sampler <= 0.5 ? sampler * sampler * 2.0 : 1.0 - ((1.0 - sampler)*(1.0 - sampler) * 2.0);\n // if(sampler <= 0.5) {\n // sampler = sampler * sampler * 2.0;\n // } else {\n // sampler = 1.0 - ((1.0 - sampler)*(1.0 - sampler) * 2.0);\n // }\n }\n\n float aa = 1.0 + pow(sum, 0.3) * 0.09;\n vec3 smoothColor = centralColor * aa - vec3(sampler) * (aa - 1.0);\n smoothColor = clamp(smoothColor, vec3(0.0), vec3(1.0));\n\n smoothColor = mix(centralColor, smoothColor, pow(centralColor.g, 0.33));\n smoothColor = mix(centralColor, smoothColor, pow(centralColor.g, 0.39));\n\n smoothColor = mix(centralColor, smoothColor, intensity * 1.5);\n\n gl_FragColor = vec4(pow(smoothColor, vec3(0.96)), 1.0);\n \n }"},partialDermabrasion:{fragment:"precision lowp float;\nuniform sampler2D uSampler;\nuniform sampler2D faceMask;\nvarying lowp vec2 vTextureCoord;\n\nuniform int width;\nuniform int height;\n\n// uniform float intensity;\n\nfloat normpdf(in float x, in float sigma)\n{\n\treturn 0.39894*exp(-0.5*x*x/(sigma*sigma))/sigma;\n}\n\nfloat normpdf3(in vec3 v, in float sigma)\n{\n\treturn 0.39894*exp(-0.5*dot(v,v)/(sigma*sigma))/sigma;\n}\n\n\n// 双边滤波\nvec3 bilateral(in vec2 coordinate) {\n const float SIGMA = 16.;\n const float BSIGMA = 9.;\n // const int MSIZE = 5;\n const int mSize = 16;\n\n // float c = getMaskColor(coordinate).a;\n\n vec3 color = texture2D(uSampler, coordinate).rgb;\n const int kSize = (mSize-1)/2;\n float kernel[mSize];\n vec3 final_alpha =vec3(0.);\n float Z = 0.;\n\tfor (int j = 0; j <= kSize; ++j)\n\t{\n\t\tkernel[kSize+j] = kernel[kSize-j] = normpdf(float(j), SIGMA);\n\t}\n\n vec3 cc;\n\tfloat factor;\n\tfloat bZ = 1.0/normpdf(0.0, BSIGMA);\n\n\t//read out the texels\n\tfor (int i=-kSize; i <= kSize; ++i)\n\t{\n\t\tfor (int j=-kSize; j <= kSize; ++j)\n\t\t{\n vec3 ccc = texture2D(uSampler, coordinate + vec2( float(i) / float(width), float(j) / float(height) )).rgb;\n cc = ccc;\n\t\t\tfactor = normpdf3(cc-color, BSIGMA)*bZ*kernel[kSize+j]*kernel[kSize+i];\n\t\t\tZ += factor;\n final_alpha += factor * ccc;\n\t\t}\n\t}\n return final_alpha / Z;\n}\n\nvoid main() {\n float mask = texture2D(faceMask, vTextureCoord).r;\n\n float i = mask;\n vec3 original = texture2D(uSampler, vTextureCoord).rgb;\n\n // gl_FragColor.rgb = original * i;\n // return;\n if (i == 0.) {\n gl_FragColor = vec4(original, 1.0);\n return;\n }\n vec3 color = bilateral(vTextureCoord).rgb;\n \n vec3 res = color * i + original * (1. - i);\n gl_FragColor = vec4(res.rgb, 1.0);\n return;\n \n }"},faceReshape:{fragment:"precision highp float;\nvarying vec2 vTextureCoord;\nuniform sampler2D uSampler;\nuniform int width;\nuniform int height;\nuniform int enable;\n\nuniform vec2 left_eye_center;\nuniform vec2 right_eye_center;\nuniform vec2 nose_tip;\nuniform vec2 contour_chin;\n\nuniform vec2 nose_bridge5;\nuniform vec2 contour_left4;\nuniform vec2 contour_left9;\nuniform vec2 contour_right4;\nuniform vec2 contour_right9;\nuniform vec2 contour_left10;\nuniform vec2 contour_right10;\n// 鼻子\nuniform vec2 nose_left1;\nuniform vec2 nose_left2;\nuniform vec2 nose_right1;\nuniform vec2 nose_right2;\nuniform vec2 nose_tip1;\nuniform vec2 nose_bottom;\n// 嘴唇\nuniform vec2 lip_top_left;\nuniform vec2 lip_top_left_target;\nuniform vec2 lip_top_right;\nuniform vec2 lip_top_right_target;\nuniform vec2 lip_bottom_left;\nuniform vec2 lip_bottom_left_target;\nuniform vec2 lip_bottom_right;\nuniform vec2 lip_bottom_right_target;\nuniform vec2 lip_top_center;\nuniform vec2 lip_top_center_target;\nuniform vec2 lip_bottom_center;\nuniform vec2 lip_bottom_center_target;\nuniform vec2 lip_inner_top;\nuniform vec2 lip_inner_bottom;\n// 额头\nuniform vec2 forehead_top_center;\nuniform vec2 eyebrow_center;\nuniform vec2 forehead_left;\nuniform vec2 left_eyebrow_center;\nuniform vec2 forehead_right;\nuniform vec2 right_eyebrow_center;\n// 眼睛\nuniform vec2 right_eye_top;\nuniform vec2 left_eye_top;\nuniform vec2 right_eye_bottom;\nuniform vec2 left_eye_bottom;\n// 瘦颧骨\nuniform vec2 contour_left3;\nuniform vec2 contour_right3;\nuniform vec2 nose_bridge6;\n\nuniform vec2 nose_bridge4;\nuniform vec2 nose_bridge3;\nuniform vec2 nose_bridge2;\nuniform vec2 nose_bridge1;\n\nuniform vec2 mouth_lower_lip_bottom;\n\nuniform vec2 chin_left;\nuniform vec2 chin_right;\n\nuniform float cheekbone;\nuniform float lift; // 窄脸\nuniform float shave; // 下颌骨\nuniform float eye; // 大眼\nuniform float chin; // 下巴\nuniform float nose; // 鼻子\n// uniform float noseBridge;\nuniform float lip; // 嘴唇\nuniform float forehead; // 额头\nuniform float eyeBrightness; // 亮眼\nuniform float head; // 小头\n// 面部液化扭曲效果(最多支持两个点位配置)\nuniform float distort1;\nuniform vec2 distortCenter1;\nuniform float distortMajorRadius1;\nuniform float distortMinorRadius1;\n\nuniform float distort2;\nuniform vec2 distortCenter2;\nuniform float distortMajorRadius2;\nuniform float distortMinorRadius2;\n\n// 曲线形变处理\nvec2 curveWarp(vec2 textureCoord, vec2 originPosition, vec2 targetPosition, float radius)\n{\n vec2 offset = vec2(0.0);\n vec2 result = vec2(0.0);\n\n vec2 direction = targetPosition - originPosition;\n\n float infect = distance(textureCoord, originPosition)/radius;\n\n infect = 1.0 - infect;\n infect = clamp(infect, 0.0, 1.0);\n offset = direction * infect;\n\n result = textureCoord - offset;\n\n return result;\n}\n// usm\nvec4 gaussianBlur(vec2 uv, float size) {\n const float Pi = 6.28318530718; // Pi*2\n \n // GAUSSIAN BLUR SETTINGS {{{\n const float Directions = 16.0; // BLUR DIRECTIONS (Default 16.0 - More is better but slower)\n const float Quality = 4.0; // BLUR QUALITY (Default 4.0 - More is better but slower)\n float Size = size; // BLUR SIZE (Radius)\n // GAUSSIAN BLUR SETTINGS }}}\n \n vec2 Radius = Size/vec2(float(width), float(height));\n \n // Pixel colour\n vec4 Color = texture2D(uSampler, uv);\n \n // Blur calculations\n for( float d=0.0; d<Pi; d+=Pi/Directions)\n {\n for(float i=1.0/Quality; i<=1.0; i+=1.0/Quality)\n {\n Color += texture2D( uSampler, uv+vec2(cos(d),sin(d))*Radius*i);\n }\n }\n \n // Output to screen\n Color /= Quality * Directions;\n return Color;\n}\nvec4 usm(vec2 vTextureCoord, float factor) {\n vec4 originColor = texture2D(uSampler, vTextureCoord);\n // if (factor == 0.) {\n // return originColor;\n // }\n vec4 gaussianColor = gaussianBlur(vTextureCoord, 3.0);\n return gaussianColor * -factor + originColor * (1.0 + factor);\n}\n\n\n// 大眼处理\nvec2 enlargeEye(vec2 currentCoordinate, vec2 circleCenter, float radius, float intensity)\n{\n // todo:改成椭圆形的放大\n float currentDistance = distance(currentCoordinate, circleCenter);\n float weight = currentDistance / radius;\n weight = 1.0 - intensity * (1.0 - weight * weight);\n weight = clamp(weight, 0.0, 1.0);\n currentCoordinate = circleCenter + (currentCoordinate - circleCenter) * weight;\n\n return currentCoordinate;\n}\nvec2 enlargeEyeEllipse(vec2 currentCoordinate, vec2 eyeCenter, float majorRadius, float minorRadius, float intensity) {\n float currentDistance = distance(currentCoordinate, eyeCenter);\n\n float cosa = (currentCoordinate.x - eyeCenter.x) / currentDistance;\n float sina = (currentCoordinate.y - eyeCenter.y) / currentDistance;\n float m = pow(majorRadius * majorRadius *cosa*cosa + minorRadius * minorRadius * sina * sina, 0.5);\n\n float weight = currentDistance / m;\n // weight = clamp(weight, 0.0, 1.0); // 保证了只对椭圆区域内部的像素放大,外部像素不变\n weight = 1.0 - abs(intensity) * (1.0 - weight * weight); // 放大倍数,超过椭圆区域,weight 会大于 1.0\n weight = clamp(weight, 0.0, 1.0); // 保证了只对椭圆区域内部的像素放大,外部像素不变\n // currentCoordinate = eyeCenter + (currentCoordinate - eyeCenter) * weight;\n if(intensity > .0){\n currentCoordinate = (currentCoordinate - eyeCenter) * weight + eyeCenter;\n }else {\n currentCoordinate = (currentCoordinate - eyeCenter) * (2.0-weight) + eyeCenter;\n }\n\n return currentCoordinate;\n}\n// 面部液化效果,支持椭圆(原始方案)\nvec2 distortingMirrorOld(vec2 currentCoordinate, vec2 center, float majorRadius, float minorRadius, float intensity) {\n float currentDistance = distance(currentCoordinate, center);\n\n float cosa = (currentCoordinate.x - center.x) / currentDistance;\n float sina = (currentCoordinate.y - center.y) / currentDistance;\n float m = pow(majorRadius * majorRadius *cosa*cosa + minorRadius * minorRadius * sina * sina, 0.5);\n\n float weight = currentDistance / m;\n // weight = clamp(weight, 0.0, 1.0); // 保证了只对椭圆区域内部的像素放大,外部像素不变\n weight = 1.0 - abs(intensity) * (1.0 - weight * weight); // 放大倍数,超过椭圆区域,weight 会大于 1.0\n weight = clamp(weight, 0.0, 1.0); // 保证了只对椭圆区域内部的像素放大,外部像素不变\n // currentCoordinate = center + (currentCoordinate - center) * weight;\n if(intensity > .0){\n currentCoordinate = (currentCoordinate - center) * weight + center;\n }else {\n currentCoordinate = (currentCoordinate - center) * (2.0-weight) + center;\n }\n return currentCoordinate;\n}\n// 面部液化效果,支持椭圆(性能优化方案)\nvec2 distortingMirror(vec2 currentCoordinate, vec2 center, float majorRadius, float minorRadius, float intensity) {\n vec2 delta = currentCoordinate - center;\n float currentDistance = length(delta);\n\n float cosa = delta.x / currentDistance;\n float sina = delta.y / currentDistance;\n float m = sqrt(majorRadius * majorRadius * cosa * cosa + minorRadius * minorRadius * sina * sina);\n\n float weight = currentDistance / m;\n weight = 1.0 - abs(intensity) * (1.0 - weight * weight);\n weight = clamp(weight, 0.0, 1.0);\n\n // float blendFactor = intensity > 0.0 ? weight : (2.0 - weight);\n float blendFactor = mix(2.0 - weight, weight, step(0.0, intensity));\n currentCoordinate = center + delta * blendFactor;\n\n return currentCoordinate;\n}\n// 瘦脸\nvec2 faceLift(vec2 currentCoordinate, float faceLength)\n{\n vec2 coordinate = currentCoordinate;\n vec2 currentPoint = vec2(0.0);\n vec2 destPoint = vec2(0.0);\n float faceLiftScale = lift * 0.06;\n float radius = faceLength * 0.5;\n\n currentPoint = contour_left4;\n destPoint = currentPoint + (nose_bridge5 - currentPoint) * faceLiftScale;\n coordinate = curveWarp(coordinate, currentPoint, destPoint, radius);\n\n currentPoint = contour_right4;\n destPoint = currentPoint + (nose_bridge5 - currentPoint) * faceLiftScale;\n coordinate = curveWarp(coordinate, currentPoint, destPoint, radius);\n\n radius = radius * 0.8;\n currentPoint = contour_left9;\n destPoint = currentPoint + (nose_tip - currentPoint) * (faceLiftScale * 0.6);\n coordinate = curveWarp(coordinate, currentPoint, destPoint, radius);\n\n currentPoint = contour_right9;\n destPoint = currentPoint + (nose_tip - currentPoint) * (faceLiftScale * 0.6);\n coordinate = curveWarp(coordinate, currentPoint, destPoint, radius);\n\n return coordinate;\n}\n// 鼻子\nvec2 noseShave(vec2 currentCoordinate, float faceLength) {\n vec2 coordinate = currentCoordinate;\n vec2 currentPoint = vec2(0.0);\n vec2 destPoint = vec2(0.0);\n float scale = nose * 0.2;\n float radius = faceLength * 0.5;\n\n currentPoint = nose_left1; // 102\n destPoint = currentPoint + (nose_tip1 - currentPoint) * scale; // nose_tip1:1\n coordinate = curveWarp(coordinate, currentPoint, destPoint, radius);\n\n currentPoint = nose_left2; // 97\n destPoint = currentPoint + (nose_bottom - currentPoint) * scale; //nose_bottom: 2\n coordinate = curveWarp(coordinate, currentPoint, destPoint, radius);\n\n\n currentPoint = nose_right1; // 331\n destPoint = currentPoint + (nose_tip1 - currentPoint) * scale; // nose_tip1:1\n coordinate = curveWarp(coordinate, currentPoint, destPoint, radius);\n\n currentPoint = nose_right2; // 326\n destPoint = currentPoint + (nose_bottom - currentPoint) * scale; //nose_bottom: 2\n coordinate = curveWarp(coordinate, currentPoint, destPoint, radius);\n\n return coordinate;\n}\n// 嘴唇\nvec2 handleLip(vec2 currentCoordinate, float faceLength) {\n vec2 coordinate = currentCoordinate;\n vec2 currentPoint = vec2(0.0);\n vec2 destPoint = vec2(0.0);\n float scale = lip * 0.1;\n\n vec2 circleCenter = (lip_inner_top + lip_inner_bottom) / 2.0;\n // 当前点的距离\n float currentDistance = distance(currentCoordinate, circleCenter);\n\n // float radius = distance(lip_top_right, lip_top_left) * 0.6;\n // float radius = distance(lip_top_right, lip_top_left) * 0.6;\n float radiusy = distance(lip_inner_top, circleCenter) * 2.0;\n float radiusx = distance(lip_top_right, lip_top_left) / 2.0 * 2.0;\n float cosa = (currentCoordinate.x - circleCenter.x) / currentDistance;\n float sina = (currentCoordinate.y - circleCenter.y) / currentDistance;\n float m = pow(radiusx * radiusx*cosa*cosa + radiusy * radiusy * sina * sina, 0.5);\n\n \n float weight = currentDistance/m;\n\n weight = 1.0 - abs(scale) * (1.0 - weight);\n weight = clamp(weight, 0.0, 1.0);\n\n // 处理是放大还是缩小\n float neg = step(0.0,lip) * 2.0 -1.0;\n weight = pow(weight, neg);\n currentCoordinate = circleCenter + (currentCoordinate - circleCenter) * weight;\n \n return currentCoordinate;\n\n}\n// 发际线\nvec2 handleForehead(vec2 currentCoordinate, float faceLength) {\n vec2 coordinate = currentCoordinate;\n vec2 currentPoint = vec2(0.0);\n vec2 destPoint = vec2(0.0);\n float scale = forehead * 0.15;\n float radius = faceLength * 0.7;\n\n currentPoint = forehead_top_center + forehead_top_center - eyebrow_center; // 10\n destPoint = currentPoint + (eyebrow_center - currentPoint) * scale; // eyebrow_center:9\n destPoint.y = clamp(destPoint.y, 0.0, float(height));\n coordinate = curveWarp(coordinate, currentPoint, destPoint, radius);\n\n currentPoint = forehead_left + forehead_left - left_eyebrow_center; // 67\n destPoint = currentPoint + (left_eyebrow_center - currentPoint) * scale; // left_eyebrow_center:66\n destPoint.y = clamp(destPoint.y, 0.0, float(height));\n coordinate = curveWarp(coordinate, currentPoint, destPoint, radius);\n\n currentPoint = forehead_right + forehead_right - right_eyebrow_center; // 297\n destPoint = currentPoint + (right_eyebrow_center - currentPoint) * scale; // right_eyebrow_center:296\n destPoint.y = clamp(destPoint.y, 0.0, float(height));\n coordinate = curveWarp(coordinate, currentPoint, destPoint, radius);\n\n\n\n return coordinate;\n\n}\n// 削脸\nvec2 faceShave(vec2 currentCoordinate, float faceLength)\n{\n vec2 coordinate = currentCoordinate;\n vec2 currentPoint = vec2(0.0);\n vec2 destPoint = vec2(0.0);\n float faceShaveScale = shave * 0.09;\n float radius = faceLength * 1.0;\n\n // 下巴中心\n vec2 chinCenter = (contour_chin + mouth_lower_lip_bottom) * 0.5;\n currentPoint = contour_left10;\n destPoint = currentPoint + (chinCenter - currentPoint) * faceShaveScale;\n coordinate = curveWarp(coordinate, currentPoint, destPoint, radius);\n\n currentPoint = contour_right10;\n destPoint = currentPoint + (chinCenter - currentPoint) * faceShaveScale;\n coordinate = curveWarp(coordinate, currentPoint, destPoint, radius);\n\n return coordinate;\n}\n// 曲线形变处理\nvec2 curveWarpVertical(vec2 textureCoord, vec2 originPosition, vec2 targetPosition, float xRadius, float yRadius)\n{\n vec2 offset = vec2(0.0);\n vec2 result = vec2(0.0);\n\n vec2 direction = targetPosition - originPosition;\n\n float infect = (textureCoord.x - originPosition.x) * (textureCoord.x - originPosition.x) / (xRadius * xRadius) + \n (textureCoord.y - originPosition.y) * (textureCoord.y - originPosition.y) / (yRadius * yRadius);\n\n infect = 1.0 - infect;\n infect = clamp(infect, 0.0, 1.0);\n offset = direction * infect;\n\n result = textureCoord - offset;\n\n return result;\n}\n// 处理下巴\nvec2 chinChange(vec2 currentCoordinate, float faceLength)\n{\n vec2 coordinate = currentCoordinate;\n vec2 currentPoint = vec2(0.0);\n vec2 destPoint = vec2(0.0);\n float chinScale = -chin * 0.4;\n float radius = faceLength * 0.3;\n vec2 chinCenter = contour_chin + (mouth_lower_lip_bottom - contour_chin) * 0.2;\n // 下巴尖\n currentPoint = contour_chin;\n destPoint = currentPoint + (chinCenter - currentPoint) * chinScale;\n coordinate = curveWarp(coordinate, currentPoint, destPoint, radius);\n\n // 下巴尖左右各取一个点平滑下巴\n float r = 0.3 - 0.1 * step(0.0,chin);\n currentPoint = chin_left;\n destPoint = currentPoint + (chinCenter - currentPoint) * chinScale * r;\n coordinate = curveWarp(coordinate, currentPoint, destPoint, radius);\n\n currentPoint = chin_right;\n destPoint = currentPoint + (chinCenter - currentPoint) * chinScale * r;\n coordinate = curveWarp(coordinate, currentPoint, destPoint, radius);\n\n return coordinate;\n}\n\nvec2 scaleHead(vec2 currentCoordinate) {\n vec2 coordinate = currentCoordinate;\n float headRadius = distance(contour_chin, nose_bridge5) * 1.8;\n float isWithin = 1.0-step(headRadius, distance(currentCoordinate, nose_bridge5));\n // if (distance(currentCoordinate, nose_bridge5) <= headRadius) {\n float weight = isWithin * (1.0 - distance(currentCoordinate, nose_bridge5) / headRadius);\n \n coordinate = nose_bridge5 + (coordinate - nose_bridge5) * (1.0+weight * 0.12*head);\n // }\n \n \n return coordinate;\n}\n// 颧骨\nvec2 handleCheekbone(vec2 currentCoordinate, float faceLength) {\n vec2 coordinate = currentCoordinate;\n vec2 currentPoint = vec2(0.0);\n vec2 destPoint = vec2(0.0);\n float scale = cheekbone * 0.05;\n float radius = faceLength * 0.45;\n\n currentPoint = (contour_left4 + contour_left3) * 0.5;\n destPoint = currentPoint + (nose_bridge6 - currentPoint) * scale;\n coordinate = curveWarp(coordinate, currentPoint, destPoint, radius);\n\n currentPoint = (contour_right4 + contour_right3) * 0.5;\n destPoint = currentPoint + (nose_bridge6 - currentPoint) * scale;\n coordinate = curveWarp(coordinate, currentPoint, destPoint, radius);\n\n return coordinate;\n\n}\n\nvec4 eyeBright(vec2 currentCoordinate) {\n vec2 coordinate = currentCoordinate * vec2(float(width), float(height));\n\n float iris_size_size = distance(left_eye_top, left_eye_bottom);\n vec2 left_center = (left_eye_top + left_eye_bottom)/2.0;\n vec2 right_center = (right_eye_top + right_eye_bottom)/2.0;\n float flag = (1.0-step(iris_size_size, distance(coordinate, left_center))) + (1.0-step(iris_size_size, distance(coordinate, right_center)));\n // if ((distance(coordinate, left_center) <= iris_size_size || distance(coordinate, right_center) <= iris_size_size)) {\n return usm(currentCoordinate, flag * clamp(eyeBrightness,0.0,1.0));\n // return;\n // }\n // gl_FragColor = texture2D(uSampler, currentCoordinate);\n}\n\nvoid main()\n{\n vec2 coordinate = vTextureCoord.xy;\n \n // 禁用美型处理或者鼻子不在图像中,则直接绘制\n float enableFlag = step(1.0, float(enable)) * (step(0.03, nose_tip.x / float(width)) + step(0.03, nose_tip.y / float(height)));\n enableFlag = clamp(enableFlag, 0.0, 1.0);\n // if (enable == 0 || ((nose_tip.x / float(width) <= 0.03) || (nose_tip.y / float(height)) <= 0.03)) {\n vec4 color = texture2D(uSampler, coordinate);\n\n // gl_FragColor = color;\n // return;\n // }\n \n \n // 将坐标转成图像大小,这里是为了方便计算\n coordinate = vTextureCoord * vec2(float(width), float(height));\n\n // 两个瞳孔的距离\n float eyeDistance = distance(left_eye_center, right_eye_center); \n\n // 瘦脸\n coordinate = faceLift(coordinate, eyeDistance);\n\n // 削脸\n coordinate = faceShave(coordinate, eyeDistance);\n\n // 下巴\n coordinate = chinChange(coordinate, eyeDistance);\n\n // 鼻子\n coordinate = noseShave(coordinate,eyeDistance);\n\n // 嘴唇厚度\n coordinate = handleLip(coordinate,eyeDistance);\n\n // 发际线\n coordinate = handleForehead(coordinate,eyeDistance);\n\n // 颧骨\n coordinate = handleCheekbone(coordinate,eyeDistance);\n\n // 小头\n coordinate = scaleHead(coordinate);\n\n // 大眼\n float eyeEnlarge = eye * 0.16; // 放大倍数\n eyeEnlarge = clamp(eyeEnlarge, -1.0, 1.0);\n // if (eyeEnlarge > 0.0) {\n // float radius = eyeDistance * 0.33; // 眼睛放大半径\n // float radius = eyeDistance * 0.33; // 眼睛放大半径\n // coordinate = enlargeEye(coordinate, left_eye_center + (right_eye_center - left_eye_center) * 0.05, radius, eyeEnlarge);\n // coordinate = enlargeEye(coordinate, right_eye_center + (left_eye_center - right_eye_center) * 0.05, radius, eyeEnlarge);\n coordinate = enlargeEyeEllipse(coordinate, left_eye_center + (right_eye_center - left_eye_center) * 0.05, eyeDistance * 0.35, eyeDistance * 0.3, eyeEnlarge);\n coordinate = enlargeEyeEllipse(coordinate, right_eye_center + (left_eye_center - right_eye_center) * 0.05, eyeDistance * 0.35, eyeDistance * 0.3, eyeEnlarge);\n // }\n\n // 哈哈镜\n if(distort1 != 0.0){\n coordinate = distortingMirror(coordinate, distortCenter1, eyeDistance*distortMajorRadius1, eyeDistance*distortMinorRadius1, distort1);\n }\n if(distort2 != 0.0){\n coordinate = distortingMirror(coordinate, distortCenter2, eyeDistance*distortMajorRadius2, eyeDistance*distortMinorRadius2, distort2);\n }\n\n\n\n // 转变回原来的纹理坐标系\n coordinate = coordinate / vec2(float(width), float(height));\n\n // 输出图像带上明目效果\n vec4 dealedColor = eyeBright(coordinate);\n\n // 输出图像\n // gl_FragColor = texture2D(uSampler, coordinate);\n gl_FragColor = mix(color, dealedColor, enableFlag);\n}"},maskBlack:{fragment:"\nuniform sampler2D uSampler;\nvarying vec2 vTextureCoord;\n\nvoid main() {\n vec4 color = texture2D(uSampler, vTextureCoord);\n gl_FragColor = vec4(color.rgb,color.r);\n}\n"},usm:{fragment:"\n\nprecision lowp float;\nuniform sampler2D uSampler;\nvarying lowp vec2 vTextureCoord;\nuniform int width;\nuniform int height;\nuniform float intensity;\n\nvec4 gaussianBlur(vec2 uv, float size) {\n const float Pi = 6.28318530718; // Pi*2\n \n // GAUSSIAN BLUR SETTINGS {{{\n const float Directions = 16.0; // BLUR DIRECTIONS (Default 16.0 - More is better but slower)\n const float Quality = 4.0; // BLUR QUALITY (Default 4.0 - More is better but slower)\n float Size = size; // BLUR SIZE (Radius)\n // GAUSSIAN BLUR SETTINGS }}}\n \n vec2 Radius = Size/vec2(float(width), float(height));\n \n // Pixel colour\n vec4 Color = texture2D(uSampler, uv);\n \n // Blur calculations\n for( float d=0.0; d<Pi; d+=Pi/Directions)\n {\n for(float i=1.0/Quality; i<=1.0; i+=1.0/Quality)\n {\n Color += texture2D( uSampler, uv+vec2(cos(d),sin(d))*Radius*i);\n }\n }\n \n // Output to screen\n Color /= Quality * Directions;\n return Color;\n}\nvec4 usm(vec2 vTextureCoord, float factor) {\n vec4 originColor = texture2D(uSampler, vTextureCoord);\n // if (factor == 0.) {\n // return originColor;\n // }\n vec4 gaussianColor = gaussianBlur(vTextureCoord, 3.0);\n return gaussianColor * -factor + originColor * (1.0 + factor);\n}\n\n\nvoid main(void)\n{ \n\n gl_FragColor = usm(vTextureCoord, intensity);\n}\n"}},s=function(t){function e(e,n,r){var i=this,o=a[e];(i=t.call(this,o.vertex||"attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\nuniform mat3 projectionMatrix;\nvarying vec2 vTextureCoord;\n\nvoid main(void)\n{\n gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n vTextureCoord = aTextureCoord;\n}",o.fragment)||this).options=r||{};var s=i.options.uniforms;if(s)for(var c in s)i.uniforms[c]=s[c];var l=n.width,u=n.height;return i.uniforms.width=l,i.uniforms.height=u,i.uniforms.iResolution=[l,u],i}return o(e,t),e.prototype.resize=function(t,e){this.uniforms.width=t,this.uniforms.height=e,this.uniforms.iResolution=[t,e]},e.prototype.setUniforms=function(t,e){if("object"==typeof t)for(var n in t)this.uniforms[n]=t[n];else this.uniforms[t]!==e&&(this.uniforms[t]=e)},e}(r.wn)},1730:(t,e,n)=>{n.d(e,{a:()=>r,L:()=>i});var r;!function(t){t[t.NORMAL=0]="NORMAL",t[t.DARKEN=1]="DARKEN",t[t.MULTIPLY=2]="MULTIPLY",t[t.COLOR_BURN=3]="COLOR_BURN",t[t.LINEAR_BURN=4]="LINEAR_BURN",t[t.LIGHTEN=5]="LIGHTEN",t[t.SCREEN=6]="SCREEN",t[t.COLOR_DODGE=7]="COLOR_DODGE",t[t.LINEAR_DODGE=8]="LINEAR_DODGE",t[t.OVERLAY=9]="OVERLAY",t[t.SOFT_LIGHT=10]="SOFT_LIGHT",t[t.HARD_LIGHT=11]="HARD_LIGHT",t[t.VIVID_LIGHT=12]="VIVID_LIGHT",t[t.LINEAR_LIGHT=13]="LINEAR_LIGHT",t[t.PIN_LIGHT=14]="PIN_LIGHT",t[t.HARD_MIX=15]="HARD_MIX",t[t.DIFFERENCE=16]="DIFFERENCE",t[t.EXCLUSION=17]="EXCLUSION",t[t.SUBSTRACT=18]="SUBSTRACT"}(r||(r={}));var i=[{name:"普通",key:"Normal",shader:"vec3 blendNormal(vec3 base, vec3 blend) {\n\treturn blend;\n}\nfloat blendNormal(float base, float blend) {\n\treturn blend;\n}\n\nvec3 blendNormal(vec3 base, vec3 blend, float opacity) {\n\treturn (blendNormal(base, blend) * opacity + base * (1.0 - opacity));\n}\n\n\n"},{name:"变暗",key:"Darken",shader:"float blendDarken(float base, float blend) {\n\treturn min(blend,base);\n}\n\nvec3 blendDarken(vec3 base, vec3 blend) {\n\treturn vec3(blendDarken(base.r,blend.r),blendDarken(base.g,blend.g),blendDarken(base.b,blend.b));\n}\n\nvec3 blendDarken(vec3 base, vec3 blend, float opacity) {\n\treturn (blendDarken(base, blend) * opacity + base * (1.0 - opacity));\n}\n\n"},{name:"正片叠底",key:"Multiply",shader:"vec3 blendMultiply(vec3 base, vec3 blend) {\n\treturn base*blend;\n}\n\n\nvec3 blendMultiply(vec3 base, vec3 blend, float opacity) {\n\treturn (blendMultiply(base, blend) * opacity + base * (1.0 - opacity));\n}\n\n"},{name:"颜色加深",key:"ColorBurn",shader:"float blendColorBurn(float base, float blend) {\n\treturn (blend==0.0)?blend:max((1.0-((1.0-base)/blend)),0.0);\n}\n\nvec3 blendColorBurn(vec3 base, vec3 blend) {\n\treturn vec3((base.r,blend.r),blendColorBurn(base.g,blend.g),blendColorBurn(base.b,blend.b));\n}\n\n\nvec3 blendColorBurn(vec3 base, vec3 blend, float opacity) {\n\treturn (blendColorBurn(base, blend) * opacity + base * (1.0 - opacity));\n}\n\n"},{name:"线性加深",key:"LinearBurn",shader:"float blendLinearBurn(float base, float blend) {\n\t// Note : Same implementation as BlendSubtractf\n\treturn max(base+blend-1.0,0.0);\n}\n\n\nvec3 blendLinearBurn(vec3 base, vec3 blend) {\n\t// Note : Same implementation as BlendSubtract\n\treturn max(base+blend-vec3(1.0),vec3(0.0));\n}\n\nvec3 blendLinearBurn(vec3 base, vec3 blend, float opacity) {\n\treturn (blendLinearBurn(base, blend) * opacity + base * (1.0 - opacity));\n}\n\n"},{name:"变亮",key:"Lighten",shader:"float blendLighten(float base, float blend) {\n\treturn max(blend,base);\n}\n\nvec3 blendLighten(vec3 base, vec3 blend) {\n\treturn vec3(blendLighten(base.r,blend.r),blendLighten(base.g,blend.g),blendLighten(base.b,blend.b));\n}\n\nvec3 blendLighten(vec3 base, vec3 blend, float opacity) {\n\treturn (blendLighten(base, blend) * opacity + base * (1.0 - opacity));\n}\n\n"},{name:"滤色",key:"Screen",shader:"float blendScreen(float base, float blend) {\n\treturn 1.0-((1.0-base)*(1.0-blend));\n}\n\nvec3 blendScreen(vec3 base, vec3 blend) {\n\treturn vec3(blendScreen(base.r,blend.r),blendScreen(base.g,blend.g),blendScreen(base.b,blend.b));\n}\n\nvec3 blendScreen(vec3 base, vec3 blend, float opacity) {\n\treturn (blendScreen(base, blend) * opacity + base * (1.0 - opacity));\n}\n\n"},{name:"颜色减淡",key:"ColorDodge",shader:"float blendColorDodge(float base, float blend) {\n\treturn (blend==1.0)?blend:min(base/(1.0-blend),1.0);\n}\n\nvec3 blendColorDodge(vec3 base, vec3 blend) {\n\treturn vec3(blendColorDodge(base.r,blend.r),blendColorDodge(base.g,blend.g),blendColorDodge(base.b,blend.b));\n}\n\nvec3 blendColorDodge(vec3 base, vec3 blend, float opacity) {\n\treturn (blendColorDodge(base, blend) * opacity + base * (1.0 - opacity));\n}\n\n"},{name:"线性减淡",key:"LinearDodge",shader:"float blendLinearDodge(float base, float blend) {\n\t// Note : Same implementation as BlendAddf\n\treturn min(base+blend,1.0);\n}\n\nvec3 blendLinearDodge(vec3 base, vec3 blend) {\n\t// Note : Same implementation as BlendAdd\n\treturn min(base+blend,vec3(1.0));\n}\n\nvec3 blendLinearDodge(vec3 base, vec3 blend, float opacity) {\n\treturn (blendLinearDodge(base, blend) * opacity + base * (1.0 - opacity));\n}\n\n"},{name:"叠加",key:"Overlay",shader:"float blendOverlay(float base, float blend) {\n\treturn base<0.5?(2.0*base*blend):(1.0-2.0*(1.0-base)*(1.0-blend));\n}\n\nvec3 blendOverlay(vec3 base, vec3 blend) {\n\treturn vec3(blendOverlay(base.r,blend.r),blendOverlay(base.g,blend.g),blendOverlay(base.b,blend.b));\n}\n\nvec3 blendOverlay(vec3 base, vec3 blend, float opacity) {\n\treturn (blendOverlay(base, blend) * opacity + base * (1.0 - opacity));\n}\n\n"},{name:"柔光",key:"SoftLight",shader:"float blendSoftLight(float base, float blend) {\n\treturn (blend<0.5)?(2.0*base*blend+base*base*(1.0-2.0*blend)):(sqrt(base)*(2.0*blend-1.0)+2.0*base*(1.0-blend));\n}\n\nvec3 blendSoftLight(vec3 base, vec3 blend) {\n\treturn vec3(blendSoftLight(base.r,blend.r),blendSoftLight(base.g,blend.g),blendSoftLight(base.b,blend.b));\n}\n\n\nvec3 blendSoftLight(vec3 base, vec3 blend, float opacity) {\n\treturn (blendSoftLight(base, blend) * opacity + base * (1.0 - opacity));\n}\n\n"},{name:"强光",key:"HardLight",shader:"float blendOverlay(float base, float blend) {\n\treturn base<0.5?(2.0*base*blend):(1.0-2.0*(1.0-base)*(1.0-blend));\n}\nvec3 blendOverlay(vec3 base, vec3 blend) {\n\treturn vec3(blendOverlay(base.r,blend.r),blendOverlay(base.g,blend.g),blendOverlay(base.b,blend.b));\n}\nvec3 blendHardLight(vec3 base, vec3 blend) {\n\treturn blendOverlay(blend,base);\n}\n\nvec3 blendHardLight(vec3 base, vec3 blend, float opacity) {\n\treturn (blendHardLight(base, blend) * opacity + base * (1.0 - opacity));\n}\n\n"},{name:"亮光",key:"VividLight",shader:"float blendColorDodge(float base, float blend) {\n\treturn (blend==1.0)?blend:min(base/(1.0-blend),1.0);\n}\n\n\nfloat blendColorBurn(float base, float blend) {\n\treturn (blend==0.0)?blend:max((1.0-((1.0-base)/blend)),0.0);\n}\n\n\n\n\nfloat blendVividLight(float base, float blend) {\n\treturn (blend<0.5)?blendColorBurn(base,(2.0*blend)):blendColorDodge(base,(2.0*(blend-0.5)));\n}\n\nvec3 blendVividLight(vec3 base, vec3 blend) {\n\treturn vec3(blendVividLight(base.r,blend.r),blendVividLight(base.g,blend.g),blendVividLight(base.b,blend.b));\n}\n\nvec3 blendVividLight(vec3 base, vec3 blend, float opacity) {\n\treturn (blendVividLight(base, blend) * opacity + base * (1.0 - opacity));\n}\n\n"},{name:"线性光",key:"LinearLight",shader:"float blendLinearBurn(float base, float blend) {\n\t// Note : Same implementation as BlendSubtractf\n\treturn max(base+blend-1.0,0.0);\n}\n\nfloat blendLinearDodge(float base, float blend) {\n\t// Note : Same implementation as BlendAddf\n\treturn min(base+blend,1.0);\n}\n\n\nfloat blendLinearLight(float base, float blend) {\n\treturn blend<0.5?blendLinearBurn(base,(2.0*blend)):blendLinearDodge(base,(2.0*(blend-0.5)));\n}\n\nvec3 blendLinearLight(vec3 base, vec3 blend) {\n\treturn vec3(blendLinearLight(base.r,blend.r),blendLinearLight(base.g,blend.g),blendLinearLight(base.b,blend.b));\n}\n\nvec3 blendLinearLight(vec3 base, vec3 blend, float opacity) {\n\treturn (blendLinearLight(base, blend) * opacity + base * (1.0 - opacity));\n}\n\n"},{name:"点光",key:"PinLight",shader:"float blendLighten(float base, float blend) {\n\treturn max(blend,base);\n}\nfloat blendDarken(float base, float blend) {\n\treturn min(blend,base);\n}\nfloat blendPinLight(float base, float blend) {\n\treturn (blend<0.5)?blendDarken(base,(2.0*blend)):blendLighten(base,(2.0*(blend-0.5)));\n}\n\nvec3 blendPinLight(vec3 base, vec3 blend) {\n\treturn vec3(blendPinLight(base.r,blend.r),blendPinLight(base.g,blend.g),blendPinLight(base.b,blend.b));\n}\n\nvec3 blendPinLight(vec3 base, vec3 blend, float opacity) {\n\treturn (blendPinLight(base, blend) * opacity + base * (1.0 - opacity));\n}\n\n"},{name:"实色混合",key:"HardMix",shader:"float blendColorDodge(float base, float blend) {\n\treturn (blend==1.0)?blend:min(base/(1.0-blend),1.0);\n}\n\n\n\nfloat blendColorBurn(float base, float blend) {\n\treturn (blend==0.0)?blend:max((1.0-((1.0-base)/blend)),0.0);\n}\n\n\n\nfloat blendVividLight(float base, float blend) {\n\treturn (blend<0.5)?blendColorBurn(base,(2.0*blend)):blendColorDodge(base,(2.0*(blend-0.5)));\n}\n\n\n\nfloat blendHardMix(float base, float blend) {\n\treturn (blendVividLight(base,blend)<0.5)?0.0:1.0;\n}\n\nvec3 blendHardMix(vec3 base, vec3 blend) {\n\treturn vec3(blendHardMix(base.r,blend.r),blendHardMix(base.g,blend.g),blendHardMix(base.b,blend.b));\n}\n\nvec3 blendHardMix(vec3 base, vec3 blend, float opacity) {\n\treturn (blendHardMix(base, blend) * opacity + base * (1.0 - opacity));\n}\n\n"},{name:"差值",key:"Difference",shader:"vec3 blendDifference(vec3 base, vec3 blend) {\n\treturn abs(base-blend);\n}\n\nvec3 blendDifference(vec3 base, vec3 blend, float opacity) {\n\treturn (blendDifference(base, blend) * opacity + base * (1.0 - opacity));\n}\n\n"},{name:"排除",key:"Exclusion",shader:"vec3 blendExclusion(vec3 base, vec3 blend) {\n\treturn base+blend-2.0*base*blend;\n}\n\nvec3 blendExclusion(vec3 base, vec3 blend, float opacity) {\n\treturn (blendExclusion(base, blend) * opacity + base * (1.0 - opacity));\n}\n\n"},{name:"减去",key:"Substract",shader:"float blendSubstract(float base, float blend) {\n\treturn max(base+blend-1.0,0.0);\n}\n\nvec3 blendSubstract(vec3 base, vec3 blend) {\n\treturn max(base+blend-vec3(1.0),vec3(0.0));\n}\n\nvec3 blendSubstract(vec3 base, vec3 blend, float opacity) {\n\treturn (blendSubstract(base, blend) * opacity + blend * (1.0 - opacity));\n}\n\n"}]},9560:(t,e,n)=>{n.d(e,{Kg:()=>_,Lc:()=>l.L,jy:()=>m});var r,i=n(9043),o=(r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},r(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function n(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}),a=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.backdropUniformName=null,e._backdropActive=!1,e.clearColor=null,e}return o(e,t),e}(i.Filter),s=function(t){function e(e){var n=this,r="\nvarying vec2 vTextureCoord;\n\nuniform sampler2D uSampler;\nuniform sampler2D uBackdrop;\nuniform vec2 uBackdrop_flipY;\nuniform float intensity;\n\n%UNIFORM_CODE%\n%FUNC_CODE%\nvoid main(void)\n{\n vec2 backdropCoord = vec2(vTextureCoord.x, vTextureCoord.y);\n // vec2 backdropCoord = vec2(vTextureCoord.x, uBackdrop_flipY.x + uBackdrop_flipY.y * vTextureCoord.y);\n vec4 b_src = texture2D(uSampler, vTextureCoord); // 精灵\n vec4 b_dest = texture2D(uBackdrop, backdropCoord); // 底图\n vec4 b_res = b_src;\n\n\n // gl_FragColor = b_dest;\n // return;\n\n if (b_src.a == 0.0) {\n gl_FragColor = vec4(0.0,0.0,0.0,0.0);\n return;\n }\n if (b_dest.a == 0.0) {\n gl_FragColor = vec4(0.0,0.0,0.0,0.0);\n // gl_FragColor = b_src;\n return;\n }\n \n \n b_res.rgb = blend%FUNC_NAME%(b_dest.rgb / b_dest.a, b_src.rgb / b_src.a, intensity);\n gl_FragColor = vec4(b_res.rgb * b_src.a,b_src.a);\n\n}";return r=(r=(r=r.replace("%UNIFORM_CODE%",e.uniformCode||"")).replace("%FUNC_CODE%",e.funcCode||"")).replace("%FUNC_NAME%",e.funcName||""),(n=t.call(this,void 0,r,e.uniforms)||this).backdropUniformName="uBackdrop",n}return o(e,t),e}(a),c=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),l=(function(t){function e(e,n){var r=n||{};return r.flipY||(r.flipY=new Float32Array([0,1])),t.call(this,"\nattribute vec2 aVertexPosition;\n\nuniform mat3 projectionMatrix;\n\nvarying vec2 vTextureCoord;\n\nuniform vec4 inputSize;\nuniform vec4 outputFrame;\nuniform vec2 flipY;\n\nvec4 filterVertexPosition( void )\n{\n vec2 position = aVertexPosition * max(outputFrame.zw, vec2(0.)) + outputFrame.xy;\n\n return vec4((projectionMatrix * vec3(position, 1.0)).xy, 0.0, 1.0);\n}\n\nvec2 filterTextureCoord( void )\n{\n return aVertexPosition * (outputFrame.zw * inputSize.zw);\n}\n\nvoid main(void)\n{\n gl_Position = filterVertexPosition();\n vTextureCoord = filterTextureCoord();\n vTextureCoord.y = flipY.x + flipY.y * vTextureCoord.y;\n}\n\n",e,r)||this}c(e,t)}(i.Filter),n(1730)),u=[],h=[];function d(t,e){return void 0===e&&(e=1),void 0===t?null:(u[t]||(u[t]=new s({funcCode:l.L[t].shader,funcName:l.L[t].key,uniforms:{intensity:e}})),u[t])}function f(t,e){return void 0===e&&(e=1),void 0===t?null:(h[t]||(h[t]=[d(t,e)]),h[t][0].uniforms.intensity=e,h[t])}var p=n(1961),g=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),m=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return g(e,t),e.prototype._render=function(t){var e=this._texture;if(e&&e.valid){var n=f(this.blendMode_1);new Date;n&&(t.batch.flush(),!t.filter.pushWithCheck(this,n))||(+new Date,this.calculateVertices(),t.batch.setObjectRenderer(t.plugins[this.pluginName]),t.plugins[this.pluginName].render(this),n&&(t.batch.flush(),t.filter.pop()))}},e}(p.j),y=n(2901),v=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),_=function(t){function e(e,n){void 0===n&&(n=!0);var r=t.call(this,e[0]instanceof i.Texture?e[0]:e[0].texture)||this;return r._textures=null,r._durations=null,r._autoUpdate=n,r._isConnectedToTicker=!1,r.animationSpeed=1,r.loop=!0,r.updateAnchor=!1,r.onComplete=null,r.onFrameChange=null,r.onLoop=null,r._currentTime=0,r._playing=!1,r._previousFrame=null,r.textures=e,r}return v(e,t),e.prototype.stop=function(){this._playing&&(this._playing=!1,this._autoUpdate&&this._isConnectedToTicker&&(y.vB.shared.remove(this.update,this),this._isConnectedToTicker=!1))},e.prototype.play=function(){this._playing||(this._playing=!0,this._autoUpdate&&!this._isConnectedToTicker&&(y.vB.shared.add(this.update,this,y.uF.HIGH),this._isConnectedToTicker=!0))},e.prototype.gotoAndStop=function(t){this.stop();var e=this.currentFrame;this._currentTime=t,e!==this.currentFrame&&this.updateTexture()},e.prototype.gotoAndPlay=function(t){var e=this.currentFrame;this._currentTime=t,e!==this.currentFrame&&this.updateTexture(),this.play()},e.prototype.update=function(t){if(this._playing){var e=this.animationSpeed*t,n=this.currentFrame;if(null!==this._durations){var r=this._currentTime%1*this._durations[this.currentFrame];for(r+=e/60*1e3;r<0;)this._currentTime--,r+=this._durations[this.currentFrame];var i=Math.sign(this.animationSpeed*t);for(this._currentTime=Math.floor(this._currentTime);r>=this._durations[this.currentFrame];)r-=this._durations[this.currentFrame]*i,this._currentTime+=i;this._currentTime+=r/this._durations[this.currentFrame]}else this._currentTime+=e;this._currentTime<0&&!this.loop?(this.gotoAndStop(0),this.onComplete&&this.onComplete()):this._currentTime>=this._textures.length&&!this.loop?(this.gotoAndStop(this._textures.length-1),this.onComplete&&this.onComplete()):n!==this.currentFrame&&(this.loop&&this.onLoop&&(this.animationSpeed>0&&this.currentFrame<n||this.animationSpeed<0&&this.currentFrame>n)&&this.onLoop(),this.updateTexture())}},e.prototype.updateTexture=function(){var t=this.currentFrame;this._previousFrame!==t&&(this._previousFrame=t,this._texture=this._textures[t],this._textureID=-1,this._textureTrimmedID=-1,this._cachedTint=16777215,this.uvs=this._texture._uvs.uvsFloat32,this.updateAnchor&&this._anchor.copyFrom(this._texture.defaultAnchor),this.onFrameChange&&this.onFrameChange(this.currentFrame))},e.prototype.destroy=function(e){this.stop(),t.prototype.destroy.call(this,e),this.onComplete=null,this.onFrameChange=null,this.onLoop=null},e.fromFrames=function(t){for(var n=[],r=0;r<t.length;++r)n.push(i.Texture.from(t[r]));return new e(n)},e.fromImages=function(t){for(var n=[],r=0;r<t.length;++r)n.push(i.Texture.from(t[r]));return new e(n)},Object.defineProperty(e.prototype,"totalFrames",{get:function(){return this._textures.length},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"textures",{get:function(){return this._textures},set:function(t){if(t[0]instanceof i.Texture)this._textures=t,this._durations=null;else{this._textures=[],this._durations=[];for(var e=0;e<t.length;e++)this._textures.push(t[e].texture),this._durations.push(t[e].time)}this._previousFrame=null,this.gotoAndStop(0),this.updateTexture()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"currentFrame",{get:function(){var t=Math.floor(this._currentTime)%this._textures.length;return t<0&&(t+=this._textures.length),t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"playing",{get:function(){return this._playing},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"autoUpdate",{get:function(){return this._autoUpdate},set:function(t){t!==this._autoUpdate&&(this._autoUpdate=t,!this._autoUpdate&&this._isConnectedToTicker?(y.vB.shared.remove(this.update,this),this._isConnectedToTicker=!1):this._autoUpdate&&!this._isConnectedToTicker&&this._playing&&(y.vB.shared.add(this.update,this),this._isConnectedToTicker=!0))},enumerable:!1,configurable:!0}),e}(m),b=n(8141),x=n(7659),w=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),C=(function(t){function e(){return null!==t&&t.apply(this,arguments)||this}w(e,t),e.prototype._render=function(t){var n=f(this.blendMode_1,this.intensity);if(!n||(t.batch.flush(),t.filter.pushWithCheck(this,n))){var r=this.geometry.buffers[0].data;this.shader.batchable&&this.drawMode===x.lg.TRIANGLES&&r.length<2*e.BATCHABLE_SIZE?this._renderToBatch(t):this._renderDefault(t),n&&(t.batch.flush(),t.filter.pop())}}}(b.Kj),n(2064)),T=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),S=(function(t){function e(){return null!==t&&t.apply(this,arguments)||this}T(e,t),e.prototype._render=function(t){var e=this._texture;if(e&&e.valid){var n=f(this.blendMode_1);n&&(t.batch.flush(),!t.filter.pushWithCheck(this,n))||(this.tileTransform.updateLocalTransform(),this.uvMatrix.update(),t.batch.setObjectRenderer(t.plugins[this.pluginName]),t.plugins[this.pluginName].render(this),n&&(t.batch.flush(),t.filter.pop()))}}}(C.o),n(1893));function k(t,e){void 0===e&&(e=0);var n=this.gl;this.currentLocation!==e&&(this.currentLocation=e,n.activeTexture(n.TEXTURE0+e)),this.bind(t,e)}var E=new S.y3;function P(t,e,n){void 0===n&&(n=!0);for(var r=this.renderer,o=this.defaultFilterStack,a=this.statePool.pop()||new i.FilterState,s=this.renderer.renderTexture,c=e[0].resolution,l=e[0].padding,u=e[0].autoFit,h=e[0].legacy,d=1;d<e.length;d++){var f=e[d];c=Math.min(c,f.resolution),l=this.useMaxPadding?Math.max(l,f.padding):l+f.padding,u=u&&f.autoFit,h=h||f.legacy}1===o.length&&(this.defaultFilterStack[0].renderTexture=s.current),o.push(a),a.resolution=c,a.legacy=h,a.target=t,a.sourceFrame.copyFrom(t.filterArea||t.getBounds(!0)),a.sourceFrame.pad(l);var p,g,m,y,v,_,b=!0;if(u){var x=this.tempRect.copyFrom(s.sourceFrame);r.projection.transform&&this.transformAABB(E.copyFrom(r.projection.transform).invert(),x),a.sourceFrame.fit(x)}else p=this.renderer.renderTexture.sourceFrame,g=a.sourceFrame,m=g.x+g.width,y=g.y+g.height,v=p.x+p.width,_=p.y+p.height,b=g.x>=p.x&&g.x<=v&&g.y>=p.y&&g.y<=_&&m>=p.x&&m<=v&&y>=p.y&&y<=_;if(n&&a.sourceFrame.width<=1&&a.sourceFrame.height<=1)return o.pop(),a.clear(),this.statePool.push(a),!1;this.roundFrame(a.sourceFrame,s.current?s.current.resolution:r.resolution,s.sourceFrame,s.destinationFrame,r.projection.transform),a.sourceFrame.ceil(c);new Date;if(b){var w=null,C=null;for(d=0;d<e.length;d++){var T=e[d].backdropUniformName;if(T){var S=e[d].uniforms;S[T+"_flipY"]||(S[T+"_flipY"]=new Float32Array([0,1]));var k=S[T+"_flipY"];null===w?(w=this.prepareBackdrop(a.sourceFrame,k),C=k):(k[0]=C[0],k[1]=C[1]),S[T]=w,w&&(e[d]._backdropActive=!0)}}w&&(c=a.resolution=w.resolution)}a.renderTexture=this.getOptimalFilterTexture(a.sourceFrame.width,a.sourceFrame.height,c),a.filters=e,a.destinationFrame.width=a.renderTexture.width,a.destinationFrame.height=a.renderTexture.height;var P=this.tempRect;P.x=0,P.y=0,P.width=a.sourceFrame.width,P.height=a.sourceFrame.height,a.renderTexture.filterFrame=a.sourceFrame,a.bindingSourceFrame.copyFrom(s.sourceFrame),a.bindingDestinationFrame.copyFrom(s.destinationFrame),a.transform=r.projection.transform,r.projection.transform=null,s.bind(a.renderTexture,a.sourceFrame,P);var R=e[e.length-1].clearColor;return R?r.framebuffer.clear(R[0],R[1],R[2],R[3]):r.framebuffer.clear(0,0,0,0),!0}function R(t,e){return this.pushWithCheck(t,e,!1)}function O(){var t=this.defaultFilterStack,e=t.pop(),n=e.filters;this.activeState=e;var r=this.globalUniforms.uniforms;r.outputFrame=e.sourceFrame,r.resolution=e.resolution;var i=r.inputSize,o=r.inputPixel,a=r.inputClamp;if(i[0]=e.destinationFrame.width,i[1]=e.destinationFrame.height,i[2]=1/i[0],i[3]=1/i[1],o[0]=i[0]*e.resolution,o[1]=i[1]*e.resolution,o[2]=1/o[0],o[3]=1/o[1],a[0]=.5*o[2],a[1]=.5*o[3],a[2]=e.sourceFrame.width*i[2]-.5*o[2],a[3]=e.sourceFrame.height*i[3]-.5*o[3],e.legacy){var s=r.filterArea;s[0]=e.destinationFrame.width,s[1]=e.destinationFrame.height,s[2]=e.sourceFrame.x,s[3]=e.sourceFrame.y,r.filterClamp=r.inputClamp}this.globalUniforms.update();var c=t[t.length-1];if(e.renderTexture.framebuffer.multisample>1&&this.renderer.framebuffer.blit(),1===n.length)n[0].apply(this,e.renderTexture,c.renderTexture,x.yl.BLEND,e),this.returnFilterTexture(e.renderTexture);else{var l=e.renderTexture,u=this.getOptimalFilterTexture(l.width,l.height,e.resolution);u.filterFrame=l.filterFrame;var h=0;for(h=0;h<n.length-1;++h){n[h].apply(this,l,u,x.yl.CLEAR,e);var d=l;l=u,u=d}n[h].apply(this,l,c.renderTexture,x.yl.BLEND,e),this.returnFilterTexture(l),this.returnFilterTexture(u)}var f=!1;for(h=0;h<n.length;h++)if(n[h]._backdropActive){var p=n[h].backdropUniformName;f||(this.returnFilterTexture(n[h].uniforms[p]),f=!0),n[h].uniforms[p]=null,n[h]._backdropActive=!1}e.clear(),this.statePool.push(e)}var D=!1;function A(t,e){var n=this.renderer,r=n.renderTexture.current,i=this.renderer.renderTexture.sourceFrame,o=n.projection.transform||S.y3.IDENTITY,a=1;if(r)a=r.baseTexture.resolution,e[1]=1;else{if(!n.useContextAlpha)return D||(D=!0,console.warn("pixi-picture: you are trying to use Blend Filter on main framebuffer! That wont work.")),null;a=n.resolution,e[1]=-1}var s=Math.round((t.x-i.x+o.tx)*a),c=t.y-i.y+o.ty,l=Math.round((e[1]<0?i.height-(c+t.height):c)*a),u=Math.round(t.width*a),h=Math.round(t.height*a),d=n.gl,f=this.getOptimalFilterTexture(u,h,1);e[1]<0&&(e[0]=h/f.height),f.filterFrame=i,f.setResolution(a),n.texture.bindForceLocation(f.baseTexture,0);new Date;return d.copyTexSubImage2D(d.TEXTURE_2D,0,0,0,s,l,u,h),f}i.TextureSystem.prototype.bindForceLocation=k,i.FilterSystem.prototype.push=R,i.FilterSystem.prototype.pushWithCheck=P,i.FilterSystem.prototype.pop=O,i.FilterSystem.prototype.prepareBackdrop=A},401:(t,e,n)=>{n.d(e,{$G:()=>v,Cb:()=>u,Eh:()=>p,F3:()=>b,Gb:()=>h,Jp:()=>l,Ss:()=>s,Ty:()=>d,c4:()=>o,c9:()=>r,em:()=>a,gz:()=>f,hJ:()=>g,iN:()=>_,jw:()=>c,rR:()=>y,ty:()=>m,xb:()=>i});var r="c30849f08b1b4841a759a7c7534a2f0c.bin";function i(){return"".concat("https://webar-static.tencent-cloud.com/ar-sdk/resources","/").concat("1.0.25-0","/").concat(r)}var o={POINTS_MAP:23,KEY_POINTS:24,LEFT_FACE_OVAL:8,LEFT_FACE_OVAL2:9,LEFT_FACE_OVAL3:10,RIGHT_FACE_OVAL:11,RIGHT_FACE_OVAL2:12,RIGHT_FACE_OVAL3:13,MOUTH_UPPER:19,MOUTH_LOWER:20,OUTER_REFERENCE:18,outer_offset_ratio:27,triangulation:25,auvs:26,LEFT_IRIS:7,RIGHT_IRIS:6,LEFT_EYE_ORDER:14,RIGHT_EYE_ORDER:15,lipsTriangulation:28,lipsAuvs:29,LIPS:5},a=0,s=0,c=356,l=[0,32],u="64,65,63,72,79,70,74",h="61,75,74,68",d="61,6c,6c,6f,77,46,75,6e,63,4c,69,73,74",f="54,69,6d,65,73,74,61,6d,70",p="57,65,62,54,69,6d,65,73,74,61,6d,70",g="4b,65,79,4c,69,73,74",m={bu:"62,65,61,75,74,69,66,79",mu:"65,66,66,65,63,74,5f,6d,61,6b,65,75,70",s:"65,66,66,65,63,74,5f,73,74,69,63,6b,65,72,5f,32,64",s3:"65,66,66,65,63,74,5f,73,74,69,63,6b,65,72,5f,33,64",f:"66,69,6c,74,65,72",bg:"62,61,63,6b,67,72,6f,75,6e,64",a:"61,76,61,74,61,72,5f,61,72",av:"61,76,61,74,61,72,5f,76,72"};function y(t){for(var e="",n=t.split(","),r=0;r<n.length;r++)e+=String.fromCharCode(parseInt(n[r],16));return e}function v(t){for(var e="",n=0;n<t.length;n++)""==e?e=t.charCodeAt(n).toString(16):e+=","+t.charCodeAt(n).toString(16);return e}var _="offscreen",b={defaultRoot:"miniprogram_npm/tencentcloud-webar"}},3044:(t,e,n)=>{n.d(e,{UI:()=>f,iV:()=>d,pF:()=>p});var r=n(6309),i=n(1206),o=n(4809),a=n(8586),s=n(201),c=function(t,e,n,r){var i,o=arguments.length,a=o<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,n,r);else for(var s=t.length-1;s>=0;s--)(i=t[s])&&(a=(o<3?i(a):o>3?i(e,n,a):i(e,n))||a);return o>3&&a&&Object.defineProperty(e,n,a),a},l=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},u=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function a(t){try{c(r.next(t))}catch(t){o(t)}}function s(t){try{c(r.throw(t))}catch(t){o(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(a,s)}c((r=r.apply(t,e||[])).next())}))},h=function(t,e){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=a.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=e.call(t,a)}catch(t){o=[6,t],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}},d={};function f(){d={}}var p=function(){function t(){this._inited=!1,this._initing=!1}return t.prototype.getLoader=function(){return this._loader},t.prototype.getIndeLoader=function(){return this._initLoader()},t.prototype.readJSON=function(t,e){var n=this.encLoader.getFileFromCache(t,e).file;if(n&&n.length)return JSON.parse((0,o.T8)(n))},t.prototype._initLoader=function(){var t=this,e=new i.aN,n=this.getPreMiddleware();return e.pre(n),e.use((function(n,r){if("json"!==n.extension){var o=n.data;if(i.P6.kN[n.name])r();else{var a=i.xE.fromBuffer(o.file,o.width,o.height,{alphaMode:i.iw.UNPACK,resolution:(0,s.u)()});i.VL.addToCache(a.baseTexture,n.name),i.xE.addToCache(a,n.name),r()}}else t.handleSpriteSheet(e,n,r)})),e},t.prototype.removeFromCache=function(t){this.encLoader&&this.encLoader.removeFromCache(t)},t.prototype.init=function(){return u(this,void 0,Promise,(function(){var t=this;return h(this,(function(e){return this._inited?[2,Promise.resolve()]:this._initing?[2,new Promise((function(e,n){var r,i=function(){t._inited?(e(),clearTimeout(r)):r=setTimeout(i,50)};r=setTimeout(i,50)}))]:(this._initing=!0,[2,new Promise((function(e,n){var i=new r.e({});i.init().then((function(){t._inited=!0,t._initing=!1,t.encLoader=i,t._loader=t._initLoader(),e()})).catch((function(t){}))}))])}))}))},t.prototype.preload=function(t){return u(this,void 0,void 0,(function(){var e;return h(this,(function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),[4,this.encLoader.preload(t)];case 1:return n.sent(),[3,3];case 2:return e=n.sent(),[2,Promise.reject(e)];case 3:return[2]}}))}))},t.prototype.getPreMiddleware=function(){var t=this;return function(e,n){if(i.P6.kN&&e&&i.P6.kN[e.name])n();else{var r=e.url,a=t.encLoader.getFileFromCache(r),s=a.zip,c=a.file,l=e.name;if(l.indexOf("https")>-1&&l.indexOf("|")>-1){var u=l.split("|")[0],h=t.encLoader.getFileFromCache(r,u);s=h.zip,c=h.file}if(/\.(json)$/i.test(r))return e.data=JSON.parse((0,o.T8)(c)),e.complete(),void n();/\.(gif|jpe?g|tiff?|png|webp|bmp)$/i.test(r)?(e.data={file:c,width:s.__config[r]?s.__config[r].width:800,height:s.__config[r]?s.__config[r].height:800},e.complete(),n()):(e.data={file:c},e.complete(),n())}}},t.prototype.handleSpriteSheet=function(t,e,n){var r="".concat(e.name,"_image");if(e.data&&e.data.frames&&!t.resources[r]&&!i.P6.kN[r]){var o={crossOrigin:e.crossOrigin,metadata:e.data.meta},a=e.data.meta.image,c=e.url.split("/");c.pop(),c.push(a),a=c.join("/");var l=this.getLoader();l.add(r,a,o,(function(t){var r=i.xE.fromBuffer(t.data.file,t.data.width,t.data.height,{alphaMode:i.iw.UNPACK}),o=new i.c2(r,e.data,e.url+"@".concat((0,s.u)(),"x"));o.parse((function(){e.spritesheet=o,e.textures=o.textures,d[e.name]=e,n()}))})),l.load((function(t,e){}))}else n()},t=c([a.e,l("design:paramtypes",[])],t)}()},6309:(t,e,n)=>{n.d(e,{e:()=>b});var r=n(4809),i=n(5127),o=n(8586),a=n(3553),s=n(6878);const c=function(){function t(){this.projectName="webar-db",this.objectStoreName="webar-object-store","undefined"!=typeof self&&self?this.window=self:"undefined"!=typeof window&&window&&(this.window=window)}return t.prototype.checkSupport=function(){var t=this.window;return!(void 0===t||!t||!t.indexedDB)},t.prototype.init=function(){var t=this;return new Promise((function(e,n){if(t.checkSupport()){if(t.db)return void e(t.db);var r=t.window.indexedDB.open(t.projectName,1);r.onsuccess=function(n){t.db=n.target.result,e(t)},r.onupgradeneeded=function(e){var n=e.target.result;n.objectStoreNames.contains(t.objectStoreName)||n.createObjectStore(t.objectStoreName)},r.onerror=function(t){n(t)}}else n()}))},t.prototype.getItem=function(t){var e=this;return new Promise((function(n,r){if(e.db){var i=e.db.transaction(e.objectStoreName).objectStore(e.objectStoreName).get(t);i.onsuccess=function(){return n(i.result)},i.onerror=function(){return r()}}else r()}))},t.prototype.setItem=function(t,e){var n=this;return new Promise((function(r,i){if(n.db){var o=n.db.transaction(n.objectStoreName,"readwrite").objectStore(n.objectStoreName).put(e,t);o.onsuccess=function(){return r(e)},o.onerror=function(){return i()}}else i()}))},t.prototype.removeItem=function(t){var e=this;return new Promise((function(n,r){if(e.db){var i=e.db.transaction(e.objectStoreName,"readwrite").objectStore(e.objectStoreName).delete(t);i.onsuccess=function(){return n(null)},i.onerror=function(){return r()}}else r()}))},t.prototype.keys=function(){var t=this;return new Promise((function(e,n){if(!t.db)return n();var r=t.db.transaction(t.objectStoreName).objectStore(t.objectStoreName).getAllKeys();r.onsuccess=function(){return e(r.result)},r.onerror=function(){return n()}}))},t.prototype.clear=function(){var t=this;return new Promise((function(e,n){if(!t.db)return n();var r=t.db.transaction(t.objectStoreName,"readwrite").objectStore(t.objectStoreName).clear();r.onsuccess=function(){return e(null)},r.onerror=function(){return n()}}))},t}();var l=n(401),u=n(6109),h=n(9984),d=function(t,e,n,r){var i,o=arguments.length,a=o<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,n,r);else for(var s=t.length-1;s>=0;s--)(i=t[s])&&(a=(o<3?i(a):o>3?i(e,n,a):i(e,n))||a);return o>3&&a&&Object.defineProperty(e,n,a),a},f=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},p=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function a(t){try{c(r.next(t))}catch(t){o(t)}}function s(t){try{c(r.throw(t))}catch(t){o(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(a,s)}c((r=r.apply(t,e||[])).next())}))},g=function(t,e){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=a.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=e.call(t,a)}catch(t){o=[6,t],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}},m=function(t){var e="function"==typeof Symbol&&Symbol.iterator,n=e&&t[e],r=0;if(n)return n.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&r>=t.length&&(t=void 0),{value:t&&t[r++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},y=function(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var r,i,o=n.call(t),a=[];try{for(;(void 0===e||e-- >0)&&!(r=o.next()).done;)a.push(r.value)}catch(t){i={error:t}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return a},v=function(t,e,n){if(n||2===arguments.length)for(var r,i=0,o=e.length;i<o;i++)!r&&i in e||(r||(r=Array.prototype.slice.call(e,0,i)),r[i]=e[i]);return t.concat(r||Array.prototype.slice.call(e))};var _=function(){function t(t){this.id=Math.floor(1e8*Math.random()),this.size=t,this.data=new Map}return t.prototype.put=function(t,e){if(u.D4.info("put",t,this.data.keys(),this.id),t.indexOf(l.c9)>-1&&(this.common_cache=e,this.common_cache_domain=t),this.data.has(t))return u.D4.info("replace key",t),this.data.delete(t),void this.data.set(t,e);if(u.D4.info("check need remove old",this.data.size,this.size),this.data.size>=this.size){var n=this.data.keys().next().value;u.D4.info("delete key",n),this.data.delete(n)}u.D4.info("set key",t),this.data.set(t,e)},t.prototype.get=function(t){if(t.indexOf(l.c9)>-1)return this.common_cache;if(!this.data.has(t))return!1;var e=this.data.get(t);return this.data.delete(t),this.data.set(t,e),e},Object.defineProperty(t.prototype,"keys",{get:function(){return Array.from(this.data.keys()).concat([this.common_cache_domain])},enumerable:!1,configurable:!0}),t.prototype.delete=function(t){this.data.delete(t)},t.prototype.clear=function(){this.data.clear()},t=d([o.e,f("design:paramtypes",[Number])],t)}(),b=function(){function t(t){this._inited=!1,this._initing=!1,this.id=Math.floor(1e8*Math.random()),this._cache=new _(7),this._loadingMap={},t=t||{},this.config=t,this.arCacheStorage=new c}return t.prototype.init=function(){return p(this,void 0,Promise,(function(){var t=this;return g(this,(function(e){return this._inited?[2,Promise.resolve()]:this._initing?[2,new Promise((function(e,n){var r,i=function(){t._inited?(e(),clearTimeout(r)):r=setTimeout(i,50)};r=setTimeout(i,50)}))]:(this._initing=!0,this._c=new i.Y,[2,this._c.init().then((function(){t._inited=!0,t._initing=!1,setTimeout((function(){t.checkAndClearOldFileCache()}),9999)}))])}))}))},t.prototype.getSingletonWorker=function(){var t=this;return this.worker||(this.worker=new Worker,this.worker.onmessage=function(e){var n=e.data,i=n.p1,o=n.p2,a=n.length,s=(n.i,n.u),c=n.error;if(c)t._error=new Error(c.message);else{var l=new Uint8Array(a);l.set(i),l.set(o,i.length),t.setFileCache(s,l);var h=t._c,d=h.run(i,"");h.finish("");var f=new Uint8Array(a);f.set(d),f.set(o,d.length);var p=(0,r.GZ)(f);u.D4.info("preload finish:",s),t._setConfig(p).then((function(){t._cache.put(s,p),delete t._loadingMap[s]}))}}),this.worker},t.prototype.preload=function(t,e,n){return void 0===e&&(e=!0),void 0===n&&(n=1),p(this,void 0,Promise,(function(){var n,r,i=this;return g(this,(function(o){if(this._loadingMap[t])return[2,this.waitUntilPreload(t)];for(n in this._loadingMap[t]=!0,this._loadingMap)n!==t&&(this._loadingMap[n]=!1);return this._cache.get(t)?(delete this._loadingMap[t],[2,Promise.resolve()]):(r=a.Z.findId(t)||+new Date,[2,new Promise((function(n,o){return p(i,void 0,void 0,(function(){var i,o,a,c=this;return g(this,(function(l){switch(l.label){case 0:return[4,(0,h.pe)(r,t).catch((function(t){s.Nd.trigger("error",t)}))];case 1:return l.sent(),i=wx.getFileSystemManager(),o={},a="".concat(wx.env.USER_DATA_PATH,"/ar/").concat(r,".zip"),console.log("zip 处理",a),i.readZipEntry({filePath:a,entries:"all",success:function(a){var s=a.entries;for(var l in s)o[l]=new Uint8Array(s[l].data);c._cache.put(t,o),delete c._loadingMap[t],c._setConfig(o).then((function(){e||i.unlink({filePath:"".concat(wx.env.USER_DATA_PATH,"/ar/").concat(r,".bin"),success:function(){},fail:function(t){console.log("delete local cache fail",t)}}),n()}))},fail:function(t){console.log(t.errMsg)}}),[2]}}))}))}))])}))}))},t.prototype.getFileFromCache=function(t,e){var n=this._find(t,e);return{zip:n.c,file:n.f}},t.prototype.getGroupFromCache=function(t){return this._cache.get(t)},t.prototype._find=function(t,e){var n,r,i,o,a=this._cache,s=t;if(e){var c=a.get(e);return c&&(o=c[s]),{c,f:o}}var l=a.keys.reverse();try{for(var u=m(l),h=u.next();!h.done;h=u.next()){var d=h.value;if(o=(i=a.get(d))[s])break}}catch(t){n={error:t}}finally{try{h&&!h.done&&(r=u.return)&&r.call(u)}finally{if(n)throw n.error}}return{c:i,f:o}},t.prototype._setConfig=function(t){return p(this,void 0,Promise,(function(){return g(this,(function(e){return[2,new Promise((function(e){if(t.__config)e();else{var n=t["__config.json"];if(n){var i=JSON.parse((0,r.T8)(n));t.__config=i,e()}else e()}}))]}))}))},t.prototype.waitUntilPreload=function(t){var e=this;return new Promise((function(n,r){var i=setInterval((function(){e._cache.get(t)&&(clearInterval(i),n())}),50)}))},t.prototype.loadScript=function(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];return p(this,void 0,Promise,(function(){var n=this;return g(this,(function(i){return[2,new Promise((function(i,o){var a=n._cache.keys,s=t.split("/").pop();return a.forEach((function(t){var o=n._cache.get(t),a=o[s];if(o[s]){var c=(0,r.T8)(a),l=new Function(""+c),u=l.call.apply(l,v([null],y(e),!1));return i(u)}})),u.kg.info("this._cache",n.id,n._cache),o({message:"file not found in cache",url:t})}))]}))}))},t.prototype.hijackFetch=function(t,e,n){var r,i=this;return void 0===n&&(n=!1),e&&"string"==typeof e&&(r=e),new Promise((function(e){var o,a=i._cache.keys;if(o=n?t:t.split("/").pop(),r){var s=i._cache.get(r)[o];return s?e(s):e()}a.forEach((function(t){var n=i._cache.get(t)[o];if(n)return e(n)}))}))},t.prototype.removeFromCache=function(t){this._cache.delete(t)},t.prototype.clearCache=function(){console.trace("clearCache"),this._cache.clear(),this.worker&&(this.worker.terminate(),this.worker=null)},t.prototype.clearCacheTmp=function(t){var e,n;void 0===t&&(t=[]);try{for(var r=m(this._cache.keys),i=r.next();!i.done;i=r.next()){var o=i.value;-1===t.indexOf(o)&&this._cache.delete(o)}}catch(t){e={error:t}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(e)throw e.error}}},t.prototype.fetchWithSubPackage=function(t,e){return p(this,void 0,void 0,(function(){var n,r,i,o,a,s;return g(this,(function(c){switch(c.label){case 0:if(!(e>1&&Blob.prototype.arrayBuffer))return[3,3];for(r=1048576,i=[],o=function(e){var n=e*r,o=n+r-1,a="bytes=".concat(n,"-").concat(o),s=new Promise((function(n,r){fetch("".concat(t,"?id=00").concat(e),{method:"GET",mode:"cors",headers:{range:a}}).then((function(t){return t.arrayBuffer()})).then((function(t){n(t)}))}));i.push(s)},a=0;a<e;a++)o(a);return[4,Promise.all(i)];case 1:return s=c.sent(),[4,new Blob(s).arrayBuffer()];case 2:return n=c.sent(),[3,6];case 3:return[4,fetch(t,{method:"GET",mode:"cors"}).catch((function(t){}))];case 4:return[4,c.sent().arrayBuffer().catch((function(t){u.kg.error("get arraybuffer error",t)}))];case 5:n=c.sent(),c.label=6;case 6:return[2,n]}}))}))},t.prototype.checkFileCacheBlackList=function(t){return!!{"effect.bin":!0}[t]},t.prototype.setFileCache=function(t,e){var n=this;try{this.arCacheStorage.checkSupport()&&this.arCacheStorage.init().then((function(){var r=t.split("/").pop();if(!n.checkFileCacheBlackList(r)){var i="".concat("1.0.25-0","/").concat(r);n.arCacheStorage.setItem(i,e)}}))}catch(t){}},t.prototype.fetchFromFileCache=function(t){var e=this;return new Promise((function(n,r){e.arCacheStorage.checkSupport()?e.arCacheStorage.init().then((function(){var r=t.split("/").pop(),i="".concat("1.0.25-0","/").concat(r);e.checkFileCacheBlackList(r)?n(null):e.arCacheStorage.getItem(i).then((function(t){n(t||null)}))})).catch((function(){n(null)})):n(null)}))},t.prototype.checkAndClearOldFileCache=function(){var t=this;this.arCacheStorage.checkSupport()&&this.arCacheStorage.init().then((function(){t.arCacheStorage.keys().then((function(e){if(e&&e.length)for(var n="".concat("1.0.25-0"),r=0;r<e.length;r++){var i=e[r];i&&i.indexOf(n)<0&&t.arCacheStorage.removeItem(i)}}))})).catch((function(){}))},t=d([o.e,f("design:paramtypes",[Object])],t)}()},337:(t,e,n)=>{n.d(e,{Z:()=>o});const r={"0001":"当前环境不支持","0002":"请先开启摄像头及麦克风权限","0003":"去设置","0004":"输入不合法","0005":"缺少输入, 请设置input或camera参数","0006":"输入图片不合法","0007":"无权访问此接口,请确认License版本信息","0008":"创建录制器失败","0009":"录制启动失败","0010":"录制器停止失败","0011":"小程序读取缓存失败","0012":"存储空间不足,前往设置-通用-存储空间,清除缓存","0013":"需要重新进入页面使授权生效","0014":"当前SDK版本过低,部分特效无法正确显示,请升级SDK版本","0015":"intensity 的值超出范围(0-1),默认为 1","0016":"输入不合法, 远程链接只支持输入图片类型","0018":"当前浏览器特性支持不足,可能会出现卡顿情况,请使用新版 Chrome/Safari/微信体验","0019":"当前浏览器不支持,请使用新版 Chrome/Safari/微信体验","0020":"当前浏览器不支持,若Chrome请开启浏览器硬件加速","0021":"缺少鉴权参数licenseKey","0022":"缺少鉴权参数appId","0023":"输入不合法, 请传input或camera参数","0024":"无权访问此接口,请确认License版本信息","0025":"基础库加载失败","0026":"上下文丢失,请重新初始化","0027":"渲染耗时大,请尝试减小分辨率或刷新页面","0028":"未捕获异常","0029":"没有摄像头权限,请到设置-隐私中开启相关权限","0030":"调起用户摄像头失败","0031":"摄像头或麦克风中断,请手动刷新页面","0032":"分辨率变化导致特效丢失,请重新设置","0033":"特效加载失败","0034":"无法解析的数据","0035":"已授权,仍无法访问摄像头或麦克风设备","0036":"没有麦克风权限,请到设置-隐私中开启相关权限",1001:"美妆",1002:"贴纸",1003:"滤镜",1004:"3D特效",1005:"VR人像",1006:"头像"},i={"0001":"Unsupported environment","0002":"Please enable the camera and microphone permissions","0003":"Setting","0004":"Invalid input","0005":'Require "input" or "camera" paramate',"0006":"Invalid image input","0007":"API not accessible, Please confirm the License version","0008":"Failed to create the recorder","0009":"Failed to start recording","0010":"Failed to stop the recorder","0011":"Failed to read WX file cache data","0012":"Out of storage space, go to Settings - General-Storage Space and clear the cache","0013":"Need to enter the page again for the license to take effect","0014":"SDK version is too old, some features are not available. Please update the SDK","0015":'Require a valid value (0-1) for "intensity" (the default value is 1)',"0016":'Invalid "input" value, Only the image type can be entered for remote links',"0018":"This browser offers limited support for the SDK, and stutter may occur. Please use the latest version of Chrome, Safari, or WeChat","0019":"This browser is not supported. Please use the latest version of Chrome, Safari, or WeChat","0020":"This browser is not supported. If Chrome is used, enable hardware acceleration for the browser","0021":'The authentication parameter "licenseKey" is missing',"0022":'The authentication parameter "appId" is missing',"0023":'Require "input" or "camera" parameter',"0024":"The interface is not accessible. Please check the License version","0025":"Failed to load the basic libraries","0026":"The context is lost. Please reinitialize the SDK again","0027":"The rendering took too long. Try reducing the resolution or refreshing the page","0028":"No errors captured","0029":"This browser does not have camera permission, please go to Settings - Privacy turn Camera on","0030":"Failed to start the camera","0031":"The camera or microphone is disconnected. Please refresh","0032":"Resolution changes cause effects to be lost, Please reset","0033":"Failed to load the effects","0034":"Unrecognized response data","0035":"Authorized, but still unable to access camera or microphone device","0036":"This browser does not have microphone permission, please go to Settings - Privacy turn Microphone on",1001:"Makeup",1002:"Sticker",1003:"Filter",1004:"3D Effect",1005:"VR",1006:"AR"};const o=new(function(){function t(t){void 0===t&&(t="zh"),this._lang=t}return Object.defineProperty(t.prototype,"lang",{get:function(){return this._lang},set:function(t){this._lang=t},enumerable:!1,configurable:!0}),t.prototype.t=function(t){return"zh"===this._lang?r[t]:i[t]},t}())},885:(t,e,n)=>{var r,i,o;n.d(e,{Mj:()=>c,UZ:()=>o,bk:()=>a}),function(t){t[t.Default=0]="Default",t[t.Preview=1]="Preview"}(r||(r={})),function(t){t["2D"]="2d",t["3D"]="3d"}(i||(i={})),function(t){t[t.CAMERA=0]="CAMERA",t[t.VIDEO=1]="VIDEO",t[t.CANVAS=2]="CANVAS",t[t.IMAGE=3]="IMAGE",t[t.MEDIA_STREAM=4]="MEDIA_STREAM"}(o||(o={}));var a,s,c={CAMERA:0,CANVAS2D:2,IMAGE:3};!function(t){t[t.CAMERA=0]="CAMERA",t[t.VIDEO=1]="VIDEO",t[t.CANVAS=2]="CANVAS",t[t.IMAGE=3]="IMAGE",t[t.MEDIA_STREAM=4]="MEDIA_STREAM"}(a||(a={})),function(t){t[t.WORKER=0]="WORKER",t[t.DEFAULT=1]="DEFAULT"}(s||(s={}))},1084:(t,e,n)=>{n.d(e,{M:()=>a,o:()=>s});var r=n(6109),i=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function a(t){try{c(r.next(t))}catch(t){o(t)}}function s(t){try{c(r.throw(t))}catch(t){o(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(a,s)}c((r=r.apply(t,e||[])).next())}))},o=function(t,e){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=a.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=e.call(t,a)}catch(t){o=[6,t],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}};function a(t){return function(e,n,a){var s=a.value;return"AsyncFunction"===s.constructor.name?a.value=function(){for(var e=[],a=0;a<arguments.length;a++)e[a]=arguments[a];return i(this,void 0,void 0,(function(){return o(this,(function(i){switch(i.label){case 0:return[4,s.apply(this,e).catch((function(e){r.kg.info("".concat(t,".").concat(n," call failed"),e)}))];case 1:return[2,i.sent()]}}))}))}:a.value=function(){for(var e=[],i=0;i<arguments.length;i++)e[i]=arguments[i];try{var o=s.apply(this,e);return o}catch(e){r.kg.info("".concat(t,".").concat(n," call failed"),e)}},a}}function s(t){return function(e,n,a){var s=a.value;return a.value=function(){for(var e=[],a=0;a<arguments.length;a++)e[a]=arguments[a];return i(this,void 0,void 0,(function(){return o(this,(function(i){switch(i.label){case 0:return[4,s.apply(this,e).catch((function(e){r.kg.info("".concat(t,".").concat(n," call failed"),e)}))];case 1:return[2,i.sent()]}}))}))},a}}},5127:(t,e,n)=>{n.d(e,{Y:()=>p});var r=n(337),i=n(6878),o=n(8586),a=n(401),s=n(4809),c=n(6879),l=function(t,e,n,r){var i,o=arguments.length,a=o<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,n,r);else for(var s=t.length-1;s>=0;s--)(i=t[s])&&(a=(o<3?i(a):o>3?i(e,n,a):i(e,n))||a);return o>3&&a&&Object.defineProperty(e,n,a),a},u=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},h=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function a(t){try{c(r.next(t))}catch(t){o(t)}}function s(t){try{c(r.throw(t))}catch(t){o(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(a,s)}c((r=r.apply(t,e||[])).next())}))},d=function(t,e){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=a.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=e.call(t,a)}catch(t){o=[6,t],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}};"undefined"==typeof WXWebAssembly&&i.Nd.trigger("error",{code:c.U.ENVIRAONMENT_NOT_COMPATIBLE,message:r.Z.t("0019")});var f=WXWebAssembly,p=function(){function t(){this._inited=!1,this._initing=!1}return t.prototype.init=function(){return h(this,void 0,Promise,(function(){var t=this;return d(this,(function(e){return this._inited?[2,Promise.resolve()]:this._initing?[2,new Promise((function(e,n){var r,i=function(){t._inited?(e(),clearTimeout(r)):r=setTimeout(i,100)};r=setTimeout(i,100)}))]:(this._initing=!0,[2,new Promise((function(e,n){f.instantiate("/".concat(a.F3.defaultRoot,"/0.wasm.br"),{}).then((function(n){t._wasm=n.instance.exports,t._initWasmWrapper(),t._inited=!0,t._initing=!1,e()})).catch((function(t){console.log("wasm instantiate error",t)}))}))])}))}))},t.prototype._initWasmWrapper=function(){var t,e=this._wasm,n=e.memory,r=e.__wbindgen_malloc,i=e.__wbindgen_realloc;function o(){return null!=t&&t.buffer===n.buffer||(t=new Uint8Array(n.buffer)),t}var c,l,u=0;function h(t){for(var e=t.length,n=r(e),a=o(),s=0;s<e;s++){var l=t.charCodeAt(s);if(l>127)break;a[n+s]=l}if(s!==e){0!==s&&(t=t.slice(s)),n=i(n,e,e=s+3*t.length);var h=o().subarray(n+s,n+e);s+=c(t,h).written}return u=s,n}function d(){return null!=l&&l.buffer===n.buffer||(l=new Int32Array(n.buffer)),l}function f(t,e){return(0,s.T8)(o().subarray(t,t+e))}c=function(t,e){var n,r,i=new Array;n=t.length;for(var o=0;o<n;o++)(r=t.charCodeAt(o))>=65536&&r<=1114111?(i.push(r>>18&7|240),i.push(r>>12&63|128),i.push(r>>6&63|128),i.push(63&r|128)):r>=2048&&r<=65535?(i.push(r>>12&15|224),i.push(r>>6&63|128),i.push(63&r|128)):r>=128&&r<=2047?(i.push(r>>6&31|192),i.push(63&r|128)):i.push(255&r);var a=new Int8Array(i.length);for(var o in i)a[o]=i[o];return e.set(a),{read:t.length,written:a.length}},this.run=function(t,n){var i,s,c=e[(0,a.rR)(a.Cb)],l=e.__wbindgen_free,f=(s=r(1*(i=t).length),o().set(i,s/1),u=i.length,s),p=u;try{c(8,f,p,h(n),u);var g=d(),m=function(t,e){return o().subarray(t/1,t/1+e)}(g[2],g[3]).slice();return l(g[2],1*g[3]),m}finally{t.set(o().subarray(f/1,f/1+p)),l(f,1*p)}},this.finish=function(t){(0,e.finish)(h(t),u)},this.run2=function(t,n,r){var i=e.__wbindgen_free,o=(e[(0,a.rR)(a.Gb)](8,h(t),u,h(n),u,h(r),u),d()),s=f(o[2],o[3]).slice();return i(o[2],1*o[3]),s},this.a_de=function(t){var n=e.__wbindgen_free,r=(e.a_de(8,h(t),u),d()),i=f(r[2],r[3]).slice();return n(r[2],1*r[3]),i},this.a_en=function(t){var n=e.__wbindgen_free,r=(e.a_en(8,h(t),u),d()),i=f(r[2],r[3]).slice();return n(r[2],1*r[3]),i}},t=l([o.e,u("design:paramtypes",[])],t)}()},6879:(t,e,n)=>{n.d(e,{U:()=>r});var r={ENVIRAONMENT_NOT_COMPATIBLE:10000001,ENVIRAONMENT_NOT_FAST:10000006,WEBGL_CONTEXT_LOST:10000002,RENDER_SLOW:10000003,INPUT_ERROR:10000005,PRELOAD_EFFECT_ERROR:10000101,SET_EFFECT_ERROR:10001101,SET_FILTER_ERROR:10001102,SET_INTENSITY_ERROR:10001103,SDK_DISABLED:10001104,INVALID_EFFECT:10001105,GET_CAMERA_ERROR:10001201,MEDIA_INTERRUPT_ERROR:10001202,GET_CAMERA_NOT_ALLOWED:10001203,GET_MEDIA_NOT_FOUND:10001204,GET_MICROPHONE_NOT_ALLOWED:10001205,MEDIA_SIZE_ERROR:10001206,EFFECT_LOAD_ERROR:10003001,CORE_LOAD_ERROR:10003002,AUTH_NEED_RELOAD_PAGE:10004001,AUTH_LICENSEKEY_MISS:20002001,AUTH_APPID_MISS:20002001,AUTH_FAIL:20001001,REQUEST_FAIL:20001002,AUTH_API_FAIL:20001003,SIGNATURE_TIMEOUT:20001004,AUTHORIZE_TIMEOUT:20001005,START_REACORD_FAIL:30000001,STOP_REACORD_FAIL:30000002,READ_FILE_CACHE_FAIL:30000003,REQUEST_FILE_FAIL:30000004,UNCAUGHT_ERROR:4e7,SDK_VERSION_LOW_ERROR:40000001,SEGMENTATION_NOT_AVAILABLE:40000002,INPUT_NODE_RESIZE:50000001,RESIZE_EFFECT_LOST:50000002}},6878:(t,e,n)=>{n.d(e,{E5:()=>o,Nd:()=>r,Q4:()=>i,SZ:()=>a});var r,i=function(){function t(){this._events={}}return t.prototype.clear=function(){this._events={}},t.prototype.on=function(t,e){return this._events[t]||(this._events[t]=[]),this._events[t].push(e)-1},t.prototype.trigger=function(t,e,n){var r=this;if(void 0===n&&(n=!1),"error"!==t){var i=this._events[t];i&&i.length&&i.forEach((function(t){t(e)}))}else setTimeout((function(n){var i=r._events[t];i&&i.length&&i.forEach((function(t){t(e)}))}),100)},t.prototype.off=function(t,e,n){var r=this._events[t];if(r&&r.length)if(void 0!==n)r.splice(n,1);else{var i=r.findIndex((function(t){return t===e}));i>-1&&r.splice(i,1)}},t.prototype.once=function(t,e){var n,r=this;this._events[t]||(this._events[t]=[]);var i=function(o){e(o),r.off(t,i,n)};n=this.on(t,i)},t}(),o=function(){return r||(r=new i),r},a=function(){r=null}},6109:(t,e,n)=>{n.d(e,{D4:()=>l,bH:()=>u,b_:()=>c,jl:()=>s,kg:()=>a});var r=n(5901),i=n.n(r);i().useDefaults(),i().setLevel(i().INFO);var o=new Set,a=i();function s(t){return o.add(t),i().get(t)}var c=s("set-effect"),l=s("resource-load"),u=s("debug");s("gl-pipeline")},1347:(t,e,n)=>{function r(t,e){t.z=t.z||0,e.z=e.z||0;var n=Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2)+Math.pow(t.z-e.z,2);return Math.pow(n,.5)}n.d(e,{Sp:()=>r})},201:(t,e,n)=>{n.d(e,{u:()=>r});QualityManager.instance.gpu_detector.level;var r=function(){return 1}},8586:(t,e,n)=>{n.d(e,{e:()=>i});var r=Symbol(),i=function(t){return new Proxy(t,{construct:function(t,e,n){return t.prototype!==n.prototype?Reflect.construct(t,e,n):(t[r]||(t[r]=Reflect.construct(t,e,n)),t[r])}})}},617:(t,e,n)=>{n.d(e,{M:()=>N});var r={};n.r(r),n.d(r,{FC:()=>l,CV:()=>s,rp:()=>c,HN:()=>C,X2:()=>g,Ej:()=>w,Nj:()=>f,Bb:()=>d,dE:()=>u,oC:()=>x,MX:()=>b,aj:()=>y,G4:()=>v,m1:()=>_,sP:()=>o,dO:()=>a,bb:()=>m,Ed:()=>p,he:()=>h,aV:()=>E,AE:()=>S,aW:()=>O,zk:()=>R,Op:()=>P,Cg:()=>T,Fx:()=>k,mw:()=>i});const i={au:"/r",ti:"/m",ef:"/t",ae:"/c"},o=[61,62,76,63,58,59,75,60],a=[42,71,70,69,68,41,40,39,38],s=[52,57,73,56,55,54,72,53],c=[33,64,65,66,67,34,35,36,37],l=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,121,122,118,116,115,114,110,111,112,113,117,120,119],u=[84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,106,107,108,109],h=[474,475,476,477],d=[469,470,471,472],f=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15],p=[332,284,251,389,356,454,323,361,288,397,365,379,378],g=[52,57,73,56,55,54,72,53],m=[61,62,76,63,58,59,75,60],y=[80,82,47,48,49,50,51,81,83],v=[43,44,45,46],_=[[{y:120,x:0},{y:112,x:112},110,{y:115,x:115},{y:122,x:32}],[{y:110,x:122},{y:121,x:121},{y:28,x:32},{y:24,x:25},{y:16,x:21}],[{y:19,x:21},16,{y:13,x:11}],[{y:110,x:120},{y:119,x:119},{y:4,x:0},{y:8,x:7},{y:16,x:11}]],b=[96,106,97,98,99,108,100],x=[96,107,103,102,101,109,100],w=[52,53,72,54,55],C=[52,57,73,56,55],T={contour_left1:0,contour_left2:0,contour_left3:0,contour_left4:2,contour_left5:0,contour_left6:0,contour_left7:0,contour_left8:0,contour_left9:9,contour_left10:9,contour_left11:0,contour_left12:0,contour_right1:0,contour_right2:0,contour_right3:0,contour_right4:30,contour_right5:0,contour_right6:0,contour_right7:0,contour_right8:0,contour_right9:23,contour_right10:23,contour_right11:0,contour_right12:0,contour_left_limit_point:0,contour_right_limit_point:0,contour_chin:16,mouth_lower_lip_bottom:43,left_eye_left_corner:52,left_eye_right_corner:55,left_eye_top:72,left_eye_bottom:73,left_eye_center:74,right_eye_left_corner:58,right_eye_right_corner:61,right_eye_top:75,right_eye_bottom:76,right_eye_center:77,nose_bridge1:0,nose_bridge2:0,nose_bridge3:0,nose_bridge4:43,nose_bridge5:44,nose_bridge6:45,nose_bridge7:46,nose_tip:47,nose_left1:82,nose_left2:48,nose_right1:83,nose_right2:50,nose_tip1:46,nose_bottom:49,lip_top_left:84,lip_top_left_target:57,lip_top_right:90,lip_top_right_target:24,lip_top_center:87,lip_top_center_target:49,lip_bottom_left:94,lip_bottom_left_target:13,lip_bottom_right:92,lip_bottom_right_target:18,lip_bottom_center:93,lip_bottom_center_target:16,lip_inner_top:98,lip_inner_bottom:102,forehead_top_center:10,eyebrow_center:43,forehead_left:113,left_eyebrow_center:35,forehead_right:116,right_eyebrow_center:40,chin_left:13,chin_right:19},S=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122],k=[43,44,79,43,78,44,44,58,79,80,45,44,44,81,58,58,59,79,79,68,43,81,63,58,58,63,59,78,55,44,59,68,79,67,54,78,78,54,55,45,81,44,67,78,43,63,105,59,59,69,68,77,105,63,76,77,63,37,67,43,60,75,105,105,75,59,81,76,63,54,56,55,55,80,44,69,38,68,68,38,43,56,80,55,45,46,81,80,46,45,70,69,75,75,69,59,38,37,43,72,104,54,54,104,56,56,73,80,72,54,66,104,74,56,66,54,67,104,53,74,76,62,77,77,60,105,28,62,76,62,60,77,57,73,74,74,73,56,51,83,81,81,83,76,37,66,67,70,39,69,69,39,38,111,36,37,73,82,80,80,48,46,50,51,81,50,81,46,49,50,46,60,70,75,71,70,60,110,37,38,37,36,66,53,104,72,53,57,74,47,48,80,30,61,62,62,61,60,48,49,46,82,47,80,53,72,65,73,4,82,65,72,66,36,65,66,53,52,57,70,40,39,112,35,36,41,40,70,64,52,53,84,47,82,61,71,60,36,35,65,65,64,53,110,38,114,86,49,48,87,88,49,49,88,50,50,89,51,85,48,47,85,86,48,85,84,96,86,87,49,71,41,70,108,89,99,88,89,50,51,90,83,29,30,62,34,64,65,86,98,87,99,89,88,106,85,96,32,42,61,61,42,71,71,42,41,99,98,101,89,90,51,99,88,98,99,109,108,108,100,89,98,88,87,99,101,109,35,34,65,64,33,52,109,100,108,100,90,89,102,98,103,97,98,86,98,102,101,85,97,86,107,103,97,97,103,98,85,47,84,85,106,97,96,107,106,106,107,97,114,39,115,114,38,39,35,113,34,115,40,116,115,39,40,84,82,7,4,73,57,34,33,64,52,2,57,116,40,41,109,91,100,100,91,90,101,91,109,92,91,101,92,101,102,110,111,37,120,119,33,29,62,28,28,76,83,30,31,61,27,83,26,27,28,83,107,95,103,103,94,102,96,95,107,84,95,96,111,112,36,31,32,61,42,122,41,32,121,42,93,92,102,118,116,41,115,127,114,26,83,25,95,94,103,94,93,102,121,122,42,129,122,121,1,2,52,2,3,57,84,11,95,0,1,52,3,4,57,25,83,90,25,90,24,117,113,123,112,113,35,33,0,52,119,0,33,120,33,34,4,5,82,122,118,41,117,120,34,119,137,0,24,90,23,5,6,82,95,12,94,113,117,34,23,90,22,6,7,82,22,90,21,90,91,21,7,8,84,21,91,20,8,9,84,94,15,93,9,10,84,20,91,19,91,92,19,10,11,84,19,92,18,11,12,95,18,92,17,12,13,94,17,92,93,13,14,94,16,17,93,14,15,94,15,16,93,31,129,32,32,129,121,122,128,118,130,129,31,130,31,30,130,30,29,130,29,28,130,28,27,130,27,131,27,26,131,26,25,131,131,24,132,131,25,24,24,23,132,23,22,132,136,137,120,120,137,119,0,137,1,1,138,2,2,138,3,3,138,4,4,138,5,5,139,6,6,139,7,7,139,8,8,140,9,132,21,133,132,22,21,21,20,133,137,138,1,9,140,10,10,140,11,11,135,12,138,139,5,12,135,13,13,135,14,129,128,122,118,127,116,116,127,115,114,126,110,133,20,19,133,19,18,133,18,17,123,136,117,117,136,120,123,113,112,123,112,111,134,17,16,134,133,17,134,16,15,135,15,14,139,140,8,140,135,11,128,127,118,124,123,111,135,134,15,124,111,110,127,126,114,126,125,110,125,124,110],E=[.488189826866528,.46679085,.488189826866528,.50658295,.516143625,.471960025,.488189826866528,.46679085,.4599979375,.4717894375,.488189826866528,.50658295,.488189826866528,.50658295,.5447991249999999,.48110985,.516143625,.471960025,.4410622,.565803525,.488189826866528,.5462991,.488189826866528,.50658295,.488189826866528,.50658295,.5369319124999999,.5654357875,.5447991249999999,.48110985,.5447991249999999,.48110985,.5602547125,.46035325,.516143625,.471960025,.516143625,.471960025,.542807575,.42128374999999996,.488189826866528,.46679085,.5369319124999999,.5654357875,.568110275,.48251628750000003,.5447991249999999,.48110985,.5447991249999999,.48110985,.568110275,.48251628750000003,.5602547125,.46035325,.4599979375,.4717894375,.42883299999999996,.48068869999999997,.488189826866528,.50658295,.5602547125,.46035325,.542807575,.42128374999999996,.516143625,.471960025,.434630275,.421406325,.4135695,.4596802125,.4599979375,.4717894375,.4599979375,.4717894375,.4135695,.4596802125,.42883299999999996,.48068869999999997,.488189826866528,.5462991,.5369319124999999,.5654357875,.488189826866528,.50658295,.434630275,.421406325,.4599979375,.4717894375,.488189826866528,.46679085,.568110275,.48251628750000003,.5865549125,.4657776625,.5602547125,.46035325,.5602547125,.46035325,.57607715,.4146392875,.542807575,.42128374999999996,.588454125,.46861568750000004,.5865549125,.4657776625,.568110275,.48251628750000003,.5915551,.4831601,.588454125,.46861568750000004,.568110275,.48251628750000003,.4365127125,.40153225,.434630275,.421406325,.488189826866528,.46679085,.6097423125,.4507424125,.5838801625,.449976875,.5865549125,.4657776625,.5865549125,.4657776625,.5838801625,.449976875,.5602547125,.46035325,.5369319124999999,.5654357875,.5915551,.4831601,.568110275,.48251628750000003,.4135695,.4596802125,.40557155,.48211937499999996,.42883299999999996,.48068869999999997,.42883299999999996,.48068869999999997,.4410622,.565803525,.488189826866528,.50658295,.57607715,.4146392875,.5406618125,.40061935,.542807575,.42128374999999996,.542807575,.42128374999999996,.5406618125,.40061935,.488189826866528,.46679085,.40557155,.48211937499999996,.4410622,.565803525,.42883299999999996,.48068869999999997,.488189826866528,.5462991,.488189826866528,.58580675,.5369319124999999,.5654357875,.4410622,.565803525,.488189826866528,.58580675,.488189826866528,.5462991,.60990175,.4109925,.57607715,.4146392875,.5838801625,.449976875,.5838801625,.449976875,.57607715,.4146392875,.5602547125,.46035325,.5406618125,.40061935,.4365127125,.40153225,.488189826866528,.46679085,.38991549999999997,.4494414125,.3875146875,.465458025,.4135695,.4596802125,.4135695,.4596802125,.3875146875,.465458025,.40557155,.48211937499999996,.40557155,.48211937499999996,.38226482500000003,.4827557,.4410622,.565803525,.38991549999999997,.4494414125,.4135695,.4596802125,.4020055,.415060875,.3875146875,.465458025,.385898325,.46785316250000003,.40557155,.48211937499999996,.4020055,.415060875,.4135695,.4596802125,.434630275,.421406325,.3875146875,.465458025,.3640840875,.45055124999999996,.385898325,.46785316250000003,.5915551,.4831601,.6139756,.476639975,.588454125,.46861568750000004,.588454125,.46861568750000004,.6097423125,.4507424125,.5865549125,.4657776625,.6986649375,.5627347125,.6139756,.476639975,.5915551,.4831601,.6139756,.476639975,.6097423125,.4507424125,.588454125,.46861568750000004,.3599488125,.47632687500000004,.38226482500000003,.4827557,.385898325,.46785316250000003,.385898325,.46785316250000003,.38226482500000003,.4827557,.40557155,.48211937499999996,.537402425,.6126665875,.5512806,.592975125,.5369319124999999,.5654357875,.5369319124999999,.5654357875,.5512806,.592975125,.5915551,.4831601,.4365127125,.40153225,.4020055,.415060875,.434630275,.421406325,.60990175,.4109925,.5750593125000001,.39081712500000004,.57607715,.4146392875,.57607715,.4146392875,.5750593125000001,.39081712500000004,.5406618125,.40061935,.4196925125,.2953909749999999,.4028723125,.3915063125,.4365127125,.40153225,.38226482500000003,.4827557,.427124375,.59353005,.4410622,.565803525,.4410622,.565803525,.46482735,.617807575,.488189826866528,.58580675,.5135869249999999,.617646025,.537402425,.6126665875,.5369319124999999,.5654357875,.5135869249999999,.617646025,.5369319124999999,.5654357875,.488189826866528,.58580675,.488189826866528,.622551,.5135869249999999,.617646025,.488189826866528,.58580675,.6097423125,.4507424125,.60990175,.4109925,.5838801625,.449976875,.64358425,.412451125,.60990175,.4109925,.6097423125,.4507424125,.488189826866528,.2883909749999999,.4365127125,.40153225,.5406618125,.40061935,.4365127125,.40153225,.4028723125,.3915063125,.4020055,.415060875,.3640840875,.45055124999999996,.3875146875,.465458025,.38991549999999997,.4494414125,.3640840875,.45055124999999996,.3599488125,.47632687500000004,.385898325,.46785316250000003,.44135155,.61300865,.46482735,.617807575,.4410622,.565803525,.7079557,.5055197499999999,.6325640875,.46274605,.6139756,.476639975,.6139756,.476639975,.6325640875,.46274605,.6097423125,.4507424125,.46482735,.617807575,.488189826866528,.622551,.488189826866528,.58580675,.427124375,.59353005,.44135155,.61300865,.4410622,.565803525,.3640840875,.45055124999999996,.38991549999999997,.4494414125,.368784175,.41131387500000005,.38226482500000003,.4827557,.282695775,.5610828375,.427124375,.59353005,.368784175,.41131387500000005,.38991549999999997,.4494414125,.4020055,.415060875,.4028723125,.3915063125,.368784175,.41131387500000005,.4020055,.415060875,.3640840875,.45055124999999996,.3412266875,.462774925,.3599488125,.47632687500000004,.60990175,.4109925,.6109665,.3861959125,.5750593125000001,.39081712500000004,.38542595,.3023909749999999,.3679795875,.3866262,.4028723125,.3915063125,.6464699500000001,.39127456250000003,.6109665,.3861959125,.60990175,.4109925,.33567349999999996,.4124759625,.3412266875,.462774925,.3640840875,.45055124999999996,.40563065000000004,.66605925,.44135155,.61300865,.427124375,.59353005,.6325640875,.46274605,.64358425,.412451125,.6097423125,.4507424125,.4028723125,.3915063125,.3679795875,.3866262,.368784175,.41131387500000005,.368784175,.41131387500000005,.33567349999999996,.4124759625,.3640840875,.45055124999999996,.488189826866528,.2883909749999999,.5406618125,.40061935,.5578605625,.2953909749999999,.467591,.6554576874999999,.488189826866528,.622551,.46482735,.617807575,.488189826866528,.660130075,.505873625,.6556971749999999,.488189826866528,.622551,.488189826866528,.622551,.505873625,.6556971749999999,.5135869249999999,.617646025,.5135869249999999,.617646025,.537864,.66081345,.537402425,.6126665875,.436492575,.659831,.46482735,.617807575,.44135155,.61300865,.436492575,.659831,.467591,.6554576874999999,.46482735,.617807575,.436492575,.659831,.40563065000000004,.66605925,.4149069625,.6694827499999999,.467591,.6554576874999999,.488189826866528,.660130075,.488189826866528,.622551,.64358425,.412451125,.6464699500000001,.39127456250000003,.60990175,.4109925,.54207058125,.6724125624999999,.537864,.66081345,.523628625,.6757999375,.505873625,.6556971749999999,.537864,.66081345,.5135869249999999,.617646025,.537402425,.6126665875,.5699740624999999,.665637625,.5512806,.592975125,.7040264999999999,.5342099,.7079557,.5055197499999999,.6139756,.476639975,.33314059999999995,.3906893125,.33567349999999996,.4124759625,.368784175,.41131387500000005,.467591,.6554576874999999,.488189826866528,.679725375,.488189826866528,.660130075,.523628625,.6757999375,.537864,.66081345,.505873625,.6556971749999999,.43286249374999997,.6727749375,.436492575,.659831,.4149069625,.6694827499999999,.7120584999999999,.4479282,.67428775,.41762,.6325640875,.46274605,.6325640875,.46274605,.67428775,.41762,.64358425,.412451125,.64358425,.412451125,.67428775,.41762,.6464699500000001,.39127456250000003,0,0,0,0,0,0,.537864,.66081345,.5699740624999999,.665637625,.537402425,.6126665875,.523628625,.6757999375,.505873625,.6556971749999999,.488189826866528,.679725375,0,0,0,0,0,0,.54207058125,.6724125624999999,.5605125375,.6690251875,.537864,.66081345,.488189826866528,.679725375,.505873625,.6556971749999999,.488189826866528,.660130075,0,0,0,0,0,0,.3679795875,.3866262,.33314059999999995,.3906893125,.368784175,.41131387500000005,.33567349999999996,.4124759625,.305216575,.4170092,.3412266875,.462774925,0,0,0,0,0,0,.5605125375,.6690251875,.5699740624999999,.665637625,.537864,.66081345,0,0,0,0,0,0,.450818025,.676067125,.488189826866528,.679725375,.467591,.6554576874999999,0,0,0,0,0,0,.436492575,.659831,.450818025,.676067125,.467591,.6554576874999999,0,0,0,0,0,0,0,0,0,0,0,0,.436492575,.659831,.44135155,.61300865,.40563065000000004,.66605925,.436492575,.659831,.43286249374999997,.6727749375,.450818025,.676067125,0,0,0,0,0,0,0,0,0,0,0,0,.5578605625,.2953909749999999,.5750593125000001,.39081712500000004,.59301290625,.3023909749999999,.5578605625,.2953909749999999,.5406618125,.40061935,.5750593125000001,.39081712500000004,.3679795875,.3866262,.35056009374999997,.3093909749999999,.33314059999999995,.3906893125,.59301290625,.3023909749999999,.6109665,.3861959125,.6287182250000001,.3093909749999999,.59301290625,.3023909749999999,.5750593125000001,.39081712500000004,.6109665,.3861959125,.40563065000000004,.66605925,.427124375,.59353005,.3030863625,.64445225,.282695775,.5610828375,.38226482500000003,.4827557,.3599488125,.47632687500000004,.33314059999999995,.3906893125,.305216575,.4170092,.33567349999999996,.4124759625,.3412266875,.462774925,.2733915,.50383525,.3599488125,.47632687500000004,.6287182250000001,.3093909749999999,.6109665,.3861959125,.6464699500000001,.39127456250000003,.54208226875,.67264515625,.5469159375,.6879962500000001,.5605125375,.6690251875,.5605125375,.6690251875,.5469159375,.6879962500000001,.5699740624999999,.665637625,.523652,.676265125,.5469159375,.6879962500000001,.54208226875,.67264515625,.5189354375,.7045858749999999,.5469159375,.6879962500000001,.523652,.676265125,.5189354375,.7045858749999999,.523652,.676265125,.488189826866528,.6814735375,.488189826866528,.2883909749999999,.4196925125,.2953909749999999,.4365127125,.40153225,.28182385833333334,.3866262,.27597567916666665,.4170092,.305216575,.4170092,.7040264999999999,.5342099,.6139756,.476639975,.6986649375,.5627347125,.6986649375,.5627347125,.5915551,.4831601,.5512806,.592975125,.7079557,.5055197499999999,.71060725,.476442525,.6325640875,.46274605,.692903125,.5908523999999999,.5512806,.592975125,.6857991250000001,.618673825,.692903125,.5908523999999999,.6986649375,.5627347125,.5512806,.592975125,.43282999375,.673484,.42734125,.6891803,.450753025,.67748525,.450753025,.67748525,.4548121625,.7055647999999999,.488189826866528,.6814735375,.4149069625,.6694827499999999,.42734125,.6891803,.43282999375,.673484,.40563065000000004,.66605925,.42734125,.6891803,.4149069625,.6694827499999999,.4196925125,.2953909749999999,.38542595,.3023909749999999,.4028723125,.3915063125,.71060725,.476442525,.7120584999999999,.4479282,.6325640875,.46274605,.67428775,.41762,.6994682499999999,.3861959125,.6464699500000001,.39127456250000003,.7120584999999999,.4479282,.705763375,.41762,.67428775,.41762,.488189826866528,.7103383750000001,.5189354375,.7045858749999999,.488189826866528,.6814735375,.67428775,.33039097499999986,.6287182250000001,.3093909749999999,.6464699500000001,.39127456250000003,.59301290625,.3023909749999999,.7120584999999999,.13003558749999994,.5578605625,.2953909749999999,.6857991250000001,.618673825,.5512806,.592975125,.6774095,.6461884999999999,.42734125,.6891803,.4548121625,.7055647999999999,.450753025,.67748525,.4548121625,.7055647999999999,.488189826866528,.7103383750000001,.488189826866528,.6814735375,.705763375,.41762,.6994682499999999,.3861959125,.67428775,.41762,.8383426749999999,.41762,.6994682499999999,.3861959125,.705763375,.41762,.2711788125,.475080675,.2733915,.50383525,.3412266875,.462774925,.2733915,.50383525,.27736215000000003,.53252975,.3599488125,.47632687500000004,.40563065000000004,.66605925,.364313,.738966,.42734125,.6891803,.2701275,.446433525,.2711788125,.475080675,.3412266875,.462774925,.27736215000000003,.53252975,.282695775,.5610828375,.3599488125,.47632687500000004,.6774095,.6461884999999999,.5512806,.592975125,.5699740624999999,.665637625,.6774095,.6461884999999999,.5699740624999999,.665637625,.66662155,.6725830875,.305216575,.33039097499999986,.35056009374999997,.3093909749999999,.2701275,.1304658749999999,.38542595,.3023909749999999,.35056009374999997,.3093909749999999,.3679795875,.3866262,.305216575,.4170092,.2701275,.446433525,.3412266875,.462774925,.27597567916666665,.4170092,.2701275,.446433525,.305216575,.4170092,.28182385833333334,.3866262,.305216575,.4170092,.33314059999999995,.3906893125,.282695775,.5610828375,.28838671250000003,.58901565,.427124375,.59353005,.6994682499999999,.3861959125,.67428775,.33039097499999986,.6464699500000001,.39127456250000003,.305216575,.33039097499999986,.28182385833333334,.3866262,.33314059999999995,.3906893125,.27597567916666665,.4170092,.1433963791666667,.4170092,.2701275,.446433525,.66662155,.6725830875,.5699740624999999,.665637625,.652230375,.6970854125,.28838671250000003,.58901565,.29503317500000004,.6170379625,.427124375,.59353005,.42734125,.6891803,.38528327500000004,.7581624625000001,.4548121625,.7055647999999999,.35056009374999997,.3093909749999999,.305216575,.33039097499999986,.33314059999999995,.3906893125,.652230375,.6970854125,.5699740624999999,.665637625,.6349819999999999,.719920125,.29503317500000004,.6170379625,.3030863625,.64445225,.427124375,.59353005,.6349819999999999,.719920125,.5699740624999999,.665637625,.615452575,.7405493125,.5699740624999999,.665637625,.5469159375,.6879962500000001,.615452575,.7405493125,.3030863625,.64445225,.3134811625,.6709578,.40563065000000004,.66605925,.615452575,.7405493125,.5469159375,.6879962500000001,.5944185000000001,.7597992000000001,.3134811625,.6709578,.327658,.6954898125,.40563065000000004,.66605925,.4548121625,.7055647999999999,.46111278749999995,.797688125,.488189826866528,.7103383750000001,.327658,.6954898125,.3447950375,.7185136249999999,.40563065000000004,.66605925,.5944185000000001,.7597992000000001,.5469159375,.6879962500000001,.57167145,.777034625,.5469159375,.6879962500000001,.5189354375,.7045858749999999,.57167145,.777034625,.3447950375,.7185136249999999,.364313,.738966,.40563065000000004,.66605925,.57167145,.777034625,.5189354375,.7045858749999999,.54608605,.79034725,.364313,.738966,.38528327500000004,.7581624625000001,.42734125,.6891803,.54608605,.79034725,.5189354375,.7045858749999999,.5180748375,.798073,.38528327500000004,.7581624625000001,.4080183375,.7756525375,.4548121625,.7055647999999999,.5180748375,.798073,.5189354375,.7045858749999999,.488189826866528,.7103383750000001,.4080183375,.7756525375,.43323218750000003,.78937325,.4548121625,.7055647999999999,.488189826866528,.800711625,.5180748375,.798073,.488189826866528,.7103383750000001,.43323218750000003,.78937325,.46111278749999995,.797688125,.4548121625,.7055647999999999,.46111278749999995,.797688125,.488189826866528,.800711625,.488189826866528,.7103383750000001,.71060725,.476442525,.8383426749999999,.41762,.7120584999999999,.4479282,.7120584999999999,.4479282,.8383426749999999,.41762,.705763375,.41762,.6994682499999999,.3861959125,.8320475499999999,.2883909749999999,.67428775,.33039097499999986,.8446377999999999,.5627347125,.8383426749999999,.41762,.71060725,.476442525,.8446377999999999,.5627347125,.71060725,.476442525,.7079557,.5055197499999999,.8446377999999999,.5627347125,.7079557,.5055197499999999,.7040264999999999,.5342099,.8446377999999999,.5627347125,.7040264999999999,.5342099,.6986649375,.5627347125,.8446377999999999,.5627347125,.6986649375,.5627347125,.692903125,.5908523999999999,.8446377999999999,.5627347125,.692903125,.5908523999999999,.8099888,.6725830875,.692903125,.5908523999999999,.6857991250000001,.618673825,.8099888,.6725830875,.6857991250000001,.618673825,.6774095,.6461884999999999,.8099888,.6725830875,.8099888,.6725830875,.66662155,.6725830875,.7480318749999999,.800711625,.8099888,.6725830875,.6774095,.6461884999999999,.66662155,.6725830875,.66662155,.6725830875,.652230375,.6970854125,.7480318749999999,.800711625,.652230375,.6970854125,.6349819999999999,.719920125,.7480318749999999,.800711625,.1492445583333334,.2883909749999999,.1433963791666667,.4170092,.28182385833333334,.3866262,.28182385833333334,.3866262,.1433963791666667,.4170092,.27597567916666665,.4170092,.2701275,.446433525,.1433963791666667,.4170092,.2711788125,.475080675,.2711788125,.475080675,.13754820000000006,.5610828375,.2733915,.50383525,.2733915,.50383525,.13754820000000006,.5610828375,.27736215000000003,.53252975,.27736215000000003,.53252975,.13754820000000006,.5610828375,.282695775,.5610828375,.282695775,.5610828375,.13754820000000006,.5610828375,.28838671250000003,.58901565,.28838671250000003,.58901565,.17050706250000003,.6709578,.29503317500000004,.6170379625,.29503317500000004,.6170379625,.17050706250000003,.6709578,.3030863625,.64445225,.3030863625,.64445225,.17050706250000003,.6709578,.3134811625,.6709578,.3134811625,.6709578,.23173370000000004,.800711625,.327658,.6954898125,.7480318749999999,.800711625,.615452575,.7405493125,.615452575,.879498755,.7480318749999999,.800711625,.6349819999999999,.719920125,.615452575,.7405493125,.615452575,.7405493125,.5944185000000001,.7597992000000001,.615452575,.879498755,.1433963791666667,.4170092,.13754820000000006,.5610828375,.2711788125,.475080675,.327658,.6954898125,.23173370000000004,.800711625,.3447950375,.7185136249999999,.3447950375,.7185136249999999,.23173370000000004,.800711625,.364313,.738966,.364313,.738966,.364313,.8781166675000001,.38528327500000004,.7581624625000001,.13754820000000006,.5610828375,.17050706250000003,.6709578,.28838671250000003,.58901565,.38528327500000004,.7581624625000001,.364313,.8781166675000001,.4080183375,.7756525375,.4080183375,.7756525375,.364313,.8781166675000001,.43323218750000003,.78937325,.8383426749999999,.41762,.8320475499999999,.2883909749999999,.6994682499999999,.3861959125,.67428775,.33039097499999986,.7120584999999999,.13003558749999994,.6287182250000001,.3093909749999999,.6287182250000001,.3093909749999999,.7120584999999999,.13003558749999994,.59301290625,.3023909749999999,.5578605625,.2953909749999999,.59301290625,.04623064999999982,.488189826866528,.2883909749999999,.615452575,.879498755,.5944185000000001,.7597992000000001,.57167145,.777034625,.615452575,.879498755,.57167145,.777034625,.54608605,.79034725,.615452575,.879498755,.54608605,.79034725,.5180748375,.798073,.2701275,.1304658749999999,.1492445583333334,.2883909749999999,.305216575,.33039097499999986,.305216575,.33039097499999986,.1492445583333334,.2883909749999999,.28182385833333334,.3866262,.2701275,.1304658749999999,.35056009374999997,.3093909749999999,.38542595,.3023909749999999,.2701275,.1304658749999999,.38542595,.3023909749999999,.4196925125,.2953909749999999,.4895560875,.9031757550000001,.5180748375,.798073,.488189826866528,.800711625,.4895560875,.9031757550000001,.615452575,.879498755,.5180748375,.798073,.4895560875,.9031757550000001,.488189826866528,.800711625,.46111278749999995,.797688125,.364313,.8781166675000001,.46111278749999995,.797688125,.43323218750000003,.78937325,.17050706250000003,.6709578,.23173370000000004,.800711625,.3134811625,.6709578,.23173370000000004,.800711625,.364313,.8781166675000001,.364313,.738966,.8320475499999999,.2883909749999999,.7120584999999999,.13003558749999994,.67428775,.33039097499999986,.38542595,.04623064999999982,.2701275,.1304658749999999,.4196925125,.2953909749999999,.364313,.8781166675000001,.4895560875,.9031757550000001,.46111278749999995,.797688125,.38542595,.04623064999999982,.4196925125,.2953909749999999,.488189826866528,.2883909749999999,.7120584999999999,.13003558749999994,.59301290625,.04623064999999982,.5578605625,.2953909749999999,.59301290625,.04623064999999982,.488446575,.032230649999999805,.488189826866528,.2883909749999999,.488446575,.032230649999999805,.38542595,.04623064999999982,.488189826866528,.2883909749999999],P=[-.08,-.05,-.03,0,0,.01,.015,.01,.01,-.01,-.03,-.05,-.06],R=[18,14,19,14,13,19,14,2,13,14,3,2,20,21,13,13,21,19,1,20,13,11,10,19,19,10,18,2,1,13,21,11,19,12,11,21,3,4,2,14,4,3,15,4,14,10,9,18,17,15,14,17,14,18,8,17,18,1,12,20,20,12,21,9,8,18,1,0,12,12,0,11,23,15,17,22,5,15,15,5,4,7,23,17,23,22,15,8,7,17,23,16,22,7,16,23,22,16,5,7,6,16,16,6,5],O=[.4994956625,.614281425,.49966255,.60233525,.46424221250000003,.6089815000000001,.49966255,.60233525,.465096475,.5992760874999999,.46424221250000003,.6089815000000001,.49966255,.60233525,.4818877,.5826464124999999,.465096475,.5992760874999999,.49966255,.60233525,.49910775,.5864197875,.4818877,.5826464124999999,.4479978375,.5976933312499999,.44757070625,.6025460375,.465096475,.5992760874999999,.465096475,.5992760874999999,.44757070625,.6025460375,.46424221250000003,.6089815000000001,.451843375,.5873581250000001,.4479978375,.5976933312499999,.465096475,.5992760874999999,.44207625,.6199760875,.46743702499999995,.6409725000000001,.46424221250000003,.6089815000000001,.46424221250000003,.6089815000000001,.46743702499999995,.6409725000000001,.4994956625,.614281425,.4818877,.5826464124999999,.451843375,.5873581250000001,.465096475,.5992760874999999,.44757070625,.6025460375,.44207625,.6199760875,.46424221250000003,.6089815000000001,.4308992,.596110575,.44207625,.6199760875,.44757070625,.6025460375,.49910775,.5864197875,.5163774999999999,.5825469625,.4818877,.5826464124999999,.49966255,.60233525,.5163774999999999,.5825469625,.49910775,.5864197875,.5342254625,.5992902,.5163774999999999,.5825469625,.49966255,.60233525,.46743702499999995,.6409725000000001,.4997823375,.64841675,.4994956625,.614281425,.535219575,.609022,.5342254625,.5992902,.49966255,.60233525,.535219575,.609022,.49966255,.60233525,.4994956625,.614281425,.53258415,.64137075,.535219575,.609022,.4994956625,.614281425,.451843375,.5873581250000001,.4308992,.596110575,.4479978375,.5976933312499999,.4479978375,.5976933312499999,.4308992,.596110575,.44757070625,.6025460375,.4997823375,.64841675,.53258415,.64137075,.4994956625,.614281425,.451843375,.5873581250000001,.422608125,.5931778375,.4308992,.596110575,.4308992,.596110575,.422608125,.5931778375,.44207625,.6199760875,.5518993,.60231035625,.5342254625,.5992902,.535219575,.609022,.55140224375,.59744445625,.546885375,.5874255749999999,.5342254625,.5992902,.5342254625,.5992902,.546885375,.5874255749999999,.5163774999999999,.5825469625,.5581709625,.620002975,.5518993,.60231035625,.535219575,.609022,.5518993,.60231035625,.55140224375,.59744445625,.5342254625,.5992902,.53258415,.64137075,.5581709625,.620002975,.535219575,.609022,.5518993,.60231035625,.568579025,.5955987125,.55140224375,.59744445625,.5581709625,.620002975,.568579025,.5955987125,.5518993,.60231035625,.55140224375,.59744445625,.568579025,.5955987125,.546885375,.5874255749999999,.5581709625,.620002975,.576995375,.5925833125,.568579025,.5955987125,.568579025,.5955987125,.576995375,.5925833125,.546885375,.5874255749999999];var D=n(401),A=n(8586),I=function(t,e,n,r){var i,o=arguments.length,a=o<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,n,r);else for(var s=t.length-1;s>=0;s--)(i=t[s])&&(a=(o<3?i(a):o>3?i(e,n,a):i(e,n))||a);return o>3&&a&&Object.defineProperty(e,n,a),a},F=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function a(t){try{c(r.next(t))}catch(t){o(t)}}function s(t){try{c(r.throw(t))}catch(t){o(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(a,s)}c((r=r.apply(t,e||[])).next())}))},L=function(t,e){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=a.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=e.call(t,a)}catch(t){o=[6,t],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}},M=function(t){var e="function"==typeof Symbol&&Symbol.iterator,n=e&&t[e],r=0;if(n)return n.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&r>=t.length&&(t=void 0),{value:t&&t[r++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")};var N=function(){function t(){}return t.prototype.load=function(){return F(this,void 0,void 0,(function(){return L(this,(function(t){return[2,Promise.resolve()]}))}))},t.prototype.getDataConfig=function(t){return function(t){switch(t){case 0:return o;case 1:return a;case 2:return s;case 3:return c;case 4:return l;case 5:return u;case 6:return h;case 7:return d;case 8:return f;case 9:return r.LEFT_FACE_OVAL2;case 10:return r.LEFT_FACE_OVAL3;case 11:return p;case 12:return r.RIGHT_FACE_OVAL2;case 13:return r.RIGHT_FACE_OVAL3;case 14:return g;case 15:return m;case 16:return y;case 17:return v;case 18:return _;case 19:return b;case 20:return x;case 21:return w;case 22:return C;case 23:return T;case 24:return S;case 25:return k;case 26:return E;case 27:return P;case 28:return R;case 29:return O;case 30:return i;default:return""}}(t)},t.prototype.getConfigByKeys=function(t){var e,n,r={};try{for(var i=M(t),o=i.next();!o.done;o=i.next()){var a=o.value,s=D.c4[a];r[a]=this.getDataConfig(s)}}catch(t){e={error:t}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(e)throw e.error}}return r},t=I([A.e],t)}()},4809:(t,e,n)=>{var r=n(7872),i=Uint8Array,o=Uint16Array,a=Uint32Array,s=new i([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),c=new i([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),l=new i([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),u=function(t,e){for(var n=new o(31),r=0;r<31;++r)n[r]=e+=1<<t[r-1];var i=new a(n[30]);for(r=1;r<30;++r)for(var s=n[r];s<n[r+1];++s)i[s]=s-n[r]<<5|r;return[n,i]},h=u(s,2),d=h[0],f=h[1];d[28]=258,f[258]=28;for(var p=u(c,0),g=p[0],m=p[1],y=new o(32768),v=0;v<32768;++v){var _=(43690&v)>>>1|(21845&v)<<1;_=(61680&(_=(52428&_)>>>2|(13107&_)<<2))>>>4|(3855&_)<<4,y[v]=((65280&_)>>>8|(255&_)<<8)>>>1}var b=function(t,e,n){for(var r=t.length,i=0,a=new o(e);i<r;++i)++a[t[i]-1];var s,c=new o(e);for(i=0;i<e;++i)c[i]=c[i-1]+a[i-1]<<1;if(n){s=new o(1<<e);var l=15-e;for(i=0;i<r;++i)if(t[i])for(var u=i<<4|t[i],h=e-t[i],d=c[t[i]-1]++<<h,f=d|(1<<h)-1;d<=f;++d)s[y[d]>>>l]=u}else for(s=new o(r),i=0;i<r;++i)t[i]&&(s[i]=y[c[t[i]-1]++]>>>15-t[i]);return s},x=new i(288);for(v=0;v<144;++v)x[v]=8;for(v=144;v<256;++v)x[v]=9;for(v=256;v<280;++v)x[v]=7;for(v=280;v<288;++v)x[v]=8;var w=new i(32);for(v=0;v<32;++v)w[v]=5;var C=b(x,9,0),T=b(x,9,1),S=b(w,5,0),k=b(w,5,1),E=function(t){for(var e=t[0],n=1;n<t.length;++n)t[n]>e&&(e=t[n]);return e},P=function(t,e,n){var r=e/8|0;return(t[r]|t[r+1]<<8)>>(7&e)&n},R=function(t,e){var n=e/8|0;return(t[n]|t[n+1]<<8|t[n+2]<<16)>>(7&e)},O=function(t){return(t+7)/8|0},D=function(t,e,n){(null==e||e<0)&&(e=0),(null==n||n>t.length)&&(n=t.length);var r=new(t instanceof o?o:t instanceof a?a:i)(n-e);return r.set(t.subarray(e,n)),r};var A=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],I=function(t,e,n){var r=new Error(e||A[t]);if(r.code=t,Error.captureStackTrace&&Error.captureStackTrace(r,I),!n)throw r;return r},F=function(t,e,n){var r=t.length;if(!r||n&&n.f&&!n.l)return e||new i(0);var o=!e||n,a=!n||n.i;n||(n={}),e||(e=new i(3*r));var u=function(t){var n=e.length;if(t>n){var r=new i(Math.max(2*n,t));r.set(e),e=r}},h=n.f||0,f=n.p||0,p=n.b||0,m=n.l,y=n.d,v=n.m,_=n.n,x=8*r;do{if(!m){h=P(t,f,1);var w=P(t,f+1,3);if(f+=3,!w){var C=t[(W=O(f)+4)-4]|t[W-3]<<8,S=W+C;if(S>r){a&&I(0);break}o&&u(p+C),e.set(t.subarray(W,S),p),n.b=p+=C,n.p=f=8*S,n.f=h;continue}if(1==w)m=T,y=k,v=9,_=5;else if(2==w){var A=P(t,f,31)+257,F=P(t,f+10,15)+4,L=A+P(t,f+5,31)+1;f+=14;for(var M=new i(L),N=new i(19),j=0;j<F;++j)N[l[j]]=P(t,f+3*j,7);f+=3*F;var U=E(N),B=(1<<U)-1,z=b(N,U,1);for(j=0;j<L;){var W,V=z[P(t,f,B)];if(f+=15&V,(W=V>>>4)<16)M[j++]=W;else{var q=0,H=0;for(16==W?(H=3+P(t,f,3),f+=2,q=M[j-1]):17==W?(H=3+P(t,f,7),f+=3):18==W&&(H=11+P(t,f,127),f+=7);H--;)M[j++]=q}}var G=M.subarray(0,A),Y=M.subarray(A);v=E(G),_=E(Y),m=b(G,v,1),y=b(Y,_,1)}else I(1);if(f>x){a&&I(0);break}}o&&u(p+131072);for(var Z=(1<<v)-1,K=(1<<_)-1,X=f;;X=f){var $=(q=m[R(t,f)&Z])>>>4;if((f+=15&q)>x){a&&I(0);break}if(q||I(2),$<256)e[p++]=$;else{if(256==$){X=f,m=null;break}var J=$-254;if($>264){var Q=s[j=$-257];J=P(t,f,(1<<Q)-1)+d[j],f+=Q}var tt=y[R(t,f)&K],et=tt>>>4;tt||I(3),f+=15&tt;Y=g[et];if(et>3){Q=c[et];Y+=R(t,f)&(1<<Q)-1,f+=Q}if(f>x){a&&I(0);break}o&&u(p+131072);for(var nt=p+J;p<nt;p+=4)e[p]=e[p-Y],e[p+1]=e[p+1-Y],e[p+2]=e[p+2-Y],e[p+3]=e[p+3-Y];p=nt}}n.l=m,n.p=X,n.b=p,n.f=h,m&&(h=1,n.m=v,n.d=y,n.n=_)}while(!h);return p==e.length?e:D(e,0,p)},L=function(t,e,n){n<<=7&e;var r=e/8|0;t[r]|=n,t[r+1]|=n>>>8},M=function(t,e,n){n<<=7&e;var r=e/8|0;t[r]|=n,t[r+1]|=n>>>8,t[r+2]|=n>>>16},N=function(t,e){for(var n=[],r=0;r<t.length;++r)t[r]&&n.push({s:r,f:t[r]});var a=n.length,s=n.slice();if(!a)return[q,0];if(1==a){var c=new i(n[0].s+1);return c[n[0].s]=1,[c,1]}n.sort((function(t,e){return t.f-e.f})),n.push({s:-1,f:25001});var l=n[0],u=n[1],h=0,d=1,f=2;for(n[0]={s:-1,f:l.f+u.f,l,r:u};d!=a-1;)l=n[n[h].f<n[f].f?h++:f++],u=n[h!=d&&n[h].f<n[f].f?h++:f++],n[d++]={s:-1,f:l.f+u.f,l,r:u};var p=s[0].s;for(r=1;r<a;++r)s[r].s>p&&(p=s[r].s);var g=new o(p+1),m=j(n[d-1],g,0);if(m>e){r=0;var y=0,v=m-e,_=1<<v;for(s.sort((function(t,e){return g[e.s]-g[t.s]||t.f-e.f}));r<a;++r){var b=s[r].s;if(!(g[b]>e))break;y+=_-(1<<m-g[b]),g[b]=e}for(y>>>=v;y>0;){var x=s[r].s;g[x]<e?y-=1<<e-g[x]++-1:++r}for(;r>=0&&y;--r){var w=s[r].s;g[w]==e&&(--g[w],++y)}m=e}return[new i(g),m]},j=function(t,e,n){return-1==t.s?Math.max(j(t.l,e,n+1),j(t.r,e,n+1)):e[t.s]=n},U=function(t){for(var e=t.length;e&&!t[--e];);for(var n=new o(++e),r=0,i=t[0],a=1,s=function(t){n[r++]=t},c=1;c<=e;++c)if(t[c]==i&&c!=e)++a;else{if(!i&&a>2){for(;a>138;a-=138)s(32754);a>2&&(s(a>10?a-11<<5|28690:a-3<<5|12305),a=0)}else if(a>3){for(s(i),--a;a>6;a-=6)s(8304);a>2&&(s(a-3<<5|8208),a=0)}for(;a--;)s(i);a=1,i=t[c]}return[n.subarray(0,r),e]},B=function(t,e){for(var n=0,r=0;r<e.length;++r)n+=t[r]*e[r];return n},z=function(t,e,n){var r=n.length,i=O(e+2);t[i]=255&r,t[i+1]=r>>>8,t[i+2]=255^t[i],t[i+3]=255^t[i+1];for(var o=0;o<r;++o)t[i+o+4]=n[o];return 8*(i+4+r)},W=function(t,e,n,r,i,a,u,h,d,f,p){L(e,p++,n),++i[256];for(var g=N(i,15),m=g[0],y=g[1],v=N(a,15),_=v[0],T=v[1],k=U(m),E=k[0],P=k[1],R=U(_),O=R[0],D=R[1],A=new o(19),I=0;I<E.length;++I)A[31&E[I]]++;for(I=0;I<O.length;++I)A[31&O[I]]++;for(var F=N(A,7),j=F[0],W=F[1],V=19;V>4&&!j[l[V-1]];--V);var q,H,G,Y,Z=f+5<<3,K=B(i,x)+B(a,w)+u,X=B(i,m)+B(a,_)+u+14+3*V+B(A,j)+(2*A[16]+3*A[17]+7*A[18]);if(Z<=K&&Z<=X)return z(e,p,t.subarray(d,d+f));if(L(e,p,1+(X<K)),p+=2,X<K){q=b(m,y,0),H=m,G=b(_,T,0),Y=_;var $=b(j,W,0);L(e,p,P-257),L(e,p+5,D-1),L(e,p+10,V-4),p+=14;for(I=0;I<V;++I)L(e,p+3*I,j[l[I]]);p+=3*V;for(var J=[E,O],Q=0;Q<2;++Q){var tt=J[Q];for(I=0;I<tt.length;++I){var et=31&tt[I];L(e,p,$[et]),p+=j[et],et>15&&(L(e,p,tt[I]>>>5&127),p+=tt[I]>>>12)}}}else q=C,H=x,G=S,Y=w;for(I=0;I<h;++I)if(r[I]>255){et=r[I]>>>18&31;M(e,p,q[et+257]),p+=H[et+257],et>7&&(L(e,p,r[I]>>>23&31),p+=s[et]);var nt=31&r[I];M(e,p,G[nt]),p+=Y[nt],nt>3&&(M(e,p,r[I]>>>5&8191),p+=c[nt])}else M(e,p,q[r[I]]),p+=H[r[I]];return M(e,p,q[256]),p+H[256]},V=new a([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),q=new i(0),H=function(t,e,n,r,l,u){var h=t.length,d=new i(r+h+5*(1+Math.ceil(h/7e3))+l),p=d.subarray(r,d.length-l),g=0;if(!e||h<8)for(var y=0;y<=h;y+=65535){var v=y+65535;v<h?g=z(p,g,t.subarray(y,v)):(p[y]=u,g=z(p,g,t.subarray(y,h)))}else{for(var _=V[e-1],b=_>>>13,x=8191&_,w=(1<<n)-1,C=new o(32768),T=new o(w+1),S=Math.ceil(n/3),k=2*S,E=function(e){return(t[e]^t[e+1]<<S^t[e+2]<<k)&w},P=new a(25e3),R=new o(288),A=new o(32),I=0,F=0,L=(y=0,0),M=0,N=0;y<h;++y){var j=E(y),U=32767&y,B=T[j];if(C[U]=B,T[j]=U,M<=y){var H=h-y;if((I>7e3||L>24576)&&H>423){g=W(t,p,0,P,R,A,F,L,N,y-N,g),L=I=F=0,N=y;for(var G=0;G<286;++G)R[G]=0;for(G=0;G<30;++G)A[G]=0}var Y=2,Z=0,K=x,X=U-B&32767;if(H>2&&j==E(y-X))for(var $=Math.min(b,H)-1,J=Math.min(32767,y),Q=Math.min(258,H);X<=J&&--K&&U!=B;){if(t[y+Y]==t[y+Y-X]){for(var tt=0;tt<Q&&t[y+tt]==t[y+tt-X];++tt);if(tt>Y){if(Y=tt,Z=X,tt>$)break;var et=Math.min(X,tt-2),nt=0;for(G=0;G<et;++G){var rt=y-X+G+32768&32767,it=rt-C[rt]+32768&32767;it>nt&&(nt=it,B=rt)}}}X+=(U=B)-(B=C[U])+32768&32767}if(Z){P[L++]=268435456|f[Y]<<18|m[Z];var ot=31&f[Y],at=31&m[Z];F+=s[ot]+c[at],++R[257+ot],++A[at],M=y+Y,++I}else P[L++]=t[y],++R[t[y]]}}g=W(t,p,u,P,R,A,F,L,N,y-N,g),!u&&7&g&&(g=z(p,g+1,q))}return D(d,0,r+O(g)+l)},G=function(){for(var t=new Int32Array(256),e=0;e<256;++e){for(var n=e,r=9;--r;)n=(1&n&&-306674912)^n>>>1;t[e]=n}return t}(),Y=function(){var t=-1;return{p:function(e){for(var n=t,r=0;r<e.length;++r)n=G[255&n^e[r]]^n>>>8;t=n},d:function(){return~t}}},Z=function(){var t=1,e=0;return{p:function(n){for(var r=t,i=e,o=0|n.length,a=0;a!=o;){for(var s=Math.min(a+2655,o);a<s;++a)i+=r+=n[a];r=(65535&r)+15*(r>>16),i=(65535&i)+15*(i>>16)}t=r,e=i},d:function(){return(255&(t%=65521))<<24|t>>>8<<16|(255&(e%=65521))<<8|e>>>8}}},K=function(t,e,n,r,i){return H(t,null==e.level?6:e.level,null==e.mem?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(t.length)))):12+e.mem,n,r,!i)},X=function(t,e){var n={};for(var r in t)n[r]=t[r];for(var r in e)n[r]=e[r];return n},$=function(t,e,n){for(var r=t(),i=t.toString(),o=i.slice(i.indexOf("[")+1,i.lastIndexOf("]")).replace(/ /g,"").split(","),a=0;a<r.length;++a){var s=r[a],c=o[a];if("function"==typeof s){e+=";"+c+"=";var l=s.toString();if(s.prototype)if(-1!=l.indexOf("[native code]")){var u=l.indexOf(" ",8)+1;e+=l.slice(u,l.indexOf("(",u))}else for(var h in e+=l,s.prototype)e+=";"+c+".prototype."+h+"="+s.prototype[h].toString();else e+=l}else n[c]=s}return[e,n]},J=[],Q=function(t,e,n,s){var c;if(!J[n]){for(var l="",u={},h=t.length-1,d=0;d<h;++d)l=(c=$(t[d],l,u))[0],u=c[1];J[n]=$(t[h],l,u)}var f=X({},J[n][1]);return r.default(J[n][0]+";onmessage=function(e){for(var k in e.data)self[k]=e.data[k];onmessage="+e.toString()+"}",n,f,function(t){var e=[];for(var n in t)(t[n]instanceof i||t[n]instanceof o||t[n]instanceof a)&&e.push((t[n]=new t[n].constructor(t[n])).buffer);return e}(f),s)},tt=function(){return[i,o,a,s,c,l,d,g,T,k,y,A,b,E,P,R,O,D,I,F,Rt,at,st]},et=function(){return[i,o,a,s,c,l,f,m,C,x,S,w,y,V,q,b,L,M,N,j,U,B,z,W,O,D,H,K,St,at]},nt=function(){return[gt,vt,pt,Y,G]},rt=function(){return[mt,yt]},it=function(){return[_t,pt,Z]},ot=function(){return[bt]},at=function(t){return postMessage(t,[t.buffer])},st=function(t){return t&&t.size&&new i(t.size)},ct=function(t,e,n,r,i,o){var a=Q(n,r,i,(function(t,e){a.terminate(),o(t,e)}));return a.postMessage([t,e],e.consume?[t.buffer]:[]),function(){a.terminate()}},lt=function(t){return t.ondata=function(t,e){return postMessage([t,e],[t.buffer])},function(e){return t.push(e.data[0],e.data[1])}},ut=function(t,e,n,r,i){var o,a=Q(t,r,i,(function(t,n){t?(a.terminate(),e.ondata.call(e,t)):(n[1]&&a.terminate(),e.ondata.call(e,t,n[0],n[1]))}));a.postMessage(n),e.push=function(t,n){e.ondata||I(5),o&&e.ondata(I(4,0,1),null,!!n),a.postMessage([t,o=n],[t.buffer])},e.terminate=function(){a.terminate()}},ht=function(t,e){return t[e]|t[e+1]<<8},dt=function(t,e){return(t[e]|t[e+1]<<8|t[e+2]<<16|t[e+3]<<24)>>>0},ft=function(t,e){return dt(t,e)+4294967296*dt(t,e+4)},pt=function(t,e,n){for(;n;++e)t[e]=n,n>>>=8},gt=function(t,e){var n=e.filename;if(t[0]=31,t[1]=139,t[2]=8,t[8]=e.level<2?4:9==e.level?2:0,t[9]=3,0!=e.mtime&&pt(t,4,Math.floor(new Date(e.mtime||Date.now())/1e3)),n){t[3]=8;for(var r=0;r<=n.length;++r)t[r+10]=n.charCodeAt(r)}},mt=function(t){31==t[0]&&139==t[1]&&8==t[2]||I(6,"invalid gzip data");var e=t[3],n=10;4&e&&(n+=t[10]|2+(t[11]<<8));for(var r=(e>>3&1)+(e>>4&1);r>0;r-=!t[n++]);return n+(2&e)},yt=function(t){var e=t.length;return(t[e-4]|t[e-3]<<8|t[e-2]<<16|t[e-1]<<24)>>>0},vt=function(t){return 10+(t.filename&&t.filename.length+1||0)},_t=function(t,e){var n=e.level,r=0==n?0:n<6?1:9==n?3:2;t[0]=120,t[1]=r<<6|(r?32-2*r:1)},bt=function(t){(8!=(15&t[0])||t[0]>>>4>7||(t[0]<<8|t[1])%31)&&I(6,"invalid zlib data"),32&t[1]&&I(6,"invalid zlib data: preset dictionaries not supported")};function xt(t,e){return e||"function"!=typeof t||(e=t,t={}),this.ondata=e,t}var wt=function(){function t(t,e){e||"function"!=typeof t||(e=t,t={}),this.ondata=e,this.o=t||{}}return t.prototype.p=function(t,e){this.ondata(K(t,this.o,0,0,!e),e)},t.prototype.push=function(t,e){this.ondata||I(5),this.d&&I(4),this.d=e,this.p(t,e||!1)},t}();var Ct=function(){return function(t,e){ut([et,function(){return[lt,wt]}],this,xt.call(this,t,e),(function(t){var e=new wt(t.data);onmessage=lt(e)}),6)}}();function Tt(t,e,n){return n||(n=e,e={}),"function"!=typeof n&&I(7),ct(t,e,[et],(function(t){return at(St(t.data[0],t.data[1]))}),0,n)}function St(t,e){return K(t,e||{},0,0)}var kt=function(){function t(t){this.s={},this.p=new i(0),this.ondata=t}return t.prototype.e=function(t){this.ondata||I(5),this.d&&I(4);var e=this.p.length,n=new i(e+t.length);n.set(this.p),n.set(t,e),this.p=n},t.prototype.c=function(t){this.d=this.s.i=t||!1;var e=this.s.b,n=F(this.p,this.o,this.s);this.ondata(D(n,e,this.s.b),this.d),this.o=D(n,this.s.b-32768),this.s.b=this.o.length,this.p=D(this.p,this.s.p/8|0),this.s.p&=7},t.prototype.push=function(t,e){this.e(t),this.c(e)},t}();var Et=function(){return function(t){this.ondata=t,ut([tt,function(){return[lt,kt]}],this,0,(function(){var t=new kt;onmessage=lt(t)}),7)}}();function Pt(t,e,n){return n||(n=e,e={}),"function"!=typeof n&&I(7),ct(t,e,[tt],(function(t){return at(Rt(t.data[0],st(t.data[1])))}),1,n)}function Rt(t,e){return F(t,e)}var Ot=function(){function t(t,e){this.c=Y(),this.l=0,this.v=1,wt.call(this,t,e)}return t.prototype.push=function(t,e){wt.prototype.push.call(this,t,e)},t.prototype.p=function(t,e){this.c.p(t),this.l+=t.length;var n=K(t,this.o,this.v&&vt(this.o),e&&8,!e);this.v&&(gt(n,this.o),this.v=0),e&&(pt(n,n.length-8,this.c.d()),pt(n,n.length-4,this.l)),this.ondata(n,e)},t}();var Dt=function(){return function(t,e){ut([et,nt,function(){return[lt,wt,Ot]}],this,xt.call(this,t,e),(function(t){var e=new Ot(t.data);onmessage=lt(e)}),8)}}();function At(t,e,n){return n||(n=e,e={}),"function"!=typeof n&&I(7),ct(t,e,[et,nt,function(){return[It]}],(function(t){return at(It(t.data[0],t.data[1]))}),2,n)}function It(t,e){e||(e={});var n=Y(),r=t.length;n.p(t);var i=K(t,e,vt(e),8),o=i.length;return gt(i,e),pt(i,o-8,n.d()),pt(i,o-4,r),i}var Ft=function(){function t(t){this.v=1,kt.call(this,t)}return t.prototype.push=function(t,e){if(kt.prototype.e.call(this,t),this.v){var n=this.p.length>3?mt(this.p):4;if(n>=this.p.length&&!e)return;this.p=this.p.subarray(n),this.v=0}e&&(this.p.length<8&&I(6,"invalid gzip data"),this.p=this.p.subarray(0,-8)),kt.prototype.c.call(this,e)},t}();var Lt=function(){return function(t){this.ondata=t,ut([tt,rt,function(){return[lt,kt,Ft]}],this,0,(function(){var t=new Ft;onmessage=lt(t)}),9)}}();function Mt(t,e,n){return n||(n=e,e={}),"function"!=typeof n&&I(7),ct(t,e,[tt,rt,function(){return[Nt]}],(function(t){return at(Nt(t.data[0]))}),3,n)}function Nt(t,e){return F(t.subarray(mt(t),-8),e||new i(yt(t)))}var jt=function(){function t(t,e){this.c=Z(),this.v=1,wt.call(this,t,e)}return t.prototype.push=function(t,e){wt.prototype.push.call(this,t,e)},t.prototype.p=function(t,e){this.c.p(t);var n=K(t,this.o,this.v&&2,e&&4,!e);this.v&&(_t(n,this.o),this.v=0),e&&pt(n,n.length-4,this.c.d()),this.ondata(n,e)},t}();function Ut(t,e){e||(e={});var n=Z();n.p(t);var r=K(t,e,2,4);return _t(r,e),pt(r,r.length-4,n.d()),r}var Bt=function(){function t(t){this.v=1,kt.call(this,t)}return t.prototype.push=function(t,e){if(kt.prototype.e.call(this,t),this.v){if(this.p.length<2&&!e)return;this.p=this.p.subarray(2),this.v=0}e&&(this.p.length<4&&I(6,"invalid zlib data"),this.p=this.p.subarray(0,-4)),kt.prototype.c.call(this,e)},t}();var zt=function(){return function(t){this.ondata=t,ut([tt,ot,function(){return[lt,kt,Bt]}],this,0,(function(){var t=new Bt;onmessage=lt(t)}),11)}}();function Wt(t,e,n){return n||(n=e,e={}),"function"!=typeof n&&I(7),ct(t,e,[tt,ot,function(){return[Vt]}],(function(t){return at(Vt(t.data[0],st(t.data[1])))}),5,n)}function Vt(t,e){return F((bt(t),t.subarray(2,-4)),e)}var qt=function(){function t(t){this.G=Ft,this.I=kt,this.Z=Bt,this.ondata=t}return t.prototype.push=function(t,e){if(this.ondata||I(5),this.s)this.s.push(t,e);else{if(this.p&&this.p.length){var n=new i(this.p.length+t.length);n.set(this.p),n.set(t,this.p.length)}else this.p=t;if(this.p.length>2){var r=this,o=function(){r.ondata.apply(r,arguments)};this.s=31==this.p[0]&&139==this.p[1]&&8==this.p[2]?new this.G(o):8!=(15&this.p[0])||this.p[0]>>4>7||(this.p[0]<<8|this.p[1])%31?new this.I(o):new this.Z(o),this.s.push(this.p,e),this.p=null}}},t}();var Ht=function(t,e,n,r){for(var o in t){var a=t[o],s=e+o;a instanceof i?n[s]=[a,r]:Array.isArray(a)?n[s]=[a[0],X(r,a[1])]:Ht(a,s+"/",n,r)}},Gt="undefined"!=typeof TextEncoder&&new TextEncoder,Yt="undefined"!=typeof TextDecoder&&new TextDecoder,Zt=0;try{Yt.decode(q,{stream:!0}),Zt=1}catch(t){}var Kt=function(t){for(var e="",n=0;;){var r=t[n++],i=(r>127)+(r>223)+(r>239);if(n+i>t.length)return[e,D(t,n-1)];i?3==i?(r=((15&r)<<18|(63&t[n++])<<12|(63&t[n++])<<6|63&t[n++])-65536,e+=String.fromCharCode(55296|r>>10,56320|1023&r)):e+=1&i?String.fromCharCode((31&r)<<6|63&t[n++]):String.fromCharCode((15&r)<<12|(63&t[n++])<<6|63&t[n++]):e+=String.fromCharCode(r)}},Xt=function(){function t(t){this.ondata=t,Zt?this.t=new TextDecoder:this.p=q}return t.prototype.push=function(t,e){if(this.ondata||I(5),e=!!e,this.t)return this.ondata(this.t.decode(t,{stream:!0}),e),void(e&&(this.t.decode().length&&I(8),this.t=null));this.p||I(4);var n=new i(this.p.length+t.length);n.set(this.p),n.set(t,this.p.length);var r=Kt(n),o=r[0],a=r[1];e?(a.length&&I(8),this.p=null):this.p=a,this.ondata(o,e)},t}();function $t(t,e){if(e){for(var n=new i(t.length),r=0;r<t.length;++r)n[r]=t.charCodeAt(r);return n}if(Gt)return Gt.encode(t);var o=t.length,a=new i(t.length+(t.length>>1)),s=0,c=function(t){a[s++]=t};for(r=0;r<o;++r){if(s+5>a.length){var l=new i(s+8+(o-r<<1));l.set(a),a=l}var u=t.charCodeAt(r);u<128||e?c(u):u<2048?(c(192|u>>6),c(128|63&u)):u>55295&&u<57344?(c(240|(u=65536+(1047552&u)|1023&t.charCodeAt(++r))>>18),c(128|u>>12&63),c(128|u>>6&63),c(128|63&u)):(c(224|u>>12),c(128|u>>6&63),c(128|63&u))}return D(a,0,s)}function Jt(t,e){if(e){for(var n="",r=0;r<t.length;r+=16384)n+=String.fromCharCode.apply(null,t.subarray(r,r+16384));return n}if(Yt)return Yt.decode(t);var i=Kt(t),o=i[0];return i[1].length&&I(8),o}e.T8=Jt;var Qt=function(t){return 1==t?3:t<6?2:9==t?1:0},te=function(t,e){return e+30+ht(t,e+26)+ht(t,e+28)},ee=function(t,e,n){var r=ht(t,e+28),i=Jt(t.subarray(e+46,e+46+r),!(2048&ht(t,e+8))),o=e+46+r,a=dt(t,e+20),s=n&&4294967295==a?ne(t,o):[a,dt(t,e+24),dt(t,e+42)],c=s[0],l=s[1],u=s[2];return[ht(t,e+10),c,l,i,o+ht(t,e+30)+ht(t,e+32),u]},ne=function(t,e){for(;1!=ht(t,e);e+=4+ht(t,e+2));return[ft(t,e+12),ft(t,e+4),ft(t,e+20)]},re=function(t){var e=0;if(t)for(var n in t){var r=t[n].length;r>65535&&I(9),e+=r+4}return e},ie=function(t,e,n,r,i,o,a,s){var c=r.length,l=n.extra,u=s&&s.length,h=re(l);pt(t,e,null!=a?33639248:67324752),e+=4,null!=a&&(t[e++]=20,t[e++]=n.os),t[e]=20,e+=2,t[e++]=n.flag<<1|(null==o&&8),t[e++]=i&&8,t[e++]=255&n.cpr,t[e++]=n.cpr>>8;var d=new Date(null==n.mtime?Date.now():n.mtime),f=d.getFullYear()-1980;if((f<0||f>119)&&I(10),pt(t,e,f<<25|d.getMonth()+1<<21|d.getDate()<<16|d.getHours()<<11|d.getMinutes()<<5|d.getSeconds()>>>1),e+=4,null!=o&&(pt(t,e,n.crc),pt(t,e+4,o),pt(t,e+8,n.size)),pt(t,e+12,c),pt(t,e+14,h),e+=16,null!=a&&(pt(t,e,u),pt(t,e+6,n.attrs),pt(t,e+10,a),e+=14),t.set(r,e),e+=c,h)for(var p in l){var g=l[p],m=g.length;pt(t,e,+p),pt(t,e+2,m),t.set(g,e+4),e+=4+m}return u&&(t.set(s,e),e+=u),e},oe=function(t,e,n,r,i){pt(t,e,101010256),pt(t,e+8,n),pt(t,e+10,n),pt(t,e+12,r),pt(t,e+16,i)},ae=function(){function t(t){this.filename=t,this.c=Y(),this.size=0,this.cpr=0}return t.prototype.process=function(t,e){this.ondata(null,t,e)},t.prototype.push=function(t,e){this.ondata||I(5),this.c.p(t),this.size+=t.length,e&&(this.crc=this.c.d()),this.process(t,e||!1)},t}();var se=function(){function t(t,e){var n=this;e||(e={}),ae.call(this,t),this.d=new Ct(e,(function(t,e,r){n.ondata(t,e,r)})),this.cpr=8,this.flag=Qt(e.level),this.terminate=this.d.terminate}return t.prototype.process=function(t,e){this.d.push(t,e)},t.prototype.push=function(t,e){ae.prototype.push.call(this,t,e)},t}();var ce=function(){function t(t){this.ondata=t,this.u=[],this.d=1}return t.prototype.add=function(t){var e=this;if(this.ondata||I(5),2&this.d)this.ondata(I(4+8*(1&this.d),0,1),null,!1);else{var n=$t(t.filename),r=n.length,o=t.comment,a=o&&$t(o),s=r!=t.filename.length||a&&o.length!=a.length,c=r+re(t.extra)+30;r>65535&&this.ondata(I(11,0,1),null,!1);var l=new i(c);ie(l,0,t,n,s);var u=[l],h=function(){for(var t=0,n=u;t<n.length;t++){var r=n[t];e.ondata(null,r,!1)}u=[]},d=this.d;this.d=0;var f=this.u.length,p=X(t,{f:n,u:s,o:a,t:function(){t.terminate&&t.terminate()},r:function(){if(h(),d){var t=e.u[f+1];t?t.r():e.d=1}d=1}}),g=0;t.ondata=function(n,r,o){if(n)e.ondata(n,r,o),e.terminate();else if(g+=r.length,u.push(r),o){var a=new i(16);pt(a,0,134695760),pt(a,4,t.crc),pt(a,8,g),pt(a,12,t.size),u.push(a),p.c=g,p.b=c+g+16,p.crc=t.crc,p.size=t.size,d&&p.r(),d=1}else d&&h()},this.u.push(p)}},t.prototype.end=function(){var t=this;2&this.d?this.ondata(I(4+8*(1&this.d),0,1),null,!0):(this.d?this.e():this.u.push({r:function(){1&t.d&&(t.u.splice(-1,1),t.e())},t:function(){}}),this.d=3)},t.prototype.e=function(){for(var t=0,e=0,n=0,r=0,o=this.u;r<o.length;r++){n+=46+(l=o[r]).f.length+re(l.extra)+(l.o?l.o.length:0)}for(var a=new i(n+22),s=0,c=this.u;s<c.length;s++){var l=c[s];ie(a,t,l,l.f,l.u,l.c,e,l.o),t+=46+l.f.length+re(l.extra)+(l.o?l.o.length:0),e+=l.b}oe(a,t,this.u.length,n,e),this.ondata(null,a,!0),this.d=2},t.prototype.terminate=function(){for(var t=0,e=this.u;t<e.length;t++){e[t].t()}this.d=2},t}();e.Xo=function(t,e){e||(e={});var n={},r=[];Ht(t,"",n,e);var o=0,a=0;for(var s in n){var c=n[s],l=c[0],u=c[1],h=0==u.level?0:8,d=(T=$t(s)).length,f=u.comment,p=f&&$t(f),g=p&&p.length,m=re(u.extra);d>65535&&I(11);var y=h?St(l,u):l,v=y.length,_=Y();_.p(l),r.push(X(u,{size:l.length,crc:_.d(),c:y,f:T,m:p,u:d!=s.length||p&&f.length!=g,o,cpr:h})),o+=30+d+m+v,a+=76+2*(d+m)+(g||0)+v}for(var b=new i(a+22),x=o,w=a-o,C=0;C<r.length;++C){var T=r[C];ie(b,T.o,T,T.f,T.u,T.c.length);var S=30+T.f.length+re(T.extra);b.set(T.c,T.o+S),ie(b,o,T,T.f,T.u,T.c.length,T.o,T.m),o+=16+S+(T.m?T.m.length:0)}return oe(b,o,r.length,w,x),b};var le=function(){function t(){}return t.prototype.push=function(t,e){this.ondata(null,t,e)},t.cpr=0,t}();var ue=function(){function t(t,e){var n=this;e<32e4?this.i=new kt((function(t,e){n.ondata(null,t,e)})):(this.i=new Et((function(t,e,r){n.ondata(t,e,r)})),this.terminate=this.i.terminate)}return t.prototype.push=function(t,e){this.i.terminate&&(t=D(t,0)),this.i.push(t,e)},t.cpr=8,t}();var he=function(){function t(t){this.onfile=t,this.k=[],this.o={0:le},this.p=q}return t.prototype.push=function(t,e){var n=this;if(this.onfile||I(5),this.p||I(4),this.c>0){var r=Math.min(this.c,t.length),o=t.subarray(0,r);if(this.c-=r,this.d?this.d.push(o,!this.c):this.k[0].push(o),(t=t.subarray(r)).length)return this.push(t,e)}else{var a=0,s=0,c=void 0,l=void 0;this.p.length?t.length?((l=new i(this.p.length+t.length)).set(this.p),l.set(t,this.p.length)):l=this.p:l=t;for(var u=l.length,h=this.c,d=h&&this.d,f=function(){var t,e=dt(l,s);if(67324752==e){a=1,c=s,p.d=null,p.c=0;var r=ht(l,s+6),i=ht(l,s+8),o=2048&r,d=8&r,f=ht(l,s+26),g=ht(l,s+28);if(u>s+30+f+g){var m=[];p.k.unshift(m),a=2;var y,v=dt(l,s+18),_=dt(l,s+22),b=Jt(l.subarray(s+30,s+=30+f),!o);4294967295==v?(t=d?[-2]:ne(l,s),v=t[0],_=t[1]):d&&(v=-1),s+=g,p.c=v;var x={name:b,cpr:i,start:function(){if(x.ondata||I(5),v){var t=n.o[i];t||x.ondata(I(14,"unknown cpr type "+i,1),null,!1),(y=v<0?new t(b):new t(b,v,_)).ondata=function(t,e,n){x.ondata(t,e,n)};for(var e=0,r=m;e<r.length;e++){var o=r[e];y.push(o,!1)}n.k[0]==m&&n.c?n.d=y:y.push(q,!0)}else x.ondata(null,q,!0)},terminate:function(){y&&y.terminate&&y.terminate()}};v>=0&&(x.size=v,x.ors=_),p.onfile(x)}return"break"}if(h){if(134695760==e)return c=s+=12+(-2==h&&8),a=3,p.c=0,"break";if(33639248==e)return c=s-=4,a=3,p.c=0,"break"}},p=this;s<u-4;++s){if("break"===f())break}if(this.p=q,h<0){var g=a?l.subarray(0,c-12-(-2==h&&8)-(134695760==dt(l,c-16)&&4)):l.subarray(0,s);d?d.push(g,!!a):this.k[+(2==a)].push(g)}if(2&a)return this.push(l.subarray(s),e);this.p=l.subarray(s)}e&&(this.c&&I(13),this.p=null)},t.prototype.register=function(t){this.o[t.cpr]=t},t}();var de="function"==typeof queueMicrotask?queueMicrotask:"function"==typeof setTimeout?setTimeout:function(t){t()};e.GZ=function(t,e){for(var n={},r=t.length-22;101010256!=dt(t,r);--r)(!r||t.length-r>65558)&&I(13);var o=ht(t,r+8);if(!o)return{};var a=dt(t,r+16),s=4294967295==a;s&&(r=dt(t,r-12),101075792!=dt(t,r)&&I(13),o=dt(t,r+32),a=dt(t,r+48));for(var c=e&&e.filter,l=0;l<o;++l){var u=ee(t,a,s),h=u[0],d=u[1],f=u[2],p=u[3],g=u[4],m=u[5],y=te(t,m);a=g,c&&!c({name:p,size:d,ors:f,cpr:h})||(h?8==h?n[p]=Rt(t.subarray(y,y+d),new i(f)):I(14,"unknown cpr type "+h):n[p]=D(t,y,y+d))}return n}},7872:(t,e)=>{var n={};e.default=function(t,e,r,i,o){var a=new Worker(n[e]||(n[e]=URL.createObjectURL(new Blob([t+';addEventListener("error",function(e){e=e.error;postMessage({$e$:[e.message,e.code,e.stack]})})'],{type:"text/javascript"}))));return a.onmessage=function(t){var e=t.data,n=e.$e$;if(n){var r=new Error(n[0]);r.code=n[1],r.stack=n[2],o(r,null)}else o(null,e)},a.postMessage(r,i),a}}},n={};function r(t){var i=n[t];if(void 0!==i)return i.exports;var o=n[t]={id:t,loaded:!1,exports:{}};return e[t].call(o.exports,o,o.exports,r),o.loaded=!0,o.exports}r.m=e,t=[],r.O=(e,n,i,o)=>{if(!n){var a=1/0;for(u=0;u<t.length;u++){for(var[n,i,o]=t[u],s=!0,c=0;c<n.length;c++)(!1&o||a>=o)&&Object.keys(r.O).every((t=>r.O[t](n[c])))?n.splice(c--,1):(s=!1,o<a&&(a=o));if(s){t.splice(u--,1);var l=i();void 0!==l&&(e=l)}}return e}o=o||0;for(var u=t.length;u>0&&t[u-1][2]>o;u--)t[u]=t[u-1];t[u]=[n,i,o]},r.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return r.d(e,{a:e}),e},r.d=(t,e)=>{for(var n in e)r.o(e,n)&&!r.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},r.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),r.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.nmd=t=>(t.paths=[],t.children||(t.children=[]),t),(()=>{var t={826:0};r.O.j=e=>0===t[e];var e=(e,n)=>{var i,o,[a,s,c]=n,l=0;if(a.some((e=>0!==t[e]))){for(i in s)r.o(s,i)&&(r.m[i]=s[i]);if(c)var u=c(r)}for(e&&e(n);l<a.length;l++)o=a[l],r.o(t,o)&&t[o]&&t[o][0](),t[o]=0;return r.O(u)},n=self.webpackChunktencentcloud_webar=self.webpackChunktencentcloud_webar||[];n.forEach(e.bind(null,0)),n.push=e.bind(null,n.push.bind(n))})();var i=r.O(void 0,[647,321],(()=>r(4504))),o=(i=r.O(i)).ry,a=i.Cz,s=i.T$,c=i.Mj,l=i.UZ,u=i.bk,h=i.Iq,d=i.aR,f=i._$;export{o as ArSdk,a as BEAUTIFY_OPTIONS,s as BLEND_MODES,c as ENTRY_TYPES,l as EntryType,u as OUTPUT_TYPES,h as authorize,d as authorizeWxCamera,f as setRootPath};
|