UNPKG

on-screen-keyboard-detector

Version:

Detects presence of the On-Screen-Keyboard in mobile browsers

19 lines (18 loc) 28.1 kB
/* @license On-screen keyboard detector (OSKD) v.2.3.0 (c) 2020-2021 Matthias Seemann OSKD may be freely distributed under the MIT license. */ !function(t,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n((t="undefined"!=typeof globalThis?globalThis:t||self).OSKD={})}(this,(function(t){"use strict";function n(t){return null!=t&&"object"==typeof t&&!0===t["@@functional/placeholder"]}function e(t){return function e(i){return 0===arguments.length||n(i)?e:t.apply(this,arguments)}}function i(t){return function i(r,s){switch(arguments.length){case 0:return i;case 1:return n(r)?i:e((function(n){return t(r,n)}));default:return n(r)&&n(s)?i:n(r)?e((function(n){return t(n,s)})):n(s)?e((function(n){return t(r,n)})):t(r,s)}}}function r(t,n){switch(t){case 0:return function(){return n.apply(this,arguments)};case 1:return function(t){return n.apply(this,arguments)};case 2:return function(t,e){return n.apply(this,arguments)};case 3:return function(t,e,i){return n.apply(this,arguments)};case 4:return function(t,e,i,r){return n.apply(this,arguments)};case 5:return function(t,e,i,r,s){return n.apply(this,arguments)};case 6:return function(t,e,i,r,s,o){return n.apply(this,arguments)};case 7:return function(t,e,i,r,s,o,u){return n.apply(this,arguments)};case 8:return function(t,e,i,r,s,o,u,c){return n.apply(this,arguments)};case 9:return function(t,e,i,r,s,o,u,c,h){return n.apply(this,arguments)};case 10:return function(t,e,i,r,s,o,u,c,h,f){return n.apply(this,arguments)};default:throw new Error("First argument to _arity must be a non-negative integer no greater than ten")}}function s(t){return function r(s,o,u){switch(arguments.length){case 0:return r;case 1:return n(s)?r:i((function(n,e){return t(s,n,e)}));case 2:return n(s)&&n(o)?r:n(s)?i((function(n,e){return t(n,o,e)})):n(o)?i((function(n,e){return t(s,n,e)})):e((function(n){return t(s,o,n)}));default:return n(s)&&n(o)&&n(u)?r:n(s)&&n(o)?i((function(n,e){return t(n,e,u)})):n(s)&&n(u)?i((function(n,e){return t(n,o,e)})):n(o)&&n(u)?i((function(n,e){return t(s,n,e)})):n(s)?e((function(n){return t(n,o,u)})):n(o)?e((function(n){return t(s,n,u)})):n(u)?e((function(n){return t(s,o,n)})):t(s,o,u)}}}var o=Array.isArray||function(t){return null!=t&&t.length>=0&&"[object Array]"===Object.prototype.toString.call(t)};var u=e((function(t){return!!o(t)||!!t&&("object"==typeof t&&(!function(t){return"[object String]"===Object.prototype.toString.call(t)}(t)&&(1===t.nodeType?!!t.length:0===t.length||t.length>0&&(t.hasOwnProperty(0)&&t.hasOwnProperty(t.length-1)))))})),c=function(){function t(t){this.f=t}return t.prototype["@@transducer/init"]=function(){throw new Error("init not implemented on XWrap")},t.prototype["@@transducer/result"]=function(t){return t},t.prototype["@@transducer/step"]=function(t,n){return this.f(t,n)},t}();var h=i((function(t,n){return r(t.length,(function(){return t.apply(n,arguments)}))}));function f(t,n,e){for(var i=e.next();!i.done;){if((n=t["@@transducer/step"](n,i.value))&&n["@@transducer/reduced"]){n=n["@@transducer/value"];break}i=e.next()}return t["@@transducer/result"](n)}function a(t,n,e,i){return t["@@transducer/result"](e[i](h(t["@@transducer/step"],t),n))}var p="undefined"!=typeof Symbol?Symbol.iterator:"@@iterator";function l(t,n,e){if("function"==typeof t&&(t=function(t){return new c(t)}(t)),u(e))return function(t,n,e){for(var i=0,r=e.length;i<r;){if((n=t["@@transducer/step"](n,e[i]))&&n["@@transducer/reduced"]){n=n["@@transducer/value"];break}i+=1}return t["@@transducer/result"](n)}(t,n,e);if("function"==typeof e["fantasy-land/reduce"])return a(t,n,e,"fantasy-land/reduce");if(null!=e[p])return f(t,n,e[p]());if("function"==typeof e.next)return f(t,n,e);if("function"==typeof e.reduce)return a(t,n,e,"reduce");throw new TypeError("reduce: list must be array or iterable")}var v=s(l);function d(t,n){return function(){return n.call(this,t.apply(this,arguments))}}function y(t,n){return function(){var e=arguments.length;if(0===e)return n();var i=arguments[e-1];return o(i)||"function"!=typeof i[t]?n.apply(this,arguments):i[t].apply(i,Array.prototype.slice.call(arguments,0,e-1))}}var k=e(y("tail",s(y("slice",(function(t,n,e){return Array.prototype.slice.call(e,t,n)})))(1,1/0)));var m=function(t,n,e){return void 0===e&&(e=!1),new b(t,n,e)},w=function(t,n){return void 0===n&&(n=!1),m("resize",t,n)},g=function(t,n){return void 0===n&&(n=!1),m("scroll",t,n)},b=function(t,n,e){this.event=t,this.node=n,this.capture=e}; /** @license MIT License (c) copyright 2015-2016 original author or authors */b.prototype.run=function(t,n){var e=this,i=function(e){return function(t,n,e){try{e.event(t,n)}catch(n){e.error(t,n)}} /** @license MIT License (c) copyright 2010-2016 original author or authors */(n.currentTime(),e,t)};return this.node.addEventListener(this.event,i,this.capture),{dispose:function(){return e.node.removeEventListener(e.event,i,e.capture)}}};function _(t){return function n(e,i){switch(arguments.length){case 0:return n;case 1:return function(n){return t(e,n)};default:return t(e,i)}}}var T,A=function(){function t(t,n){this.origin=t,this.scheduler=n}return t.prototype.currentTime=function(){return this.scheduler.currentTime()-this.origin},t.prototype.scheduleTask=function(t,n,e,i){return this.scheduler.scheduleTask(t+this.origin,n,e,i)},t.prototype.relative=function(n){return new t(n+this.origin,this.scheduler)},t.prototype.cancel=function(t){return this.scheduler.cancel(t)},t.prototype.cancelAll=function(t){return this.scheduler.cancelAll(t)},t}(),x=_((function(t,n){return n.scheduleTask(0,0,-1,t)})),E=(T=function(t,n,e){return e.scheduleTask(0,t,-1,n)},function t(n,e,i){switch(arguments.length){case 0:return t;case 1:return _((function(t,e){return T(n,t,e)}));case 2:return function(t){return T(n,e,t)};default:return T(n,e,i)}}),O=function(t){return t.dispose()},S=_((function(t,n){return new A(t,n)}));function V(t,n,e){for(var i=n,r=0,s=e.length;r<s;++r)i=t(i,e[r],r);return i}function j(t){return function n(e,i){switch(arguments.length){case 0:return n;case 1:return function(n){return t(e,n)};default:return t(e,i)}}}var R=new(function(){function t(){}return t.prototype.dispose=function(){},t}()),N=function(t){return new D(t)},D=function(){function t(t){this.disposed=!1,this.disposable=t}return t.prototype.dispose=function(){this.disposed||(this.disposed=!0,this.disposable&&(this.disposable.dispose(),this.disposable=void 0))},t}(),P=function(t){var n=V(I,[],t);return 0===n.length?R:new M(n)},q=j((function(t,n){return P([t,n])})),I=function(t,n){return function(t){return t===R}(n)?t:n instanceof M?function(t,n){var e=t.length,i=n.length,r=new Array(e+i),s=0;for(s=0;s<e;s++)r[s]=t[s];for(var o=0;o<i;o++)r[s++]=n[o];return r}(t,n.disposables): /** @license MIT License (c) copyright 2010-2016 original author or authors */ function(t,n){for(var e=n.length,i=new Array(e+1),r=0;r<e;++r)i[r]=n[r];return i[e]=t,i}(n,t)},M=function(){function t(t){this.disposables=t}return t.prototype.dispose=function(){B(C(this.disposables))},t}(),C=function(t){return V(F,[],t)},F=function(t,n){try{n.dispose()}catch(n){t.push(n)}return t},B=function(t){if(t.length>0)throw new H(t.length+" errors",t)},H=function t(n,e){this.name="DisposeAllError",this.message=n,this.errors=e,Error.call(this,n),Error.captureStackTrace&&Error.captureStackTrace(this,t),this.stack=""+this.stack+K(this.errors)};H.prototype=Object.create(Error.prototype);var K=function(t){return V(L,"",t)},L=function(t,n,e){return t+"\n["+(e+1)+"] "+n.stack},z=function(t){return function n(e,i,r){switch(arguments.length){case 0:return n;case 1:return j((function(n,i){return t(e,n,i)}));case 2:return function(n){return t(e,i,n)};default:return t(e,i,r)}}}((function(t,n,e){try{n.dispose()}catch(n){e.error(t,n)}})),W=function(t,n){return(W=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var e in n)n.hasOwnProperty(e)&&(t[e]=n[e])})(t,n)};function X(t,n){function e(){this.constructor=t}W(t,n),t.prototype=null===n?Object.create(n):(e.prototype=n.prototype,new e)} /** @license MIT License (c) copyright 2010-2016 original author or authors */function G(t){throw t}var J=function(t){return new Y(t)},Q=function(){function t(t){this.sink=t,this.active=!0}return t.prototype.dispose=function(){this.active=!1},t.prototype.run=function(t){this.active&&this.runIfActive(t)},t.prototype.error=function(t,n){if(!this.active)return function(t){setTimeout(G,0,t)}(n);this.sink.error(t,n)},t}(),U=(function(t){function n(n,e,i){var r=t.call(this,i)||this;return r.runEvent=n,r.value=e,r}X(n,t),n.prototype.runIfActive=function(t){this.runEvent(t,this.value,this.sink)}}(Q),function(t){function n(n,e){var i=t.call(this,e)||this;return i.value=n,i}return X(n,t),n.prototype.runIfActive=function(t){this.sink.event(t,this.value)},n}(Q)),Y=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return X(n,t),n.prototype.runIfActive=function(t){this.sink.end(t)},n}(Q),Z=(function(t){function n(n,e){var i=t.call(this,e)||this;return i.value=n,i}X(n,t),n.prototype.runIfActive=function(t){this.sink.error(t,this.value)}}(Q),function(){return tt}),$=function(t){return t===tt},tt=new(function(){function t(){}return t.prototype.run=function(t,n){return x(J(t),n)},t}()),nt=function(){function t(){this.disposable=void 0,this.disposed=!1}return t.prototype.setDisposable=function(t){if(void 0!==this.disposable)throw new Error("setDisposable called more than once");this.disposable=t,this.disposed&&t.dispose()},t.prototype.dispose=function(){this.disposed||(this.disposed=!0,void 0!==this.disposable&&this.disposable.dispose())},t}(),et=_((function(t,n){return new Promise((function(e,i){return function(t,n,e,i){var r=new nt,s=new it(e,i,r);r.setDisposable(t.run(s,n))}(t,n,e,i)}))}));var it=function(){function t(t,n,e){this._end=t,this._error=n,this._disposable=e,this.active=!0}return t.prototype.event=function(){},t.prototype.end=function(){this.active&&this.dispose(this._error,this._end,void 0)},t.prototype.error=function(t,n){this.dispose(this._error,this._error,n)},t.prototype.dispose=function(t,n,e){this.active=!1,function(t,n,e,i){try{i.dispose()}catch(n){return void t(n)}n(e)}(t,n,e,this._disposable)},t}();var rt=function(){function t(t,n){this.sink=n,this.offset=t}return t.prototype.event=function(t,n){this.sink.event(t+this.offset,n)},t.prototype.error=function(t,n){this.sink.error(t+this.offset,n)},t.prototype.end=function(t){this.sink.end(t+this.offset)},t}(),st=function(){function t(t,n){this.origin=t,this.source=n}return t.prototype.run=function(t,n){return this.source.run(ot(this.origin,t),S(this.origin,n))},t}(),ot=function(t,n){return n instanceof rt?new rt(t+n.offset,n.sink):new rt(t,n)},ut=function(){function t(t){this.sink=t}return t.prototype.end=function(t){return this.sink.end(t)},t.prototype.error=function(t,n){return this.sink.error(t,n)},t}(),ct=(function(t){function n(n,e,i){var r=t.call(this,i)||this;return r.step=n,r.seed=e,r}X(n,t),n.prototype.event=function(t,n){var e=this.step(this.seed,n);this.seed=e.seed,this.sink.event(t,e.value)}}(ut),function(t){function n(n,e,i){var r=t.call(this,i)||this;return r.f=n,r.value=e,r}X(n,t),n.prototype.event=function(t,n){var e=this.f;this.value=e(this.value,n),this.sink.event(t,this.value)}}(ut),function(t){function n(n,e,i,r){var s=t.call(this,i)||this;return s.f=n,s.scheduler=r,s.active=!0,s.disposable=N(e.run(s,r)),s}X(n,t),n.prototype.event=function(t,n){this.active&&this.sink.event(t,n)},n.prototype.end=function(t){this.active&&(z(t,this.disposable,this.sink),this.startNext(t,this.sink))},n.prototype.startNext=function(t,n){try{this.disposable=this.continue(this.f,t,n)}catch(e){n.error(t,e)}},n.prototype.continue=function(t,n,e){return function(t,n,e){return e.run(t,n)}(e,this.scheduler,(i=n,r=t(),new st(i,r)));var i,r},n.prototype.dispose=function(){return this.active=!1,this.disposable.dispose()}}(ut),function(){function t(t,n){this.p=t,this.source=n}return t.prototype.run=function(t,n){return this.source.run(new ht(this.p,t),n)},t.create=function(n,e){return $(e)?e:e instanceof t?new t(ft(e.p,n),e.source):new t(n,e)},t}()),ht=function(t){function n(n,e){var i=t.call(this,e)||this;return i.p=n,i}return X(n,t),n.prototype.event=function(t,n){(0,this.p)(n)&&this.sink.event(t,n)},n}(ut),ft=function(t,n){return function(e){return t(e)&&n(e)}},at=function(){function t(t,n,e){this.p=t,this.f=n,this.source=e}return t.prototype.run=function(t,n){return this.source.run(new pt(this.p,this.f,t),n)},t}(),pt=function(t){function n(n,e,i){var r=t.call(this,i)||this;return r.p=n,r.f=e,r}return X(n,t),n.prototype.event=function(t,n){var e=this.f;(0,this.p)(n)&&this.sink.event(t,e(n))},n}(ut),lt=function(){function t(t,n){this.f=t,this.source=n}return t.prototype.run=function(t,n){return this.source.run(new vt(this.f,t),n)},t.create=function(n,e){return $(e)?Z():e instanceof t?new t(function(t,n){return function(e){return t(n(e))}}(n,e.f),e.source):e instanceof ct?new at(e.p,n,e.source):new t(n,e)},t}(),vt=function(t){function n(n,e){var i=t.call(this,e)||this;return i.f=n,i}return X(n,t),n.prototype.event=function(t,n){var e=this.f;this.sink.event(t,e(n))},n}(ut),dt=function(){function t(t,n){this.source=n,this.f=t}return t.prototype.run=function(t,n){return this.source.run(new yt(this.f,t),n)},t}(),yt=function(t){function n(n,e){var i=t.call(this,e)||this;return i.f=n,i}return X(n,t),n.prototype.event=function(t,n){(0,this.f)(n),this.sink.event(t,n)},n}(ut),kt=function(t){function n(n,e){var i=t.call(this,e)||this;return i.index=n,i.active=!0,i.value=void 0,i}return X(n,t),n.prototype.event=function(t,n){this.active&&(this.value=n,this.sink.event(t,this))},n.prototype.end=function(t){this.active&&(this.active=!1,this.sink.event(t,this))},n}(ut); /** @license MIT License (c) copyright 2010-2016 original author or authors */ function mt(t,n){switch(n.length){case 0:return t();case 1:return t(n[0]);case 2:return t(n[0],n[1]);case 3:return t(n[0],n[1],n[2]);case 4:return t(n[0],n[1],n[2],n[3]);case 5:return t(n[0],n[1],n[2],n[3],n[4]);default:return t.apply(void 0,n)}}!function(t){function n(n,e,i,r){var s=t.call(this,i)||this;return s.disposables=n,s.f=r,s.awaiting=e,s.values=new Array(e),s.hasValue=new Array(e).fill(!1),s.activeCount=e,s}X(n,t),n.prototype.event=function(t,n){if(n.active){var e=n.index,i=this.updateReady(e);this.values[e]=n.value,0===i&&this.sink.event(t,mt(this.f,this.values))}else this.dispose(t,n.index)},n.prototype.updateReady=function(t){return this.awaiting>0&&(this.hasValue[t]||(this.hasValue[t]=!0,this.awaiting-=1)),this.awaiting},n.prototype.dispose=function(t,n){z(t,this.disposables[n],this.sink),0==--this.activeCount&&this.sink.end(t)}}(ut);var wt=function(t){return gt(bt(t))},gt=function(t){return 0===t.length?Z():1===t.length?t[0]:new At(function(t,n,e){for(var i=n,r=0,s=e.length;r<s;++r)i=t(i,e[r],r);return i}(Tt,[],t))},bt=function(t){return t.filter(_t)},_t=function(t){return!$(t)},Tt=function(t,n){return t.concat(n instanceof At?n.sources:n)},At=function(){function t(t){this.sources=t}return t.prototype.run=function(t,n){for(var e=this.sources.length,i=new Array(e),r=new Array(e),s=new xt(i,r,t),o=void 0,u=0;u<e;++u)o=r[u]=new kt(u,s),i[u]=this.sources[u].run(o,n);return P(i)},t}(),xt=function(t){function n(n,e,i){var r=t.call(this,i)||this;return r.disposables=n,r.activeCount=e.length,r}return X(n,t),n.prototype.event=function(t,n){n.active?this.sink.event(t,n.value):this.dispose(t,n.index)},n.prototype.dispose=function(t,n){z(t,this.disposables[n],this.sink),0==--this.activeCount&&this.sink.end(t)},n}(ut),Et=(function(t){function n(n,e){var i=t.call(this,e)||this;return i.f=n,i.latest=new Et(i),i}X(n,t),n.prototype.event=function(t,n){if(this.latest.hasValue){var e=this.f;this.sink.event(t,e(this.latest.value,n))}}}(ut),function(t){function n(n){var e=t.call(this,n)||this;return e.hasValue=!1,e}return X(n,t),n.prototype.event=function(t,n){this.value=n,this.hasValue=!0},n.prototype.end=function(){},n}(ut)),Ot=(function(t){function n(n,e,i,r){var s=t.call(this,i)||this;return s.skip=n,s.take=e,s.disposable=r,s}X(n,t),n.prototype.event=function(t,n){this.skip>0?this.skip-=1:0!==this.take&&(this.take-=1,this.sink.event(t,n),0===this.take&&(this.disposable.dispose(),this.sink.end(t)))}}(ut),function(t){function n(n,e,i){var r=t.call(this,e)||this;return r.p=n,r.active=!0,r.disposable=i,r}X(n,t),n.prototype.event=function(t,n){if(this.active){var e=this.p;this.active=e(n),this.active?this.sink.event(t,n):(this.disposable.dispose(),this.sink.end(t))}}}(ut),function(t){function n(n,e){var i=t.call(this,e)||this;return i.p=n,i.skipping=!0,i}X(n,t),n.prototype.event=function(t,n){if(this.skipping){var e=this.p;if(this.skipping=e(n),this.skipping)return}this.sink.event(t,n)}}(ut),function(t){function n(n,e){var i=t.call(this,e)||this;return i.p=n,i.skipping=!1,i}X(n,t),n.prototype.event=function(t,n){if(!this.skipping){var e=this.p;this.skipping=e(n),this.sink.event(t,n),this.skipping&&this.sink.end(t)}}}(ut),function(t){function n(n,e,i){var r=t.call(this,i)||this;return r.f=n,r.items=e,r.index=0,r}X(n,t),n.prototype.event=function(t,n){var e=this.f;this.sink.event(t,e(this.items[this.index],n)),this.index+=1}}(ut),function(t){function n(n,e,i,r){var s=t.call(this,r)||this;return s.f=n,s.sinks=i,s.buffers=e,s}X(n,t),n.prototype.event=function(t,n){if(n.active){var e=this.buffers,i=e[n.index];if(i.push(n.value),1===i.length()){if(!function(t){for(var n=0,e=t.length;n<e;++n)if(t[n].isEmpty())return!1;return!0}(e))return;Ot(this.f,t,e,this.sink),function(t,n){for(var e=0,i=t.length;e<i;++e)if(t[e].isEmpty()&&!n[e].active)return!0;return!1}(this.buffers,this.sinks)&&this.sink.end(t)}}else this.dispose(t,n.index)},n.prototype.dispose=function(t,n){this.buffers[n].isEmpty()&&this.sink.end(t)}}(ut),function(t,n,e,i){return i.event(n,mt(t,function(t,n){for(var e=n.length,i=new Array(e),r=0;r<e;++r)i[r]=t(n[r]);return i}(St,e)))}),St=function(t){return t.shift()};var Vt=function(t){return jt(Dt,t)},jt=function(t,n){return $(n)?Z():new Rt(t,n)},Rt=function(){function t(t,n){this.equals=t,this.source=n}return t.prototype.run=function(t,n){return this.source.run(new Nt(this.equals,t),n)},t}(),Nt=function(t){function n(n,e){var i=t.call(this,e)||this;return i.equals=n,i.value=void 0,i.init=!0,i}return X(n,t),n.prototype.event=function(t,n){this.init?(this.init=!1,this.value=n,this.sink.event(t,n)):this.equals(this.value,n)||(this.value=n,this.sink.event(t,n))},n}(ut);function Dt(t,n){return t===n} /** @license MIT License (c) copyright 2010-2016 original author or authors */var Pt=function(){function t(t,n){this.maxSignal=t,this.source=n}return t.prototype.run=function(t,n){var e=new nt,i=this.source.run(t,n),r=this.maxSignal.run(new qt(t,e),n);return e.setDisposable(q(i,r)),e},t}(),qt=(function(t){function n(n,e){var i=t.call(this,e)||this;return i.min=n,i}X(n,t),n.prototype.event=function(t,n){this.min.allow&&this.sink.event(t,n)}}(ut),function(t){function n(n,e,i){var r=t.call(this,e)||this;return r.allow=!1,r.disposable=n.run(r,i),r}X(n,t),n.prototype.event=function(){this.allow=!0,this.dispose()},n.prototype.end=function(){},n.prototype.dispose=function(){this.disposable.dispose()}}(ut),function(t){function n(n,e){var i=t.call(this,n)||this;return i.disposable=e,i}return X(n,t),n.prototype.event=function(t){this.disposable.dispose(),this.sink.end(t)},n.prototype.end=function(){},n}(ut)),It=(function(t){function n(n,e,i){var r=t.call(this,e)||this;return r.dt=n,r.scheduler=i,r.tasks=[],r}X(n,t),n.prototype.dispose=function(){this.tasks.forEach(O)},n.prototype.event=function(t,n){var e,i;this.tasks.push(E(this.dt,(e=n,i=this.sink,new U(e,i)),this.scheduler))},n.prototype.end=function(){this.tasks.push(E(this.dt,J(this.sink),this.scheduler))}}(ut),function(t){function n(n,e){var i=t.call(this,e)||this;return i.time=0,i.period=n,i}X(n,t),n.prototype.event=function(t,n){t>=this.time&&(this.time=t+this.period,this.sink.event(t,n))}}(ut),function(){function t(t,n){this.dt=t,this.source=n}return t.prototype.run=function(t,n){return new Mt(this.dt,this.source,t,n)},t}()),Mt=function(){function t(t,n,e,i){this.dt=t,this.sink=e,this.scheduler=i,this.timer=null,this.disposable=n.run(this,i)}return t.prototype.event=function(t,n){this.clearTimer(),this.value=n,this.timer=E(this.dt,new Ct(this,n),this.scheduler)},t.prototype.handleEventFromTask=function(t,n){this.clearTimer(),this.sink.event(t,n)},t.prototype.end=function(t){this.clearTimer()&&(this.sink.event(t,this.value),this.value=void 0),this.sink.end(t)},t.prototype.error=function(t,n){this.clearTimer(),this.sink.error(t,n)},t.prototype.dispose=function(){this.clearTimer(),this.disposable.dispose()},t.prototype.clearTimer=function(){return null!==this.timer&&(this.timer.dispose(),this.timer=null,!0)},t}(),Ct=function(){function t(t,n){this.sink=t,this.value=n}return t.prototype.run=function(t){this.sink.handleEventFromTask(t,this.value)},t.prototype.error=function(t,n){this.sink.error(t,n)},t.prototype.dispose=function(){},t}(),Ft=_((function(t,n){return lt.create(t,n)})),Bt=_((function(t,n){return new dt(t,n)})),Ht=_((function(t,n){return new Pt(t,n)})),Kt=_((function(t,n){return $(n)?Z():new It(t,n)})),Lt=function(){var t=[];return[function(n){return zt(t,n)},new Wt(t)]},zt=function(t,n){return t.forEach((function(t){var e=t.sink;return function(t,n,e){try{e.event(t,n)}catch(n){e.error(t,n)}} /** @license MIT License (c) copyright 2010-2016 original author or authors */(t.scheduler.currentTime(),n,e)}))},Wt=function(){function t(t){this.sinks=t}return t.prototype.run=function(t,n){var e={sink:t,scheduler:n};return this.sinks.push(e),new Xt(e,this.sinks)},t}(),Xt=function(){function t(t,n){this.sink=t,this.sinks=n}return t.prototype.dispose=function(){var t=this.sinks.indexOf(this.sink);t>=0&&this.sinks.splice(t,1)},t}();var Gt=function(){function t(t,n,e,i,r){this.time=t,this.localOffset=n,this.period=e,this.task=i,this.scheduler=r,this.active=!0}return t.prototype.run=function(){return this.task.run(this.time-this.localOffset)},t.prototype.error=function(t){return this.task.error(this.time-this.localOffset,t)},t.prototype.dispose=function(){return this.active=!1,this.scheduler.cancel(this),this.task.dispose()},t}(),Jt=function(){function t(t,n){this.origin=t,this.scheduler=n}return t.prototype.currentTime=function(){return this.scheduler.currentTime()-this.origin},t.prototype.scheduleTask=function(t,n,e,i){return this.scheduler.scheduleTask(t+this.origin,n,e,i)},t.prototype.relative=function(n){return new t(n+this.origin,this.scheduler)},t.prototype.cancel=function(t){return this.scheduler.cancel(t)},t.prototype.cancelAll=function(t){return this.scheduler.cancelAll(t)},t}(),Qt=function(t){return Promise.resolve(t).then(Ut)};function Ut(t){try{return t.run()}catch(n){return t.error(n)}} /** @license MIT License (c) copyright 2010-2017 original author or authors */var Yt=function(){function t(t,n){var e=this;this._runReadyTasksBound=function(){return e._runReadyTasks()},this.timer=t,this.timeline=n,this._timer=null,this._nextArrival=1/0}return t.prototype.currentTime=function(){return this.timer.now()},t.prototype.scheduleTask=function(t,n,e,i){var r=this.currentTime()+Math.max(0,n),s=new Gt(r,t,e,i,this);return this.timeline.add(s),this._scheduleNextRun(),s},t.prototype.relative=function(t){return new Jt(t,this)},t.prototype.cancel=function(t){t.active=!1,this.timeline.remove(t)&&this._reschedule()},t.prototype.cancelAll=function(t){this.timeline.removeAll(t),this._reschedule()},t.prototype._reschedule=function(){this.timeline.isEmpty()?this._unschedule():this._scheduleNextRun()},t.prototype._unschedule=function(){this.timer.clearTimer(this._timer),this._timer=null},t.prototype._scheduleNextRun=function(){if(!this.timeline.isEmpty()){var t=this.timeline.nextArrival();null===this._timer?this._scheduleNextArrival(t):t<this._nextArrival&&(this._unschedule(),this._scheduleNextArrival(t))}},t.prototype._scheduleNextArrival=function(t){this._nextArrival=t;var n=Math.max(0,t-this.currentTime());this._timer=this.timer.setTimer(this._runReadyTasksBound,n)},t.prototype._runReadyTasks=function(){this._timer=null,this.timeline.runTasks(this.currentTime(),Ut),this._scheduleNextRun()},t}(),Zt=function(){function t(){this.tasks=[]}return t.prototype.nextArrival=function(){return this.isEmpty()?1/0:this.tasks[0].time},t.prototype.isEmpty=function(){return 0===this.tasks.length},t.prototype.add=function(t){tn(t,this.tasks)},t.prototype.remove=function(t){var n=rn(nn(t),this.tasks);if(n>=0&&n<this.tasks.length){var e=this.tasks[n].events,i=function(t,n){for(var e=0,i=n.length;e<i;++e)if(t===n[e])return e;return-1}(t,e);if(i>=0)return e.splice(i,1),0===e.length&&this.tasks.splice(n,1),!0}return!1},t.prototype.removeAll=function(t){for(var n=0;n<this.tasks.length;++n)en(t,this.tasks[n])},t.prototype.runTasks=function(t,n){for(var e=this.tasks,i=e.length,r=0;r<i&&e[r].time<=t;)++r;this.tasks=e.slice(r);for(var s=0;s<r;++s)this.tasks=$t(n,e[s].events,this.tasks)},t}(); /** @license MIT License (c) copyright 2010-2017 original author or authors */function $t(t,n,e){for(var i=0;i<n.length;++i){var r=n[i];r.active&&(t(r),r.period>=0&&r.active&&(r.time=r.time+r.period,tn(r,e)))}return e}function tn(t,n){var e=n.length,i=nn(t);if(0!==e){var r=rn(i,n);r>=e?n.push(sn(i,[t])):function(t,n,e,i){var r=n[i];e===r.time?function(t,n){0===n.length||t.time>=n[n.length-1].time?n.push(t):function(t,n){for(var e=0;e<n.length;e++)if(t.time<n[e].time){n.splice(e,0,t);break}}(t,n)}(t,r.events):n.splice(i,0,sn(e,[t]))}(t,n,i,r)}else n.push(sn(i,[t]))}function nn(t){return Math.floor(t.time)}function en(t,n){n.events=function(t,n){for(var e=n.length,i=new Array(e),r=0,s=void 0,o=0;o<e;++o)t(s=n[o])||(i[r]=s,++r);return i.length=r,i}(t,n.events)}function rn(t,n){for(var e,i,r=0,s=n.length;r<s;){if(t===(i=n[e=Math.floor((r+s)/2)]).time)return e;t<i.time?s=e:r=e+1}return s}var sn=function(t,n){return{time:t,events:n}},on=function(){function t(t){this._clock=t}return t.prototype.now=function(){return this._clock.now()},t.prototype.setTimer=function(t,n){return n<=0?function(t){var n=new un(t);return Qt(n),n}(t):setTimeout(t,n)},t.prototype.clearTimer=function(t){return t instanceof un?t.cancel():clearTimeout(t)},t}(),un=function(){function t(t){this.f=t,this.active=!0}return t.prototype.run=function(){if(this.active)return this.f()},t.prototype.error=function(t){throw t},t.prototype.cancel=function(){this.active=!1},t}(); /** @license MIT License (c) copyright 2010-2017 original author or authors */var cn=function(){function t(t,n){this.origin=n,this.clock=t}return t.prototype.now=function(){return this.clock.now()-this.origin},t}(),hn=function(){function t(t,n){this.origin=n,this.hrtime=t}return t.prototype.now=function(){var t=this.hrtime(this.origin);return(1e9*t[0]+t[1])/1e6},t}(),fn=function(t){return new cn(t,t.now())},an=function(){return"undefined"!=typeof performance&&"function"==typeof performance.now?fn(performance):"undefined"!=typeof process&&"function"==typeof process.hrtime?new hn(process.hrtime,process.hrtime()):fn(Date)},pn=function(){return new Yt(ln(),new Zt)},ln=function(){return new on(an())};const vn="visualViewport"in window;function dn(){return vn}t.isSupported=dn,t.subscribe=function(t){if(!dn())return console.warn("On-Screen-Keyboard detection not supported on this version of iOS"),()=>void 0;const[n,e]=Lt(),i=pn(),s=function(){if(0===arguments.length)throw new Error("pipe requires at least one argument");return r(arguments[0].length,v(d,arguments[0],k(arguments)))}(()=>wt([g(visualViewport),w(visualViewport),g(window)]),Kt(800),Bt(()=>{console.log(visualViewport.height*visualViewport.scale/document.documentElement.clientHeight)}),Ft(()=>visualViewport.height*visualViewport.scale/document.documentElement.clientHeight<.85),Vt,Ft(t=>t?"visible":"hidden"),Ht(e))();return et(Bt(t,s),i),n},Object.defineProperty(t,"__esModule",{value:!0})}));