add index.esm.html

This commit is contained in:
Harvey Zack committed 2025-04-20 19:35:10 +08:00
1 parent a64e13c9c1
commit 2a7e3d5e03
194 files changed
+11632 -371

No files matched your search

@@ -2,7 +2,7 @@
/*!
* artplayer-plugin-danmuku-mask.js v1.0.0
* Github: https://github.com/zhw2590582/ArtPlayer
* (c) 2017-2024 Harvey Zack
* (c) 2017-2025 Harvey Zack
* Released under the MIT License.
*/
!function(e,t,r,n,s){var a="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},o="function"==typeof a[n]&&a[n],l=o.cache||{},i="undefined"!=typeof module&&"function"==typeof module.require&&module.require.bind(module);function u(t,r){if(!l[t]){if(!e[t]){var s="function"==typeof a[n]&&a[n];if(!r&&s)return s(t,!0);if(o)return o(t,!0);if(i&&"string"==typeof t)return i(t);var p=Error("Cannot find module '"+t+"'");throw p.code="MODULE_NOT_FOUND",p}d.resolve=function(r){var n=e[t][1][r];return null!=n?n:r},d.cache={};var c=l[t]=new u.Module(t);e[t][0].call(c.exports,d,c,c.exports,this)}return l[t].exports;function d(e){var t=d.resolve(e);return!1===t?{}:u(t)}}u.isParcelRequire=!0,u.Module=function(e){this.id=e,this.bundle=u,this.exports={}},u.modules=e,u.cache=l,u.parent=o,u.register=function(t,r){e[t]=[function(e,t){t.exports=r},{}]},Object.defineProperty(u,"root",{get:function(){return a[n]}}),a[n]=u;for(var p=0;p<t.length;p++)u(t[p]);if(r){var c=u(r);"object"==typeof exports&&"undefined"!=typeof module?module.exports=c:"function"==typeof define&&define.amd&&define(function(){return c})}}({"3nz8g":[function(e,t,r){var n=e("@parcel/transformer-js/src/esmodule-helpers.js");n.defineInteropFlag(r),n.export(r,"default",()=>o);var s=e("@tensorflow/tfjs-core");e("@tensorflow/tfjs-backend-webgl"),e("@tensorflow/tfjs-backend-cpu");var a=e("@tensorflow-models/body-segmentation");function o(e={}){return t=>{let{template:{$player:r,$video:n,$danmuku:o}}=t,l=null,i=null,u=null,p=null,c=!1,d={solutionPath:e.solutionPath||"https://cdn.jsdelivr.net/npm/@mediapipe/selfie_segmentation",modelSelection:e.modelSelection||1,smoothSegmentation:void 0===e.smoothSegmentation||e.smoothSegmentation,minDetectionConfidence:e.minDetectionConfidence||.5,minTrackingConfidence:e.minTrackingConfidence||.5,selfieMode:e.selfieMode||!1,drawContour:e.drawContour||!1,foregroundThreshold:e.foregroundThreshold||.5,opacity:e.opacity||1,maskBlurAmount:e.maskBlurAmount||3};async function f(){try{await s.setBackend("webgl"),console.log("Using WebGL backend")}catch(e){console.warn("WebGL backend not available, falling back to CPU"),await s.setBackend("cpu")}}async function h(){await f();let e=a.SupportedModels.MediaPipeSelfieSegmentation,t={runtime:"mediapipe",modelType:"general",solutionPath:d.solutionPath,modelSelection:d.modelSelection,smoothSegmentation:d.smoothSegmentation,minDetectionConfidence:d.minDetectionConfidence,minTrackingConfidence:d.minTrackingConfidence,selfieMode:d.selfieMode};try{l=await a.createSegmenter(e,t),c=!0,console.log("Segmenter initialized successfully")}catch(e){console.error("Error initializing segmenter:",e),c=!1}}async function m(){if(!c||n.paused||n.ended){p=requestAnimationFrame(m);return}try{i.width=n.videoWidth,i.height=n.videoHeight;let e=await l.segmentPeople(n);if(!e||0===e.length){p=requestAnimationFrame(m);return}let t=await a.toBinaryMask(e,{r:255,g:255,b:255,a:255},{r:0,g:0,b:0,a:255},d.drawContour,d.foregroundThreshold);await a.drawMask(i,n,t,d.opacity,d.maskBlurAmount);let r=u.getImageData(0,0,i.width,i.height);u.putImageData(function(e){let t=e.data;for(let e=0;e<t.length;e+=4)t[e]>250&&t[e+1]>250&&t[e+2]>250&&(t[e+3]=0);return e}(r),0,0),o.style.maskImage=`url(${i.toDataURL()})`}catch(e){console.error("Error in segmentBody:",e)}p=requestAnimationFrame(m)}async function g(){c||await h(),i||(u=(i=document.createElement("canvas")).getContext("2d"),Object.assign(i.style,{position:"absolute",top:"0",left:"0",width:"100%",height:"100%",pointerEvents:"none",opacity:"0"}),r.appendChild(i)),Object.assign(o.style,{maskMode:"alpha",maskSize:"contain",maskRepeat:"no-repeat",backgroundSize:"contain",backgroundRepeat:"no-repeat"}),m()}function x(){o.style.maskImage="none",p&&(cancelAnimationFrame(p),p=null)}return t.on("ready",g),t.on("destroy",x),{name:"artplayerPluginDanmukuMask",start:g,stop:x}}}"undefined"!=typeof window&&(window.artplayerPluginDanmukuMask=o)},{"@tensorflow/tfjs-core":"2nuhV","@tensorflow/tfjs-backend-webgl":"2cOos","@tensorflow/tfjs-backend-cpu":"61SaF","@tensorflow-models/body-segmentation":"79Ppz","@parcel/transformer-js/src/esmodule-helpers.js":"9pCYc"}],"2nuhV":[function(e,t,r){/** * @license * Copyright 2017 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= */var n=e("@parcel/transformer-js/src/esmodule-helpers.js"Line truncated
!function(e,t,r,n,s,a,o,l){var i="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},p="function"==typeof i[n]&&i[n],u=p.i||{},c=p.cache||{},d="undefined"!=typeof module&&"function"==typeof module.require&&module.require.bind(module);function f(t,r){if(!c[t]){if(!e[t]){if(s[t])return s[t];var a="function"==typeof i[n]&&i[n];if(!r&&a)return a(t,!0);if(p)return p(t,!0);if(d&&"string"==typeof t)return d(t);var o=Error("Cannot find module '"+t+"'");throw o.code="MODULE_NOT_FOUND",o}u.resolve=function(r){var n=e[t][1][r];return null!=n?n:r},u.cache={};var l=c[t]=new f.Module(t);e[t][0].call(l.exports,u,l,l.exports,i)}return c[t].exports;function u(e){var t=u.resolve(e);return!1===t?{}:f(t)}}f.isParcelRequire=!0,f.Module=function(e){this.id=e,this.bundle=f,this.require=d,this.exports={}},f.modules=e,f.cache=c,f.parent=p,f.distDir=void 0,f.publicUrl=void 0,f.devServer=void 0,f.i=u,f.register=function(t,r){e[t]=[function(e,t){t.exports=r},{}]},Object.defineProperty(f,"root",{get:function(){return i[n]}}),i[n]=f;for(var m=0;m<t.length;m++)f(t[m]);if(r){var h=f(r);"object"==typeof exports&&"undefined"!=typeof module?module.exports=h:"function"==typeof define&&define.amd&&define(function(){return h})}}({ecCzQ:[function(e,t,r,n){var s=e("@parcel/transformer-js/src/esmodule-helpers.js");s.defineInteropFlag(r),s.export(r,"default",()=>l);var a=e("@tensorflow/tfjs-core");e("@tensorflow/tfjs-backend-webgl"),e("@tensorflow/tfjs-backend-cpu");var o=e("@tensorflow-models/body-segmentation");function l(e={}){return t=>{let{template:{$video:r,$danmuku:n}}=t,s=null,l=null,i=null,p=null,u=!1,c={solutionPath:e.solutionPath||"https://cdn.jsdelivr.net/npm/@mediapipe/selfie_segmentation",modelSelection:e.modelSelection||1,smoothSegmentation:void 0===e.smoothSegmentation||e.smoothSegmentation,minDetectionConfidence:e.minDetectionConfidence||.5,minTrackingConfidence:e.minTrackingConfidence||.5,selfieMode:e.selfieMode||!1,drawContour:e.drawContour||!1,foregroundThreshold:e.foregroundThreshold||.5,opacity:e.opacity||1,maskBlurAmount:e.maskBlurAmount||3};async function d(){try{await a.setBackend("webgl")}catch(e){console.warn("WebGL backend not available, falling back to CPU"),await a.setBackend("cpu")}}async function f(){await d();let e=o.SupportedModels.MediaPipeSelfieSegmentation,t={runtime:"mediapipe",modelType:"general",solutionPath:c.solutionPath,modelSelection:c.modelSelection,smoothSegmentation:c.smoothSegmentation,minDetectionConfidence:c.minDetectionConfidence,minTrackingConfidence:c.minTrackingConfidence,selfieMode:c.selfieMode};try{s=await o.createSegmenter(e,t),console.log("Segmenter initialized:",s),u=!0}catch(e){console.error("Error initializing segmenter:",e),u=!1}}async function m(){if(!u||r.paused||r.ended){p=requestAnimationFrame(m);return}try{l.width=r.videoWidth,l.height=r.videoHeight;let e=await s.segmentPeople(r);if(!e||0===e.length){p=requestAnimationFrame(m);return}let t=await o.toBinaryMask(e,{r:255,g:255,b:255,a:255},{r:0,g:0,b:0,a:255},c.drawContour,c.foregroundThreshold);await o.drawMask(l,r,t,c.opacity,c.maskBlurAmount);let a=i.getImageData(0,0,l.width,l.height);i.putImageData(function(e){let t=e.data;for(let e=0;e<t.length;e+=4)t[e]>250&&t[e+1]>250&&t[e+2]>250&&(t[e+3]=0);return e}(a),0,0),n.style.maskImage=`url(${l.toDataURL()})`}catch(e){console.error("Error in segmentBody:",e)}p=requestAnimationFrame(m)}async function h(){u||await f(),l||(i=(l=document.createElement("canvas")).getContext("2d")),Object.assign(n.style,{maskMode:"alpha",maskSize:"contain",maskRepeat:"no-repeat",backgroundSize:"contain",backgroundRepeat:"no-repeat"}),m()}function g(){n.style.maskImage="none",p&&(cancelAnimationFrame(p),p=null)}return t.on("ready",h),t.on("destroy",g),{name:"artplayerPluginDanmukuMask",start:h,stop:g}}}"undefined"!=typeof window&&(window.artplayerPluginDanmukuMask=l)},{"@tensorflow/tfjs-core":"2Gtps","@tensorflow/tfjs-backend-webgl":"2ZcDF","@tensorflow/tfjs-backend-cpu":"b4yJT","@tensorflow-models/body-segmentation":"5Otso","@parcel/transformer-js/src/esmodule-helpers.js":"6ykb1"}],"2Gtps":[function(e,t,r,n){var s=e("@parcel/transformer-js/src/esmodule-helpers.js");s.defineInteropFlag(r),e("./base_side_effects");var a=e("./optimizers/register_optimizers"),o=e("./base");s.exportAll(o,r),(0,a.registerOptimizers)()},{"./base_side_effects":"2myjr","./optimizers/register_optimizers":"iq2z6","./base":"6xSpB","@parcel/transformer-js/src/esmodule-helpers.js":"6ykb1"}],"2myjr":[function(e,t,r,n){var s=e("./engine");e("./flags"),e("./platforms/platform_browser"),e("./platforms/platform_node");var a=e("./ops/buffer"),o=e("./ops/cast"),l=e("./ops/clone"),i=e("./ops/print"),p=e("./tensor");(0,s.getOrMakeEngine)();let u={buffer:a.buffer,cast:o.cast,clone:l.clone,print:i.print};(0,p.setOpHandler)(u)},{"./engine":"5aImO","./flags":"44Dje","./platforms/platform_browser":"5luux","./platforms/platform_node":"5A4CI","./ops/buffer":"avZau"Line truncated