Files
Probability-and-Statistics-…/_static/126.a976f62852f30b51.js
T
2026-01-11 13:24:27 -05:00

2 lines
5.0 KiB
JavaScript
Executable File

"use strict";(self.webpackChunkWebComponents=self.webpackChunkWebComponents||[]).push([[126],{23053:()=>{Symbol("__sensor__");Event},50126:(e,t,r)=>{r.r(t),r.d(t,{SimpleAbsoluteOrientationSensor:()=>w,SimpleAccelerometer:()=>d,SimpleAmbientLightSensor:()=>l,SimpleGeolocationSensor:()=>u,SimpleGravitySensor:()=>p,SimpleGyroscope:()=>m,SimpleLinearAccelerationSensor:()=>h,SimpleMagnetometer:()=>v,SimpleRelativeOrientationSensor:()=>g}),r(52840),r(23053);let s;window.GeolocationSensor||Sensor,screen.orientation?s=screen.orientation:screen.msOrientation?s=screen.msOrientation:(s={},Object.defineProperty(s,"angle",{get:()=>window.orientation||0}));const n=(e,...t)=>class extends e{constructor(...e){super(e);for(const e of t)if(`on${e}`in window){this[slot].eventName=e;break}this[slot].activateCallback=()=>{window.addEventListener(this[slot].eventName,this[slot].handleEvent,{capture:!0})},this[slot].deactivateCallback=()=>{window.removeEventListener(this[slot].eventName,this[slot].handleEvent,{capture:!0})}}};window.RelativeOrientationSensor||n(Sensor,"deviceorientation"),window.AbsoluteOrientationSensor||n(Sensor,"deviceorientationabsolute","deviceorientation"),window.Gyroscope||n(Sensor,"devicemotion"),window.Accelerometer||n(Sensor,"devicemotion"),window.LinearAccelerationSensor||n(Sensor,"devicemotion"),window.GravitySensor||n(Sensor,"devicemotion");var o=r(65865);class i{constructor(){(0,o.e)(this),this.sensor=null}async start(e,t,r){if(this.sensor)throw"In use. Stop the sensor before starting another.";if("function"!=typeof e)throw"Not available.";if(navigator.permissions&&!(await Promise.all(t.map((e=>navigator.permissions.query({name:e}))))).every((e=>"granted"===e.state)))throw`Permission to use the ${t} sensor was denied.`;let s,n;this.sensor=null;let o=new Promise(((t,o)=>{try{this.sensor=new e(r);let i=this;s=e=>{i.sensor.removeEventListener("error",s),"NotAllowedError"===e.error.name?o("Access to this sensor is not allowed."):"NotReadableError"===e.error.name&&o("Cannot connect to the sensor."),o(`Unknown error: ${e.error.name}`)},this.sensor.addEventListener("error",s),n=e=>{i.sensor.removeEventListener("reading",n),t()},this.sensor.addEventListener("reading",n),this.sensor.start()}catch(e){"SecurityError"===e.name?o("Sensor construction was blocked by a feature policy."):"ReferenceError"===e.name?o("Sensor is not supported by the User Agent."):o(e)}}));try{console.log(`Await ${new Date}`),await o}catch(e){throw this.stop(),e}finally{console.log(`Done ${new Date}`),this.sensor.removeEventListener("error",s),this.sensor.removeEventListener("reading",n)}}get ready(){return this.sensor&&this.sensor.activated&&this.sensor.hasReading}stop(){this.sensor&&this.sensor.stop(),this.sensor=null}}class a extends i{get x(){return this.sensor.x}get y(){return this.sensor.y}get z(){return this.sensor.z}}class c extends i{get quaternion(){return this.sensor.quaternion}populateMatrix(e){return this.sensor.populateMatrix(e)}}class l extends i{async start(e){return super.start(window.AmbientLightSensor,["ambient-light-sensor"],e)}get illuminance(){return this.sensor.illuminance}}class u extends i{async start(e){return super.start(GeolocationSensor,["geolocation"],e)}get latitude(){return this.sensor.latitude}get longitude(){return this.sensor.longitude}get altitude(){return this.sensor.altitude}get accuracy(){return this.sensor.accuracy}get altitudeAccuracy(){return this.sensor.altitudeAccuracy}get heading(){return this.sensor.heading}get speed(){return this.sensor.speed}}class d extends a{async start(e){return super.start(Accelerometer,["accelerometer"],e)}}class m extends a{async start(e){return super.start(Gyroscope,["gyroscope"],e)}}class h extends a{async start(e){return super.start(LinearAccelerationSensor,["accelerometer"],e)}}class p extends a{async start(e){return super.start(GravitySensor,["accelerometer"],e)}}class v extends a{async start(e){return super.start(window.Magnetometer,["magnetometer"],e)}}class w extends c{async start(e){return super.start(AbsoluteOrientationSensor,["accelerometer","gyroscope","magnetometer"],e)}}class g extends c{async start(e){return super.start(RelativeOrientationSensor,["accelerometer","gyroscope"],e)}}},52840:()=>{navigator.permissions||"function"!=typeof DeviceMotionEvent.requestPermission||"function"!=typeof DeviceOrientationEvent.requestPermission||(navigator.permissions={query:e=>{switch(e.name){case"accelerometer":case"gyroscope":return new Promise(((e,t)=>{Promise.all([DeviceMotionEvent.requestPermission(),DeviceOrientationEvent.requestPermission()]).then((t=>e({state:t.every((e=>"granted"===e))?"granted":"denied"})))}));default:return Promise.resolve({state:"granted"})}}})},65865:(e,t,r)=>{r.d(t,{e:()=>n});const s=e=>{const t=new Set;do{for(const r of Reflect.ownKeys(e))t.add([e,r])}while((e=Reflect.getPrototypeOf(e))&&e!==Object.prototype);return t};function n(e){for(const[t,r]of s(e.constructor.prototype)){if("constructor"===r)continue;const s=Reflect.getOwnPropertyDescriptor(t,r);s&&"function"==typeof s.value&&(e[r]=e[r].bind(e))}}}}]);
//# sourceMappingURL=126.a976f62852f30b51.js.map