native-fn 1.0.60 → 1.0.62
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.
- package/dist/index.d.ts +198 -0
- package/dist/native.cjs +32 -7
- package/dist/native.min.cjs +1 -1
- package/dist/native.min.mjs +1 -1
- package/dist/native.mjs +32 -7
- package/dist/native.umd.js +32 -7
- package/dist/native.umd.min.js +1 -1
- package/dist/plugin/app/index.cjs +134 -89
- package/dist/plugin/app/index.d.ts +59 -7
- package/dist/plugin/app/index.min.cjs +1 -1
- package/dist/plugin/app/index.min.mjs +1 -1
- package/dist/plugin/app/index.mjs +134 -89
- package/dist/plugin/app/index.umd.js +134 -89
- package/dist/plugin/app/index.umd.min.js +1 -1
- package/dist/plugin/app/src/constants/platform.d.ts +10 -0
- package/dist/plugin/app/src/plugin/app/utils/try-open-url.d.ts +15 -0
- package/dist/plugin/app/src/plugin/fullscreen/types/fullscreen-electron.d.ts +10 -0
- package/dist/plugin/app/src/plugin/fullscreen/types/fullscreen.d.ts +4 -3
- package/dist/plugin/app/src/types/native.d.ts +8 -0
- package/dist/plugin/app/src/types/platform.d.ts +0 -3
- package/dist/plugin/camera/index.cjs +19 -6
- package/dist/plugin/camera/index.d.ts +150 -0
- package/dist/plugin/camera/index.min.cjs +1 -1
- package/dist/plugin/camera/index.min.mjs +1 -1
- package/dist/plugin/camera/index.mjs +19 -6
- package/dist/plugin/camera/index.umd.js +19 -6
- package/dist/plugin/camera/index.umd.min.js +1 -1
- package/dist/plugin/camera/src/constants/platform.d.ts +10 -0
- package/dist/plugin/camera/src/plugin/app/utils/try-open-url.d.ts +15 -0
- package/dist/plugin/camera/src/plugin/fullscreen/types/fullscreen-electron.d.ts +10 -0
- package/dist/plugin/camera/src/plugin/fullscreen/types/fullscreen.d.ts +4 -3
- package/dist/plugin/camera/src/types/native.d.ts +8 -0
- package/dist/plugin/camera/src/types/platform.d.ts +0 -3
- package/dist/plugin/clipboard/index.cjs +225 -212
- package/dist/plugin/clipboard/index.d.ts +135 -0
- package/dist/plugin/clipboard/index.min.cjs +1 -1
- package/dist/plugin/clipboard/index.min.mjs +1 -1
- package/dist/plugin/clipboard/index.mjs +225 -212
- package/dist/plugin/clipboard/index.umd.js +225 -212
- package/dist/plugin/clipboard/index.umd.min.js +1 -1
- package/dist/plugin/clipboard/src/constants/platform.d.ts +10 -0
- package/dist/plugin/clipboard/src/plugin/app/utils/try-open-url.d.ts +15 -0
- package/dist/plugin/clipboard/src/plugin/fullscreen/types/fullscreen-electron.d.ts +10 -0
- package/dist/plugin/clipboard/src/plugin/fullscreen/types/fullscreen.d.ts +4 -3
- package/dist/plugin/clipboard/src/types/native.d.ts +8 -0
- package/dist/plugin/clipboard/src/types/platform.d.ts +0 -3
- package/dist/plugin/fullscreen/index.cjs +62 -28
- package/dist/plugin/fullscreen/index.d.ts +132 -3
- package/dist/plugin/fullscreen/index.min.cjs +1 -1
- package/dist/plugin/fullscreen/index.min.mjs +1 -1
- package/dist/plugin/fullscreen/index.mjs +62 -28
- package/dist/plugin/fullscreen/index.umd.js +62 -28
- package/dist/plugin/fullscreen/index.umd.min.js +1 -1
- package/dist/plugin/fullscreen/src/constants/platform.d.ts +10 -0
- package/dist/plugin/fullscreen/src/plugin/app/utils/try-open-url.d.ts +15 -0
- package/dist/plugin/fullscreen/src/plugin/fullscreen/types/fullscreen-electron.d.ts +10 -0
- package/dist/plugin/fullscreen/src/plugin/fullscreen/types/fullscreen.d.ts +4 -3
- package/dist/plugin/fullscreen/src/types/native.d.ts +8 -0
- package/dist/plugin/fullscreen/src/types/platform.d.ts +0 -3
- package/dist/plugin/theme/index.cjs +24 -11
- package/dist/plugin/theme/index.d.ts +150 -0
- package/dist/plugin/theme/index.min.cjs +1 -1
- package/dist/plugin/theme/index.min.mjs +1 -1
- package/dist/plugin/theme/index.mjs +24 -11
- package/dist/plugin/theme/index.umd.js +24 -11
- package/dist/plugin/theme/index.umd.min.js +1 -1
- package/dist/plugin/theme/src/constants/platform.d.ts +10 -0
- package/dist/plugin/theme/src/plugin/app/utils/try-open-url.d.ts +15 -0
- package/dist/plugin/theme/src/plugin/fullscreen/types/fullscreen-electron.d.ts +10 -0
- package/dist/plugin/theme/src/plugin/fullscreen/types/fullscreen.d.ts +4 -3
- package/dist/plugin/theme/src/types/native.d.ts +8 -0
- package/dist/plugin/theme/src/types/platform.d.ts +0 -3
- package/dist/src/constants/platform.d.ts +10 -0
- package/dist/src/plugin/app/utils/try-open-url.d.ts +15 -0
- package/dist/src/plugin/fullscreen/types/fullscreen-electron.d.ts +10 -0
- package/dist/src/plugin/fullscreen/types/fullscreen.d.ts +4 -3
- package/dist/src/types/native.d.ts +8 -0
- package/dist/src/types/platform.d.ts +0 -3
- package/package.json +1 -1
package/dist/native.umd.min.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(e,o){"object"==typeof exports&&"undefined"!=typeof module?module.exports=o():"function"==typeof define&&define.amd?define(o):(e="undefined"!=typeof globalThis?globalThis:e||self).Native=o()}(this,(function(){"use strict";var e="1.0.60";function o(){for(var e=[],o=0;o<arguments.length;o++)e[o]=arguments[o];for(var r=Object(e[0]),i=1;i<e.length;i++){var n=e[i];if(null!=n)for(var t in n)Object.prototype.hasOwnProperty.call(n,t)&&"__proto__"!==t&&"constructor"!==t&&"prototype"!==t&&(r[t]=n[t])}return r}var r,i,n,t,a=function(e,o){function r(i){if(!(this instanceof r))return new r(i);var n=new o(i||"");if("function"==typeof Object.setPrototypeOf?Object.setPrototypeOf(n,r.prototype):n.__proto__=r.prototype,n.name=e,void 0!==i&&(n.message=i),"undefined"!=typeof Symbol&&Symbol.toStringTag)try{Object.defineProperty(n,Symbol.toStringTag,{value:e,writable:!1,enumerable:!1,configurable:!0})}catch(e){}if("function"==typeof Error.captureStackTrace)Error.captureStackTrace(n,r);else if(o.captureStackTrace&&"function"==typeof o.captureStackTrace)o.captureStackTrace(n,r);else try{var t=new o;t.stack&&(n.stack=t.stack)}catch(e){}return n}void 0===o&&(o=Error),r.prototype=Object.create(o.prototype,{constructor:{value:r,writable:!0,enumerable:!1,configurable:!0}});try{Object.defineProperty(r.prototype,"name",{value:e,writable:!0,enumerable:!1,configurable:!0})}catch(o){try{r.prototype.name=e}catch(e){}}try{Object.defineProperty(r,"name",{value:e,writable:!1,enumerable:!1,configurable:!0})}catch(e){}return r}("PluginNotExtendedError");!function(e){e.Unknown="Unknown",e.Android="Android",e.iOS="iOS",e.Windows="Windows",e.MacOS="MacOS"}(r||(r={})),function(e){e.Unknown="Unknown",e.Mobile="Mobile",e.Desktop="Desktop"}(i||(i={})),function(e){e.Unknown="Unknown",e.EdgeHTML="EdgeHTML",e.ArkWeb="ArkWeb",e.Blink="Blink",e.Presto="Presto",e.WebKit="WebKit",e.Trident="Trident",e.NetFront="NetFront",e.KHTML="KHTML",e.Tasman="Tasman",e.Gecko="Gecko"}(n||(n={})),function(e){e.Unknown="Unknown",e.Chrome="Chrome",e.Safari="Safari",e.Edge="Edge",e.Firefox="Firefox",e.Opera="Opera",e.IE="IE",e.SamsungInternet="SamsungInternet"}(t||(t={}));var s="undefined"!=typeof navigator&&"string"==typeof navigator.userAgent?navigator.userAgent:"",m={device:i.Unknown,os:r.Unknown,osVersion:"",engine:n.Unknown,engineVersion:"",browser:t.Unknown,browserVersion:"",renderer:function(){if(void 0===globalThis.document)return"";var e=globalThis.document.createElement("canvas");if("function"!=typeof e.getContext)return"";var o=e.getContext("webgl2")||e.getContext("experimental-webgl")||e.getContext("webgl");if(null===o)return"";if(o instanceof WebGLRenderingContext||"getParameter"in o&&"function"==typeof o.getParameter){var r=o.getExtension("WEBGL_debug_renderer_info");return null===r?o.getParameter(o.RENDERER):o.getParameter(r.UNMASKED_RENDERER_WEBGL)}return""}(),userAgent:s,isMobile:!1,isDesktop:!1,isStandalone:!1,isWebview:/; ?wv|applewebkit(?!.*safari)/i.test(s),isNodeJS:void 0!==globalThis.process&&void 0!==globalThis.process.versions&&void 0!==globalThis.process.versions.node,isElectron:void 0!==globalThis.process&&void 0!==globalThis.process.versions&&void 0!==globalThis.process.versions.electron||/ electron\//i.test(s),isReactNative:"undefined"!=typeof navigator&&"ReactNative"===navigator.product},l=[[/windows nt (6\.[23]); arm/i,r.Windows,f],[/windows (?:phone|mobile|iot)(?: os)?[\/ ]?([\d.]*( se)?)/i,r.Windows,f],[/windows[\/ ](1[01]|2000|3\.1|7|8(\.1)?|9[58]|me|server 20\d\d( r2)?|vista|xp)/i,r.Windows,f],[/windows nt ?([\d.)]*)(?!.+xbox)/i,r.Windows,f],[/\bwin(?=3| ?9|n)(?:nt| 9x )?([\d.;]*)/i,r.Windows,f],[/windows ce\/?([\d.]*)/i,r.Windows,f],[/[adehimnop]{4,7}\b(?:.*os (\w+) like mac|; opera)/i,r.iOS,u],[/(?:ios;fbsv|ios(?=.+ip(?:ad|hone))|ip(?:ad|hone)(?: |.+i(?:pad)?)os)[\/ ]([\w.]+)/i,r.iOS,u],[/cfnetwork\/.+darwin/i,r.iOS,u],[/mac os x ?([\w. ]*)/i,r.MacOS,u],[/(?:macintosh|mac_powerpc\b)(?!.+(haiku|morphos))/i,r.MacOS,u],[/droid ([\w.]+)\b.+(android[- ]x86)/i,r.Android],[/android\w*[-\/.; ]?([\d.]*)/i,r.Android]],d=[[/windows.+ edge\/([\w.]+)/i,n.EdgeHTML],[/arkweb\/([\w.]+)/i,n.ArkWeb],[/webkit\/537\.36.+chrome\/(?!27)([\w.]+)/i,n.Blink],[/presto\/([\w.]+)/i,n.Presto],[/webkit\/([\w.]+)/i,n.WebKit],[/trident\/([\w.]+)/i,n.Trident],[/netfront\/([\w.]+)/i,n.NetFront],[/khtml[\/ ]\(?([\w.]+)/i,n.KHTML],[/tasman[\/ ]\(?([\w.]+)/i,n.Tasman],[/rv:([\w.]{1,9})\b.+gecko/i,n.Gecko]],c=[[/\b(?:crmo|crios)\/([\w.]+)/i,t.Chrome],[/webview.+edge\/([\w.]+)/i,t.Edge],[/edg(?:e|ios|a)?\/([\w.]+)/i,t.Edge],[/opera mini\/([-\w.]+)/i,t.Opera],[/opera [mobileta]{3,6}\b.+version\/([-\w.]+)/i,t.Opera],[/opera(?:.+version\/|[\/ ]+)([\w.]+)/i,t.Opera],[/opios[\/ ]+([\w.]+)/i,t.Opera],[/\bop(?:rg)?x\/([\w.]+)/i,t.Opera],[/\bopr\/([\w.]+)/i,t.Opera],[/iemobile(?:browser|boat|jet)[\/ ]?([\d.]*)/i,t.IE],[/(?:ms|\()ie ([\w.]+)/i,t.IE],[/trident.+rv[: ]([\w.]{1,9})\b.+like gecko/i,t.IE],[/\bfocus\/([\w.]+)/i,t.Firefox],[/\bopt\/([\w.]+)/i,t.Opera],[/coast\/([\w.]+)/i,t.Opera],[/fxios\/([\w.-]+)/i,t.Firefox],[/samsungbrowser\/([\w.]+)/i,t.SamsungInternet],[/headlesschrome(?:\/([\w.]+)| )/i,t.Chrome],[/wv\).+chrome\/([\w.]+).+edgw\//i,t.Edge],[/ wv\).+(chrome)\/([\w.]+)/i,t.Chrome],[/chrome\/([\w.]+) mobile/i,t.Chrome],[/chrome\/v?([\w.]+)/i,t.Chrome],[/version\/([\w.,]+) .*mobile(?:\/\w+ | ?)safari/i,t.Safari],[/iphone .*mobile(?:\/\w+ | ?)safari/i,t.Safari],[/version\/([\w.,]+) .*safari/i,t.Safari],[/webkit.+?(?:mobile ?safari|safari)(\/[\w.]+)/i,t.Safari,"1"],[/(?:mobile|tablet);.*firefox\/([\w.-]+)/i,t.Firefox],[/mobile vr; rv:([\w.]+)\).+firefox/i,t.Firefox],[/firefox\/([\w.]+)/i,t.Firefox]];function f(e){if(void 0===e)return"";var o={"4.90":"ME","NT3.51":"NT 3.11","NT4.0":"NT 4.0","NT 5.0":"2000","NT 5.1":"XP","NT 5.2":"XP","NT 6.0":"Vista","NT 6.1":"7","NT 6.2":"8","NT 6.3":"8.1","NT 6.4":"10","NT 10.0":"10",ARM:"RT"}[e];return void 0!==o?o:e}function u(e){return void 0===e?"":e.replace(/_/g,".")}function b(e,o){return 10===e.major&&0===e.minor&&e.build>=22e3?"11":10===e.major&&0===e.minor&&e.build<22e3?"10":6===e.major&&3===e.minor?"8.1":6===e.major&&2===e.minor?"8":6===e.major&&1===e.minor?"7":6===e.major&&0===e.minor?"Vista":5===e.major&&1===e.minor||5===e.major&&2===e.minor?"XP":5===e.major&&0===e.minor?"2000":4===e.major&&90===e.minor?"ME":4===e.major&&0===e.minor?"NT 4.0":3===e.major&&51===e.minor?"NT 3.11":o}function w(e,o){return"function"==typeof o?o(e):"string"==typeof o?o:void 0===e?"":e}function p(e){var o=e.split(".");return{major:parseInt(o[0]||"0"),minor:parseInt(o[1]||"0"),build:parseInt(o[2]||"0")}}for(var g=0;g<l.length;g++){var v=(y=l[g])[0],h=y[1],j=y[2];if(null!==(T=m.userAgent.match(v))){m.os=h,m.osVersion=w(T[1],j);break}}m.os===r.iOS&&0===function(e,o){for(var r=e.split("."),i=o.split("."),n=Math.max(r.length,i.length),t=0;t<n;t++){var a=void 0,s=void 0;if((a=t<r.length?parseInt(r[t],10):0)>(s=t<i.length?parseInt(i[t],10):0))return 1;if(a<s)return-1}return 0}(m.osVersion,"18.6")&&(null!==(S=/\) Version\/([\d.]+)/.exec(m.userAgent))&&parseInt(S[1].substring(0,2),10)>=26&&(m.osVersion=S[1]));for(g=0;g<d.length;g++){v=(y=d[g])[0];var k=y[1];j=y[2];if(null!==(T=m.userAgent.match(v))){m.engine=k,m.engineVersion=w(T[1],j);break}}for(g=0;g<c.length;g++){v=(y=c[g])[0];var y,T,O=y[1];j=y[2];if(null!==(T=m.userAgent.match(v))){m.browser=O,m.browserVersion=w(T[1],j);break}}if(m.isReactNative)try{h=(x=require("react-native").Platform).OS;var S=p(E=""+x.Version);switch(h){case"android":m.os=r.Android,m.osVersion=function(e,o){return e.major>=36?"16":35===e.major?"15":34===e.major?"14":33===e.major?"13":32===e.major?"12.1":31===e.major?"12":30===e.major?"11":29===e.major?"10":28===e.major?"9":27===e.major?"8.1":26===e.major?"8.0":25===e.major?"7.1":24===e.major?"7.0":23===e.major?"6.0":22===e.major?"5.1":21===e.major?"5.0":20===e.major?"4.4W":19===e.major?"4.4":18===e.major?"4.3":17===e.major?"4.2":16===e.major?"4.1":15===e.major?"4.0.3":14===e.major?"4.0":13===e.major?"3.2":12===e.major?"3.1":11===e.major?"3.0":10===e.major?"2.3.3":9===e.major?"2.3":8===e.major?"2.2":7===e.major?"2.1":6===e.major?"2.0.1":5===e.major?"2.0":4===e.major?"1.6":3===e.major?"1.5":2===e.major?"1.1":1===e.major?"1.0":o}(S,E);break;case"ios":m.os=r.iOS,m.osVersion=E;break;case"windows":m.os=r.Windows,m.osVersion=b(S,E);break;case"macos":m.os=r.MacOS,m.osVersion=E}}catch(e){}if(m.isNodeJS)try{var E,x=(h=require("os")).platform();S=p(E=h.release());switch(x){case"win32":m.os=r.Windows,m.osVersion=b(S,E);break;case"darwin":m.os=r.MacOS,m.osVersion=function(e,o){return e.major>=24?e.major-9+"."+e.minor+"."+e.build:23===e.major?"14."+e.minor+"."+e.build:22===e.major?"13."+e.minor+"."+e.build:21===e.major?"12."+e.minor+"."+e.build:20===e.major?"11."+e.minor+"."+e.build:19===e.major?"10.15."+e.minor:18===e.major?"10.14."+e.minor:17===e.major?"10.13."+e.minor:16===e.major?"10.12."+e.minor:15===e.major?"10.11."+e.minor:14===e.major?"10.10."+e.minor:13===e.major?"10.9."+e.minor:e.major>=5&&e.major<=12?"10."+(e.major-4)+"."+e.minor:o}(S,E);break;case"android":m.os=r.Android,m.osVersion=E;break;case"linux":/android/i.test(E)&&(m.os=r.Android,m.osVersion=E)}}catch(e){}void 0!==navigator.userAgentData&&void 0!==navigator.userAgentData.getHighEntropyValues&&navigator.userAgentData.getHighEntropyValues(["brands","fullVersionList","mobile","model","platform","platformVersion","architecture","formFactors","bitness","uaFullVersion","wow64"]).then((function(e){for(var o,i=e.fullVersionList||e.brands||[],n=e.platformVersion,t=0;t<i.length;t++){var a=null==(o=i[t])?{brand:"",version:""}:"string"==typeof o?{brand:o,version:""}:{brand:o.brand,version:o.version},s=a.brand,l=a.version;/not.a.brand/i.test(s)||"Chromium"===s&&(m.engineVersion=l)}"string"==typeof n&&(m.os===r.Windows&&parseInt(n.replace(/[^\d.]/g,"").split(".")[0],10)>=13?m.osVersion="11":m.osVersion=n)})),m.device=m.os===r.iOS||m.os===r.Android?i.Mobile:m.os===r.Windows||m.os===r.MacOS?i.Desktop:i.Unknown,m.isMobile=m.device===i.Mobile,m.isDesktop=m.device===i.Desktop,m.isStandalone=function(e){return"matchMedia"in globalThis&&(e===r.iOS?"standalone"in navigator&&!!navigator.standalone:globalThis.matchMedia("(display-mode: standalone)").matches)}(m.os),function(){if("object"!=typeof globalThis){Object.defineProperty(Object.prototype,"__getGlobalThis__",{get:function(){return this},configurable:!0});try{var e=__getGlobalThis__;Object.defineProperty(e,"globalThis",{value:e,writable:!0,configurable:!0})}finally{delete Object.prototype.__getGlobalThis__}}}();var V=new Proxy({Version:e,Constants:{},Errors:{PluginNotExtendedError:a},extends:function(e){return e.installed||(this.Constants=o(this.Constants,e.Constants),this.Errors=o(this.Errors,e.Errors),this[e.name]=e.module,e.installed=!0),this}},{get:function(e,o,r){if(o in e)return Reflect.get(e,o,r);throw new a(o.toString()+" is not extended yet. Call Native.extends(plugin) first.")}}),N={installed:!1,name:"Platform",module:m,Constants:{OS:r,Devices:i,Engines:n,Browsers:t},Errors:{}};return V.extends(N),V}));
|
|
1
|
+
!function(e,o){"object"==typeof exports&&"undefined"!=typeof module?module.exports=o():"function"==typeof define&&define.amd?define(o):(e="undefined"!=typeof globalThis?globalThis:e||self).Native=o()}(this,(function(){"use strict";var e="1.0.62";function o(){for(var e=[],o=0;o<arguments.length;o++)e[o]=arguments[o];for(var r=Object(e[0]),i=1;i<e.length;i++){var n=e[i];if(null!=n)for(var t in n)Object.prototype.hasOwnProperty.call(n,t)&&"__proto__"!==t&&"constructor"!==t&&"prototype"!==t&&(r[t]=n[t])}return r}var r,i,n,t,a=function(e,o){function r(i){if(!(this instanceof r))return new r(i);var n=new o(i||"");if("function"==typeof Object.setPrototypeOf?Object.setPrototypeOf(n,r.prototype):n.__proto__=r.prototype,n.name=e,void 0!==i&&(n.message=i),"undefined"!=typeof Symbol&&Symbol.toStringTag)try{Object.defineProperty(n,Symbol.toStringTag,{value:e,writable:!1,enumerable:!1,configurable:!0})}catch(e){}if("function"==typeof Error.captureStackTrace)Error.captureStackTrace(n,r);else if(o.captureStackTrace&&"function"==typeof o.captureStackTrace)o.captureStackTrace(n,r);else try{var t=new o;t.stack&&(n.stack=t.stack)}catch(e){}return n}void 0===o&&(o=Error),r.prototype=Object.create(o.prototype,{constructor:{value:r,writable:!0,enumerable:!1,configurable:!0}});try{Object.defineProperty(r.prototype,"name",{value:e,writable:!0,enumerable:!1,configurable:!0})}catch(o){try{r.prototype.name=e}catch(e){}}try{Object.defineProperty(r,"name",{value:e,writable:!1,enumerable:!1,configurable:!0})}catch(e){}return r}("PluginNotExtendedError");!function(e){e.Unknown="Unknown",e.Android="Android",e.iOS="iOS",e.Windows="Windows",e.MacOS="MacOS"}(r||(r={})),function(e){e.Unknown="Unknown",e.Mobile="Mobile",e.Desktop="Desktop"}(i||(i={})),function(e){e.Unknown="Unknown",e.EdgeHTML="EdgeHTML",e.ArkWeb="ArkWeb",e.Blink="Blink",e.Presto="Presto",e.WebKit="WebKit",e.Trident="Trident",e.NetFront="NetFront",e.KHTML="KHTML",e.Tasman="Tasman",e.Gecko="Gecko"}(n||(n={})),function(e){e.Unknown="Unknown",e.Chrome="Chrome",e.Safari="Safari",e.Edge="Edge",e.Firefox="Firefox",e.Opera="Opera",e.IE="IE",e.SamsungInternet="SamsungInternet"}(t||(t={}));var s=void 0!==globalThis.navigator&&"string"==typeof globalThis.navigator.userAgent?globalThis.navigator.userAgent:"",l=void 0!==globalThis.process&&void 0!==globalThis.process.versions&&void 0!==globalThis.process.versions.node;void 0!==globalThis.process&&void 0!==globalThis.process.versions&&void 0!==globalThis.process.versions.electron||/ electron\//i.test(s);var d=void 0!==globalThis.navigator&&"ReactNative"===globalThis.navigator.product,m={device:i.Unknown,os:r.Unknown,osVersion:"",engine:n.Unknown,engineVersion:"",browser:t.Unknown,browserVersion:"",renderer:function(){if(void 0===globalThis.document)return"";var e=globalThis.document.createElement("canvas");if("function"!=typeof e.getContext)return"";var o=e.getContext("webgl2")||e.getContext("experimental-webgl")||e.getContext("webgl");if(null===o)return"";if(o instanceof WebGLRenderingContext||"getParameter"in o&&"function"==typeof o.getParameter){var r=o.getExtension("WEBGL_debug_renderer_info");return null===r?o.getParameter(o.RENDERER):o.getParameter(r.UNMASKED_RENDERER_WEBGL)}return""}(),userAgent:s,isMobile:!1,isDesktop:!1,isStandalone:!1,isWebview:/; ?wv|applewebkit(?!.*safari)/i.test(s)},c=[[/windows nt (6\.[23]); arm/i,r.Windows,b],[/windows (?:phone|mobile|iot)(?: os)?[\/ ]?([\d.]*( se)?)/i,r.Windows,b],[/windows[\/ ](1[01]|2000|3\.1|7|8(\.1)?|9[58]|me|server 20\d\d( r2)?|vista|xp)/i,r.Windows,b],[/windows nt ?([\d.)]*)(?!.+xbox)/i,r.Windows,b],[/\bwin(?=3| ?9|n)(?:nt| 9x )?([\d.;]*)/i,r.Windows,b],[/windows ce\/?([\d.]*)/i,r.Windows,b],[/[adehimnop]{4,7}\b(?:.*os (\w+) like mac|; opera)/i,r.iOS,w],[/(?:ios;fbsv|ios(?=.+ip(?:ad|hone))|ip(?:ad|hone)(?: |.+i(?:pad)?)os)[\/ ]([\w.]+)/i,r.iOS,w],[/cfnetwork\/.+darwin/i,r.iOS,w],[/mac os x ?([\w. ]*)/i,r.MacOS,w],[/(?:macintosh|mac_powerpc\b)(?!.+(haiku|morphos))/i,r.MacOS,w],[/droid ([\w.]+)\b.+(android[- ]x86)/i,r.Android],[/android\w*[-\/.; ]?([\d.]*)/i,r.Android]],f=[[/windows.+ edge\/([\w.]+)/i,n.EdgeHTML],[/arkweb\/([\w.]+)/i,n.ArkWeb],[/webkit\/537\.36.+chrome\/(?!27)([\w.]+)/i,n.Blink],[/presto\/([\w.]+)/i,n.Presto],[/webkit\/([\w.]+)/i,n.WebKit],[/trident\/([\w.]+)/i,n.Trident],[/netfront\/([\w.]+)/i,n.NetFront],[/khtml[\/ ]\(?([\w.]+)/i,n.KHTML],[/tasman[\/ ]\(?([\w.]+)/i,n.Tasman],[/rv:([\w.]{1,9})\b.+gecko/i,n.Gecko]],u=[[/\b(?:crmo|crios)\/([\w.]+)/i,t.Chrome],[/webview.+edge\/([\w.]+)/i,t.Edge],[/edg(?:e|ios|a)?\/([\w.]+)/i,t.Edge],[/opera mini\/([-\w.]+)/i,t.Opera],[/opera [mobileta]{3,6}\b.+version\/([-\w.]+)/i,t.Opera],[/opera(?:.+version\/|[\/ ]+)([\w.]+)/i,t.Opera],[/opios[\/ ]+([\w.]+)/i,t.Opera],[/\bop(?:rg)?x\/([\w.]+)/i,t.Opera],[/\bopr\/([\w.]+)/i,t.Opera],[/iemobile(?:browser|boat|jet)[\/ ]?([\d.]*)/i,t.IE],[/(?:ms|\()ie ([\w.]+)/i,t.IE],[/trident.+rv[: ]([\w.]{1,9})\b.+like gecko/i,t.IE],[/\bfocus\/([\w.]+)/i,t.Firefox],[/\bopt\/([\w.]+)/i,t.Opera],[/coast\/([\w.]+)/i,t.Opera],[/fxios\/([\w.-]+)/i,t.Firefox],[/samsungbrowser\/([\w.]+)/i,t.SamsungInternet],[/headlesschrome(?:\/([\w.]+)| )/i,t.Chrome],[/wv\).+chrome\/([\w.]+).+edgw\//i,t.Edge],[/ wv\).+(chrome)\/([\w.]+)/i,t.Chrome],[/chrome\/([\w.]+) mobile/i,t.Chrome],[/chrome\/v?([\w.]+)/i,t.Chrome],[/version\/([\w.,]+) .*mobile(?:\/\w+ | ?)safari/i,t.Safari],[/iphone .*mobile(?:\/\w+ | ?)safari/i,t.Safari],[/version\/([\w.,]+) .*safari/i,t.Safari],[/webkit.+?(?:mobile ?safari|safari)(\/[\w.]+)/i,t.Safari,"1"],[/(?:mobile|tablet);.*firefox\/([\w.-]+)/i,t.Firefox],[/mobile vr; rv:([\w.]+)\).+firefox/i,t.Firefox],[/firefox\/([\w.]+)/i,t.Firefox]];function b(e){if(void 0===e)return"";var o={"4.90":"ME","NT3.51":"NT 3.11","NT4.0":"NT 4.0","NT 5.0":"2000","NT 5.1":"XP","NT 5.2":"XP","NT 6.0":"Vista","NT 6.1":"7","NT 6.2":"8","NT 6.3":"8.1","NT 6.4":"10","NT 10.0":"10",ARM:"RT"}[e];return void 0!==o?o:e}function w(e){return void 0===e?"":e.replace(/_/g,".")}function g(e,o){return 10===e.major&&0===e.minor&&e.build>=22e3?"11":10===e.major&&0===e.minor&&e.build<22e3?"10":6===e.major&&3===e.minor?"8.1":6===e.major&&2===e.minor?"8":6===e.major&&1===e.minor?"7":6===e.major&&0===e.minor?"Vista":5===e.major&&1===e.minor||5===e.major&&2===e.minor?"XP":5===e.major&&0===e.minor?"2000":4===e.major&&90===e.minor?"ME":4===e.major&&0===e.minor?"NT 4.0":3===e.major&&51===e.minor?"NT 3.11":o}function p(e,o){return"function"==typeof o?o(e):"string"==typeof o?o:void 0===e?"":e}function v(e){var o=e.split(".");return{major:parseInt(o[0]||"0"),minor:parseInt(o[1]||"0"),build:parseInt(o[2]||"0")}}for(var h=0;h<c.length;h++){var j=(x=c[h])[0],T=x[1],k=x[2];if(null!==(O=m.userAgent.match(j))){m.os=T,m.osVersion=p(O[1],k);break}}m.os===r.iOS&&0===function(e,o){for(var r=e.split("."),i=o.split("."),n=Math.max(r.length,i.length),t=0;t<n;t++){var a=void 0,s=void 0;if((a=t<r.length?parseInt(r[t],10):0)>(s=t<i.length?parseInt(i[t],10):0))return 1;if(a<s)return-1}return 0}(m.osVersion,"18.6")&&(null!==(E=/\) Version\/([\d.]+)/.exec(m.userAgent))&&parseInt(E[1].substring(0,2),10)>=26&&(m.osVersion=E[1]));for(h=0;h<f.length;h++){j=(x=f[h])[0];var y=x[1];k=x[2];if(null!==(O=m.userAgent.match(j))){m.engine=y,m.engineVersion=p(O[1],k);break}}for(h=0;h<u.length;h++){j=(x=u[h])[0];var x,O,S=x[1];k=x[2];if(null!==(O=m.userAgent.match(j))){m.browser=S,m.browserVersion=p(O[1],k);break}}if(d)try{T=(N=require("react-native").Platform).OS;var E=v(V=""+N.Version);switch(T){case"android":m.os=r.Android,m.osVersion=function(e,o){return e.major>=36?"16":35===e.major?"15":34===e.major?"14":33===e.major?"13":32===e.major?"12.1":31===e.major?"12":30===e.major?"11":29===e.major?"10":28===e.major?"9":27===e.major?"8.1":26===e.major?"8.0":25===e.major?"7.1":24===e.major?"7.0":23===e.major?"6.0":22===e.major?"5.1":21===e.major?"5.0":20===e.major?"4.4W":19===e.major?"4.4":18===e.major?"4.3":17===e.major?"4.2":16===e.major?"4.1":15===e.major?"4.0.3":14===e.major?"4.0":13===e.major?"3.2":12===e.major?"3.1":11===e.major?"3.0":10===e.major?"2.3.3":9===e.major?"2.3":8===e.major?"2.2":7===e.major?"2.1":6===e.major?"2.0.1":5===e.major?"2.0":4===e.major?"1.6":3===e.major?"1.5":2===e.major?"1.1":1===e.major?"1.0":o}(E,V);break;case"ios":m.os=r.iOS,m.osVersion=V;break;case"windows":m.os=r.Windows,m.osVersion=g(E,V);break;case"macos":m.os=r.MacOS,m.osVersion=V}}catch(e){}if(l)try{var V,N=(T=require("os")).platform();E=v(V=T.release());switch(N){case"win32":m.os=r.Windows,m.osVersion=g(E,V);break;case"darwin":m.os=r.MacOS,m.osVersion=function(e,o){return e.major>=24?e.major-9+"."+e.minor+"."+e.build:23===e.major?"14."+e.minor+"."+e.build:22===e.major?"13."+e.minor+"."+e.build:21===e.major?"12."+e.minor+"."+e.build:20===e.major?"11."+e.minor+"."+e.build:19===e.major?"10.15."+e.minor:18===e.major?"10.14."+e.minor:17===e.major?"10.13."+e.minor:16===e.major?"10.12."+e.minor:15===e.major?"10.11."+e.minor:14===e.major?"10.10."+e.minor:13===e.major?"10.9."+e.minor:e.major>=5&&e.major<=12?"10."+(e.major-4)+"."+e.minor:o}(E,V);break;case"android":m.os=r.Android,m.osVersion=V;break;case"linux":/android/i.test(V)&&(m.os=r.Android,m.osVersion=V)}}catch(e){}document.addEventListener("deviceready",(function(){if(m.os===r.Unknown&&void 0!==globalThis.device){switch(globalThis.device.platform){case"Android":m.os=r.Android;break;case"iOS":m.os=r.iOS}m.osVersion=globalThis.device.version}}),!1),void 0!==navigator.userAgentData&&void 0!==navigator.userAgentData.getHighEntropyValues&&navigator.userAgentData.getHighEntropyValues(["brands","fullVersionList","mobile","model","platform","platformVersion","architecture","formFactors","bitness","uaFullVersion","wow64"]).then((function(e){for(var o,i=e.fullVersionList||e.brands||[],n=e.platformVersion,t=0;t<i.length;t++){var a=null==(o=i[t])?{brand:"",version:""}:"string"==typeof o?{brand:o,version:""}:{brand:o.brand,version:o.version},s=a.brand,l=a.version;/not.a.brand/i.test(s)||"Chromium"===s&&(m.engineVersion=l)}"string"==typeof n&&(m.os===r.Windows&&parseInt(n.replace(/[^\d.]/g,"").split(".")[0],10)>=13?m.osVersion="11":m.osVersion=n)})),m.device=m.os===r.iOS||m.os===r.Android?i.Mobile:m.os===r.Windows||m.os===r.MacOS?i.Desktop:i.Unknown,m.isMobile=m.device===i.Mobile,m.isDesktop=m.device===i.Desktop,m.isStandalone=function(e){return"matchMedia"in globalThis&&(e===r.iOS?"standalone"in navigator&&!!navigator.standalone:globalThis.matchMedia("(display-mode: standalone)").matches)}(m.os),function(){if("object"!=typeof globalThis){Object.defineProperty(Object.prototype,"__getGlobalThis__",{get:function(){return this},configurable:!0});try{var e=__getGlobalThis__;Object.defineProperty(e,"globalThis",{value:e,writable:!0,configurable:!0})}finally{delete Object.prototype.__getGlobalThis__}}}();var A=new Proxy({Version:e,Constants:{},Errors:{PluginNotExtendedError:a},get Platform(){throw new a("Platform is not extended yet. Call Native.extends(plugin) first.")},get App(){throw new a("App is not extended yet. Call Native.extends(plugin) first.")},get Clipboard(){throw new a("Clipboard is not extended yet. Call Native.extends(plugin) first.")},get Fullscreen(){throw new a("Fullscreen is not extended yet. Call Native.extends(plugin) first.")},extends:function(e){return e.installed||(this.Constants=o(this.Constants,e.Constants),this.Errors=o(this.Errors,e.Errors),this[e.name]=e.module,e.installed=!0),this}},{get:function(e,o,r){if(o in e)return Reflect.get(e,o,r);throw new a(o.toString()+" is not extended yet. Call Native.extends(plugin) first.")}}),_={installed:!1,name:"Platform",module:m,Constants:{OS:r,Devices:i,Engines:n,Browsers:t},Errors:{}};return A.extends(_),A}));
|
|
@@ -77,7 +77,11 @@ var Browsers;
|
|
|
77
77
|
Browsers["IE"] = "IE";
|
|
78
78
|
Browsers["SamsungInternet"] = "SamsungInternet";
|
|
79
79
|
})(Browsers || (Browsers = {}));
|
|
80
|
-
var userAgent = typeof navigator !== 'undefined' && typeof navigator.userAgent === 'string' ? navigator.userAgent : '';
|
|
80
|
+
var userAgent = typeof globalThis.navigator !== 'undefined' && typeof globalThis.navigator.userAgent === 'string' ? globalThis.navigator.userAgent : '';
|
|
81
|
+
var IS_NODE_JS = typeof globalThis.process !== 'undefined' && typeof globalThis.process.versions !== 'undefined' && globalThis.process.versions.node !== undefined;
|
|
82
|
+
var IS_ELECTRON = (typeof globalThis.process !== 'undefined' && typeof globalThis.process.versions !== 'undefined' && globalThis.process.versions.electron !== undefined) || (/ electron\//i.test(userAgent));
|
|
83
|
+
var IS_REACT_NATIVE = typeof globalThis.navigator !== 'undefined' && globalThis.navigator.product === 'ReactNative';
|
|
84
|
+
var IS_CORDOVA = typeof globalThis.cordova !== 'undefined';
|
|
81
85
|
var Platform = {
|
|
82
86
|
device: Devices.Unknown,
|
|
83
87
|
os: OS.Unknown,
|
|
@@ -92,9 +96,6 @@ var Platform = {
|
|
|
92
96
|
isDesktop: false,
|
|
93
97
|
isStandalone: false,
|
|
94
98
|
isWebview: /; ?wv|applewebkit(?!.*safari)/i.test(userAgent),
|
|
95
|
-
isNodeJS: typeof globalThis.process !== 'undefined' && typeof globalThis.process.versions !== 'undefined' && globalThis.process.versions.node !== undefined,
|
|
96
|
-
isElectron: (typeof globalThis.process !== 'undefined' && typeof globalThis.process.versions !== 'undefined' && globalThis.process.versions.electron !== undefined) || (/ electron\//i.test(userAgent)),
|
|
97
|
-
isReactNative: typeof navigator !== 'undefined' && navigator.product === 'ReactNative'
|
|
98
99
|
};
|
|
99
100
|
var OS_RESOLVER_MAP = [
|
|
100
101
|
[/windows nt (6\.[23]); arm/i, OS.Windows, resolveWindowsVersion],
|
|
@@ -404,7 +405,7 @@ for (var i = 0; i < BROWSER_RESOLVER_MAP.length; i++) {
|
|
|
404
405
|
break;
|
|
405
406
|
}
|
|
406
407
|
}
|
|
407
|
-
if (
|
|
408
|
+
if (IS_REACT_NATIVE) {
|
|
408
409
|
try {
|
|
409
410
|
var reactNative = require('react-native');
|
|
410
411
|
var platform = reactNative.Platform;
|
|
@@ -433,7 +434,7 @@ if (Platform.isReactNative) {
|
|
|
433
434
|
catch (_) {
|
|
434
435
|
}
|
|
435
436
|
}
|
|
436
|
-
if (
|
|
437
|
+
if (IS_NODE_JS) {
|
|
437
438
|
try {
|
|
438
439
|
var os = require('os');
|
|
439
440
|
var platform = os.platform();
|
|
@@ -463,6 +464,20 @@ if (Platform.isNodeJS) {
|
|
|
463
464
|
catch (_) {
|
|
464
465
|
}
|
|
465
466
|
}
|
|
467
|
+
document.addEventListener("deviceready", function () {
|
|
468
|
+
IS_CORDOVA = true;
|
|
469
|
+
if (Platform.os === OS.Unknown && typeof globalThis.device !== 'undefined') {
|
|
470
|
+
switch (globalThis.device.platform) {
|
|
471
|
+
case 'Android':
|
|
472
|
+
Platform.os = OS.Android;
|
|
473
|
+
break;
|
|
474
|
+
case 'iOS':
|
|
475
|
+
Platform.os = OS.iOS;
|
|
476
|
+
break;
|
|
477
|
+
}
|
|
478
|
+
Platform.osVersion = globalThis.device.version;
|
|
479
|
+
}
|
|
480
|
+
}, false);
|
|
466
481
|
if (navigator.userAgentData !== undefined && navigator.userAgentData.getHighEntropyValues !== undefined) {
|
|
467
482
|
navigator
|
|
468
483
|
.userAgentData
|
|
@@ -492,7 +507,7 @@ Platform.isMobile = Platform.device === Devices.Mobile;
|
|
|
492
507
|
Platform.isDesktop = Platform.device === Devices.Desktop;
|
|
493
508
|
Platform.isStandalone = getIsStandalone(Platform.os);
|
|
494
509
|
|
|
495
|
-
function capitalize(
|
|
510
|
+
function capitalize(_) {
|
|
496
511
|
var groups = [];
|
|
497
512
|
for (var _i = 1; _i < arguments.length; _i++) {
|
|
498
513
|
groups[_i - 1] = arguments[_i];
|
|
@@ -614,7 +629,9 @@ var EventListenerUtils = {
|
|
|
614
629
|
withVender: function (target, type) {
|
|
615
630
|
if (type === undefined)
|
|
616
631
|
return '';
|
|
617
|
-
if (
|
|
632
|
+
if (target === globalThis.document && ['deviceready', 'pause', 'resume', 'backbutton', 'menubutton', 'searchbutton', 'startcallbutton', 'endcallbutton', 'volumedownbutton', 'volumeupbutton', 'activated', 'cordovacallbackerror'].indexOf(type) > -1)
|
|
633
|
+
return type;
|
|
634
|
+
if (typeof target.webkitEnterFullscreen !== 'undefined' && ['webkitbeginfullscreen', 'webkitendfullscreen', 'webkitpresentationmodechanged'].indexOf(type) > -1)
|
|
618
635
|
return type;
|
|
619
636
|
var types;
|
|
620
637
|
if (type in LEGACY_TYPE_MAP)
|
|
@@ -719,7 +736,7 @@ function createHiddenElement(tagName, focusable) {
|
|
|
719
736
|
|
|
720
737
|
function openURLViaHref(url, index) {
|
|
721
738
|
var top = getTopmostWindow();
|
|
722
|
-
var
|
|
739
|
+
var topDocument = top.document;
|
|
723
740
|
var a = undefined;
|
|
724
741
|
try {
|
|
725
742
|
if (index === 0) {
|
|
@@ -730,15 +747,16 @@ function openURLViaHref(url, index) {
|
|
|
730
747
|
if (a === undefined)
|
|
731
748
|
return;
|
|
732
749
|
a.href = url;
|
|
733
|
-
|
|
750
|
+
topDocument.body.appendChild(a);
|
|
734
751
|
dispatchClickEvent(a, top);
|
|
752
|
+
return a;
|
|
735
753
|
}
|
|
736
754
|
catch (_) {
|
|
737
755
|
}
|
|
738
756
|
finally {
|
|
739
757
|
if (a !== undefined) {
|
|
740
758
|
try {
|
|
741
|
-
|
|
759
|
+
topDocument.body.removeChild(a);
|
|
742
760
|
}
|
|
743
761
|
catch (_) {
|
|
744
762
|
}
|
|
@@ -747,17 +765,18 @@ function openURLViaHref(url, index) {
|
|
|
747
765
|
}
|
|
748
766
|
function openURLViaIframe(url) {
|
|
749
767
|
var top = getTopmostWindow();
|
|
768
|
+
var topDocument = top.document;
|
|
750
769
|
var iframe = undefined;
|
|
751
770
|
try {
|
|
752
771
|
iframe = createHiddenElement('iframe');
|
|
753
772
|
if (iframe === undefined)
|
|
754
773
|
return;
|
|
755
774
|
iframe.src = url;
|
|
756
|
-
|
|
775
|
+
topDocument.body.appendChild(iframe);
|
|
757
776
|
globalThis.setTimeout(function () {
|
|
758
777
|
if (iframe !== undefined) {
|
|
759
778
|
try {
|
|
760
|
-
|
|
779
|
+
topDocument.body.removeChild(iframe);
|
|
761
780
|
}
|
|
762
781
|
catch (_) {
|
|
763
782
|
}
|
|
@@ -766,27 +785,29 @@ function openURLViaIframe(url) {
|
|
|
766
785
|
}
|
|
767
786
|
catch (_) {
|
|
768
787
|
}
|
|
788
|
+
return iframe;
|
|
769
789
|
}
|
|
770
790
|
function isDocumentHidden() {
|
|
771
|
-
var
|
|
772
|
-
|
|
791
|
+
var top = getTopmostWindow();
|
|
792
|
+
var topDocument = top.document;
|
|
793
|
+
if (topDocument.visibilityState === 'hidden')
|
|
773
794
|
return true;
|
|
774
|
-
if (
|
|
795
|
+
if (topDocument.webkitVisibilityState === 'hidden')
|
|
775
796
|
return true;
|
|
776
|
-
if (
|
|
797
|
+
if (topDocument.mozVisibilityState === 'hidden')
|
|
777
798
|
return true;
|
|
778
|
-
if (
|
|
799
|
+
if (topDocument.msVisibilityState === 'hidden')
|
|
779
800
|
return true;
|
|
780
|
-
if (
|
|
781
|
-
return
|
|
782
|
-
if (
|
|
783
|
-
return
|
|
784
|
-
if (
|
|
785
|
-
return
|
|
786
|
-
if (
|
|
787
|
-
return
|
|
788
|
-
if (typeof
|
|
789
|
-
return !
|
|
801
|
+
if (topDocument.hidden !== undefined)
|
|
802
|
+
return topDocument.hidden;
|
|
803
|
+
if (topDocument.webkitHidden !== undefined)
|
|
804
|
+
return topDocument.webkitHidden;
|
|
805
|
+
if (topDocument.mozHidden !== undefined)
|
|
806
|
+
return topDocument.mozHidden;
|
|
807
|
+
if (topDocument.msHidden !== undefined)
|
|
808
|
+
return topDocument.msHidden;
|
|
809
|
+
if (typeof topDocument.hasFocus === 'function')
|
|
810
|
+
return !topDocument.hasFocus();
|
|
790
811
|
return true;
|
|
791
812
|
}
|
|
792
813
|
function hasFocus(document) {
|
|
@@ -808,15 +829,14 @@ function focus(target) {
|
|
|
808
829
|
}
|
|
809
830
|
function restoreFocus() {
|
|
810
831
|
var top = getTopmostWindow();
|
|
811
|
-
var
|
|
832
|
+
var topDocument = top.document;
|
|
812
833
|
focus(top);
|
|
813
|
-
if (hasFocus(
|
|
834
|
+
if (hasFocus(topDocument))
|
|
814
835
|
return true;
|
|
815
|
-
if (
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
if (hasFocus(document))
|
|
836
|
+
if (topDocument.body.tabIndex < 0)
|
|
837
|
+
topDocument.body.tabIndex = -1;
|
|
838
|
+
focus(topDocument.body);
|
|
839
|
+
if (hasFocus(topDocument))
|
|
820
840
|
return true;
|
|
821
841
|
var input = undefined;
|
|
822
842
|
try {
|
|
@@ -825,14 +845,14 @@ function restoreFocus() {
|
|
|
825
845
|
return false;
|
|
826
846
|
input.type = 'text';
|
|
827
847
|
input.readOnly = true;
|
|
828
|
-
|
|
848
|
+
topDocument.body.appendChild(input);
|
|
829
849
|
focus(input);
|
|
830
850
|
try {
|
|
831
851
|
input.select();
|
|
832
852
|
}
|
|
833
853
|
catch (_) {
|
|
834
854
|
}
|
|
835
|
-
if (hasFocus(
|
|
855
|
+
if (hasFocus(topDocument))
|
|
836
856
|
return true;
|
|
837
857
|
}
|
|
838
858
|
catch (_) {
|
|
@@ -845,58 +865,69 @@ function restoreFocus() {
|
|
|
845
865
|
catch (_) {
|
|
846
866
|
}
|
|
847
867
|
try {
|
|
848
|
-
|
|
868
|
+
topDocument.body.removeChild(input);
|
|
849
869
|
}
|
|
850
870
|
catch (_) {
|
|
851
871
|
}
|
|
852
872
|
}
|
|
853
873
|
}
|
|
854
|
-
return hasFocus(
|
|
874
|
+
return hasFocus(topDocument);
|
|
855
875
|
}
|
|
856
|
-
function
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
.
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
.
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
}
|
|
878
|
-
function tryOpenURLElectron(url) {
|
|
879
|
-
try {
|
|
880
|
-
var electron_1 = require('electron');
|
|
881
|
-
return new Promise(function (resolve, reject) {
|
|
882
|
-
electron_1.shell
|
|
883
|
-
.openExternal(url)
|
|
884
|
-
.then(resolve)
|
|
885
|
-
.catch(reject);
|
|
886
|
-
});
|
|
876
|
+
function tryOpenURL(url, index, timeout) {
|
|
877
|
+
if (IS_REACT_NATIVE) {
|
|
878
|
+
try {
|
|
879
|
+
var reactNative_1 = require('react-native');
|
|
880
|
+
return new Promise(function (resolve, reject) {
|
|
881
|
+
reactNative_1.Linking.canOpenURL(url)
|
|
882
|
+
.then(function (canOpen) {
|
|
883
|
+
if (canOpen) {
|
|
884
|
+
reactNative_1.Linking.openURL(url)
|
|
885
|
+
.then(resolve)
|
|
886
|
+
.catch(reject);
|
|
887
|
+
}
|
|
888
|
+
else {
|
|
889
|
+
reject();
|
|
890
|
+
}
|
|
891
|
+
})
|
|
892
|
+
.catch(reject);
|
|
893
|
+
});
|
|
894
|
+
}
|
|
895
|
+
catch (_) {
|
|
896
|
+
return Promise.reject();
|
|
897
|
+
}
|
|
887
898
|
}
|
|
888
|
-
|
|
889
|
-
|
|
899
|
+
if (IS_ELECTRON) {
|
|
900
|
+
try {
|
|
901
|
+
var shell_1;
|
|
902
|
+
if (typeof globalThis.electronBridge !== 'undefined') {
|
|
903
|
+
shell_1 = globalThis.electronBridge;
|
|
904
|
+
}
|
|
905
|
+
else {
|
|
906
|
+
var electron = require('electron');
|
|
907
|
+
shell_1 = electron.shell;
|
|
908
|
+
}
|
|
909
|
+
return new Promise(function (resolve, reject) {
|
|
910
|
+
shell_1
|
|
911
|
+
.openExternal(url)
|
|
912
|
+
.then(resolve)
|
|
913
|
+
.catch(reject);
|
|
914
|
+
});
|
|
915
|
+
}
|
|
916
|
+
catch (_) {
|
|
917
|
+
return Promise.reject();
|
|
918
|
+
}
|
|
890
919
|
}
|
|
891
|
-
}
|
|
892
|
-
function tryOpenURLBrowser(url, index, timeout) {
|
|
893
920
|
var top = getTopmostWindow();
|
|
894
|
-
var
|
|
921
|
+
var topDocument = top.document;
|
|
895
922
|
var eventType = { focus: undefined, blur: undefined, visibilitychange: undefined };
|
|
896
923
|
var eventTarget = { focus: undefined, blur: undefined, visibilitychange: undefined };
|
|
897
|
-
if (
|
|
924
|
+
if (IS_CORDOVA) {
|
|
925
|
+
eventTarget = { focus: topDocument, blur: topDocument };
|
|
926
|
+
eventType = { focus: 'resume', blur: 'pause' };
|
|
927
|
+
}
|
|
928
|
+
else if (Platform.os === OS.iOS) {
|
|
898
929
|
if (compareVersion(Platform.osVersion, '8.0') >= 0) {
|
|
899
|
-
eventTarget = { visibilitychange:
|
|
930
|
+
eventTarget = { visibilitychange: topDocument };
|
|
900
931
|
eventType = { visibilitychange: 'visibilitychange' };
|
|
901
932
|
}
|
|
902
933
|
else {
|
|
@@ -906,14 +937,16 @@ function tryOpenURLBrowser(url, index, timeout) {
|
|
|
906
937
|
}
|
|
907
938
|
else {
|
|
908
939
|
if (EventListenerUtils.useStd) {
|
|
909
|
-
eventTarget = { focus: top, blur: top, visibilitychange:
|
|
940
|
+
eventTarget = { focus: top, blur: top, visibilitychange: topDocument };
|
|
910
941
|
eventType = { focus: 'focus', blur: 'blur', visibilitychange: 'visibilitychange' };
|
|
911
942
|
}
|
|
912
943
|
else {
|
|
913
|
-
eventTarget = { focus:
|
|
944
|
+
eventTarget = { focus: topDocument, blur: topDocument, visibilitychange: topDocument };
|
|
914
945
|
eventType = { focus: 'focus', blur: 'blur', visibilitychange: 'visibilitychange' };
|
|
915
946
|
}
|
|
916
947
|
}
|
|
948
|
+
var a = undefined;
|
|
949
|
+
var iframe = undefined;
|
|
917
950
|
return new Promise(function (resolve, reject) {
|
|
918
951
|
var timeoutId;
|
|
919
952
|
var resolved = false;
|
|
@@ -929,6 +962,20 @@ function tryOpenURLBrowser(url, index, timeout) {
|
|
|
929
962
|
}
|
|
930
963
|
catch (_) {
|
|
931
964
|
}
|
|
965
|
+
if (a !== undefined) {
|
|
966
|
+
try {
|
|
967
|
+
topDocument.body.removeChild(a);
|
|
968
|
+
}
|
|
969
|
+
catch (_) {
|
|
970
|
+
}
|
|
971
|
+
}
|
|
972
|
+
if (iframe !== undefined) {
|
|
973
|
+
try {
|
|
974
|
+
topDocument.body.removeChild(iframe);
|
|
975
|
+
}
|
|
976
|
+
catch (_) {
|
|
977
|
+
}
|
|
978
|
+
}
|
|
932
979
|
}
|
|
933
980
|
function done(success) {
|
|
934
981
|
if (resolved)
|
|
@@ -965,24 +1012,22 @@ function tryOpenURLBrowser(url, index, timeout) {
|
|
|
965
1012
|
}, timeout);
|
|
966
1013
|
EventListenerUtils.add(eventTarget.blur, { type: eventType.blur, callback: onBlur });
|
|
967
1014
|
EventListenerUtils.add(eventTarget.visibilitychange, { type: eventType.visibilitychange, callback: onVisibilityChange });
|
|
968
|
-
if (!hasFocus(
|
|
1015
|
+
if (!hasFocus(topDocument))
|
|
969
1016
|
restoreFocus();
|
|
970
1017
|
try {
|
|
971
|
-
|
|
972
|
-
|
|
1018
|
+
if (IS_CORDOVA) {
|
|
1019
|
+
globalThis.open(url, '_system');
|
|
1020
|
+
}
|
|
1021
|
+
else {
|
|
1022
|
+
a = openURLViaHref(url, index);
|
|
1023
|
+
iframe = openURLViaIframe(url);
|
|
1024
|
+
}
|
|
973
1025
|
}
|
|
974
1026
|
catch (_) {
|
|
975
1027
|
done(false);
|
|
976
1028
|
}
|
|
977
1029
|
});
|
|
978
1030
|
}
|
|
979
|
-
function tryOpenURL(url, index, timeout) {
|
|
980
|
-
if (Platform.isReactNative)
|
|
981
|
-
return tryOpenURLReactNative(url);
|
|
982
|
-
if (Platform.isElectron)
|
|
983
|
-
return tryOpenURLElectron(url);
|
|
984
|
-
return tryOpenURLBrowser(url, index, timeout);
|
|
985
|
-
}
|
|
986
1031
|
|
|
987
1032
|
function createCustomError(name, Base) {
|
|
988
1033
|
if (Base === void 0) { Base = Error; }
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
installed: boolean;
|
|
3
|
-
name: Key;
|
|
4
|
-
module: Module;
|
|
5
|
-
Constants: Constants;
|
|
6
|
-
Errors: Errors;
|
|
7
|
-
}
|
|
1
|
+
import * as electron from 'electron';
|
|
8
2
|
|
|
9
3
|
declare global {
|
|
4
|
+
var cordova: string | undefined;
|
|
5
|
+
var device: CordovaDevice | undefined;
|
|
10
6
|
interface Navigator {
|
|
11
7
|
userAgent?: string;
|
|
12
8
|
userAgentData?: UserAgentData;
|
|
13
9
|
}
|
|
14
10
|
}
|
|
11
|
+
interface CordovaDevice {
|
|
12
|
+
platform: string;
|
|
13
|
+
version: string;
|
|
14
|
+
}
|
|
15
15
|
interface ModernUserAgentDataBrand {
|
|
16
16
|
brand: string;
|
|
17
17
|
version: string;
|
|
@@ -33,6 +33,58 @@ declare enum OS {
|
|
|
33
33
|
MacOS = "MacOS"
|
|
34
34
|
}
|
|
35
35
|
|
|
36
|
+
declare type BrowserWindow = electron.BrowserWindow;
|
|
37
|
+
declare type IsElectron = typeof process extends {
|
|
38
|
+
versions: {
|
|
39
|
+
electron: string;
|
|
40
|
+
};
|
|
41
|
+
} ? true : false;
|
|
42
|
+
declare type FullscreenTarget = IsElectron extends true ? BrowserWindow : Element;
|
|
43
|
+
|
|
44
|
+
declare interface FullscreenInstance {
|
|
45
|
+
enabled: boolean;
|
|
46
|
+
element: FullscreenTarget | null;
|
|
47
|
+
isFullscreen: boolean;
|
|
48
|
+
request(target?: FullscreenTarget, options?: FullscreenOptions): Promise<void>;
|
|
49
|
+
exit(): Promise<void>;
|
|
50
|
+
toggle(target?: FullscreenTarget, options?: FullscreenOptions): Promise<void>;
|
|
51
|
+
onChange(handler: (event: Event) => void): () => void;
|
|
52
|
+
onError(handler: (event: Event) => void): () => void;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
declare module 'native-fn' {
|
|
56
|
+
interface NativePlugins {
|
|
57
|
+
Fullscreen: FullscreenInstance;
|
|
58
|
+
}
|
|
59
|
+
interface NativeConstants {
|
|
60
|
+
}
|
|
61
|
+
interface NativeErrors {
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
declare interface ClipboardInstance {
|
|
66
|
+
copy(item: any): Promise<boolean>;
|
|
67
|
+
paste(): Promise<string>;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
declare module 'native-fn' {
|
|
71
|
+
interface NativePlugins {
|
|
72
|
+
Clipboard: ClipboardInstance;
|
|
73
|
+
}
|
|
74
|
+
interface NativeConstants {
|
|
75
|
+
}
|
|
76
|
+
interface NativeErrors {
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
declare interface NativePlugin<Key extends string, Module, Constants extends Record<string, any> = Record<string, any>, Errors extends Record<string, ErrorConstructor> = Record<string, ErrorConstructor>> {
|
|
81
|
+
installed: boolean;
|
|
82
|
+
name: Key;
|
|
83
|
+
module: Module;
|
|
84
|
+
Constants: Constants;
|
|
85
|
+
Errors: Errors;
|
|
86
|
+
}
|
|
87
|
+
|
|
36
88
|
declare enum AppOpenState {
|
|
37
89
|
Scheme = 0,
|
|
38
90
|
Universal = 1,
|