@monitordog/detector 1.0.2 → 1.0.3

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.
Files changed (34) hide show
  1. package/README.md +13 -107
  2. package/dist/assets/inference-worker-EjUccpPR.js +8 -0
  3. package/dist/assets/ort/ort-wasm-simd-threaded.mjs +59 -0
  4. package/dist/assets/ort/ort-wasm-simd-threaded.wasm +0 -0
  5. package/dist/assets/sdk/detector-320.onnx.enc +0 -0
  6. package/dist/assets/sdk/detector-416.onnx.enc +0 -0
  7. package/dist/assets/sdk/detector-640.onnx.enc +0 -0
  8. package/dist/constants.d.ts +0 -6
  9. package/dist/detect/model-loader.d.ts +1 -11
  10. package/dist/environment.d.ts +0 -8
  11. package/dist/events.d.ts +2 -5
  12. package/dist/index.d.ts +1 -3
  13. package/dist/monitordog-detector.js +603 -11543
  14. package/dist/monitordog-detector.umd.cjs +1 -54
  15. package/dist/service/container.d.ts +0 -8
  16. package/dist/service/detect-service.d.ts +0 -30
  17. package/dist/service/detection-event-service.d.ts +2 -10
  18. package/dist/service/webcam-service.d.ts +0 -2
  19. package/dist/types.d.ts +19 -97
  20. package/package.json +15 -18
  21. package/dist/assets/inference-worker-C-n1YxCo.js +0 -2
  22. package/dist/detect/wasm/webcam-frame-analysis-wasm-bytes.d.ts +0 -1
  23. package/dist/detect/webcam-blockage-detector.d.ts +0 -32
  24. package/dist/detect/webcam-frame-analysis-wasm.d.ts +0 -47
  25. package/dist/detect/webcam-frame-analysis.d.ts +0 -34
  26. package/dist/detect/webcam-lighting-detector.d.ts +0 -21
  27. package/dist/language.d.ts +0 -6
  28. package/dist/monitordog-detector.d.ts +0 -41
  29. package/dist/pose/mediapipe-asset-loader.d.ts +0 -16
  30. package/dist/pose/mediapipe-main-user-tracker.d.ts +0 -90
  31. package/dist/pose.d.ts +0 -15
  32. package/dist/service/overlay-renderer.d.ts +0 -71
  33. package/dist/service/overlay-service.d.ts +0 -75
  34. package/dist/service/overlay-watchdog-service.d.ts +0 -13
@@ -1,54 +1 @@
1
- (function(e,t){typeof exports==`object`&&typeof module<`u`?t(exports,require("html2canvas")):typeof define==`function`&&define.amd?define([`exports`,`html2canvas`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e.MonitorDogDetector={},e.html2canvas))})(this,function(e,t){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var n=Object.create,r=Object.defineProperty,i=Object.getOwnPropertyDescriptor,a=Object.getOwnPropertyNames,o=Object.getPrototypeOf,s=Object.prototype.hasOwnProperty,c=(e,t,n,o)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var c=a(t),l=0,u=c.length,d;l<u;l++)d=c[l],!s.call(e,d)&&d!==n&&r(e,d,{get:(e=>t[e]).bind(null,d),enumerable:!(o=i(t,d))||o.enumerable});return e};t=((e,t,i)=>(i=e==null?{}:n(o(e)),c(t||!e||!e.__esModule?r(i,`default`,{value:e,enumerable:!0}):i,e)))(t,1);var l=ae;function u(){let e=[`mediapipe-vision-wasm-js`,`ort-js`,`130182wZVuzv`,`30787neBMGE`,`736637bUtSAQ`,`1473731nHtxki`,`1605648whJSNk`,`10qdrdZq`,`5DbKyRx`,`3wWNMDl`,`180TZVhxr`,`548628eKjoAk`,`mediapipe-pose-landmarker`,`107110RXFjHx`];return u=function(){return e},u()}(function(e,t){let n=ae,r=e();for(;;)try{if(-parseInt(n(452))/1*(-parseInt(n(456))/2)+-parseInt(n(458))/3*(-parseInt(n(460))/4)+parseInt(n(457))/5*(parseInt(n(451))/6)+-parseInt(n(454))/7+parseInt(n(455))/8+parseInt(n(459))/9*(-parseInt(n(462))/10)+parseInt(n(453))/11===t)break;r.push(r.shift())}catch{r.push(r.shift())}})(u,155709);var d=.8,ee=.7,te=3e4,ne=`monitordog.mainUserTracking.enabled`;l(464);var re=l(463),ie=`mediapipe-vision-wasm-wasm`;function ae(e,t){return e-=451,u()[e]}var oe=l(461);(function(e,t){let n=se,r=e();for(;;)try{if(-parseInt(n(433))/1+-parseInt(n(431))/2+-parseInt(n(427))/3*(parseInt(n(438))/4)+-parseInt(n(437))/5+parseInt(n(432))/6+-parseInt(n(439))/7*(parseInt(n(428))/8)+parseInt(n(436))/9*(parseInt(n(430))/10)===t)break;r.push(r.shift())}catch{r.push(r.shift())}})(pe,164884);function se(e,t){return e-=427,pe()[e]}function ce(e){return typeof e==`string`?e:e.access_token}function le(e){if(typeof e!==se(435))return e.expires_in}function ue(e){if(typeof e!=`string`)return e.expires_at}function de(e){let t=se;if(e.expiresAt){let t=Date.parse(e.expiresAt);if(!Number.isNaN(t))return t}if(e.expiresIn)return e.expiresIn>1e9?e.expiresIn*1e3:Date[t(434)]()+e.expiresIn*1e3}function fe(e){return e[se(429)](/\/+$/,``)}function pe(){let e=[`430392ghXNdT`,`98965iiSotF`,`now`,`string`,`54TQwRVS`,`43285VgVfWX`,`104icvipB`,`609DBppWd`,`37473KQMYcF`,`9048rDDoID`,`replace`,`1353080xMIPcp`,`375822byJtZc`];return pe=function(){return e},pe()}function me(e,t){return e-=149,ge()[e]}(function(e,t){let n=me,r=e();for(;;)try{if(-parseInt(n(165))/1+parseInt(n(156))/2*(-parseInt(n(163))/3)+-parseInt(n(158))/4*(-parseInt(n(155))/5)+-parseInt(n(149))/6+parseInt(n(150))/7+parseInt(n(157))/8+parseInt(n(154))/9===t)break;r.push(r.shift())}catch{r.push(r.shift())}})(ge,123484);function he(){let e=me;if(typeof navigator===e(153))return`none`;let t=navigator.userAgent.toLowerCase();return/ipad|tablet/.test(t)?`tablet`:/mobile|iphone|ipod|android/.test(t)?`mobile`:e(160)}function ge(){let e=[`low memory (`,`110747IDzVKv`,`849150QFZths`,`940135zYlfJN`,`mobile`,`tablet`,`undefined`,`161460OknZZf`,`5730zEXvYG`,`1208TuNffO`,`572360UlgqnL`,`756PMtfau`,`userAgent`,`desktop`,`ios`,`GB)`,`321pUDRrN`];return ge=function(){return e},ge()}function _e(){let e=me;if(typeof navigator>`u`)return`none`;let t=navigator[e(159)].toLowerCase(),n=navigator.platform.toLowerCase();return/iphone|ipad|ipod/.test(t)?e(161):/android/.test(t)?`android`:n.includes(`win`)?`windows`:n.includes(`mac`)?`macos`:n.includes(`linux`)?`linux`:`other`}function ve(){let e=me,t=he(),n=typeof navigator===e(153)?0:navigator.hardwareConcurrency||0,r=ye();return t===e(151)||t===e(152)?{enabled:!1,reason:t+` device`,deviceType:t,cpuCores:n,deviceMemoryGb:r}:n>0&&n<8?{enabled:!1,reason:`low cpu cores (`+n+`)`,deviceType:t,cpuCores:n,deviceMemoryGb:r}:r!==void 0&&r<8?{enabled:!1,reason:e(164)+r+e(162),deviceType:t,cpuCores:n,deviceMemoryGb:r}:{enabled:!0,deviceType:t,cpuCores:n,deviceMemoryGb:r}}function ye(){if(!(typeof navigator>`u`))return navigator.deviceMemory}(function(e,t){for(var n=Se,r=e();;)try{if(-parseInt(n(458))/1+-parseInt(n(463))/2+-parseInt(n(461))/3+parseInt(n(465))/4+-parseInt(n(457))/5+-parseInt(n(462))/6+-parseInt(n(459))/7*(-parseInt(n(464))/8)===t)break;r.push(r.shift())}catch{r.push(r.shift())}})(xe,215989);var be=class extends Error{code;cause;constructor(e,t,n){var r=Se;super(t),this.name=`MonitorDogSdkError`,this.code=e,this[r(460)]=n}};function xe(){var e=[`320696XCOeqo`,`244970WTvHbS`,`5053TgMccy`,`93513zDEiTe`,`cause`,`1039545XUuqzI`,`2003094EipeWN`,`450424PJVJAz`,`656koLVql`];return xe=function(){return e},xe()}function Se(e,t){return e-=457,xe()[e]}function Ce(e){return e instanceof be}(function(e,t){let n=Oe,r=e();for(;;)try{if(-parseInt(n(179))/1+parseInt(n(175))/2+-parseInt(n(182))/3*(-parseInt(n(181))/4)+parseInt(n(186))/5+parseInt(n(171))/6+parseInt(n(180))/7+-parseInt(n(169))/8*(parseInt(n(176))/9)===t)break;r.push(r.shift())}catch{r.push(r.shift())}})(Ae,797097);function we(e,t){let n=Oe;if(e.faceCount===0&&(t.state===`AWAY`||t[n(178)]===`INIT`&&t.hasTrackedUser))return ke(`noFaceDetected`,e);if(e[n(170)]>=2)return ke(n(183),e);if(e.phoneCount>=1)return ke(n(177),e)}function Te(e){let t=Oe,n=new Date().toISOString();return{type:t(174),payload:{...je(t(174),n),properties:{confidence:1,spots:[],changed_coverage:e.changedCoverage}}}}function Ee(e){return{...je(e,new Date().toISOString()),properties:{},webcam_imgs:[],monitor_imgs:[]}}function De(e,t){return e[Oe(185)]===0&&(e.faceCount===1||e.faceCount===0&&t.state===`TRACKING`)}function Oe(e,t){return e-=169,Ae()[e]}function ke(e,t){let n=Oe,r=je(e,new Date().toISOString());switch(e){case`noFaceDetected`:return{type:e,payload:{...r,properties:{confidence:0,spots:[]}}};case n(183):return{type:e,payload:{...r,properties:{confidence:Me(t[n(173)]),spots:t[n(173)]}}};case`mobileDevice`:return{type:e,payload:{...r,properties:{confidence:Me(t[n(187)]),spots:t.phoneDetections}}};case`webcamBlocked`:return{type:e,payload:{...r,properties:{confidence:0,spots:[]}}}}}function Ae(){let e=[`e2c48c23-36e2-4253-82b1-7f6565fdcfc3`,`phoneCount`,`1363175bfBSIR`,`phoneDetections`,`55672PGUjGn`,`faceCount`,`9341898PKFNXy`,`score`,`faceDetections`,`webcamBlocked`,`2869488EeuEiL`,`5859tDYdbH`,`mobileDevice`,`state`,`387396UdoPOm`,`6991432AuireD`,`9792RsMKVy`,`1779fgTgXC`,`twoFacesDetected`];return Ae=function(){return e},Ae()}function je(e,t){return{basic_event_uuid:Ne(e),occured_at:t,sended_at:new Date().toISOString(),device_type:he(),device_os:_e(),device_id:`browser`}}function Me(e){let t=Oe;return e.reduce((e,n)=>Math.max(e,n[t(172)]),0)}function Ne(e){let t=Oe;switch(e){case`logout`:return`12ca646a-d832-4581-b03c-48f95627507f`;case`login`:return`4c6f98ea-88d8-4215-9b6a-9b3ccb753465`;case t(177):return`027af5c9-297d-4a64-983f-4199ca4b9dad`;case`twoFacesDetected`:return`d555efac-7465-4067-8056-611e95385807`;case`noFaceDetected`:return t(184);case t(174):return`169058dd-60c3-44dd-a97b-ce92a7083197`;default:return``}}var f=Pe;(function(e,t){let n=Pe,r=e();for(;;)try{if(-parseInt(n(320))/1+-parseInt(n(337))/2+parseInt(n(332))/3+-parseInt(n(321))/4+parseInt(n(319))/5+-parseInt(n(356))/6+-parseInt(n(316))/7*(-parseInt(n(317))/8)===t)break;r.push(r.shift())}catch{r.push(r.shift())}})(Re,145030);function Pe(e,t){return e-=313,Re()[e]}var Fe=f(336),Ie=300*1e3,Le=class{[f(322)];[f(343)]=Ie;periodicRefreshIntervalMs=te;[f(341)];tokenExpiresAt;refreshPromise;[f(342)];[f(352)]=0;sessionEmail;constructor(e){this.services=e}async[f(355)](e){let t=f,n=await this[t(347)](e.email);return this.sessionEmail=e.email,this.setSessionTokenPayload(n),await this[t(334)](t(355)),n}async logout(){let e=f;if(this.token)try{await this[e(334)](`logout`)}finally{this.clearTokens()}}[f(360)](){return this.token}[f(346)](){return this.tokenExpiresAt}getSessionEmail(){return this.sessionEmail}isAuthenticated(){return!!this.token}dispose(){this.clearTokens()}assertAuthenticated(){if(!this.token)throw Error(`MonitorDog login is required before detection.`)}async getValidAccessToken(){let e=f;if(this[e(348)]())try{await this[e(354)]()}catch(t){if(this.token&&this.tokenExpiresAt&&Date.now()<this[e(335)])return this[e(341)];throw t}return this[e(341)]}async authorizedFetch(e,t={},n=!0){let r=f,i=await this.getValidAccessToken(),a=new Headers(t.headers);i&&(a[r(329)](r(351),`Bearer `+i),a.set(`Device-Access-Token`,i));let o=await fetch(``+this.services[r(345)][r(349)]+e,{...t,headers:a}),s=await this.getApiErrorCode(o);return o[r(318)]===400&&s===4221&&this.handleLoginRequired(),n&&this.shouldRefreshAfterAuthError(o,s)?(await this.handleAuthRefresh(),this[r(361)](e,t,!1)):o}setSessionTokenPayload(e){let t=ce(e);if(!t||typeof t!=`string`)throw Error(`MonitorDog SDK token response did not include a token.`);this.setTokens({accessToken:t,expiresIn:le(e),expiresAt:ue(e)})}[f(326)](e){this.token=e.accessToken,this.tokenExpiresAt=de(e),this.tokenExpiresAt?this.startPeriodicRefresh():this.stopPeriodicRefresh()}clearTokens(){let e=f;this.authSessionId+=1,this.token=void 0,this.tokenExpiresAt=void 0,this.refreshPromise=void 0,this[e(340)]=void 0,this[e(350)]()}async[f(325)](){let e=f;return this.refreshPromise?this.refreshPromise:(this[e(338)]=this.refreshAccessToken().finally(()=>{this.refreshPromise=void 0}),this[e(338)])}async[f(354)](){let e=f;try{return await this.refreshToken()}catch(t){if(!this[e(357)](t)){let n=this[e(313)](`SESSION_TOKEN_FAILED`,`MonitorDog SDK session token refresh failed.`,t);this.services.options.onAuthError?.(n),this.isCurrentTokenExpired()&&(this[e(353)](),this[e(322)].onLoginRequired?.())}throw t}}async[f(324)](){let e=f,t=this[e(352)],n=this[e(340)];if(!n)throw Error(`MonitorDog login email is required to refresh SDK token.`);let r=await this.fetchSessionToken(n),i=ce(r);if(!i||typeof i!=`string`)throw Error(`MonitorDog SDK token response did not include a token.`);if(t!==this.authSessionId)throw Error(Fe);return this.setSessionTokenPayload(r),i}startPeriodicRefresh(){this.refreshIntervalId||=setInterval(()=>{this.refreshPeriodically()},this.periodicRefreshIntervalMs)}[f(350)](){let e=f;this.refreshIntervalId&&(clearInterval(this.refreshIntervalId),this[e(342)]=void 0)}async refreshPeriodically(){if(!(!this.token||!this.shouldRefreshCurrentToken()))try{await this.handleAuthRefresh()}catch{}}[f(348)](){let e=f;return!!(this[e(341)]&&this[e(335)]&&Date.now()>=this.tokenExpiresAt-this.refreshBeforeMs)}[f(328)](){let e=f;return!!(this[e(335)]&&Date.now()>=this.tokenExpiresAt)}isRefreshSupersededError(e){let t=f;return e instanceof Error&&e[t(314)]===Fe}async fetchSessionToken(e){let t=this.services.options.sessionTokenProvider;if(!t)throw Error(`MonitorDog sessionTokenProvider is required for SDK login.`);return t({email:e})}async[f(331)](e){let t=f;if(e.status===400)try{let n=await e.clone().json();if(typeof n===t(333)&&n!==null&&`code`in n&&typeof n.code===t(344))return n.code}catch{return}}[f(330)](e,t){let n=f;return e.status===401?!0:e[n(318)]===400&&t===422}[f(323)](){let e=f;this.clearTokens(),this.services[e(315)]?.();let t=this.createSdkError(`NOT_LOGGED_IN`,`MonitorDog login is required.`);throw this.services.options.onAuthError?.(t),t}async sendUserActivityEvent(e){let t=f;try{let n=await this[t(361)](`/event`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON[t(339)](Ee(e))});if(!n.ok)throw Error(t(358)+e+t(327)+n.status)}catch(n){let r=this.createSdkError(ze(e),`MonitorDog `+e+t(359),n);if(this[t(322)].options.onAuthError?.(r),e===`logout`)throw r}}createSdkError(e,t,n){return n instanceof be?n:new be(e,t,n)}};function Re(){let e=`isCurrentTokenExpired,set,shouldRefreshAfterAuthError,getApiErrorCode,446481DrllnL,object,sendUserActivityEvent,tokenExpiresAt,MonitorDog token refresh was superseded.,238836tjYluW,refreshPromise,stringify,sessionEmail,token,refreshIntervalId,refreshBeforeMs,number,options,getTokenExpiresAt,fetchSessionToken,shouldRefreshCurrentToken,apiBaseUrl,stopPeriodicRefresh,authorization,authSessionId,clearTokens,handleAuthRefresh,login,36894LAeRVs,isRefreshSupersededError,MonitorDog , event failed.,getToken,authorizedFetch,createSdkError,message,onLoginRequired,7nsBPkx,518264Mwmfed,status,993805rbZmyv,49654PPIphB,368480grSEJC,services,handleLoginRequired,refreshAccessToken,refreshToken,setTokens, event failed: `.split(`,`);return Re=function(){return e},Re()}function ze(e){return e===`logout`?`LOGOUT_FAILED`:`SESSION_TOKEN_FAILED`}var Be=Ue;(function(e,t){let n=Ue,r=e();for(;;)try{if(parseInt(n(450))/1+-parseInt(n(435))/2*(-parseInt(n(439))/3)+parseInt(n(418))/4*(parseInt(n(419))/5)+parseInt(n(445))/6*(-parseInt(n(429))/7)+parseInt(n(432))/8*(-parseInt(n(446))/9)+-parseInt(n(451))/10*(-parseInt(n(426))/11)+-parseInt(n(454))/12*(-parseInt(n(422))/13)===t)break;r.push(r.shift())}catch{r.push(r.shift())}})(He,615140);var Ve=/(obs|virtual|xsplit|manycam|splitcam|webcammax|fake|loopback|camtwist|e2esoft|vcam|droidcam|iriun|epoccam|camo|mmhmm|nvidia broadcast|streamlabs|bandicam|wirecast|chromacam|youcam|cyberlink|altserver|logi capture|elgato|streamfx|screen capture|desktop capture)/i;function He(){let e=`1346521FYJTfz,stop,addEventListener,168UyDgRG,isPermissionError,createFirstCameraConstraints,5048xvwCvJ,message,height,1249574EiYJSA,createDeviceConstraints,deviceId,watchStreamDeviceDisconnect,3qQppqf,width,videoinput,audio,then,object,232494mnbDkK,13527LaEzQs,facingMode,createFallbackWebcamStream,getWebcamNaturalAspectRatio,504512jFBjIL,30azuZRT,forEach,getVideoInputDevices,3732qWlzMo,mediaDevices,204xIsHuI,31945bWBuhS,Camera permission request timed out.,getVideoTracks,28054KJYqXa,getBaseWebcamConstraints,getTracks,handleDeviceChange`.split(`,`);return He=function(){return e},He()}function Ue(e,t){return e-=417,He()[e]}var We=class{async createWebcamStream(e){let t=Ue;if(!navigator.mediaDevices?.getUserMedia)throw Error(`getUserMedia is not available in this browser.`);let n=this[t(423)](e),r=await this.createFirstCameraConstraints(n);try{return await this.getUserMedia(r)}catch(e){if(this[t(430)](e)||this.isCameraRequestTimeoutError(e))throw e;return this[t(448)](r,e)}}stopStream(e){let t=Ue;e[t(424)]()[t(452)](e=>e.stop())}[Be(438)](e,t,n=1e3){let r=Be,i=e[r(421)]()[0],a=i?.getSettings().deviceId;if(!i&&!a)return()=>{};let o=!1,s,c=()=>{o||(o=!0,t())},l=()=>{a&&(s&&clearTimeout(s),s=setTimeout(()=>{s=void 0,this.handleDeviceChange(a,c)},n))};return i?.[r(428)](`ended`,c),navigator.mediaDevices?.addEventListener?.(`devicechange`,l),()=>{s&&clearTimeout(s),i?.removeEventListener(`ended`,c),navigator.mediaDevices?.removeEventListener?.(`devicechange`,l)}}isCameraInUse(e){let t=Be,n=e?.srcObject;return n instanceof MediaStream?n[t(424)]().some(e=>e.readyState===`live`):!1}async getVideoInputDevices(){let e=Be;return navigator.mediaDevices?.enumerateDevices?(await navigator.mediaDevices.enumerateDevices()).filter(t=>t.kind===e(441)):[]}async getRealVideoInputDevices(){let e=Be,t=await this[e(453)](),n=t.filter(e=>!this.isVirtualCamera(e));return n.length>0?n:t}async createFallbackWebcamStream(e,t){let n=Be,r=await this.getRealVideoInputDevices();if(r.length===0)throw t;let i=r[0],a=t;if(!i?.deviceId)throw a;let o=await this[n(449)](i[n(437)]),s=this.generateResolutionList(o,720);for(let t of s)try{return await this.getUserMedia(this[n(436)](e,i.deviceId,t))}catch(e){a=e}throw a}async[Be(425)](e,t){try{!(await this.getVideoInputDevices()).some(t=>t.deviceId===e)&&t()}catch{}}[Be(423)](e){return e??{audio:!1,video:{facingMode:`user`}}}async[Be(431)](e){let t=Be,n=typeof e.video==`object`?e.video:{};if(`deviceId`in n||t(447)in n)return e;let r=(await this.getRealVideoInputDevices())[0];return r?.[t(437)]?this.createDeviceConstraints(e,r[t(437)]):e}async getWebcamNaturalAspectRatio(e){let t=Be,n;try{n=await this.getUserMedia({audio:!1,video:{deviceId:{exact:e}}});let r=n.getVideoTracks()[0]?.getSettings();if(r?.[t(440)]&&r.height)return r.width/r[t(434)]}catch{}finally{n?.getTracks().forEach(e=>e[t(427)]())}return 16/9}generateResolutionList(e,t){let n=Be;return[t,640,600,480,320,240].map(t=>({width:t,height:Math.max(1,Math.round(t/e))})).filter(e=>e[n(440)]<=t&&e.height>=120&&e.height<=1080)}createDeviceConstraints(e,t,n){let r=Be,i=typeof e.video===r(444)?e.video:{};return{...e,audio:e[r(442)]??!1,video:{...i,deviceId:{exact:t},...n?{width:{min:n[r(440)],ideal:n.width},height:{min:n.height,ideal:n.height}}:{}}}}isVirtualCamera(e){let t=e.label.toLowerCase();return t?Ve.test(t):!1}isPermissionError(e){return e instanceof DOMException&&(e.name===`NotAllowedError`||e.name===`SecurityError`)}getUserMedia(e,t=15e3){let n=Be,r=!1,i,a=navigator[n(417)].getUserMedia(e)[n(443)](e=>{let t=n;if(r)throw this.stopStream(e),Error(t(420));return e}),o=new Promise((e,n)=>{i=setTimeout(()=>{r=!0,n(Error(`Camera permission request timed out.`))},t)});return Promise.race([a,o]).finally(()=>{i&&clearTimeout(i)})}isCameraRequestTimeoutError(e){let t=Be;return e instanceof Error&&e[t(433)]===t(420)}};(function(e,t){let n=Ke,r=e();for(;;)try{if(-parseInt(n(404))/1*(parseInt(n(402))/2)+parseInt(n(397))/3+parseInt(n(401))/4*(parseInt(n(403))/5)+parseInt(n(400))/6+-parseInt(n(405))/7+-parseInt(n(396))/8+parseInt(n(408))/9*(parseInt(n(407))/10)===t)break;r.push(r.shift())}catch{r.push(r.shift())}})(Ge,515274);function Ge(){let e=[`toBlob`,`videoHeight`,`6449544pblJBC`,`2355873INjWmu`,`2D canvas context is not available.`,`getContext`,`3705264dDfjoa`,`12LFDkAq`,`12KsFPmx`,`601645HqRwYB`,`99897otDvPB`,`4555075tiOPbe`,`videoWidth`,`440ewWrKo`,`165222qiGRIj`];return Ge=function(){return e},Ge()}function Ke(e,t){return e-=395,Ge()[e]}function qe(e){let t=Ke;if(e.videoWidth===0||e.videoHeight===0)throw Error(`Video frame is not ready for capture.`);let n=document.createElement(`canvas`),r=n[t(399)](`2d`);if(!r)throw Error(t(398));return n.width=e[t(406)],n.height=e[t(395)],r.drawImage(e,0,0,n.width,n.height),new Promise((e,t)=>{n.toBlob(n=>{if(!n){t(Error(`Failed to capture video frame.`));return}e(n)},`image/jpeg`,.9)})}async function Je(){if(typeof document>`u`||!document.body)return null;let e=await(0,t.default)(document.body,{backgroundColor:`#ffffff`,useCORS:!0});return new Promise(t=>{e[Ke(409)](t,`image/jpeg`,.9)})}function Ye(){let e=`options,400563rxvUEM,now,noFaceDetected,987705ZkrGMD,resetAfterResumePasswordUnlock,authorizedFetch,shouldSendWebcamBlockedEvent,MonitorDog image upload failed: ,webcam.jpg,clearLock,payload,1368346YsOdYB,uploadImage,5553616XHUQDS,detectionEventInFlight,userPreferences,getMode,resetForWebcamStartup,7JeySjs,1UiPdFO,webcamBlockageDetectionEnabled,clearSource,noFaceStartedAt,detection,mobileDetectionThreshold,24DACyPu,POST,getOverlayDuration,detectionEventLocked,1362990fshoLE,15195686coVsAQ,multiPersonLockDuration,json,detectionEventLockTimeoutId,3754335LcQzlo,overlay,noFaceEventDelayMs,type,mobileDevice,webcam_imgs,MonitorDog event request failed: ,multiPersonDetectionMode,20ulFqsS,webcam,requiredPassword,multiPersonDetectionEnabled,services,shouldPauseDetectionAfterCapture,uploadWebcamImage,max`.split(`,`);return Ye=function(){return e},Ye()}var p=Ze;(function(e,t){let n=Ze,r=e();for(;;)try{if(parseInt(n(269))/1*(-parseInt(n(312))/2)+-parseInt(n(301))/3*(-parseInt(n(275))/4)+parseInt(n(284))/5+parseInt(n(279))/6*(parseInt(n(268))/7)+parseInt(n(314))/8+parseInt(n(304))/9*(parseInt(n(292))/10)+-parseInt(n(280))/11===t)break;r.push(r.shift())}catch{r.push(r.shift())}})(Ye,627251);var Xe=class e{static NO_FACE_STARTUP_GRACE_MS=1500;services;detectionEventLocked=!1;detectionEventInFlight=!1;detectionEventLockTimeoutId;noFaceStartedAt;suppressNoFaceUntil=0;constructor(e){this.services=e}async handleDetectionResult(e,t,n){let r=Ze;if(De(e,t)){if(this.noFaceStartedAt=void 0,this[r(296)].overlay.isLocked()||this[r(296)].shouldPauseForResumePassword)return;this[r(310)](),this[r(296)].overlay[r(271)](r(273));return}if(this[r(278)]||this.detectionEventInFlight||this.services[r(285)].isShowingDetectionBlocker())return;let i=we(e,t);if(!i){this.noFaceStartedAt=void 0;return}if(!(i[r(287)]===r(303)&&!this.hasNoFaceDelayElapsed())&&(i.type!==`noFaceDetected`&&(this[r(272)]=void 0),this.shouldSendEvent(i[r(287)],e))){this.lock(i[r(287)]),this.shouldShowOverlay(i.type)&&this[r(296)].overlay.showJob({id:`detection:`+i.type,state:i[r(287)],source:r(273),durationMs:this.getOverlayDuration(i[r(287)])}),this.detectionEventInFlight=!0;try{let e=await this.uploadWebcamImage(n);this.shouldPauseDetectionAfterCapture(i[r(287)])&&this[r(296)][r(293)].syncPauseState(),e&&(i[r(311)][r(289)]=e);let t=await this.uploadMonitorImage();if(t&&(i.payload.monitor_imgs=t),this.services[r(300)].debug){console.log(i[r(311)]);return}let a=await this.services.auth.authorizedFetch(`/event`,{method:r(276),headers:{"content-type":`application/json`},body:JSON.stringify(i.payload)});if(!a.ok)throw Error(r(290)+a.status)}finally{this.detectionEventInFlight=!1}}}async handleWebcamBlockageResult(e,t){let n=Ze,r=`webcamBlocked`;if((e.likelyCovered||e.suspected||e.blocked)&&(this.noFaceStartedAt=void 0),!(!e.blocked||!this.shouldSendWebcamBlockedEvent()||this.detectionEventLocked||this[n(264)]||this.services.overlay.hasActiveState(`noFaceDetected`)||this.services[n(285)].hasActiveState(r))){this.lock(r),this.shouldShowOverlay(r)&&this.services[n(285)].showJob({id:`detection:webcamBlocked`,state:r,source:`detection`,durationMs:this.getOverlayDuration(r),priority:150}),this[n(264)]=!0;try{let r=Te(e),i=await this[n(298)](t);i&&(r.payload[n(289)]=i);let a=await this.uploadMonitorImage();if(a&&(r.payload.monitor_imgs=a),this.services.options.debug){console.log(r.payload);return}let o=await this.services.auth[n(306)](`/event`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify(r.payload)});if(!o.ok)throw Error(n(290)+o.status)}finally{this.detectionEventInFlight=!1}}}reset(){this.clearLock(),this.noFaceStartedAt=void 0,this.suppressNoFaceUntil=0}[p(267)](){let t=p;this[t(310)](),this.noFaceStartedAt=void 0,this.suppressNoFaceUntil=Date[t(302)]()+e.NO_FACE_STARTUP_GRACE_MS}[p(305)](){let e=p;this[e(267)]()}async uploadWebcamImage(e){let t=p;if(!(e instanceof HTMLVideoElement)||e.videoWidth===0||e.videoHeight===0)return;let n=await qe(e);return this.uploadImage(n,t(309))}async uploadMonitorImage(){let e=p,t=this.services[e(300)].captureMonitorImage?await this.services.options.captureMonitorImage():await Je();if(!t)return;let n=typeof File<`u`&&t instanceof File?t.name:`monitor.jpg`;return this[e(313)](t,n)}async uploadImage(e,t){let n=p,r=new FormData;r.append(`files`,e,t);let i=await this[n(296)].auth.authorizedFetch(`/file/image`,{method:`POST`,body:r});if(!i.ok)throw Error(n(308)+i.status);return i[n(282)]()}shouldSendEvent(e,t){let n=p;switch(e){case`mobileDevice`:return this[n(296)][n(265)].mobileDetectionEnabled&&Qe(t.phoneDetections)>=this.services[n(265)][n(274)];case`twoFacesDetected`:return this.services.userPreferences[n(295)]&&Qe(t.faceDetections)>=this.services[n(265)].faceDetectionThreshold;case n(303):return this.services.userPreferences.noPersonDetectionEnabled;case`webcamBlocked`:return this.shouldSendWebcamBlockedEvent()}}[p(307)](){let e=p;return this.services.userPreferences[e(270)]}shouldShowOverlay(e){let t=p;return this[t(266)](e)===`auto_lock`}lock(e){this.clearLock(),this.detectionEventLocked=!0;let t=this.getLockDuration(e);if(t<=0){this.detectionEventLocked=!1;return}this.detectionEventLockTimeoutId=setTimeout(()=>{this.detectionEventLocked=!1,this.detectionEventLockTimeoutId=void 0},t)}clearLock(){let e=p;this.detectionEventLockTimeoutId&&=(clearTimeout(this[e(283)]),void 0),this.detectionEventLocked=!1}hasNoFaceDelayElapsed(){let e=p;if(Date.now()<this.suppressNoFaceUntil)return this[e(272)]=void 0,!1;if(this[e(296)].noFaceEventDelayMs<=0)return!0;let t=Date.now();return this.noFaceStartedAt===void 0?(this[e(272)]=t,!1):t-this.noFaceStartedAt>=this.services[e(286)]}getLockDuration(e){let t=p;switch(e){case`mobileDevice`:return this[t(296)].userPreferences.mobileDetectionLockDuration;case`twoFacesDetected`:return this.services[t(265)][t(281)];case`noFaceDetected`:return this.services.userPreferences.noPersonLockDuration;case`webcamBlocked`:return this[t(296)].userPreferences.webcamBlockageLockDuration}}[p(277)](e){let t=p;if(!(e===`noFaceDetected`&&this.services[t(300)].requiredPassword))return this.getLockDuration(e)}[p(297)](e){let t=p;return e===t(303)&&this.services.options[t(294)]&&this.shouldShowOverlay(e)}[p(266)](e){let t=p;switch(e){case t(288):return this[t(296)].userPreferences.mobileDetectionMode;case`twoFacesDetected`:return this.services[t(265)][t(291)];case`noFaceDetected`:return this.services.userPreferences.noPersonDetectionMode;case`webcamBlocked`:return this.services.userPreferences.webcamBlockageDetectionMode}}};function Ze(e,t){return e-=264,Ye()[e]}function Qe(e){let t=p;return e.reduce((e,n)=>Math[t(299)](e,n.confidence),0)}``+(typeof document>`u`&&typeof location>`u`?require("url").pathToFileURL(__dirname+`/assets/inference-worker-C-n1YxCo.js`).href:new URL(`assets/inference-worker-C-n1YxCo.js`,typeof document>`u`?location.href:document.currentScript&&document.currentScript.tagName.toUpperCase()===`SCRIPT`&&document.currentScript.src||document.baseURI).href);var $e=et;(function(e,t){let n=et,r=e();for(;;)try{if(-parseInt(n(284))/1*(parseInt(n(268))/2)+-parseInt(n(287))/3*(-parseInt(n(272))/4)+-parseInt(n(283))/5+-parseInt(n(264))/6+-parseInt(n(275))/7*(parseInt(n(262))/8)+-parseInt(n(277))/9+parseInt(n(261))/10===t)break;r.push(r.shift())}catch{r.push(r.shift())}})(tt,280983);function et(e,t){return e-=260,tt()[e]}function tt(){let e=`handleError.clear.worker.result.1190980dsxFCh.231907TEXCyL.buffer.pendingRequests.2742SWnHIR.source.nextRequestId.maxDetections.13937680MzyIlA.16QIPiLO.bitmap.2059560asMbnY.addEventListener.data.handleMessage.2WIhJYf.message.rejectPendingRequests.messageerror.1928XCqWjx.get.postMessage.1114008fUYxTz.terminate.3795138mcGdoz.error`.split(`.`);return tt=function(){return e},tt()}var nt=class{[$e(281)];[$e(289)]=1;pendingRequests=new Map;async load(e){let t={id:this.nextRequestId,type:`load`,model:e};await this.request(t)}run(e){let t=$e,n=e[t(288)].kind===t(263)?[e.source.bitmap]:[e[t(288)].data[t(285)]];return this.request({id:this.nextRequestId,type:`run`,source:e.source,inputSize:e.inputSize,inputType:e.inputType,confidenceThreshold:e.confidenceThreshold,faceConfidenceThreshold:e.faceConfidenceThreshold,iouThreshold:e.iouThreshold,maxDetections:e[t(260)],debug:e.debug},n)}terminate(){let e=$e;this.rejectPendingRequests(Error(`Inference worker was terminated.`)),this[e(281)]?.terminate(),this[e(281)]=void 0}request(e,t=[]){let n=this.getWorker();return this.nextRequestId+=1,new Promise((r,i)=>{let a=et;this[a(286)].set(e.id,{resolve:r,reject:i}),n[a(274)](e,t)})}getWorker(){let e=$e;return!this.worker&&(this.worker=new Worker(``+(typeof document>`u`&&typeof location>`u`?require("url").pathToFileURL(__dirname+`/assets/inference-worker-C-n1YxCo.js`).href:new URL(`assets/inference-worker-C-n1YxCo.js`,typeof document>`u`?location.href:document.currentScript&&document.currentScript.tagName.toUpperCase()===`SCRIPT`&&document.currentScript.src||document.baseURI).href),{name:`MonitorDogInference`,type:`module`}),this[e(281)][e(265)](e(269),this[e(267)]),this.worker[e(265)](e(278),this[e(279)]),this.worker.addEventListener(e(271),this.handleError)),this.worker}handleMessage=e=>{let t=$e,n=e[t(266)],r=this[t(286)][t(273)](n.id);if(r){if(this.pendingRequests.delete(n.id),!n.ok){r.reject(Error(n.error));return}r.resolve(n[t(282)])}};handleError=e=>{let t=$e,n=e instanceof ErrorEvent?e.message:`Inference worker message failed.`;this.rejectPendingRequests(Error(n)),this.worker?.[t(276)](),this.worker=void 0};[$e(270)](e){let t=$e;for(let n of this[t(286)].values())n.reject(e);this[t(286)][t(280)]()}};function rt(){let e=[`12dPUpqf`,`225062ZjxkkX`,`fillStyle`,`8990980VbzOxo`,`rgb(114, 114, 114)`,`getContext`,`videoWidth`,`2392428xokKtN`,`round`,`6361569HBMuEj`,`8NFTfni`,`7631148EXwclv`,`8753657amBLdS`,`height`,`createElement`,`40pzdNGH`,`width`,`data`,`function`,`102546jPVIOP`,`naturalHeight`,`21zPCnZi`,`bitmap`];return rt=function(){return e},rt()}(function(e,t){let n=ot,r=e();for(;;)try{if(-parseInt(n(277))/1*(-parseInt(n(276))/2)+parseInt(n(283))/3+-parseInt(n(287))/4+-parseInt(n(279))/5+-parseInt(n(272))/6*(-parseInt(n(274))/7)+parseInt(n(286))/8*(-parseInt(n(285))/9)+-parseInt(n(291))/10*(-parseInt(n(288))/11)===t)break;r.push(r.shift())}catch{r.push(r.shift())}})(rt,969445);async function it(e){let t=ot,{sourceWidth:n,sourceHeight:r}=at(e);if(e instanceof ImageData)return{kind:`rgba`,data:new Uint8ClampedArray(e[t(270)]),sourceWidth:n,sourceHeight:r};if(st()&&ct())try{return{kind:t(275),bitmap:await createImageBitmap(e),sourceWidth:n,sourceHeight:r}}catch{}return lt(e,n,r)}function at(e){let t=ot;return e instanceof ImageData?{sourceWidth:e[t(292)],sourceHeight:e.height}:e instanceof HTMLVideoElement?{sourceWidth:e[t(282)],sourceHeight:e.videoHeight}:e instanceof HTMLImageElement?{sourceWidth:e.naturalWidth,sourceHeight:e[t(273)]}:{sourceWidth:e[t(292)],sourceHeight:e[t(289)]}}function ot(e,t){return e-=270,rt()[e]}function st(){let e=ot;return typeof createImageBitmap===e(271)}function ct(){let e=ot;return typeof OffscreenCanvas===e(271)}function lt(e,t,n){let r=document.createElement(`canvas`),i=r.getContext(`2d`);if(!i)throw Error(`2D canvas context is not available.`);return r.width=t,r.height=n,i.drawImage(e,0,0,t,n),{kind:`rgba`,data:i.getImageData(0,0,t,n).data,sourceWidth:t,sourceHeight:n}}var ut=new Uint8Array([0,97,115,109,1,0,0,0,1,43,5,96,0,0,96,4,127,127,127,127,0,96,21,127,127,127,127,127,127,124,124,124,127,124,124,127,124,124,127,127,127,127,127,127,0,96,1,127,0,96,0,1,127,3,6,5,0,1,2,3,4,4,5,1,112,1,2,2,5,6,1,1,130,2,130,2,6,8,1,127,1,65,128,136,4,11,7,160,1,7,6,109,101,109,111,114,121,2,0,17,109,100,95,119,101,98,99,97,109,95,97,110,97,108,121,122,101,0,1,26,109,100,95,119,101,98,99,97,109,95,98,108,111,99,107,97,103,101,95,97,110,97,108,121,122,101,0,2,11,95,105,110,105,116,105,97,108,105,122,101,0,0,25,95,95,105,110,100,105,114,101,99,116,95,102,117,110,99,116,105,111,110,95,116,97,98,108,101,1,0,25,95,101,109,115,99,114,105,112,116,101,110,95,115,116,97,99,107,95,114,101,115,116,111,114,101,0,3,28,101,109,115,99,114,105,112,116,101,110,95,115,116,97,99,107,95,103,101,116,95,99,117,114,114,101,110,116,0,4,9,7,1,0,65,1,11,1,0,10,246,26,5,3,0,1,11,193,16,2,14,127,10,124,35,0,65,128,204,0,107,34,4,36,0,2,64,32,1,32,2,108,34,8,65,176,9,74,13,0,32,2,65,0,76,13,0,32,1,65,0,76,13,0,32,0,69,13,0,32,3,69,13,0,32,4,65,60,106,65,0,65,196,0,252,11,0,32,4,65,128,1,106,65,0,65,128,203,0,252,11,0,65,1,32,8,32,8,65,1,77,27,33,9,32,4,65,64,107,33,6,3,64,32,4,65,128,1,106,32,5,65,3,116,106,32,0,32,5,65,2,116,106,34,7,45,0,2,184,34,22,68,93,109,197,254,178,123,178,63,162,32,7,45,0,0,184,34,25,68,188,150,144,15,122,54,203,63,162,32,7,45,0,1,184,34,23,68,165,44,67,28,235,226,230,63,162,160,160,34,19,57,3,0,32,6,65,15,32,19,68,0,0,0,0,0,0,112,63,162,68,0,0,0,0,0,0,48,64,162,156,252,2,34,7,32,7,65,15,78,27,65,2,116,106,34,7,32,7,40,2,0,65,1,106,54,2,0,32,24,32,19,160,33,24,32,13,32,19,68,0,0,0,0,0,64,106,64,102,106,33,13,32,12,32,19,68,0,0,0,0,0,128,70,64,101,106,33,12,32,11,32,19,68,0,0,0,0,0,128,91,64,101,106,33,11,32,20,32,22,160,33,20,32,18,32,23,160,33,18,32,21,32,25,160,33,21,32,5,65,1,106,34,5,32,9,71,13,0,11,32,20,32,8,184,34,23,163,33,19,32,18,32,23,163,33,18,32,21,32,23,163,33,21,65,0,33,5,3,64,32,26,32,0,32,5,65,2,116,106,34,8,45,0,2,184,32,19,161,34,20,32,20,162,32,8,45,0,0,184,32,21,161,34,20,32,20,162,32,8,45,0,1,184,32,18,161,34,20,32,20,162,160,160,160,33,26,32,5,65,1,106,34,5,32,9,71,13,0,11,68,0,0,0,0,0,0,0,0,33,21,2,64,32,1,65,3,73,13,0,32,2,65,3,73,13,0,32,1,65,2,107,33,7,32,2,65,2,107,33,14,65,0,33,9,65,1,33,0,3,64,32,4,65,128,1,106,34,5,32,0,32,1,108,65,3,116,106,33,15,32,0,65,1,106,34,2,32,1,108,65,3,116,32,5,106,34,16,43,3,0,33,19,32,0,65,1,107,32,1,108,65,3,116,32,5,106,34,17,43,3,0,33,21,32,16,43,3,8,33,18,32,17,43,3,8,33,20,65,1,33,5,3,64,32,21,33,22,32,20,33,21,32,19,33,25,32,18,33,19,32,9,32,15,32,5,65,1,106,34,8,65,3,116,34,10,106,43,3,0,34,18,32,18,160,32,10,32,17,106,43,3,0,34,20,160,32,10,32,16,106,43,3,0,34,18,160,32,25,32,22,32,15,32,5,65,3,116,106,65,8,107,43,3,0,34,27,32,27,160,160,160,161,34,27,32,27,162,32,25,32,19,32,19,160,160,32,18,160,32,22,32,21,32,21,160,160,32,20,160,161,34,22,32,22,162,160,159,68,0,0,0,0,0,0,68,64,100,106,33,9,32,5,32,7,71,33,10,32,8,33,5,32,10,13,0,11,32,0,32,14,71,33,5,32,2,33,0,32,5,13,0,11,32,9,183,32,7,32,14,108,184,163,33,21,11,68,0,0,0,0,0,224,31,64,33,18,2,124,68,0,0,0,0,0,224,31,64,32,4,40,2,64,34,1,32,23,68,205,204,204,204,204,204,236,63,162,155,34,19,68,0,0,0,0,0,0,240,63,32,19,68,0,0,0,0,0,0,240,63,100,27,252,3,34,0,79,13,0,26,68,0,0,0,0,0,232,55,64,32,0,32,4,40,2,68,32,1,106,34,2,77,13,0,26,68,0,0,0,0,0,236,67,64,32,0,32,4,40,2,72,32,2,106,34,2,77,13,0,26,68,0,0,0,0,0,228,75,64,32,0,32,4,40,2,76,32,2,106,34,2,77,13,0,26,68,0,0,0,0,0,238,81,64,32,0,32,4,40,2,80,32,2,106,34,2,77,13,0,26,68,0,0,0,0,0,234,85,64,32,0,32,4,40,2,84,32,2,106,34,2,77,13,0,26,68,0,0,0,0,0,230,89,64,32,0,32,4,40,2,88,32,2,106,34,2,77,13,0,26,68,0,0,0,0,0,226,93,64,32,0,32,4,40,2,92,32,2,106,34,2,77,13,0,26,68,0,0,0,0,0,239,96,64,32,0,32,4,40,2,96,32,2,106,34,2,77,13,0,26,68,0,0,0,0,0,237,98,64,32,0,32,4,40,2,100,32,2,106,34,2,77,13,0,26,68,0,0,0,0,0,235,100,64,32,0,32,4,40,2,104,32,2,106,34,2,77,13,0,26,68,0,0,0,0,0,233,102,64,32,0,32,4,40,2,108,32,2,106,34,2,77,13,0,26,68,0,0,0,0,0,231,104,64,32,0,32,4,40,2,112,32,2,106,34,2,77,13,0,26,68,0,0,0,0,0,229,106,64,32,0,32,4,40,2,116,32,2,106,34,2,77,13,0,26,68,0,0,0,0,0,227,108,64,32,0,32,4,40,2,120,32,2,106,34,2,77,13,0,26,68,0,0,0,0,0,224,111,64,68,0,0,0,0,0,225,110,64,32,4,40,2,124,32,2,106,32,0,73,27,11,33,20,32,11,184,33,22,32,24,32,23,163,33,19,32,26,32,23,163,33,25,2,64,32,1,32,23,68,154,153,153,153,153,153,185,63,162,155,34,24,68,0,0,0,0,0,0,240,63,32,24,68,0,0,0,0,0,0,240,63,100,27,252,3,34,0,79,13,0,32,0,32,4,40,2,68,32,1,106,34,1,77,4,64,68,0,0,0,0,0,232,55,64,33,18,12,1,11,32,0,32,4,40,2,72,32,1,106,34,1,77,4,64,68,0,0,0,0,0,236,67,64,33,18,12,1,11,32,0,32,4,40,2,76,32,1,106,34,1,77,4,64,68,0,0,0,0,0,228,75,64,33,18,12,1,11,32,0,32,4,40,2,80,32,1,106,34,1,77,4,64,68,0,0,0,0,0,238,81,64,33,18,12,1,11,32,0,32,4,40,2,84,32,1,106,34,1,77,4,64,68,0,0,0,0,0,234,85,64,33,18,12,1,11,32,0,32,4,40,2,88,32,1,106,34,1,77,4,64,68,0,0,0,0,0,230,89,64,33,18,12,1,11,32,0,32,4,40,2,92,32,1,106,34,1,77,4,64,68,0,0,0,0,0,226,93,64,33,18,12,1,11,32,0,32,4,40,2,96,32,1,106,34,1,77,4,64,68,0,0,0,0,0,239,96,64,33,18,12,1,11,32,0,32,4,40,2,100,32,1,106,34,1,77,4,64,68,0,0,0,0,0,237,98,64,33,18,12,1,11,32,0,32,4,40,2,104,32,1,106,34,1,77,4,64,68,0,0,0,0,0,235,100,64,33,18,12,1,11,32,0,32,4,40,2,108,32,1,106,34,1,77,4,64,68,0,0,0,0,0,233,102,64,33,18,12,1,11,32,0,32,4,40,2,112,32,1,106,34,1,77,4,64,68,0,0,0,0,0,231,104,64,33,18,12,1,11,32,0,32,4,40,2,116,32,1,106,34,1,77,4,64,68,0,0,0,0,0,229,106,64,33,18,12,1,11,32,0,32,4,40,2,120,32,1,106,34,1,77,4,64,68,0,0,0,0,0,227,108,64,33,18,12,1,11,68,0,0,0,0,0,224,111,64,68,0,0,0,0,0,225,110,64,32,4,40,2,124,32,1,106,32,0,73,27,33,18,11,32,22,32,23,163,33,24,32,12,184,32,23,163,34,22,68,92,143,194,245,40,92,239,63,102,34,0,32,20,32,18,161,34,20,68,0,0,0,0,0,0,48,64,101,34,1,32,19,68,0,0,0,0,0,0,32,64,101,113,113,32,25,68,0,0,0,0,0,0,78,64,101,113,32,21,68,123,20,174,71,225,122,132,63,101,113,32,19,68,0,0,0,0,0,0,73,64,101,32,1,113,32,0,113,114,33,0,32,13,184,32,23,163,33,18,65,1,33,5,2,64,2,64,32,19,68,0,0,0,0,0,64,90,64,101,69,13,0,32,22,68,225,122,20,174,71,225,218,63,102,69,13,0,32,18,68,184,30,133,235,81,184,174,63,102,69,13,0,32,20,68,0,0,0,0,0,0,94,64,102,13,1,11,32,19,68,0,0,0,0,0,128,70,64,101,13,0,32,22,68,61,10,215,163,112,61,234,63,102,13,0,65,2,65,2,65,0,32,18,68,10,215,163,112,61,10,231,63,102,27,32,19,68,0,0,0,0,0,32,108,64,102,27,33,5,11,32,3,32,5,54,0,60,32,3,32,0,54,0,56,32,3,32,18,57,0,48,32,3,32,22,57,0,40,32,3,32,20,57,0,32,32,3,32,19,57,0,24,32,3,32,25,57,0,16,32,3,32,24,57,0,8,32,3,32,21,57,0,0,32,3,65,64,107,32,6,41,0,0,55,0,0,32,3,32,6,41,0,8,55,0,72,32,3,32,6,41,0,16,55,0,80,32,3,32,6,41,0,24,55,0,88,32,3,32,6,41,0,32,55,0,96,32,3,32,6,41,0,40,55,0,104,32,3,32,6,41,0,48,55,0,112,32,3,32,6,41,0,56,55,0,120,11,32,4,65,128,204,0,106,36,0,11,160,10,2,4,124,8,127,2,64,32,5,65,0,76,13,0,32,0,69,13,0,32,20,69,13,0,32,3,65,0,71,32,4,65,0,71,113,33,4,2,64,2,64,2,64,32,1,69,13,0,32,2,69,13,0,32,4,4,64,65,0,33,2,3,64,32,21,32,0,32,2,65,2,116,34,4,65,1,114,34,27,106,45,0,0,34,30,32,1,32,27,106,45,0,0,107,34,25,32,25,65,31,117,34,25,115,32,25,107,32,0,32,4,106,45,0,0,34,31,32,1,32,4,106,45,0,0,107,34,25,32,25,65,31,117,34,25,115,32,25,107,106,32,0,32,4,65,2,114,34,25,106,45,0,0,34,32,32,1,32,25,106,45,0,0,107,34,29,32,29,65,31,117,34,29,115,32,29,107,106,184,34,22,160,33,21,32,28,32,6,32,30,32,3,32,27,106,45,0,0,107,34,27,32,27,65,31,117,34,27,115,32,27,107,32,31,32,3,32,4,106,45,0,0,107,34,4,32,4,65,31,117,34,4,115,32,4,107,106,32,32,32,3,32,25,106,45,0,0,107,34,4,32,4,65,31,117,34,4,115,32,4,107,106,184,101,106,33,28,32,26,32,6,32,22,101,106,33,26,32,2,65,1,106,34,2,32,5,71,13,0,11,32,28,184,32,5,184,163,33,6,12,2,11,65,0,33,4,3,64,32,21,32,0,32,4,65,2,116,34,2,65,1,114,34,3,106,45,0,0,32,1,32,3,106,45,0,0,107,34,3,32,3,65,31,117,34,3,115,32,3,107,32,0,32,2,106,45,0,0,32,1,32,2,106,45,0,0,107,34,3,32,3,65,31,117,34,3,115,32,3,107,106,32,0,32,2,65,2,114,34,2,106,45,0,0,32,1,32,2,106,45,0,0,107,34,2,32,2,65,31,117,34,2,115,32,2,107,106,184,34,22,160,33,21,32,26,32,6,32,22,101,106,33,26,32,4,65,1,106,34,4,32,5,71,13,0,11,68,0,0,0,0,0,0,0,0,33,6,12,1,11,32,4,4,124,65,0,33,4,3,64,32,26,32,6,32,0,32,4,65,2,116,34,1,65,1,114,34,2,106,45,0,0,32,2,32,3,106,45,0,0,107,34,2,32,2,65,31,117,34,2,115,32,2,107,32,0,32,1,106,45,0,0,32,1,32,3,106,45,0,0,107,34,2,32,2,65,31,117,34,2,115,32,2,107,106,32,0,32,1,65,2,114,34,1,106,45,0,0,32,1,32,3,106,45,0,0,107,34,1,32,1,65,31,117,34,1,115,32,1,107,106,184,101,106,33,26,32,4,65,1,106,34,4,32,5,71,13,0,11,32,26,184,32,5,184,163,5,68,0,0,0,0,0,0,0,0,11,33,6,12,1,11,32,21,32,5,184,34,21,163,33,24,32,26,183,32,21,163,33,23,11,65,0,33,3,2,64,32,17,69,13,0,32,15,69,13,0,32,16,69,13,0,32,15,42,2,0,187,32,16,42,2,0,187,161,153,32,15,42,2,4,187,32,16,42,2,4,187,161,153,160,32,15,42,2,8,187,32,16,42,2,8,187,161,153,160,32,15,42,2,12,187,32,16,42,2,12,187,161,153,160,32,15,42,2,16,187,32,16,42,2,16,187,161,153,160,32,15,42,2,20,187,32,16,42,2,20,187,161,153,160,32,15,42,2,24,187,32,16,42,2,24,187,161,153,160,32,15,42,2,28,187,32,16,42,2,28,187,161,153,160,32,15,42,2,32,187,32,16,42,2,32,187,161,153,160,32,15,42,2,36,187,32,16,42,2,36,187,161,153,160,32,15,42,2,40,187,32,16,42,2,40,187,161,153,160,32,15,42,2,44,187,32,16,42,2,44,187,161,153,160,32,15,42,2,48,187,32,16,42,2,48,187,161,153,160,32,15,42,2,52,187,32,16,42,2,52,187,161,153,160,32,15,42,2,56,187,32,16,42,2,56,187,161,153,160,32,15,42,2,60,187,32,16,42,2,60,187,161,153,160,68,0,0,0,0,0,0,224,63,162,68,205,204,204,204,204,204,220,63,102,33,3,11,68,0,0,0,0,0,0,0,0,33,22,2,124,68,0,0,0,0,0,0,0,0,32,8,68,0,0,0,0,0,0,0,0,100,69,13,0,26,68,0,0,0,0,0,0,0,0,32,9,69,13,0,26,32,8,32,7,161,32,8,163,11,33,21,2,64,32,11,68,0,0,0,0,0,0,0,0,100,69,13,0,32,12,69,13,0,32,11,32,10,161,32,11,163,33,22,11,32,6,68,51,51,51,51,51,51,227,63,102,34,2,32,21,68,154,153,153,153,153,153,201,63,102,113,33,1,65,0,33,0,2,64,32,2,69,4,64,65,0,33,4,12,1,11,32,10,68,0,0,0,0,0,64,143,64,101,34,2,32,22,68,0,0,0,0,0,0,224,63,102,114,33,4,32,13,68,154,153,153,153,153,153,225,63,101,32,14,68,0,0,0,0,0,128,65,64,101,114,32,3,113,69,13,0,32,2,32,21,68,184,30,133,235,81,184,190,63,102,32,22,68,51,51,51,51,51,51,211,63,102,114,114,33,0,11,32,1,32,4,114,32,0,114,33,2,32,20,32,0,54,0,44,32,20,32,4,54,0,40,32,20,32,1,54,0,36,32,20,32,24,57,0,16,32,20,32,23,57,0,8,32,20,32,6,57,0,0,32,20,32,6,68,51,51,51,51,51,51,227,63,102,54,0,24,32,20,65,1,32,18,65,0,71,34,0,32,2,27,54,0,32,32,20,65,1,32,0,2,127,65,1,32,18,13,0,26,65,1,32,2,13,0,26,32,19,65,0,71,32,21,68,154,153,153,153,153,153,201,63,102,113,11,27,32,0,32,8,68,154,153,153,153,153,153,169,63,102,27,32,0,32,9,27,54,0,28,11,11,6,0,32,0,36,0,11,4,0,35,0,11]);(function(e,t){let n=ft,r=e();for(;;)try{if(-parseInt(n(201))/1+-parseInt(n(206))/2*(-parseInt(n(204))/3)+-parseInt(n(209))/4*(-parseInt(n(213))/5)+-parseInt(n(200))/6*(parseInt(n(199))/7)+parseInt(n(216))/8+-parseInt(n(202))/9+parseInt(n(211))/10===t)break;r.push(r.shift())}catch{r.push(r.shift())}})(dt,160220);function dt(){let e=[`edgeDensity`,`baselineLuminanceHistogram`,`1574699CKfrkp`,`6cUkbEZ`,`185420PvRUqj`,`32184yptJUf`,`baselineFrameData`,`3fxSIXE`,`getUint32`,`3766IMHZgJ`,`getFloat64`,`baselineEdgeDensity`,`16qzDANw`,`height`,`2085350ezyTgJ`,`data`,`298600ZqyYnl`,`image`,`memory`,`999000RuAbvw`,`exports`];return dt=function(){return e},dt()}function ft(e,t){return e-=199,dt()[e]}var pt=1048576,mt=1056768,ht=1064960,gt=1073152,_t=1081344,vt=1081472,yt=1081600,bt=new class{exports;constructor(){let e=ft,t=new WebAssembly.Module(ut),n=new WebAssembly.Instance(t,{});this[e(217)]=n.exports}analyze(e){let t=ft,n=e.width*e.height;new Uint8Array(this.exports.memory.buffer).set(e.data,pt),this.exports.md_webcam_analyze(pt,e.width,e[t(210)],mt);let r=new DataView(this.exports.memory.buffer),i=new Uint16Array(16),a=new Float32Array(16);for(let e=0;e<i.length;e+=1){let o=r[t(205)](1056832+e*4,!0);i[e]=o,a[e]=o/n}return{edgeDensity:r[t(207)](1056768,!0),coverage:r.getFloat64(1056776,!0),colorVariance:r.getFloat64(1056784,!0),averageLuminance:r.getFloat64(1056792,!0),luminanceSpread:r.getFloat64(1056800,!0),luminanceHistogram:i,normalizedLuminanceHistogram:a,darkRatio:r.getFloat64(1056808,!0),brightRatio:r.getFloat64(1056816,!0),blackout:r.getUint32(1056824,!0)!==0,lightingIssueCode:r[t(205)](1056828,!0)}}analyzeBlockage(e){let t=ft,n=new Uint8Array(this.exports.memory.buffer),r=new DataView(this.exports[t(215)].buffer),i=e[t(214)].width*e.image[t(210)];return n.set(e.image[t(212)],pt),e.previousFrameData&&n.set(e.previousFrameData,ht),e.baselineFrameData&&n.set(e[t(203)],gt),xt(r,_t,e.normalizedLuminanceHistogram),e.baselineLuminanceHistogram&&xt(r,vt,e[t(219)]),this.exports.md_webcam_blockage_analyze(pt,ht,+!!e.previousFrameData,gt,+!!e.baselineFrameData,i,e.pixelChangeThreshold,e[t(218)],e[t(208)]??0,e[t(208)]===void 0?0:1,e.colorVariance,e.baselineColorVariance??0,e.baselineColorVariance===void 0?0:1,e.luminanceEntropy,e.luminanceSpread,_t,vt,+!!e.baselineLuminanceHistogram,+!!e.blackout,+!!e.currentlyBlocked,yt),{changedCoverage:r.getFloat64(1081600,!0),previousChangedCoverage:r[t(207)](1081608,!0),frameNoiseAverage:r[t(207)](1081616,!0),hasCoveredArea:r.getUint32(1081624,!0)!==0,detected:r.getUint32(1081628,!0)!==0,likelyCovered:r[t(205)](1081632,!0)!==0}}};function xt(e,t,n){for(let r=0;r<n.length;r+=1)e.setFloat32(t+r*Float32Array.BYTES_PER_ELEMENT,n[r],!0)}var St=wt;(function(e,t){let n=wt,r=e();for(;;)try{if(-parseInt(n(289))/1+-parseInt(n(280))/2+parseInt(n(277))/3+-parseInt(n(290))/4+-parseInt(n(279))/5*(parseInt(n(293))/6)+parseInt(n(292))/7+-parseInt(n(278))/8*(-parseInt(n(282))/9)===t)break;r.push(r.shift())}catch{r.push(r.shift())}})(Ct,695874);function Ct(){let e=[`1382585AxncCa`,`3000888zJNNTT`,`getContext`,`5184620TrsuRy`,`362514WXrkZU`,`darkRatio`,`2084343ZAswfR`,`2328ziErcU`,`105TveqQK`,`2202928FJYcZM`,`log2`,`116397hhLfbW`,`height`,`width`,`luminanceSpread`,`coverage`,`edgeDensity`,`analyze`];return Ct=function(){return e},Ct()}function wt(e,t){return e-=277,Ct()[e]}var Tt=class{context;constructor(){let{context:e}=Ot(`Failed to create webcam frame analysis canvas.`);this.context=e}[St(288)](e){return Et(Dt(this.context,e))}};function Et(e){let t=St,n=e.width*e[t(283)],r=bt.analyze(e);return{image:e,pixelCount:n,edgeDensity:r[t(287)],coverage:r[t(286)],colorVariance:r.colorVariance,averageLuminance:r.averageLuminance,luminanceSpread:r[t(285)],luminanceEntropy:At(r.normalizedLuminanceHistogram),luminanceHistogram:r.luminanceHistogram,normalizedLuminanceHistogram:r.normalizedLuminanceHistogram,darkRatio:r[t(294)],brightRatio:r.brightRatio,blackout:r.blackout,lightingIssueCode:r.lightingIssueCode}}function Dt(e,t){return e.drawImage(t,0,0,40,30),e.getImageData(0,0,40,30)}function Ot(e){let t=St,n=document.createElement(`canvas`);n[t(284)]=40,n[t(283)]=30;let r=n[t(291)](`2d`,{willReadFrequently:!0});if(!r)throw Error(e);return{canvas:n,context:r}}function kt(e){return e.blackout}function At(e){let t=St,n=0;for(let r of e)r>0&&(n-=r*Math[t(281)](r));return n/Math[t(281)](e.length)}var jt=Nt;(function(e,t){let n=Nt,r=e();for(;;)try{if(-parseInt(n(360))/1*(-parseInt(n(379))/2)+-parseInt(n(362))/3*(parseInt(n(363))/4)+parseInt(n(358))/5*(-parseInt(n(381))/6)+parseInt(n(383))/7+-parseInt(n(395))/8*(-parseInt(n(392))/9)+parseInt(n(394))/10*(parseInt(n(375))/11)+parseInt(n(377))/12===t)break;r.push(r.shift())}catch{r.push(r.shift())}})(Mt,825221);function Mt(){let e=`calibrated.9005850zbNmSi.refreshBaseline.previousFrameData.colorVariance.push.baselineColorVariance.baselineLuminanceHistogram.reset.hasCoveredArea.15894fwkCKY.smoothEdgeDensity.10VqiZFV.1496Xdeskt.smoothedEdgeDensity.startedAt.baselineFrameData.blocked.533635kpMoGq.edgeDensity.1kznuME.baselineEdgeDensityUpdatedAt.969GPHIoL.7472ckgSMW.normalizedLuminanceHistogram.blockedStartedAt.smoothedEdgeDensityUpdatedAt.calibrationNoiseSamples.finalizeCalibration.data.frameNoiseAverage.now.adaptivePixelChangeThreshold.luminanceEntropy.reduce.1003651BCAasW.baselineEdgeDensity.2851920QLUATl.min.1954140viiGtS.image.84mTZrAQ`.split(`.`);return Mt=function(){return e},Mt()}function Nt(e,t){return e-=358,Mt()[e]}var Pt=60,Ft=30,It=90,Lt=4,Rt=100,zt=650,Bt=2e3,Vt=2,Ht=2e3,Ut=class{[jt(385)];baselineFrameData;baselineEdgeDensity;[jt(361)];baselineColorVariance;[jt(389)];smoothedEdgeDensity;smoothedEdgeDensityUpdatedAt;blocked=!1;blockedStartedAt;baselineRefreshPending=!1;clearSampleCount=0;[jt(397)]=Date.now();[jt(382)]=!1;calibrationNoiseSamples=[];[jt(372)]=Pt;analyze(e){let t=jt,n=e.image,r=Date.now(),i=r-this[t(397)]<Ht,a=this[t(393)](e[t(359)],r),o=bt.analyzeBlockage({image:n,previousFrameData:this[t(385)],baselineFrameData:this[t(398)],pixelChangeThreshold:this.adaptivePixelChangeThreshold,edgeDensity:a,baselineEdgeDensity:this[t(376)],colorVariance:e.colorVariance,baselineColorVariance:this[t(388)],luminanceEntropy:e[t(373)],luminanceSpread:e.luminanceSpread,normalizedLuminanceHistogram:e.normalizedLuminanceHistogram,baselineLuminanceHistogram:this[t(389)],blackout:kt(e),currentlyBlocked:this.blocked});return i&&this.previousFrameData?this.calibrationNoiseSamples[t(387)](o[t(370)]):!i&&!this.calibrated&&this[t(368)](),this.previousFrameData=new Uint8ClampedArray(n[t(369)]),!this[t(398)]&&(this[t(398)]=new Uint8ClampedArray(n.data),this.baselineEdgeDensity=a,this.baselineEdgeDensityUpdatedAt=r,this.baselineColorVariance=e.colorVariance,this.baselineLuminanceHistogram=e[t(364)]),i?(this.blockedStartedAt=void 0,this.clearSampleCount=0):o.detected?(this.blockedStartedAt??=r,this.clearSampleCount=0):(this.clearSampleCount+=1,this.blockedStartedAt=void 0),!this.blocked&&this[t(365)]!==void 0&&r-this.blockedStartedAt>=Bt&&(this.blocked=!0),this.blocked&&this.clearSampleCount>=Vt&&(this.blocked=!1,this.baselineRefreshPending=!0),(i||!this[t(399)]&&!this.baselineRefreshPending&&!o.detected&&!o[t(391)])&&(this.baselineFrameData=new Uint8ClampedArray(n[t(369)]),this.updateBaselineEdgeDensity(a,r),this.baselineColorVariance=e[t(386)],this[t(389)]=e.normalizedLuminanceHistogram),{blocked:i?!1:this.blocked,suspected:!i&&(this.blocked||this[t(365)]!==void 0),likelyCovered:!i&&(this.blocked||o.likelyCovered),changedCoverage:o.changedCoverage}}[jt(390)](){let e=jt;this.previousFrameData=void 0,this.baselineFrameData=void 0,this.baselineEdgeDensity=void 0,this.baselineEdgeDensityUpdatedAt=void 0,this.baselineColorVariance=void 0,this[e(389)]=void 0,this[e(396)]=void 0,this.smoothedEdgeDensityUpdatedAt=void 0,this.blocked=!1,this.blockedStartedAt=void 0,this.baselineRefreshPending=!1,this.clearSampleCount=0,this.startedAt=Date[e(371)](),this[e(382)]=!1,this[e(367)]=[],this.adaptivePixelChangeThreshold=Pt}needsBaselineRefresh(){return this.baselineRefreshPending}[jt(384)](e){let t=jt,n=e[t(380)],r=Date[t(371)](),i=this.smoothEdgeDensity(e.edgeDensity,r);this[t(385)]=new Uint8ClampedArray(n.data),this[t(398)]=new Uint8ClampedArray(n.data),this.baselineEdgeDensity=i,this.baselineEdgeDensityUpdatedAt=r,this.baselineColorVariance=e.colorVariance,this.baselineLuminanceHistogram=e.normalizedLuminanceHistogram,this.blocked=!1,this.blockedStartedAt=void 0,this.baselineRefreshPending=!1,this.clearSampleCount=0}[jt(368)](){let e=jt;if(this[e(382)]=!0,this.calibrationNoiseSamples.length===0)return;let t=this.calibrationNoiseSamples[e(374)]((e,t)=>e+t,0)/this.calibrationNoiseSamples.length;this.adaptivePixelChangeThreshold=Math[e(378)](It,Math.max(Ft,t*Lt))}smoothEdgeDensity(e,t){let n=jt;if(this.smoothedEdgeDensity===void 0)return this.smoothedEdgeDensity=e,this.smoothedEdgeDensityUpdatedAt=t,e;let r=t-(this.smoothedEdgeDensityUpdatedAt??t),i=1-Math.exp(-r/Rt);return this.smoothedEdgeDensity=this.smoothedEdgeDensity*(1-i)+e*i,this[n(366)]=t,this[n(396)]}updateBaselineEdgeDensity(e,t){if(this.baselineEdgeDensity===void 0){this.baselineEdgeDensity=e,this.baselineEdgeDensityUpdatedAt=t;return}let n=t-(this.baselineEdgeDensityUpdatedAt??t),r=1-Math.exp(-n/zt);this.baselineEdgeDensity=this.baselineEdgeDensity*(1-r)+e*r,this.baselineEdgeDensityUpdatedAt=t}},Wt=Gt;(function(e,t){let n=Gt,r=e();for(;;)try{if(parseInt(n(446))/1+-parseInt(n(448))/2*(parseInt(n(443))/3)+-parseInt(n(433))/4+parseInt(n(441))/5+-parseInt(n(434))/6+parseInt(n(438))/7+-parseInt(n(436))/8*(-parseInt(n(437))/9)===t)break;r.push(r.shift())}catch{r.push(r.shift())}})(Kt,504335);function Gt(e,t){return e-=432,Kt()[e]}function Kt(){let e=[`5598492nTmIJw`,`analyze`,`100784DOLCbV`,`657vgJpvk`,`1308727jmRJGw`,`issueStartedAt`,`now`,`1456885mGCJQP`,`lightingIssueCode`,`3TNvmmQ`,`pendingIssue`,`detectIssue`,`638500yTXZce`,`activeIssue`,`311132RbSCWb`,`brightRatio`,`1774036FycVHA`];return Kt=function(){return e},Kt()}var qt=2e3,Jt=1500,Yt=2e3,Xt=class{startedAt=Date.now();issueStartedAt;clearStartedAt;pendingIssue;activeIssue;[Wt(435)](e){let t=Wt,n=Date[t(440)](),r=n-this.startedAt<qt,i=kt(e),a=i?void 0:this[t(445)](e);return r||i?(this.issueStartedAt=void 0,this.clearStartedAt=void 0,this[t(444)]=void 0,this[t(447)]=void 0):a?(this.pendingIssue!==a&&(this[t(444)]=a,this.issueStartedAt=n),this.clearStartedAt=void 0,this[t(439)]!==void 0&&n-this.issueStartedAt>=Jt&&(this[t(447)]=a)):(this.pendingIssue=void 0,this.issueStartedAt=void 0,this.clearStartedAt??=n,n-this.clearStartedAt>=Yt&&(this[t(447)]=void 0)),{issue:r?void 0:this[t(447)]??a,active:!r&&this.activeIssue!==void 0,averageLuminance:e.averageLuminance,luminanceSpread:e.luminanceSpread,luminanceEntropy:e.luminanceEntropy,darkRatio:e.darkRatio,brightRatio:e[t(432)]}}reset(){let e=Wt;this.startedAt=Date.now(),this.issueStartedAt=void 0,this.clearStartedAt=void 0,this.pendingIssue=void 0,this[e(447)]=void 0}detectIssue(e){let t=Wt;if(e[t(442)]===1)return`tooDark`;if(e[t(442)]===2)return`tooBright`}},Zt=typeof self<`u`?self:{};function Qt(e,t){t:{for(var n=[`CLOSURE_FLAGS`],r=Zt,i=0;i<n.length;i++)if((r=r[n[i]])==null){n=null;break t}n=r}return(e=n&&n[e])??t}function $t(){throw Error(`Invalid UTF8`)}function en(e,t){return t=String.fromCharCode.apply(null,t),e==null?t:e+t}var tn,nn,rn=typeof TextDecoder<`u`,an,on=typeof TextEncoder<`u`;function sn(e){if(on)e=(an||=new TextEncoder).encode(e);else{let n=0,r=new Uint8Array(3*e.length);for(let i=0;i<e.length;i++){var t=e.charCodeAt(i);if(t<128)r[n++]=t;else{if(t<2048)r[n++]=t>>6|192;else{if(t>=55296&&t<=57343){if(t<=56319&&i<e.length){let a=e.charCodeAt(++i);if(a>=56320&&a<=57343){t=1024*(t-55296)+a-56320+65536,r[n++]=t>>18|240,r[n++]=t>>12&63|128,r[n++]=t>>6&63|128,r[n++]=63&t|128;continue}i--}t=65533}r[n++]=t>>12|224,r[n++]=t>>6&63|128}r[n++]=63&t|128}}e=n===r.length?r:r.subarray(0,n)}return e}function cn(e){Zt.setTimeout((()=>{throw e}),0)}var ln,un=Qt(610401301,!1),dn=Qt(748402147,!0);function fn(){var e=Zt.navigator;return(e&&=e.userAgent)?e:``}var pn=Zt.navigator;function mn(e){return mn[` `](e),e}ln=pn&&pn.userAgentData||null,mn[` `]=function(){};var hn={},gn=null;function _n(e){let t=e.length,n=3*t/4;n%3?n=Math.floor(n):`=.`.indexOf(e[t-1])!=-1&&(n=`=.`.indexOf(e[t-2])==-1?n-1:n-2);let r=new Uint8Array(n),i=0;return function(e,t){function n(t){for(;r<e.length;){let t=e.charAt(r++),n=gn[t];if(n!=null)return n;if(!/^[\s\xa0]*$/.test(t))throw Error(`Unknown base64 encoding at char: `+t)}return t}vn();let r=0;for(;;){let e=n(-1),r=n(0),i=n(64),a=n(64);if(a===64&&e===-1)break;t(e<<2|r>>4),i!=64&&(t(r<<4&240|i>>2),a!=64&&t(i<<6&192|a))}}(e,(function(e){r[i++]=e})),i===n?r:r.subarray(0,i)}function vn(){if(!gn){gn={};var e=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789`.split(``),t=[`+/=`,`+/`,`-_=`,`-_.`,`-_`];for(let n=0;n<5;n++){let r=e.concat(t[n].split(``));hn[n]=r;for(let e=0;e<r.length;e++){let t=r[e];gn[t]===void 0&&(gn[t]=e)}}}}var yn=typeof Uint8Array<`u`,bn=!(!(un&&ln&&ln.brands.length>0)&&(fn().indexOf(`Trident`)!=-1||fn().indexOf(`MSIE`)!=-1))&&typeof btoa==`function`,xn=/[-_.]/g,Sn={"-":`+`,_:`/`,".":`=`};function Cn(e){return Sn[e]||``}function wn(e){if(!bn)return _n(e);e=xn.test(e)?e.replace(xn,Cn):e,e=atob(e);let t=new Uint8Array(e.length);for(let n=0;n<e.length;n++)t[n]=e.charCodeAt(n);return t}function Tn(e){return yn&&e!=null&&e instanceof Uint8Array}var En={};function Dn(){return An||=new kn(null,En)}function On(e){Mn(En);var t=e.g;return(t=t==null||Tn(t)?t:typeof t==`string`?wn(t):null)==null?t:e.g=t}var kn=class{h(){return new Uint8Array(On(this)||0)}constructor(e,t){if(Mn(t),this.g=e,e!=null&&e.length===0)throw Error(`ByteString should be constructed with non-empty values`)}},An,jn;function Mn(e){if(e!==En)throw Error(`illegal external caller`)}function Nn(e,t){e.__closure__error__context__984382||={},e.__closure__error__context__984382.severity=t}function Pn(e){return Nn(e=Error(e),`warning`),e}function Fn(e,t){if(e!=null){var n=jn??={},r=n[e]||0;r>=t||(n[e]=r+1,Nn(e=Error(),`incident`),cn(e))}}function In(){return typeof BigInt==`function`}var Ln=typeof Symbol==`function`&&typeof Symbol()==`symbol`;function Rn(e,t,n=!1){return typeof Symbol==`function`&&typeof Symbol()==`symbol`?n&&Symbol.for&&e?Symbol.for(e):e==null?Symbol():Symbol(e):t}var zn=Rn(`jas`,void 0,!0),Bn=Rn(void 0,`0di`),Vn=Rn(void 0,`1oa`),Hn=Rn(void 0,Symbol()),Un=Rn(void 0,`0ub`),Wn=Rn(void 0,`0ubs`),Gn=Rn(void 0,`0ubsb`),Kn=Rn(void 0,`0actk`),qn=Rn(`m_m`,`Pa`,!0),Jn=Rn(),Yn={Ga:{value:0,configurable:!0,writable:!0,enumerable:!1}},Xn=Object.defineProperties,m=Ln?zn:`Ga`,Zn,Qn=[];function $n(e,t){Ln||m in e||Xn(e,Yn),e[m]|=t}function h(e,t){Ln||m in e||Xn(e,Yn),e[m]=t}function er(e){return $n(e,34),e}function tr(e){return $n(e,8192),e}h(Qn,7),Zn=Object.freeze(Qn);var nr={};function rr(e,t){return t===void 0?e.h!==ir&&!!(2&(0|e.v[m])):!!(2&t)&&e.h!==ir}var ir={};function ar(e,t){if(e!=null){if(typeof e==`string`)e=e?new kn(e,En):Dn();else if(e.constructor!==kn)if(Tn(e))e=e.length?new kn(new Uint8Array(e),En):Dn();else{if(!t)throw Error();e=void 0}}return e}var or=class{constructor(e,t,n){this.g=e,this.h=t,this.l=n}next(){let e=this.g.next();return e.done||(e.value=this.h.call(this.l,e.value)),e}[Symbol.iterator](){return this}},sr=Object.freeze({});function cr(e,t,n){let r=128&t?0:-1,i=e.length;var a;(a=!!i)&&(a=(a=e[i-1])!=null&&typeof a==`object`&&a.constructor===Object);let o=i+(a?-1:0);for(t=128&t?1:0;t<o;t++)n(t-r,e[t]);if(a){e=e[i-1];for(let t in e)!isNaN(t)&&n(+t,e[t])}}var lr={};function ur(e){return 128&e?lr:void 0}function dr(e){return e.Na=!0,e}var fr=dr((e=>typeof e==`number`)),pr=dr((e=>typeof e==`string`)),mr=dr((e=>typeof e==`boolean`)),hr=typeof Zt.BigInt==`function`&&typeof Zt.BigInt(0)==`bigint`;function gr(e){var t=e;if(pr(t)){if(!/^\s*(?:-?[1-9]\d*|0)?\s*$/.test(t))throw Error(String(t))}else if(fr(t)&&!Number.isSafeInteger(t))throw Error(String(t));return hr?BigInt(e):e=mr(e)?e?`1`:`0`:pr(e)?e.trim()||`0`:String(e)}var _r=dr((e=>hr?e>=yr&&e<=xr:e[0]===`-`?Sr(e,vr):Sr(e,br))),vr=(-(2**53-1)).toString(),yr=hr?BigInt(-(2**53-1)):void 0,br=(2**53-1).toString(),xr=hr?BigInt(2**53-1):void 0;function Sr(e,t){if(e.length>t.length)return!1;if(e.length<t.length||e===t)return!0;for(let n=0;n<e.length;n++){let r=e[n],i=t[n];if(r>i)return!1;if(r<i)return!0}}var Cr=typeof Uint8Array.prototype.slice==`function`,wr,g=0,_=0;function Tr(e){let t=e>>>0;g=t,_=(e-t)/4294967296>>>0}function Er(e){if(e<0){Tr(-e);let[t,n]=Fr(g,_);g=t>>>0,_=n>>>0}else Tr(e)}function Dr(e){let t=wr||=new DataView(new ArrayBuffer(8));t.setFloat32(0,+e,!0),_=0,g=t.getUint32(0,!0)}function Or(e,t){let n=4294967296*t+(e>>>0);return Number.isSafeInteger(n)?n:jr(e,t)}function kr(e,t){return gr(In()?BigInt.asUintN(64,(BigInt(t>>>0)<<BigInt(32))+BigInt(e>>>0)):jr(e,t))}function Ar(e,t){return In()?gr(BigInt.asIntN(64,(BigInt.asUintN(32,BigInt(t))<<BigInt(32))+BigInt.asUintN(32,BigInt(e)))):gr(Nr(e,t))}function jr(e,t){if(e>>>=0,(t>>>=0)<=2097151)var n=``+(4294967296*t+e);else In()?n=``+(BigInt(t)<<BigInt(32)|BigInt(e)):(e=(16777215&e)+6777216*(n=16777215&(e>>>24|t<<8))+6710656*(t=t>>16&65535),n+=8147497*t,t*=2,e>=1e7&&(n+=e/1e7>>>0,e%=1e7),n>=1e7&&(t+=n/1e7>>>0,n%=1e7),n=t+Mr(n)+Mr(e));return n}function Mr(e){return e=String(e),`0000000`.slice(e.length)+e}function Nr(e,t){if(2147483648&t)if(In())e=``+(BigInt(0|t)<<BigInt(32)|BigInt(e>>>0));else{let[n,r]=Fr(e,t);e=`-`+jr(n,r)}else e=jr(e,t);return e}function Pr(e){if(e.length<16)Er(Number(e));else if(In())e=BigInt(e),g=Number(e&BigInt(4294967295))>>>0,_=Number(e>>BigInt(32)&BigInt(4294967295));else{let t=+(e[0]===`-`);_=g=0;let n=e.length;for(let r=t,i=(n-t)%6+t;i<=n;r=i,i+=6){let t=Number(e.slice(r,i));_*=1e6,g=1e6*g+t,g>=4294967296&&(_+=Math.trunc(g/4294967296),_>>>=0,g>>>=0)}if(t){let[e,t]=Fr(g,_);g=e,_=t}}}function Fr(e,t){return t=~t,e?e=1+~e:t+=1,[e,t]}function Ir(e){return Array.prototype.slice.call(e)}var Lr=typeof BigInt==`function`?BigInt.asIntN:void 0,Rr=typeof BigInt==`function`?BigInt.asUintN:void 0,zr=Number.isSafeInteger,Br=Number.isFinite,Vr=Math.trunc,Hr=gr(0);function Ur(e){if(e!=null&&typeof e!=`number`)throw Error(`Value of float/double field must be a number, found ${typeof e}: ${e}`);return e}function Wr(e){return e==null||typeof e==`number`?e:e===`NaN`||e===`Infinity`||e===`-Infinity`?Number(e):void 0}function Gr(e){if(e!=null&&typeof e!=`boolean`){var t=typeof e;throw Error(`Expected boolean but got ${t==`object`?e?Array.isArray(e)?`array`:t:`null`:t}: ${e}`)}return e}function Kr(e){return e==null||typeof e==`boolean`?e:typeof e==`number`?!!e:void 0}var qr=/^-?([1-9][0-9]*|0)(\.[0-9]+)?$/;function Jr(e){switch(typeof e){case`bigint`:return!0;case`number`:return Br(e);case`string`:return qr.test(e);default:return!1}}function Yr(e){if(e==null)return e;if(typeof e==`string`&&e)e=+e;else if(typeof e!=`number`)return;return Br(e)?0|e:void 0}function Xr(e){if(e==null)return e;if(typeof e==`string`&&e)e=+e;else if(typeof e!=`number`)return;return Br(e)?e>>>0:void 0}function Zr(e){let t=e.length;return(e[0]===`-`?t<20||t===20&&e<=`-9223372036854775808`:t<19||t===19&&e<=`9223372036854775807`)?e:(Pr(e),Nr(g,_))}function Qr(e){if(e=Vr(e),!zr(e)){Er(e);var t=g,n=_;(e=2147483648&n)&&(n=~n>>>0,(t=1+~t>>>0)==0&&(n=n+1>>>0)),e=typeof(t=Or(t,n))==`number`?e?-t:t:e?`-`+t:t}return e}function $r(e){var t=Vr(Number(e));return zr(t)?String(t):((t=e.indexOf(`.`))!==-1&&(e=e.substring(0,t)),Zr(e))}function ei(e){var t=Vr(Number(e));return zr(t)?gr(t):((t=e.indexOf(`.`))!==-1&&(e=e.substring(0,t)),In()?gr(Lr(64,BigInt(e))):gr(Zr(e)))}function ti(e){return zr(e)?e=gr(Qr(e)):(e=Vr(e),zr(e)?e=String(e):(Er(e),e=Nr(g,_)),e=gr(e)),e}function ni(e){let t=typeof e;return e==null?e:t===`bigint`?gr(Lr(64,e)):Jr(e)?t===`string`?ei(e):ti(e):void 0}function ri(e){if(typeof e!=`string`)throw Error();return e}function ii(e){if(e!=null&&typeof e!=`string`)throw Error();return e}function v(e){return e==null||typeof e==`string`?e:void 0}function ai(e,t,n,r){return e!=null&&e[qn]===nr?e:Array.isArray(e)?((r=(n=0|e[m])|32&r|2&r)!==n&&h(e,r),new t(e)):(n?2&r?((e=t[Bn])||(er((e=new t).v),e=t[Bn]=e),t=e):t=new t:t=void 0,t)}function oi(e,t,n){if(t)t:{if(!Jr(t=e))throw Pn(`int64`);switch(typeof t){case`string`:t=ei(t);break t;case`bigint`:t=gr(Lr(64,t));break t;default:t=ti(t)}}else t=ni(e);return(e=t)??(n?Hr:void 0)}var si={},ci=function(){try{return mn(new class extends Map{constructor(){super()}}),!1}catch{return!0}}(),li=class{constructor(){this.g=new Map}get(e){return this.g.get(e)}set(e,t){return this.g.set(e,t),this.size=this.g.size,this}delete(e){return e=this.g.delete(e),this.size=this.g.size,e}clear(){this.g.clear(),this.size=this.g.size}has(e){return this.g.has(e)}entries(){return this.g.entries()}keys(){return this.g.keys()}values(){return this.g.values()}forEach(e,t){return this.g.forEach(e,t)}[Symbol.iterator](){return this.entries()}},ui=ci?(Object.setPrototypeOf(li.prototype,Map.prototype),Object.defineProperties(li.prototype,{size:{value:0,configurable:!0,enumerable:!0,writable:!0}}),li):class extends Map{constructor(){super()}};function di(e){return e}function fi(e){if(2&e.J)throw Error(`Cannot mutate an immutable Map`)}var pi=class extends ui{constructor(e,t,n=di,r=di){super(),this.J=0|e[m],this.K=t,this.S=n,this.fa=this.K?mi:r;for(let i=0;i<e.length;i++){let a=e[i],o=n(a[0],!1,!0),s=a[1];t?s===void 0&&(s=null):s=r(a[1],!1,!0,void 0,void 0,this.J),super.set(o,s)}}V(e){return tr(Array.from(super.entries(),e))}clear(){fi(this),super.clear()}delete(e){return fi(this),super.delete(this.S(e,!0,!1))}entries(){if(this.K){var e=super.keys();e=new or(e,hi,this)}else e=super.entries();return e}values(){if(this.K){var e=super.keys();e=new or(e,pi.prototype.get,this)}else e=super.values();return e}forEach(e,t){this.K?super.forEach(((n,r,i)=>{e.call(t,i.get(r),r,i)})):super.forEach(e,t)}set(e,t){return fi(this),(e=this.S(e,!0,!1))==null?this:t==null?(super.delete(e),this):super.set(e,this.fa(t,!0,!0,this.K,!1,this.J))}Ma(e){let t=this.S(e[0],!1,!0);e=e[1],e=this.K?e===void 0?null:e:this.fa(e,!1,!0,void 0,!1,this.J),super.set(t,e)}has(e){return super.has(this.S(e,!1,!1))}get(e){e=this.S(e,!1,!1);let t=super.get(e);if(t!==void 0){var n=this.K;return n?((n=this.fa(t,!1,!0,n,this.ra,this.J))!==t&&super.set(e,n),n):t}}[Symbol.iterator](){return this.entries()}};function mi(e,t,n,r,i,a){return e=ai(e,r,n,a),i&&(e=Ii(e)),e}function hi(e){return[e,this.get(e)]}var gi;function _i(){return gi||=new pi(er([]),void 0,void 0,void 0,si)}function vi(e){return Hn?e[Hn]:void 0}function yi(e,t){for(let n in e)!isNaN(n)&&t(e,+n,e[n])}pi.prototype.toJSON=void 0;var bi=class{},xi={Ka:!0};function Si(e,t){t<100||Fn(Wn,1)}function Ci(e,t,n,r){let i=r!==void 0;r=!!r;var a,o=Hn;!i&&Ln&&o&&(a=e[o])&&yi(a,Si),o=[];var s=e.length;let c;a=4294967295;let l=!1,u=!!(64&t),d=u?128&t?0:-1:void 0;1&t||(c=s&&e[s-1],typeof c==`object`&&c&&c.constructor===Object?a=--s:c=void 0,!u||128&t||i||(l=!0,a=a-d+d)),t=void 0;for(var ee=0;ee<s;ee++){let i=e[ee];if(i!=null&&(i=n(i,r))!=null)if(u&&ee>=a){let e=ee-d;(t??={})[e]=i}else o[ee]=i}if(c)for(let e in c){if((s=c[e])==null||(s=n(s,r))==null)continue;let i;ee=+e,u&&!Number.isNaN(ee)&&(i=ee+d)<a?o[i]=s:(t??={})[e]=s}return t&&(l?o.push(t):o[a]=t),i&&Hn&&(e=vi(e))&&e instanceof bi&&(o[Hn]=function(e){let t=new bi;return yi(e,((e,n,r)=>{t[n]=Ir(r)})),t.da=e.da,t}(e)),o}function wi(e){return e[0]=Ti(e[0]),e[1]=Ti(e[1]),e}function Ti(e){switch(typeof e){case`number`:return Number.isFinite(e)?e:``+e;case`bigint`:return _r(e)?Number(e):``+e;case`boolean`:return+!!e;case`object`:if(Array.isArray(e)){var t=0|e[m];return e.length===0&&1&t?void 0:Ci(e,t,Ti)}if(e!=null&&e[qn]===nr)return Oi(e);if(e instanceof kn){if((t=e.g)==null)e=``;else if(typeof t==`string`)e=t;else{if(bn){for(var n=``,r=0,i=t.length-10240;r<i;)n+=String.fromCharCode.apply(null,t.subarray(r,r+=10240));n+=String.fromCharCode.apply(null,r?t.subarray(r):t),t=btoa(n)}else{n===void 0&&(n=0),vn(),n=hn[n],r=Array(Math.floor(t.length/3)),i=n[64]||``;let e=0,l=0;for(;e<t.length-2;e+=3){var a=t[e],o=t[e+1],s=t[e+2],c=n[a>>2];a=n[(3&a)<<4|o>>4],o=n[(15&o)<<2|s>>6],s=n[63&s],r[l++]=c+a+o+s}switch(c=0,s=i,t.length-e){case 2:s=n[(15&(c=t[e+1]))<<2]||i;case 1:t=t[e],r[l]=n[t>>2]+n[(3&t)<<4|c>>4]+s+i}t=r.join(``)}e=e.g=t}return e}return e instanceof pi?e=e.size===0?void 0:e.V(wi):void 0}return e}var Ei,Di;function Oi(e){return Ci(e=e.v,0|e[m],Ti)}function ki(e,t){return Ai(e,t[0],t[1])}function Ai(e,t,n,r=0){if(e==null){var i=32;n?(e=[n],i|=128):e=[],t&&(i=-16760833&i|(1023&t)<<14)}else{if(!Array.isArray(e))throw Error(`narr`);if(i=0|e[m],dn&&1&i)throw Error(`rfarr`);if(2048&i&&!(2&i)&&function(){if(dn)throw Error(`carr`);Fn(Kn,5)}(),256&i)throw Error(`farr`);if(64&i)return(i|r)!==i&&h(e,i|r),e;if(n&&(i|=128,n!==e[0]))throw Error(`mid`);t:{i|=64;var a=(n=e).length;if(a){var o=a-1;let e=n[o];if(typeof e==`object`&&e&&e.constructor===Object){if((o-=t=128&i?0:-1)>=1024)throw Error(`pvtlmt`);for(var s in e)(a=+s)<o&&(n[a+t]=e[s],delete e[s]);i=-16760833&i|(1023&o)<<14;break t}}if(t){if((s=Math.max(t,a-(128&i?0:-1)))>1024)throw Error(`spvt`);i=-16760833&i|(1023&s)<<14}}}return h(e,64|i|r),e}function ji(e,t){if(typeof e!=`object`)return e;if(Array.isArray(e)){var n=0|e[m];return e.length===0&&1&n?void 0:Mi(e,n,t)}if(e!=null&&e[qn]===nr)return Pi(e);if(e instanceof pi){if(2&(t=e.J))return e;if(!e.size)return;if(n=er(e.V()),e.K)for(e=0;e<n.length;e++){let r=n[e],i=r[1];i=typeof i!=`object`||!i?void 0:i!=null&&i[qn]===nr?Pi(i):Array.isArray(i)?Mi(i,0|i[m],!!(32&t)):void 0,r[1]=i}return n}return e instanceof kn?e:void 0}function Mi(e,t,n){return 2&t||(!n||4096&t||16&t?e=Fi(e,t,!1,n&&!(16&t)):($n(e,34),4&t&&Object.freeze(e))),e}function Ni(e,t,n){return e=new e.constructor(t),n&&(e.h=ir),e.m=ir,e}function Pi(e){let t=e.v,n=0|t[m];return rr(e,n)?e:Bi(e,t,n)?Ni(e,t):Fi(t,n)}function Fi(e,t,n,r){return r??=!!(34&t),e=Ci(e,t,ji,r),r=32,n&&(r|=2),h(e,t=16769217&t|r),e}function Ii(e){let t=e.v,n=0|t[m];return rr(e,n)?Bi(e,t,n)?Ni(e,t,!0):new e.constructor(Fi(t,n,!1)):e}function Li(e){if(e.h!==ir)return!1;var t=e.v;return $n(t=Fi(t,0|t[m]),2048),e.v=t,e.h=void 0,e.m=void 0,!0}function Ri(e){if(!Li(e)&&rr(e,0|e.v[m]))throw Error()}function zi(e,t){t===void 0&&(t=0|e[m]),32&t&&!(4096&t)&&h(e,4096|t)}function Bi(e,t,n){return!!(2&n)||!(!(32&n)||4096&n)&&(h(t,2|n),e.h=ir,!0)}var Vi=gr(0),Hi={};function y(e,t,n,r,i){if((t=Ui(e.v,t,n,i))!==null||r&&e.m!==ir)return t}function Ui(e,t,n,r){if(t===-1)return null;let i=t+(n?0:-1),a=e.length-1,o,s;if(!(a<1+(n?0:-1))){if(i>=a)if(o=e[a],typeof o==`object`&&o&&o.constructor===Object)n=o[t],s=!0;else{if(i!==a)return;n=o}else n=e[i];if(r&&n!=null){if((r=r(n))==null)return r;if(!Object.is(r,n))return s?o[t]=r:e[i]=r,r}return n}}function b(e,t,n,r){Ri(e),x(e=e.v,0|e[m],t,n,r)}function x(e,t,n,r,i){let a=n+(i?0:-1);var o=e.length-1;if(o>=1+(i?0:-1)&&a>=o){let i=e[o];if(typeof i==`object`&&i&&i.constructor===Object)return i[n]=r,t}return a<=o?(e[a]=r,t):(r!==void 0&&(n>=(o=(t??=0|e[m])>>14&1023||536870912)?r!=null&&(e[o+(i?0:-1)]={[n]:r}):e[a]=r),t)}function Wi(){return sr===void 0?2:4}function Gi(e,t,n,r,i){let a=e.v,o=0|a[m];r=rr(e,o)?1:r,i=!!i||r===3,r===2&&Li(e)&&(a=e.v,o=0|a[m]);let s=(e=qi(a,t))===Zn?7:0|e[m],c=Ji(s,o);var l=!(4&c);if(l){4&c&&(e=Ir(e),s=0,c=ua(c,o),o=x(a,o,t,e));let r=0,i=0;for(;r<e.length;r++){let t=n(e[r]);t!=null&&(e[i++]=t)}i<r&&(e.length=i),n=-513&(4|c),c=n&=-1025,c&=-4097}return c!==s&&(h(e,c),2&c&&Object.freeze(e)),Ki(e,c,a,o,t,r,l,i)}function Ki(e,t,n,r,i,a,o,s){let c=t;return a===1||a===4&&(2&t||!(16&t)&&32&r)?Yi(t)||((t|=!e.length||o&&!(4096&t)||32&r&&!(4096&t||16&t)?2:256)!==c&&h(e,t),Object.freeze(e)):(a===2&&Yi(t)&&(e=Ir(e),c=0,t=ua(t,r),r=x(n,r,i,e)),Yi(t)||(s||(t|=16),t!==c&&h(e,t))),2&t||!(4096&t||16&t)||zi(n,r),e}function qi(e,t,n){return e=Ui(e,t,n),Array.isArray(e)?e:Zn}function Ji(e,t){return 2&t&&(e|=2),1|e}function Yi(e){return!!(2&e)&&!!(4&e)||!!(256&e)}function Xi(e){return ar(e,!0)}function Zi(e){e=Ir(e);for(let t=0;t<e.length;t++){let n=e[t]=Ir(e[t]);Array.isArray(n[1])&&(n[1]=er(n[1]))}return tr(e)}function Qi(e,t,n,r){Ri(e),x(e=e.v,0|e[m],t,(r===`0`?Number(n)===0:n===r)?void 0:n)}function $i(e,t,n){if(2&t)throw Error();let r=ur(t),i=qi(e,n,r),a=i===Zn?7:0|i[m],o=Ji(a,t);return(2&o||Yi(o)||16&o)&&(o===a||Yi(o)||h(i,o),i=Ir(i),a=0,o=ua(o,t),x(e,t,n,i,r)),o&=-13,o!==a&&h(i,o),i}function ea(e,t){var n=sc;return ra(ta(e=e.v),e,void 0,n)===t?t:-1}function ta(e){if(Ln)return e[Vn]??(e[Vn]=new Map);if(Vn in e)return e[Vn];let t=new Map;return Object.defineProperty(e,Vn,{value:t}),t}function na(e,t,n,r,i){let a=ta(e),o=ra(a,e,t,n,i);return o!==r&&(o&&(t=x(e,t,o,void 0,i)),a.set(n,r)),t}function ra(e,t,n,r,i){let a=e.get(r);if(a!=null)return a;a=0;for(let e=0;e<r.length;e++){let o=r[e];Ui(t,o,i)!=null&&(a!==0&&(n=x(t,n,a,void 0,i)),a=o)}return e.set(r,a),a}function ia(e,t,n){let r=0|e[m],i=ur(r),a=Ui(e,n,i),o;if(a!=null&&a[qn]===nr){if(!rr(a))return Li(a),a.v;o=a.v}else Array.isArray(a)&&(o=a);if(o){let e=0|o[m];2&e&&(o=Fi(o,e))}return o=ki(o,t),o!==a&&x(e,r,n,o,i),o}function aa(e,t,n,r,i){let a=!1;if((r=Ui(e,r,i,(e=>{let r=ai(e,n,!1,t);return a=r!==e&&r!=null,r})))!=null)return a&&!rr(r)&&zi(e,t),r}function S(e,t,n,r){let i=e.v,a=0|i[m];if((t=aa(i,a,t,n,r))==null)return t;if(a=0|i[m],!rr(e,a)){let o=Ii(t);o!==t&&(Li(e)&&(i=e.v,a=0|i[m]),a=x(i,a,n,t=o,r),zi(i,a))}return t}function oa(e,t,n,r,i,a,o,s){var c=rr(e,n);a=c?1:a,o=!!o||a===3,c=s&&!c,(a===2||c)&&Li(e)&&(n=0|(t=e.v)[m]);var l=(e=qi(t,i))===Zn?7:0|e[m],u=Ji(l,n);if(s=!(4&u)){var d=e,ee=n;let t=!!(2&u);t&&(ee|=2);let i=!t,a=!0,o=0,s=0;for(;o<d.length;o++){let e=ai(d[o],r,!1,ee);if(e instanceof r){if(!t){let t=rr(e);i&&=!t,a&&=t}d[s++]=e}}s<o&&(d.length=s),u|=4,u=a?-4097&u:4096|u,u=i?8|u:-9&u}if(u!==l&&(h(e,u),2&u&&Object.freeze(e)),c&&!(8&u||!e.length&&(a===1||a===4&&(2&u||!(16&u)&&32&n)))){for(Yi(u)&&(e=Ir(e),u=ua(u,n),n=x(t,n,i,e)),r=e,c=u,l=0;l<r.length;l++)(d=r[l])!==(u=Ii(d))&&(r[l]=u);c|=8,h(e,u=c=r.length?4096|c:-4097&c)}return Ki(e,u,t,n,i,a,s,o)}function sa(e,t,n){let r=e.v;return oa(e,r,0|r[m],t,n,Wi(),!1,!0)}function ca(e){return e??=void 0,e}function C(e,t,n,r,i){return b(e,n,r=ca(r),i),r&&!rr(r)&&zi(e.v),e}function la(e,t,n,r){t:{var i=r=ca(r);Ri(e);let a=e.v,o=0|a[m];if(i==null){let e=ta(a);if(ra(e,a,o,n)!==t)break t;e.set(n,0)}else o=na(a,o,n,t);x(a,o,t,i)}r&&!rr(r)&&zi(e.v)}function ua(e,t){return-273&(2&t?2|e:-3&e)}function da(e,t,n,r){var i=r;Ri(e),e=oa(e,r=e.v,0|r[m],n,t,2,!0),i??=new n,e.push(i),t=n=e===Zn?7:0|e[m],(i=rr(i))?(n&=-9,e.length===1&&(n&=-4097)):n|=4096,n!==t&&h(e,n),i||zi(r)}function fa(e,t,n){return Yr(y(e,t,void 0,n))}function w(e,t){return y(e,t,void 0,void 0,Wr)??0}function pa(e,t,n){if(n!=null){if(typeof n!=`number`||!Br(n))throw Pn(`int32`);n|=0}b(e,t,n)}function T(e,t,n){b(e,t,Ur(n))}function ma(e,t,n){Qi(e,t,ii(n),``)}function ha(e,t,n){{Ri(e);let o=e.v,s=0|o[m];if(n==null)x(o,s,t);else{var r=e=n===Zn?7:0|n[m],i=Yi(e),a=i||Object.isFrozen(n);for(i||(e=0),a||=(n=Ir(n),r=0,e=ua(e,s),!1),e|=5,e|=(4&e?512&e?512:1024&e?1024:0:void 0)??1024,i=0;i<n.length;i++){let t=n[i],o=ri(t);Object.is(t,o)||(a&&=(n=Ir(n),r=0,e=ua(e,s),!1),n[i]=o)}e!==r&&(a&&(n=Ir(n),e=ua(e,s)),h(n,e)),x(o,s,t,n)}}}function ga(e,t,n){Ri(e),Gi(e,t,v,2,!0).push(ri(n))}var _a=class{constructor(e,t,n){if(this.buffer=e,n&&!t)throw Error();this.g=t}};function va(e,t){if(typeof e==`string`)return new _a(wn(e),t);if(Array.isArray(e))return new _a(new Uint8Array(e),t);if(e.constructor===Uint8Array)return new _a(e,!1);if(e.constructor===ArrayBuffer)return e=new Uint8Array(e),new _a(e,!1);if(e.constructor===kn)return t=On(e)||new Uint8Array,new _a(t,!0,e);if(e instanceof Uint8Array)return e=e.constructor===Uint8Array?e:new Uint8Array(e.buffer,e.byteOffset,e.byteLength),new _a(e,!1);throw Error()}function ya(e,t){let n,r=0,i=0,a=0,o=e.h,s=e.g;do n=o[s++],r|=(127&n)<<a,a+=7;while(a<32&&128&n);if(a>32)for(i|=(127&n)>>4,a=3;a<32&&128&n;a+=7)n=o[s++],i|=(127&n)<<a;if(Ta(e,s),!(128&n))return t(r>>>0,i>>>0);throw Error()}function ba(e){let t=0,n=e.g,r=n+10,i=e.h;for(;n<r;){let r=i[n++];if(t|=r,!(128&r))return Ta(e,n),!!(127&t)}throw Error()}function xa(e){let t=e.h,n=e.g,r=t[n++],i=127&r;if(128&r&&(r=t[n++],i|=(127&r)<<7,128&r&&(r=t[n++],i|=(127&r)<<14,128&r&&(r=t[n++],i|=(127&r)<<21,128&r&&(r=t[n++],i|=r<<28,128&r&&128&t[n++]&&128&t[n++]&&128&t[n++]&&128&t[n++]&&128&t[n++])))))throw Error();return Ta(e,n),i}function Sa(e){return xa(e)>>>0}function Ca(e){var t=e.h;let n=e.g;var r=t[n],i=t[n+1];let a=t[n+2];return t=t[n+3],Ta(e,e.g+4),e=2*((i=(r<<0|i<<8|a<<16|t<<24)>>>0)>>31)+1,r=i>>>23&255,i&=8388607,r==255?i?NaN:e*(1/0):r==0?1401298464324817e-60*e*i:e*2**(r-150)*(i+8388608)}function wa(e){return xa(e)}function Ta(e,t){if(e.g=t,t>e.l)throw Error()}function Ea(e,t){if(t<0)throw Error();let n=e.g;if((t=n+t)>e.l)throw Error();return e.g=t,n}function Da(e,t){if(t==0)return Dn();var n=Ea(e,t);return e.Y&&e.j?n=e.h.subarray(n,n+t):(e=e.h,n=n===(t=n+t)?new Uint8Array:Cr?e.slice(n,t):new Uint8Array(e.subarray(n,t))),n.length==0?Dn():new kn(n,En)}var Oa=[];function ka(e,t,n,r){if(Ra.length){let i=Ra.pop();return i.o(r),i.g.init(e,t,n,r),i}return new La(e,t,n,r)}function Aa(e){e.g.clear(),e.l=-1,e.h=-1,Ra.length<100&&Ra.push(e)}function ja(e){var t=e.g;if(t.g==t.l)return!1;e.m=e.g.g;var n=Sa(e.g);if(t=n>>>3,!((n&=7)>=0&&n<=5)||t<1)throw Error();return e.l=t,e.h=n,!0}function Ma(e){switch(e.h){case 0:e.h==0?ba(e.g):Ma(e);break;case 1:Ta(e=e.g,e.g+8);break;case 2:if(e.h!=2)Ma(e);else{var t=Sa(e.g);Ta(e=e.g,e.g+t)}break;case 5:Ta(e=e.g,e.g+4);break;case 3:for(t=e.l;;){if(!ja(e))throw Error();if(e.h==4){if(e.l!=t)throw Error();break}Ma(e)}break;default:throw Error()}}function Na(e,t,n){let r=e.g.l;var i=Sa(e.g);let a=(i=e.g.g+i)-r;if(a<=0&&(e.g.l=i,n(t,e,void 0,void 0,void 0),a=i-e.g.g),a)throw Error();return e.g.g=i,e.g.l=r,t}function Pa(e){var t=Sa(e.g),n=Ea(e=e.g,t);if(e=e.h,rn){var r,i=e;(r=nn)||(r=nn=new TextDecoder(`utf-8`,{fatal:!0})),t=n+t,i=n===0&&t===i.length?i:i.subarray(n,t);try{var a=r.decode(i)}catch(e){if(tn===void 0){try{r.decode(new Uint8Array([128]))}catch{}try{r.decode(new Uint8Array([97])),tn=!0}catch{tn=!1}}throw!tn&&(nn=void 0),e}}else{t=(a=n)+t,n=[];let s,c=null;for(;a<t;){var o=e[a++];o<128?n.push(o):o<224?a>=t?$t():(s=e[a++],o<194||(192&s)!=128?(a--,$t()):n.push((31&o)<<6|63&s)):o<240?a>=t-1?$t():(s=e[a++],(192&s)!=128||o===224&&s<160||o===237&&s>=160||(192&(r=e[a++]))!=128?(a--,$t()):n.push((15&o)<<12|(63&s)<<6|63&r)):o<=244?a>=t-2?$t():(s=e[a++],(192&s)!=128||s-144+(o<<28)>>30||(192&(r=e[a++]))!=128||(192&(i=e[a++]))!=128?(a--,$t()):(o=(7&o)<<18|(63&s)<<12|(63&r)<<6|63&i,o-=65536,n.push(55296+(o>>10&1023),56320+(1023&o)))):$t(),n.length>=8192&&(c=en(c,n),n.length=0)}a=en(c,n)}return a}function Fa(e){let t=Sa(e.g);return Da(e.g,t)}function Ia(e,t,n){var r=Sa(e.g);for(r=e.g.g+r;e.g.g<r;)n.push(t(e.g))}var La=class{constructor(e,t,n,r){if(Oa.length){let i=Oa.pop();i.init(e,t,n,r),e=i}else e=new class{constructor(e,t,n,r){this.h=null,this.j=!1,this.g=this.l=this.m=0,this.init(e,t,n,r)}init(e,t,n,{Y:r=!1,ea:i=!1}={}){this.Y=r,this.ea=i,e&&(e=va(e,this.ea),this.h=e.buffer,this.j=e.g,this.m=t||0,this.l=n===void 0?this.h.length:this.m+n,this.g=this.m)}clear(){this.h=null,this.j=!1,this.g=this.l=this.m=0,this.Y=!1}}(e,t,n,r);this.g=e,this.m=this.g.g,this.h=this.l=-1,this.o(r)}o({ha:e=!1}={}){this.ha=e}},Ra=[];function za(e){return e?/^\d+$/.test(e)?(Pr(e),new Ba(g,_)):null:Va||=new Ba(0,0)}var Ba=class{constructor(e,t){this.h=e>>>0,this.g=t>>>0}},Va;function Ha(e){return e?/^-?\d+$/.test(e)?(Pr(e),new Ua(g,_)):null:Wa||=new Ua(0,0)}var Ua=class{constructor(e,t){this.h=e>>>0,this.g=t>>>0}},Wa;function Ga(e,t,n){for(;n>0||t>127;)e.g.push(127&t|128),t=(t>>>7|n<<25)>>>0,n>>>=7;e.g.push(t)}function Ka(e,t){for(;t>127;)e.g.push(127&t|128),t>>>=7;e.g.push(t)}function qa(e,t){if(t>=0)Ka(e,t);else{for(let n=0;n<9;n++)e.g.push(127&t|128),t>>=7;e.g.push(1)}}function Ja(e){var t=g;e.g.push(t>>>0&255),e.g.push(t>>>8&255),e.g.push(t>>>16&255),e.g.push(t>>>24&255)}function Ya(e,t){t.length!==0&&(e.l.push(t),e.h+=t.length)}function Xa(e,t,n){Ka(e.g,8*t+n)}function Za(e,t){return Xa(e,t,2),t=e.g.end(),Ya(e,t),t.push(e.h),t}function Qa(e,t){var n=t.pop();for(n=e.h+e.g.length()-n;n>127;)t.push(127&n|128),n>>>=7,e.h++;t.push(n),e.h++}function $a(e,t,n){Xa(e,t,2),Ka(e.g,n.length),Ya(e,e.g.end()),Ya(e,n)}function eo(e,t,n,r){n!=null&&(t=Za(e,t),r(n,e),Qa(e,t))}function to(){let e=class{constructor(){throw Error()}};return Object.setPrototypeOf(e,e.prototype),e}var no=to(),ro=to(),io=to(),ao=to(),oo=to(),so=to(),co=to(),lo=to(),uo=to(),fo=to();function po(e,t,n){var r=e.v;Hn&&Hn in r&&(r=r[Hn])&&delete r[t.g],t.h?t.j(e,t.h,t.g,n,t.l):t.j(e,t.g,n,t.l)}var E=class{constructor(e,t){this.v=Ai(e,t,void 0,2048)}toJSON(){return Oi(this)}j(){var e=Zc,t=this.v,n=e.g,r=Hn;if(Ln&&r&&t[r]?.[n]!=null&&Fn(Un,3),t=e.g,Jn&&Hn&&Jn===void 0&&(r=(n=this.v)[Hn])&&(r=r.da))try{r(n,t,xi)}catch(e){cn(e)}return e.h?e.m(this,e.h,e.g,e.l):e.m(this,e.g,e.defaultValue,e.l)}clone(){let e=this.v,t=0|e[m];return Bi(this,e,t)?Ni(this,e,!0):new this.constructor(Fi(e,t,!1))}};E.prototype[qn]=nr,E.prototype.toString=function(){return this.v.toString()};var mo=class{constructor(e,t,n){this.g=e,this.h=t,e=no,this.l=!!e&&n===e||!1}};function ho(e,t){return new mo(e,t,no)}function go(e,t,n,r,i){eo(e,n,Oo(t,r),i)}var _o=ho((function(e,t,n,r,i){return e.h===2&&(Na(e,ia(t,r,n),i),!0)}),go),vo=ho((function(e,t,n,r,i){return e.h===2&&(Na(e,ia(t,r,n),i),!0)}),go),yo=Symbol(),bo=Symbol(),xo=Symbol(),So=Symbol(),Co=Symbol(),wo,To;function Eo(e,t,n,r){var i=r[e];if(i)return i;(i={}).qa=r,i.T=function(e){switch(typeof e){case`boolean`:return Ei||=[0,void 0,!0];case`number`:return e>0?void 0:e===0?Di||=[0,void 0]:[-e,void 0];case`string`:return[0,e];case`object`:return e}}(r[0]);var a=r[1];let o=1;a&&a.constructor===Object&&(i.ba=a,typeof(a=r[++o])==`function`&&(i.ma=!0,wo??=a,To??=r[o+1],a=r[o+=2]));let s={};for(;a&&Array.isArray(a)&&a.length&&typeof a[0]==`number`&&a[0]>0;){for(var c=0;c<a.length;c++)s[a[c]]=a;a=r[++o]}for(c=1;a!==void 0;){let e;typeof a==`number`&&(c+=a,a=r[++o]);var l=void 0;if(a instanceof mo?e=a:(e=_o,o--),e?.l){a=r[++o],l=r;var u=o;typeof a==`function`&&(a=a(),l[u]=a),l=a}for(u=c+1,typeof(a=r[++o])==`number`&&a<0&&(u-=a,a=r[++o]);c<u;c++){let r=s[c];l?n(i,c,e,l,r):t(i,c,e,r)}}return r[e]=i}function Do(e){return Array.isArray(e)?e[0]instanceof mo?e:[vo,e]:[e,void 0]}function Oo(e,t){return e instanceof E?e.v:Array.isArray(e)?ki(e,t):void 0}function ko(e,t,n,r){let i=n.g;e[t]=r?(e,t,n)=>i(e,t,n,r):i}function Ao(e,t,n,r,i){let a=n.g,o,s;e[t]=(e,t,n)=>a(e,t,n,s||=Eo(bo,ko,Ao,r).T,o||=jo(r),i)}function jo(e){let t=e[xo];if(t!=null)return t;let n=Eo(bo,ko,Ao,e);return t=n.ma?(e,t)=>wo(e,t,n):(e,t)=>{for(;ja(t)&&t.h!=4;){var r=t.l,i=n[r];if(i==null){var a=n.ba;(a&&=a[r])&&(a=No(a))!=null&&(i=n[r]=a)}if(i==null||!i(t,e,r)){if(i=(a=t).m,Ma(a),a.ha)var o=void 0;else o=a.g.g-i,a.g.g=i,o=Da(a.g,o);i=void 0,a=e,o&&((i=a[Hn]??(a[Hn]=new bi))[r]??(i[r]=[])).push(o)}}return(e=vi(e))&&(e.da=n.qa[Co]),!0},e[xo]=t,e[Co]=Mo.bind(e),t}function Mo(e,t,n,r){var i=this[bo];let a=this[xo],o=ki(void 0,i.T),s=vi(e);if(s){var c=!1,l=i.ba;if(l){if(i=(t,n,i)=>{if(i.length!==0)if(l[n])for(let e of i){t=ka(e);try{c=!0,a(o,t)}finally{Aa(t)}}else r?.(e,n,i)},t==null)yi(s,i);else if(s!=null){let e=s[t];e&&i(s,t,e)}if(c){let r=0|e[m];if(2&r&&2048&r&&!n?.Ka)throw Error();let i=ur(r),a=(t,a)=>{if(Ui(e,t,i)!=null){if(n?.Qa===1)return;throw Error()}a!=null&&(r=x(e,r,t,a,i)),delete s[t]};t==null?cr(o,0|o[m],((e,t)=>{a(e,t)})):a(t,Ui(o,t,i))}}}}function No(e){let t=(e=Do(e))[0].g;if(e=e[1]){let n=jo(e),r=Eo(bo,ko,Ao,e).T;return(e,i,a)=>t(e,i,a,r,n)}return t}function Po(e,t,n){e[t]=n.h}function Fo(e,t,n,r){let i,a,o=n.h;e[t]=(e,t,n)=>o(e,t,n,a||=Eo(yo,Po,Fo,r).T,i||=Io(r))}function Io(e){let t=e[So];if(!t){let n=Eo(yo,Po,Fo,e);t=(e,t)=>Lo(e,t,n),e[So]=t}return t}function Lo(e,t,n){cr(e,0|e[m],((e,r)=>{if(r!=null){var i=function(e,t){var n=e[t];if(n)return n;if((n=e.ba)&&(n=n[t])){var r=(n=Do(n))[0].h;if(n=n[1]){let t=Io(n),i=Eo(yo,Po,Fo,n).T;n=e.ma?To(i,t):(e,n,a)=>r(e,n,a,i,t)}else n=r;return e[t]=n}}(n,e);i?i(t,r,e):e<500||Fn(Gn,3)}})),(e=vi(e))&&yi(e,((e,n,r)=>{for(Ya(t,t.g.end()),e=0;e<r.length;e++)Ya(t,On(r[e])||new Uint8Array)}))}var Ro=gr(0);function zo(e,t){if(Array.isArray(t)){var n=0|t[m];if(4&n)return t;for(var r=0,i=0;r<t.length;r++){let n=e(t[r]);n!=null&&(t[i++]=n)}return i<r&&(t.length=i),(e=-1537&(5|n))!==n&&h(t,e),2&e&&Object.freeze(t),t}}function Bo(e,t,n){return new mo(e,t,n)}function Vo(e,t,n){return new mo(e,t,n)}function Ho(e,t,n){x(e,0|e[m],t,n,ur(0|e[m]))}var Uo=ho((function(e,t,n,r,i){if(e.h!==2)return!1;if(e=Ir(e=Na(e,ki([void 0,void 0],r),i)),i=ur(r=0|t[m]),2&r)throw Error();let a=Ui(t,n,i);if(a instanceof pi)2&a.J?(a=a.V(),a.push(e),x(t,r,n,a,i)):a.Ma(e);else if(Array.isArray(a)){var o=0|a[m];8192&o||h(a,o|=8192),2&o&&(a=Zi(a),x(t,r,n,a,i)),a.push(e)}else x(t,r,n,tr([e]),i);return!0}),(function(e,t,n,r,i){if(t instanceof pi)t.forEach(((t,a)=>{eo(e,n,ki([a,t],r),i)}));else if(Array.isArray(t)){for(let a=0;a<t.length;a++){let o=t[a];Array.isArray(o)&&eo(e,n,ki(o,r),i)}tr(t)}}));function Wo(e,t,n){(t=Wr(t))!=null&&(Xa(e,n,5),e=e.g,Dr(t),Ja(e))}function Go(e,t,n){if(t=function(e){if(e==null)return e;let t=typeof e;if(t===`bigint`)return String(Lr(64,e));if(Jr(e)){if(t===`string`)return $r(e);if(t===`number`)return Qr(e)}}(t),t!=null&&(typeof t==`string`&&Ha(t),t!=null))switch(Xa(e,n,0),typeof t){case`number`:e=e.g,Er(t),Ga(e,g,_);break;case`bigint`:n=BigInt.asUintN(64,t),n=new Ua(Number(n&BigInt(4294967295)),Number(n>>BigInt(32))),Ga(e.g,n.h,n.g);break;default:n=Ha(t),Ga(e.g,n.h,n.g)}}function Ko(e,t,n){(t=Yr(t))!=null&&t!=null&&(Xa(e,n,0),qa(e.g,t))}function qo(e,t,n){(t=Kr(t))!=null&&(Xa(e,n,0),e.g.g.push(+!!t))}function Jo(e,t,n){(t=v(t))!=null&&$a(e,n,sn(t))}function Yo(e,t,n,r,i){eo(e,n,Oo(t,r),i)}function Xo(e,t,n){(t=t==null||typeof t==`string`||t instanceof kn?t:void 0)!=null&&$a(e,n,va(t,!0).buffer)}function Zo(e,t,n){(t=Xr(t))!=null&&t!=null&&(Xa(e,n,0),Ka(e.g,t))}function Qo(e,t,n){return(e.h===5||e.h===2)&&(t=$i(t,0|t[m],n),e.h==2?Ia(e,Ca,t):t.push(Ca(e.g)),!0)}var D=Bo((function(e,t,n){return e.h===5&&(Ho(t,n,Ca(e.g)),!0)}),Wo,lo),$o=Vo(Qo,(function(e,t,n){if((t=zo(Wr,t))!=null)for(let o=0;o<t.length;o++){var r=e,i=n,a=t[o];a!=null&&(Xa(r,i,5),r=r.g,Dr(a),Ja(r))}}),lo),es=Vo(Qo,(function(e,t,n){if((t=zo(Wr,t))!=null&&t.length){Xa(e,n,2),Ka(e.g,4*t.length);for(let r=0;r<t.length;r++)n=e.g,Dr(t[r]),Ja(n)}}),lo),ts=Bo((function(e,t,n){return e.h===5&&(Ho(t,n,(e=Ca(e.g))===0?void 0:e),!0)}),Wo,lo),ns=Bo((function(e,t,n){return e.h===0?(Ho(t,n,ya(e.g,Ar)),e=!0):e=!1,e}),Go,so),rs=Bo((function(e,t,n){return e.h===0?(Ho(t,n,(e=ya(e.g,Ar))===Ro?void 0:e),t=!0):t=!1,t}),Go,so),is=Bo((function(e,t,n){return e.h===0?(Ho(t,n,ya(e.g,kr)),e=!0):e=!1,e}),(function(e,t,n){if(t=function(e){if(e==null)return e;var t=typeof e;if(t===`bigint`)return String(Rr(64,e));if(Jr(e)){if(t===`string`)return t=Vr(Number(e)),zr(t)&&t>=0?e=String(t):((t=e.indexOf(`.`))!==-1&&(e=e.substring(0,t)),(t=e[0]!==`-`&&((t=e.length)<20||t===20&&e<=`18446744073709551615`))||(Pr(e),e=jr(g,_))),e;if(t===`number`)return(e=Vr(e))>=0&&zr(e)||(Er(e),e=Or(g,_)),e}}(t),t!=null&&(typeof t==`string`&&za(t),t!=null))switch(Xa(e,n,0),typeof t){case`number`:e=e.g,Er(t),Ga(e,g,_);break;case`bigint`:n=BigInt.asUintN(64,t),n=new Ba(Number(n&BigInt(4294967295)),Number(n>>BigInt(32))),Ga(e.g,n.h,n.g);break;default:n=za(t),Ga(e.g,n.h,n.g)}}),co),O=Bo((function(e,t,n){return e.h===0&&(Ho(t,n,xa(e.g)),!0)}),Ko,ao),as=Vo((function(e,t,n){return(e.h===0||e.h===2)&&(t=$i(t,0|t[m],n),e.h==2?Ia(e,xa,t):t.push(xa(e.g)),!0)}),(function(e,t,n){if((t=zo(Yr,t))!=null&&t.length){n=Za(e,n);for(let n=0;n<t.length;n++)qa(e.g,t[n]);Qa(e,n)}}),ao),os=Bo((function(e,t,n){return e.h===0&&(Ho(t,n,(e=xa(e.g))===0?void 0:e),!0)}),Ko,ao),k=Bo((function(e,t,n){return e.h===0&&(Ho(t,n,ba(e.g)),!0)}),qo,ro),ss=Bo((function(e,t,n){return e.h===0&&(Ho(t,n,!1===(e=ba(e.g))?void 0:e),!0)}),qo,ro),A=Vo((function(e,t,n){return e.h===2&&(e=Pa(e),$i(t,0|t[m],n).push(e),!0)}),(function(e,t,n){if((t=zo(v,t))!=null)for(let o=0;o<t.length;o++){var r=e,i=n,a=t[o];a!=null&&$a(r,i,sn(a))}}),io),cs=Bo((function(e,t,n){return e.h===2&&(Ho(t,n,(e=Pa(e))===``?void 0:e),!0)}),Jo,io),j=Bo((function(e,t,n){return e.h===2&&(Ho(t,n,Pa(e)),!0)}),Jo,io),M=function(e,t,n=no){return new mo(e,t,n)}((function(e,t,n,r,i){return e.h===2&&(r=ki(void 0,r),$i(t,0|t[m],n).push(r),Na(e,r,i),!0)}),(function(e,t,n,r,i){if(Array.isArray(t)){for(let a=0;a<t.length;a++)Yo(e,t[a],n,r,i);1&(e=0|t[m])||h(t,1|e)}})),N=ho((function(e,t,n,r,i,a){if(e.h!==2)return!1;let o=0|t[m];return na(t,o,a,n,ur(o)),Na(e,t=ia(t,r,n),i),!0}),Yo),ls=Bo((function(e,t,n){return e.h===2&&(Ho(t,n,Fa(e)),!0)}),Xo,uo),us=Vo((function(e,t,n){return(e.h===0||e.h===2)&&(t=$i(t,0|t[m],n),e.h==2?Ia(e,Sa,t):t.push(Sa(e.g)),!0)}),(function(e,t,n){if((t=zo(Xr,t))!=null)for(let o=0;o<t.length;o++){var r=e,i=n,a=t[o];a!=null&&(Xa(r,i,0),Ka(r.g,a))}}),oo),ds=Bo((function(e,t,n){return e.h===0&&(Ho(t,n,(e=Sa(e.g))===0?void 0:e),!0)}),Zo,oo),fs=Bo((function(e,t,n){return e.h===0&&(Ho(t,n,xa(e.g)),!0)}),(function(e,t,n){(t=Yr(t))!=null&&(t=parseInt(t,10),Xa(e,n,0),qa(e.g,t))}),fo),ps=class{constructor(e,t){var n=js;this.g=e,this.h=t,this.m=S,this.j=C,this.defaultValue=void 0,this.l=n.Oa==null?void 0:lr}register(){mn(this)}};function ms(e,t){return new ps(e,t)}function hs(e,t){return(n,r)=>{{let a={ea:!0};r&&Object.assign(a,r),n=ka(n,void 0,void 0,a);try{let r=new e,a=r.v;jo(t)(a,n);var i=r}finally{Aa(n)}}return i}}function gs(e){return function(){let t=new class{constructor(){this.l=[],this.h=0,this.g=new class{constructor(){this.g=[]}length(){return this.g.length}end(){let e=this.g;return this.g=[],e}}}};Lo(this.v,t,Eo(yo,Po,Fo,e)),Ya(t,t.g.end());let n=new Uint8Array(t.h),r=t.l,i=r.length,a=0;for(let e=0;e<i;e++){let t=r[e];n.set(t,a),a+=t.length}return t.l=[n],n}}var _s=class extends E{constructor(e){super(e)}},vs=[0,cs,Bo((function(e,t,n){return e.h===2&&(Ho(t,n,(e=Fa(e))===Dn()?void 0:e),!0)}),(function(e,t,n){if(t!=null){if(t instanceof E){let r=t.Ra;r?(t=r(t),t!=null&&$a(e,n,va(t,!0).buffer)):Fn(Gn,3);return}if(Array.isArray(t))return void Fn(Gn,3)}Xo(e,t,n)}),uo)],ys,bs=globalThis.trustedTypes;function xs(e){var t;return ys===void 0&&(ys=function(){let e=null;if(!bs)return e;try{let t=e=>e;e=bs.createPolicy(`goog#html`,{createHTML:t,createScript:t,createScriptURL:t})}catch{}return e}()),e=(t=ys)?t.createScriptURL(e):e,new class{constructor(e){this.g=e}toString(){return this.g+``}}(e)}function Ss(e,...t){if(t.length===0)return xs(e[0]);let n=e[0];for(let r=0;r<t.length;r++)n+=encodeURIComponent(t[r])+e[r+1];return xs(n)}var Cs=[0,O,fs,k,-1,as,fs,-1,k],ws=class extends E{constructor(e){super(e)}},Ts=[0,k,j,k,fs,-1,Vo((function(e,t,n){return(e.h===0||e.h===2)&&(t=$i(t,0|t[m],n),e.h==2?Ia(e,wa,t):t.push(xa(e.g)),!0)}),(function(e,t,n){if((t=zo(Yr,t))!=null&&t.length){n=Za(e,n);for(let n=0;n<t.length;n++)qa(e.g,t[n]);Qa(e,n)}}),fo),j,-1,[0,k,-1],fs,k,-1],Es=[0,3,k,-1,2,[0,[2],O,N,[0,Bo((function(e,t,n){return e.h===0&&(Ho(t,n,Sa(e.g)),!0)}),Zo,oo)]],[0,fs,k,fs,k,fs,k,j,-1],[0,[3,4],j,-1,N,[0,O],N,[0,fs]],[0]],Ds=[0,j,-2],Os=class extends E{constructor(e){super(e)}},ks=[0],As=[0,O,k,1,k,-4],js=class extends E{constructor(e){super(e,2)}},P={};P[336783863]=[0,j,k,-1,O,[0,[1,2,3,4,5,6,7,8,9],N,ks,N,Ts,N,Ds,N,As,N,Cs,N,[0,j,-2],N,[0,j,fs],N,Es,N,[0,fs,-1,k]],[0,j],k,[0,[1,3],[2,4],N,[0,as],-1,N,[0,A],-1,M,[0,j,-1]],j];var Ms=[0,rs,-1,ss,-3,rs,as,cs,os,rs,-1,ss,os,ss,-2,cs];function F(e,t){ga(e,3,t)}function I(e,t){ga(e,4,t)}var Ns=class extends E{constructor(e){super(e,500)}o(e){return C(this,0,7,e)}},Ps=[-1,{}],Fs=[0,j,1,Ps],Is=[0,j,A,Ps];function Ls(e,t){da(e,1,Ns,t)}function L(e,t){ga(e,10,t)}function R(e,t){ga(e,15,t)}var Rs=class extends E{constructor(e){super(e,500)}o(e){return C(this,0,1001,e)}},zs=[-500,M,[-500,cs,-1,A,-3,[-2,P,k],M,vs,os,-1,Fs,Is,M,[0,cs,ss],cs,Ms,os,A,987,A],4,M,[-500,j,-1,[-1,{}],998,j],M,[-500,j,A,-1,[-2,{},k],997,A,-1],os,M,[-500,j,A,Ps,998,A],A,os,Fs,Is,M,[0,cs,-1,Ps],A,-2,Ms,cs,-1,ss,[0,ss,ds],978,Ps,M,vs];Rs.prototype.g=gs(zs);var Bs=hs(Rs,zs),Vs=class extends E{constructor(e){super(e)}},Hs=class extends E{constructor(e){super(e)}g(){return sa(this,Vs,1)}},Us=[0,M,[0,O,D,j,-1]],Ws=hs(Hs,Us),Gs=class extends E{constructor(e){super(e)}},Ks=class extends E{constructor(e){super(e)}},qs=class extends E{constructor(e){super(e)}l(){return S(this,Gs,2)}g(){return sa(this,Ks,5)}},Js=hs(class extends E{constructor(e){super(e)}},[0,A,as,es,[0,fs,[0,O,-3],[0,D,-3],[0,O,-1,[0,M,[0,O,-2]]],M,[0,D,-1,j,D]],j,-1,ns,M,[0,O,D],A,ns]),Ys=class extends E{constructor(e){super(e)}},Xs=hs(class extends E{constructor(e){super(e)}},[0,M,[0,D,-4]]),Zs=class extends E{constructor(e){super(e)}},Qs=hs(class extends E{constructor(e){super(e)}},[0,M,[0,D,-4]]),$s=class extends E{constructor(e){super(e)}},ec=[0,O,-1,es,fs],tc=class extends E{constructor(e){super(e)}};tc.prototype.g=gs([0,D,-4,ns]);var nc=class extends E{constructor(e){super(e)}},rc=hs(class extends E{constructor(e){super(e)}},[0,M,[0,1,O,j,Us],ns]),ic=class extends E{constructor(e){super(e)}},ac=class extends E{constructor(e){super(e)}na(){return y(this,1,void 0,void 0,Xi)??Dn()}},oc=class extends E{constructor(e){super(e)}},sc=[1,2],cc=hs(class extends E{constructor(e){super(e)}},[0,M,[0,sc,N,[0,es],N,[0,ls],O,j],ns]),lc=class extends E{constructor(e){super(e)}},uc=[0,j,O,D,A,-1],dc=class extends E{constructor(e){super(e)}},fc=[0,k,-1],pc=class extends E{constructor(e){super(e)}},mc=[1,2,3,4,5,6],hc=class extends E{constructor(e){super(e)}g(){return y(this,1,void 0,void 0,Xi)!=null}l(){return v(y(this,2))!=null}},z=class extends E{constructor(e){super(e)}g(){return Kr(y(this,2))??!1}},gc=[0,ls,j,[0,O,ns,-1],[0,is,ns]],B=[0,gc,k,[0,mc,N,As,N,Ts,N,Cs,N,ks,N,Ds,N,Es],fs],_c=class extends E{constructor(e){super(e)}},vc=[0,B,D,-1,O],yc=ms(502141897,_c);P[502141897]=vc;var bc=hs(class extends E{constructor(e){super(e)}},[0,[0,fs,-1,$o,us],ec]),xc=class extends E{constructor(e){super(e)}},Sc=class extends E{constructor(e){super(e)}},Cc=[0,B,D,[0,B],k],wc=ms(508968150,Sc);P[508968150]=[0,B,vc,Cc,D,[0,[0,gc]]],P[508968149]=Cc;var Tc=class extends E{constructor(e){super(e)}l(){return S(this,lc,2)}g(){b(this,2)}},Ec=[0,B,uc];P[478825465]=Ec;var Dc=class extends E{constructor(e){super(e)}},Oc=class extends E{constructor(e){super(e)}},kc=class extends E{constructor(e){super(e)}},Ac=class extends E{constructor(e){super(e)}},jc=class extends E{constructor(e){super(e)}},Mc=[0,B,[0,B],Ec,-1],Nc=[0,B,D,O],Pc=[0,B,D],Fc=[0,B,Nc,Pc,D],Ic=ms(479097054,jc);P[479097054]=[0,B,Fc,Mc],P[463370452]=Mc,P[464864288]=Nc;var Lc=ms(462713202,Ac);P[462713202]=Fc,P[474472470]=Pc;var Rc=class extends E{constructor(e){super(e)}},zc=class extends E{constructor(e){super(e)}},Bc=class extends E{constructor(e){super(e)}},Vc=class extends E{constructor(e){super(e)}},Hc=[0,B,D,-1,O],Uc=[0,B,D,k];Vc.prototype.g=gs([0,B,Pc,[0,B],vc,Cc,Hc,Uc]);var Wc=class extends E{constructor(e){super(e)}},Gc=ms(456383383,Wc);P[456383383]=[0,B,uc];var Kc=class extends E{constructor(e){super(e)}},qc=ms(476348187,Kc);P[476348187]=[0,B,fc];var Jc=class extends E{constructor(e){super(e)}},Yc=class extends E{constructor(e){super(e)}},Xc=[0,fs,-1],Zc=ms(458105876,class extends E{constructor(e){super(e)}g(){let e;var t=this.v;let n=0|t[m];return e=rr(this,n),t=function(e,t,n,r){var i=Yc;!r&&Li(e)&&(n=0|(t=e.v)[m]);var a=Ui(t,2);if(e=!1,a==null){if(r)return _i();a=[]}else if(a.constructor===pi){if(!(2&a.J)||r)return a;a=a.V()}else Array.isArray(a)?e=!!(2&(0|a[m])):a=[];if(r){if(!a.length)return _i();e||(e=!0,er(a))}else e&&(e=!1,tr(a),a=Zi(a));return!e&&32&n&&$n(a,32),n=x(t,n,2,r=new pi(a,i,oi,void 0)),e||zi(t,n),r}(this,t,n,e),!e&&Yc&&(t.ra=!0),t}});P[458105876]=[0,Xc,Uo,[!0,ns,[0,j,-1,A]],[0,as,k,fs]];var Qc=class extends E{constructor(e){super(e)}},$c=ms(458105758,Qc);P[458105758]=[0,B,j,Xc];var el=class extends E{constructor(e){super(e)}},tl=[0,ts,-1,ss],nl=class extends E{constructor(e){super(e)}},rl=class extends E{constructor(e){super(e)}},il=[1,2];rl.prototype.g=gs([0,il,N,tl,N,[0,M,tl]]);var al=class extends E{constructor(e){super(e)}},ol=ms(443442058,al);P[443442058]=[0,B,j,O,D,A,-1,k,D],P[514774813]=Hc;var sl=class extends E{constructor(e){super(e)}},cl=ms(516587230,sl);function ll(e,t){return t=t?t.clone():new lc,e.displayNamesLocale===void 0?e.displayNamesLocale===void 0&&b(t,1):b(t,1,ii(e.displayNamesLocale)),e.maxResults===void 0?`maxResults`in e&&b(t,2):pa(t,2,e.maxResults),e.scoreThreshold===void 0?`scoreThreshold`in e&&b(t,3):T(t,3,e.scoreThreshold),e.categoryAllowlist===void 0?`categoryAllowlist`in e&&b(t,4):ha(t,4,e.categoryAllowlist),e.categoryDenylist===void 0?`categoryDenylist`in e&&b(t,5):ha(t,5,e.categoryDenylist),t}function ul(e){let t=Number(e);return Number.isSafeInteger(t)?t:String(e)}function dl(e,t=-1,n=``){return{categories:e.map((e=>({index:fa(e,1)??0??-1,score:w(e,2)??0,categoryName:v(y(e,3))??``??``,displayName:v(y(e,4))??``??``}))),headIndex:t,headName:n}}function fl(e){let t={classifications:sa(e,nc,1).map((e=>dl(S(e,Hs,4)?.g()??[],fa(e,2)??0,v(y(e,3))??``)))};return function(e){return e==null?e:typeof e==`bigint`?(_r(e)?e=Number(e):(e=Lr(64,e),e=_r(e)?Number(e):String(e)),e):Jr(e)?typeof e==`number`?Qr(e):$r(e):void 0}(y(e,2,void 0,void 0,ni))!=null&&(t.timestampMs=ul(y(e,2,void 0,void 0,ni)??Vi)),t}function pl(e){var t=Gi(e,3,Wr,Wi()),n=Gi(e,2,Yr,Wi()),r=Gi(e,1,v,Wi()),i=Gi(e,9,v,Wi());let a={categories:[],keypoints:[]};for(let e=0;e<t.length;e++)a.categories.push({score:t[e],index:n[e]??-1,categoryName:r[e]??``,displayName:i[e]??``});if((t=S(e,qs,4)?.l())&&(a.boundingBox={originX:fa(t,1,Hi)??0,originY:fa(t,2,Hi)??0,width:fa(t,3,Hi)??0,height:fa(t,4,Hi)??0,angle:0}),S(e,qs,4)?.g().length)for(let t of S(e,qs,4).g())a.keypoints.push({x:y(t,1,void 0,Hi,Wr)??0,y:y(t,2,void 0,Hi,Wr)??0,score:y(t,4,void 0,Hi,Wr)??0,label:v(y(t,3,void 0,Hi))??``});return a}function ml(e){let t=[];for(let n of sa(e,Zs,1))t.push({x:w(n,1)??0,y:w(n,2)??0,z:w(n,3)??0,visibility:w(n,4)??0});return t}function hl(e){let t=[];for(let n of sa(e,Ys,1))t.push({x:w(n,1)??0,y:w(n,2)??0,z:w(n,3)??0,visibility:w(n,4)??0});return t}function gl(e){return Array.from(e,(e=>e>127?e-256:e))}function _l(e,t){if(e.length!==t.length)throw Error(`Cannot compute cosine similarity between embeddings of different sizes (${e.length} vs. ${t.length}).`);let n=0,r=0,i=0;for(let a=0;a<e.length;a++)n+=e[a]*t[a],r+=e[a]*e[a],i+=t[a]*t[a];if(r<=0||i<=0)throw Error(`Cannot compute cosine similarity on embedding with 0 norm.`);return n/Math.sqrt(r*i)}var vl;P[516587230]=[0,B,Hc,Uc,D],P[518928384]=Uc;var yl=new Uint8Array([0,97,115,109,1,0,0,0,1,5,1,96,0,1,123,3,2,1,0,10,10,1,8,0,65,0,253,15,253,98,11]);async function bl(e){if(e)return!0;if(vl===void 0)try{await WebAssembly.instantiate(yl),vl=!0}catch{vl=!1}return vl}async function xl(e,t,n){return{wasmLoaderPath:`${t}/${e}_${n=`wasm${n?`_module`:``}${await bl(n)?``:`_nosimd`}_internal`}.js`,wasmBinaryPath:`${t}/${e}_${n}.wasm`}}var Sl=class{};function Cl(){var e=navigator;return typeof OffscreenCanvas<`u`&&(!function(e=navigator){return(e=e.userAgent).includes(`Safari`)&&!e.includes(`Chrome`)}(e)||!!((e=e.userAgent.match(/Version\/([\d]+).*Safari/))&&e.length>=1&&Number(e[1])>=17))}async function wl(e){if(typeof importScripts!=`function`){let t=document.createElement(`script`);return t.src=e.toString(),t.crossOrigin=`anonymous`,new Promise(((e,n)=>{t.addEventListener(`load`,(()=>{e()}),!1),t.addEventListener(`error`,(e=>{n(e)}),!1),document.body.appendChild(t)}))}try{importScripts(e.toString())}catch(t){if(!(t instanceof TypeError))throw t;{let t=self.import;t?await t(e.toString()):await import(e.toString())}}}function Tl(e){return e.videoWidth===void 0?e.naturalWidth===void 0?e.displayWidth===void 0?[e.width,e.height]:[e.displayWidth,e.displayHeight]:[e.naturalWidth,e.naturalHeight]:[e.videoWidth,e.videoHeight]}function V(e,t,n){e.m||console.error(`No wasm multistream support detected: ensure dependency inclusion of :gl_graph_runner_internal_multi_input target`),n(t=e.i.stringToNewUTF8(t)),e.i._free(t)}function El(e,t,n){if(!e.i.canvas)throw Error(`No OpenGL canvas configured.`);if(n?e.i._bindTextureToStream(n):e.i._bindTextureToCanvas(),!(n=e.i.canvas.getContext(`webgl2`)||e.i.canvas.getContext(`webgl`)))throw Error("Failed to obtain WebGL context from the provided canvas. `getContext()` should only be invoked with `webgl` or `webgl2`.");e.i.gpuOriginForWebTexturesIsBottomLeft&&n.pixelStorei(n.UNPACK_FLIP_Y_WEBGL,!0),n.texImage2D(n.TEXTURE_2D,0,n.RGBA,n.RGBA,n.UNSIGNED_BYTE,t),e.i.gpuOriginForWebTexturesIsBottomLeft&&n.pixelStorei(n.UNPACK_FLIP_Y_WEBGL,!1);let[r,i]=Tl(t);return!e.l||r===e.i.canvas.width&&i===e.i.canvas.height||(e.i.canvas.width=r,e.i.canvas.height=i),[r,i]}function Dl(e,t,n){e.m||console.error(`No wasm multistream support detected: ensure dependency inclusion of :gl_graph_runner_internal_multi_input target`);let r=new Uint32Array(t.length);for(let n=0;n<t.length;n++)r[n]=e.i.stringToNewUTF8(t[n]);t=e.i._malloc(4*r.length),e.i.HEAPU32.set(r,t>>2),n(t);for(let t of r)e.i._free(t);e.i._free(t)}function Ol(e,t,n){e.i.simpleListeners=e.i.simpleListeners||{},e.i.simpleListeners[t]=n}function kl(e,t,n){let r=[];e.i.simpleListeners=e.i.simpleListeners||{},e.i.simpleListeners[t]=(e,t,i)=>{t?(n(r,i),r=[]):r.push(e)}}Sl.forVisionTasks=function(e,t=!1){return xl(`vision`,e??Ss``,t)},Sl.forTextTasks=function(e,t=!1){return xl(`text`,e??Ss``,t)},Sl.forGenAiTasks=function(e,t=!1){return xl(`genai`,e??Ss``,t)},Sl.forAudioTasks=function(e,t=!1){return xl(`audio`,e??Ss``,t)},Sl.isSimdSupported=function(e=!1){return bl(e)};async function Al(e,t,n,r){return e=await(async(e,t,n,r,i)=>{if(t&&await wl(t),!self.ModuleFactory||n&&(await wl(n),!self.ModuleFactory))throw Error(`ModuleFactory not set.`);return self.Module&&i&&((t=self.Module).locateFile=i.locateFile,i.mainScriptUrlOrBlob&&(t.mainScriptUrlOrBlob=i.mainScriptUrlOrBlob)),i=await self.ModuleFactory(self.Module||i),self.ModuleFactory=self.Module=void 0,new e(i,r)})(e,n.wasmLoaderPath,n.assetLoaderPath,t,{locateFile:e=>e.endsWith(`.wasm`)?n.wasmBinaryPath.toString():n.assetBinaryPath&&e.endsWith(`.data`)?n.assetBinaryPath.toString():e}),await e.o(r),e}function jl(e,t){let n=S(e.baseOptions,hc,1)||new hc;typeof t==`string`?(b(n,2,ii(t)),b(n,1)):t instanceof Uint8Array&&(b(n,1,ar(t,!1)),b(n,2)),C(e.baseOptions,0,1,n)}function Ml(e){try{let t=e.H.length;if(t===1)throw Error(e.H[0].message);if(t>1)throw Error(`Encountered multiple errors: `+e.H.map((e=>e.message)).join(`, `))}finally{e.H=[]}}function H(e,t){e.C=Math.max(e.C,t)}function Nl(e,t){e.B=new Ns,ma(e.B,2,`PassThroughCalculator`),F(e.B,`free_memory`),I(e.B,`free_memory_unused_out`),L(t,`free_memory`),Ls(t,e.B)}function Pl(e,t){F(e.B,t),I(e.B,t+`_unused_out`)}function Fl(e){e.g.addBoolToStream(!0,`free_memory`,e.C)}var Il=class{constructor(e){this.g=e,this.H=[],this.C=0,this.g.setAutoRenderToScreen(!1)}l(e,t=!0){if(t){let t=e.baseOptions||{};if(e.baseOptions?.modelAssetBuffer&&e.baseOptions?.modelAssetPath)throw Error(`Cannot set both baseOptions.modelAssetPath and baseOptions.modelAssetBuffer`);if(!(S(this.baseOptions,hc,1)?.g()||S(this.baseOptions,hc,1)?.l()||e.baseOptions?.modelAssetBuffer||e.baseOptions?.modelAssetPath))throw Error(`Either baseOptions.modelAssetPath or baseOptions.modelAssetBuffer must be set`);if(function(e,t){let n=S(e.baseOptions,pc,3);if(!n){var r=n=new pc,i=new Os;la(r,4,mc,i)}`delegate`in t&&(t.delegate===`GPU`?(t=n,r=new ws,la(t,2,mc,r)):(t=n,r=new Os,la(t,4,mc,r))),C(e.baseOptions,0,3,n)}(this,t),t.modelAssetPath)return fetch(t.modelAssetPath.toString()).then((e=>{if(e.ok)return e.arrayBuffer();throw Error(`Failed to fetch model: ${t.modelAssetPath} (${e.status})`)})).then((e=>{try{this.g.i.FS_unlink(`/model.dat`)}catch{}this.g.i.FS_createDataFile(`/`,`model.dat`,new Uint8Array(e),!0,!1,!1),jl(this,`/model.dat`),this.m(),this.L()}));if(t.modelAssetBuffer instanceof Uint8Array)jl(this,t.modelAssetBuffer);else if(t.modelAssetBuffer)return async function(e){let t=[];for(var n=0;;){let{done:r,value:i}=await e.read();if(r)break;t.push(i),n+=i.length}if(t.length===0)return new Uint8Array;if(t.length===1)return t[0];e=new Uint8Array(n),n=0;for(let r of t)e.set(r,n),n+=r.length;return e}(t.modelAssetBuffer).then((e=>{jl(this,e),this.m(),this.L()}))}return this.m(),this.L(),Promise.resolve()}L(){}ca(){let e;if(this.g.ca((t=>{e=Bs(t)})),!e)throw Error(`Failed to retrieve CalculatorGraphConfig`);return e}setGraph(e,t){this.g.attachErrorListener(((e,t)=>{this.H.push(Error(t))})),this.g.Ja(),this.g.setGraph(e,t),this.B=void 0,Ml(this)}finishProcessing(){this.g.finishProcessing(),Ml(this)}close(){this.B=void 0,this.g.closeGraph()}};function Ll(e,t){if(!e)throw Error(`Unable to obtain required WebGL resource: ${t}`);return e}Il.prototype.close=Il.prototype.close;var Rl=class{constructor(e,t,n,r){this.g=e,this.h=t,this.m=n,this.l=r}bind(){this.g.bindVertexArray(this.h)}close(){this.g.deleteVertexArray(this.h),this.g.deleteBuffer(this.m),this.g.deleteBuffer(this.l)}};function zl(e,t,n){let r=e.g;if(n=Ll(r.createShader(n),`Failed to create WebGL shader`),r.shaderSource(n,t),r.compileShader(n),!r.getShaderParameter(n,r.COMPILE_STATUS))throw Error(`Could not compile WebGL shader: ${r.getShaderInfoLog(n)}`);return r.attachShader(e.h,n),n}function Bl(e,t){let n=e.g,r=Ll(n.createVertexArray(),`Failed to create vertex array`);n.bindVertexArray(r);let i=Ll(n.createBuffer(),`Failed to create buffer`);n.bindBuffer(n.ARRAY_BUFFER,i),n.enableVertexAttribArray(e.O),n.vertexAttribPointer(e.O,2,n.FLOAT,!1,0,0),n.bufferData(n.ARRAY_BUFFER,new Float32Array([-1,-1,-1,1,1,1,1,-1]),n.STATIC_DRAW);let a=Ll(n.createBuffer(),`Failed to create buffer`);return n.bindBuffer(n.ARRAY_BUFFER,a),n.enableVertexAttribArray(e.L),n.vertexAttribPointer(e.L,2,n.FLOAT,!1,0,0),n.bufferData(n.ARRAY_BUFFER,new Float32Array(t?[0,1,0,0,1,0,1,1]:[0,0,0,1,1,1,1,0]),n.STATIC_DRAW),n.bindBuffer(n.ARRAY_BUFFER,null),n.bindVertexArray(null),new Rl(n,r,i,a)}function Vl(e,t){if(e.g){if(t!==e.g)throw Error(`Cannot change GL context once initialized`)}else e.g=t}function Hl(e,t,n,r){return Vl(e,t),e.h||(e.m(),e.D()),n?(e.u||=Bl(e,!0),n=e.u):(e.A||=Bl(e,!1),n=e.A),t.useProgram(e.h),n.bind(),e.l(),e=r(),n.g.bindVertexArray(null),e}function Ul(e,t,n){return Vl(e,t),e=Ll(t.createTexture(),`Failed to create texture`),t.bindTexture(t.TEXTURE_2D,e),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,n??t.LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,n??t.LINEAR),t.bindTexture(t.TEXTURE_2D,null),e}function Wl(e,t,n){Vl(e,t),e.B||=Ll(t.createFramebuffer(),`Failed to create framebuffe.`),t.bindFramebuffer(t.FRAMEBUFFER,e.B),t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,n,0)}function Gl(e){e.g?.bindFramebuffer(e.g.FRAMEBUFFER,null)}var Kl=class{H(){return`
2
- precision mediump float;
3
- varying vec2 vTex;
4
- uniform sampler2D inputTexture;
5
- void main() {
6
- gl_FragColor = texture2D(inputTexture, vTex);
7
- }
8
- `}m(){let e=this.g;if(this.h=Ll(e.createProgram(),`Failed to create WebGL program`),this.X=zl(this,`
9
- attribute vec2 aVertex;
10
- attribute vec2 aTex;
11
- varying vec2 vTex;
12
- void main(void) {
13
- gl_Position = vec4(aVertex, 0.0, 1.0);
14
- vTex = aTex;
15
- }`,e.VERTEX_SHADER),this.W=zl(this,this.H(),e.FRAGMENT_SHADER),e.linkProgram(this.h),!e.getProgramParameter(this.h,e.LINK_STATUS))throw Error(`Error during program linking: ${e.getProgramInfoLog(this.h)}`);this.O=e.getAttribLocation(this.h,`aVertex`),this.L=e.getAttribLocation(this.h,`aTex`)}D(){}l(){}close(){if(this.h){let e=this.g;e.deleteProgram(this.h),e.deleteShader(this.X),e.deleteShader(this.W)}this.B&&this.g.deleteFramebuffer(this.B),this.A&&this.A.close(),this.u&&this.u.close()}},ql=class extends Kl{H(){return`
16
- precision mediump float;
17
- uniform sampler2D backgroundTexture;
18
- uniform sampler2D maskTexture;
19
- uniform sampler2D colorMappingTexture;
20
- varying vec2 vTex;
21
- void main() {
22
- vec4 backgroundColor = texture2D(backgroundTexture, vTex);
23
- float category = texture2D(maskTexture, vTex).r;
24
- vec4 categoryColor = texture2D(colorMappingTexture, vec2(category, 0.0));
25
- gl_FragColor = mix(backgroundColor, categoryColor, categoryColor.a);
26
- }
27
- `}D(){let e=this.g;e.activeTexture(e.TEXTURE1),this.C=Ul(this,e,e.LINEAR),e.activeTexture(e.TEXTURE2),this.j=Ul(this,e,e.NEAREST)}m(){super.m();let e=this.g;this.P=Ll(e.getUniformLocation(this.h,`backgroundTexture`),`Uniform location`),this.U=Ll(e.getUniformLocation(this.h,`colorMappingTexture`),`Uniform location`),this.M=Ll(e.getUniformLocation(this.h,`maskTexture`),`Uniform location`)}l(){super.l();let e=this.g;e.uniform1i(this.M,0),e.uniform1i(this.P,1),e.uniform1i(this.U,2)}close(){this.C&&this.g.deleteTexture(this.C),this.j&&this.g.deleteTexture(this.j),super.close()}},Jl=class extends Kl{H(){return`
28
- precision mediump float;
29
- uniform sampler2D maskTexture;
30
- uniform sampler2D defaultTexture;
31
- uniform sampler2D overlayTexture;
32
- varying vec2 vTex;
33
- void main() {
34
- float confidence = texture2D(maskTexture, vTex).r;
35
- vec4 defaultColor = texture2D(defaultTexture, vTex);
36
- vec4 overlayColor = texture2D(overlayTexture, vTex);
37
- // Apply the alpha from the overlay and merge in the default color
38
- overlayColor = mix(defaultColor, overlayColor, overlayColor.a);
39
- gl_FragColor = mix(defaultColor, overlayColor, confidence);
40
- }
41
- `}D(){let e=this.g;e.activeTexture(e.TEXTURE1),this.j=Ul(this,e),e.activeTexture(e.TEXTURE2),this.C=Ul(this,e)}m(){super.m();let e=this.g;this.M=Ll(e.getUniformLocation(this.h,`defaultTexture`),`Uniform location`),this.P=Ll(e.getUniformLocation(this.h,`overlayTexture`),`Uniform location`),this.I=Ll(e.getUniformLocation(this.h,`maskTexture`),`Uniform location`)}l(){super.l();let e=this.g;e.uniform1i(this.I,0),e.uniform1i(this.M,1),e.uniform1i(this.P,2)}close(){this.j&&this.g.deleteTexture(this.j),this.C&&this.g.deleteTexture(this.C),super.close()}};function Yl(e,t){switch(t){case 0:return e.g.find((e=>e instanceof Uint8Array));case 1:return e.g.find((e=>e instanceof Float32Array));case 2:return e.g.find((e=>typeof WebGLTexture<`u`&&e instanceof WebGLTexture));default:throw Error(`Type is not supported: ${t}`)}}function Xl(e){var t=Yl(e,1);if(!t){if(t=Yl(e,0))t=new Float32Array(t).map((e=>e/255));else{t=new Float32Array(e.width*e.height);let r=Ql(e);var n=eu(e);if(Wl(n,r,Zl(e)),`iPad Simulator;iPhone Simulator;iPod Simulator;iPad;iPhone;iPod`.split(`;`).includes(navigator.platform)||navigator.userAgent.includes(`Mac`)&&`document`in self&&`ontouchend`in self.document){n=new Float32Array(e.width*e.height*4),r.readPixels(0,0,e.width,e.height,r.RGBA,r.FLOAT,n);for(let e=0,r=0;e<t.length;++e,r+=4)t[e]=n[r]}else r.readPixels(0,0,e.width,e.height,r.RED,r.FLOAT,t)}e.g.push(t)}return t}function Zl(e){let t=Yl(e,2);if(!t){let n=Ql(e);t=tu(e);let r=Xl(e),i=$l(e);n.texImage2D(n.TEXTURE_2D,0,i,e.width,e.height,0,n.RED,n.FLOAT,r),nu(e)}return t}function Ql(e){if(!e.canvas)throw Error(`Conversion to different image formats require that a canvas is passed when initializing the image.`);return e.h||=Ll(e.canvas.getContext(`webgl2`),`You cannot use a canvas that is already bound to a different type of rendering context.`),e.h}function $l(e){if(e=Ql(e),!ru)if(e.getExtension(`EXT_color_buffer_float`)&&e.getExtension(`OES_texture_float_linear`)&&e.getExtension(`EXT_float_blend`))ru=e.R32F;else{if(!e.getExtension(`EXT_color_buffer_half_float`))throw Error(`GPU does not fully support 4-channel float32 or float16 formats`);ru=e.R16F}return ru}function eu(e){return e.l||=new Kl,e.l}function tu(e){let t=Ql(e);t.viewport(0,0,e.width,e.height),t.activeTexture(t.TEXTURE0);let n=Yl(e,2);return n||(n=Ul(eu(e),t,e.m?t.LINEAR:t.NEAREST),e.g.push(n),e.j=!0),t.bindTexture(t.TEXTURE_2D,n),n}function nu(e){e.h.bindTexture(e.h.TEXTURE_2D,null)}var ru,U=class{constructor(e,t,n,r,i,a,o){this.g=e,this.m=t,this.j=n,this.canvas=r,this.l=i,this.width=a,this.height=o,this.j&&--iu===0&&console.error(`You seem to be creating MPMask instances without invoking .close(). This leaks resources.`)}Fa(){return!!Yl(this,0)}ka(){return!!Yl(this,1)}R(){return!!Yl(this,2)}ja(){return(t=Yl(e=this,0))||(t=Xl(e),t=new Uint8Array(t.map((e=>Math.round(255*e)))),e.g.push(t)),t;var e,t}ia(){return Xl(this)}N(){return Zl(this)}clone(){let e=[];for(let t of this.g){let n;if(t instanceof Uint8Array)n=new Uint8Array(t);else if(t instanceof Float32Array)n=new Float32Array(t);else{if(!(t instanceof WebGLTexture))throw Error(`Type is not supported: ${t}`);{let e=Ql(this),t=eu(this);e.activeTexture(e.TEXTURE1),n=Ul(t,e,this.m?e.LINEAR:e.NEAREST),e.bindTexture(e.TEXTURE_2D,n);let r=$l(this);e.texImage2D(e.TEXTURE_2D,0,r,this.width,this.height,0,e.RED,e.FLOAT,null),e.bindTexture(e.TEXTURE_2D,null),Wl(t,e,n),Hl(t,e,!1,(()=>{tu(this),e.clearColor(0,0,0,0),e.clear(e.COLOR_BUFFER_BIT),e.drawArrays(e.TRIANGLE_FAN,0,4),nu(this)})),Gl(t),nu(this)}}e.push(n)}return new U(e,this.m,this.R(),this.canvas,this.l,this.width,this.height)}close(){this.j&&Ql(this).deleteTexture(Yl(this,2)),iu=-1}};U.prototype.close=U.prototype.close,U.prototype.clone=U.prototype.clone,U.prototype.getAsWebGLTexture=U.prototype.N,U.prototype.getAsFloat32Array=U.prototype.ia,U.prototype.getAsUint8Array=U.prototype.ja,U.prototype.hasWebGLTexture=U.prototype.R,U.prototype.hasFloat32Array=U.prototype.ka,U.prototype.hasUint8Array=U.prototype.Fa;var iu=250,au={color:`white`,lineWidth:4,radius:6};function ou(e){return{...au,fillColor:(e||={}).color,...e}}function su(e,t){return e instanceof Function?e(t):e}function cu(e,t,n){return Math.max(Math.min(t,n),Math.min(Math.max(t,n),e))}function lu(e){if(!e.l)throw Error(`CPU rendering requested but CanvasRenderingContext2D not provided.`);return e.l}function uu(e){if(!e.j)throw Error(`GPU rendering requested but WebGL2RenderingContext not provided.`);return e.j}function du(e,t,n){if(t.R())n(t.N());else{let r=t.ka()?t.ia():t.ja();e.m=e.m??new Kl;let i=uu(e);n((e=new U([r],t.m,!1,i.canvas,e.m,t.width,t.height)).N()),e.close()}}function fu(e,t,n,r){let i=function(e){return e.g||=new ql,e.g}(e),a=uu(e),o=Array.isArray(n)?new ImageData(new Uint8ClampedArray(n),1,1):n;Hl(i,a,!0,(()=>{(function(e,t,n,r){let i=e.g;if(i.activeTexture(i.TEXTURE0),i.bindTexture(i.TEXTURE_2D,t),i.activeTexture(i.TEXTURE1),i.bindTexture(i.TEXTURE_2D,e.C),i.texImage2D(i.TEXTURE_2D,0,i.RGBA,i.RGBA,i.UNSIGNED_BYTE,n),e.I&&function(e,t){if(e!==t)return!1;e=e.entries(),t=t.entries();for(let[n,r]of e){e=n;let i=r,a=t.next();if(a.done)return!1;let[o,s]=a.value;if(e!==o||i[0]!==s[0]||i[1]!==s[1]||i[2]!==s[2]||i[3]!==s[3])return!1}return!!t.next().done}(e.I,r))i.activeTexture(i.TEXTURE2),i.bindTexture(i.TEXTURE_2D,e.j);else{e.I=r;let t=Array(1024).fill(0);r.forEach(((e,n)=>{if(e.length!==4)throw Error(`Color at index ${n} is not a four-channel value.`);t[4*n]=e[0],t[4*n+1]=e[1],t[4*n+2]=e[2],t[4*n+3]=e[3]})),i.activeTexture(i.TEXTURE2),i.bindTexture(i.TEXTURE_2D,e.j),i.texImage2D(i.TEXTURE_2D,0,i.RGBA,256,1,0,i.RGBA,i.UNSIGNED_BYTE,new Uint8Array(t))}})(i,t,o,r),a.clearColor(0,0,0,0),a.clear(a.COLOR_BUFFER_BIT),a.drawArrays(a.TRIANGLE_FAN,0,4);let e=i.g;e.activeTexture(e.TEXTURE0),e.bindTexture(e.TEXTURE_2D,null),e.activeTexture(e.TEXTURE1),e.bindTexture(e.TEXTURE_2D,null),e.activeTexture(e.TEXTURE2),e.bindTexture(e.TEXTURE_2D,null)}))}function pu(e,t,n,r){let i=uu(e),a=function(e){return e.h||=new Jl,e.h}(e),o=Array.isArray(n)?new ImageData(new Uint8ClampedArray(n),1,1):n,s=Array.isArray(r)?new ImageData(new Uint8ClampedArray(r),1,1):r;Hl(a,i,!0,(()=>{var e=a.g;e.activeTexture(e.TEXTURE0),e.bindTexture(e.TEXTURE_2D,t),e.activeTexture(e.TEXTURE1),e.bindTexture(e.TEXTURE_2D,a.j),e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,o),e.activeTexture(e.TEXTURE2),e.bindTexture(e.TEXTURE_2D,a.C),e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,s),i.clearColor(0,0,0,0),i.clear(i.COLOR_BUFFER_BIT),i.drawArrays(i.TRIANGLE_FAN,0,4),i.bindTexture(i.TEXTURE_2D,null),(e=a.g).activeTexture(e.TEXTURE0),e.bindTexture(e.TEXTURE_2D,null),e.activeTexture(e.TEXTURE1),e.bindTexture(e.TEXTURE_2D,null),e.activeTexture(e.TEXTURE2),e.bindTexture(e.TEXTURE_2D,null)}))}var mu=class{constructor(e,t){typeof CanvasRenderingContext2D<`u`&&e instanceof CanvasRenderingContext2D||e instanceof OffscreenCanvasRenderingContext2D?(this.l=e,this.j=t):this.j=e}ya(e,t){if(e){var n=lu(this);t=ou(t),n.save();var r=n.canvas,i=0;for(let a of e)n.fillStyle=su(t.fillColor,{index:i,from:a}),n.strokeStyle=su(t.color,{index:i,from:a}),n.lineWidth=su(t.lineWidth,{index:i,from:a}),(e=new Path2D).arc(a.x*r.width,a.y*r.height,su(t.radius,{index:i,from:a}),0,2*Math.PI),n.fill(e),n.stroke(e),++i;n.restore()}}xa(e,t,n){if(e&&t){var r=lu(this);n=ou(n),r.save();var i=r.canvas,a=0;for(let o of t){r.beginPath(),t=e[o.start];let s=e[o.end];t&&s&&(r.strokeStyle=su(n.color,{index:a,from:t,to:s}),r.lineWidth=su(n.lineWidth,{index:a,from:t,to:s}),r.moveTo(t.x*i.width,t.y*i.height),r.lineTo(s.x*i.width,s.y*i.height)),++a,r.stroke()}r.restore()}}ua(e,t){let n=lu(this);t=ou(t),n.save(),n.beginPath(),n.lineWidth=su(t.lineWidth,{}),n.strokeStyle=su(t.color,{}),n.fillStyle=su(t.fillColor,{}),n.moveTo(e.originX,e.originY),n.lineTo(e.originX+e.width,e.originY),n.lineTo(e.originX+e.width,e.originY+e.height),n.lineTo(e.originX,e.originY+e.height),n.lineTo(e.originX,e.originY),n.stroke(),n.fill(),n.restore()}va(e,t,n=[0,0,0,255]){this.l?function(e,t,n,r){let i=uu(e);du(e,t,(t=>{fu(e,t,n,r),(t=lu(e)).drawImage(i.canvas,0,0,t.canvas.width,t.canvas.height)}))}(this,e,n,t):fu(this,e.N(),n,t)}wa(e,t,n){this.l?function(e,t,n,r){let i=uu(e);du(e,t,(t=>{pu(e,t,n,r),(t=lu(e)).drawImage(i.canvas,0,0,t.canvas.width,t.canvas.height)}))}(this,e,t,n):pu(this,e.N(),t,n)}close(){this.g?.close(),this.g=void 0,this.h?.close(),this.h=void 0,this.m?.close(),this.m=void 0}};function hu(e,t){switch(t){case 0:return e.g.find((e=>e instanceof ImageData));case 1:return e.g.find((e=>typeof ImageBitmap<`u`&&e instanceof ImageBitmap));case 2:return e.g.find((e=>typeof WebGLTexture<`u`&&e instanceof WebGLTexture));default:throw Error(`Type is not supported: ${t}`)}}function gu(e){var t=hu(e,0);if(!t){t=vu(e);let n=yu(e),r=new Uint8Array(e.width*e.height*4);Wl(n,t,_u(e)),t.readPixels(0,0,e.width,e.height,t.RGBA,t.UNSIGNED_BYTE,r),Gl(n),t=new ImageData(new Uint8ClampedArray(r.buffer),e.width,e.height),e.g.push(t)}return t}function _u(e){let t=hu(e,2);if(!t){let n=vu(e);t=bu(e);let r=hu(e,1)||gu(e);n.texImage2D(n.TEXTURE_2D,0,n.RGBA,n.RGBA,n.UNSIGNED_BYTE,r),xu(e)}return t}function vu(e){if(!e.canvas)throw Error(`Conversion to different image formats require that a canvas is passed when initializing the image.`);return e.h||=Ll(e.canvas.getContext(`webgl2`),`You cannot use a canvas that is already bound to a different type of rendering context.`),e.h}function yu(e){return e.l||=new Kl,e.l}function bu(e){let t=vu(e);t.viewport(0,0,e.width,e.height),t.activeTexture(t.TEXTURE0);let n=hu(e,2);return n||(n=Ul(yu(e),t),e.g.push(n),e.m=!0),t.bindTexture(t.TEXTURE_2D,n),n}function xu(e){e.h.bindTexture(e.h.TEXTURE_2D,null)}function Su(e){let t=vu(e);return Hl(yu(e),t,!0,(()=>function(e,t){let n=e.canvas;if(n.width===e.width&&n.height===e.height)return t();let r=n.width,i=n.height;return n.width=e.width,n.height=e.height,e=t(),n.width=r,n.height=i,e}(e,(()=>{if(t.bindFramebuffer(t.FRAMEBUFFER,null),t.clearColor(0,0,0,0),t.clear(t.COLOR_BUFFER_BIT),t.drawArrays(t.TRIANGLE_FAN,0,4),!(e.canvas instanceof OffscreenCanvas))throw Error(`Conversion to ImageBitmap requires that the MediaPipe Tasks is initialized with an OffscreenCanvas`);return e.canvas.transferToImageBitmap()}))))}mu.prototype.close=mu.prototype.close,mu.prototype.drawConfidenceMask=mu.prototype.wa,mu.prototype.drawCategoryMask=mu.prototype.va,mu.prototype.drawBoundingBox=mu.prototype.ua,mu.prototype.drawConnectors=mu.prototype.xa,mu.prototype.drawLandmarks=mu.prototype.ya,mu.lerp=function(e,t,n,r,i){return cu(r*(1-(e-t)/(n-t))+i*(1-(n-e)/(n-t)),r,i)},mu.clamp=cu;var W=class{constructor(e,t,n,r,i,a,o){this.g=e,this.j=t,this.m=n,this.canvas=r,this.l=i,this.width=a,this.height=o,(this.j||this.m)&&--Cu===0&&console.error(`You seem to be creating MPImage instances without invoking .close(). This leaks resources.`)}Ea(){return!!hu(this,0)}la(){return!!hu(this,1)}R(){return!!hu(this,2)}Ca(){return gu(this)}Ba(){var e=hu(this,1);return e||(_u(this),bu(this),e=Su(this),xu(this),this.g.push(e),this.j=!0),e}N(){return _u(this)}clone(){let e=[];for(let t of this.g){let n;if(t instanceof ImageData)n=new ImageData(t.data,this.width,this.height);else if(t instanceof WebGLTexture){let e=vu(this),t=yu(this);e.activeTexture(e.TEXTURE1),n=Ul(t,e),e.bindTexture(e.TEXTURE_2D,n),e.texImage2D(e.TEXTURE_2D,0,e.RGBA,this.width,this.height,0,e.RGBA,e.UNSIGNED_BYTE,null),e.bindTexture(e.TEXTURE_2D,null),Wl(t,e,n),Hl(t,e,!1,(()=>{bu(this),e.clearColor(0,0,0,0),e.clear(e.COLOR_BUFFER_BIT),e.drawArrays(e.TRIANGLE_FAN,0,4),xu(this)})),Gl(t),xu(this)}else{if(!(t instanceof ImageBitmap))throw Error(`Type is not supported: ${t}`);_u(this),bu(this),n=Su(this),xu(this)}e.push(n)}return new W(e,this.la(),this.R(),this.canvas,this.l,this.width,this.height)}close(){this.j&&hu(this,1).close(),this.m&&vu(this).deleteTexture(hu(this,2)),Cu=-1}};W.prototype.close=W.prototype.close,W.prototype.clone=W.prototype.clone,W.prototype.getAsWebGLTexture=W.prototype.N,W.prototype.getAsImageBitmap=W.prototype.Ba,W.prototype.getAsImageData=W.prototype.Ca,W.prototype.hasWebGLTexture=W.prototype.R,W.prototype.hasImageBitmap=W.prototype.la,W.prototype.hasImageData=W.prototype.Ea;var Cu=250;function wu(...e){return e.map((([e,t])=>({start:e,end:t})))}var Tu=function(e){return class extends e{Ja(){this.i._registerModelResourcesGraphService()}}}((Eu=class{constructor(e,t){this.l=!0,this.i=e,this.g=null,this.h=0,this.m=typeof this.i._addIntToInputStream==`function`,t===void 0?Cl()?this.i.canvas=new OffscreenCanvas(1,1):(console.warn(`OffscreenCanvas not supported and GraphRunner constructor glCanvas parameter is undefined. Creating backup canvas.`),this.i.canvas=document.createElement(`canvas`)):this.i.canvas=t}async initializeGraph(e){let t=await(await fetch(e)).arrayBuffer();e=!(e.endsWith(`.pbtxt`)||e.endsWith(`.textproto`)),this.setGraph(new Uint8Array(t),e)}setGraphFromString(e){this.setGraph(new TextEncoder().encode(e),!1)}setGraph(e,t){let n=e.length,r=this.i._malloc(n);this.i.HEAPU8.set(e,r),t?this.i._changeBinaryGraph(n,r):this.i._changeTextGraph(n,r),this.i._free(r)}configureAudio(e,t,n,r,i){this.i._configureAudio||console.warn(`Attempting to use configureAudio without support for input audio. Is build dep ":gl_graph_runner_audio" missing?`),V(this,r||`input_audio`,(r=>{V(this,i||=`audio_header`,(i=>{this.i._configureAudio(r,i,e,t??0,n)}))}))}setAutoResizeCanvas(e){this.l=e}setAutoRenderToScreen(e){this.i._setAutoRenderToScreen(e)}setGpuBufferVerticalFlip(e){this.i.gpuOriginForWebTexturesIsBottomLeft=e}ca(e){Ol(this,`__graph_config__`,(t=>{e(t)})),V(this,`__graph_config__`,(e=>{this.i._getGraphConfig(e,void 0)})),delete this.i.simpleListeners.__graph_config__}attachErrorListener(e){this.i.errorListener=e}attachEmptyPacketListener(e,t){this.i.emptyPacketListeners=this.i.emptyPacketListeners||{},this.i.emptyPacketListeners[e]=t}addAudioToStream(e,t,n){this.addAudioToStreamWithShape(e,0,0,t,n)}addAudioToStreamWithShape(e,t,n,r,i){let a=4*e.length;this.h!==a&&(this.g&&this.i._free(this.g),this.g=this.i._malloc(a),this.h=a),this.i.HEAPF32.set(e,this.g/4),V(this,r,(e=>{this.i._addAudioToInputStream(this.g,t,n,e,i)}))}addGpuBufferToStream(e,t,n){V(this,t,(t=>{let[r,i]=El(this,e,t);this.i._addBoundTextureToStream(t,r,i,n)}))}addBoolToStream(e,t,n){V(this,t,(t=>{this.i._addBoolToInputStream(e,t,n)}))}addDoubleToStream(e,t,n){V(this,t,(t=>{this.i._addDoubleToInputStream(e,t,n)}))}addFloatToStream(e,t,n){V(this,t,(t=>{this.i._addFloatToInputStream(e,t,n)}))}addIntToStream(e,t,n){V(this,t,(t=>{this.i._addIntToInputStream(e,t,n)}))}addUintToStream(e,t,n){V(this,t,(t=>{this.i._addUintToInputStream(e,t,n)}))}addStringToStream(e,t,n){V(this,t,(t=>{V(this,e,(e=>{this.i._addStringToInputStream(e,t,n)}))}))}addStringRecordToStream(e,t,n){V(this,t,(t=>{Dl(this,Object.keys(e),(r=>{Dl(this,Object.values(e),(i=>{this.i._addFlatHashMapToInputStream(r,i,Object.keys(e).length,t,n)}))}))}))}addProtoToStream(e,t,n,r){V(this,n,(n=>{V(this,t,(t=>{let i=this.i._malloc(e.length);this.i.HEAPU8.set(e,i),this.i._addProtoToInputStream(i,e.length,t,n,r),this.i._free(i)}))}))}addEmptyPacketToStream(e,t){V(this,e,(e=>{this.i._addEmptyPacketToInputStream(e,t)}))}addBoolVectorToStream(e,t,n){V(this,t,(t=>{let r=this.i._allocateBoolVector(e.length);if(!r)throw Error(`Unable to allocate new bool vector on heap.`);for(let t of e)this.i._addBoolVectorEntry(r,t);this.i._addBoolVectorToInputStream(r,t,n)}))}addDoubleVectorToStream(e,t,n){V(this,t,(t=>{let r=this.i._allocateDoubleVector(e.length);if(!r)throw Error(`Unable to allocate new double vector on heap.`);for(let t of e)this.i._addDoubleVectorEntry(r,t);this.i._addDoubleVectorToInputStream(r,t,n)}))}addFloatVectorToStream(e,t,n){V(this,t,(t=>{let r=this.i._allocateFloatVector(e.length);if(!r)throw Error(`Unable to allocate new float vector on heap.`);for(let t of e)this.i._addFloatVectorEntry(r,t);this.i._addFloatVectorToInputStream(r,t,n)}))}addIntVectorToStream(e,t,n){V(this,t,(t=>{let r=this.i._allocateIntVector(e.length);if(!r)throw Error(`Unable to allocate new int vector on heap.`);for(let t of e)this.i._addIntVectorEntry(r,t);this.i._addIntVectorToInputStream(r,t,n)}))}addUintVectorToStream(e,t,n){V(this,t,(t=>{let r=this.i._allocateUintVector(e.length);if(!r)throw Error(`Unable to allocate new unsigned int vector on heap.`);for(let t of e)this.i._addUintVectorEntry(r,t);this.i._addUintVectorToInputStream(r,t,n)}))}addStringVectorToStream(e,t,n){V(this,t,(t=>{let r=this.i._allocateStringVector(e.length);if(!r)throw Error(`Unable to allocate new string vector on heap.`);for(let t of e)V(this,t,(e=>{this.i._addStringVectorEntry(r,e)}));this.i._addStringVectorToInputStream(r,t,n)}))}addBoolToInputSidePacket(e,t){V(this,t,(t=>{this.i._addBoolToInputSidePacket(e,t)}))}addDoubleToInputSidePacket(e,t){V(this,t,(t=>{this.i._addDoubleToInputSidePacket(e,t)}))}addFloatToInputSidePacket(e,t){V(this,t,(t=>{this.i._addFloatToInputSidePacket(e,t)}))}addIntToInputSidePacket(e,t){V(this,t,(t=>{this.i._addIntToInputSidePacket(e,t)}))}addUintToInputSidePacket(e,t){V(this,t,(t=>{this.i._addUintToInputSidePacket(e,t)}))}addStringToInputSidePacket(e,t){V(this,t,(t=>{V(this,e,(e=>{this.i._addStringToInputSidePacket(e,t)}))}))}addProtoToInputSidePacket(e,t,n){V(this,n,(n=>{V(this,t,(t=>{let r=this.i._malloc(e.length);this.i.HEAPU8.set(e,r),this.i._addProtoToInputSidePacket(r,e.length,t,n),this.i._free(r)}))}))}addBoolVectorToInputSidePacket(e,t){V(this,t,(t=>{let n=this.i._allocateBoolVector(e.length);if(!n)throw Error(`Unable to allocate new bool vector on heap.`);for(let t of e)this.i._addBoolVectorEntry(n,t);this.i._addBoolVectorToInputSidePacket(n,t)}))}addDoubleVectorToInputSidePacket(e,t){V(this,t,(t=>{let n=this.i._allocateDoubleVector(e.length);if(!n)throw Error(`Unable to allocate new double vector on heap.`);for(let t of e)this.i._addDoubleVectorEntry(n,t);this.i._addDoubleVectorToInputSidePacket(n,t)}))}addFloatVectorToInputSidePacket(e,t){V(this,t,(t=>{let n=this.i._allocateFloatVector(e.length);if(!n)throw Error(`Unable to allocate new float vector on heap.`);for(let t of e)this.i._addFloatVectorEntry(n,t);this.i._addFloatVectorToInputSidePacket(n,t)}))}addIntVectorToInputSidePacket(e,t){V(this,t,(t=>{let n=this.i._allocateIntVector(e.length);if(!n)throw Error(`Unable to allocate new int vector on heap.`);for(let t of e)this.i._addIntVectorEntry(n,t);this.i._addIntVectorToInputSidePacket(n,t)}))}addUintVectorToInputSidePacket(e,t){V(this,t,(t=>{let n=this.i._allocateUintVector(e.length);if(!n)throw Error(`Unable to allocate new unsigned int vector on heap.`);for(let t of e)this.i._addUintVectorEntry(n,t);this.i._addUintVectorToInputSidePacket(n,t)}))}addStringVectorToInputSidePacket(e,t){V(this,t,(t=>{let n=this.i._allocateStringVector(e.length);if(!n)throw Error(`Unable to allocate new string vector on heap.`);for(let t of e)V(this,t,(e=>{this.i._addStringVectorEntry(n,e)}));this.i._addStringVectorToInputSidePacket(n,t)}))}attachBoolListener(e,t){Ol(this,e,t),V(this,e,(e=>{this.i._attachBoolListener(e)}))}attachBoolVectorListener(e,t){kl(this,e,t),V(this,e,(e=>{this.i._attachBoolVectorListener(e)}))}attachIntListener(e,t){Ol(this,e,t),V(this,e,(e=>{this.i._attachIntListener(e)}))}attachIntVectorListener(e,t){kl(this,e,t),V(this,e,(e=>{this.i._attachIntVectorListener(e)}))}attachUintListener(e,t){Ol(this,e,t),V(this,e,(e=>{this.i._attachUintListener(e)}))}attachUintVectorListener(e,t){kl(this,e,t),V(this,e,(e=>{this.i._attachUintVectorListener(e)}))}attachDoubleListener(e,t){Ol(this,e,t),V(this,e,(e=>{this.i._attachDoubleListener(e)}))}attachDoubleVectorListener(e,t){kl(this,e,t),V(this,e,(e=>{this.i._attachDoubleVectorListener(e)}))}attachFloatListener(e,t){Ol(this,e,t),V(this,e,(e=>{this.i._attachFloatListener(e)}))}attachFloatVectorListener(e,t){kl(this,e,t),V(this,e,(e=>{this.i._attachFloatVectorListener(e)}))}attachStringListener(e,t){Ol(this,e,t),V(this,e,(e=>{this.i._attachStringListener(e)}))}attachStringVectorListener(e,t){kl(this,e,t),V(this,e,(e=>{this.i._attachStringVectorListener(e)}))}attachProtoListener(e,t,n){Ol(this,e,t),V(this,e,(e=>{this.i._attachProtoListener(e,n||!1)}))}attachProtoVectorListener(e,t,n){kl(this,e,t),V(this,e,(e=>{this.i._attachProtoVectorListener(e,n||!1)}))}attachAudioListener(e,t,n){this.i._attachAudioListener||console.warn(`Attempting to use attachAudioListener without support for output audio. Is build dep ":gl_graph_runner_audio_out" missing?`),Ol(this,e,((e,n)=>{e=new Float32Array(e.buffer,e.byteOffset,e.length/4),t(e,n)})),V(this,e,(e=>{this.i._attachAudioListener(e,n||!1)}))}finishProcessing(){this.i._waitUntilIdle()}closeGraph(){this.i._closeGraph(),this.i.simpleListeners=void 0,this.i.emptyPacketListeners=void 0}},class extends Eu{get ga(){return this.i}pa(e,t,n){V(this,t,(t=>{let[r,i]=El(this,e,t);this.ga._addBoundTextureAsImageToStream(t,r,i,n)}))}Z(e,t){Ol(this,e,t),V(this,e,(e=>{this.ga._attachImageListener(e)}))}aa(e,t){kl(this,e,t),V(this,e,(e=>{this.ga._attachImageVectorListener(e)}))}})),Eu,Du=class extends Tu{};async function G(e,t,n){return async function(e,t,n,r){return Al(e,t,n,r)}(e,n.canvas??(Cl()?void 0:document.createElement(`canvas`)),t,n)}function Ou(e,t,n,r){if(e.U){let a=new tc;if(n?.regionOfInterest){if(!e.oa)throw Error(`This task doesn't support region-of-interest.`);var i=n.regionOfInterest;if(i.left>=i.right||i.top>=i.bottom)throw Error(`Expected RectF with left < right and top < bottom.`);if(i.left<0||i.top<0||i.right>1||i.bottom>1)throw Error(`Expected RectF values to be in [0,1].`);T(a,1,(i.left+i.right)/2),T(a,2,(i.top+i.bottom)/2),T(a,4,i.right-i.left),T(a,3,i.bottom-i.top)}else T(a,1,.5),T(a,2,.5),T(a,4,1),T(a,3,1);if(n?.rotationDegrees){if(n?.rotationDegrees%90!=0)throw Error(`Expected rotation to be a multiple of 90°.`);if(T(a,5,-Math.PI*n.rotationDegrees/180),n?.rotationDegrees%180!=0){let[e,r]=Tl(t);n=w(a,3)*r/e,i=w(a,4)*e/r,T(a,4,n),T(a,3,i)}}e.g.addProtoToStream(a.g(),`mediapipe.NormalizedRect`,e.U,r)}e.g.pa(t,e.X,r??performance.now()),e.finishProcessing()}function ku(e,t,n){if(e.baseOptions?.g())throw Error(`Task is not initialized with image mode. 'runningMode' must be set to 'IMAGE'.`);Ou(e,t,n,e.C+1)}function Au(e,t,n,r){if(!e.baseOptions?.g())throw Error(`Task is not initialized with video mode. 'runningMode' must be set to 'VIDEO'.`);Ou(e,t,n,r)}function ju(e,t,n,r){var i=t.data;let a=t.width,o=a*(t=t.height);if((i instanceof Uint8Array||i instanceof Float32Array)&&i.length!==o)throw Error(`Unsupported channel count: `+i.length/o);return e=new U([i],n,!1,e.g.i.canvas,e.P,a,t),r?e.clone():e}var Mu=class extends Il{constructor(e,t,n,r){super(e),this.g=e,this.X=t,this.U=n,this.oa=r,this.P=new Kl}l(e,t=!0){if(`runningMode`in e&&b(this.baseOptions,2,Gr(!!e.runningMode&&e.runningMode!==`IMAGE`)),e.canvas!==void 0&&this.g.i.canvas!==e.canvas)throw Error(`You must create a new task to reset the canvas.`);return super.l(e,t)}close(){this.P.close(),super.close()}};Mu.prototype.close=Mu.prototype.close;var Nu=class extends Mu{constructor(e,t){super(new Du(e,t),`image_in`,`norm_rect_in`,!1),this.j={detections:[]},C(e=this.h=new _c,0,1,t=new z),T(this.h,2,.5),T(this.h,3,.3)}get baseOptions(){return S(this.h,z,1)}set baseOptions(e){C(this.h,0,1,e)}o(e){return`minDetectionConfidence`in e&&T(this.h,2,e.minDetectionConfidence??.5),`minSuppressionThreshold`in e&&T(this.h,3,e.minSuppressionThreshold??.3),this.l(e)}F(e,t){return this.j={detections:[]},ku(this,e,t),this.j}G(e,t,n){return this.j={detections:[]},Au(this,e,n,t),this.j}m(){var e=new Rs;L(e,`image_in`),L(e,`norm_rect_in`),R(e,`detections`);let t=new js;po(t,yc,this.h);let n=new Ns;ma(n,2,`mediapipe.tasks.vision.face_detector.FaceDetectorGraph`),F(n,`IMAGE:image_in`),F(n,`NORM_RECT:norm_rect_in`),I(n,`DETECTIONS:detections`),n.o(t),Ls(e,n),this.g.attachProtoVectorListener(`detections`,((e,t)=>{for(let t of e)e=Js(t),this.j.detections.push(pl(e));H(this,t)})),this.g.attachEmptyPacketListener(`detections`,(e=>{H(this,e)})),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};Nu.prototype.detectForVideo=Nu.prototype.G,Nu.prototype.detect=Nu.prototype.F,Nu.prototype.setOptions=Nu.prototype.o,Nu.createFromModelPath=async function(e,t){return G(Nu,e,{baseOptions:{modelAssetPath:t}})},Nu.createFromModelBuffer=function(e,t){return G(Nu,e,{baseOptions:{modelAssetBuffer:t}})},Nu.createFromOptions=function(e,t){return G(Nu,e,t)};var Pu=wu([61,146],[146,91],[91,181],[181,84],[84,17],[17,314],[314,405],[405,321],[321,375],[375,291],[61,185],[185,40],[40,39],[39,37],[37,0],[0,267],[267,269],[269,270],[270,409],[409,291],[78,95],[95,88],[88,178],[178,87],[87,14],[14,317],[317,402],[402,318],[318,324],[324,308],[78,191],[191,80],[80,81],[81,82],[82,13],[13,312],[312,311],[311,310],[310,415],[415,308]),Fu=wu([263,249],[249,390],[390,373],[373,374],[374,380],[380,381],[381,382],[382,362],[263,466],[466,388],[388,387],[387,386],[386,385],[385,384],[384,398],[398,362]),Iu=wu([276,283],[283,282],[282,295],[295,285],[300,293],[293,334],[334,296],[296,336]),Lu=wu([474,475],[475,476],[476,477],[477,474]),Ru=wu([33,7],[7,163],[163,144],[144,145],[145,153],[153,154],[154,155],[155,133],[33,246],[246,161],[161,160],[160,159],[159,158],[158,157],[157,173],[173,133]),zu=wu([46,53],[53,52],[52,65],[65,55],[70,63],[63,105],[105,66],[66,107]),Bu=wu([469,470],[470,471],[471,472],[472,469]),Vu=wu([10,338],[338,297],[297,332],[332,284],[284,251],[251,389],[389,356],[356,454],[454,323],[323,361],[361,288],[288,397],[397,365],[365,379],[379,378],[378,400],[400,377],[377,152],[152,148],[148,176],[176,149],[149,150],[150,136],[136,172],[172,58],[58,132],[132,93],[93,234],[234,127],[127,162],[162,21],[21,54],[54,103],[103,67],[67,109],[109,10]),Hu=[...Pu,...Fu,...Iu,...Ru,...zu,...Vu],Uu=wu([127,34],[34,139],[139,127],[11,0],[0,37],[37,11],[232,231],[231,120],[120,232],[72,37],[37,39],[39,72],[128,121],[121,47],[47,128],[232,121],[121,128],[128,232],[104,69],[69,67],[67,104],[175,171],[171,148],[148,175],[118,50],[50,101],[101,118],[73,39],[39,40],[40,73],[9,151],[151,108],[108,9],[48,115],[115,131],[131,48],[194,204],[204,211],[211,194],[74,40],[40,185],[185,74],[80,42],[42,183],[183,80],[40,92],[92,186],[186,40],[230,229],[229,118],[118,230],[202,212],[212,214],[214,202],[83,18],[18,17],[17,83],[76,61],[61,146],[146,76],[160,29],[29,30],[30,160],[56,157],[157,173],[173,56],[106,204],[204,194],[194,106],[135,214],[214,192],[192,135],[203,165],[165,98],[98,203],[21,71],[71,68],[68,21],[51,45],[45,4],[4,51],[144,24],[24,23],[23,144],[77,146],[146,91],[91,77],[205,50],[50,187],[187,205],[201,200],[200,18],[18,201],[91,106],[106,182],[182,91],[90,91],[91,181],[181,90],[85,84],[84,17],[17,85],[206,203],[203,36],[36,206],[148,171],[171,140],[140,148],[92,40],[40,39],[39,92],[193,189],[189,244],[244,193],[159,158],[158,28],[28,159],[247,246],[246,161],[161,247],[236,3],[3,196],[196,236],[54,68],[68,104],[104,54],[193,168],[168,8],[8,193],[117,228],[228,31],[31,117],[189,193],[193,55],[55,189],[98,97],[97,99],[99,98],[126,47],[47,100],[100,126],[166,79],[79,218],[218,166],[155,154],[154,26],[26,155],[209,49],[49,131],[131,209],[135,136],[136,150],[150,135],[47,126],[126,217],[217,47],[223,52],[52,53],[53,223],[45,51],[51,134],[134,45],[211,170],[170,140],[140,211],[67,69],[69,108],[108,67],[43,106],[106,91],[91,43],[230,119],[119,120],[120,230],[226,130],[130,247],[247,226],[63,53],[53,52],[52,63],[238,20],[20,242],[242,238],[46,70],[70,156],[156,46],[78,62],[62,96],[96,78],[46,53],[53,63],[63,46],[143,34],[34,227],[227,143],[123,117],[117,111],[111,123],[44,125],[125,19],[19,44],[236,134],[134,51],[51,236],[216,206],[206,205],[205,216],[154,153],[153,22],[22,154],[39,37],[37,167],[167,39],[200,201],[201,208],[208,200],[36,142],[142,100],[100,36],[57,212],[212,202],[202,57],[20,60],[60,99],[99,20],[28,158],[158,157],[157,28],[35,226],[226,113],[113,35],[160,159],[159,27],[27,160],[204,202],[202,210],[210,204],[113,225],[225,46],[46,113],[43,202],[202,204],[204,43],[62,76],[76,77],[77,62],[137,123],[123,116],[116,137],[41,38],[38,72],[72,41],[203,129],[129,142],[142,203],[64,98],[98,240],[240,64],[49,102],[102,64],[64,49],[41,73],[73,74],[74,41],[212,216],[216,207],[207,212],[42,74],[74,184],[184,42],[169,170],[170,211],[211,169],[170,149],[149,176],[176,170],[105,66],[66,69],[69,105],[122,6],[6,168],[168,122],[123,147],[147,187],[187,123],[96,77],[77,90],[90,96],[65,55],[55,107],[107,65],[89,90],[90,180],[180,89],[101,100],[100,120],[120,101],[63,105],[105,104],[104,63],[93,137],[137,227],[227,93],[15,86],[86,85],[85,15],[129,102],[102,49],[49,129],[14,87],[87,86],[86,14],[55,8],[8,9],[9,55],[100,47],[47,121],[121,100],[145,23],[23,22],[22,145],[88,89],[89,179],[179,88],[6,122],[122,196],[196,6],[88,95],[95,96],[96,88],[138,172],[172,136],[136,138],[215,58],[58,172],[172,215],[115,48],[48,219],[219,115],[42,80],[80,81],[81,42],[195,3],[3,51],[51,195],[43,146],[146,61],[61,43],[171,175],[175,199],[199,171],[81,82],[82,38],[38,81],[53,46],[46,225],[225,53],[144,163],[163,110],[110,144],[52,65],[65,66],[66,52],[229,228],[228,117],[117,229],[34,127],[127,234],[234,34],[107,108],[108,69],[69,107],[109,108],[108,151],[151,109],[48,64],[64,235],[235,48],[62,78],[78,191],[191,62],[129,209],[209,126],[126,129],[111,35],[35,143],[143,111],[117,123],[123,50],[50,117],[222,65],[65,52],[52,222],[19,125],[125,141],[141,19],[221,55],[55,65],[65,221],[3,195],[195,197],[197,3],[25,7],[7,33],[33,25],[220,237],[237,44],[44,220],[70,71],[71,139],[139,70],[122,193],[193,245],[245,122],[247,130],[130,33],[33,247],[71,21],[21,162],[162,71],[170,169],[169,150],[150,170],[188,174],[174,196],[196,188],[216,186],[186,92],[92,216],[2,97],[97,167],[167,2],[141,125],[125,241],[241,141],[164,167],[167,37],[37,164],[72,38],[38,12],[12,72],[38,82],[82,13],[13,38],[63,68],[68,71],[71,63],[226,35],[35,111],[111,226],[101,50],[50,205],[205,101],[206,92],[92,165],[165,206],[209,198],[198,217],[217,209],[165,167],[167,97],[97,165],[220,115],[115,218],[218,220],[133,112],[112,243],[243,133],[239,238],[238,241],[241,239],[214,135],[135,169],[169,214],[190,173],[173,133],[133,190],[171,208],[208,32],[32,171],[125,44],[44,237],[237,125],[86,87],[87,178],[178,86],[85,86],[86,179],[179,85],[84,85],[85,180],[180,84],[83,84],[84,181],[181,83],[201,83],[83,182],[182,201],[137,93],[93,132],[132,137],[76,62],[62,183],[183,76],[61,76],[76,184],[184,61],[57,61],[61,185],[185,57],[212,57],[57,186],[186,212],[214,207],[207,187],[187,214],[34,143],[143,156],[156,34],[79,239],[239,237],[237,79],[123,137],[137,177],[177,123],[44,1],[1,4],[4,44],[201,194],[194,32],[32,201],[64,102],[102,129],[129,64],[213,215],[215,138],[138,213],[59,166],[166,219],[219,59],[242,99],[99,97],[97,242],[2,94],[94,141],[141,2],[75,59],[59,235],[235,75],[24,110],[110,228],[228,24],[25,130],[130,226],[226,25],[23,24],[24,229],[229,23],[22,23],[23,230],[230,22],[26,22],[22,231],[231,26],[112,26],[26,232],[232,112],[189,190],[190,243],[243,189],[221,56],[56,190],[190,221],[28,56],[56,221],[221,28],[27,28],[28,222],[222,27],[29,27],[27,223],[223,29],[30,29],[29,224],[224,30],[247,30],[30,225],[225,247],[238,79],[79,20],[20,238],[166,59],[59,75],[75,166],[60,75],[75,240],[240,60],[147,177],[177,215],[215,147],[20,79],[79,166],[166,20],[187,147],[147,213],[213,187],[112,233],[233,244],[244,112],[233,128],[128,245],[245,233],[128,114],[114,188],[188,128],[114,217],[217,174],[174,114],[131,115],[115,220],[220,131],[217,198],[198,236],[236,217],[198,131],[131,134],[134,198],[177,132],[132,58],[58,177],[143,35],[35,124],[124,143],[110,163],[163,7],[7,110],[228,110],[110,25],[25,228],[356,389],[389,368],[368,356],[11,302],[302,267],[267,11],[452,350],[350,349],[349,452],[302,303],[303,269],[269,302],[357,343],[343,277],[277,357],[452,453],[453,357],[357,452],[333,332],[332,297],[297,333],[175,152],[152,377],[377,175],[347,348],[348,330],[330,347],[303,304],[304,270],[270,303],[9,336],[336,337],[337,9],[278,279],[279,360],[360,278],[418,262],[262,431],[431,418],[304,408],[408,409],[409,304],[310,415],[415,407],[407,310],[270,409],[409,410],[410,270],[450,348],[348,347],[347,450],[422,430],[430,434],[434,422],[313,314],[314,17],[17,313],[306,307],[307,375],[375,306],[387,388],[388,260],[260,387],[286,414],[414,398],[398,286],[335,406],[406,418],[418,335],[364,367],[367,416],[416,364],[423,358],[358,327],[327,423],[251,284],[284,298],[298,251],[281,5],[5,4],[4,281],[373,374],[374,253],[253,373],[307,320],[320,321],[321,307],[425,427],[427,411],[411,425],[421,313],[313,18],[18,421],[321,405],[405,406],[406,321],[320,404],[404,405],[405,320],[315,16],[16,17],[17,315],[426,425],[425,266],[266,426],[377,400],[400,369],[369,377],[322,391],[391,269],[269,322],[417,465],[465,464],[464,417],[386,257],[257,258],[258,386],[466,260],[260,388],[388,466],[456,399],[399,419],[419,456],[284,332],[332,333],[333,284],[417,285],[285,8],[8,417],[346,340],[340,261],[261,346],[413,441],[441,285],[285,413],[327,460],[460,328],[328,327],[355,371],[371,329],[329,355],[392,439],[439,438],[438,392],[382,341],[341,256],[256,382],[429,420],[420,360],[360,429],[364,394],[394,379],[379,364],[277,343],[343,437],[437,277],[443,444],[444,283],[283,443],[275,440],[440,363],[363,275],[431,262],[262,369],[369,431],[297,338],[338,337],[337,297],[273,375],[375,321],[321,273],[450,451],[451,349],[349,450],[446,342],[342,467],[467,446],[293,334],[334,282],[282,293],[458,461],[461,462],[462,458],[276,353],[353,383],[383,276],[308,324],[324,325],[325,308],[276,300],[300,293],[293,276],[372,345],[345,447],[447,372],[352,345],[345,340],[340,352],[274,1],[1,19],[19,274],[456,248],[248,281],[281,456],[436,427],[427,425],[425,436],[381,256],[256,252],[252,381],[269,391],[391,393],[393,269],[200,199],[199,428],[428,200],[266,330],[330,329],[329,266],[287,273],[273,422],[422,287],[250,462],[462,328],[328,250],[258,286],[286,384],[384,258],[265,353],[353,342],[342,265],[387,259],[259,257],[257,387],[424,431],[431,430],[430,424],[342,353],[353,276],[276,342],[273,335],[335,424],[424,273],[292,325],[325,307],[307,292],[366,447],[447,345],[345,366],[271,303],[303,302],[302,271],[423,266],[266,371],[371,423],[294,455],[455,460],[460,294],[279,278],[278,294],[294,279],[271,272],[272,304],[304,271],[432,434],[434,427],[427,432],[272,407],[407,408],[408,272],[394,430],[430,431],[431,394],[395,369],[369,400],[400,395],[334,333],[333,299],[299,334],[351,417],[417,168],[168,351],[352,280],[280,411],[411,352],[325,319],[319,320],[320,325],[295,296],[296,336],[336,295],[319,403],[403,404],[404,319],[330,348],[348,349],[349,330],[293,298],[298,333],[333,293],[323,454],[454,447],[447,323],[15,16],[16,315],[315,15],[358,429],[429,279],[279,358],[14,15],[15,316],[316,14],[285,336],[336,9],[9,285],[329,349],[349,350],[350,329],[374,380],[380,252],[252,374],[318,402],[402,403],[403,318],[6,197],[197,419],[419,6],[318,319],[319,325],[325,318],[367,364],[364,365],[365,367],[435,367],[367,397],[397,435],[344,438],[438,439],[439,344],[272,271],[271,311],[311,272],[195,5],[5,281],[281,195],[273,287],[287,291],[291,273],[396,428],[428,199],[199,396],[311,271],[271,268],[268,311],[283,444],[444,445],[445,283],[373,254],[254,339],[339,373],[282,334],[334,296],[296,282],[449,347],[347,346],[346,449],[264,447],[447,454],[454,264],[336,296],[296,299],[299,336],[338,10],[10,151],[151,338],[278,439],[439,455],[455,278],[292,407],[407,415],[415,292],[358,371],[371,355],[355,358],[340,345],[345,372],[372,340],[346,347],[347,280],[280,346],[442,443],[443,282],[282,442],[19,94],[94,370],[370,19],[441,442],[442,295],[295,441],[248,419],[419,197],[197,248],[263,255],[255,359],[359,263],[440,275],[275,274],[274,440],[300,383],[383,368],[368,300],[351,412],[412,465],[465,351],[263,467],[467,466],[466,263],[301,368],[368,389],[389,301],[395,378],[378,379],[379,395],[412,351],[351,419],[419,412],[436,426],[426,322],[322,436],[2,164],[164,393],[393,2],[370,462],[462,461],[461,370],[164,0],[0,267],[267,164],[302,11],[11,12],[12,302],[268,12],[12,13],[13,268],[293,300],[300,301],[301,293],[446,261],[261,340],[340,446],[330,266],[266,425],[425,330],[426,423],[423,391],[391,426],[429,355],[355,437],[437,429],[391,327],[327,326],[326,391],[440,457],[457,438],[438,440],[341,382],[382,362],[362,341],[459,457],[457,461],[461,459],[434,430],[430,394],[394,434],[414,463],[463,362],[362,414],[396,369],[369,262],[262,396],[354,461],[461,457],[457,354],[316,403],[403,402],[402,316],[315,404],[404,403],[403,315],[314,405],[405,404],[404,314],[313,406],[406,405],[405,313],[421,418],[418,406],[406,421],[366,401],[401,361],[361,366],[306,408],[408,407],[407,306],[291,409],[409,408],[408,291],[287,410],[410,409],[409,287],[432,436],[436,410],[410,432],[434,416],[416,411],[411,434],[264,368],[368,383],[383,264],[309,438],[438,457],[457,309],[352,376],[376,401],[401,352],[274,275],[275,4],[4,274],[421,428],[428,262],[262,421],[294,327],[327,358],[358,294],[433,416],[416,367],[367,433],[289,455],[455,439],[439,289],[462,370],[370,326],[326,462],[2,326],[326,370],[370,2],[305,460],[460,455],[455,305],[254,449],[449,448],[448,254],[255,261],[261,446],[446,255],[253,450],[450,449],[449,253],[252,451],[451,450],[450,252],[256,452],[452,451],[451,256],[341,453],[453,452],[452,341],[413,464],[464,463],[463,413],[441,413],[413,414],[414,441],[258,442],[442,441],[441,258],[257,443],[443,442],[442,257],[259,444],[444,443],[443,259],[260,445],[445,444],[444,260],[467,342],[342,445],[445,467],[459,458],[458,250],[250,459],[289,392],[392,290],[290,289],[290,328],[328,460],[460,290],[376,433],[433,435],[435,376],[250,290],[290,392],[392,250],[411,416],[416,433],[433,411],[341,463],[463,464],[464,341],[453,464],[464,465],[465,453],[357,465],[465,412],[412,357],[343,412],[412,399],[399,343],[360,363],[363,440],[440,360],[437,399],[399,456],[456,437],[420,456],[456,363],[363,420],[401,435],[435,288],[288,401],[372,383],[383,353],[353,372],[339,255],[255,249],[249,339],[448,261],[261,255],[255,448],[133,243],[243,190],[190,133],[133,155],[155,112],[112,133],[33,246],[246,247],[247,33],[33,130],[130,25],[25,33],[398,384],[384,286],[286,398],[362,398],[398,414],[414,362],[362,463],[463,341],[341,362],[263,359],[359,467],[467,263],[263,249],[249,255],[255,263],[466,467],[467,260],[260,466],[75,60],[60,166],[166,75],[238,239],[239,79],[79,238],[162,127],[127,139],[139,162],[72,11],[11,37],[37,72],[121,232],[232,120],[120,121],[73,72],[72,39],[39,73],[114,128],[128,47],[47,114],[233,232],[232,128],[128,233],[103,104],[104,67],[67,103],[152,175],[175,148],[148,152],[119,118],[118,101],[101,119],[74,73],[73,40],[40,74],[107,9],[9,108],[108,107],[49,48],[48,131],[131,49],[32,194],[194,211],[211,32],[184,74],[74,185],[185,184],[191,80],[80,183],[183,191],[185,40],[40,186],[186,185],[119,230],[230,118],[118,119],[210,202],[202,214],[214,210],[84,83],[83,17],[17,84],[77,76],[76,146],[146,77],[161,160],[160,30],[30,161],[190,56],[56,173],[173,190],[182,106],[106,194],[194,182],[138,135],[135,192],[192,138],[129,203],[203,98],[98,129],[54,21],[21,68],[68,54],[5,51],[51,4],[4,5],[145,144],[144,23],[23,145],[90,77],[77,91],[91,90],[207,205],[205,187],[187,207],[83,201],[201,18],[18,83],[181,91],[91,182],[182,181],[180,90],[90,181],[181,180],[16,85],[85,17],[17,16],[205,206],[206,36],[36,205],[176,148],[148,140],[140,176],[165,92],[92,39],[39,165],[245,193],[193,244],[244,245],[27,159],[159,28],[28,27],[30,247],[247,161],[161,30],[174,236],[236,196],[196,174],[103,54],[54,104],[104,103],[55,193],[193,8],[8,55],[111,117],[117,31],[31,111],[221,189],[189,55],[55,221],[240,98],[98,99],[99,240],[142,126],[126,100],[100,142],[219,166],[166,218],[218,219],[112,155],[155,26],[26,112],[198,209],[209,131],[131,198],[169,135],[135,150],[150,169],[114,47],[47,217],[217,114],[224,223],[223,53],[53,224],[220,45],[45,134],[134,220],[32,211],[211,140],[140,32],[109,67],[67,108],[108,109],[146,43],[43,91],[91,146],[231,230],[230,120],[120,231],[113,226],[226,247],[247,113],[105,63],[63,52],[52,105],[241,238],[238,242],[242,241],[124,46],[46,156],[156,124],[95,78],[78,96],[96,95],[70,46],[46,63],[63,70],[116,143],[143,227],[227,116],[116,123],[123,111],[111,116],[1,44],[44,19],[19,1],[3,236],[236,51],[51,3],[207,216],[216,205],[205,207],[26,154],[154,22],[22,26],[165,39],[39,167],[167,165],[199,200],[200,208],[208,199],[101,36],[36,100],[100,101],[43,57],[57,202],[202,43],[242,20],[20,99],[99,242],[56,28],[28,157],[157,56],[124,35],[35,113],[113,124],[29,160],[160,27],[27,29],[211,204],[204,210],[210,211],[124,113],[113,46],[46,124],[106,43],[43,204],[204,106],[96,62],[62,77],[77,96],[227,137],[137,116],[116,227],[73,41],[41,72],[72,73],[36,203],[203,142],[142,36],[235,64],[64,240],[240,235],[48,49],[49,64],[64,48],[42,41],[41,74],[74,42],[214,212],[212,207],[207,214],[183,42],[42,184],[184,183],[210,169],[169,211],[211,210],[140,170],[170,176],[176,140],[104,105],[105,69],[69,104],[193,122],[122,168],[168,193],[50,123],[123,187],[187,50],[89,96],[96,90],[90,89],[66,65],[65,107],[107,66],[179,89],[89,180],[180,179],[119,101],[101,120],[120,119],[68,63],[63,104],[104,68],[234,93],[93,227],[227,234],[16,15],[15,85],[85,16],[209,129],[129,49],[49,209],[15,14],[14,86],[86,15],[107,55],[55,9],[9,107],[120,100],[100,121],[121,120],[153,145],[145,22],[22,153],[178,88],[88,179],[179,178],[197,6],[6,196],[196,197],[89,88],[88,96],[96,89],[135,138],[138,136],[136,135],[138,215],[215,172],[172,138],[218,115],[115,219],[219,218],[41,42],[42,81],[81,41],[5,195],[195,51],[51,5],[57,43],[43,61],[61,57],[208,171],[171,199],[199,208],[41,81],[81,38],[38,41],[224,53],[53,225],[225,224],[24,144],[144,110],[110,24],[105,52],[52,66],[66,105],[118,229],[229,117],[117,118],[227,34],[34,234],[234,227],[66,107],[107,69],[69,66],[10,109],[109,151],[151,10],[219,48],[48,235],[235,219],[183,62],[62,191],[191,183],[142,129],[129,126],[126,142],[116,111],[111,143],[143,116],[118,117],[117,50],[50,118],[223,222],[222,52],[52,223],[94,19],[19,141],[141,94],[222,221],[221,65],[65,222],[196,3],[3,197],[197,196],[45,220],[220,44],[44,45],[156,70],[70,139],[139,156],[188,122],[122,245],[245,188],[139,71],[71,162],[162,139],[149,170],[170,150],[150,149],[122,188],[188,196],[196,122],[206,216],[216,92],[92,206],[164,2],[2,167],[167,164],[242,141],[141,241],[241,242],[0,164],[164,37],[37,0],[11,72],[72,12],[12,11],[12,38],[38,13],[13,12],[70,63],[63,71],[71,70],[31,226],[226,111],[111,31],[36,101],[101,205],[205,36],[203,206],[206,165],[165,203],[126,209],[209,217],[217,126],[98,165],[165,97],[97,98],[237,220],[220,218],[218,237],[237,239],[239,241],[241,237],[210,214],[214,169],[169,210],[140,171],[171,32],[32,140],[241,125],[125,237],[237,241],[179,86],[86,178],[178,179],[180,85],[85,179],[179,180],[181,84],[84,180],[180,181],[182,83],[83,181],[181,182],[194,201],[201,182],[182,194],[177,137],[137,132],[132,177],[184,76],[76,183],[183,184],[185,61],[61,184],[184,185],[186,57],[57,185],[185,186],[216,212],[212,186],[186,216],[192,214],[214,187],[187,192],[139,34],[34,156],[156,139],[218,79],[79,237],[237,218],[147,123],[123,177],[177,147],[45,44],[44,4],[4,45],[208,201],[201,32],[32,208],[98,64],[64,129],[129,98],[192,213],[213,138],[138,192],[235,59],[59,219],[219,235],[141,242],[242,97],[97,141],[97,2],[2,141],[141,97],[240,75],[75,235],[235,240],[229,24],[24,228],[228,229],[31,25],[25,226],[226,31],[230,23],[23,229],[229,230],[231,22],[22,230],[230,231],[232,26],[26,231],[231,232],[233,112],[112,232],[232,233],[244,189],[189,243],[243,244],[189,221],[221,190],[190,189],[222,28],[28,221],[221,222],[223,27],[27,222],[222,223],[224,29],[29,223],[223,224],[225,30],[30,224],[224,225],[113,247],[247,225],[225,113],[99,60],[60,240],[240,99],[213,147],[147,215],[215,213],[60,20],[20,166],[166,60],[192,187],[187,213],[213,192],[243,112],[112,244],[244,243],[244,233],[233,245],[245,244],[245,128],[128,188],[188,245],[188,114],[114,174],[174,188],[134,131],[131,220],[220,134],[174,217],[217,236],[236,174],[236,198],[198,134],[134,236],[215,177],[177,58],[58,215],[156,143],[143,124],[124,156],[25,110],[110,7],[7,25],[31,228],[228,25],[25,31],[264,356],[356,368],[368,264],[0,11],[11,267],[267,0],[451,452],[452,349],[349,451],[267,302],[302,269],[269,267],[350,357],[357,277],[277,350],[350,452],[452,357],[357,350],[299,333],[333,297],[297,299],[396,175],[175,377],[377,396],[280,347],[347,330],[330,280],[269,303],[303,270],[270,269],[151,9],[9,337],[337,151],[344,278],[278,360],[360,344],[424,418],[418,431],[431,424],[270,304],[304,409],[409,270],[272,310],[310,407],[407,272],[322,270],[270,410],[410,322],[449,450],[450,347],[347,449],[432,422],[422,434],[434,432],[18,313],[313,17],[17,18],[291,306],[306,375],[375,291],[259,387],[387,260],[260,259],[424,335],[335,418],[418,424],[434,364],[364,416],[416,434],[391,423],[423,327],[327,391],[301,251],[251,298],[298,301],[275,281],[281,4],[4,275],[254,373],[373,253],[253,254],[375,307],[307,321],[321,375],[280,425],[425,411],[411,280],[200,421],[421,18],[18,200],[335,321],[321,406],[406,335],[321,320],[320,405],[405,321],[314,315],[315,17],[17,314],[423,426],[426,266],[266,423],[396,377],[377,369],[369,396],[270,322],[322,269],[269,270],[413,417],[417,464],[464,413],[385,386],[386,258],[258,385],[248,456],[456,419],[419,248],[298,284],[284,333],[333,298],[168,417],[417,8],[8,168],[448,346],[346,261],[261,448],[417,413],[413,285],[285,417],[326,327],[327,328],[328,326],[277,355],[355,329],[329,277],[309,392],[392,438],[438,309],[381,382],[382,256],[256,381],[279,429],[429,360],[360,279],[365,364],[364,379],[379,365],[355,277],[277,437],[437,355],[282,443],[443,283],[283,282],[281,275],[275,363],[363,281],[395,431],[431,369],[369,395],[299,297],[297,337],[337,299],[335,273],[273,321],[321,335],[348,450],[450,349],[349,348],[359,446],[446,467],[467,359],[283,293],[293,282],[282,283],[250,458],[458,462],[462,250],[300,276],[276,383],[383,300],[292,308],[308,325],[325,292],[283,276],[276,293],[293,283],[264,372],[372,447],[447,264],[346,352],[352,340],[340,346],[354,274],[274,19],[19,354],[363,456],[456,281],[281,363],[426,436],[436,425],[425,426],[380,381],[381,252],[252,380],[267,269],[269,393],[393,267],[421,200],[200,428],[428,421],[371,266],[266,329],[329,371],[432,287],[287,422],[422,432],[290,250],[250,328],[328,290],[385,258],[258,384],[384,385],[446,265],[265,342],[342,446],[386,387],[387,257],[257,386],[422,424],[424,430],[430,422],[445,342],[342,276],[276,445],[422,273],[273,424],[424,422],[306,292],[292,307],[307,306],[352,366],[366,345],[345,352],[268,271],[271,302],[302,268],[358,423],[423,371],[371,358],[327,294],[294,460],[460,327],[331,279],[279,294],[294,331],[303,271],[271,304],[304,303],[436,432],[432,427],[427,436],[304,272],[272,408],[408,304],[395,394],[394,431],[431,395],[378,395],[395,400],[400,378],[296,334],[334,299],[299,296],[6,351],[351,168],[168,6],[376,352],[352,411],[411,376],[307,325],[325,320],[320,307],[285,295],[295,336],[336,285],[320,319],[319,404],[404,320],[329,330],[330,349],[349,329],[334,293],[293,333],[333,334],[366,323],[323,447],[447,366],[316,15],[15,315],[315,316],[331,358],[358,279],[279,331],[317,14],[14,316],[316,317],[8,285],[285,9],[9,8],[277,329],[329,350],[350,277],[253,374],[374,252],[252,253],[319,318],[318,403],[403,319],[351,6],[6,419],[419,351],[324,318],[318,325],[325,324],[397,367],[367,365],[365,397],[288,435],[435,397],[397,288],[278,344],[344,439],[439,278],[310,272],[272,311],[311,310],[248,195],[195,281],[281,248],[375,273],[273,291],[291,375],[175,396],[396,199],[199,175],[312,311],[311,268],[268,312],[276,283],[283,445],[445,276],[390,373],[373,339],[339,390],[295,282],[282,296],[296,295],[448,449],[449,346],[346,448],[356,264],[264,454],[454,356],[337,336],[336,299],[299,337],[337,338],[338,151],[151,337],[294,278],[278,455],[455,294],[308,292],[292,415],[415,308],[429,358],[358,355],[355,429],[265,340],[340,372],[372,265],[352,346],[346,280],[280,352],[295,442],[442,282],[282,295],[354,19],[19,370],[370,354],[285,441],[441,295],[295,285],[195,248],[248,197],[197,195],[457,440],[440,274],[274,457],[301,300],[300,368],[368,301],[417,351],[351,465],[465,417],[251,301],[301,389],[389,251],[394,395],[395,379],[379,394],[399,412],[412,419],[419,399],[410,436],[436,322],[322,410],[326,2],[2,393],[393,326],[354,370],[370,461],[461,354],[393,164],[164,267],[267,393],[268,302],[302,12],[12,268],[312,268],[268,13],[13,312],[298,293],[293,301],[301,298],[265,446],[446,340],[340,265],[280,330],[330,425],[425,280],[322,426],[426,391],[391,322],[420,429],[429,437],[437,420],[393,391],[391,326],[326,393],[344,440],[440,438],[438,344],[458,459],[459,461],[461,458],[364,434],[434,394],[394,364],[428,396],[396,262],[262,428],[274,354],[354,457],[457,274],[317,316],[316,402],[402,317],[316,315],[315,403],[403,316],[315,314],[314,404],[404,315],[314,313],[313,405],[405,314],[313,421],[421,406],[406,313],[323,366],[366,361],[361,323],[292,306],[306,407],[407,292],[306,291],[291,408],[408,306],[291,287],[287,409],[409,291],[287,432],[432,410],[410,287],[427,434],[434,411],[411,427],[372,264],[264,383],[383,372],[459,309],[309,457],[457,459],[366,352],[352,401],[401,366],[1,274],[274,4],[4,1],[418,421],[421,262],[262,418],[331,294],[294,358],[358,331],[435,433],[433,367],[367,435],[392,289],[289,439],[439,392],[328,462],[462,326],[326,328],[94,2],[2,370],[370,94],[289,305],[305,455],[455,289],[339,254],[254,448],[448,339],[359,255],[255,446],[446,359],[254,253],[253,449],[449,254],[253,252],[252,450],[450,253],[252,256],[256,451],[451,252],[256,341],[341,452],[452,256],[414,413],[413,463],[463,414],[286,441],[441,414],[414,286],[286,258],[258,441],[441,286],[258,257],[257,442],[442,258],[257,259],[259,443],[443,257],[259,260],[260,444],[444,259],[260,467],[467,445],[445,260],[309,459],[459,250],[250,309],[305,289],[289,290],[290,305],[305,290],[290,460],[460,305],[401,376],[376,435],[435,401],[309,250],[250,392],[392,309],[376,411],[411,433],[433,376],[453,341],[341,464],[464,453],[357,453],[453,465],[465,357],[343,357],[357,412],[412,343],[437,343],[343,399],[399,437],[344,360],[360,440],[440,344],[420,437],[437,456],[456,420],[360,420],[420,363],[363,360],[361,401],[401,288],[288,361],[265,372],[372,353],[353,265],[390,339],[339,249],[249,390],[339,448],[448,255],[255,339]);function Wu(e){e.j={faceLandmarks:[],faceBlendshapes:[],facialTransformationMatrixes:[]}}var K=class extends Mu{constructor(e,t){super(new Du(e,t),`image_in`,`norm_rect`,!1),this.j={faceLandmarks:[],faceBlendshapes:[],facialTransformationMatrixes:[]},this.outputFacialTransformationMatrixes=this.outputFaceBlendshapes=!1,C(e=this.h=new Sc,0,1,t=new z),this.A=new xc,C(this.h,0,3,this.A),this.u=new _c,C(this.h,0,2,this.u),pa(this.u,4,1),T(this.u,2,.5),T(this.A,2,.5),T(this.h,4,.5)}get baseOptions(){return S(this.h,z,1)}set baseOptions(e){C(this.h,0,1,e)}o(e){return`numFaces`in e&&pa(this.u,4,e.numFaces??1),`minFaceDetectionConfidence`in e&&T(this.u,2,e.minFaceDetectionConfidence??.5),`minTrackingConfidence`in e&&T(this.h,4,e.minTrackingConfidence??.5),`minFacePresenceConfidence`in e&&T(this.A,2,e.minFacePresenceConfidence??.5),`outputFaceBlendshapes`in e&&(this.outputFaceBlendshapes=!!e.outputFaceBlendshapes),`outputFacialTransformationMatrixes`in e&&(this.outputFacialTransformationMatrixes=!!e.outputFacialTransformationMatrixes),this.l(e)}F(e,t){return Wu(this),ku(this,e,t),this.j}G(e,t,n){return Wu(this),Au(this,e,n,t),this.j}m(){var e=new Rs;L(e,`image_in`),L(e,`norm_rect`),R(e,`face_landmarks`);let t=new js;po(t,wc,this.h);let n=new Ns;ma(n,2,`mediapipe.tasks.vision.face_landmarker.FaceLandmarkerGraph`),F(n,`IMAGE:image_in`),F(n,`NORM_RECT:norm_rect`),I(n,`NORM_LANDMARKS:face_landmarks`),n.o(t),Ls(e,n),this.g.attachProtoVectorListener(`face_landmarks`,((e,t)=>{for(let t of e)e=Qs(t),this.j.faceLandmarks.push(ml(e));H(this,t)})),this.g.attachEmptyPacketListener(`face_landmarks`,(e=>{H(this,e)})),this.outputFaceBlendshapes&&(R(e,`blendshapes`),I(n,`BLENDSHAPES:blendshapes`),this.g.attachProtoVectorListener(`blendshapes`,((e,t)=>{if(this.outputFaceBlendshapes)for(let t of e)e=Ws(t),this.j.faceBlendshapes.push(dl(e.g()??[]));H(this,t)})),this.g.attachEmptyPacketListener(`blendshapes`,(e=>{H(this,e)}))),this.outputFacialTransformationMatrixes&&(R(e,`face_geometry`),I(n,`FACE_GEOMETRY:face_geometry`),this.g.attachProtoVectorListener(`face_geometry`,((e,t)=>{if(this.outputFacialTransformationMatrixes)for(let t of e)(e=S(e=bc(t),$s,2))&&this.j.facialTransformationMatrixes.push({rows:fa(e,1)??0??0,columns:fa(e,2)??0??0,data:Gi(e,3,Wr,Wi()).slice()??[]});H(this,t)})),this.g.attachEmptyPacketListener(`face_geometry`,(e=>{H(this,e)}))),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};K.prototype.detectForVideo=K.prototype.G,K.prototype.detect=K.prototype.F,K.prototype.setOptions=K.prototype.o,K.createFromModelPath=function(e,t){return G(K,e,{baseOptions:{modelAssetPath:t}})},K.createFromModelBuffer=function(e,t){return G(K,e,{baseOptions:{modelAssetBuffer:t}})},K.createFromOptions=function(e,t){return G(K,e,t)},K.FACE_LANDMARKS_LIPS=Pu,K.FACE_LANDMARKS_LEFT_EYE=Fu,K.FACE_LANDMARKS_LEFT_EYEBROW=Iu,K.FACE_LANDMARKS_LEFT_IRIS=Lu,K.FACE_LANDMARKS_RIGHT_EYE=Ru,K.FACE_LANDMARKS_RIGHT_EYEBROW=zu,K.FACE_LANDMARKS_RIGHT_IRIS=Bu,K.FACE_LANDMARKS_FACE_OVAL=Vu,K.FACE_LANDMARKS_CONTOURS=Hu,K.FACE_LANDMARKS_TESSELATION=Uu;var Gu=wu([0,1],[1,2],[2,3],[3,4],[0,5],[5,6],[6,7],[7,8],[5,9],[9,10],[10,11],[11,12],[9,13],[13,14],[14,15],[15,16],[13,17],[0,17],[17,18],[18,19],[19,20]);function Ku(e){e.gestures=[],e.landmarks=[],e.worldLandmarks=[],e.handedness=[]}function qu(e){return e.gestures.length===0?{gestures:[],landmarks:[],worldLandmarks:[],handedness:[],handednesses:[]}:{gestures:e.gestures,landmarks:e.landmarks,worldLandmarks:e.worldLandmarks,handedness:e.handedness,handednesses:e.handedness}}function Ju(e,t=!0){let n=[];for(let i of e){var r=Ws(i);e=[];for(let n of r.g())r=t&&fa(n,1)!=null?fa(n,1)??0:-1,e.push({score:w(n,2)??0,index:r,categoryName:v(y(n,3))??``??``,displayName:v(y(n,4))??``??``});n.push(e)}return n}var Yu=class extends Mu{constructor(e,t){super(new Du(e,t),`image_in`,`norm_rect`,!1),this.gestures=[],this.landmarks=[],this.worldLandmarks=[],this.handedness=[],C(e=this.j=new jc,0,1,t=new z),this.u=new Ac,C(this.j,0,2,this.u),this.D=new kc,C(this.u,0,3,this.D),this.A=new Oc,C(this.u,0,2,this.A),this.h=new Dc,C(this.j,0,3,this.h),T(this.A,2,.5),T(this.u,4,.5),T(this.D,2,.5)}get baseOptions(){return S(this.j,z,1)}set baseOptions(e){C(this.j,0,1,e)}o(e){if(pa(this.A,3,e.numHands??1),`minHandDetectionConfidence`in e&&T(this.A,2,e.minHandDetectionConfidence??.5),`minTrackingConfidence`in e&&T(this.u,4,e.minTrackingConfidence??.5),`minHandPresenceConfidence`in e&&T(this.D,2,e.minHandPresenceConfidence??.5),e.cannedGesturesClassifierOptions){var t=new Tc,n=t,r=ll(e.cannedGesturesClassifierOptions,S(this.h,Tc,3)?.l());C(n,0,2,r),C(this.h,0,3,t)}else e.cannedGesturesClassifierOptions===void 0&&S(this.h,Tc,3)?.g();return e.customGesturesClassifierOptions?(C(n=t=new Tc,0,2,r=ll(e.customGesturesClassifierOptions,S(this.h,Tc,4)?.l())),C(this.h,0,4,t)):e.customGesturesClassifierOptions===void 0&&S(this.h,Tc,4)?.g(),this.l(e)}Ha(e,t){return Ku(this),ku(this,e,t),qu(this)}Ia(e,t,n){return Ku(this),Au(this,e,n,t),qu(this)}m(){var e=new Rs;L(e,`image_in`),L(e,`norm_rect`),R(e,`hand_gestures`),R(e,`hand_landmarks`),R(e,`world_hand_landmarks`),R(e,`handedness`);let t=new js;po(t,Ic,this.j);let n=new Ns;ma(n,2,`mediapipe.tasks.vision.gesture_recognizer.GestureRecognizerGraph`),F(n,`IMAGE:image_in`),F(n,`NORM_RECT:norm_rect`),I(n,`HAND_GESTURES:hand_gestures`),I(n,`LANDMARKS:hand_landmarks`),I(n,`WORLD_LANDMARKS:world_hand_landmarks`),I(n,`HANDEDNESS:handedness`),n.o(t),Ls(e,n),this.g.attachProtoVectorListener(`hand_landmarks`,((e,t)=>{for(let t of e){e=Qs(t);let n=[];for(let t of sa(e,Zs,1))n.push({x:w(t,1)??0,y:w(t,2)??0,z:w(t,3)??0,visibility:w(t,4)??0});this.landmarks.push(n)}H(this,t)})),this.g.attachEmptyPacketListener(`hand_landmarks`,(e=>{H(this,e)})),this.g.attachProtoVectorListener(`world_hand_landmarks`,((e,t)=>{for(let t of e){e=Xs(t);let n=[];for(let t of sa(e,Ys,1))n.push({x:w(t,1)??0,y:w(t,2)??0,z:w(t,3)??0,visibility:w(t,4)??0});this.worldLandmarks.push(n)}H(this,t)})),this.g.attachEmptyPacketListener(`world_hand_landmarks`,(e=>{H(this,e)})),this.g.attachProtoVectorListener(`hand_gestures`,((e,t)=>{this.gestures.push(...Ju(e,!1)),H(this,t)})),this.g.attachEmptyPacketListener(`hand_gestures`,(e=>{H(this,e)})),this.g.attachProtoVectorListener(`handedness`,((e,t)=>{this.handedness.push(...Ju(e)),H(this,t)})),this.g.attachEmptyPacketListener(`handedness`,(e=>{H(this,e)})),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};function Xu(e){return{landmarks:e.landmarks,worldLandmarks:e.worldLandmarks,handednesses:e.handedness,handedness:e.handedness}}Yu.prototype.recognizeForVideo=Yu.prototype.Ia,Yu.prototype.recognize=Yu.prototype.Ha,Yu.prototype.setOptions=Yu.prototype.o,Yu.createFromModelPath=function(e,t){return G(Yu,e,{baseOptions:{modelAssetPath:t}})},Yu.createFromModelBuffer=function(e,t){return G(Yu,e,{baseOptions:{modelAssetBuffer:t}})},Yu.createFromOptions=function(e,t){return G(Yu,e,t)},Yu.HAND_CONNECTIONS=Gu;var Zu=class extends Mu{constructor(e,t){super(new Du(e,t),`image_in`,`norm_rect`,!1),this.landmarks=[],this.worldLandmarks=[],this.handedness=[],C(e=this.h=new Ac,0,1,t=new z),this.u=new kc,C(this.h,0,3,this.u),this.j=new Oc,C(this.h,0,2,this.j),pa(this.j,3,1),T(this.j,2,.5),T(this.u,2,.5),T(this.h,4,.5)}get baseOptions(){return S(this.h,z,1)}set baseOptions(e){C(this.h,0,1,e)}o(e){return`numHands`in e&&pa(this.j,3,e.numHands??1),`minHandDetectionConfidence`in e&&T(this.j,2,e.minHandDetectionConfidence??.5),`minTrackingConfidence`in e&&T(this.h,4,e.minTrackingConfidence??.5),`minHandPresenceConfidence`in e&&T(this.u,2,e.minHandPresenceConfidence??.5),this.l(e)}F(e,t){return this.landmarks=[],this.worldLandmarks=[],this.handedness=[],ku(this,e,t),Xu(this)}G(e,t,n){return this.landmarks=[],this.worldLandmarks=[],this.handedness=[],Au(this,e,n,t),Xu(this)}m(){var e=new Rs;L(e,`image_in`),L(e,`norm_rect`),R(e,`hand_landmarks`),R(e,`world_hand_landmarks`),R(e,`handedness`);let t=new js;po(t,Lc,this.h);let n=new Ns;ma(n,2,`mediapipe.tasks.vision.hand_landmarker.HandLandmarkerGraph`),F(n,`IMAGE:image_in`),F(n,`NORM_RECT:norm_rect`),I(n,`LANDMARKS:hand_landmarks`),I(n,`WORLD_LANDMARKS:world_hand_landmarks`),I(n,`HANDEDNESS:handedness`),n.o(t),Ls(e,n),this.g.attachProtoVectorListener(`hand_landmarks`,((e,t)=>{for(let t of e)e=Qs(t),this.landmarks.push(ml(e));H(this,t)})),this.g.attachEmptyPacketListener(`hand_landmarks`,(e=>{H(this,e)})),this.g.attachProtoVectorListener(`world_hand_landmarks`,((e,t)=>{for(let t of e)e=Xs(t),this.worldLandmarks.push(hl(e));H(this,t)})),this.g.attachEmptyPacketListener(`world_hand_landmarks`,(e=>{H(this,e)})),this.g.attachProtoVectorListener(`handedness`,((e,t)=>{var n=this.handedness,r=n.push;let i=[];for(let t of e){e=Ws(t);let n=[];for(let t of e.g())n.push({score:w(t,2)??0,index:fa(t,1)??0??-1,categoryName:v(y(t,3))??``??``,displayName:v(y(t,4))??``??``});i.push(n)}r.call(n,...i),H(this,t)})),this.g.attachEmptyPacketListener(`handedness`,(e=>{H(this,e)})),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};Zu.prototype.detectForVideo=Zu.prototype.G,Zu.prototype.detect=Zu.prototype.F,Zu.prototype.setOptions=Zu.prototype.o,Zu.createFromModelPath=function(e,t){return G(Zu,e,{baseOptions:{modelAssetPath:t}})},Zu.createFromModelBuffer=function(e,t){return G(Zu,e,{baseOptions:{modelAssetBuffer:t}})},Zu.createFromOptions=function(e,t){return G(Zu,e,t)},Zu.HAND_CONNECTIONS=Gu;var Qu=wu([0,1],[1,2],[2,3],[3,7],[0,4],[4,5],[5,6],[6,8],[9,10],[11,12],[11,13],[13,15],[15,17],[15,19],[15,21],[17,19],[12,14],[14,16],[16,18],[16,20],[16,22],[18,20],[11,23],[12,24],[23,24],[23,25],[24,26],[25,27],[26,28],[27,29],[28,30],[29,31],[30,32],[27,31],[28,32]);function $u(e){e.h={faceLandmarks:[],faceBlendshapes:[],poseLandmarks:[],poseWorldLandmarks:[],poseSegmentationMasks:[],leftHandLandmarks:[],leftHandWorldLandmarks:[],rightHandLandmarks:[],rightHandWorldLandmarks:[]}}function ed(e){try{if(!e.D)return e.h;e.D(e.h)}finally{Fl(e)}}function td(e,t){e=Qs(e),t.push(ml(e))}var q=class extends Mu{constructor(e,t){super(new Du(e,t),`input_frames_image`,null,!1),this.h={faceLandmarks:[],faceBlendshapes:[],poseLandmarks:[],poseWorldLandmarks:[],poseSegmentationMasks:[],leftHandLandmarks:[],leftHandWorldLandmarks:[],rightHandLandmarks:[],rightHandWorldLandmarks:[]},this.outputPoseSegmentationMasks=this.outputFaceBlendshapes=!1,C(e=this.j=new Vc,0,1,t=new z),this.I=new kc,C(this.j,0,2,this.I),this.W=new Rc,C(this.j,0,3,this.W),this.u=new _c,C(this.j,0,4,this.u),this.O=new xc,C(this.j,0,5,this.O),this.A=new zc,C(this.j,0,6,this.A),this.M=new Bc,C(this.j,0,7,this.M),T(this.u,2,.5),T(this.u,3,.3),T(this.O,2,.5),T(this.A,2,.5),T(this.A,3,.3),T(this.M,2,.5),T(this.I,2,.5)}get baseOptions(){return S(this.j,z,1)}set baseOptions(e){C(this.j,0,1,e)}o(e){return`minFaceDetectionConfidence`in e&&T(this.u,2,e.minFaceDetectionConfidence??.5),`minFaceSuppressionThreshold`in e&&T(this.u,3,e.minFaceSuppressionThreshold??.3),`minFacePresenceConfidence`in e&&T(this.O,2,e.minFacePresenceConfidence??.5),`outputFaceBlendshapes`in e&&(this.outputFaceBlendshapes=!!e.outputFaceBlendshapes),`minPoseDetectionConfidence`in e&&T(this.A,2,e.minPoseDetectionConfidence??.5),`minPoseSuppressionThreshold`in e&&T(this.A,3,e.minPoseSuppressionThreshold??.3),`minPosePresenceConfidence`in e&&T(this.M,2,e.minPosePresenceConfidence??.5),`outputPoseSegmentationMasks`in e&&(this.outputPoseSegmentationMasks=!!e.outputPoseSegmentationMasks),`minHandLandmarksConfidence`in e&&T(this.I,2,e.minHandLandmarksConfidence??.5),this.l(e)}F(e,t,n){let r=typeof t==`function`?{}:t;return this.D=typeof t==`function`?t:n,$u(this),ku(this,e,r),ed(this)}G(e,t,n,r){let i=typeof n==`function`?{}:n;return this.D=typeof n==`function`?n:r,$u(this),Au(this,e,i,t),ed(this)}m(){var e=new Rs;L(e,`input_frames_image`),R(e,`pose_landmarks`),R(e,`pose_world_landmarks`),R(e,`face_landmarks`),R(e,`left_hand_landmarks`),R(e,`left_hand_world_landmarks`),R(e,`right_hand_landmarks`),R(e,`right_hand_world_landmarks`);let t=new js,n=new _s;ma(n,1,`type.googleapis.com/mediapipe.tasks.vision.holistic_landmarker.proto.HolisticLandmarkerGraphOptions`),function(e,t){if(t!=null)if(Array.isArray(t))b(e,2,Ci(t,0,Ti));else{if(!(typeof t==`string`||t instanceof kn||Tn(t)))throw Error(`invalid value in Any.value field: `+t+` expected a ByteString, a base64 encoded string, a Uint8Array or a jspb array`);Qi(e,2,ar(t,!1),Dn())}}(n,this.j.g());let r=new Ns;ma(r,2,`mediapipe.tasks.vision.holistic_landmarker.HolisticLandmarkerGraph`),da(r,8,_s,n),F(r,`IMAGE:input_frames_image`),I(r,`POSE_LANDMARKS:pose_landmarks`),I(r,`POSE_WORLD_LANDMARKS:pose_world_landmarks`),I(r,`FACE_LANDMARKS:face_landmarks`),I(r,`LEFT_HAND_LANDMARKS:left_hand_landmarks`),I(r,`LEFT_HAND_WORLD_LANDMARKS:left_hand_world_landmarks`),I(r,`RIGHT_HAND_LANDMARKS:right_hand_landmarks`),I(r,`RIGHT_HAND_WORLD_LANDMARKS:right_hand_world_landmarks`),r.o(t),Ls(e,r),Nl(this,e),this.g.attachProtoListener(`pose_landmarks`,((e,t)=>{td(e,this.h.poseLandmarks),H(this,t)})),this.g.attachEmptyPacketListener(`pose_landmarks`,(e=>{H(this,e)})),this.g.attachProtoListener(`pose_world_landmarks`,((e,t)=>{var n=this.h.poseWorldLandmarks;e=Xs(e),n.push(hl(e)),H(this,t)})),this.g.attachEmptyPacketListener(`pose_world_landmarks`,(e=>{H(this,e)})),this.outputPoseSegmentationMasks&&(I(r,`POSE_SEGMENTATION_MASK:pose_segmentation_mask`),Pl(this,`pose_segmentation_mask`),this.g.Z(`pose_segmentation_mask`,((e,t)=>{this.h.poseSegmentationMasks=[ju(this,e,!0,!this.D)],H(this,t)})),this.g.attachEmptyPacketListener(`pose_segmentation_mask`,(e=>{this.h.poseSegmentationMasks=[],H(this,e)}))),this.g.attachProtoListener(`face_landmarks`,((e,t)=>{td(e,this.h.faceLandmarks),H(this,t)})),this.g.attachEmptyPacketListener(`face_landmarks`,(e=>{H(this,e)})),this.outputFaceBlendshapes&&(R(e,`extra_blendshapes`),I(r,`FACE_BLENDSHAPES:extra_blendshapes`),this.g.attachProtoListener(`extra_blendshapes`,((e,t)=>{var n=this.h.faceBlendshapes;this.outputFaceBlendshapes&&(e=Ws(e),n.push(dl(e.g()??[]))),H(this,t)})),this.g.attachEmptyPacketListener(`extra_blendshapes`,(e=>{H(this,e)}))),this.g.attachProtoListener(`left_hand_landmarks`,((e,t)=>{td(e,this.h.leftHandLandmarks),H(this,t)})),this.g.attachEmptyPacketListener(`left_hand_landmarks`,(e=>{H(this,e)})),this.g.attachProtoListener(`left_hand_world_landmarks`,((e,t)=>{var n=this.h.leftHandWorldLandmarks;e=Xs(e),n.push(hl(e)),H(this,t)})),this.g.attachEmptyPacketListener(`left_hand_world_landmarks`,(e=>{H(this,e)})),this.g.attachProtoListener(`right_hand_landmarks`,((e,t)=>{td(e,this.h.rightHandLandmarks),H(this,t)})),this.g.attachEmptyPacketListener(`right_hand_landmarks`,(e=>{H(this,e)})),this.g.attachProtoListener(`right_hand_world_landmarks`,((e,t)=>{var n=this.h.rightHandWorldLandmarks;e=Xs(e),n.push(hl(e)),H(this,t)})),this.g.attachEmptyPacketListener(`right_hand_world_landmarks`,(e=>{H(this,e)})),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};q.prototype.detectForVideo=q.prototype.G,q.prototype.detect=q.prototype.F,q.prototype.setOptions=q.prototype.o,q.createFromModelPath=function(e,t){return G(q,e,{baseOptions:{modelAssetPath:t}})},q.createFromModelBuffer=function(e,t){return G(q,e,{baseOptions:{modelAssetBuffer:t}})},q.createFromOptions=function(e,t){return G(q,e,t)},q.HAND_CONNECTIONS=Gu,q.POSE_CONNECTIONS=Qu,q.FACE_LANDMARKS_LIPS=Pu,q.FACE_LANDMARKS_LEFT_EYE=Fu,q.FACE_LANDMARKS_LEFT_EYEBROW=Iu,q.FACE_LANDMARKS_LEFT_IRIS=Lu,q.FACE_LANDMARKS_RIGHT_EYE=Ru,q.FACE_LANDMARKS_RIGHT_EYEBROW=zu,q.FACE_LANDMARKS_RIGHT_IRIS=Bu,q.FACE_LANDMARKS_FACE_OVAL=Vu,q.FACE_LANDMARKS_CONTOURS=Hu,q.FACE_LANDMARKS_TESSELATION=Uu;var nd=class extends Mu{constructor(e,t){super(new Du(e,t),`input_image`,`norm_rect`,!0),this.j={classifications:[]},C(e=this.h=new Wc,0,1,t=new z)}get baseOptions(){return S(this.h,z,1)}set baseOptions(e){C(this.h,0,1,e)}o(e){return C(this.h,0,2,ll(e,S(this.h,lc,2))),this.l(e)}sa(e,t){return this.j={classifications:[]},ku(this,e,t),this.j}ta(e,t,n){return this.j={classifications:[]},Au(this,e,n,t),this.j}m(){var e=new Rs;L(e,`input_image`),L(e,`norm_rect`),R(e,`classifications`);let t=new js;po(t,Gc,this.h);let n=new Ns;ma(n,2,`mediapipe.tasks.vision.image_classifier.ImageClassifierGraph`),F(n,`IMAGE:input_image`),F(n,`NORM_RECT:norm_rect`),I(n,`CLASSIFICATIONS:classifications`),n.o(t),Ls(e,n),this.g.attachProtoListener(`classifications`,((e,t)=>{this.j=fl(rc(e)),H(this,t)})),this.g.attachEmptyPacketListener(`classifications`,(e=>{H(this,e)})),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};nd.prototype.classifyForVideo=nd.prototype.ta,nd.prototype.classify=nd.prototype.sa,nd.prototype.setOptions=nd.prototype.o,nd.createFromModelPath=function(e,t){return G(nd,e,{baseOptions:{modelAssetPath:t}})},nd.createFromModelBuffer=function(e,t){return G(nd,e,{baseOptions:{modelAssetBuffer:t}})},nd.createFromOptions=function(e,t){return G(nd,e,t)};var rd=class extends Mu{constructor(e,t){super(new Du(e,t),`image_in`,`norm_rect`,!0),this.h=new Kc,this.embeddings={embeddings:[]},C(e=this.h,0,1,t=new z)}get baseOptions(){return S(this.h,z,1)}set baseOptions(e){C(this.h,0,1,e)}o(e){var t=this.h,n=S(this.h,dc,2);return n=n?n.clone():new dc,e.l2Normalize===void 0?`l2Normalize`in e&&b(n,1):b(n,1,Gr(e.l2Normalize)),e.quantize===void 0?`quantize`in e&&b(n,2):b(n,2,Gr(e.quantize)),C(t,0,2,n),this.l(e)}za(e,t){return ku(this,e,t),this.embeddings}Aa(e,t,n){return Au(this,e,n,t),this.embeddings}m(){var e=new Rs;L(e,`image_in`),L(e,`norm_rect`),R(e,`embeddings_out`);let t=new js;po(t,qc,this.h);let n=new Ns;ma(n,2,`mediapipe.tasks.vision.image_embedder.ImageEmbedderGraph`),F(n,`IMAGE:image_in`),F(n,`NORM_RECT:norm_rect`),I(n,`EMBEDDINGS:embeddings_out`),n.o(t),Ls(e,n),this.g.attachProtoListener(`embeddings_out`,((e,t)=>{e=cc(e),this.embeddings=function(e){return{embeddings:sa(e,oc,1).map((e=>{let t={headIndex:fa(e,3)??0??-1,headName:v(y(e,4))??``??``};var n=e.v;return aa(n,0|n[m],ic,ea(e,1))===void 0?(n=new Uint8Array,t.quantizedEmbedding=S(e,ac,ea(e,2),void 0)?.na()?.h()??n):(e=Gi(e=S(e,ic,ea(e,1),void 0),1,Wr,Wi()),t.floatEmbedding=e.slice()),t})),timestampMs:ul(y(e,2,void 0,void 0,ni)??Vi)}}(e),H(this,t)})),this.g.attachEmptyPacketListener(`embeddings_out`,(e=>{H(this,e)})),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};rd.cosineSimilarity=function(e,t){if(e.floatEmbedding&&t.floatEmbedding)e=_l(e.floatEmbedding,t.floatEmbedding);else{if(!e.quantizedEmbedding||!t.quantizedEmbedding)throw Error(`Cannot compute cosine similarity between quantized and float embeddings.`);e=_l(gl(e.quantizedEmbedding),gl(t.quantizedEmbedding))}return e},rd.prototype.embedForVideo=rd.prototype.Aa,rd.prototype.embed=rd.prototype.za,rd.prototype.setOptions=rd.prototype.o,rd.createFromModelPath=function(e,t){return G(rd,e,{baseOptions:{modelAssetPath:t}})},rd.createFromModelBuffer=function(e,t){return G(rd,e,{baseOptions:{modelAssetBuffer:t}})},rd.createFromOptions=function(e,t){return G(rd,e,t)};var id=class{constructor(e,t,n){this.confidenceMasks=e,this.categoryMask=t,this.qualityScores=n}close(){this.confidenceMasks?.forEach((e=>{e.close()})),this.categoryMask?.close()}};function ad(e){let t=function(e){return sa(e,Ns,1)}(e.ca()).filter((e=>(v(y(e,1))??``).includes(`mediapipe.tasks.TensorsToSegmentationCalculator`)));if(e.u=[],t.length>1)throw Error(`The graph has more than one mediapipe.tasks.TensorsToSegmentationCalculator.`);t.length===1&&(S(t[0],js,7)?.j()?.g()??new Map).forEach(((t,n)=>{e.u[Number(n)]=v(y(t,1))??``}))}function od(e){e.categoryMask=void 0,e.confidenceMasks=void 0,e.qualityScores=void 0}function sd(e){try{let t=new id(e.confidenceMasks,e.categoryMask,e.qualityScores);if(!e.j)return t;e.j(t)}finally{Fl(e)}}id.prototype.close=id.prototype.close;var cd=class extends Mu{constructor(e,t){super(new Du(e,t),`image_in`,`norm_rect`,!1),this.u=[],this.outputCategoryMask=!1,this.outputConfidenceMasks=!0,this.h=new Qc,this.A=new Jc,C(this.h,0,3,this.A),C(e=this.h,0,1,t=new z)}get baseOptions(){return S(this.h,z,1)}set baseOptions(e){C(this.h,0,1,e)}o(e){return e.displayNamesLocale===void 0?`displayNamesLocale`in e&&b(this.h,2):b(this.h,2,ii(e.displayNamesLocale)),`outputCategoryMask`in e&&(this.outputCategoryMask=e.outputCategoryMask??!1),`outputConfidenceMasks`in e&&(this.outputConfidenceMasks=e.outputConfidenceMasks??!0),super.l(e)}L(){ad(this)}segment(e,t,n){let r=typeof t==`function`?{}:t;return this.j=typeof t==`function`?t:n,od(this),ku(this,e,r),sd(this)}La(e,t,n,r){let i=typeof n==`function`?{}:n;return this.j=typeof n==`function`?n:r,od(this),Au(this,e,i,t),sd(this)}Da(){return this.u}m(){var e=new Rs;L(e,`image_in`),L(e,`norm_rect`);let t=new js;po(t,$c,this.h);let n=new Ns;ma(n,2,`mediapipe.tasks.vision.image_segmenter.ImageSegmenterGraph`),F(n,`IMAGE:image_in`),F(n,`NORM_RECT:norm_rect`),n.o(t),Ls(e,n),Nl(this,e),this.outputConfidenceMasks&&(R(e,`confidence_masks`),I(n,`CONFIDENCE_MASKS:confidence_masks`),Pl(this,`confidence_masks`),this.g.aa(`confidence_masks`,((e,t)=>{this.confidenceMasks=e.map((e=>ju(this,e,!0,!this.j))),H(this,t)})),this.g.attachEmptyPacketListener(`confidence_masks`,(e=>{this.confidenceMasks=[],H(this,e)}))),this.outputCategoryMask&&(R(e,`category_mask`),I(n,`CATEGORY_MASK:category_mask`),Pl(this,`category_mask`),this.g.Z(`category_mask`,((e,t)=>{this.categoryMask=ju(this,e,!1,!this.j),H(this,t)})),this.g.attachEmptyPacketListener(`category_mask`,(e=>{this.categoryMask=void 0,H(this,e)}))),R(e,`quality_scores`),I(n,`QUALITY_SCORES:quality_scores`),this.g.attachFloatVectorListener(`quality_scores`,((e,t)=>{this.qualityScores=e,H(this,t)})),this.g.attachEmptyPacketListener(`quality_scores`,(e=>{this.categoryMask=void 0,H(this,e)})),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};cd.prototype.getLabels=cd.prototype.Da,cd.prototype.segmentForVideo=cd.prototype.La,cd.prototype.segment=cd.prototype.segment,cd.prototype.setOptions=cd.prototype.o,cd.createFromModelPath=function(e,t){return G(cd,e,{baseOptions:{modelAssetPath:t}})},cd.createFromModelBuffer=function(e,t){return G(cd,e,{baseOptions:{modelAssetBuffer:t}})},cd.createFromOptions=function(e,t){return G(cd,e,t)};var ld=class{constructor(e,t,n){this.confidenceMasks=e,this.categoryMask=t,this.qualityScores=n}close(){this.confidenceMasks?.forEach((e=>{e.close()})),this.categoryMask?.close()}};ld.prototype.close=ld.prototype.close;var ud=class extends Mu{constructor(e,t){super(new Du(e,t),`image_in`,`norm_rect_in`,!1),this.outputCategoryMask=!1,this.outputConfidenceMasks=!0,this.h=new Qc,this.u=new Jc,C(this.h,0,3,this.u),C(e=this.h,0,1,t=new z)}get baseOptions(){return S(this.h,z,1)}set baseOptions(e){C(this.h,0,1,e)}o(e){return`outputCategoryMask`in e&&(this.outputCategoryMask=e.outputCategoryMask??!1),`outputConfidenceMasks`in e&&(this.outputConfidenceMasks=e.outputConfidenceMasks??!0),super.l(e)}segment(e,t,n,r){let i=typeof n==`function`?{}:n;if(this.j=typeof n==`function`?n:r,this.qualityScores=this.categoryMask=this.confidenceMasks=void 0,n=this.C+1,r=new rl,t.keypoint&&t.scribble)throw Error(`Cannot provide both keypoint and scribble.`);if(t.keypoint){var a=new el;Qi(a,3,Gr(!0),!1),Qi(a,1,Ur(t.keypoint.x),0),Qi(a,2,Ur(t.keypoint.y),0),la(r,1,il,a)}else{if(!t.scribble)throw Error(`Must provide either a keypoint or a scribble.`);{let e=new nl;for(a of t.scribble)Qi(t=new el,3,Gr(!0),!1),Qi(t,1,Ur(a.x),0),Qi(t,2,Ur(a.y),0),da(e,1,el,t);la(r,2,il,e)}}this.g.addProtoToStream(r.g(),`mediapipe.tasks.vision.interactive_segmenter.proto.RegionOfInterest`,`roi_in`,n),ku(this,e,i);t:{try{let e=new ld(this.confidenceMasks,this.categoryMask,this.qualityScores);if(!this.j){var o=e;break t}this.j(e)}finally{Fl(this)}o=void 0}return o}m(){var e=new Rs;L(e,`image_in`),L(e,`roi_in`),L(e,`norm_rect_in`);let t=new js;po(t,$c,this.h);let n=new Ns;ma(n,2,`mediapipe.tasks.vision.interactive_segmenter.InteractiveSegmenterGraphV2`),F(n,`IMAGE:image_in`),F(n,`ROI:roi_in`),F(n,`NORM_RECT:norm_rect_in`),n.o(t),Ls(e,n),Nl(this,e),this.outputConfidenceMasks&&(R(e,`confidence_masks`),I(n,`CONFIDENCE_MASKS:confidence_masks`),Pl(this,`confidence_masks`),this.g.aa(`confidence_masks`,((e,t)=>{this.confidenceMasks=e.map((e=>ju(this,e,!0,!this.j))),H(this,t)})),this.g.attachEmptyPacketListener(`confidence_masks`,(e=>{this.confidenceMasks=[],H(this,e)}))),this.outputCategoryMask&&(R(e,`category_mask`),I(n,`CATEGORY_MASK:category_mask`),Pl(this,`category_mask`),this.g.Z(`category_mask`,((e,t)=>{this.categoryMask=ju(this,e,!1,!this.j),H(this,t)})),this.g.attachEmptyPacketListener(`category_mask`,(e=>{this.categoryMask=void 0,H(this,e)}))),R(e,`quality_scores`),I(n,`QUALITY_SCORES:quality_scores`),this.g.attachFloatVectorListener(`quality_scores`,((e,t)=>{this.qualityScores=e,H(this,t)})),this.g.attachEmptyPacketListener(`quality_scores`,(e=>{this.categoryMask=void 0,H(this,e)})),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};ud.prototype.segment=ud.prototype.segment,ud.prototype.setOptions=ud.prototype.o,ud.createFromModelPath=function(e,t){return G(ud,e,{baseOptions:{modelAssetPath:t}})},ud.createFromModelBuffer=function(e,t){return G(ud,e,{baseOptions:{modelAssetBuffer:t}})},ud.createFromOptions=function(e,t){return G(ud,e,t)};var dd=class extends Mu{constructor(e,t){super(new Du(e,t),`input_frame_gpu`,`norm_rect`,!1),this.j={detections:[]},C(e=this.h=new al,0,1,t=new z)}get baseOptions(){return S(this.h,z,1)}set baseOptions(e){C(this.h,0,1,e)}o(e){return e.displayNamesLocale===void 0?`displayNamesLocale`in e&&b(this.h,2):b(this.h,2,ii(e.displayNamesLocale)),e.maxResults===void 0?`maxResults`in e&&b(this.h,3):pa(this.h,3,e.maxResults),e.scoreThreshold===void 0?`scoreThreshold`in e&&b(this.h,4):T(this.h,4,e.scoreThreshold),e.categoryAllowlist===void 0?`categoryAllowlist`in e&&b(this.h,5):ha(this.h,5,e.categoryAllowlist),e.categoryDenylist===void 0?`categoryDenylist`in e&&b(this.h,6):ha(this.h,6,e.categoryDenylist),this.l(e)}F(e,t){return this.j={detections:[]},ku(this,e,t),this.j}G(e,t,n){return this.j={detections:[]},Au(this,e,n,t),this.j}m(){var e=new Rs;L(e,`input_frame_gpu`),L(e,`norm_rect`),R(e,`detections`);let t=new js;po(t,ol,this.h);let n=new Ns;ma(n,2,`mediapipe.tasks.vision.ObjectDetectorGraph`),F(n,`IMAGE:input_frame_gpu`),F(n,`NORM_RECT:norm_rect`),I(n,`DETECTIONS:detections`),n.o(t),Ls(e,n),this.g.attachProtoVectorListener(`detections`,((e,t)=>{for(let t of e)e=Js(t),this.j.detections.push(pl(e));H(this,t)})),this.g.attachEmptyPacketListener(`detections`,(e=>{H(this,e)})),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};dd.prototype.detectForVideo=dd.prototype.G,dd.prototype.detect=dd.prototype.F,dd.prototype.setOptions=dd.prototype.o,dd.createFromModelPath=async function(e,t){return G(dd,e,{baseOptions:{modelAssetPath:t}})},dd.createFromModelBuffer=function(e,t){return G(dd,e,{baseOptions:{modelAssetBuffer:t}})},dd.createFromOptions=function(e,t){return G(dd,e,t)};var fd=class{constructor(e,t,n){this.landmarks=e,this.worldLandmarks=t,this.segmentationMasks=n}close(){this.segmentationMasks?.forEach((e=>{e.close()}))}};function pd(e){e.landmarks=[],e.worldLandmarks=[],e.segmentationMasks=void 0}function md(e){try{let t=new fd(e.landmarks,e.worldLandmarks,e.segmentationMasks);if(!e.u)return t;e.u(t)}finally{Fl(e)}}fd.prototype.close=fd.prototype.close;var hd=class extends Mu{constructor(e,t){super(new Du(e,t),`image_in`,`norm_rect`,!1),this.landmarks=[],this.worldLandmarks=[],this.outputSegmentationMasks=!1,C(e=this.h=new sl,0,1,t=new z),this.A=new Bc,C(this.h,0,3,this.A),this.j=new zc,C(this.h,0,2,this.j),pa(this.j,4,1),T(this.j,2,.5),T(this.A,2,.5),T(this.h,4,.5)}get baseOptions(){return S(this.h,z,1)}set baseOptions(e){C(this.h,0,1,e)}o(e){return`numPoses`in e&&pa(this.j,4,e.numPoses??1),`minPoseDetectionConfidence`in e&&T(this.j,2,e.minPoseDetectionConfidence??.5),`minTrackingConfidence`in e&&T(this.h,4,e.minTrackingConfidence??.5),`minPosePresenceConfidence`in e&&T(this.A,2,e.minPosePresenceConfidence??.5),`outputSegmentationMasks`in e&&(this.outputSegmentationMasks=e.outputSegmentationMasks??!1),this.l(e)}F(e,t,n){let r=typeof t==`function`?{}:t;return this.u=typeof t==`function`?t:n,pd(this),ku(this,e,r),md(this)}G(e,t,n,r){let i=typeof n==`function`?{}:n;return this.u=typeof n==`function`?n:r,pd(this),Au(this,e,i,t),md(this)}m(){var e=new Rs;L(e,`image_in`),L(e,`norm_rect`),R(e,`normalized_landmarks`),R(e,`world_landmarks`),R(e,`segmentation_masks`);let t=new js;po(t,cl,this.h);let n=new Ns;ma(n,2,`mediapipe.tasks.vision.pose_landmarker.PoseLandmarkerGraph`),F(n,`IMAGE:image_in`),F(n,`NORM_RECT:norm_rect`),I(n,`NORM_LANDMARKS:normalized_landmarks`),I(n,`WORLD_LANDMARKS:world_landmarks`),n.o(t),Ls(e,n),Nl(this,e),this.g.attachProtoVectorListener(`normalized_landmarks`,((e,t)=>{this.landmarks=[];for(let t of e)e=Qs(t),this.landmarks.push(ml(e));H(this,t)})),this.g.attachEmptyPacketListener(`normalized_landmarks`,(e=>{this.landmarks=[],H(this,e)})),this.g.attachProtoVectorListener(`world_landmarks`,((e,t)=>{this.worldLandmarks=[];for(let t of e)e=Xs(t),this.worldLandmarks.push(hl(e));H(this,t)})),this.g.attachEmptyPacketListener(`world_landmarks`,(e=>{this.worldLandmarks=[],H(this,e)})),this.outputSegmentationMasks&&(I(n,`SEGMENTATION_MASK:segmentation_masks`),Pl(this,`segmentation_masks`),this.g.aa(`segmentation_masks`,((e,t)=>{this.segmentationMasks=e.map((e=>ju(this,e,!0,!this.u))),H(this,t)})),this.g.attachEmptyPacketListener(`segmentation_masks`,(e=>{this.segmentationMasks=[],H(this,e)}))),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};hd.prototype.detectForVideo=hd.prototype.G,hd.prototype.detect=hd.prototype.F,hd.prototype.setOptions=hd.prototype.o,hd.createFromModelPath=function(e,t){return G(hd,e,{baseOptions:{modelAssetPath:t}})},hd.createFromModelBuffer=function(e,t){return G(hd,e,{baseOptions:{modelAssetBuffer:t}})},hd.createFromOptions=function(e,t){return G(hd,e,t)},hd.POSE_CONNECTIONS=Qu,(function(e,t){let n=Md,r=e();for(;;)try{if(-parseInt(n(288))/1*(-parseInt(n(274))/2)+parseInt(n(278))/3*(-parseInt(n(281))/4)+parseInt(n(254))/5+-parseInt(n(252))/6+-parseInt(n(261))/7+-parseInt(n(270))/8*(-parseInt(n(259))/9)+-parseInt(n(289))/10*(parseInt(n(271))/11)===t)break;r.push(r.shift())}catch{r.push(r.shift())}})(Ad,980251);var gd=12,_d=`SHA-256`;async function vd(e){let t=Md;Nd();let n=await crypto[t(253)].generateKey({name:t(257),modulusLength:2048,publicExponent:new Uint8Array([1,0,1]),hash:_d},!0,[`decrypt`]),r=wd(await Sd(n[t(282)])),i=await yd({apiBaseUrl:e.apiBaseUrl,accessToken:e[t(267)],asset:e.asset,inputSize:e.inputSize,errorContext:e.errorContext},r),a=await bd(i.asset_download_url),o=new Uint8Array(await crypto.subtle[t(258)]({name:`RSA-OAEP`},n[t(262)],jd(Td(i.encrypted_dek)))),s=Ed(o);try{return await xd(a,s)}finally{a[t(260)](0),o[t(260)](0),s[t(260)](0)}}async function yd(e,t){let n=Md,r=new URLSearchParams({asset:e.asset,public_key:t});e.inputSize!==void 0&&r.set(`input_size`,String(e[n(263)]));let i=await fetch(e.apiBaseUrl+`/auth/sdk-assets?`+r,{method:`GET`,headers:{accept:`application/json`,authorization:`Bearer `+e[n(267)],"Device-Access-Token":e.accessToken}});if(!i.ok)throw Error(n(266)+e.errorContext+` request failed: `+i.status);let a=await i.json();if(!a.encrypted_dek||!a[n(284)])throw Error(n(266)+e[n(268)]+` response is incomplete.`);return{encrypted_dek:a.encrypted_dek,asset_download_url:a.asset_download_url,asset:a[n(279)]??e[n(279)],input_size:a.input_size??null,version:a[n(285)]??``}}async function bd(e){let t=Md,n=await fetch(e);if(!n.ok)throw Error(`Failed to download MonitorDog model: `+n.status+` `+n.statusText);return new Uint8Array(await n[t(273)]())}async function xd(e,t){let n=Md;if(e.byteLength<=gd)throw Error(n(280));let r=await crypto.subtle.importKey(n(269),jd(t),{name:n(255)},!1,[n(258)]),i=e[n(272)](0,gd),a=e.slice(gd);return new Uint8Array(await crypto[n(253)].decrypt({name:`AES-GCM`,iv:jd(i)},r,jd(a)))}async function Sd(e){let t=Md,n=await crypto[t(253)].exportKey(`spki`,e);return[`-----BEGIN PUBLIC KEY-----`,...Cd(new Uint8Array(n)).match(/.{1,64}/g)??[],`-----END PUBLIC KEY-----`][t(276)](`
42
- `)}function Cd(e){let t=``;for(let n of e)t+=String.fromCharCode(n);return btoa(t)}function wd(e){let t=Md;return Cd(new TextEncoder()[t(283)](e))}function Td(e){let t=Md,n=e.replace(/-----BEGIN [^-]+-----/g,``)[t(264)](/-----END [^-]+-----/g,``).replace(/\s/g,``).replace(/-/g,`+`).replace(/_/g,`/`),r=(4-n.length%4)%4,i=n+`=`[t(290)](r),a=atob(i),o=new Uint8Array(a[t(265)]);for(let e=0;e<a.length;e+=1)o[e]=a.charCodeAt(e);return o}function Ed(e){let t=Md;if(kd(e.byteLength))return new Uint8Array(e);let n=new TextDecoder().decode(e).trim(),r=Dd(n.startsWith(`"`)&&n.endsWith(`"`)?n[t(272)](1,-1):n);if(r&&kd(r[t(277)]))return r;throw Error(t(292)+e.byteLength+t(286))}function Dd(e){if(/^[0-9a-f]+$/i[Md(291)](e)&&e.length%2==0)return Od(e);try{return Td(e)}catch{return}}function Od(e){let t=new Uint8Array(e.length/2);for(let n=0;n<t.length;n+=1)t[n]=Number.parseInt(e.slice(n*2,n*2+2),16);return t}function kd(e){return e===16||e===32}function Ad(){let e=`MonitorDog SDK ,accessToken,errorContext,raw,8091808luUFNz,7356283xsDZUp,slice,arrayBuffer,2842BMSZEJ,apiBaseUrl,join,byteLength,1620369TfJTEK,asset,MonitorDog encrypted model data is too short.,4XBBJJU,publicKey,encode,asset_download_url,version, bytes.,decode,1357rQszRu,10tHpoUv,repeat,test,MonitorDog SDK model DEK must decode to a 128-bit or 256-bit AES key. Received ,set,1597902SOlaEU,subtle,993535SFsHkr,AES-GCM,ORT WASM runtime,RSA-OAEP,decrypt,9fRdVLX,fill,4781252yjTouS,privateKey,inputSize,replace,length`.split(`,`);return Ad=function(){return e},Ad()}function jd(e){let t=Md,n=new ArrayBuffer(e[t(277)]);return new Uint8Array(n)[t(251)](e),n}function Md(e,t){return e-=251,Ad()[e]}function Nd(){if(!globalThis.crypto?.subtle)throw Error(`MonitorDog SDK model decryption requires Web Crypto API.`)}(function(e,t){let n=Ld,r=e();for(;;)try{if(parseInt(n(227))/1*(-parseInt(n(226))/2)+-parseInt(n(217))/3+parseInt(n(218))/4*(parseInt(n(223))/5)+-parseInt(n(215))/6*(-parseInt(n(219))/7)+parseInt(n(216))/8*(-parseInt(n(221))/9)+-parseInt(n(220))/10*(parseInt(n(222))/11)+parseInt(n(224))/12===t)break;r.push(r.shift())}catch{r.push(r.shift())}})(Id,403707);async function Pd(e){let[t,n,r]=await Promise.all([Fd(e,re,`MediaPipe vision WASM loader`),Fd(e,ie,`MediaPipe vision WASM binary`),Fd(e,oe,`MediaPipe pose model`)]),i=Rd(t,`text/javascript`),a=Rd(n,`application/wasm`);return t.fill(0),n.fill(0),{wasmFileset:{wasmLoaderPath:i,wasmBinaryPath:a},poseModelAssetBuffer:r,dispose(){URL.revokeObjectURL(i),URL.revokeObjectURL(a),r.fill(0)}}}function Fd(e,t,n){return vd({apiBaseUrl:e.apiBaseUrl,accessToken:e.accessToken,asset:t,errorContext:n})}function Id(){let e=[`10YBydhv`,`133911nITxbE`,`1023253aoCxJm`,`295875UuqMpt`,`9651780bUNCKS`,`createObjectURL`,`6FLyAty`,`8724AcyyKD`,`60SsmeMd`,`104xivgGf`,`1160343QWflJn`,`4lTACBX`,`167734cQqait`];return Id=function(){return e},Id()}function Ld(e,t){return e-=215,Id()[e]}function Rd(e,t){return URL[Ld(225)](new Blob([zd(e)],{type:t}))}function zd(e){let t=new ArrayBuffer(e.byteLength);return new Uint8Array(t).set(e),t}(function(e,t){let n=Bd,r=e();for(;;)try{if(parseInt(n(244))/1+parseInt(n(253))/2+-parseInt(n(259))/3+-parseInt(n(257))/4+-parseInt(n(254))/5+parseInt(n(258))/6*(-parseInt(n(247))/7)+parseInt(n(249))/8===t)break;r.push(r.shift())}catch{r.push(r.shift())}})(Hd,446545);function Bd(e,t){return e-=244,Hd()[e]}var Vd=.04;function Hd(){let e=[`min`,`visibility`,`1139156iXihvw`,`3218490fpQRsr`,`max`,`hypot`,`1774152ASrGps`,`12552KgbLDx`,`1968345GBTqwy`,`328784fUzpZl`,`length`,`reduce`,`1841qCkxfG`,`filter`,`14733840rpZWBe`,`map`];return Hd=function(){return e},Hd()}function Ud(e,t){return e!==void 0&&e[Bd(252)]>=t}function Wd(e,t){let n=Bd;return[e[lf.leftShoulder],e[lf.rightShoulder],e[lf.leftHip],e[lf.rightHip]][n(248)](e=>Ud(e,t))}function Gd(e){return e===`track`?{minShoulderWidth:nf,minVisibility:af}:{minShoulderWidth:tf,minVisibility:rf}}function Kd(e){let t=Bd,n=e[t(246)]((e,t)=>({x:e.x+t.x,y:e.y+t.y}),{x:0,y:0});return{x:Qd(n.x/e[t(245)]),y:Qd(n.y/e.length)}}function qd(e){let t=Bd,n=e[t(250)](e=>e.x),r=e.map(e=>e.y),i=Math.min(...n),a=Math.min(...r),o=Math.max(...n),s=Math.max(...r),c=Math.max(o-i,Vd),l=Math[t(255)](s-a,Vd),u=(i+o)/2,d=(a+s)/2;return{x:Qd(u-c/2),y:Qd(d-l/2),width:Math.min(c,1),height:Math[t(251)](l,1)}}function Jd(e,t){let n=Bd,r=Math[n(255)](e.x,t.x),i=Math.max(e.y,t.y),a=Math.min(e.x+e.width,t.x+t.width),o=Math[n(251)](e.y+e.height,t.y+t.height),s=Math.max(0,a-r)*Math[n(255)](0,o-i),c=Math.min(Yd(e),Yd(t));return c<=0?0:s/c}function Yd(e){return e.width*e.height}function Xd(e,t){if(!e||!t)return!1;let n=t/e;return n>=.45&&n<=2.2}function Zd(e,t){return Math[Bd(256)](e.x-t.x,e.y-t.y)}function Qd(e){return Math.min(Math[Bd(255)](e,0),1)}function $d(e,t,n){return Math.min(Math.max(e,t),n)}var J=of;(function(e,t){let n=of,r=e();for(;;)try{if(parseInt(n(220))/1*(parseInt(n(251))/2)+-parseInt(n(246))/3*(-parseInt(n(211))/4)+parseInt(n(260))/5+parseInt(n(239))/6*(-parseInt(n(236))/7)+parseInt(n(214))/8+parseInt(n(248))/9+parseInt(n(245))/10*(-parseInt(n(226))/11)===t)break;r.push(r.shift())}catch{r.push(r.shift())}})(ef,467470);function ef(){let e=`accessToken.setTracking.createResult.11UMAZiZ.close.minVisibility.map.missingSampleCount.distance.landmarks.lastTrack.now.minShoulderWidth.6150865tKyNfW.MISSING.length.6lByvoo.getPoseCentroid.leftShoulder.filter.createElement.centroid.4169170IDJPsV.48DETtaX.missingStartedAt.5555646rBiOGJ.matchCandidate.apiBaseUrl.3428KgLIGC.markMissing.INIT.hasTrackedUser.poseModelAssetPath.detectForVideo.state.lastCentroid.poseLandmarker.153455KgaFve.51492gBVVxp.wasmBasePath.numPoses.3132008EpTDWi.hasSelfHostedAssetPath.shoulderWidth.loadAssetBundle.dispose.TRACKING.302DmZkrb.toPoseCandidates.torsoBox`.split(`.`);return ef=function(){return e},ef()}var tf=.2,nf=.08,rf=.5,af=.75;function of(e,t){return e-=211,ef()[e]}var sf=1,cf=2,lf={leftShoulder:11,rightShoulder:12,leftHip:23,rightHip:24},uf=class{[J(212)];[J(255)];numPoses;apiBaseUrl;accessToken;assetBundle;poseLandmarker;state=`INIT`;[J(258)];[J(233)];[J(254)]=!1;missingStartedAt;[J(230)]=0;constructor(e={}){let t=J;this.apiBaseUrl=e.apiBaseUrl,this[t(223)]=e.accessToken,this.wasmBasePath=e.wasmBasePath??``,this.poseModelAssetPath=e.modelAssetPath??``,this[t(213)]=$d(e[t(213)]??sf,1,4)}async load(){this.poseLandmarker||(this.poseLandmarker??=await this.createPoseLandmarkerWithFallback())}[J(256)](e,t){let n=J;if(!this.poseLandmarker)throw Error(`MediaPipe main user tracker is not loaded.`);let r=this.poseLandmarker.detectForVideo(e,t);if(this.state===n(219)||this.state===`MISSING`){let e=this.toPoseCandidates(r.landmarks,`track`),i=this[n(249)](e);return i?(this[n(224)](i,t),this.createResult(r[n(232)],e)):(this.markMissing(t),this[n(225)](r.landmarks,e))}let i=this[n(221)](r.landmarks,`acquire`),a=this.findMainUser(i);return a&&this.setTracking(a,t),this.createResult(r.landmarks,i)}getSnapshot(e){let t=J,n=this[t(257)]===t(237)&&this.missingStartedAt!==void 0?Math.max(0,e-this.missingStartedAt):0;return{enabled:!0,state:this[t(257)],hasTrackedUser:this.hasTrackedUser,lastCentroid:this.lastTrack?.centroid??this.lastCentroid,missingElapsedMs:n,poseCount:0,candidateCount:0}}reset(){this.resetTrackingState({preserveHistory:!1})}resetTrackingState(e){let t=J;this.state=t(253),this.lastCentroid=void 0,this.lastTrack=void 0,!e.preserveHistory&&(this.hasTrackedUser=!1),this.missingStartedAt=void 0,this[t(230)]=0}dispose(){let e=J;this.poseLandmarker?.[e(227)](),this[e(259)]=void 0,this.assetBundle?.[e(218)](),this.assetBundle=void 0,this.reset()}async createPoseLandmarkerWithFallback(){try{return await this.createPoseLandmarker(`GPU`)}catch{return this.createPoseLandmarker(`CPU`)}}async createPoseLandmarker(e){let t=J,n=await this.loadAssetBundle(),r=n?n.wasmFileset:await Sl.forVisionTasks(this.getSelfHostedWasmBasePath());return hd.createFromOptions(r,{baseOptions:{...n?{modelAssetBuffer:new Uint8Array(n.poseModelAssetBuffer)}:{modelAssetPath:this.getSelfHostedModelAssetPath()},delegate:e},runningMode:`VIDEO`,numPoses:this[t(213)],...e===`GPU`?{canvas:document[t(243)](`canvas`)}:{}})}async[J(217)](){let e=J;if(!this.hasSelfHostedAssetPath()&&!(!this.apiBaseUrl||!this[e(223)]))return this.assetBundle??=await Pd({apiBaseUrl:this[e(250)],accessToken:this[e(223)]}),this.assetBundle}[J(215)](){let e=J;return!!(this[e(212)]||this.poseModelAssetPath)}getSelfHostedWasmBasePath(){if(!this.wasmBasePath||!this.poseModelAssetPath)throw Error(`Both mainUserTrackingWasmBasePath and mainUserTrackingModelAssetPath are required for self-hosted MediaPipe assets.`);return this.wasmBasePath}getSelfHostedModelAssetPath(){let e=J;if(!this[e(212)]||!this[e(255)])throw Error(`Both mainUserTrackingWasmBasePath and mainUserTrackingModelAssetPath are required for self-hosted MediaPipe assets.`);return this.poseModelAssetPath}toPoseCandidates(e,t){let n=J;return e.map(e=>this.toPoseCandidate(e,t))[n(242)](e=>!!e)}toPoseCandidate(e,t){let n=J,r=Gd(t),i=Wd(e,r.minVisibility),a=e[lf.leftShoulder],o=e[lf.rightShoulder],s=Ud(a,r.minVisibility),c=Ud(o,r.minVisibility);if(t===`track`){if(i[n(238)]<cf)return;let e=s&&c?Math.abs(a.x-o.x):void 0;return{centroid:Kd(i),torsoBox:qd(i),shoulderWidth:e!==void 0&&e>=.08?e:void 0}}if(!s||!c)return;let l=Math.abs(a.x-o.x);if(!(l<r[n(235)]))return{centroid:this[n(240)](e,r[n(228)]),torsoBox:qd(i),shoulderWidth:l}}getPoseCentroid(e,t){let n=J,r=[e[lf[n(241)]],e[lf.rightShoulder]],i=[e[lf.leftHip],e[lf.rightHip]],a=i[n(242)](e=>Ud(e,t));return Kd(a.length===i[n(238)]?[...r,...a]:r)}findMainUser(e){return e.reduce((e,t)=>e?Zd(t.centroid,{x:.5,y:.5})<Zd(e.centroid,{x:.5,y:.5})?t:e:t,void 0)}matchCandidate(e){let t=J;if(this.lastTrack)return e[t(229)](e=>({candidate:e,distance:Zd(e.centroid,this.lastTrack[t(244)]),overlapRatio:Jd(e[t(222)],this[t(233)][t(222)]),scaleMatches:Xd(this.lastTrack.shoulderWidth,e[t(216)])}))[t(242)](e=>e[t(231)]<=.25||e.distance<=.45&&e.overlapRatio>=.15||e[t(231)]<=.45&&e.scaleMatches).sort((e,n)=>e[t(231)]-n.distance)[0]?.candidate}[J(224)](e,t){let n=J;this.state=`TRACKING`,this[n(254)]=!0,this.lastCentroid=e[n(244)],this[n(233)]={centroid:e.centroid,torsoBox:e.torsoBox,shoulderWidth:e.shoulderWidth,updatedAt:t},this[n(247)]=void 0,this[n(230)]=0}[J(252)](e){let t=J;this.missingStartedAt===void 0&&(this[t(247)]=e),this.missingSampleCount+=1;let n=e-this.missingStartedAt;if(this.missingSampleCount>=2||n>=650){this.setAway();return}this.state=t(237)}setAway(){let e=J;this.state=`AWAY`,this[e(258)]=void 0,this.lastTrack=void 0,this[e(247)]=void 0,this[e(230)]=0}[J(225)](e,t){let n=J;return{...this.getSnapshot(performance[n(234)]()),poseCount:e[n(238)],candidateCount:t.length,debugPose:{landmarks:e.map(e=>e.map(({x:e,y:t})=>({x:Qd(e),y:Qd(t)}))),candidateBoxes:t.map(e=>e.torsoBox),lastTrackBox:this.lastTrack?.torsoBox}}}};function df(e,t){return e-=329,hf()[e]}(function(e,t){let n=df,r=e();for(;;)try{if(-parseInt(n(345))/1+-parseInt(n(350))/2*(-parseInt(n(330))/3)+-parseInt(n(338))/4*(parseInt(n(335))/5)+-parseInt(n(336))/6*(parseInt(n(329))/7)+-parseInt(n(333))/8*(-parseInt(n(332))/9)+parseInt(n(347))/10*(-parseInt(n(346))/11)+-parseInt(n(331))/12*(-parseInt(n(342))/13)===t)break;r.push(r.shift())}catch{r.push(r.shift())}})(hf,517445);function ff(e){return e.readyState>=HTMLMediaElement.HAVE_CURRENT_DATA&&e.videoWidth>0&&e.videoHeight>0&&!e.paused&&!e.ended}function pf(e,t=1e4){let n=df;return mf(e)?Promise[n(343)]():new Promise((r,i)=>{let a=n,o=window[a(341)](()=>{let e=a;c(),i(Error(e(339)))},t),s=window[a(334)](l,100),c=()=>{let t=a;window.clearTimeout(o),window.clearInterval(s),e.removeEventListener(`loadedmetadata`,u),e.removeEventListener(`loadeddata`,u),e.removeEventListener(t(337),u),e.removeEventListener(`playing`,u),e.removeEventListener(`resize`,u),e[t(340)](t(348),d)};function l(){mf(e)&&(c(),r())}let u=()=>{l()},d=()=>{let e=a;c(),i(Error(e(344)))};e[a(349)](`loadedmetadata`,u,{once:!0}),e.addEventListener(`loadeddata`,u,{once:!0}),e.addEventListener(`canplay`,u,{once:!0}),e[a(349)](`playing`,u,{once:!0}),e[a(349)](`resize`,u,{once:!0}),e.addEventListener(`error`,d,{once:!0})})}function mf(e){return e.readyState>=HTMLMediaElement.HAVE_METADATA&&e.videoWidth>0&&e.videoHeight>0}function hf(){let e=[`addEventListener`,`398FXjkkv`,`42ZvSpLM`,`321jObzhF`,`27615612BDYJhY`,`514332FtDxqi`,`88JHeoGQ`,`setInterval`,`28205mUZACz`,`1024602UaKsXG`,`canplay`,`124JoVCYW`,`Timed out waiting for webcam video metadata.`,`removeEventListener`,`setTimeout`,`13fLhRcu`,`resolve`,`Failed to load webcam video stream.`,`782205mcvIZD`,`16973euYJyE`,`2930UZwxjF`,`error`];return hf=function(){return e},hf()}function gf(){let e=`faceDetected.clearMainUserTrackerLoadTimeout.renderPoseDebugOverlay.reset.scheduleMainUserTrackerLoading.baselineRefreshPendingAfterNoFace.25mvprHi.loadInferenceWorkerWithOptions.882935piSBHF.phoneDetected.detectionEvents.clearPoseDebugOverlay.4592ldrzzh.19864jKOetU.candidateBoxes.mainUserTrackerDisabledReason.2MoBhcG.false.now.not loaded.webcamBlockageDetector.dispose.getPoseDebugCanvas.absolute.getContext.video.INIT.info.getInferenceWorker.onError.detect.inferenceWorker.changedCoverage.getWebcamFrameAnalyzer.115569zGvBwc.710GEmvpe.camera.2738120hiREle.hasTrackedUser.mainUserTrackerLoadTimeoutId.overlay.analyze.assign.detectMainUser.webcamLightingDetector.1109256fgKVsP.createElement.1377267Cznipm.system.resolve.height.lastInferenceMemoryErrorAt.detectionIntervalMs.shouldRefreshBaselineForNormalState.poseDebugCanvas.clearWebcamLightingOverlay.7105ysGnrb.tooDark.disposed.mainUserTracker.clearJob.lineWidth.stopStream.finally.apiBaseUrl.width.left.srcObject.block.terminate.likelyCovered.mainUserTrackingEnabled.setItem.needsBaselineRefresh.recoverFromInferenceMemoryError.degradeInferenceModelForMemoryPressure.handleWebcamLightingResult.style.run.debug.debugPose.#facc15.lastTrackBox.playsInline.getSnapshot.showJob.mainUserTrackerLoadPromise.load.webcamTooBright.services.loadPromise.ensureMainUserTrackerLoading.options.[MonitorDog] detect frame.#22c55e.webcam-lighting:.activeLightingOverlayState.webcamTooDark.#38bdf8`.split(`.`);return gf=function(){return e},gf()}var Y=_f;(function(e,t){let n=_f,r=e();for(;;)try{if(parseInt(n(494))/1+-parseInt(n(403))/2*(-parseInt(n(434))/3)+-parseInt(n(400))/4+parseInt(n(492))/5*(-parseInt(n(432))/6)+parseInt(n(443))/7*(-parseInt(n(498))/8)+parseInt(n(421))/9*(parseInt(n(422))/10)+-parseInt(n(424))/11===t)break;r.push(r.shift())}catch{r.push(r.shift())}})(gf,492859);function _f(e,t){return e-=400,gf()[e]}var vf=class{services;inferenceWorker;[Y(477)];lastInferenceMemoryErrorAt=0;[Y(446)];mainUserTrackerLoadPromise;mainUserTrackerLoadTimeoutId;mainUserTrackerLoadToken=0;mainUserTrackerDisabledReason=Y(406);mainUserTrackingEnabled=!0;webcamFrameAnalyzer;webcamBlockageDetector;webcamLightingDetector;activeLightingOverlayState;poseDebugCanvas;baselineRefreshPendingAfterNoFace=!1;constructor(e){let t=Y;this.services=e,this.mainUserTrackingEnabled=wf(e[t(479)][t(458)])}async load(){!this.loadPromise&&(this.loadPromise=this.loadInferenceWorker()),await this.loadPromise,this.scheduleMainUserTrackerLoading()}async[Y(417)](e){let t=Y;await this[t(474)]();let n=this.services.options,r=n[t(466)]?performance[t(405)]():0,i=n.debug?performance.now():0,a=await it(e),o=n[t(466)]?performance.now():0,s=await this.getInferenceWorker()[t(465)]({source:a,inputSize:n.inputSize,inputType:n.inputType,confidenceThreshold:n.confidenceThreshold,faceConfidenceThreshold:n.faceConfidenceThreshold,iouThreshold:n.iouThreshold,maxDetections:n.maxDetections,debug:!!n.debug});if(n.debug){let e=performance.now();console[t(414)](t(480),{sourceMs:yf(o-i),workerRoundtripMs:yf(e-o),totalMs:yf(e-r)})}return s}toPublicResult(e){let t=Y;return{faceDetected:e[t(486)],phoneDetected:e[t(495)],faceCount:e.faceCount,phoneCount:e.phoneCount,faceDetections:e.faceDetections,phoneDetections:e.phoneDetections}}detectVideo(e){let t=Y,n=!1,r,i=this.services.options[t(439)],a=async()=>{let o=t;if(!n){try{if(!this.services.shouldPauseDetection&&ff(e)){let t=this.getWebcamFrameAnalyzer()[o(428)](e),s=this.getWebcamBlockageDetector(),c=s.analyze(t);if(await this.services[o(496)].handleWebcamBlockageResult(c,e).catch(e=>{this.services.options.onError?.(e)}),n||c[o(457)]&&!this.baselineRefreshPendingAfterNoFace){!n&&(r=setTimeout(a,i));return}let l=await this.detect(e);if(n)return;let u=this[o(430)](e);this.renderPoseDebugOverlay(e,u);let d=De(l,u);this.isNoUserTrackingState(u)&&(this.baselineRefreshPendingAfterNoFace=!0),(s[o(460)]()||this.baselineRefreshPendingAfterNoFace||this[o(440)](c,d))&&d&&(s.refreshBaseline(t),this[o(491)]=!1);try{await this.services.options.onDetect({...this.toPublicResult(l),video:e,timestamp:e.currentTime,mainUserTracking:u})}catch(e){this.services.options[o(416)]?.(e)}if(n)return;await this[o(476)].detectionEvents.handleDetectionResult(l,u,e).catch(e=>{let t=o;this[t(476)].options.onError?.(e)})}}catch(e){this.handleDetectionLoopError(e)}!n&&(r=setTimeout(a,i))}};return a(),{stop(){n=!0,r&&clearTimeout(r)}}}async startWebcamDetection(){let e=Y,t=this.services[e(479)],n=await this.services[e(423)].createWebcamStream(t.constraints),r=this[e(476)][e(423)],i=!t[e(412)],a=t.video??document[e(433)](`video`),o=a.muted,s=a[e(470)],c=a.srcObject;a.muted=!0,a.playsInline=!0,a[e(454)]=n;try{await Promise.all([a.play(),pf(a)])}catch(t){throw r.stopStream(n),a.pause(),i?a.srcObject=null:(a.muted=o,a.playsInline=s,a[e(454)]=c),t}this[e(446)]?.[e(489)](),this[e(490)](),this.webcamBlockageDetector?.reset(),this.webcamLightingDetector?.reset(),this[e(442)](),this[e(491)]=!1,this.services.detectionEvents.resetForWebcamStartup();let l=this.detectVideo(a),u=!1,d=r.watchStreamDeviceDisconnect(n,()=>{ee(),this.services.onCameraDisconnect?.()}),ee=()=>{let t=e;u||(u=!0,d(),l.stop(),this.webcamBlockageDetector?.reset(),this.webcamLightingDetector?.reset(),this.clearWebcamLightingOverlay(),this.clearPoseDebugOverlay(),this.baselineRefreshPendingAfterNoFace=!1,r[t(449)](n),a.pause(),i?a.srcObject=null:(a.muted=o,a[t(470)]=s,a[t(454)]=c))};return{stream:n,video:a,stop:ee}}isMainUserTrackingEnabled(){return this.mainUserTrackingEnabled}setMainUserTrackingEnabled(e){let t=Y;if(this.mainUserTrackingEnabled!==e){if(this.mainUserTrackingEnabled=e,Tf(e),this.clearMainUserTrackerLoadTimeout(),this.mainUserTrackerLoadToken+=1,this.mainUserTrackerLoadPromise=void 0,e){this.mainUserTrackerDisabledReason=`not loaded`,this.scheduleMainUserTrackerLoading();return}this.mainUserTracker?.dispose(),this.mainUserTracker=void 0,this.mainUserTrackerDisabledReason=`disabled`,this[t(497)](),this.baselineRefreshPendingAfterNoFace=!1}}dispose(){let e=Y;this.inferenceWorker?.[e(456)](),this.inferenceWorker=void 0,this.loadPromise=void 0,this[e(487)](),this.webcamBlockageDetector?.reset(),this.webcamLightingDetector?.[e(489)](),this[e(442)](),this.clearPoseDebugOverlay(),this[e(491)]=!1,this.mainUserTrackerLoadToken+=1,this.mainUserTrackerLoadPromise=void 0,this[e(446)]?.dispose(),this.mainUserTracker=void 0,this[e(402)]=e(445)}[Y(478)](){let e=Y;if(!this.mainUserTrackingEnabled)return this[e(402)]=`disabled`,Promise.resolve();if(this.mainUserTracker||this.mainUserTrackerLoadPromise)return this[e(473)]??Promise[e(436)]();let t=ve();if(!t.enabled)return this.mainUserTrackerDisabledReason=t.reason??`unsupported`,Promise.resolve();let n=this.mainUserTrackerLoadToken+1;return this.mainUserTrackerLoadToken=n,this.mainUserTrackerDisabledReason=`loading`,this.mainUserTrackerLoadPromise=this.loadMainUserTracker(n)[e(450)](()=>{this.mainUserTrackerLoadToken===n&&(this.mainUserTrackerLoadPromise=void 0)}),this.mainUserTrackerLoadPromise}scheduleMainUserTrackerLoading(){!this.mainUserTrackingEnabled||this.mainUserTracker||this.mainUserTrackerLoadPromise||this.mainUserTrackerLoadTimeoutId||(this.mainUserTrackerLoadTimeoutId=setTimeout(()=>{this.mainUserTrackerLoadTimeoutId=void 0,this.ensureMainUserTrackerLoading().catch(e=>{this.services.options.onError?.(e)})},2e3))}clearMainUserTrackerLoadTimeout(){let e=Y;this.mainUserTrackerLoadTimeoutId&&(clearTimeout(this.mainUserTrackerLoadTimeoutId),this[e(426)]=void 0)}async loadMainUserTracker(e){let t=Y,n;try{let r=await this[t(476)].auth.getValidAccessToken();if(!r)throw Error(`MonitorDog login is required before loading MediaPipe.`);n=new uf({apiBaseUrl:this[t(476)].options[t(451)],accessToken:r,wasmBasePath:this[t(476)][t(479)].mainUserTrackingWasmBasePath,modelAssetPath:this.services.options.mainUserTrackingModelAssetPath}),await n[t(474)](),this.mainUserTrackerLoadToken===e?(this.mainUserTracker?.[t(408)](),this.mainUserTracker=n,this[t(402)]=``):n.dispose()}catch(e){n?.dispose(),this.mainUserTrackerDisabledReason=e instanceof Error?e.message:`failed to load`}}[Y(430)](e){let t=Y;if(!this[t(446)])return xf(this.mainUserTrackerDisabledReason);let n=performance.now(),r=this.mainUserTracker[t(471)](n);try{return this.mainUserTracker.detectForVideo(e,n)}catch{return r}}isNoUserTrackingState(e){let t=Y;return e.state===`AWAY`||e.state===`INIT`&&e[t(425)]}shouldRefreshBaselineForNormalState(e,t){let n=Y;return t&&!e.blocked&&!e.suspected&&!e.likelyCovered&&e[n(419)]>=.6}[Y(463)](e){let t=Y;if(!e.issue)return this[t(442)](),!1;let n=Cf(e.issue);return n?e.active?this.activeLightingOverlayState===n?!0:(this[t(442)](),this[t(483)]=n,this.services[t(427)].showJob({id:t(482)+n,state:n,source:`system`,priority:180}),!0):(this[t(442)](),!0):(this.clearWebcamLightingOverlay(),!1)}clearWebcamLightingOverlay(){let e=Y;if(this.activeLightingOverlayState){for(let t of Sf)this.services.overlay[e(447)](`webcam-lighting:`+t);this.activeLightingOverlayState=void 0}}[Y(488)](e,t){let n=Y;if(!this.services.options[n(466)]||!t.debugPose){this.clearPoseDebugOverlay();return}let r=this.getPoseDebugCanvas(),i=r[n(411)](`2d`);if(!i)return;let a=e.getBoundingClientRect();r.width=Math.max(1,Math.round(a[n(452)])),r.height=Math.max(1,Math.round(a.height)),Object.assign(r.style,{left:a[n(453)]+window.scrollX+`px`,top:a.top+window.scrollY+`px`,width:a[n(452)]+`px`,height:a.height+`px`,display:n(455)}),i.clearRect(0,0,r.width,r.height),this.drawPoseDebug(i,r,t[n(467)])}[Y(409)](){let e=Y;if(this.poseDebugCanvas?.isConnected)return this.poseDebugCanvas;let t=document.createElement(`canvas`);return t.id=`monitordog-pose-debug-overlay`,Object[e(429)](t[e(464)],{position:e(410),zIndex:`2147483646`,pointerEvents:`none`,display:`none`}),document.body.append(t),this.poseDebugCanvas=t,t}clearPoseDebugOverlay(){let e=Y;this[e(441)]?.remove(),this.poseDebugCanvas=void 0}drawPoseDebug(e,t,n){let r=Y;for(let i of n.landmarks){e.fillStyle=r(468);for(let n of i)e.beginPath(),e.arc(n.x*t.width,n.y*t[r(437)],3,0,Math.PI*2),e.fill()}for(let i of n[r(401)])bf(e,t,i,r(485),2);n.lastTrackBox&&bf(e,t,n[r(469)],r(481),3)}handleDetectionLoopError(e){let t=Y;if(this.isInferenceMemoryError(e)){this.recoverFromInferenceMemoryError(),this[t(476)][t(479)].onError?.(e);return}this[t(476)].options.onError?.(e)}[Y(461)](){let e=Y;this.degradeModelForMemoryPressure(),this.resetInferenceWorker();let t=Date[e(405)]();t-this.lastInferenceMemoryErrorAt<1e4||(this[e(438)]=t,this[e(476)].overlay[e(472)]({id:`inference:memory`,state:`inferenceMemoryError`,source:e(435),text:`MonitorDog detection ran out of memory.
43
- Please close unused tabs or apps to free memory. Detection is restarting automatically.`,durationMs:4e3,priority:220}))}resetInferenceWorker(){let e=Y;this.inferenceWorker?.terminate(),this[e(418)]=void 0,this.loadPromise=void 0}degradeModelForMemoryPressure(){let e=Y;this[e(476)][e(462)]()}isInferenceMemoryError(e){let t=e instanceof Error?e.message:String(e);return/out of memory|oom|memory access out of bounds|cannot enlarge memory|array buffer allocation|bad allocation|allocation failed/i.test(t)}[Y(415)](){let e=Y;return!this[e(418)]&&(this.inferenceWorker=new nt),this[e(418)]}[Y(420)](){return!this.webcamFrameAnalyzer&&(this.webcamFrameAnalyzer=new Tt),this.webcamFrameAnalyzer}getWebcamBlockageDetector(){let e=Y;return!this.webcamBlockageDetector&&(this[e(407)]=new Ut),this[e(407)]}getWebcamLightingDetector(){let e=Y;return!this.webcamLightingDetector&&(this.webcamLightingDetector=new Xt),this[e(431)]}async loadInferenceWorker(){let e=Y;try{await this[e(493)]()}catch(t){if(!this.isInferenceMemoryError(t))throw t;this.recoverFromInferenceMemoryError();try{await this.loadInferenceWorkerWithOptions()}catch(t){throw this[e(461)](),t}}}async[Y(493)](){let e=await this.services.auth.getValidAccessToken();if(!e)throw Error(`MonitorDog login is required before loading detection.`);let t=this.services.options;await this.getInferenceWorker().load({apiBaseUrl:t.apiBaseUrl,accessToken:e,inputSize:t.inputSize})}};function yf(e){return Math.round(e*10)/10}function bf(e,t,n,r,i){let a=Y;e.strokeStyle=r,e[a(448)]=i,e.strokeRect(n.x*t.width,n.y*t.height,n[a(452)]*t.width,n.height*t.height)}function xf(e){return{enabled:!1,disabledReason:e,state:Y(413),hasTrackedUser:!1,missingElapsedMs:0,poseCount:0,candidateCount:0}}var Sf=[Y(484),`webcamTooBright`];function Cf(e){let t=Y;switch(e){case t(444):return`webcamTooDark`;case`tooBright`:return t(475);case void 0:return}}function wf(e){let t=Y;if(e!==void 0)return e;if(typeof localStorage>`u`)return!0;try{let e=localStorage.getItem(ne);return e===null?!0:e!==t(404)}catch{return!0}}function Tf(e){let t=Y;if(!(typeof localStorage>`u`))try{localStorage[t(459)](ne,String(e))}catch{return}}var Ef=Of;function Df(){let e=`undefined,再試行,解除をリクエスト,languages,21230xeqCSV,170853VOZgOi,카메라 촬영 시도가 탐지되어 화면을 보호합니다.,ロック解除,750034aYlHuy,2730TCevZo,현재 작업자가 자리를 비워 화면을 보호합니다.,131350vtwgnj,36uVZSNY,Submit,Retry,1727226MsWbKC,A filming attempt has been detected.
44
- MonitorDog is protecting your screen.,Cannot read camera,リモートでロックされました,Retrying...,709304zUvbCo,3647000gcPHdD,周囲の環境が明るすぎます。
45
- 直射光を避けるか、位置を調整してください。,잠금 해제 요청,52feCsxr,21nMpVeL,Webカメラが覆われたと検出されたため、画面を保護します。,주변 환경이 너무 밝습니다.
46
- 직사광선을 줄이거나 위치를 조정해 주세요.`.split(`,`);return Df=function(){return e},Df()}function Of(e,t){return e-=379,Df()[e]}(function(e,t){let n=Of,r=e();for(;;)try{if(parseInt(n(381))/1+parseInt(n(406))/2+-parseInt(n(403))/3*(-parseInt(n(394))/4)+-parseInt(n(391))/5+-parseInt(n(385))/6*(-parseInt(n(395))/7)+parseInt(n(390))/8*(-parseInt(n(382))/9)+parseInt(n(379))/10*(-parseInt(n(402))/11)===t)break;r.push(r.shift())}catch{r.push(r.shift())}})(Df,499401);var kf={en:{noFaceDetected:`We can't find you in your seat.
47
- MonitorDog is protecting your screen.`,twoFacesDetected:`Two people have been detected.
48
- MonitorDog is protecting your screen.`,mobileDevice:Ef(386),webcamBlocked:`The webcam appears to be covered.
49
- MonitorDog is protecting your screen.`,webcamTooDark:`Your surroundings are too dark.
50
- Please turn on a light or move to a brighter area.`,webcamTooBright:`Your surroundings are too bright.
51
- Please reduce direct light or adjust your position.`,cameraPermissionDenied:`Camera permission is required`,cameraReadableError:Ef(387),remoteAdminLocked:`Locked by administrator`,remoteLocked:`Locked remotely`,cameraRetryButton:Ef(384),cameraRetryingButton:Ef(389),remoteUnlockButton:`Unlock`,remoteUnlockingButton:`Unlocking...`,remoteUnlockRequestButton:`Request unlock`,remoteUnlockRequestingButton:`Requesting...`,noFacePasswordInputPlaceholder:`Password`,noFacePasswordSubmitButton:Ef(383),noFacePasswordSubmittingButton:`Submitting...`},ko:{webcamTooDark:`주변 환경이 너무 어둡습니다.
52
- 조명을 켜거나 더 밝은 환경으로 이동해 주세요.`,webcamTooBright:Ef(397),webcamBlocked:`웹캠이 가려진 것으로 감지되어 화면을 보호합니다.`,noFaceDetected:Ef(380),twoFacesDetected:`두 사람 이상의 화면 시청이 탐지되어 화면을 보호합니다.`,mobileDevice:Ef(404),cameraPermissionDenied:`카메라 권한이 필요합니다.`,cameraReadableError:`카메라를 사용할 수 없습니다.`,remoteAdminLocked:`관리자에 의해 잠겼습니다.`,remoteLocked:`원격으로 잠겼습니다.`,cameraRetryButton:`재시도`,cameraRetryingButton:`재시도 중...`,remoteUnlockButton:`잠금 해제`,remoteUnlockingButton:`해제 중...`,remoteUnlockRequestButton:Ef(393),remoteUnlockRequestingButton:`요청 중...`,noFacePasswordInputPlaceholder:`비밀번호`,noFacePasswordSubmitButton:`확인`,noFacePasswordSubmittingButton:`확인 중...`},ja:{webcamTooDark:`周囲の環境が暗すぎます。
53
- 照明をつけるか、明るい場所へ移動してください。`,webcamTooBright:Ef(392),webcamBlocked:Ef(396),noFaceDetected:`現在のユーザーが席を離れたため、画面を保護しています。`,twoFacesDetected:`2人以上の画面閲覧が検知されたため、画面を保護します。`,mobileDevice:`カメラ撮影試行が検出されたため、画面を保護します。`,cameraPermissionDenied:`カメラの権限が必要です`,cameraReadableError:`カメラを使用できません`,remoteAdminLocked:`管理者によりロックされました`,remoteLocked:Ef(388),cameraRetryButton:Ef(399),cameraRetryingButton:`再試行中...`,remoteUnlockButton:Ef(405),remoteUnlockingButton:`解除中...`,remoteUnlockRequestButton:Ef(400),remoteUnlockRequestingButton:`リクエスト中...`,noFacePasswordInputPlaceholder:`パスワード`,noFacePasswordSubmitButton:`確認`,noFacePasswordSubmittingButton:`確認中...`}};function Af(e){let t=Pf(e);return Nf(t)?t:`en`}function jf(e){return kf[e?Af(e):Mf()]}function Mf(){let e=Ef;if(typeof navigator===e(398))return`en`;let t=[...navigator[e(401)],navigator.language].filter(Boolean);for(let e of t){let t=Pf(e);if(Nf(t))return t}return`en`}function Nf(e){return e===`en`||e===`ko`||e===`ja`}function Pf(e){return e?.toLowerCase().split(/[-_]/)[0]}var X=Ff;function Ff(e,t){return e-=232,If()[e]}function If(){let e=[`button`,`unlockPageScroll`,`assign`,`submit`,`transparent`,`remoteUnlockRequestingButton`,`aria-pressed`,`textContent`,`zIndex`,`978131SbRYBy`,`24px`,`querySelector`,`remoteUnlockButtonClassName`,`getNoFacePasswordSubmitButtonText`,`messages`,`overlayOptions`,`applyCameraRetryButtonStyle`,`className`,`getOnRemoteUnlockRequest`,`overflow`,`pointerEvents`,`700`,`8px`,`getRemoteLockButtonText`,`replaceChildren`,`true`,`[data-monitordog-no-face-password-toggle]`,`pre-line`,`cameraRetryingButton`,`clearRemoteUnlockRequestCooldownTimer`,`Hide password`,`img`,`100%`,`updateRemoteUnlockRequestCooldownButton`,`noFacePasswordToggleButtonClassName`,`center`,`auto`,`blur(16px) saturate(150%)`,`padStart`,`focus`,`getRemoteUnlockRequestCooldownMs`,`createElement`,`toggleNoFacePasswordVisibility`,`form`,`click`,`syncNoFacePasswordInput`,`noFacePasswordSubmittingButton`,`hasInteractiveAction`,`applyNoFacePasswordInputStyle`,`languageMessages`,`addEventListener`,`setAttribute`,`85wZswBv`,`52453WTvJza`,`placeholder`,`state`,`noFacePasswordSubmitButtonText`,`dataset`,`getOverlayMessageElement`,`not-allowed`,`autocomplete`,`grid`,`previousBodyOverflow`,`syncActions`,`none`,`monitordogRemoteLockAction`,`applyPointerEvents`,`data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20stroke%3D%22black%22%20stroke-width%3D%222%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%3E%3Cpath%20d%3D%22M3%203l18%2018%22%2F%3E%3Cpath%20d%3D%22M10.6%2010.6a2%202%200%200%200%202.8%202.8%22%2F%3E%3Cpath%20d%3D%22M9.9%204.2A10.6%2010.6%200%200%201%2012%204c6.5%200%2010%208%2010%208a18.5%2018.5%200%200%201-4.1%205.1%22%2F%3E%3Cpath%20d%3D%22M6.1%206.1A18.5%2018.5%200%200%200%202%2012s3.5%208%2010%208c1.3%200%202.5-.3%203.5-.8%22%2F%3E%3C%2Fsvg%3E`,`startRemoteUnlockRequestCooldownTimer`,`getElementById`,`remoteUnlockRequestCooldownIntervalId`,`type`,`data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20stroke%3D%22black%22%20stroke-width%3D%222%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%3E%3Cpath%20d%3D%22M2%2012s3.5-7%2010-7%2010%207%2010%207-3.5%207-10%207-10-7-10-7Z%22%2F%3E%3Ccircle%20cx%3D%2212%22%20cy%3D%2212%22%20r%3D%223%22%2F%3E%3C%2Fsvg%3E`,`enabled`,`590307OBotIV`,`messageClassName`,`pointer`,`2147483647`,`36604sgJWtR`,`applyOverlayMessageStyle`,`getCameraRetryButtonText`,`getOverlayElement`,`#ffffff`,`lockPageScroll`,`flex`,`filter`,`firstElementChild`,`style`,`16px`,`getCameraRetryingButtonText`,`applyOverlayStyle`,`261390nUJjLU`,`display`,`getAttribute`,`remoteAdminLocked`,`hidden`,`updateNoFacePasswordToggleButton`,`options`,`cameraRetryButton`,`2261864OHySAZ`,`append`,`1.2`,`onNoFacePasswordSubmit`,`parentElement`,`getOverlayMessage`,`#0f172a`,`20px`,`disabled`,`remoteUnlockRequestButton`,`524916nvgNaL`];return If=function(){return e},If()}(function(e,t){let n=Ff,r=e();for(;;)try{if(parseInt(n(282))/1+parseInt(n(320))/2+-parseInt(n(303))/3+parseInt(n(307))/4*(-parseInt(n(281))/5)+-parseInt(n(338))/6+parseInt(n(238))/7+parseInt(n(328))/8===t)break;r.push(r.shift())}catch{r.push(r.shift())}})(If,165792);var Lf=X(301),Rf=X(296),zf=class{options;previousBodyOverflow;remoteUnlockRequestCooldownIntervalId;constructor(e){this.options=e}ensureIntegrity(e){let t=X;if(!this[t(244)]?.[t(302)])return;let n=this[t(310)](),r=this.getOverlayMessageElement(n),i=getComputedStyle(n);(i.display===`none`||i.visibility===`hidden`||i.opacity===`0`)&&(n.style[t(321)]=`flex`,n[t(316)].visibility=`visible`,n.style.opacity=`1`),i.position!==`fixed`&&(n[t(316)].position=`fixed`),i[t(237)]!==`2147483647`&&(n.style.zIndex=t(306));let a=this.options[t(333)](e);r.textContent!==a&&(r[t(236)]=a),this.syncActions(n,e),this[t(312)]()}render(e){let t=X,n=this.getOverlayElement(),r=this.getOverlayMessageElement(n);r[t(236)]=this.options.getOverlayMessage(e),this[t(292)](n,e),n[t(316)].display=`flex`,this[t(312)]()}hide(){let e=X;this.clearRemoteUnlockRequestCooldownTimer();let t=document[e(298)](this.rootId);t instanceof HTMLDivElement&&(t[e(316)].display=`none`,this.resetCameraRetryButton(t),this.resetRemoteLockButton(t),this.resetNoFacePasswordInput(t)),this[e(340)]()}stop(){this.clearRemoteUnlockRequestCooldownTimer()}get overlayOptions(){let e=X;return this[e(326)].getOverlayOptions()}get[X(278)](){return this.options.getLanguageMessages()}get rootId(){return this.overlayOptions?.rootId??`monitordog-overlay`}[X(292)](e,t){this.syncCameraRetryButton(e,t),this.syncRemoteLockButton(e,t),this.syncNoFacePasswordInput(e,t)}[X(312)](){let e=X;this.previousBodyOverflow===void 0&&(this.previousBodyOverflow=document.body.style[e(248)],document.body[e(316)].overflow=e(324))}unlockPageScroll(){let e=X;this.previousBodyOverflow!==void 0&&(document.body.style.overflow=this.previousBodyOverflow,this[e(291)]=void 0)}getOverlayElement(){let e=X,t=document.getElementById(this.rootId);if(t instanceof HTMLDivElement)return this.applyOverlayStyle(t),t;let n=document[e(270)](`div`),r=document.createElement(`div`);return n.id=this.rootId,n.className=this[e(244)]?.className??``,r.className=this.overlayOptions?.[e(304)]??``,n.append(r),this[e(319)](n),this[e(308)](r),document.body.append(n),n}applyOverlayStyle(e){let t=X;e.className=this.overlayOptions?.className??``,Object[t(341)](e.style,{position:`fixed`,inset:`0`,display:e.style[t(321)]===t(313)?`flex`:t(293),flexDirection:`column`,alignItems:`center`,justifyContent:`center`,background:`rgb(15 23 42 / 0.34)`,backdropFilter:t(266),color:`#ffffff`,zIndex:t(306),pointerEvents:this.options[t(276)](this.options.getCurrentJob()?.state)?`auto`:t(293),padding:`24px`,textAlign:`center`,...this.overlayOptions?.style})}[X(308)](e){let t=X;e.className=this.overlayOptions?.[t(304)]??``,Object[t(341)](e.style,{maxWidth:`720px`,borderRadius:`8px`,fontSize:t(239),fontWeight:`800`,lineHeight:`1.4`,padding:`24px 32px`,whiteSpace:t(256),...this.overlayOptions?.messageStyle})}[X(287)](e){let t=X,n=e[t(315)];if(n instanceof HTMLDivElement)return this.applyOverlayMessageStyle(n),n;let r=document[t(270)](`div`);return this[t(308)](r),e[t(253)](r),r}syncCameraRetryButton(e,t){let n=X,r=e.querySelector(`[data-monitordog-camera-retry]`);if(!this.options.isCameraOverlay(t[n(284)])){r?.remove(),this.applyPointerEvents(e,t.state);return}e.style.pointerEvents=`auto`;let i=r??document[n(270)](`button`);!r&&(i.type=`button`,i.dataset.monitordogCameraRetry=`true`,i.addEventListener(n(273),()=>{this.handleCameraRetry(i)}),e.append(i)),this[n(245)](i),!i[n(336)]&&(i.textContent=this[n(309)]())}async handleCameraRetry(e){let t=X,n=this.options.getOnCameraRetry();if(!(!n||e.disabled)){e[t(336)]=!0,e[t(236)]=this[t(318)]();try{await n()}catch{}finally{e.disabled=!1,e.textContent=this.getCameraRetryButtonText()}}}syncRemoteLockButton(e,t){let n=X,r=e.querySelector(`[data-monitordog-remote-lock-action]`);if(!this.options.isRemoteLockOverlay(t.state)){r?.remove(),this[n(295)](e,t.state);return}e[n(316)].pointerEvents=`auto`;let i=r??document.createElement(`button`);if(!r&&(i.type=n(339),i[n(286)][n(294)]=n(254),i.addEventListener(`click`,()=>{this.handleRemoteLockAction(i)}),e.append(i)),this.applyRemoteLockButtonStyle(i),t[n(284)]===`remoteAdminLocked`){this[n(262)](i),this[n(297)](i);return}this[n(258)](),!i[n(336)]&&(i.textContent=this[n(252)](t[n(284)]))}async handleRemoteLockAction(e){let t=X,n=this.options.getCurrentJob();if(!n||e.disabled)return;let r=n.state;if(!this.options.isRemoteLockOverlay(r))return;if(r===`remoteAdminLocked`&&this[t(326)][t(269)]()>0){this.updateRemoteUnlockRequestCooldownButton(e),this.startRemoteUnlockRequestCooldownTimer(e);return}let i=r===`remoteLocked`?this.options.getOnRemoteUnlock():this.options[t(247)]();if(i){e.disabled=!0,e.textContent=this.getRemoteLockBusyButtonText(r);try{await i()}catch(e){this.options.getOnError()?.(e)}finally{e.disabled=!1,this.options.getCurrentJob()?.[t(284)]===r&&(r===`remoteAdminLocked`?(this.updateRemoteUnlockRequestCooldownButton(e),this.startRemoteUnlockRequestCooldownTimer(e)):e.textContent=this.getRemoteLockButtonText(r))}}}resetCameraRetryButton(e){let t=X,n=e[t(240)](`[data-monitordog-camera-retry]`);n&&(n.disabled=!1,n.textContent=this[t(309)]())}resetRemoteLockButton(e){let t=X,n=e.querySelector(`[data-monitordog-remote-lock-action]`);if(!n)return;this.clearRemoteUnlockRequestCooldownTimer(),n.disabled=!1;let r=this[t(326)].getCurrentJob();r&&(n[t(236)]=this.getRemoteLockButtonText(r[t(284)]))}[X(274)](e,t){let n=X,r=e[n(240)](`[data-monitordog-no-face-password-form]`);if(!this.options.shouldShowNoFacePasswordInput(t)){r?.remove(),this[n(295)](e,t.state);return}e.style[n(249)]=`auto`;let i=r??document[n(270)](n(272)),a=i.querySelector(`[data-monitordog-no-face-password-input-wrapper]`),o=i[n(240)](`[data-monitordog-no-face-password]`),s=i.querySelector(n(255)),c=i[n(240)](`[data-monitordog-no-face-password-submit]`);!r&&(i.dataset.monitordogNoFacePasswordForm=n(254),i.addEventListener(n(232),e=>{e.preventDefault(),this.handleNoFacePasswordSubmit(i)}),e.append(i)),!a&&(a=document[n(270)](`div`),a.dataset.monitordogNoFacePasswordInputWrapper=n(254),i.prepend(a)),!o&&(o=document.createElement(`input`),o.type=`password`,o[n(289)]=`current-password`,o.dataset.monitordogNoFacePassword=`true`,o[n(280)](`aria-label`,`Password`)),o[n(332)]!==a&&a.append(o),!s&&(s=document.createElement(`button`),s[n(300)]=n(339),s.dataset.monitordogNoFacePasswordToggle=n(254),s[n(279)](`click`,()=>{let e=n;this[e(271)](i)})),s.parentElement!==a&&a.append(s),!c&&(c=document.createElement(n(339)),c[n(300)]=n(232),c.dataset.monitordogNoFacePasswordSubmit=n(254),i[n(329)](c)),o[n(283)]=this.overlayOptions?.noFacePasswordInputPlaceholder??this.overlayOptions?.messages?.noFacePasswordInputPlaceholder??this.languageMessages.noFacePasswordInputPlaceholder,this[n(325)](s,o),c[n(236)]=this.getNoFacePasswordSubmitButtonText(),this.applyNoFacePasswordFormStyle(i),this.applyNoFacePasswordInputWrapperStyle(a),this[n(277)](o),this.applyNoFacePasswordToggleButtonStyle(s),this.applyNoFacePasswordSubmitButtonStyle(c)}resetNoFacePasswordInput(e){let t=X,n=e[t(240)](`[data-monitordog-no-face-password]`),r=e.querySelector(`[data-monitordog-no-face-password-toggle]`);n&&(n.value=``,n[t(300)]=`password`,r&&this.updateNoFacePasswordToggleButton(r,n))}toggleNoFacePasswordVisibility(e){let t=X,n=e.querySelector(`[data-monitordog-no-face-password]`),r=e[t(240)](`[data-monitordog-no-face-password-toggle]`);!n||!r||(n[t(300)]=n.type===`password`?`text`:`password`,this.updateNoFacePasswordToggleButton(r,n),n[t(268)]())}updateNoFacePasswordToggleButton(e,t){let n=X,r=t.type===`text`,i=r?this.getNoFacePasswordCloseIconSrc():this.getNoFacePasswordOpenIconSrc(),a=document.createElement(n(260)),o=e.querySelector(`img`),s=r?n(259):`Show password`,c=String(r),l=r?`none`:`invert(1)`;if(o&&o[n(322)](`src`)===i&&e.getAttribute(`aria-label`)===s&&e.getAttribute(n(235))===c){o[n(316)][n(314)]!==l&&(o.style.filter=l);return}a.src=i,a.alt=``,a[n(280)](`aria-hidden`,`true`),Object[n(341)](a[n(316)],{display:`block`,filter:l,width:`20px`,height:n(335),pointerEvents:`none`}),e.replaceChildren(a),e.setAttribute(`aria-label`,s),e.setAttribute(`aria-pressed`,c)}async handleNoFacePasswordSubmit(e){let t=X,n=e[t(240)](`[data-monitordog-no-face-password]`),r=e.querySelector(`[data-monitordog-no-face-password-submit]`);if(!n)return;let i=n.value;if(!i||r?.disabled){n[t(268)]();return}r&&(r.disabled=!0,r[t(236)]=this.getNoFacePasswordSubmittingButtonText(),this.applyNoFacePasswordSubmitButtonStyle(r));try{if(await this.options[t(331)](i)){n.value=``;return}n.value=``,n[t(268)]()}catch(e){this.options.getOnError()?.(e),n.value=``,n.focus()}finally{r&&(r[t(336)]=!1,r.textContent=this.getNoFacePasswordSubmitButtonText(),this.applyNoFacePasswordSubmitButtonStyle(r))}}applyCameraRetryButtonStyle(e){let t=X;e.className=this.overlayOptions?.cameraRetryButtonClassName??``,Object.assign(e[t(316)],{border:`0`,borderRadius:t(251),background:t(311),color:`#0f172a`,cursor:t(305),fontSize:t(317),fontWeight:t(250),lineHeight:t(330),marginTop:`12px`,padding:`12px 18px`,pointerEvents:t(265),...this.overlayOptions?.cameraRetryButtonStyle})}applyRemoteLockButtonStyle(e){let t=X;e.className=this.overlayOptions?.[t(241)]??``,Object.assign(e.style,{border:`0`,borderRadius:`8px`,background:`#ffffff`,color:`#0f172a`,cursor:t(305),fontSize:t(317),fontWeight:`700`,lineHeight:`1.2`,marginTop:`12px`,padding:`12px 18px`,pointerEvents:`auto`,...this.overlayOptions?.remoteUnlockButtonStyle})}applyNoFacePasswordInputStyle(e){let t=X;e[t(246)]=this[t(244)]?.noFacePasswordInputClassName??``,Object.assign(e.style,{width:`min(100%, 320px)`,border:`1px solid rgb(255 255 255 / 0.7)`,borderRadius:t(251),background:`#ffffff`,color:t(334),fontSize:`16px`,lineHeight:`1.2`,margin:`0`,padding:`12px 46px 12px 14px`,pointerEvents:t(265),...this[t(244)]?.noFacePasswordInputStyle})}applyNoFacePasswordInputWrapperStyle(e){Object.assign(e.style,{position:`relative`,width:`min(100%, 320px)`})}applyNoFacePasswordFormStyle(e){let t=X;e[t(246)]=this.overlayOptions?.noFacePasswordFormClassName??``,Object[t(341)](e.style,{display:`flex`,flexWrap:`wrap`,justifyContent:t(264),gap:t(251),marginTop:`12px`,pointerEvents:t(265),...this.overlayOptions?.noFacePasswordFormStyle})}applyNoFacePasswordSubmitButtonStyle(e){let t=X;e.className=this.overlayOptions?.noFacePasswordSubmitButtonClassName??``,Object[t(341)](e.style,{border:`0`,borderRadius:`8px`,background:t(311),color:`#0f172a`,cursor:e.disabled?`not-allowed`:`pointer`,fontSize:t(317),fontWeight:t(250),lineHeight:t(330),padding:`12px 18px`,pointerEvents:`auto`,...this[t(244)]?.noFacePasswordSubmitButtonStyle})}applyNoFacePasswordToggleButtonStyle(e){let t=X;e.className=this.overlayOptions?.[t(263)]??``,Object[t(341)](e[t(316)],{border:`0`,borderRadius:`0`,background:t(233),color:`#0f172a`,cursor:`pointer`,display:t(290),height:t(261),placeItems:`center`,padding:`0`,pointerEvents:`auto`,position:`absolute`,right:`0`,top:`0`,width:`44px`,...this.overlayOptions?.noFacePasswordToggleButtonStyle})}updateRemoteUnlockRequestCooldownButton(e){let t=X,n=this.options[t(269)]();if(n<=0){e[t(336)]=!1,e.textContent=this.getRemoteLockButtonText(`remoteAdminLocked`),this.applyRemoteLockButtonEnabledState(e),this.clearRemoteUnlockRequestCooldownTimer();return}e.disabled=!0,e.textContent=this[t(252)](`remoteAdminLocked`)+` (`+Bf(n)+`)`,this.applyRemoteLockButtonDisabledState(e)}startRemoteUnlockRequestCooldownTimer(e){let t=X;this[t(299)]||this.options[t(269)]()<=0||(this.remoteUnlockRequestCooldownIntervalId=setInterval(()=>{let n=t;this.options.getCurrentJob?.()?.[n(284)]===`remoteAdminLocked`?this.updateRemoteUnlockRequestCooldownButton(e):this[n(258)]()},1e3))}[X(258)](){let e=X;this.remoteUnlockRequestCooldownIntervalId&&=(clearInterval(this[e(299)]),void 0)}applyRemoteLockButtonEnabledState(e){let t=X;Object[t(341)](e.style,{cursor:`pointer`,opacity:`1`,pointerEvents:t(265)})}applyRemoteLockButtonDisabledState(e){let t=X;Object.assign(e.style,{cursor:t(288),opacity:`0.58`,pointerEvents:t(265)})}applyPointerEvents(e,t){e.style.pointerEvents=this.options.hasInteractiveAction(t)?`auto`:`none`}getCameraRetryButtonText(){let e=X;return this.overlayOptions?.cameraRetryButtonText??this.overlayOptions?.messages?.cameraRetryButton??this.languageMessages[e(327)]}getCameraRetryingButtonText(){let e=X;return this.overlayOptions?.cameraRetryingButtonText??this.overlayOptions?.messages?.[e(257)]??this.languageMessages.cameraRetryingButton}getRemoteLockButtonText(e){let t=X;return e===t(323)?this[t(244)]?.remoteUnlockRequestButtonText??this.overlayOptions?.[t(243)]?.[t(337)]??this.languageMessages.remoteUnlockRequestButton:this.overlayOptions?.remoteUnlockButtonText??this[t(244)]?.messages?.remoteUnlockButton??this[t(278)].remoteUnlockButton}getRemoteLockBusyButtonText(e){let t=X;return e===`remoteAdminLocked`?this.overlayOptions?.remoteUnlockRequestingButtonText??this[t(244)]?.messages?.[t(234)]??this.languageMessages.remoteUnlockRequestingButton:this[t(244)]?.remoteUnlockingButtonText??this[t(244)]?.messages?.remoteUnlockingButton??this.languageMessages.remoteUnlockingButton}[X(242)](){let e=X;return this[e(244)]?.[e(285)]??this.overlayOptions?.[e(243)]?.noFacePasswordSubmitButton??this.languageMessages.noFacePasswordSubmitButton}getNoFacePasswordSubmittingButtonText(){let e=X;return this.overlayOptions?.noFacePasswordSubmittingButtonText??this.overlayOptions?.messages?.[e(275)]??this.languageMessages[e(275)]}getNoFacePasswordOpenIconSrc(){return this.overlayOptions?.noFacePasswordOpenIconSrc??Lf}getNoFacePasswordCloseIconSrc(){return this.overlayOptions?.noFacePasswordCloseIconSrc??Rf}};function Bf(e){let t=X,n=Math.ceil(e/1e3),r=Math.floor(n/60),i=n%60;return r<=0?`00:`+i.toString()[t(267)](2,`0`):i===0?r.toString()[t(267)](2,`0`)+`:00`:r.toString().padStart(2,`0`)+`:`+i.toString().padStart(2,`0`)}var Vf=Hf;(function(e,t){let n=Hf,r=e();for(;;)try{if(parseInt(n(166))/1+parseInt(n(167))/2+-parseInt(n(173))/3+parseInt(n(174))/4+-parseInt(n(165))/5*(-parseInt(n(175))/6)+parseInt(n(172))/7*(parseInt(n(171))/8)+-parseInt(n(169))/9===t)break;r.push(r.shift())}catch{r.push(r.shift())}})(Uf,472815);function Hf(e,t){return e-=165,Uf()[e]}function Uf(){let e=[`intervalId`,`8349345kZSlyG`,`options`,`442232cOpXRX`,`14XWEeUK`,`381828wCwfad`,`830504HZPIPH`,`1707096Uxsurk`,`5RysQNQ`,`839137ascKwJ`,`171918TNKWUr`];return Uf=function(){return e},Uf()}var Wf=class{[Vf(170)];intervalId;constructor(e){this.options=e}start(){let e=Vf,t=this[e(170)].getOverlayOptions();t?.enabled===!1||t?.watchdog===!1||this.intervalId||(this[e(168)]=setInterval(()=>this.options.ensureIntegrity(),t?.watchdogIntervalMs??500))}stop(){let e=Vf;this.intervalId&&(clearInterval(this.intervalId),this[e(168)]=void 0)}},Z=Gf;(function(e,t){let n=Gf,r=e();for(;;)try{if(parseInt(n(218))/1*(parseInt(n(249))/2)+parseInt(n(242))/3*(parseInt(n(229))/4)+parseInt(n(276))/5*(parseInt(n(216))/6)+parseInt(n(248))/7+parseInt(n(243))/8*(parseInt(n(236))/9)+-parseInt(n(262))/10+-parseInt(n(239))/11===t)break;r.push(r.shift())}catch{r.push(r.shift())}})(qf,481918);function Gf(e,t){return e-=214,qf()[e]}var Kf=class{services;[Z(251)]=[];activeJobs=new Map;jobTimeoutIds=new Map;renderer;watchdog;currentJob;constructor(e){let t=Z;this.services=e,this.renderer=new zf({getOverlayOptions:()=>this.overlayOptions,getCurrentJob:()=>this[t(265)],getOverlayMessage:e=>this.getOverlayMessage(e),getLanguageMessages:()=>this.getLanguageMessages(),hasInteractiveAction:e=>this.hasInteractiveAction(e),isCameraOverlay:e=>this.isCameraOverlay(e),isRemoteLockOverlay:e=>this.isRemoteLockOverlay(e),shouldShowNoFacePasswordInput:e=>this.shouldShowNoFacePasswordInput(e),getOnCameraRetry:()=>this.services.onCameraRetry,getOnRemoteUnlock:()=>this[t(253)].onRemoteUnlock,getOnRemoteUnlockRequest:()=>this.services[t(241)],getRemoteUnlockRequestCooldownMs:()=>this.services.getRemoteUnlockRequestCooldownMs?.()??0,onNoFacePasswordSubmit:e=>this.handleNoFacePasswordSubmit(e),getOnError:()=>this[t(253)].options.onError}),this.watchdog=new Wf({getOverlayOptions:()=>this.overlayOptions,ensureIntegrity:()=>this[t(258)]()})}get isDebug(){return!!this.services.options.debug}get overlayOptions(){let e=Z;return this[e(253)].options[e(231)]}show(e){let t=Z;this[t(256)]({action:`show`,id:e,state:e,source:this[t(254)](e)})}hide(){let e=Z;this.enqueue({action:e(273)})}[Z(219)](e){let t=Z;this.currentJob&&this.setJobDuration(this[t(265)].id,e)}clearLock(){let e=Z;this.currentJob&&this[e(233)](this.currentJob.id)}isLocked(){let e=Z;return!!(this.currentJob&&this.jobTimeoutIds[e(232)](this.currentJob.id))}isShowing(){return this.currentJob!==void 0}isShowingDetectionBlocker(){return this.currentJob!==void 0}[Z(225)](e){let t=Z;for(let n of this.activeJobs[t(259)]())if(n.source===e)return!0;return!1}hasActiveState(e){let t=Z;for(let n of this[t(263)].values())if(n.state===e)return!0;return!1}hasActiveResumePasswordLock(){let e=Z;for(let t of this.activeJobs.values())if(t[e(224)])return!0;return!1}enqueue(e){let t=Z;this.queue[t(266)](e),this.processQueue()}showJob(e){let t=Z;this.enqueue({...e,action:t(255)})}clearJob(e){this.enqueue({action:`clear`,id:e})}clearSource(e){let t=Z;this[t(256)]({action:t(273),source:e})}stopWatchdog(){let e=Z;this[e(261)].stop(),this[e(223)].stop()}startWatchdog(){let e=Z;this[e(261)][e(240)]()}ensureIntegrity(){let e=Z;!this.currentJob||!this.overlayOptions?.enabled||this.renderer[e(258)](this.currentJob)}processQueue(){let e=Z;for(;this.queue[e(244)]>0;){let t=this.queue.shift();t&&(t.action===`show`?(this[e(263)].set(t.id,{id:t.id,state:t.state,source:t.source,text:t.text,priority:t.priority??this[e(235)](t.state),requiresPasswordInput:this.shouldRequirePasswordInput(t[e(257)])}),this.setJobDuration(t.id,t.durationMs)):this.clearJobs(t))}this[e(260)]()}clearJobs(e){let t=Z;if(!e.id&&!e.source){for(let e of this.activeJobs.keys())this.clearJobDuration(e);this.activeJobs.clear();return}if(e.id&&(this.clearJobDuration(e.id),this.activeJobs.delete(e.id)),e[t(226)])for(let n of this[t(263)].values())n.source===e.source&&(this[t(233)](n.id),this[t(263)].delete(n.id))}syncActiveOverlay(){let e=Z;if(this[e(265)]=this.getNextActiveJob(),!this[e(265)]||this[e(252)]||!this[e(237)]?.[e(271)]){this[e(250)]();return}this.renderer.render(this.currentJob),this.startWatchdog()}[Z(250)](){let e=Z;this[e(268)](),this.renderer.hide()}getNextActiveJob(){let e=Z;return[...this.activeJobs[e(259)]()][e(238)]((t,n)=>{let r=e;return n[r(269)]===t.priority?t.id.localeCompare(n.id):n[r(269)]-t.priority})[0]}setJobDuration(e,t){this.clearJobDuration(e),!(t===void 0||t<=0)&&this.jobTimeoutIds.set(e,setTimeout(()=>{let t=Gf;this[t(275)].delete(e),this.activeJobs.delete(e),this[t(260)]()},t))}clearJobDuration(e){let t=Z,n=this[t(275)][t(272)](e);n&&(clearTimeout(n),this[t(275)][t(245)](e))}getOverlayMessage(e){let t=Z;if(e.text)return e[t(215)];if(this[t(274)](e.state))return this.overlayOptions?.messages?.[e.state]??this.getLanguageMessages()[e.state];switch(e.state){case t(217):return`MonitorDog detection ran out of memory.
54
- Please close unused tabs or apps to free memory. Detection is restarting automatically.`;case`remoteAdminLocked`:return this[t(237)]?.messages?.remoteAdminLocked??this.getLanguageMessages().remoteAdminLocked;case`remoteLocked`:return this.overlayOptions?.messages?.remoteLocked??this.getLanguageMessages().remoteLocked}}getLanguageMessages(){let e=Z;return jf(this.overlayOptions?.[e(228)])}[Z(254)](e){let t=Z;return this.isCameraOverlay(e)?`camera`:e===`remoteAdminLocked`||e===t(264)?t(221):`detection`}getDefaultPriority(e){let t=Z;switch(e){case t(230):return 300;case`remoteLocked`:return 250;case`cameraPermissionDenied`:case t(246):return 200;case t(267):case t(234):return 180;default:return 100}}async handleNoFacePasswordSubmit(e){let t=Z,n=await this[t(253)][t(222)].authorizedFetch(`/account/me/password/verify_resume`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({password:e})});if(!n.ok)throw Error(`MonitorDog resume password verification failed: `+n.status);let r=await n[t(214)]();return r&&(this.services.detectionEvents.resetAfterResumePasswordUnlock(),this[t(227)](t(247)),this.services.webcam.syncPauseState()),r}isCameraOverlay(e){return e===`cameraPermissionDenied`||e===Z(246)}isRemoteLockOverlay(e){return e===`remoteAdminLocked`||e===`remoteLocked`}[Z(277)](e){return e===`noFaceDetected`&&this.services.options.requiredPassword}shouldShowNoFacePasswordInput(e){return e[Z(224)]}hasInteractiveAction(e){let t=Z;return this.isCameraOverlay(e)||this.isRemoteLockOverlay(e)||this[t(265)]!==void 0&&this.currentJob[t(257)]===e&&this[t(265)][t(224)]}[Z(274)](e){let t=Z;return e===t(220)||e===`twoFacesDetected`||e===`mobileDevice`||e===`webcamBlocked`||e===t(267)||e===t(234)||e===t(270)||e===t(246)}};function qf(){let e=`getDefaultPriority.117vgWGxW.overlayOptions.sort.8719062XltRWf.start.onRemoteUnlockRequest.51798dhfPZk.196184krSYpN.length.delete.cameraReadableError.detection.4949903nfDPMU.2fCgNJy.renderHidden.queue.isDebug.services.getDefaultSource.show.enqueue.state.ensureIntegrity.values.syncActiveOverlay.watchdog.8754700Jzcejq.activeJobs.remoteLocked.currentJob.push.webcamTooDark.stopWatchdog.priority.cameraPermissionDenied.enabled.get.clear.isMonitorDogOverlayType.jobTimeoutIds.435ZJiHQM.shouldRequirePasswordInput.json.text.20346MRLswc.inferenceMemoryError.86647HxipHs.lock.noFaceDetected.remote.auth.renderer.requiresPasswordInput.hasActiveSource.source.clearSource.locale.172rOGMoS.remoteAdminLocked.overlay.has.clearJobDuration.webcamTooBright`.split(`.`);return qf=function(){return e},qf()}var Q=Yf;function Jf(){let e=`showJob.overlay.shouldPauseDetection.options.services.1027725QtsLFI.finally.handleCameraDisconnect.clearSource.startPromise.9312600JSjsXp.3217818iCbbkk.isWebcamRunning.ensureStarted.camera.3266904zRvPuu.detectionEvents.737620cDVNlW.21gLhYRf.addVisibilityListener.stopCurrentWebcam.cameraReadableError.shouldRun.isRunning.SecurityError.stopWebcam.1086418KvNcqN.camera:readable.syncPauseState.start.775135cdXXkg.handleVisibilityChange`.split(`.`);return Jf=function(){return e},Jf()}function Yf(e,t){return e-=415,Jf()[e]}(function(e,t){let n=Yf,r=e();for(;;)try{if(-parseInt(n(442))/1+-parseInt(n(431))/2+-parseInt(n(420))/3+parseInt(n(422))/4+parseInt(n(435))/5+-parseInt(n(416))/6+parseInt(n(423))/7*(parseInt(n(415))/8)===t)break;r.push(r.shift())}catch{r.push(r.shift())}})(Jf,635452);var Xf=class{[Q(441)];[Q(417)]=!1;stopCurrentWebcam;startPromise;shouldRun=!1;resumeWhenUnpaused=!1;handleVisibilityChange=()=>{let e=Q;this[e(433)]()};constructor(e){let t=Q;this.services=e,this[t(441)].onCameraDisconnect=()=>this.handleCameraDisconnect()}get[Q(428)](){let e=Q;return this[e(417)]}get isStarting(){return!!this.startPromise}async[Q(434)](){let e=Q;if(this[e(441)].auth.assertAuthenticated(),this.shouldRun=!0,this[e(424)](),!this.isWebcamRunning){if(this[e(441)][e(439)]){this.resumeWhenUnpaused=!0;return}await this[e(418)]()}}stop(){let e=Q;this.shouldRun=!1,this.resumeWhenUnpaused=!1,this.removeVisibilityListener(),this.services[e(421)].reset(),this.services.overlay.hide(),this.stopWebcam()}async retryConnection(){if(this.isWebcamRunning){this.services.overlay.clearSource(`camera`);return}await this.start()}async syncPauseState(){let e=Q;if(this[e(427)]){if(this[e(441)].shouldPauseDetection){this.isWebcamRunning&&(this.resumeWhenUnpaused=!0,this.stopWebcam());return}if(this.resumeWhenUnpaused&&!this.isWebcamRunning){this.resumeWhenUnpaused=!1;try{await this.ensureStarted()}catch{this.shouldRun=!1}}}}syncBackgroundPreference(){let e=Q;this.services[e(440)].runInBackground?this.removeVisibilityListener():this.shouldRun&&this.addVisibilityListener(),this.syncPauseState()}async ensureStarted(){let e=Q;this[e(417)]||(!this[e(446)]&&(this.startPromise=this.startWebcam()[e(443)](()=>{this.startPromise=void 0})),await this.startPromise)}async startWebcam(){let e=Q;try{let t=await this[e(441)].detect.startWebcamDetection();if(!this.shouldRun){t.stop();return}this[e(417)]=!0,this[e(425)]=t.stop,this.services.overlay[e(445)](e(419))}catch(t){throw this.isCameraPermissionError(t)&&this.services.overlay.showJob({id:`camera:permission`,state:`cameraPermissionDenied`,source:`camera`}),this.isCameraReadError(t)&&this.services[e(438)][e(437)]({id:e(432),state:e(426),source:e(419)}),this.services[e(440)].onError?.(t),t}}stopWebcam(){let e=Q;this.stopCurrentWebcam?.(),this[e(425)]=void 0,this.isWebcamRunning=!1}async[Q(444)](){let e=Q;if(this.isWebcamRunning&&(this[e(430)](),this.shouldRun)){if(this[e(441)][e(439)]){this.resumeWhenUnpaused=!0;return}try{await this.ensureStarted()}catch(t){this.services.overlay.showJob({id:`camera:readable`,state:`cameraReadableError`,source:e(419)}),this.services[e(440)].onError?.(t)}}}addVisibilityListener(){let e=Q;this.services.options.runInBackground||typeof document>`u`||document.addEventListener(`visibilitychange`,this[e(436)])}removeVisibilityListener(){let e=Q;typeof document>`u`||document.removeEventListener(`visibilitychange`,this[e(436)])}isCameraPermissionError(e){let t=Q;return e instanceof DOMException&&(e.name===`NotAllowedError`||e.name===t(429))}isCameraReadError(e){return e instanceof DOMException&&e.name===`NotReadableError`}},Zf=$f;(function(e,t){let n=$f,r=e();for(;;)try{if(parseInt(n(448))/1*(parseInt(n(454))/2)+-parseInt(n(445))/3+parseInt(n(442))/4*(parseInt(n(452))/5)+parseInt(n(451))/6*(-parseInt(n(459))/7)+-parseInt(n(466))/8+parseInt(n(462))/9+parseInt(n(465))/10*(parseInt(n(443))/11)===t)break;r.push(r.shift())}catch{r.push(r.shift())}})(Qf,450113);function Qf(){let e=[`mobileDetectionMode`,`shouldPauseDetection`,`144639rXVwQn`,`overlay`,`freeze`,`2490276BqdoWZ`,`5orkxxt`,`mobileDetectionThreshold`,`2LoYwdE`,`undefined`,`auth`,`onCameraRetry`,`shouldPauseForResumePassword`,`7tOzOoB`,`inputSize`,`detect`,`4455180qpRsvQ`,`noFaceEventDelayMs`,`onRemoteUnlock`,`202810WItDOt`,`2181136JwMcZH`,`2951456VOJRhU`,`319jxqjHu`,`updateNoFaceEventDelayFromServer`,`2483613fsYTIO`];return Qf=function(){return e},Qf()}function $f(e,t){return e-=442,Qf()[e]}var ep=class{[Zf(456)];overlay;camera;detectionEvents;detect;webcam;[Zf(457)];onCameraDisconnect;[Zf(464)];onRemoteUnlockRequest;getRemoteUnlockRequestCooldownMs;onShutdownRequest;onLoginRequired;#e=0;#t=tp();#n;constructor(e){let t=Zf;this.#n=e,this.camera=new We,this.auth=new Le(this),this[t(449)]=new Kf(this),this.detectionEvents=new Xe(this),this[t(461)]=new vf(this),this.webcam=new Xf(this)}get options(){return Object[Zf(450)]({...this.#n()})}get[Zf(463)](){return this.#e}get userPreferences(){return Object.freeze({...this.#t})}[Zf(444)](e){this.#e=e}updateRequiredPasswordFromServer(e){this.#n().requiredPassword=e}degradeInferenceModelForMemoryPressure(){let e=Zf,t=this.#n();if(t.inputSize>416){t.inputSize=416;return}t.inputSize>320&&(t[e(460)]=320)}get shouldPauseForHiddenPage(){let e=Zf;return!this.options.runInBackground&&typeof document!==e(455)&&document.hidden}get[Zf(447)](){let e=Zf;return this.shouldPauseForHiddenPage||this[e(458)]}get[Zf(458)](){return this.overlay.hasActiveResumePasswordLock()}applyPolicyItems(e,t){let n={...this.#t};for(let t of e)rp(n,t);this.#t=n,this.#n().confidenceThreshold=n.mobileDetectionThreshold,this.#n().faceConfidenceThreshold=n.faceDetectionThreshold,this.updateRequiredPasswordFromServer(!1)}resetAuthenticatedState(){this.#e=0,this.#t=tp(),this.#n().requiredPassword=!1,this.#n().confidenceThreshold=this.#t.mobileDetectionThreshold,this.#n().faceConfidenceThreshold=this.#t.faceDetectionThreshold}};function tp(){return{mobileDetectionThreshold:.8,faceDetectionThreshold:.8,headTurningThreshold:.8,language:`en`,mobileDetectionEnabled:!0,noPersonDetectionEnabled:!0,multiPersonDetectionEnabled:!0,noPersonLockDuration:0,multiPersonLockDuration:0,mobileDetectionLockDuration:0,mobileDetectionMode:`auto_lock`,noPersonDetectionMode:`auto_lock`,multiPersonDetectionMode:`auto_lock`,webcamBlockageDetectionEnabled:!0,webcamBlockageLockDuration:0,webcamBlockageDetectionMode:`auto_lock`}}function np(e){return e===`none`}function rp(e,t){let n=Zf,r=t.policy,i=!np(t.policy),a=t.seconds*1e3,o=`sensitivity`in t?1-t.sensitivity/100:void 0;switch(t.basic_event_uuid){case Ne(`mobileDevice`):e.mobileDetectionEnabled=i,e.mobileDetectionLockDuration=a,e[n(446)]=r,o!==void 0&&(e[n(453)]=o);break;case Ne(`twoFacesDetected`):e.multiPersonDetectionEnabled=i,e.multiPersonLockDuration=a,e.multiPersonDetectionMode=r,o!==void 0&&(e.faceDetectionThreshold=o);break;case Ne(`noFaceDetected`):e.noPersonDetectionEnabled=i,e.noPersonLockDuration=a,e.noPersonDetectionMode=r;break;case Ne(`webcamBlocked`):e.webcamBlockageDetectionEnabled=i,e.webcamBlockageLockDuration=a,e.webcamBlockageDetectionMode=r;break;default:break}}var $=ip;(function(e,t){let n=ip,r=e();for(;;)try{if(parseInt(n(392))/1*(parseInt(n(372))/2)+-parseInt(n(396))/3*(parseInt(n(408))/4)+parseInt(n(422))/5*(-parseInt(n(365))/6)+parseInt(n(423))/7+parseInt(n(425))/8*(-parseInt(n(371))/9)+parseInt(n(404))/10+parseInt(n(405))/11*(-parseInt(n(383))/12)===t)break;r.push(r.shift())}catch{r.push(r.shift())}})(ap,292977);function ip(e,t){return e-=356,ap()[e]}function ap(){let e=`notifyStatusChange,shouldPauseDetection,stopLocalRuntime,idle,error,resetLoggedOutState,hasRuntimeToStop,DETECTOR_RUNNING,undefined,21612OAwWld,loading,assertAuthenticated,setMainUserTrackingEnabled,CAMERA_PERMISSION_DENIED,retryConnection,9bHpaQI,10edXEOp,MonitorDog onDetect callback is required.,lifecycleError,camera,completeAuthenticatedLogin,isCameraReadError,isAuthenticated,function,resetAuthenticatedState,name,json,252horBZg,stop,isDetectorRunning,detect,transitionToError,starting,uuid,requesting,NOT_LOGGED_IN,93039UPdwlo,MODEL_LOAD_FAILED,onCameraRetry,getStartErrorCode,39tsyeVk,MonitorDog detector runtime failed to start.,running,authorizedFetch,MonitorDog camera permission was denied.,anonymous,MonitorDog logout failed.,webcam,1479260DxWEPt,85294VnpbwX,string,auth,60132yTgPGi,onError,sessionTokenProvider,MonitorDog account request failed: ,onAuthError,updateState,assertUsable,syncBackgroundPreference,status,MonitorDog lock policy request failed: ,apiBaseUrl,active,getUserPreferences,session,5JOWiBp,1427286muRjnA,getState,1297416UbvkIo,runtime,start,load`.split(`,`);return ap=function(){return e},ap()}var op=class e{#e;#t;#n=`anonymous`;#r=`idle`;#i=`idle`;#a;#o;static async init(t){return cp=new e(t),cp}constructor(e){let t=ip;pp(e);let n=fp();this.#t={...e,apiBaseUrl:fe(e.apiBaseUrl),confidenceThreshold:d,faceConfidenceThreshold:d,iouThreshold:ee,maxDetections:100,inputSize:n?416:640,inputType:`float32`,detectionIntervalMs:e.detectionIntervalMs??300,requiredPassword:!1},this.#e=new ep(()=>this.#t),this.#e[t(394)]=()=>this.#e.webcam[t(370)](),this.#e.onShutdownRequest=()=>this[t(384)](),this.#e.onLoginRequired=()=>this.resetLoggedOutState(),Object.freeze(this)}async load(){let e=ip;this.assertUsable(),this.assertAuthenticated(`loading detection`);try{this.updateState({runtime:`loading`,lastError:void 0}),await this.#e.detect[e(428)](),this[e(413)]({runtime:`idle`,lastError:void 0})}catch(t){let n=this.createSdkError(e(393),`MonitorDog detection model failed to load.`,t);throw this.transitionToError(n),this.#t.onError?.(n),n}}async login(e){let t=ip;this.assertUsable();let n;try{n=await this.#e.auth.login(e)}catch(e){let t=this.createSdkError(`SESSION_TOKEN_FAILED`,`MonitorDog SDK session token could not be created.`,e);throw this.transitionToError(t),this.#t.onAuthError?.(t),t}try{await this[t(376)]()}catch(e){let n=this.createSdkError(`ACCOUNT_POLICY_FAILED`,`MonitorDog account or policy could not be loaded.`,e);throw this.rollbackAuthenticatedLogin(),this[t(387)](n),this.#t[t(412)]?.(n),n}return this.updateState({session:`authenticated`,runtime:this.#r===`stopped`?`stopped`:`idle`,camera:this.#e.webcam.isRunning?`active`:`idle`,lastError:void 0}),n}async completeAuthenticatedLogin(){let e=ip,t=await this.#e.auth[e(399)](`/account/me`,{method:`GET`,headers:{"content-type":`application/json`}});if(!t.ok)throw Error(e(411)+t.status);let n=await t.json(),r=await this.#e[e(407)].authorizedFetch(`/account/`+n[e(389)]+`/lock_policy`,{method:`GET`,headers:{"content-type":`application/json`}});if(!r.ok)throw Error(e(417)+r[e(416)]);let i=await r[e(382)]();this.#e.applyPolicyItems(i,n)}async logout(){let e=ip;if(this[e(414)](),this.isDetectorRunning())throw this.lifecycleError(e(363),`MonitorDog detector is running. Call stop() before logout().`);if(!this.#e.auth.getToken()){this.clearSessionState();return}try{await this.#e[e(407)].logout(),this.clearSessionState()}catch(t){let n=this.createSdkError(`LOGOUT_FAILED`,e(402),t);throw this.transitionToError(n),this.#t[e(412)]?.(n),n}finally{!this.#e.auth.getToken()&&(this.#n=`anonymous`)}}async start(){this.assertUsable(),this.assertAuthenticated(`starting detection`),!this.isDetectorRunning()&&(!this.#o&&(this.#o=this.startRuntime().finally(()=>{this.#o=void 0})),await this.#o)}[$(384)](){let e=$;this.assertUsable(),this.hasRuntimeToStop()&&(this.stopLocalRuntime(),this.updateState({runtime:this.#n===`authenticated`?`stopped`:`idle`,camera:e(359),lastError:void 0}))}setRunInBackground(e){let t=$;this.assertUsable(),this.#t.runInBackground=e,this.#e[t(403)][t(415)]()}[$(420)](){return this.assertUsable(),this.#e.userPreferences}isMainUserTrackingEnabled(){let e=$;return this[e(414)](),this.#e[e(386)].isMainUserTrackingEnabled()}[$(368)](e){this.assertUsable(),this.#e.detect.setMainUserTrackingEnabled(e)}[$(424)](){let e=$;return Object.freeze({session:this.#n,runtime:this.#r,camera:this.#i,tokenExpiresAt:this.#e[e(407)].getTokenExpiresAt(),email:this.#e[e(407)].getSessionEmail(),lastError:this.#a})}dispose(){let e=$;this.#r!==`disposed`&&(this[e(358)](),this.#e[e(386)].dispose(),this.#e.auth.dispose(),this.#e.resetAuthenticatedState(),this.updateState({session:e(401),runtime:`disposed`,camera:`idle`,lastError:void 0}))}[$(361)](){this.stopLocalRuntime(),this.#e.detect.dispose(),this.#e.resetAuthenticatedState(),this.updateState({session:`anonymous`,runtime:`idle`,camera:`idle`,lastError:void 0})}rollbackAuthenticatedLogin(){let e=$;this.#e.auth.dispose(),this.#e[e(380)]()}async startRuntime(){let e=$;try{this.updateState({runtime:`loading`,camera:`idle`,lastError:void 0}),await this.#e.detect[e(428)](),this.updateState({runtime:`starting`,camera:e(390)}),await this.#e.webcam[e(427)](),this[e(413)]({runtime:e(398),camera:this.#e[e(357)]?e(359):e(419),lastError:void 0})}catch(t){let n=this.createSdkError(this.getStartErrorCode(t),this.getStartErrorMessage(t),t);throw this[e(387)](n,sp(n.code)?`blocked`:`idle`),this.#t.onError?.(n),n}}clearSessionState(){this.#e.resetAuthenticatedState(),this.updateState({session:`anonymous`,runtime:`idle`,camera:`idle`,lastError:void 0})}stopLocalRuntime(){this.#e.webcam.stop()}assertUsable(){let e=$;if(this.#r===`disposed`)throw this[e(374)](`ALREADY_DISPOSED`,`MonitorDog detector instance has already been disposed.`,void 0,`disposed`)}[$(367)](e){let t=$;if(!this.#e.auth[t(378)]())throw this.lifecycleError(t(391),`MonitorDog login is required before `+e+`.`)}lifecycleError(e,t,n,r=`error`){let i=$,a=this.createSdkError(e,t,n);return r===`error`?this[i(387)](a):this.updateState({runtime:r,lastError:a},!0),a}transitionToError(e,t=this.#i){let n=$;this.updateState({runtime:n(360),camera:t,lastError:e},!0)}updateState(e,t=!1){let n=$,r=!1;e.session!==void 0&&e[n(421)]!==this.#n&&(this.#n=e.session,r=!0),e.runtime!==void 0&&e.runtime!==this.#r&&(this.#r=e[n(426)],r=!0),e.camera!==void 0&&e[n(375)]!==this.#i&&(this.#i=e[n(375)],r=!0),`lastError`in e&&e.lastError!==this.#a&&(this.#a=e.lastError,r=!0),(r||t)&&this[n(356)]()}notifyStatusChange(){let e=$;try{this.#t.onStatusChange?.(this.getState())}catch(t){this.#t[e(409)]?.(t)}}createSdkError(e,t,n){return Ce(n)?n:new be(e,t,n)}[$(385)](){let e=$;return this.#r===`running`||this.#r===e(388)||!!this.#o||this.#e.webcam.isRunning||this.#e.webcam.isStarting}[$(362)](){let e=$;return this.#r===`running`||this.#r===`starting`||this.#i!==e(359)||!!this.#o||this.#e[e(403)].isRunning||this.#e.webcam.isStarting}[$(395)](e){let t=$;return this.isCameraPermissionError(e)?t(369):this[t(377)](e)?`CAMERA_READ_FAILED`:this.#r===t(366)?`MODEL_LOAD_FAILED`:`RUNTIME_START_FAILED`}getStartErrorMessage(e){let t=$;switch(this.getStartErrorCode(e)){case`CAMERA_PERMISSION_DENIED`:return t(400);case`CAMERA_READ_FAILED`:return`MonitorDog camera could not be read.`;case t(393):return`MonitorDog detection model failed to load.`;default:return t(397)}}isCameraPermissionError(e){let t=$;return typeof DOMException<`u`&&e instanceof DOMException&&(e[t(381)]===`NotAllowedError`||e.name===`SecurityError`)}isCameraReadError(e){let t=$;return typeof DOMException!==t(364)&&e instanceof DOMException&&e[t(381)]===`NotReadableError`}};function sp(e){return e===$(369)||e===`CAMERA_READ_FAILED`}var cp;function lp(e){return cp=new op(e),cp}async function up(e){return op.init(e)}function dp(){if(!cp)throw Error(`MonitorDog is not configured. Call MonitorDogDetector.init(), createMonitorDogDetector(), or configureMonitorDogDetector() before using getDetector().`);return cp}function fp(){if(typeof navigator===$(364))return!1;let e=he();return e===`mobile`||e===`tablet`}function pp(e){let t=$;if(!e||typeof e.apiBaseUrl!==t(406)||e[t(418)].length===0)throw Error(`MonitorDog apiBaseUrl is required.`);if(typeof e[t(410)]!=`function`)throw Error(`MonitorDog sessionTokenProvider is required.`);if(typeof e.onDetect!==t(379))throw Error(t(373))}e.MonitorDogDetector=op,e.MonitorDogSdkError=be,e.configureMonitorDogDetector=lp,e.createMonitorDogDetector=up,e.getDetector=dp,e.isMonitorDogSdkError=Ce});
1
+ (function(e,t){typeof exports==`object`&&typeof module<`u`?t(exports,require("html2canvas")):typeof define==`function`&&define.amd?define([`exports`,`html2canvas`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e.MonitorDogDetector={},e.html2canvas))})(this,function(e,t){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var n=Object.create,r=Object.defineProperty,i=Object.getOwnPropertyDescriptor,a=Object.getOwnPropertyNames,o=Object.getPrototypeOf,s=Object.prototype.hasOwnProperty,c=(e,t,n,o)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var c=a(t),l=0,u=c.length,d;l<u;l++)d=c[l],!s.call(e,d)&&d!==n&&r(e,d,{get:(e=>t[e]).bind(null,d),enumerable:!(o=i(t,d))||o.enumerable});return e};t=((e,t,i)=>(i=e==null?{}:n(o(e)),c(t||!e||!e.__esModule?r(i,`default`,{value:e,enumerable:!0}):i,e)))(t,1);var l=.8,u=.7,d=3e4;function f(e){return typeof e==`string`?e:e.access_token}function p(e){if(typeof e!=`string`)return e.expires_in}function ee(e){if(typeof e!=`string`)return e.expires_at}function m(e){if(e.expiresAt){let t=Date.parse(e.expiresAt);if(!Number.isNaN(t))return t}if(e.expiresIn)return e.expiresIn>1e9?e.expiresIn*1e3:Date.now()+e.expiresIn*1e3}function h(e){return e.replace(/\/+$/,``)}function g(){if(typeof navigator>`u`)return`none`;let e=navigator.userAgent.toLowerCase();return/ipad|tablet/.test(e)?`tablet`:/mobile|iphone|ipod|android/.test(e)?`mobile`:/macintosh|windows|linux/.test(e)?`desktop`:`other`}function _(){if(typeof navigator>`u`)return`none`;let e=navigator.userAgent.toLowerCase(),t=navigator.platform.toLowerCase();return/win/.test(t)||/windows/.test(e)?`windows`:/mac/.test(t)||/mac os/.test(e)?`macos`:/android/.test(e)?`android`:/iphone|ipad|ipod/.test(e)?`ios`:/linux/.test(t)||/linux/.test(e)?`linux`:`other`}var v=class extends Error{code;cause;constructor(e,t,n){super(t),this.name=`MonitorDogSdkError`,this.code=e,this.cause=n}};function y(e){return e instanceof v}function b(e){if(e.faceCount===0)return C(`noFaceDetected`,e);if(e.faceCount>=2)return C(`twoFacesDetected`,e);if(e.phoneCount>=1)return C(`mobileDevice`,e)}function x(e){return{...w(e,new Date().toISOString()),properties:{},webcam_imgs:[],monitor_imgs:[]}}function S(e){return e.phoneCount===0&&e.faceCount===1}function C(e,t){let n=w(e,new Date().toISOString());switch(e){case`noFaceDetected`:return{type:e,payload:{...n,properties:{confidence:0,spots:[]}}};case`twoFacesDetected`:return{type:e,payload:{...n,properties:{confidence:T(t.faceDetections),spots:t.faceDetections}}};case`mobileDevice`:return{type:e,payload:{...n,properties:{confidence:T(t.phoneDetections),spots:t.phoneDetections}}}}}function w(e,t){return{basic_event_uuid:E(e),occured_at:t,sended_at:new Date().toISOString(),device_type:g(),device_os:_(),device_id:`browser`}}function T(e){return e.reduce((e,t)=>Math.max(e,t.score),0)}function E(e){switch(e){case`logout`:return`12ca646a-d832-4581-b03c-48f95627507f`;case`login`:return`4c6f98ea-88d8-4215-9b6a-9b3ccb753465`;case`mobileDevice`:return`027af5c9-297d-4a64-983f-4199ca4b9dad`;case`twoFacesDetected`:return`d555efac-7465-4067-8056-611e95385807`;case`noFaceDetected`:return`e2c48c23-36e2-4253-82b1-7f6565fdcfc3`;default:return``}}var D=`MonitorDog token refresh was superseded.`,te=300*1e3,O=class{services;refreshBeforeMs=te;periodicRefreshIntervalMs=d;token;tokenExpiresAt;refreshPromise;refreshIntervalId;authSessionId=0;sessionEmail;constructor(e){this.services=e}async login(e){let t=await this.fetchSessionToken(e.email);return this.sessionEmail=e.email,this.setSessionTokenPayload(t),await this.sendUserActivityEvent(`login`),t}async logout(){if(this.token)try{await this.sendUserActivityEvent(`logout`)}finally{this.clearTokens()}}getToken(){return this.token}getTokenExpiresAt(){return this.tokenExpiresAt}getSessionEmail(){return this.sessionEmail}isAuthenticated(){return!!this.token}dispose(){this.clearTokens()}assertAuthenticated(){if(!this.token)throw Error(`MonitorDog login is required before detection.`)}async getValidAccessToken(){if(this.shouldRefreshCurrentToken())try{await this.handleAuthRefresh()}catch(e){if(this.token&&this.tokenExpiresAt&&Date.now()<this.tokenExpiresAt)return this.token;throw e}return this.token}async authorizedFetch(e,t={},n=!0){let r=await this.getValidAccessToken(),i=new Headers(t.headers);r&&(i.set(`authorization`,`Bearer ${r}`),i.set(`Device-Access-Token`,r));let a=await fetch(`${this.services.options.apiBaseUrl}${e}`,{...t,headers:i}),o=await this.getApiErrorCode(a);return a.status===400&&o===4221&&this.handleLoginRequired(),n&&this.shouldRefreshAfterAuthError(a,o)?(await this.handleAuthRefresh(),this.authorizedFetch(e,t,!1)):a}setSessionTokenPayload(e){let t=f(e);if(!t||typeof t!=`string`)throw Error(`MonitorDog SDK token response did not include a token.`);this.setTokens({accessToken:t,expiresIn:p(e),expiresAt:ee(e)})}setTokens(e){this.token=e.accessToken,this.tokenExpiresAt=m(e),this.tokenExpiresAt?this.startPeriodicRefresh():this.stopPeriodicRefresh()}clearTokens(){this.authSessionId+=1,this.token=void 0,this.tokenExpiresAt=void 0,this.refreshPromise=void 0,this.sessionEmail=void 0,this.stopPeriodicRefresh()}async refreshToken(){return this.refreshPromise||=this.refreshAccessToken().finally(()=>{this.refreshPromise=void 0}),this.refreshPromise}async handleAuthRefresh(){try{return await this.refreshToken()}catch(e){if(!this.isRefreshSupersededError(e)){let t=this.createSdkError(`SESSION_TOKEN_FAILED`,`MonitorDog SDK session token refresh failed.`,e);this.services.options.onAuthError?.(t),this.isCurrentTokenExpired()&&(this.clearTokens(),this.services.onLoginRequired?.())}throw e}}async refreshAccessToken(){let e=this.authSessionId,t=this.sessionEmail;if(!t)throw Error(`MonitorDog login email is required to refresh SDK token.`);let n=await this.fetchSessionToken(t),r=f(n);if(!r||typeof r!=`string`)throw Error(`MonitorDog SDK token response did not include a token.`);if(e!==this.authSessionId)throw Error(D);return this.setSessionTokenPayload(n),r}startPeriodicRefresh(){this.refreshIntervalId||=setInterval(()=>{this.refreshPeriodically()},this.periodicRefreshIntervalMs)}stopPeriodicRefresh(){this.refreshIntervalId&&=(clearInterval(this.refreshIntervalId),void 0)}async refreshPeriodically(){if(!(!this.token||!this.shouldRefreshCurrentToken()))try{await this.handleAuthRefresh()}catch{}}shouldRefreshCurrentToken(){return!!(this.token&&this.tokenExpiresAt&&Date.now()>=this.tokenExpiresAt-this.refreshBeforeMs)}isCurrentTokenExpired(){return!!(this.tokenExpiresAt&&Date.now()>=this.tokenExpiresAt)}isRefreshSupersededError(e){return e instanceof Error&&e.message===D}async fetchSessionToken(e){let t=this.services.options.sessionTokenProvider;if(!t)throw Error(`MonitorDog sessionTokenProvider is required for SDK login.`);return t({email:e})}async getApiErrorCode(e){if(e.status===400)try{let t=await e.clone().json();if(typeof t==`object`&&t&&`code`in t&&typeof t.code==`number`)return t.code}catch{return}}shouldRefreshAfterAuthError(e,t){return e.status===401?!0:e.status===400&&t===422}handleLoginRequired(){this.clearTokens(),this.services.onLoginRequired?.();let e=this.createSdkError(`NOT_LOGGED_IN`,`MonitorDog login is required.`);throw this.services.options.onAuthError?.(e),e}async sendUserActivityEvent(e){try{let t=await this.authorizedFetch(`/event`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify(x(e))});if(!t.ok)throw Error(`MonitorDog ${e} event failed: ${t.status}`)}catch(t){let n=this.createSdkError(k(e),`MonitorDog ${e} event failed.`,t);if(this.services.options.onAuthError?.(n),e===`logout`)throw n}}createSdkError(e,t,n){return n instanceof v?n:new v(e,t,n)}};function k(e){return e===`logout`?`LOGOUT_FAILED`:`SESSION_TOKEN_FAILED`}var A=/(obs|virtual|xsplit|manycam|splitcam|webcammax|fake|loopback|camtwist|e2esoft|vcam|droidcam|iriun|epoccam|camo|mmhmm|nvidia broadcast|streamlabs|bandicam|wirecast|chromacam|youcam|cyberlink|altserver|logi capture|elgato|streamfx|screen capture|desktop capture)/i,j=class{async createWebcamStream(e){if(!navigator.mediaDevices?.getUserMedia)throw Error(`getUserMedia is not available in this browser.`);let t=this.getBaseWebcamConstraints(e),n=await this.createFirstCameraConstraints(t);try{return await this.getUserMedia(n)}catch(e){if(this.isPermissionError(e)||this.isCameraRequestTimeoutError(e))throw e;return this.createFallbackWebcamStream(n,e)}}stopStream(e){e.getTracks().forEach(e=>e.stop())}watchStreamDeviceDisconnect(e,t,n=1e3){let r=e.getVideoTracks()[0],i=r?.getSettings().deviceId;if(!r&&!i)return()=>{};let a=!1,o,s=()=>{a||(a=!0,t())},c=()=>{i&&(o&&clearTimeout(o),o=setTimeout(()=>{o=void 0,this.handleDeviceChange(i,s)},n))};return r?.addEventListener(`ended`,s),navigator.mediaDevices?.addEventListener?.(`devicechange`,c),()=>{o&&clearTimeout(o),r?.removeEventListener(`ended`,s),navigator.mediaDevices?.removeEventListener?.(`devicechange`,c)}}isCameraInUse(e){let t=e?.srcObject;return t instanceof MediaStream?t.getTracks().some(e=>e.readyState===`live`):!1}async getVideoInputDevices(){return navigator.mediaDevices?.enumerateDevices?(await navigator.mediaDevices.enumerateDevices()).filter(e=>e.kind===`videoinput`):[]}async getRealVideoInputDevices(){let e=await this.getVideoInputDevices(),t=e.filter(e=>!this.isVirtualCamera(e));return t.length>0?t:e}async createFallbackWebcamStream(e,t){let n=await this.getRealVideoInputDevices();if(n.length===0)throw t;let r=n[0],i=t;if(!r?.deviceId)throw i;let a=await this.getWebcamNaturalAspectRatio(r.deviceId),o=this.generateResolutionList(a,720);for(let t of o)try{return await this.getUserMedia(this.createDeviceConstraints(e,r.deviceId,t))}catch(e){i=e}throw i}async handleDeviceChange(e,t){try{(await this.getVideoInputDevices()).some(t=>t.deviceId===e)||t()}catch{}}getBaseWebcamConstraints(e){return e??{audio:!1,video:{facingMode:`user`}}}async createFirstCameraConstraints(e){let t=typeof e.video==`object`?e.video:{};if(`deviceId`in t||`facingMode`in t)return e;let n=(await this.getRealVideoInputDevices())[0];return n?.deviceId?this.createDeviceConstraints(e,n.deviceId):e}async getWebcamNaturalAspectRatio(e){let t;try{t=await this.getUserMedia({audio:!1,video:{deviceId:{exact:e}}});let n=t.getVideoTracks()[0]?.getSettings();if(n?.width&&n.height)return n.width/n.height}catch{}finally{t?.getTracks().forEach(e=>e.stop())}return 16/9}generateResolutionList(e,t){return[t,640,600,480,320,240].map(t=>({width:t,height:Math.max(1,Math.round(t/e))})).filter(e=>e.width<=t&&e.height>=120&&e.height<=1080)}createDeviceConstraints(e,t,n){let r=typeof e.video==`object`?e.video:{};return{...e,audio:e.audio??!1,video:{...r,deviceId:{exact:t},...n?{width:{min:n.width,ideal:n.width},height:{min:n.height,ideal:n.height}}:{}}}}isVirtualCamera(e){let t=e.label.toLowerCase();return t?A.test(t):!1}isPermissionError(e){return e instanceof DOMException&&(e.name===`NotAllowedError`||e.name===`SecurityError`)}getUserMedia(e,t=15e3){let n=!1,r,i=navigator.mediaDevices.getUserMedia(e).then(e=>{if(n)throw this.stopStream(e),Error(`Camera permission request timed out.`);return e}),a=new Promise((e,i)=>{r=setTimeout(()=>{n=!0,i(Error(`Camera permission request timed out.`))},t)});return Promise.race([i,a]).finally(()=>{r&&clearTimeout(r)})}isCameraRequestTimeoutError(e){return e instanceof Error&&e.message===`Camera permission request timed out.`}};function M(e){if(e.videoWidth===0||e.videoHeight===0)throw Error(`Video frame is not ready for capture.`);let t=document.createElement(`canvas`),n=t.getContext(`2d`);if(!n)throw Error(`2D canvas context is not available.`);return t.width=e.videoWidth,t.height=e.videoHeight,n.drawImage(e,0,0,t.width,t.height),new Promise((e,n)=>{t.toBlob(t=>{if(!t){n(Error(`Failed to capture video frame.`));return}e(t)},`image/jpeg`,.9)})}async function N(){if(typeof document>`u`||!document.body)return null;let e=await(0,t.default)(document.body,{backgroundColor:`#ffffff`,useCORS:!0});return new Promise(t=>{e.toBlob(t,`image/jpeg`,.9)})}var P=class e{static NO_FACE_STARTUP_GRACE_MS=1500;services;detectionEventLocked=!1;detectionEventInFlight=!1;detectionEventLockTimeoutId;noFaceStartedAt;suppressNoFaceUntil=0;constructor(e){this.services=e}async handleDetectionResult(e,t){if(S(e)){this.noFaceStartedAt=void 0,this.clearLock();return}if(this.detectionEventLocked||this.detectionEventInFlight)return;let n=b(e);if(!n){this.noFaceStartedAt=void 0;return}if(!(n.type===`noFaceDetected`&&!this.hasNoFaceDelayElapsed())&&(n.type!==`noFaceDetected`&&(this.noFaceStartedAt=void 0),this.shouldSendEvent(n.type,e))){this.lock(n.type),this.detectionEventInFlight=!0;try{let e=await this.uploadWebcamImage(t);e&&(n.payload.webcam_imgs=e);let r=await this.uploadMonitorImage();if(r&&(n.payload.monitor_imgs=r),this.services.options.debug){console.log(n.payload);return}let i=await this.services.auth.authorizedFetch(`/event`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify(n.payload)});if(!i.ok)throw Error(`MonitorDog event request failed: ${i.status}`)}finally{this.detectionEventInFlight=!1}}}reset(){this.clearLock(),this.noFaceStartedAt=void 0,this.suppressNoFaceUntil=0}resetForWebcamStartup(){this.clearLock(),this.noFaceStartedAt=void 0,this.suppressNoFaceUntil=Date.now()+e.NO_FACE_STARTUP_GRACE_MS}clearTransientState(){this.noFaceStartedAt=void 0}async uploadWebcamImage(e){if(!(e instanceof HTMLVideoElement)||e.videoWidth===0||e.videoHeight===0)return;let t=await M(e);return this.uploadImage(t,`webcam.jpg`)}async uploadMonitorImage(){let e=this.services.options.captureMonitorImage?await this.services.options.captureMonitorImage():await N();if(!e)return;let t=typeof File<`u`&&e instanceof File?e.name:`monitor.jpg`;return this.uploadImage(e,t)}async uploadImage(e,t){let n=new FormData;n.append(`files`,e,t);let r=await this.services.auth.authorizedFetch(`/file/image`,{method:`POST`,body:n});if(!r.ok)throw Error(`MonitorDog image upload failed: ${r.status}`);return r.json()}shouldSendEvent(e,t){switch(e){case`mobileDevice`:return this.services.userPreferences.mobileDetectionEnabled&&F(t.phoneDetections)>=this.services.userPreferences.mobileDetectionThreshold;case`twoFacesDetected`:return this.services.userPreferences.multiPersonDetectionEnabled&&F(t.faceDetections)>=this.services.userPreferences.faceDetectionThreshold;case`noFaceDetected`:return this.services.userPreferences.noPersonDetectionEnabled}}lock(e){this.clearLock(),this.detectionEventLocked=!0;let t=this.getLockDuration(e);if(t<=0){this.detectionEventLocked=!1;return}this.detectionEventLockTimeoutId=setTimeout(()=>{this.detectionEventLocked=!1,this.detectionEventLockTimeoutId=void 0},t)}clearLock(){this.detectionEventLockTimeoutId&&=(clearTimeout(this.detectionEventLockTimeoutId),void 0),this.detectionEventLocked=!1}hasNoFaceDelayElapsed(){if(Date.now()<this.suppressNoFaceUntil)return this.noFaceStartedAt=void 0,!1;if(this.services.noFaceEventDelayMs<=0)return!0;let e=Date.now();return this.noFaceStartedAt===void 0?(this.noFaceStartedAt=e,!1):e-this.noFaceStartedAt>=this.services.noFaceEventDelayMs}getLockDuration(e){switch(e){case`mobileDevice`:return this.services.userPreferences.mobileDetectionLockDuration;case`twoFacesDetected`:return this.services.userPreferences.multiPersonLockDuration;case`noFaceDetected`:return this.services.userPreferences.noPersonLockDuration}}};function F(e){return e.reduce((e,t)=>Math.max(e,t.confidence),0)}var I=``+(typeof document>`u`&&typeof location>`u`?require("url").pathToFileURL(__dirname+`/assets/inference-worker-EjUccpPR.js`).href:new URL(`assets/inference-worker-EjUccpPR.js`,typeof document>`u`?location.href:document.currentScript&&document.currentScript.tagName.toUpperCase()===`SCRIPT`&&document.currentScript.src||document.baseURI).href),L=class{worker;nextRequestId=1;pendingRequests=new Map;async load(e){let t={id:this.nextRequestId,type:`load`,model:e};await this.request(t)}run(e){let t=e.source.kind===`bitmap`?[e.source.bitmap]:[e.source.data.buffer];return this.request({id:this.nextRequestId,type:`run`,source:e.source,inputSize:e.inputSize,inputType:e.inputType,confidenceThreshold:e.confidenceThreshold,faceConfidenceThreshold:e.faceConfidenceThreshold,iouThreshold:e.iouThreshold,maxDetections:e.maxDetections,debug:e.debug},t)}terminate(){this.rejectPendingRequests(Error(`Inference worker was terminated.`)),this.worker?.terminate(),this.worker=void 0}request(e,t=[]){let n=this.getWorker();return this.nextRequestId+=1,new Promise((r,i)=>{this.pendingRequests.set(e.id,{resolve:r,reject:i}),n.postMessage(e,t)})}getWorker(){return this.worker||(this.worker=new Worker(I,{name:`MonitorDogInference`,type:`module`}),this.worker.addEventListener(`message`,this.handleMessage),this.worker.addEventListener(`error`,this.handleError),this.worker.addEventListener(`messageerror`,this.handleError)),this.worker}handleMessage=e=>{let t=e.data,n=this.pendingRequests.get(t.id);if(n){if(this.pendingRequests.delete(t.id),!t.ok){n.reject(Error(t.error));return}n.resolve(t.result)}};handleError=e=>{let t=e instanceof ErrorEvent?e.message:`Inference worker message failed.`;this.rejectPendingRequests(Error(t)),this.worker?.terminate(),this.worker=void 0};rejectPendingRequests(e){for(let t of this.pendingRequests.values())t.reject(e);this.pendingRequests.clear()}};async function R(e){let{sourceWidth:t,sourceHeight:n}=z(e);if(e instanceof ImageData)return{kind:`rgba`,data:new Uint8ClampedArray(e.data),sourceWidth:t,sourceHeight:n};if(B()&&V())try{return{kind:`bitmap`,bitmap:await createImageBitmap(e),sourceWidth:t,sourceHeight:n}}catch{}return H(e,t,n)}function z(e){return e instanceof ImageData?{sourceWidth:e.width,sourceHeight:e.height}:e instanceof HTMLVideoElement?{sourceWidth:e.videoWidth,sourceHeight:e.videoHeight}:e instanceof HTMLImageElement?{sourceWidth:e.naturalWidth,sourceHeight:e.naturalHeight}:{sourceWidth:e.width,sourceHeight:e.height}}function B(){return typeof createImageBitmap==`function`}function V(){return typeof OffscreenCanvas==`function`}function H(e,t,n){let r=document.createElement(`canvas`),i=r.getContext(`2d`);if(!i)throw Error(`2D canvas context is not available.`);return r.width=t,r.height=n,i.drawImage(e,0,0,t,n),{kind:`rgba`,data:i.getImageData(0,0,t,n).data,sourceWidth:t,sourceHeight:n}}function ne(e){return e.readyState>=HTMLMediaElement.HAVE_CURRENT_DATA&&e.videoWidth>0&&e.videoHeight>0&&!e.paused&&!e.ended}function U(e,t=1e4){return W(e)?Promise.resolve():new Promise((n,r)=>{let i=window.setTimeout(()=>{o(),r(Error(`Timed out waiting for webcam video metadata.`))},t),a=window.setInterval(s,100),o=()=>{window.clearTimeout(i),window.clearInterval(a),e.removeEventListener(`loadedmetadata`,c),e.removeEventListener(`loadeddata`,c),e.removeEventListener(`canplay`,c),e.removeEventListener(`playing`,c),e.removeEventListener(`resize`,c),e.removeEventListener(`error`,l)};function s(){W(e)&&(o(),n())}let c=()=>{s()},l=()=>{o(),r(Error(`Failed to load webcam video stream.`))};e.addEventListener(`loadedmetadata`,c,{once:!0}),e.addEventListener(`loadeddata`,c,{once:!0}),e.addEventListener(`canplay`,c,{once:!0}),e.addEventListener(`playing`,c,{once:!0}),e.addEventListener(`resize`,c,{once:!0}),e.addEventListener(`error`,l,{once:!0})})}function W(e){return e.readyState>=HTMLMediaElement.HAVE_METADATA&&e.videoWidth>0&&e.videoHeight>0}var G=class{services;inferenceWorker;loadPromise;lastInferenceMemoryErrorAt=0;constructor(e){this.services=e}async load(){this.loadPromise||=this.loadInferenceWorker(),await this.loadPromise}async detect(e){await this.load();let t=this.services.options,n=t.debug?performance.now():0,r=t.debug?performance.now():0,i=await R(e),a=t.debug?performance.now():0,o=await this.getInferenceWorker().run({source:i,inputSize:t.inputSize,inputType:t.inputType,confidenceThreshold:t.confidenceThreshold,faceConfidenceThreshold:t.faceConfidenceThreshold,iouThreshold:t.iouThreshold,maxDetections:t.maxDetections,debug:!!t.debug});if(t.debug){let e=performance.now();console.info(`[MonitorDog] detect frame`,{sourceMs:K(a-r),workerRoundtripMs:K(e-a),totalMs:K(e-n)})}return o}toPublicResult(e){return{faceDetected:e.faceDetected,phoneDetected:e.phoneDetected,faceCount:e.faceCount,phoneCount:e.phoneCount,faceDetections:e.faceDetections,phoneDetections:e.phoneDetections}}detectVideo(e){let t=!1,n,r=this.services.options.detectionIntervalMs,i=async()=>{if(!t){try{if(!this.services.shouldPauseDetection&&ne(e)){let n=await this.detect(e);if(t)return;try{await this.services.options.onDetect({...this.toPublicResult(n),video:e,timestamp:e.currentTime})}catch(e){this.services.options.onError?.(e)}if(t)return;await this.services.detectionEvents.handleDetectionResult(n,e).catch(e=>{this.services.options.onError?.(e)}),S(n)&&this.services.detectionEvents.clearTransientState()}}catch(e){this.handleDetectionLoopError(e)}t||(n=setTimeout(i,r))}};return i(),{stop(){t=!0,n&&clearTimeout(n)}}}async startWebcamDetection(){let e=this.services.options,t=await this.services.camera.createWebcamStream(e.constraints),n=this.services.camera,r=!e.video,i=e.video??document.createElement(`video`),a=i.muted,o=i.playsInline,s=i.srcObject;i.muted=!0,i.playsInline=!0,i.srcObject=t;try{await Promise.all([i.play(),U(i)])}catch(e){throw n.stopStream(t),i.pause(),r?i.srcObject=null:(i.muted=a,i.playsInline=o,i.srcObject=s),e}this.services.detectionEvents.resetForWebcamStartup();let c=this.detectVideo(i),l=!1,u=n.watchStreamDeviceDisconnect(t,()=>{d(),this.services.onCameraDisconnect?.()}),d=()=>{l||(l=!0,u(),c.stop(),this.services.detectionEvents.reset(),n.stopStream(t),i.pause(),r?i.srcObject=null:(i.muted=a,i.playsInline=o,i.srcObject=s))};return{stream:t,video:i,stop:d}}dispose(){this.inferenceWorker?.terminate(),this.inferenceWorker=void 0,this.loadPromise=void 0,this.services.detectionEvents.reset()}handleDetectionLoopError(e){this.isInferenceMemoryError(e)&&this.recoverFromInferenceMemoryError(),this.services.options.onError?.(e)}recoverFromInferenceMemoryError(){this.degradeModelForMemoryPressure(),this.resetInferenceWorker();let e=Date.now();e-this.lastInferenceMemoryErrorAt<1e4||(this.lastInferenceMemoryErrorAt=e)}resetInferenceWorker(){this.inferenceWorker?.terminate(),this.inferenceWorker=void 0,this.loadPromise=void 0}degradeModelForMemoryPressure(){this.services.degradeInferenceModelForMemoryPressure()}isInferenceMemoryError(e){let t=e instanceof Error?e.message:String(e);return/out of memory|oom|memory access out of bounds|cannot enlarge memory|array buffer allocation|bad allocation|allocation failed/i.test(t)}getInferenceWorker(){return this.inferenceWorker||=new L,this.inferenceWorker}async loadInferenceWorker(){try{await this.loadInferenceWorkerWithOptions()}catch(e){if(!this.isInferenceMemoryError(e))throw e;this.recoverFromInferenceMemoryError();try{await this.loadInferenceWorkerWithOptions()}catch(e){throw this.recoverFromInferenceMemoryError(),e}}}async loadInferenceWorkerWithOptions(){let e=await this.services.auth.getValidAccessToken();if(!e)throw Error(`MonitorDog login is required before loading detection.`);let t=this.services.options;await this.getInferenceWorker().load({apiBaseUrl:t.apiBaseUrl,accessToken:e,inputSize:t.inputSize})}};function K(e){return Math.round(e*10)/10}var q=class{services;isWebcamRunning=!1;stopCurrentWebcam;startPromise;shouldRun=!1;resumeWhenUnpaused=!1;handleVisibilityChange=()=>{this.syncPauseState()};constructor(e){this.services=e,this.services.onCameraDisconnect=()=>this.handleCameraDisconnect()}get isRunning(){return this.isWebcamRunning}get isStarting(){return!!this.startPromise}async start(){if(this.services.auth.assertAuthenticated(),this.shouldRun=!0,this.addVisibilityListener(),!this.isWebcamRunning){if(this.services.shouldPauseDetection){this.resumeWhenUnpaused=!0;return}await this.ensureStarted()}}stop(){this.shouldRun=!1,this.resumeWhenUnpaused=!1,this.removeVisibilityListener(),this.services.detectionEvents.reset(),this.stopWebcam()}async retryConnection(){await this.start()}async syncPauseState(){if(this.shouldRun){if(this.services.shouldPauseDetection){this.isWebcamRunning&&(this.resumeWhenUnpaused=!0,this.stopWebcam());return}if(this.resumeWhenUnpaused&&!this.isWebcamRunning){this.resumeWhenUnpaused=!1;try{await this.ensureStarted()}catch{this.shouldRun=!1}}}}syncBackgroundPreference(){this.services.options.runInBackground?this.removeVisibilityListener():this.shouldRun&&this.addVisibilityListener(),this.syncPauseState()}async ensureStarted(){this.isWebcamRunning||(this.startPromise||=this.startWebcam().finally(()=>{this.startPromise=void 0}),await this.startPromise)}async startWebcam(){try{let e=await this.services.detect.startWebcamDetection();if(!this.shouldRun){e.stop();return}this.isWebcamRunning=!0,this.stopCurrentWebcam=e.stop}catch(e){throw this.services.options.onError?.(e),e}}stopWebcam(){this.stopCurrentWebcam?.(),this.stopCurrentWebcam=void 0,this.isWebcamRunning=!1}async handleCameraDisconnect(){if(this.isWebcamRunning&&(this.stopWebcam(),this.shouldRun)){if(this.services.shouldPauseDetection){this.resumeWhenUnpaused=!0;return}try{await this.ensureStarted()}catch(e){this.services.options.onError?.(e)}}}addVisibilityListener(){this.services.options.runInBackground||typeof document>`u`||document.addEventListener(`visibilitychange`,this.handleVisibilityChange)}removeVisibilityListener(){typeof document>`u`||document.removeEventListener(`visibilitychange`,this.handleVisibilityChange)}},J=class{auth;camera;detectionEvents;detect;webcam;onCameraDisconnect;onLoginRequired;#e=0;#t=Y();#n;constructor(e){this.#n=e,this.camera=new j,this.auth=new O(this),this.detectionEvents=new P(this),this.detect=new G(this),this.webcam=new q(this)}get options(){return Object.freeze({...this.#n()})}get noFaceEventDelayMs(){return this.#e}get userPreferences(){return Object.freeze({...this.#t})}updateNoFaceEventDelayFromServer(e){this.#e=e}updateRequiredPasswordFromServer(e){this.#n().requiredPassword=e}degradeInferenceModelForMemoryPressure(){let e=this.#n();if(e.inputSize>416){e.inputSize=416;return}e.inputSize>320&&(e.inputSize=320)}get shouldPauseForHiddenPage(){return!this.options.runInBackground&&typeof document<`u`&&document.hidden}get shouldPauseDetection(){return this.shouldPauseForHiddenPage}applyPolicyItems(e,t){let n={...this.#t};for(let t of e)Z(n,t);this.#t=n,this.#n().confidenceThreshold=n.mobileDetectionThreshold,this.#n().faceConfidenceThreshold=n.faceDetectionThreshold,this.updateRequiredPasswordFromServer(!1)}resetAuthenticatedState(){this.#e=0,this.#t=Y(),this.#n().requiredPassword=!1,this.#n().confidenceThreshold=this.#t.mobileDetectionThreshold,this.#n().faceConfidenceThreshold=this.#t.faceDetectionThreshold}};function Y(){return{mobileDetectionThreshold:.8,faceDetectionThreshold:.8,language:`en`,mobileDetectionEnabled:!0,noPersonDetectionEnabled:!0,multiPersonDetectionEnabled:!0,noPersonLockDuration:0,multiPersonLockDuration:0,mobileDetectionLockDuration:0,mobileDetectionMode:`auto_lock`,noPersonDetectionMode:`auto_lock`,multiPersonDetectionMode:`auto_lock`}}function X(e){return e===`none`}function Z(e,t){let n=t.policy,r=!X(t.policy),i=t.seconds*1e3,a=`sensitivity`in t?1-t.sensitivity/100:void 0;switch(t.basic_event_uuid){case E(`mobileDevice`):e.mobileDetectionEnabled=r,e.mobileDetectionLockDuration=i,e.mobileDetectionMode=n,a!==void 0&&(e.mobileDetectionThreshold=a);break;case E(`twoFacesDetected`):e.multiPersonDetectionEnabled=r,e.multiPersonLockDuration=i,e.multiPersonDetectionMode=n,a!==void 0&&(e.faceDetectionThreshold=a);break;case E(`noFaceDetected`):e.noPersonDetectionEnabled=r,e.noPersonLockDuration=i,e.noPersonDetectionMode=n;break;default:break}}var Q=class e{#e;#t;#n=`anonymous`;#r=`idle`;#i=`idle`;#a;#o;static async init(t){return $=new e(t),$}constructor(e){ce(e);let t=se();this.#t={...e,apiBaseUrl:h(e.apiBaseUrl),confidenceThreshold:l,faceConfidenceThreshold:l,iouThreshold:u,maxDetections:100,inputSize:t?416:640,inputType:`float32`,detectionIntervalMs:e.detectionIntervalMs??300,requiredPassword:!1},this.#e=new J(()=>this.#t),this.#e.onLoginRequired=()=>this.resetLoggedOutState(),Object.freeze(this)}async load(){this.assertUsable(),this.assertAuthenticated(`loading detection`);try{this.updateState({runtime:`loading`,lastError:void 0}),await this.#e.detect.load(),this.updateState({runtime:`idle`,lastError:void 0})}catch(e){let t=this.createSdkError(`MODEL_LOAD_FAILED`,`MonitorDog detection model failed to load.`,e);throw this.transitionToError(t),this.#t.onError?.(t),t}}async login(e){this.assertUsable();let t;try{t=await this.#e.auth.login(e)}catch(e){let t=this.createSdkError(`SESSION_TOKEN_FAILED`,`MonitorDog SDK session token could not be created.`,e);throw this.transitionToError(t),this.#t.onAuthError?.(t),t}try{await this.completeAuthenticatedLogin()}catch(e){let t=this.createSdkError(`ACCOUNT_POLICY_FAILED`,`MonitorDog account or policy could not be loaded.`,e);throw this.rollbackAuthenticatedLogin(),this.transitionToError(t),this.#t.onAuthError?.(t),t}return this.updateState({session:`authenticated`,runtime:this.#r===`stopped`?`stopped`:`idle`,camera:this.#e.webcam.isRunning?`active`:`idle`,lastError:void 0}),t}async logout(){if(this.assertUsable(),this.isDetectorRunning())throw this.lifecycleError(`DETECTOR_RUNNING`,`MonitorDog detector is running. Call stop() before logout().`);if(!this.#e.auth.getToken()){this.clearSessionState();return}try{await this.#e.auth.logout(),this.clearSessionState()}catch(e){let t=this.createSdkError(`LOGOUT_FAILED`,`MonitorDog logout failed.`,e);throw this.transitionToError(t),this.#t.onAuthError?.(t),t}finally{this.#e.auth.getToken()||(this.#n=`anonymous`)}}async start(){this.assertUsable(),this.assertAuthenticated(`starting detection`),!this.isDetectorRunning()&&(this.#o||=this.startRuntime().finally(()=>{this.#o=void 0}),await this.#o)}stop(){this.assertUsable(),this.hasRuntimeToStop()&&(this.stopLocalRuntime(),this.updateState({runtime:this.#n===`authenticated`?`stopped`:`idle`,camera:`idle`,lastError:void 0}))}setRunInBackground(e){this.assertUsable(),this.#t.runInBackground=e,this.#e.webcam.syncBackgroundPreference()}getUserPreferences(){return this.assertUsable(),this.#e.userPreferences}getState(){return Object.freeze({session:this.#n,runtime:this.#r,camera:this.#i,tokenExpiresAt:this.#e.auth.getTokenExpiresAt(),email:this.#e.auth.getSessionEmail(),lastError:this.#a})}dispose(){this.#r!==`disposed`&&(this.stopLocalRuntime(),this.#e.detect.dispose(),this.#e.auth.dispose(),this.#e.resetAuthenticatedState(),this.updateState({session:`anonymous`,runtime:`disposed`,camera:`idle`,lastError:void 0}))}async completeAuthenticatedLogin(){let e=await this.#e.auth.authorizedFetch(`/account/me`,{method:`GET`,headers:{"content-type":`application/json`}});if(!e.ok)throw Error(`MonitorDog account request failed: ${e.status}`);let t=await e.json(),n=await this.#e.auth.authorizedFetch(`/account/${t.uuid}/lock_policy`,{method:`GET`,headers:{"content-type":`application/json`}});if(!n.ok)throw Error(`MonitorDog lock policy request failed: ${n.status}`);let r=await n.json();this.#e.applyPolicyItems(r,t)}resetLoggedOutState(){this.stopLocalRuntime(),this.#e.detect.dispose(),this.#e.resetAuthenticatedState(),this.updateState({session:`anonymous`,runtime:`idle`,camera:`idle`,lastError:void 0})}rollbackAuthenticatedLogin(){this.#e.auth.dispose(),this.#e.resetAuthenticatedState()}async startRuntime(){try{this.updateState({runtime:`loading`,camera:`idle`,lastError:void 0}),await this.#e.detect.load(),this.updateState({runtime:`starting`,camera:`requesting`}),await this.#e.webcam.start(),this.updateState({runtime:`running`,camera:this.#e.shouldPauseDetection?`idle`:`active`,lastError:void 0})}catch(e){let t=this.createSdkError(this.getStartErrorCode(e),this.getStartErrorMessage(e),e);throw this.transitionToError(t,re(t.code)?`blocked`:`idle`),this.#t.onError?.(t),t}}clearSessionState(){this.#e.resetAuthenticatedState(),this.updateState({session:`anonymous`,runtime:`idle`,camera:`idle`,lastError:void 0})}stopLocalRuntime(){this.#e.webcam.stop()}assertUsable(){if(this.#r===`disposed`)throw this.lifecycleError(`ALREADY_DISPOSED`,`MonitorDog detector instance has already been disposed.`,void 0,`disposed`)}assertAuthenticated(e){if(!this.#e.auth.isAuthenticated())throw this.lifecycleError(`NOT_LOGGED_IN`,`MonitorDog login is required before ${e}.`)}lifecycleError(e,t,n,r=`error`){let i=this.createSdkError(e,t,n);return r===`error`?this.transitionToError(i):this.updateState({runtime:r,lastError:i},!0),i}transitionToError(e,t=this.#i){this.updateState({runtime:`error`,camera:t,lastError:e},!0)}updateState(e,t=!1){let n=!1;e.session!==void 0&&e.session!==this.#n&&(this.#n=e.session,n=!0),e.runtime!==void 0&&e.runtime!==this.#r&&(this.#r=e.runtime,n=!0),e.camera!==void 0&&e.camera!==this.#i&&(this.#i=e.camera,n=!0),`lastError`in e&&e.lastError!==this.#a&&(this.#a=e.lastError,n=!0),(n||t)&&this.notifyStatusChange()}notifyStatusChange(){try{this.#t.onStatusChange?.(this.getState())}catch(e){this.#t.onError?.(e)}}createSdkError(e,t,n){return y(n)?n:new v(e,t,n)}isDetectorRunning(){return this.#r===`running`||this.#r===`starting`||!!this.#o||this.#e.webcam.isRunning||this.#e.webcam.isStarting}hasRuntimeToStop(){return this.#r===`running`||this.#r===`starting`||this.#i!==`idle`||!!this.#o||this.#e.webcam.isRunning||this.#e.webcam.isStarting}getStartErrorCode(e){return this.isCameraPermissionError(e)?`CAMERA_PERMISSION_DENIED`:this.isCameraReadError(e)?`CAMERA_READ_FAILED`:this.#r===`loading`?`MODEL_LOAD_FAILED`:`RUNTIME_START_FAILED`}getStartErrorMessage(e){switch(this.getStartErrorCode(e)){case`CAMERA_PERMISSION_DENIED`:return`MonitorDog camera permission was denied.`;case`CAMERA_READ_FAILED`:return`MonitorDog camera could not be read.`;case`MODEL_LOAD_FAILED`:return`MonitorDog detection model failed to load.`;default:return`MonitorDog detector runtime failed to start.`}}isCameraPermissionError(e){return typeof DOMException<`u`&&e instanceof DOMException&&(e.name===`NotAllowedError`||e.name===`SecurityError`)}isCameraReadError(e){return typeof DOMException<`u`&&e instanceof DOMException&&e.name===`NotReadableError`}};function re(e){return e===`CAMERA_PERMISSION_DENIED`||e===`CAMERA_READ_FAILED`}var $;function ie(e){return $=new Q(e),$}async function ae(e){return Q.init(e)}function oe(){if(!$)throw Error(`MonitorDog is not configured. Call MonitorDogDetector.init(), createMonitorDogDetector(), or configureMonitorDogDetector() before using getDetector().`);return $}function se(){if(typeof navigator>`u`)return!1;let e=g();return e===`mobile`||e===`tablet`}function ce(e){if(!e||typeof e.apiBaseUrl!=`string`||e.apiBaseUrl.length===0)throw Error(`MonitorDog apiBaseUrl is required.`);if(typeof e.sessionTokenProvider!=`function`)throw Error(`MonitorDog sessionTokenProvider is required.`);if(typeof e.onDetect!=`function`)throw Error(`MonitorDog onDetect callback is required.`)}e.MonitorDogDetector=Q,e.MonitorDogSdkError=v,e.configureMonitorDogDetector=ie,e.createMonitorDogDetector=ae,e.getDetector=oe,e.isMonitorDogSdkError=y});