(()=>{"use strict";var e,t,a={20815:(e,t,a)=>{a(88674),a(39575),a(49743),a(33105),a(3462),a(33824),a(12974);var r=a(41811);let n,i,o=null,s=0;self.onmessage=async e=>{let{data:t}=e;if(t.canvas){console.log("segmeneter.worker: received canvas, initializing",t);try{const e=await r.n.forVisionTasks("".concat(t.assetsPath,"/mediapipe/tasks-vision/wasm"));o=await r.cW.createFromOptions(e,{baseOptions:{modelAssetPath:"".concat(t.assetsPath,"/mediapipe/tasks-vision/selfie_segmenter_landscape.tflite"),delegate:"GPU"},outputCategoryMask:!0,outputConfidenceMasks:!1,runningMode:"VIDEO"})}catch(e){console.error("segmeneter.worker: failed to initialize segmenter",e)}n=t.canvas.getContext("2d");const e=new OffscreenCanvas(640,480).getContext("2d",{willReadFrequently:!0});if(!e)return void console.error("segmeneter.worker: failed to create temp canvas context");i=e}else t.frame&&o?(n.canvas.width===t.width&&n.canvas.height===t.height||(console.log("segmeneter.worker: resizing output canvas",t.width,t.height),n.canvas.width=t.width,n.canvas.height=t.height),i.canvas.width===t.width&&i.canvas.height===t.height||(console.log("segmeneter.worker: resizing temp canvas",t.width,t.height),i.canvas.width=t.width,i.canvas.height=t.height),o.segmentForVideo(t.frame,performance.now(),(async e=>{if(!e.categoryMask)return void console.warn("segmeneter.worker: no category mask in result");n.filter="blur(".concat(s,"px)"),n.drawImage(t.frame,0,0,t.width,t.height),n.filter="none",i.globalCompositeOperation="source-over",i.drawImage(t.frame,0,0,t.width,t.height),i.globalCompositeOperation="destination-in";const a=i.getImageData(0,0,t.width,t.height).data;let r=0;const o=e.categoryMask.getAsFloat32Array();for(let e=0;e<o.length;e++)o[e]>0&&(a[r]=0,a[r+1]=0,a[r+2]=0,a[r+3]=0),r+=4;const c=new Uint8ClampedArray(a.buffer),h=new ImageData(c,t.width,t.height);n.drawImage(await createImageBitmap(h),0,0)}))):"blurIntensity"in t&&(s=t.blurIntensity)}}},r={};function n(e){var t=r[e];if(void 0!==t)return t.exports;var i=r[e]={exports:{}};return a[e](i,i.exports,n),i.exports}n.m=a,n.x=()=>{var e=n.O(void 0,[501],(()=>n(20815)));return e=n.O(e)},e=[],n.O=(t,a,r,i)=>{if(!a){var o=1/0;for(l=0;l<e.length;l++){for(var[a,r,i]=e[l],s=!0,c=0;c<a.length;c++)(!1&i||o>=i)&&Object.keys(n.O).every((e=>n.O[e](a[c])))?a.splice(c--,1):(s=!1,i<o&&(o=i));if(s){e.splice(l--,1);var h=r();void 0!==h&&(t=h)}}return t}i=i||0;for(var l=e.length;l>0&&e[l-1][2]>i;l--)e[l]=e[l-1];e[l]=[a,r,i]},n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var a in t)n.o(t,a)&&!n.o(e,a)&&Object.defineProperty(e,a,{enumerable:!0,get:t[a]})},n.f={},n.e=e=>Promise.all(Object.keys(n.f).reduce(((t,a)=>(n.f[a](e,t),t)),[])),n.u=e=>"chunk.491928a03cac928fc2a9.js",n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.p="",(()=>{var e={815:1};n.f.i=(t,a)=>{e[t]||importScripts(n.p+n.u(t))};var t=self.webpackChunk=self.webpackChunk||[],a=t.push.bind(t);t.push=t=>{var[r,i,o]=t;for(var s in i)n.o(i,s)&&(n.m[s]=i[s]);for(o&&o(n);r.length;)e[r.pop()]=1;a(t)}})(),t=n.x,n.x=()=>n.e(501).then(t);n.x()})();