native-fn 1.0.31 → 1.0.32

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 (109) hide show
  1. package/dist/index.d.ts +11 -11
  2. package/dist/native.cjs +5 -5
  3. package/dist/native.min.cjs +1 -1
  4. package/dist/native.min.mjs +1 -1
  5. package/dist/native.mjs +5 -5
  6. package/dist/native.umd.js +5 -5
  7. package/dist/native.umd.min.js +1 -1
  8. package/dist/plugin/app/index.cjs +4 -4
  9. package/dist/plugin/app/index.d.ts +9 -7
  10. package/dist/plugin/app/index.min.cjs +1 -1
  11. package/dist/plugin/app/index.min.mjs +1 -1
  12. package/dist/plugin/app/index.mjs +4 -4
  13. package/dist/plugin/app/index.umd.js +4 -4
  14. package/dist/plugin/app/index.umd.min.js +1 -1
  15. package/dist/plugin/app/src/plugin/app/cores/app.d.ts +2 -2
  16. package/dist/plugin/app/src/plugin/app/index.d.ts +3 -3
  17. package/dist/plugin/app/src/plugin/app/types/app.d.ts +1 -1
  18. package/dist/plugin/app/src/plugin/app/types/appModule.d.ts +1 -1
  19. package/dist/plugin/app/src/plugin/app/types/index.d.ts +1 -1
  20. package/dist/plugin/app/src/plugin/app/utils/event-listener-utils.d.ts +1 -1
  21. package/dist/plugin/app/src/plugin/platform/cores/platform.d.ts +2 -2
  22. package/dist/plugin/app/src/plugin/platform/index.d.ts +3 -3
  23. package/dist/plugin/app/src/plugin/platform/types/index.d.ts +1 -1
  24. package/dist/plugin/app/src/plugin/platform/types/platform.d.ts +1 -1
  25. package/dist/plugin/app/src/plugin/platform/types/platformModule.d.ts +1 -1
  26. package/dist/plugin/app/src/plugin/theme/constants/theme.d.ts +1 -1
  27. package/dist/plugin/app/src/plugin/theme/cores/theme.d.ts +2 -2
  28. package/dist/plugin/app/src/plugin/theme/index.d.ts +3 -3
  29. package/dist/plugin/app/src/plugin/theme/types/index.d.ts +1 -1
  30. package/dist/plugin/app/src/plugin/theme/types/theme.d.ts +8 -9
  31. package/dist/plugin/app/src/plugin/theme/types/themeModule.d.ts +1 -1
  32. package/dist/plugin/app/src/plugin/theme/utils/parse-color.d.ts +1 -1
  33. package/dist/plugin/app/src/plugin/theme/utils/parse-easing-function.d.ts +1 -1
  34. package/dist/plugin/app/src/types/native.d.ts +8 -8
  35. package/dist/plugin/platform/index.cjs +4 -4
  36. package/dist/plugin/platform/index.d.ts +9 -7
  37. package/dist/plugin/platform/index.min.cjs +1 -1
  38. package/dist/plugin/platform/index.min.mjs +1 -1
  39. package/dist/plugin/platform/index.mjs +4 -4
  40. package/dist/plugin/platform/index.umd.js +4 -4
  41. package/dist/plugin/platform/index.umd.min.js +1 -1
  42. package/dist/plugin/platform/src/plugin/app/cores/app.d.ts +2 -2
  43. package/dist/plugin/platform/src/plugin/app/index.d.ts +3 -3
  44. package/dist/plugin/platform/src/plugin/app/types/app.d.ts +1 -1
  45. package/dist/plugin/platform/src/plugin/app/types/appModule.d.ts +1 -1
  46. package/dist/plugin/platform/src/plugin/app/types/index.d.ts +1 -1
  47. package/dist/plugin/platform/src/plugin/app/utils/event-listener-utils.d.ts +1 -1
  48. package/dist/plugin/platform/src/plugin/platform/cores/platform.d.ts +2 -2
  49. package/dist/plugin/platform/src/plugin/platform/index.d.ts +3 -3
  50. package/dist/plugin/platform/src/plugin/platform/types/index.d.ts +1 -1
  51. package/dist/plugin/platform/src/plugin/platform/types/platform.d.ts +1 -1
  52. package/dist/plugin/platform/src/plugin/platform/types/platformModule.d.ts +1 -1
  53. package/dist/plugin/platform/src/plugin/theme/constants/theme.d.ts +1 -1
  54. package/dist/plugin/platform/src/plugin/theme/cores/theme.d.ts +2 -2
  55. package/dist/plugin/platform/src/plugin/theme/index.d.ts +3 -3
  56. package/dist/plugin/platform/src/plugin/theme/types/index.d.ts +1 -1
  57. package/dist/plugin/platform/src/plugin/theme/types/theme.d.ts +8 -9
  58. package/dist/plugin/platform/src/plugin/theme/types/themeModule.d.ts +1 -1
  59. package/dist/plugin/platform/src/plugin/theme/utils/parse-color.d.ts +1 -1
  60. package/dist/plugin/platform/src/plugin/theme/utils/parse-easing-function.d.ts +1 -1
  61. package/dist/plugin/platform/src/types/native.d.ts +8 -8
  62. package/dist/plugin/theme/index.cjs +4 -4
  63. package/dist/plugin/theme/index.d.ts +9 -7
  64. package/dist/plugin/theme/index.min.cjs +1 -1
  65. package/dist/plugin/theme/index.min.mjs +1 -1
  66. package/dist/plugin/theme/index.mjs +4 -4
  67. package/dist/plugin/theme/index.umd.js +4 -4
  68. package/dist/plugin/theme/index.umd.min.js +1 -1
  69. package/dist/plugin/theme/src/plugin/app/cores/app.d.ts +2 -2
  70. package/dist/plugin/theme/src/plugin/app/index.d.ts +3 -3
  71. package/dist/plugin/theme/src/plugin/app/types/app.d.ts +1 -1
  72. package/dist/plugin/theme/src/plugin/app/types/appModule.d.ts +1 -1
  73. package/dist/plugin/theme/src/plugin/app/types/index.d.ts +1 -1
  74. package/dist/plugin/theme/src/plugin/app/utils/event-listener-utils.d.ts +1 -1
  75. package/dist/plugin/theme/src/plugin/platform/cores/platform.d.ts +2 -2
  76. package/dist/plugin/theme/src/plugin/platform/index.d.ts +3 -3
  77. package/dist/plugin/theme/src/plugin/platform/types/index.d.ts +1 -1
  78. package/dist/plugin/theme/src/plugin/platform/types/platform.d.ts +1 -1
  79. package/dist/plugin/theme/src/plugin/platform/types/platformModule.d.ts +1 -1
  80. package/dist/plugin/theme/src/plugin/theme/constants/theme.d.ts +1 -1
  81. package/dist/plugin/theme/src/plugin/theme/cores/theme.d.ts +2 -2
  82. package/dist/plugin/theme/src/plugin/theme/index.d.ts +3 -3
  83. package/dist/plugin/theme/src/plugin/theme/types/index.d.ts +1 -1
  84. package/dist/plugin/theme/src/plugin/theme/types/theme.d.ts +8 -9
  85. package/dist/plugin/theme/src/plugin/theme/types/themeModule.d.ts +1 -1
  86. package/dist/plugin/theme/src/plugin/theme/utils/parse-color.d.ts +1 -1
  87. package/dist/plugin/theme/src/plugin/theme/utils/parse-easing-function.d.ts +1 -1
  88. package/dist/plugin/theme/src/types/native.d.ts +8 -8
  89. package/dist/src/plugin/app/cores/app.d.ts +2 -2
  90. package/dist/src/plugin/app/index.d.ts +3 -3
  91. package/dist/src/plugin/app/types/app.d.ts +1 -1
  92. package/dist/src/plugin/app/types/appModule.d.ts +1 -1
  93. package/dist/src/plugin/app/types/index.d.ts +1 -1
  94. package/dist/src/plugin/app/utils/event-listener-utils.d.ts +1 -1
  95. package/dist/src/plugin/platform/cores/platform.d.ts +2 -2
  96. package/dist/src/plugin/platform/index.d.ts +3 -3
  97. package/dist/src/plugin/platform/types/index.d.ts +1 -1
  98. package/dist/src/plugin/platform/types/platform.d.ts +1 -1
  99. package/dist/src/plugin/platform/types/platformModule.d.ts +1 -1
  100. package/dist/src/plugin/theme/constants/theme.d.ts +1 -1
  101. package/dist/src/plugin/theme/cores/theme.d.ts +2 -2
  102. package/dist/src/plugin/theme/index.d.ts +3 -3
  103. package/dist/src/plugin/theme/types/index.d.ts +1 -1
  104. package/dist/src/plugin/theme/types/theme.d.ts +8 -9
  105. package/dist/src/plugin/theme/types/themeModule.d.ts +1 -1
  106. package/dist/src/plugin/theme/utils/parse-color.d.ts +1 -1
  107. package/dist/src/plugin/theme/utils/parse-easing-function.d.ts +1 -1
  108. package/dist/src/types/native.d.ts +8 -8
  109. package/package.json +1 -1
@@ -1 +1 @@
1
- var e,t=navigator.userAgent;!function(e){e.Unknown="unknown",e.Light="light",e.Dark="dark"}(e||(e={}));var r=function(){var e=t.match(/chrome\/([\w.]+) mobile/i);if(null===e)return NaN;var r=parseInt(e[1]);return isNaN(r)?NaN:r}(),n=window.matchMedia("(prefers-color-scheme: dark)"),a="not all"!==n.media,o=isNaN(r)||r>=92,i=document.createElement("canvas").getContext("2d",{willReadFrequently:!0}),u=/Samsung/i.test(t),l=/iemobile/i.test(t),c=/windows phone/i.test(t),s=[];function f(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function d(e,t){function r(n){if(!(this instanceof r))return new r(n);var a=new t(n||"");if("function"==typeof Object.setPrototypeOf?Object.setPrototypeOf(a,r.prototype):a.__proto__=r.prototype,a.name=e,void 0!==n&&(a.message=n),"undefined"!=typeof Symbol&&Symbol.toStringTag)try{Object.defineProperty(a,Symbol.toStringTag,{value:e,writable:!1,enumerable:!1,configurable:!0})}catch(e){}if("function"==typeof Error.captureStackTrace)Error.captureStackTrace(a,r);else if(t.captureStackTrace&&"function"==typeof t.captureStackTrace)t.captureStackTrace(a,r);else try{var o=new t;o.stack&&(a.stack=o.stack)}catch(e){}return a}void 0===t&&(t=Error),r.prototype=Object.create(t.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(t){try{r.prototype.name=e}catch(e){}}try{Object.defineProperty(r,"name",{value:e,writable:!1,enumerable:!1,configurable:!0})}catch(e){}return r}"function"==typeof SuppressedError&&SuppressedError;var p=d("EasingError"),v=d("CubicBezierSyntaxError",p),m=d("LinearSyntaxError",p),h=d("StepSyntaxError",p),b=d("UnsupportedEasingFunctionError",p),g={linear:"linear(0, 1)",ease:"cubic-bezier(0.25, 0.1, 0.25, 1)","ease-in":"cubic-bezier(0.42, 0, 1, 1)","ease-out":"cubic-bezier(0, 0, 0.58, 1)","ease-in-out":"cubic-bezier(0.42, 0, 0.58, 1)","step-start":"steps(1, jump-start)","step-end":"steps(1, jump-end)"};function y(e,t,r){return e<t?t:e>r?r:e}function w(e){var t=function(e){var t=e.match(/cubic-bezier\((.*)\)/);if(null===t)throw new v("Invalid cubic-bezier syntax");var r=t[1].trim().split(","),n=[];if(4!==r.length)throw new v("Cubic-bezier must have exactly 4 numeric values");for(var a=0;a<4;a++){var o=parseFloat(r[a]);if(isNaN(o))throw new v("Cubic-bezier must have exactly 4 numeric values");if(a%2==0&&(o<0||o>1))throw new v("x1 and x2 must be between 0 and 1");n.push(o)}return{x1:n[0],y1:n[1],x2:n[2],y2:n[3]}}(e),r=t.x1,n=t.x2,a=t.y1,o=t.y2;return function(e){if(0===(e=y(e,0,1))||1===e)return e;var t=function(e,t,a){if(void 0===t&&(t=1e-6),void 0===a&&(a=50),e<=0)return 0;if(e>=1)return 1;for(var o=e,i=0;i<a;i++){var u=3*(1-o)*(1-o)*o*r+3*(1-o)*o*o*n+o*o*o,l=3*(1-o)*(1-o)*r+6*(1-o)*o*(n-r)+3*o*o*(1-n);if(Math.abs(l)<t)break;var c=o-(u-e)/l;if(Math.abs(c-o)<t){o=c;break}o=Math.max(0,Math.min(1,c))}return o}(e);return 3*(1-t)*(1-t)*t*a+3*(1-t)*t*t*o+t*t*t}}function S(e){var t=function(e){var t,r,n=e.match(/linear\((.*)\)/);if(null===n)throw new m("Invalid linear syntax");var a=n[1].trim();if(""===a)throw new m("Linear function must have at least one point");for(var o=a.split(","),i=[],u=0;u<o.length;u++){var l=o[u].trim(),c=l.match(/^([+-]?\d*\.?\d+)((?:\s+[+-]?\d*\.?\d+%){2,})$/);if(null===c){var s=l.match(/^([+-]?\d*\.?\d+)\s+([+-]?\d*\.?\d+)%$/);if(null===s){var d=l.match(/^([+-]?\d*\.?\d+)$/);if(null===d)throw new m('Invalid linear point format: "'+l+'"');i.push({position:1===o.length?0:u/(o.length-1),value:parseFloat(d[1])})}else i.push({position:parseFloat(s[2])/100,value:parseFloat(s[1])})}else{var p=parseFloat(c[1]),v=c[2].trim().split(/\s+/);try{for(var h=(t=void 0,f(v)),b=h.next();!b.done;b=h.next()){var g=b.value;i.push({value:p,position:parseFloat(g)/100})}}catch(e){t={error:e}}finally{try{b&&!b.done&&(r=h.return)&&r.call(h)}finally{if(t)throw t.error}}}}if(0===i.length)throw new m("No valid points found in linear function");return i.sort((function(e,t){return e.position-t.position})),i[0].position>0&&i.unshift({position:0,value:0}),i[i.length-1].position<1&&i.push({position:1,value:1}),i}(e);return function(e){if((e=y(e,0,1))<=t[0].position)return t[0].value;if(e>=t[t.length-1].position)return t[t.length-1].value;for(var r=0;r<t.length-1;r++){var n=t[r],a=t[r+1];if(e>=n.position&&e<=a.position){if(n.position===a.position)return a.value;var o=(e-n.position)/(a.position-n.position);return n.value+(a.value-n.value)*o}}return t[t.length-1].value}}function x(e){if(function(e){return!/(linear|cubic-bezier|steps)\((.*)\)/.test(e)}(e)&&(e=g[e]),function(e){return/cubic-bezier\(/.test(e)}(e))return w(e);if(function(e){return/linear\(/.test(e)}(e))return S(e);if(function(e){return/steps\(\s*(\d+)\s*(?:,\s*(jump-start|jump-end|jump-none|jump-both|start|end)\s*)?\)$/.test(e)}(e))return function(e){var t=e.match(/steps\(\s*(\d+)\s*(?:,\s*(jump-start|jump-end|jump-none|jump-both|start|end)\s*)?\)$/);if(null===t)throw new h("Invalid steps syntax");var r=parseInt(t[1],10),n=t[2];if(r<=0)throw new h("Steps count must be a positive integer");if("jump-none"===n&&r<2)throw new h("jump-none requires at least 2 steps");return function(e){switch(e=y(e,0,1),n){case"start":case"jump-start":return 0===e?1/r:1===e?1:Math.ceil(e*r)/r;case void 0:case"end":case"jump-end":return 1===e?1:Math.floor(e*r)/r;case"jump-both":return 0===e?0:1===e?1:Math.round(e*(r+1))/(r+1);case"jump-none":return 0===e?0:1===e?1:Math.floor(e*(r-1))/(r-1);default:throw new h('Unsupported step position: "'+n+'"')}}}(e);throw new b('Unsupported easing function: "'+e+'"')}var E=d("UnsupportedColorError");function k(e){if("undefined"!=typeof CSS&&CSS.supports&&!CSS.supports("color",e))throw new E('Unsupported color: "'+e+'".');if(null!==i)try{i.clearRect(0,0,1,1),i.fillStyle=e,i.fillRect(0,0,1,1);var t=i.getImageData(0,0,1,1).data;return{red:t[0],green:t[1],blue:t[2],alpha:parseFloat((t[3]/255).toFixed(2))}}catch(e){}var r=document.createElement("div");r.style.position="absolute",r.style.top="-9999px",r.style.left="-9999px",r.style.width="1px",r.style.height="1px",r.style.color=e,document.body.appendChild(r);try{var n=window.getComputedStyle(r).color,a=n.match(/rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*([\d.]+))?\s*\)/),o=n.match(/rgba?\(\s*(\d+)\s+(\d+)\s+(\d+)\s*(?:\/\s*([\d.]+%?))?\s*\)/),u=a||o;if(null===u)throw new E('Unsupported color: "'+e+'".');var l=parseInt(u[1],10),c=parseInt(u[2],10),s=parseInt(u[3],10),f=1;if(void 0!==u[4]){var d=u[4];f="%"===d.charAt(d.length-1)?parseFloat((parseFloat(d)/100).toFixed(2)):parseFloat(parseFloat(d).toFixed(2))}if(isNaN(l)||isNaN(c)||isNaN(s)||isNaN(f))throw new E('Failed to parse color values from: "'+e+'".');return{red:l,green:c,blue:s,alpha:f}}finally{document.body.removeChild(r)}}var j,C={},L=null,I=null,F=null,M=null,N={setThemeColor:function(t,r){void 0===r&&(r={duration:0,easingFunction:"linear",appearance:"default"});var n=r.duration,i=x(r.easingFunction),u=r.appearance;null!==L&&(window.cancelAnimationFrame(L),L=null,null!==I&&(I(R()),I=null));var s=R();void 0===s&&(s=void 0!==r.defaultColor?r.defaultColor:P()===e.Dark?"#181818ff":"#dcdcdcff");var f=k(s),d=k(t);return new Promise((function(e){I=e;var t=null;L=window.requestAnimationFrame((function r(s){null===t&&(t=s);var p,v=s-t;p=0===n?1:Math.min(v/n,1);var m=i(p),h={red:Math.round(f.red+(d.red-f.red)*m),green:Math.round(f.green+(d.green-f.green)*m),blue:Math.round(f.blue+(d.blue-f.blue)*m),alpha:+(f.alpha+(d.alpha-f.alpha)*m).toFixed(2)};(function(e){void 0===e&&(e="default");var t;t=!o||!a||l||c?"default":e;var r=C[t];if(void 0!==r)return r;r=document.createElement("meta"),l?r.setAttribute("name","msapplication-navbutton-color"):c?r.setAttribute("name","msapplication-TileColor"):r.setAttribute("name","theme-color");"default"!==e&&r.setAttribute("media","(prefers-color-scheme: "+t+")");return document.head.prepend(r),C[e]=r})(u).setAttribute("content",T(h)),p<1?L=window.requestAnimationFrame(r):(L=null,null!==I&&(e(R()),L=null))}))}))},getThemeColor:R,removeThemeColor:function(e){void 0===e&&(e="default");var t=C[e];void 0!==t&&t.remove();C[e]=void 0},detectAppearance:function(){return u?z():Promise.resolve(P())},onAppearanceChange:function(e,t){void 0===t&&(t=!1);var r={fn:e,capture:!1,once:!1};"boolean"==typeof t&&(t={capture:t});void 0!==t.capture&&(r.capture=t.capture);void 0!==t.once&&(r.once=t.once);void 0!==t.signal&&(r.signal=t.signal);var a=q(r);-1===a?(s.push(r),1===s.length&&(u?(z().then((function(e){F=e})),M=window.setInterval((function(){z().then((function(e){e!==F&&(F=e,U(e))}))}),2e3)):(o=r.capture,F=P(),"function"==typeof n.addEventListener?n.addEventListener("change",D,o):"function"==typeof n.addListener&&n.addListener(D))),this.detectAppearance().then(U)):s[a].once&&!r.once&&(s[a].once=!1);var o;void 0!==r.signal&&(r.signal.aborted?O(r):r.signal.addEventListener("abort",(function e(){void 0!==r.signal&&r.signal.removeEventListener("abort",e),O(r)})));return function(){O(r)}}};function A(e){var t=e.toString(16);switch(t.length){case 0:return"00";case 1:return"0"+t;default:return t}}function T(e){return"#"+A(e.red)+A(e.green)+A(e.blue)+A(Math.round(255*e.alpha))}function z(){return new Promise((function(t){var r=new Image;r.onload=function(){if(null===i)return t(e.Light);i.drawImage(r,0,0);var n=i.getImageData(0,0,1,1).data;(n[0]&n[1]&n[2])<255?t(e.Dark):t(e.Light)},r.onerror=function(){t(e.Unknown)},r.src="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjxyZWN0IHdpZHRoPSIxIiBoZWlnaHQ9IjEiIGZpbGw9IndoaXRlIi8+PC9zdmc+"}))}function P(){return a?n.matches?e.Dark:e.Light:e.Unknown}function D(t){var r;(r=t.matches?e.Dark:e.Light)!==F&&U(F=r)}function U(e){for(var t=0;t<s.length;t++){var r=s[t];r.fn(e),r.once&&O(r)}}function O(e){var t,r=q(e);-1!==r&&s.splice(r,1),0===s.length&&(u?(F=null,null!==M&&(clearInterval(M),M=null)):(t=e.capture,F=null,"function"==typeof n.removeEventListener?n.removeEventListener("change",D,t):"function"==typeof n.removeListener&&n.removeListener(D)))}function q(e){for(var t=0;t<s.length;t++)if(s[t].fn===e.fn&&s[t].capture===e.capture)return t;return-1}function H(){var e;C={},e=l?'meta[name="msapplication-navbutton-color"]':c?'meta[name="msapplication-TileColor"]':'meta[name="theme-color"]';var t=document.querySelectorAll(e);if(o&&a&&!l&&!c)for(var r=0;r<t.length;r++){var n=t.item(r),i=n.getAttribute("media");if("(prefers-color-scheme: dark)"===i&&void 0===C.dark?C.dark=n:"(prefers-color-scheme: light)"===i&&void 0===C.light?C.light=n:null===i&&void 0===C.default&&(C.default=n),void 0!==C.dark&&void 0!==C.light&&void 0!==C.default)return}else C.default=t[0]}function R(){var r=function(){if(l)return document.querySelector('meta[name="msapplication-navbutton-color"]');if(c)return document.querySelector('meta[name="msapplication-TileColor"]');if(!o||!a)return document.querySelector('meta[name="theme-color"]');var t,r=document.querySelectorAll('meta[name="theme-color"]');t=P()===e.Dark?"(prefers-color-scheme: dark)":"(prefers-color-scheme: light)";for(var n=0;n<r.length;n++){var i=r.item(n);if(i.hasAttribute("content")){var u=i.getAttribute("media");if(null===u||u===t)return i}}return null}();return null!==r?r.getAttribute("content"):/version\/[\w.,]+ .*safari/i.test(t)?navigator.standalone?P()===e.Dark?"#ffffffff":"#000000ff":T(k(window.getComputedStyle(document.body).backgroundColor)):/\b(?:crmo|crios)\/[\w.]+/i.test(t)||/chrome\/[\w.]+ mobile/i.test(t)?P()===e.Dark?"#28292cff":"#ffffffff":void 0}j=new MutationObserver((function(e){for(var t=0;t<e.length;t++){for(var r=e[t],n=r.addedNodes,a=r.removedNodes,o=0;o<n.length;o++)if(n[o]instanceof HTMLMetaElement)return H();for(o=0;o<a.length;o++)if(a[o]instanceof HTMLMetaElement)return H()}})),"function"==typeof n.addEventListener?n.addEventListener("change",H):"function"==typeof n.addListener&&n.addListener(H),j.observe(document.head,{childList:!0}),H();var Z={installed:!1,name:"Theme",module:N,constants:{Appearances:e},errors:{EasingError:p,UnsupportedEasingFunctionError:b,StepSyntaxError:h,LinearSyntaxError:m,CubicBezierSyntaxError:v,UnsupportedColorError:E}};export{Z as default};
1
+ var e,t=navigator.userAgent;!function(e){e.Unknown="unknown",e.Light="light",e.Dark="dark"}(e||(e={}));var r=function(){var e=t.match(/chrome\/([\w.]+) mobile/i);if(null===e)return NaN;var r=parseInt(e[1]);return isNaN(r)?NaN:r}(),n=window.matchMedia("(prefers-color-scheme: dark)"),a="not all"!==n.media,o=isNaN(r)||r>=92,i=document.createElement("canvas").getContext("2d",{willReadFrequently:!0}),u=/Samsung/i.test(t),l=/iemobile/i.test(t),s=/windows phone/i.test(t),c=[];function f(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function d(e,t){function r(n){if(!(this instanceof r))return new r(n);var a=new t(n||"");if("function"==typeof Object.setPrototypeOf?Object.setPrototypeOf(a,r.prototype):a.__proto__=r.prototype,a.name=e,void 0!==n&&(a.message=n),"undefined"!=typeof Symbol&&Symbol.toStringTag)try{Object.defineProperty(a,Symbol.toStringTag,{value:e,writable:!1,enumerable:!1,configurable:!0})}catch(e){}if("function"==typeof Error.captureStackTrace)Error.captureStackTrace(a,r);else if(t.captureStackTrace&&"function"==typeof t.captureStackTrace)t.captureStackTrace(a,r);else try{var o=new t;o.stack&&(a.stack=o.stack)}catch(e){}return a}void 0===t&&(t=Error),r.prototype=Object.create(t.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(t){try{r.prototype.name=e}catch(e){}}try{Object.defineProperty(r,"name",{value:e,writable:!1,enumerable:!1,configurable:!0})}catch(e){}return r}"function"==typeof SuppressedError&&SuppressedError;var p=d("EasingError"),v=d("CubicBezierSyntaxError",p),m=d("LinearSyntaxError",p),h=d("StepSyntaxError",p),b=d("UnsupportedEasingFunctionError",p),g={linear:"linear(0, 1)",ease:"cubic-bezier(0.25, 0.1, 0.25, 1)","ease-in":"cubic-bezier(0.42, 0, 1, 1)","ease-out":"cubic-bezier(0, 0, 0.58, 1)","ease-in-out":"cubic-bezier(0.42, 0, 0.58, 1)","step-start":"steps(1, jump-start)","step-end":"steps(1, jump-end)"};function y(e,t,r){return e<t?t:e>r?r:e}function w(e){var t=function(e){var t=e.match(/cubic-bezier\((.*)\)/);if(null===t)throw new v("Invalid cubic-bezier syntax");var r=t[1].trim().split(","),n=[];if(4!==r.length)throw new v("Cubic-bezier must have exactly 4 numeric values");for(var a=0;a<4;a++){var o=parseFloat(r[a]);if(isNaN(o))throw new v("Cubic-bezier must have exactly 4 numeric values");if(a%2==0&&(o<0||o>1))throw new v("x1 and x2 must be between 0 and 1");n.push(o)}return{x1:n[0],y1:n[1],x2:n[2],y2:n[3]}}(e),r=t.x1,n=t.x2,a=t.y1,o=t.y2;return function(e){if(0===(e=y(e,0,1))||1===e)return e;var t=function(e,t,a){if(void 0===t&&(t=1e-6),void 0===a&&(a=50),e<=0)return 0;if(e>=1)return 1;for(var o=e,i=0;i<a;i++){var u=3*(1-o)*(1-o)*o*r+3*(1-o)*o*o*n+o*o*o,l=3*(1-o)*(1-o)*r+6*(1-o)*o*(n-r)+3*o*o*(1-n);if(Math.abs(l)<t)break;var s=o-(u-e)/l;if(Math.abs(s-o)<t){o=s;break}o=Math.max(0,Math.min(1,s))}return o}(e);return 3*(1-t)*(1-t)*t*a+3*(1-t)*t*t*o+t*t*t}}function S(e){var t=function(e){var t,r,n=e.match(/linear\((.*)\)/);if(null===n)throw new m("Invalid linear syntax");var a=n[1].trim();if(""===a)throw new m("Linear function must have at least one point");for(var o=a.split(","),i=[],u=0;u<o.length;u++){var l=o[u].trim(),s=l.match(/^([+-]?\d*\.?\d+)((?:\s+[+-]?\d*\.?\d+%){2,})$/);if(null===s){var c=l.match(/^([+-]?\d*\.?\d+)\s+([+-]?\d*\.?\d+)%$/);if(null===c){var d=l.match(/^([+-]?\d*\.?\d+)$/);if(null===d)throw new m('Invalid linear point format: "'+l+'"');i.push({position:1===o.length?0:u/(o.length-1),value:parseFloat(d[1])})}else i.push({position:parseFloat(c[2])/100,value:parseFloat(c[1])})}else{var p=parseFloat(s[1]),v=s[2].trim().split(/\s+/);try{for(var h=(t=void 0,f(v)),b=h.next();!b.done;b=h.next()){var g=b.value;i.push({value:p,position:parseFloat(g)/100})}}catch(e){t={error:e}}finally{try{b&&!b.done&&(r=h.return)&&r.call(h)}finally{if(t)throw t.error}}}}if(0===i.length)throw new m("No valid points found in linear function");return i.sort((function(e,t){return e.position-t.position})),i[0].position>0&&i.unshift({position:0,value:0}),i[i.length-1].position<1&&i.push({position:1,value:1}),i}(e);return function(e){if((e=y(e,0,1))<=t[0].position)return t[0].value;if(e>=t[t.length-1].position)return t[t.length-1].value;for(var r=0;r<t.length-1;r++){var n=t[r],a=t[r+1];if(e>=n.position&&e<=a.position){if(n.position===a.position)return a.value;var o=(e-n.position)/(a.position-n.position);return n.value+(a.value-n.value)*o}}return t[t.length-1].value}}function E(e){if(function(e){return!/(linear|cubic-bezier|steps)\((.*)\)/.test(e)}(e)&&(e=g[e]),function(e){return/cubic-bezier\(/.test(e)}(e))return w(e);if(function(e){return/linear\(/.test(e)}(e))return S(e);if(function(e){return/steps\(\s*(\d+)\s*(?:,\s*(jump-start|jump-end|jump-none|jump-both|start|end)\s*)?\)$/.test(e)}(e))return function(e){var t=e.match(/steps\(\s*(\d+)\s*(?:,\s*(jump-start|jump-end|jump-none|jump-both|start|end)\s*)?\)$/);if(null===t)throw new h("Invalid steps syntax");var r=parseInt(t[1],10),n=t[2];if(r<=0)throw new h("Steps count must be a positive integer");if("jump-none"===n&&r<2)throw new h("jump-none requires at least 2 steps");return function(e){switch(e=y(e,0,1),n){case"start":case"jump-start":return 0===e?1/r:1===e?1:Math.ceil(e*r)/r;case void 0:case"end":case"jump-end":return 1===e?1:Math.floor(e*r)/r;case"jump-both":return 0===e?0:1===e?1:Math.round(e*(r+1))/(r+1);case"jump-none":return 0===e?0:1===e?1:Math.floor(e*(r-1))/(r-1);default:throw new h('Unsupported step position: "'+n+'"')}}}(e);throw new b('Unsupported easing function: "'+e+'"')}var x=d("UnsupportedColorError");function k(e){if("undefined"!=typeof CSS&&CSS.supports&&!CSS.supports("color",e))throw new x('Unsupported color: "'+e+'".');if(null!==i)try{i.clearRect(0,0,1,1),i.fillStyle=e,i.fillRect(0,0,1,1);var t=i.getImageData(0,0,1,1).data;return{red:t[0],green:t[1],blue:t[2],alpha:parseFloat((t[3]/255).toFixed(2))}}catch(e){}var r=document.createElement("div");r.style.position="absolute",r.style.top="-9999px",r.style.left="-9999px",r.style.width="1px",r.style.height="1px",r.style.color=e,document.body.appendChild(r);try{var n=window.getComputedStyle(r).color,a=n.match(/rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*([\d.]+))?\s*\)/),o=n.match(/rgba?\(\s*(\d+)\s+(\d+)\s+(\d+)\s*(?:\/\s*([\d.]+%?))?\s*\)/),u=a||o;if(null===u)throw new x('Unsupported color: "'+e+'".');var l=parseInt(u[1],10),s=parseInt(u[2],10),c=parseInt(u[3],10),f=1;if(void 0!==u[4]){var d=u[4];f="%"===d.charAt(d.length-1)?parseFloat((parseFloat(d)/100).toFixed(2)):parseFloat(parseFloat(d).toFixed(2))}if(isNaN(l)||isNaN(s)||isNaN(c)||isNaN(f))throw new x('Failed to parse color values from: "'+e+'".');return{red:l,green:s,blue:c,alpha:f}}finally{document.body.removeChild(r)}}var C,j={},L=null,I=null,F=null,M=null,N={setThemeColor:function(t,r){void 0===r&&(r={duration:0,easingFunction:"linear",appearance:"default"});var n=r.duration,i=E(r.easingFunction),u=r.appearance;null!==L&&(window.cancelAnimationFrame(L),L=null,null!==I&&(I(R()),I=null));var c=R();void 0===c&&(c=void 0!==r.defaultColor?r.defaultColor:P()===e.Dark?"#181818ff":"#dcdcdcff");var f=k(c),d=k(t);return new Promise((function(e){I=e;var t=null;L=window.requestAnimationFrame((function r(c){null===t&&(t=c);var p,v=c-t;p=0===n?1:Math.min(v/n,1);var m=i(p),h={red:Math.round(f.red+(d.red-f.red)*m),green:Math.round(f.green+(d.green-f.green)*m),blue:Math.round(f.blue+(d.blue-f.blue)*m),alpha:+(f.alpha+(d.alpha-f.alpha)*m).toFixed(2)};(function(e){void 0===e&&(e="default");var t;t=!o||!a||l||s?"default":e;var r=j[t];if(void 0!==r)return r;r=document.createElement("meta"),l?r.setAttribute("name","msapplication-navbutton-color"):s?r.setAttribute("name","msapplication-TileColor"):r.setAttribute("name","theme-color");"default"!==e&&r.setAttribute("media","(prefers-color-scheme: "+t+")");return document.head.prepend(r),j[e]=r})(u).setAttribute("content",T(h)),p<1?L=window.requestAnimationFrame(r):(L=null,null!==I&&(e(R()),L=null))}))}))},getThemeColor:R,removeThemeColor:function(e){void 0===e&&(e="default");var t=j[e];void 0!==t&&t.remove();j[e]=void 0},detectAppearance:function(){return u?z():Promise.resolve(P())},onAppearanceChange:function(e,t){void 0===t&&(t=!1);var r={fn:e,capture:!1,once:!1};"boolean"==typeof t&&(t={capture:t});void 0!==t.capture&&(r.capture=t.capture);void 0!==t.once&&(r.once=t.once);void 0!==t.signal&&(r.signal=t.signal);var a=q(r);-1===a?(c.push(r),1===c.length&&(u?(z().then((function(e){F=e})),M=window.setInterval((function(){z().then((function(e){e!==F&&(F=e,U(e))}))}),2e3)):(o=r.capture,F=P(),"function"==typeof n.addEventListener?n.addEventListener("change",D,o):"function"==typeof n.addListener&&n.addListener(D))),this.detectAppearance().then(U)):c[a].once&&!r.once&&(c[a].once=!1);var o;void 0!==r.signal&&(r.signal.aborted?O(r):r.signal.addEventListener("abort",(function e(){void 0!==r.signal&&r.signal.removeEventListener("abort",e),O(r)})));return function(){O(r)}}};function A(e){var t=e.toString(16);switch(t.length){case 0:return"00";case 1:return"0"+t;default:return t}}function T(e){return"#"+A(e.red)+A(e.green)+A(e.blue)+A(Math.round(255*e.alpha))}function z(){return new Promise((function(t){var r=new Image;r.onload=function(){if(null===i)return t(e.Light);i.drawImage(r,0,0);var n=i.getImageData(0,0,1,1).data;(n[0]&n[1]&n[2])<255?t(e.Dark):t(e.Light)},r.onerror=function(){t(e.Unknown)},r.src="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjxyZWN0IHdpZHRoPSIxIiBoZWlnaHQ9IjEiIGZpbGw9IndoaXRlIi8+PC9zdmc+"}))}function P(){return a?n.matches?e.Dark:e.Light:e.Unknown}function D(t){var r;(r=t.matches?e.Dark:e.Light)!==F&&U(F=r)}function U(e){for(var t=0;t<c.length;t++){var r=c[t];r.fn(e),r.once&&O(r)}}function O(e){var t,r=q(e);-1!==r&&c.splice(r,1),0===c.length&&(u?(F=null,null!==M&&(clearInterval(M),M=null)):(t=e.capture,F=null,"function"==typeof n.removeEventListener?n.removeEventListener("change",D,t):"function"==typeof n.removeListener&&n.removeListener(D)))}function q(e){for(var t=0;t<c.length;t++)if(c[t].fn===e.fn&&c[t].capture===e.capture)return t;return-1}function H(){var e;j={},e=l?'meta[name="msapplication-navbutton-color"]':s?'meta[name="msapplication-TileColor"]':'meta[name="theme-color"]';var t=document.querySelectorAll(e);if(o&&a&&!l&&!s)for(var r=0;r<t.length;r++){var n=t.item(r),i=n.getAttribute("media");if("(prefers-color-scheme: dark)"===i&&void 0===j.dark?j.dark=n:"(prefers-color-scheme: light)"===i&&void 0===j.light?j.light=n:null===i&&void 0===j.default&&(j.default=n),void 0!==j.dark&&void 0!==j.light&&void 0!==j.default)return}else j.default=t[0]}function R(){var r=function(){if(l)return document.querySelector('meta[name="msapplication-navbutton-color"]');if(s)return document.querySelector('meta[name="msapplication-TileColor"]');if(!o||!a)return document.querySelector('meta[name="theme-color"]');var t,r=document.querySelectorAll('meta[name="theme-color"]');t=P()===e.Dark?"(prefers-color-scheme: dark)":"(prefers-color-scheme: light)";for(var n=0;n<r.length;n++){var i=r.item(n);if(i.hasAttribute("content")){var u=i.getAttribute("media");if(null===u||u===t)return i}}return null}();return null!==r?r.getAttribute("content"):/version\/[\w.,]+ .*safari/i.test(t)?navigator.standalone?P()===e.Dark?"#ffffffff":"#000000ff":T(k(window.getComputedStyle(document.body).backgroundColor)):/\b(?:crmo|crios)\/[\w.]+/i.test(t)||/chrome\/[\w.]+ mobile/i.test(t)?P()===e.Dark?"#28292cff":"#ffffffff":void 0}C=new MutationObserver((function(e){for(var t=0;t<e.length;t++){for(var r=e[t],n=r.addedNodes,a=r.removedNodes,o=0;o<n.length;o++)if(n[o]instanceof HTMLMetaElement)return H();for(o=0;o<a.length;o++)if(a[o]instanceof HTMLMetaElement)return H()}})),"function"==typeof n.addEventListener?n.addEventListener("change",H):"function"==typeof n.addListener&&n.addListener(H),C.observe(document.head,{childList:!0}),H();var Z={installed:!1,name:"Theme",module:N,Constants:{Appearances:e},Errors:{EasingError:p,UnsupportedEasingFunctionError:b,StepSyntaxError:h,LinearSyntaxError:m,CubicBezierSyntaxError:v,UnsupportedColorError:x}};export{Z as default};
@@ -788,14 +788,14 @@ function onAppearanceChange(listener, options) {
788
788
  };
789
789
  }
790
790
 
791
- var ThemePlugin = {
791
+ var NativeThemePlugin = {
792
792
  installed: false,
793
793
  name: 'Theme',
794
794
  module: Theme,
795
- constants: {
795
+ Constants: {
796
796
  Appearances: Appearances
797
797
  },
798
- errors: {
798
+ Errors: {
799
799
  EasingError: EasingError,
800
800
  UnsupportedEasingFunctionError: UnsupportedEasingFunctionError,
801
801
  StepSyntaxError: StepSyntaxError,
@@ -805,4 +805,4 @@ var ThemePlugin = {
805
805
  }
806
806
  };
807
807
 
808
- export { ThemePlugin as default };
808
+ export { NativeThemePlugin as default };
@@ -794,14 +794,14 @@
794
794
  };
795
795
  }
796
796
 
797
- var ThemePlugin = {
797
+ var NativeThemePlugin = {
798
798
  installed: false,
799
799
  name: 'Theme',
800
800
  module: Theme,
801
- constants: {
801
+ Constants: {
802
802
  Appearances: Appearances
803
803
  },
804
- errors: {
804
+ Errors: {
805
805
  EasingError: EasingError,
806
806
  UnsupportedEasingFunctionError: UnsupportedEasingFunctionError,
807
807
  StepSyntaxError: StepSyntaxError,
@@ -811,6 +811,6 @@
811
811
  }
812
812
  };
813
813
 
814
- return ThemePlugin;
814
+ return NativeThemePlugin;
815
815
 
816
816
  }));
@@ -1 +1 @@
1
- !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).Theme=t()}(this,(function(){"use strict";var e,t=navigator.userAgent;!function(e){e.Unknown="unknown",e.Light="light",e.Dark="dark"}(e||(e={}));var r=function(){var e=t.match(/chrome\/([\w.]+) mobile/i);if(null===e)return NaN;var r=parseInt(e[1]);return isNaN(r)?NaN:r}(),n=window.matchMedia("(prefers-color-scheme: dark)"),o="not all"!==n.media,a=isNaN(r)||r>=92,i=document.createElement("canvas").getContext("2d",{willReadFrequently:!0}),u=/Samsung/i.test(t),l=/iemobile/i.test(t),s=/windows phone/i.test(t),c=[];function f(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function d(e,t){function r(n){if(!(this instanceof r))return new r(n);var o=new t(n||"");if("function"==typeof Object.setPrototypeOf?Object.setPrototypeOf(o,r.prototype):o.__proto__=r.prototype,o.name=e,void 0!==n&&(o.message=n),"undefined"!=typeof Symbol&&Symbol.toStringTag)try{Object.defineProperty(o,Symbol.toStringTag,{value:e,writable:!1,enumerable:!1,configurable:!0})}catch(e){}if("function"==typeof Error.captureStackTrace)Error.captureStackTrace(o,r);else if(t.captureStackTrace&&"function"==typeof t.captureStackTrace)t.captureStackTrace(o,r);else try{var a=new t;a.stack&&(o.stack=a.stack)}catch(e){}return o}void 0===t&&(t=Error),r.prototype=Object.create(t.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(t){try{r.prototype.name=e}catch(e){}}try{Object.defineProperty(r,"name",{value:e,writable:!1,enumerable:!1,configurable:!0})}catch(e){}return r}"function"==typeof SuppressedError&&SuppressedError;var p=d("EasingError"),m=d("CubicBezierSyntaxError",p),v=d("LinearSyntaxError",p),h=d("StepSyntaxError",p),b=d("UnsupportedEasingFunctionError",p),g={linear:"linear(0, 1)",ease:"cubic-bezier(0.25, 0.1, 0.25, 1)","ease-in":"cubic-bezier(0.42, 0, 1, 1)","ease-out":"cubic-bezier(0, 0, 0.58, 1)","ease-in-out":"cubic-bezier(0.42, 0, 0.58, 1)","step-start":"steps(1, jump-start)","step-end":"steps(1, jump-end)"};function y(e,t,r){return e<t?t:e>r?r:e}function w(e){var t=function(e){var t=e.match(/cubic-bezier\((.*)\)/);if(null===t)throw new m("Invalid cubic-bezier syntax");var r=t[1].trim().split(","),n=[];if(4!==r.length)throw new m("Cubic-bezier must have exactly 4 numeric values");for(var o=0;o<4;o++){var a=parseFloat(r[o]);if(isNaN(a))throw new m("Cubic-bezier must have exactly 4 numeric values");if(o%2==0&&(a<0||a>1))throw new m("x1 and x2 must be between 0 and 1");n.push(a)}return{x1:n[0],y1:n[1],x2:n[2],y2:n[3]}}(e),r=t.x1,n=t.x2,o=t.y1,a=t.y2;return function(e){if(0===(e=y(e,0,1))||1===e)return e;var t=function(e,t,o){if(void 0===t&&(t=1e-6),void 0===o&&(o=50),e<=0)return 0;if(e>=1)return 1;for(var a=e,i=0;i<o;i++){var u=3*(1-a)*(1-a)*a*r+3*(1-a)*a*a*n+a*a*a,l=3*(1-a)*(1-a)*r+6*(1-a)*a*(n-r)+3*a*a*(1-n);if(Math.abs(l)<t)break;var s=a-(u-e)/l;if(Math.abs(s-a)<t){a=s;break}a=Math.max(0,Math.min(1,s))}return a}(e);return 3*(1-t)*(1-t)*t*o+3*(1-t)*t*t*a+t*t*t}}function S(e){var t=function(e){var t,r,n=e.match(/linear\((.*)\)/);if(null===n)throw new v("Invalid linear syntax");var o=n[1].trim();if(""===o)throw new v("Linear function must have at least one point");for(var a=o.split(","),i=[],u=0;u<a.length;u++){var l=a[u].trim(),s=l.match(/^([+-]?\d*\.?\d+)((?:\s+[+-]?\d*\.?\d+%){2,})$/);if(null===s){var c=l.match(/^([+-]?\d*\.?\d+)\s+([+-]?\d*\.?\d+)%$/);if(null===c){var d=l.match(/^([+-]?\d*\.?\d+)$/);if(null===d)throw new v('Invalid linear point format: "'+l+'"');i.push({position:1===a.length?0:u/(a.length-1),value:parseFloat(d[1])})}else i.push({position:parseFloat(c[2])/100,value:parseFloat(c[1])})}else{var p=parseFloat(s[1]),m=s[2].trim().split(/\s+/);try{for(var h=(t=void 0,f(m)),b=h.next();!b.done;b=h.next()){var g=b.value;i.push({value:p,position:parseFloat(g)/100})}}catch(e){t={error:e}}finally{try{b&&!b.done&&(r=h.return)&&r.call(h)}finally{if(t)throw t.error}}}}if(0===i.length)throw new v("No valid points found in linear function");return i.sort((function(e,t){return e.position-t.position})),i[0].position>0&&i.unshift({position:0,value:0}),i[i.length-1].position<1&&i.push({position:1,value:1}),i}(e);return function(e){if((e=y(e,0,1))<=t[0].position)return t[0].value;if(e>=t[t.length-1].position)return t[t.length-1].value;for(var r=0;r<t.length-1;r++){var n=t[r],o=t[r+1];if(e>=n.position&&e<=o.position){if(n.position===o.position)return o.value;var a=(e-n.position)/(o.position-n.position);return n.value+(o.value-n.value)*a}}return t[t.length-1].value}}function x(e){if(function(e){return!/(linear|cubic-bezier|steps)\((.*)\)/.test(e)}(e)&&(e=g[e]),function(e){return/cubic-bezier\(/.test(e)}(e))return w(e);if(function(e){return/linear\(/.test(e)}(e))return S(e);if(function(e){return/steps\(\s*(\d+)\s*(?:,\s*(jump-start|jump-end|jump-none|jump-both|start|end)\s*)?\)$/.test(e)}(e))return function(e){var t=e.match(/steps\(\s*(\d+)\s*(?:,\s*(jump-start|jump-end|jump-none|jump-both|start|end)\s*)?\)$/);if(null===t)throw new h("Invalid steps syntax");var r=parseInt(t[1],10),n=t[2];if(r<=0)throw new h("Steps count must be a positive integer");if("jump-none"===n&&r<2)throw new h("jump-none requires at least 2 steps");return function(e){switch(e=y(e,0,1),n){case"start":case"jump-start":return 0===e?1/r:1===e?1:Math.ceil(e*r)/r;case void 0:case"end":case"jump-end":return 1===e?1:Math.floor(e*r)/r;case"jump-both":return 0===e?0:1===e?1:Math.round(e*(r+1))/(r+1);case"jump-none":return 0===e?0:1===e?1:Math.floor(e*(r-1))/(r-1);default:throw new h('Unsupported step position: "'+n+'"')}}}(e);throw new b('Unsupported easing function: "'+e+'"')}var E=d("UnsupportedColorError");function k(e){if("undefined"!=typeof CSS&&CSS.supports&&!CSS.supports("color",e))throw new E('Unsupported color: "'+e+'".');if(null!==i)try{i.clearRect(0,0,1,1),i.fillStyle=e,i.fillRect(0,0,1,1);var t=i.getImageData(0,0,1,1).data;return{red:t[0],green:t[1],blue:t[2],alpha:parseFloat((t[3]/255).toFixed(2))}}catch(e){}var r=document.createElement("div");r.style.position="absolute",r.style.top="-9999px",r.style.left="-9999px",r.style.width="1px",r.style.height="1px",r.style.color=e,document.body.appendChild(r);try{var n=window.getComputedStyle(r).color,o=n.match(/rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*([\d.]+))?\s*\)/),a=n.match(/rgba?\(\s*(\d+)\s+(\d+)\s+(\d+)\s*(?:\/\s*([\d.]+%?))?\s*\)/),u=o||a;if(null===u)throw new E('Unsupported color: "'+e+'".');var l=parseInt(u[1],10),s=parseInt(u[2],10),c=parseInt(u[3],10),f=1;if(void 0!==u[4]){var d=u[4];f="%"===d.charAt(d.length-1)?parseFloat((parseFloat(d)/100).toFixed(2)):parseFloat(parseFloat(d).toFixed(2))}if(isNaN(l)||isNaN(s)||isNaN(c)||isNaN(f))throw new E('Failed to parse color values from: "'+e+'".');return{red:l,green:s,blue:c,alpha:f}}finally{document.body.removeChild(r)}}var j,C={},L=null,I=null,F=null,M=null,N={setThemeColor:function(t,r){void 0===r&&(r={duration:0,easingFunction:"linear",appearance:"default"});var n=r.duration,i=x(r.easingFunction),u=r.appearance;null!==L&&(window.cancelAnimationFrame(L),L=null,null!==I&&(I(R()),I=null));var c=R();void 0===c&&(c=void 0!==r.defaultColor?r.defaultColor:P()===e.Dark?"#181818ff":"#dcdcdcff");var f=k(c),d=k(t);return new Promise((function(e){I=e;var t=null;L=window.requestAnimationFrame((function r(c){null===t&&(t=c);var p,m=c-t;p=0===n?1:Math.min(m/n,1);var v=i(p),h={red:Math.round(f.red+(d.red-f.red)*v),green:Math.round(f.green+(d.green-f.green)*v),blue:Math.round(f.blue+(d.blue-f.blue)*v),alpha:+(f.alpha+(d.alpha-f.alpha)*v).toFixed(2)};(function(e){void 0===e&&(e="default");var t;t=!a||!o||l||s?"default":e;var r=C[t];if(void 0!==r)return r;r=document.createElement("meta"),l?r.setAttribute("name","msapplication-navbutton-color"):s?r.setAttribute("name","msapplication-TileColor"):r.setAttribute("name","theme-color");"default"!==e&&r.setAttribute("media","(prefers-color-scheme: "+t+")");return document.head.prepend(r),C[e]=r})(u).setAttribute("content",T(h)),p<1?L=window.requestAnimationFrame(r):(L=null,null!==I&&(e(R()),L=null))}))}))},getThemeColor:R,removeThemeColor:function(e){void 0===e&&(e="default");var t=C[e];void 0!==t&&t.remove();C[e]=void 0},detectAppearance:function(){return u?z():Promise.resolve(P())},onAppearanceChange:function(e,t){void 0===t&&(t=!1);var r={fn:e,capture:!1,once:!1};"boolean"==typeof t&&(t={capture:t});void 0!==t.capture&&(r.capture=t.capture);void 0!==t.once&&(r.once=t.once);void 0!==t.signal&&(r.signal=t.signal);var o=q(r);-1===o?(c.push(r),1===c.length&&(u?(z().then((function(e){F=e})),M=window.setInterval((function(){z().then((function(e){e!==F&&(F=e,U(e))}))}),2e3)):(a=r.capture,F=P(),"function"==typeof n.addEventListener?n.addEventListener("change",D,a):"function"==typeof n.addListener&&n.addListener(D))),this.detectAppearance().then(U)):c[o].once&&!r.once&&(c[o].once=!1);var a;void 0!==r.signal&&(r.signal.aborted?O(r):r.signal.addEventListener("abort",(function e(){void 0!==r.signal&&r.signal.removeEventListener("abort",e),O(r)})));return function(){O(r)}}};function A(e){var t=e.toString(16);switch(t.length){case 0:return"00";case 1:return"0"+t;default:return t}}function T(e){return"#"+A(e.red)+A(e.green)+A(e.blue)+A(Math.round(255*e.alpha))}function z(){return new Promise((function(t){var r=new Image;r.onload=function(){if(null===i)return t(e.Light);i.drawImage(r,0,0);var n=i.getImageData(0,0,1,1).data;(n[0]&n[1]&n[2])<255?t(e.Dark):t(e.Light)},r.onerror=function(){t(e.Unknown)},r.src="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjxyZWN0IHdpZHRoPSIxIiBoZWlnaHQ9IjEiIGZpbGw9IndoaXRlIi8+PC9zdmc+"}))}function P(){return o?n.matches?e.Dark:e.Light:e.Unknown}function D(t){var r;(r=t.matches?e.Dark:e.Light)!==F&&U(F=r)}function U(e){for(var t=0;t<c.length;t++){var r=c[t];r.fn(e),r.once&&O(r)}}function O(e){var t,r=q(e);-1!==r&&c.splice(r,1),0===c.length&&(u?(F=null,null!==M&&(clearInterval(M),M=null)):(t=e.capture,F=null,"function"==typeof n.removeEventListener?n.removeEventListener("change",D,t):"function"==typeof n.removeListener&&n.removeListener(D)))}function q(e){for(var t=0;t<c.length;t++)if(c[t].fn===e.fn&&c[t].capture===e.capture)return t;return-1}function H(){var e;C={},e=l?'meta[name="msapplication-navbutton-color"]':s?'meta[name="msapplication-TileColor"]':'meta[name="theme-color"]';var t=document.querySelectorAll(e);if(a&&o&&!l&&!s)for(var r=0;r<t.length;r++){var n=t.item(r),i=n.getAttribute("media");if("(prefers-color-scheme: dark)"===i&&void 0===C.dark?C.dark=n:"(prefers-color-scheme: light)"===i&&void 0===C.light?C.light=n:null===i&&void 0===C.default&&(C.default=n),void 0!==C.dark&&void 0!==C.light&&void 0!==C.default)return}else C.default=t[0]}function R(){var r=function(){if(l)return document.querySelector('meta[name="msapplication-navbutton-color"]');if(s)return document.querySelector('meta[name="msapplication-TileColor"]');if(!a||!o)return document.querySelector('meta[name="theme-color"]');var t,r=document.querySelectorAll('meta[name="theme-color"]');t=P()===e.Dark?"(prefers-color-scheme: dark)":"(prefers-color-scheme: light)";for(var n=0;n<r.length;n++){var i=r.item(n);if(i.hasAttribute("content")){var u=i.getAttribute("media");if(null===u||u===t)return i}}return null}();return null!==r?r.getAttribute("content"):/version\/[\w.,]+ .*safari/i.test(t)?navigator.standalone?P()===e.Dark?"#ffffffff":"#000000ff":T(k(window.getComputedStyle(document.body).backgroundColor)):/\b(?:crmo|crios)\/[\w.]+/i.test(t)||/chrome\/[\w.]+ mobile/i.test(t)?P()===e.Dark?"#28292cff":"#ffffffff":void 0}return j=new MutationObserver((function(e){for(var t=0;t<e.length;t++){for(var r=e[t],n=r.addedNodes,o=r.removedNodes,a=0;a<n.length;a++)if(n[a]instanceof HTMLMetaElement)return H();for(a=0;a<o.length;a++)if(o[a]instanceof HTMLMetaElement)return H()}})),"function"==typeof n.addEventListener?n.addEventListener("change",H):"function"==typeof n.addListener&&n.addListener(H),j.observe(document.head,{childList:!0}),H(),{installed:!1,name:"Theme",module:N,constants:{Appearances:e},errors:{EasingError:p,UnsupportedEasingFunctionError:b,StepSyntaxError:h,LinearSyntaxError:v,CubicBezierSyntaxError:m,UnsupportedColorError:E}}}));
1
+ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).Theme=t()}(this,(function(){"use strict";var e,t=navigator.userAgent;!function(e){e.Unknown="unknown",e.Light="light",e.Dark="dark"}(e||(e={}));var r=function(){var e=t.match(/chrome\/([\w.]+) mobile/i);if(null===e)return NaN;var r=parseInt(e[1]);return isNaN(r)?NaN:r}(),n=window.matchMedia("(prefers-color-scheme: dark)"),o="not all"!==n.media,a=isNaN(r)||r>=92,i=document.createElement("canvas").getContext("2d",{willReadFrequently:!0}),u=/Samsung/i.test(t),l=/iemobile/i.test(t),s=/windows phone/i.test(t),c=[];function f(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function d(e,t){function r(n){if(!(this instanceof r))return new r(n);var o=new t(n||"");if("function"==typeof Object.setPrototypeOf?Object.setPrototypeOf(o,r.prototype):o.__proto__=r.prototype,o.name=e,void 0!==n&&(o.message=n),"undefined"!=typeof Symbol&&Symbol.toStringTag)try{Object.defineProperty(o,Symbol.toStringTag,{value:e,writable:!1,enumerable:!1,configurable:!0})}catch(e){}if("function"==typeof Error.captureStackTrace)Error.captureStackTrace(o,r);else if(t.captureStackTrace&&"function"==typeof t.captureStackTrace)t.captureStackTrace(o,r);else try{var a=new t;a.stack&&(o.stack=a.stack)}catch(e){}return o}void 0===t&&(t=Error),r.prototype=Object.create(t.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(t){try{r.prototype.name=e}catch(e){}}try{Object.defineProperty(r,"name",{value:e,writable:!1,enumerable:!1,configurable:!0})}catch(e){}return r}"function"==typeof SuppressedError&&SuppressedError;var p=d("EasingError"),m=d("CubicBezierSyntaxError",p),v=d("LinearSyntaxError",p),h=d("StepSyntaxError",p),b=d("UnsupportedEasingFunctionError",p),g={linear:"linear(0, 1)",ease:"cubic-bezier(0.25, 0.1, 0.25, 1)","ease-in":"cubic-bezier(0.42, 0, 1, 1)","ease-out":"cubic-bezier(0, 0, 0.58, 1)","ease-in-out":"cubic-bezier(0.42, 0, 0.58, 1)","step-start":"steps(1, jump-start)","step-end":"steps(1, jump-end)"};function y(e,t,r){return e<t?t:e>r?r:e}function w(e){var t=function(e){var t=e.match(/cubic-bezier\((.*)\)/);if(null===t)throw new m("Invalid cubic-bezier syntax");var r=t[1].trim().split(","),n=[];if(4!==r.length)throw new m("Cubic-bezier must have exactly 4 numeric values");for(var o=0;o<4;o++){var a=parseFloat(r[o]);if(isNaN(a))throw new m("Cubic-bezier must have exactly 4 numeric values");if(o%2==0&&(a<0||a>1))throw new m("x1 and x2 must be between 0 and 1");n.push(a)}return{x1:n[0],y1:n[1],x2:n[2],y2:n[3]}}(e),r=t.x1,n=t.x2,o=t.y1,a=t.y2;return function(e){if(0===(e=y(e,0,1))||1===e)return e;var t=function(e,t,o){if(void 0===t&&(t=1e-6),void 0===o&&(o=50),e<=0)return 0;if(e>=1)return 1;for(var a=e,i=0;i<o;i++){var u=3*(1-a)*(1-a)*a*r+3*(1-a)*a*a*n+a*a*a,l=3*(1-a)*(1-a)*r+6*(1-a)*a*(n-r)+3*a*a*(1-n);if(Math.abs(l)<t)break;var s=a-(u-e)/l;if(Math.abs(s-a)<t){a=s;break}a=Math.max(0,Math.min(1,s))}return a}(e);return 3*(1-t)*(1-t)*t*o+3*(1-t)*t*t*a+t*t*t}}function S(e){var t=function(e){var t,r,n=e.match(/linear\((.*)\)/);if(null===n)throw new v("Invalid linear syntax");var o=n[1].trim();if(""===o)throw new v("Linear function must have at least one point");for(var a=o.split(","),i=[],u=0;u<a.length;u++){var l=a[u].trim(),s=l.match(/^([+-]?\d*\.?\d+)((?:\s+[+-]?\d*\.?\d+%){2,})$/);if(null===s){var c=l.match(/^([+-]?\d*\.?\d+)\s+([+-]?\d*\.?\d+)%$/);if(null===c){var d=l.match(/^([+-]?\d*\.?\d+)$/);if(null===d)throw new v('Invalid linear point format: "'+l+'"');i.push({position:1===a.length?0:u/(a.length-1),value:parseFloat(d[1])})}else i.push({position:parseFloat(c[2])/100,value:parseFloat(c[1])})}else{var p=parseFloat(s[1]),m=s[2].trim().split(/\s+/);try{for(var h=(t=void 0,f(m)),b=h.next();!b.done;b=h.next()){var g=b.value;i.push({value:p,position:parseFloat(g)/100})}}catch(e){t={error:e}}finally{try{b&&!b.done&&(r=h.return)&&r.call(h)}finally{if(t)throw t.error}}}}if(0===i.length)throw new v("No valid points found in linear function");return i.sort((function(e,t){return e.position-t.position})),i[0].position>0&&i.unshift({position:0,value:0}),i[i.length-1].position<1&&i.push({position:1,value:1}),i}(e);return function(e){if((e=y(e,0,1))<=t[0].position)return t[0].value;if(e>=t[t.length-1].position)return t[t.length-1].value;for(var r=0;r<t.length-1;r++){var n=t[r],o=t[r+1];if(e>=n.position&&e<=o.position){if(n.position===o.position)return o.value;var a=(e-n.position)/(o.position-n.position);return n.value+(o.value-n.value)*a}}return t[t.length-1].value}}function x(e){if(function(e){return!/(linear|cubic-bezier|steps)\((.*)\)/.test(e)}(e)&&(e=g[e]),function(e){return/cubic-bezier\(/.test(e)}(e))return w(e);if(function(e){return/linear\(/.test(e)}(e))return S(e);if(function(e){return/steps\(\s*(\d+)\s*(?:,\s*(jump-start|jump-end|jump-none|jump-both|start|end)\s*)?\)$/.test(e)}(e))return function(e){var t=e.match(/steps\(\s*(\d+)\s*(?:,\s*(jump-start|jump-end|jump-none|jump-both|start|end)\s*)?\)$/);if(null===t)throw new h("Invalid steps syntax");var r=parseInt(t[1],10),n=t[2];if(r<=0)throw new h("Steps count must be a positive integer");if("jump-none"===n&&r<2)throw new h("jump-none requires at least 2 steps");return function(e){switch(e=y(e,0,1),n){case"start":case"jump-start":return 0===e?1/r:1===e?1:Math.ceil(e*r)/r;case void 0:case"end":case"jump-end":return 1===e?1:Math.floor(e*r)/r;case"jump-both":return 0===e?0:1===e?1:Math.round(e*(r+1))/(r+1);case"jump-none":return 0===e?0:1===e?1:Math.floor(e*(r-1))/(r-1);default:throw new h('Unsupported step position: "'+n+'"')}}}(e);throw new b('Unsupported easing function: "'+e+'"')}var E=d("UnsupportedColorError");function k(e){if("undefined"!=typeof CSS&&CSS.supports&&!CSS.supports("color",e))throw new E('Unsupported color: "'+e+'".');if(null!==i)try{i.clearRect(0,0,1,1),i.fillStyle=e,i.fillRect(0,0,1,1);var t=i.getImageData(0,0,1,1).data;return{red:t[0],green:t[1],blue:t[2],alpha:parseFloat((t[3]/255).toFixed(2))}}catch(e){}var r=document.createElement("div");r.style.position="absolute",r.style.top="-9999px",r.style.left="-9999px",r.style.width="1px",r.style.height="1px",r.style.color=e,document.body.appendChild(r);try{var n=window.getComputedStyle(r).color,o=n.match(/rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*([\d.]+))?\s*\)/),a=n.match(/rgba?\(\s*(\d+)\s+(\d+)\s+(\d+)\s*(?:\/\s*([\d.]+%?))?\s*\)/),u=o||a;if(null===u)throw new E('Unsupported color: "'+e+'".');var l=parseInt(u[1],10),s=parseInt(u[2],10),c=parseInt(u[3],10),f=1;if(void 0!==u[4]){var d=u[4];f="%"===d.charAt(d.length-1)?parseFloat((parseFloat(d)/100).toFixed(2)):parseFloat(parseFloat(d).toFixed(2))}if(isNaN(l)||isNaN(s)||isNaN(c)||isNaN(f))throw new E('Failed to parse color values from: "'+e+'".');return{red:l,green:s,blue:c,alpha:f}}finally{document.body.removeChild(r)}}var j,C={},L=null,I=null,F=null,M=null,N={setThemeColor:function(t,r){void 0===r&&(r={duration:0,easingFunction:"linear",appearance:"default"});var n=r.duration,i=x(r.easingFunction),u=r.appearance;null!==L&&(window.cancelAnimationFrame(L),L=null,null!==I&&(I(R()),I=null));var c=R();void 0===c&&(c=void 0!==r.defaultColor?r.defaultColor:P()===e.Dark?"#181818ff":"#dcdcdcff");var f=k(c),d=k(t);return new Promise((function(e){I=e;var t=null;L=window.requestAnimationFrame((function r(c){null===t&&(t=c);var p,m=c-t;p=0===n?1:Math.min(m/n,1);var v=i(p),h={red:Math.round(f.red+(d.red-f.red)*v),green:Math.round(f.green+(d.green-f.green)*v),blue:Math.round(f.blue+(d.blue-f.blue)*v),alpha:+(f.alpha+(d.alpha-f.alpha)*v).toFixed(2)};(function(e){void 0===e&&(e="default");var t;t=!a||!o||l||s?"default":e;var r=C[t];if(void 0!==r)return r;r=document.createElement("meta"),l?r.setAttribute("name","msapplication-navbutton-color"):s?r.setAttribute("name","msapplication-TileColor"):r.setAttribute("name","theme-color");"default"!==e&&r.setAttribute("media","(prefers-color-scheme: "+t+")");return document.head.prepend(r),C[e]=r})(u).setAttribute("content",T(h)),p<1?L=window.requestAnimationFrame(r):(L=null,null!==I&&(e(R()),L=null))}))}))},getThemeColor:R,removeThemeColor:function(e){void 0===e&&(e="default");var t=C[e];void 0!==t&&t.remove();C[e]=void 0},detectAppearance:function(){return u?z():Promise.resolve(P())},onAppearanceChange:function(e,t){void 0===t&&(t=!1);var r={fn:e,capture:!1,once:!1};"boolean"==typeof t&&(t={capture:t});void 0!==t.capture&&(r.capture=t.capture);void 0!==t.once&&(r.once=t.once);void 0!==t.signal&&(r.signal=t.signal);var o=q(r);-1===o?(c.push(r),1===c.length&&(u?(z().then((function(e){F=e})),M=window.setInterval((function(){z().then((function(e){e!==F&&(F=e,U(e))}))}),2e3)):(a=r.capture,F=P(),"function"==typeof n.addEventListener?n.addEventListener("change",D,a):"function"==typeof n.addListener&&n.addListener(D))),this.detectAppearance().then(U)):c[o].once&&!r.once&&(c[o].once=!1);var a;void 0!==r.signal&&(r.signal.aborted?O(r):r.signal.addEventListener("abort",(function e(){void 0!==r.signal&&r.signal.removeEventListener("abort",e),O(r)})));return function(){O(r)}}};function A(e){var t=e.toString(16);switch(t.length){case 0:return"00";case 1:return"0"+t;default:return t}}function T(e){return"#"+A(e.red)+A(e.green)+A(e.blue)+A(Math.round(255*e.alpha))}function z(){return new Promise((function(t){var r=new Image;r.onload=function(){if(null===i)return t(e.Light);i.drawImage(r,0,0);var n=i.getImageData(0,0,1,1).data;(n[0]&n[1]&n[2])<255?t(e.Dark):t(e.Light)},r.onerror=function(){t(e.Unknown)},r.src="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjxyZWN0IHdpZHRoPSIxIiBoZWlnaHQ9IjEiIGZpbGw9IndoaXRlIi8+PC9zdmc+"}))}function P(){return o?n.matches?e.Dark:e.Light:e.Unknown}function D(t){var r;(r=t.matches?e.Dark:e.Light)!==F&&U(F=r)}function U(e){for(var t=0;t<c.length;t++){var r=c[t];r.fn(e),r.once&&O(r)}}function O(e){var t,r=q(e);-1!==r&&c.splice(r,1),0===c.length&&(u?(F=null,null!==M&&(clearInterval(M),M=null)):(t=e.capture,F=null,"function"==typeof n.removeEventListener?n.removeEventListener("change",D,t):"function"==typeof n.removeListener&&n.removeListener(D)))}function q(e){for(var t=0;t<c.length;t++)if(c[t].fn===e.fn&&c[t].capture===e.capture)return t;return-1}function H(){var e;C={},e=l?'meta[name="msapplication-navbutton-color"]':s?'meta[name="msapplication-TileColor"]':'meta[name="theme-color"]';var t=document.querySelectorAll(e);if(a&&o&&!l&&!s)for(var r=0;r<t.length;r++){var n=t.item(r),i=n.getAttribute("media");if("(prefers-color-scheme: dark)"===i&&void 0===C.dark?C.dark=n:"(prefers-color-scheme: light)"===i&&void 0===C.light?C.light=n:null===i&&void 0===C.default&&(C.default=n),void 0!==C.dark&&void 0!==C.light&&void 0!==C.default)return}else C.default=t[0]}function R(){var r=function(){if(l)return document.querySelector('meta[name="msapplication-navbutton-color"]');if(s)return document.querySelector('meta[name="msapplication-TileColor"]');if(!a||!o)return document.querySelector('meta[name="theme-color"]');var t,r=document.querySelectorAll('meta[name="theme-color"]');t=P()===e.Dark?"(prefers-color-scheme: dark)":"(prefers-color-scheme: light)";for(var n=0;n<r.length;n++){var i=r.item(n);if(i.hasAttribute("content")){var u=i.getAttribute("media");if(null===u||u===t)return i}}return null}();return null!==r?r.getAttribute("content"):/version\/[\w.,]+ .*safari/i.test(t)?navigator.standalone?P()===e.Dark?"#ffffffff":"#000000ff":T(k(window.getComputedStyle(document.body).backgroundColor)):/\b(?:crmo|crios)\/[\w.]+/i.test(t)||/chrome\/[\w.]+ mobile/i.test(t)?P()===e.Dark?"#28292cff":"#ffffffff":void 0}return j=new MutationObserver((function(e){for(var t=0;t<e.length;t++){for(var r=e[t],n=r.addedNodes,o=r.removedNodes,a=0;a<n.length;a++)if(n[a]instanceof HTMLMetaElement)return H();for(a=0;a<o.length;a++)if(o[a]instanceof HTMLMetaElement)return H()}})),"function"==typeof n.addEventListener?n.addEventListener("change",H):"function"==typeof n.addListener&&n.addListener(H),j.observe(document.head,{childList:!0}),H(),{installed:!1,name:"Theme",module:N,Constants:{Appearances:e},Errors:{EasingError:p,UnsupportedEasingFunctionError:b,StepSyntaxError:h,LinearSyntaxError:v,CubicBezierSyntaxError:m,UnsupportedColorError:E}}}));
@@ -1,3 +1,3 @@
1
- import type { AppModule } from '../types/appModule';
2
- declare const App: AppModule;
1
+ import type { AppInstance } from '../types';
2
+ declare const App: AppInstance;
3
3
  export default App;
@@ -1,5 +1,5 @@
1
1
  import type { NativePlugin } from '../../types';
2
- import type { AppModule } from "./types";
2
+ import type { AppInstance } from "./types";
3
3
  export * from './types';
4
- declare const AppPlugin: NativePlugin<AppModule>;
5
- export default AppPlugin;
4
+ declare const NativeAppPlugin: NativePlugin<AppInstance>;
5
+ export default NativeAppPlugin;
@@ -48,7 +48,7 @@ export declare type MessengerOpenOptions = {
48
48
  body?: Stringifiable;
49
49
  } | HTMLFormElement | FormData;
50
50
  export declare type Messenger = Record<Messengers, (options: MessengerOpenOptions, self?: WindowProxy) => Promise<void>>;
51
- export declare interface App {
51
+ export declare interface AppInstance {
52
52
  open: (options: AppOpenOptions, target?: WindowProxy) => Promise<AppOpenState>;
53
53
  messenger: Messenger;
54
54
  }
@@ -48,7 +48,7 @@ export declare type MessengerOpenOptions = {
48
48
  body?: Stringifiable;
49
49
  } | HTMLFormElement | FormData;
50
50
  export declare type Messenger = Record<Messengers, (options: MessengerOpenOptions, self?: WindowProxy) => Promise<void>>;
51
- export declare interface AppModule {
51
+ export declare interface AppInstance {
52
52
  open: (options: AppOpenOptions, target?: WindowProxy) => Promise<AppOpenState>;
53
53
  messenger: Messenger;
54
54
  }
@@ -1 +1 @@
1
- export * from './appModule';
1
+ export * from './app';
@@ -1,3 +1,3 @@
1
- import type { EventListenerUtil } from '../types/appModule';
1
+ import type { EventListenerUtil } from '../types';
2
2
  declare const EventListenerUtils: EventListenerUtil;
3
3
  export default EventListenerUtils;
@@ -1,3 +1,3 @@
1
- import type { PlatformModule } from '../types/platformModule';
2
- declare const Platform: PlatformModule;
1
+ import type { PlatformInstance } from '../types';
2
+ declare const Platform: PlatformInstance;
3
3
  export default Platform;
@@ -1,5 +1,5 @@
1
1
  import type { NativePlugin } from '../../types';
2
- import type { PlatformModule } from "./types";
2
+ import type { PlatformInstance } from "./types";
3
3
  export * from './types';
4
- declare const PlatformPlugin: NativePlugin<PlatformModule>;
5
- export default PlatformPlugin;
4
+ declare const NativePlatformPlugin: NativePlugin<PlatformInstance>;
5
+ export default NativePlatformPlugin;
@@ -1 +1 @@
1
- export * from './platformModule';
1
+ export * from './platform';
@@ -1,5 +1,5 @@
1
1
  import { Devices, Engines, OS } from '../../../constants/platform';
2
- export declare interface Platform {
2
+ export declare interface PlatformInstance {
3
3
  os: OS;
4
4
  device: Devices;
5
5
  engine: Engines;
@@ -1,5 +1,5 @@
1
1
  import { Devices, Engines, OS } from '../../../constants/platform';
2
- export declare interface PlatformModule {
2
+ export declare interface PlatformInstance {
3
3
  os: OS;
4
4
  device: Devices;
5
5
  engine: Engines;
@@ -1,4 +1,4 @@
1
- import type { ListenerEntry } from '../types/themeModule';
1
+ import type { ListenerEntry } from '../types';
2
2
  export declare enum Appearances {
3
3
  Unknown = "unknown",
4
4
  Light = "light",
@@ -1,3 +1,3 @@
1
- import type { ThemeModule } from '../types/themeModule';
2
- declare const Theme: ThemeModule;
1
+ import type { ThemeInstance } from '../types';
2
+ declare const Theme: ThemeInstance;
3
3
  export default Theme;
@@ -1,5 +1,5 @@
1
1
  import type { NativePlugin } from '../../types';
2
- import type { ThemeModule } from "./types";
2
+ import type { ThemeInstance } from "./types";
3
3
  export * from './types';
4
- declare const ThemePlugin: NativePlugin<ThemeModule>;
5
- export default ThemePlugin;
4
+ declare const NativeThemePlugin: NativePlugin<ThemeInstance>;
5
+ export default NativeThemePlugin;
@@ -1,3 +1,3 @@
1
1
  export * from './color';
2
2
  export * from './easing-syntax';
3
- export * from './themeModule';
3
+ export * from './theme';
@@ -1,19 +1,11 @@
1
1
  import { Appearances } from '../constants/theme';
2
- import type { EasingKeyword, EasingSyntax } from '../types/easing-syntax';
3
- import type { Color } from '../types/color';
2
+ import type { EasingKeyword, EasingSyntax, Color } from '../types';
4
3
  export declare interface ListenerEntry {
5
4
  fn: (appearance: Appearances) => any;
6
5
  capture: boolean;
7
6
  once: boolean;
8
7
  signal?: AbortSignal;
9
8
  }
10
- export declare interface Theme {
11
- setThemeColor: (color: Color, options?: SetThemeColorOptions) => Promise<string | undefined>;
12
- getThemeColor: () => Color | undefined;
13
- removeThemeColor: (appearance?: ThemeColorMetaAppearanceKeys) => void;
14
- detectAppearance: () => Promise<Appearances>;
15
- onAppearanceChange: (listener: (appearance?: Appearances) => any, options?: boolean | AddEventListenerOptions) => () => void;
16
- }
17
9
  export declare type ThemeColorMetaAppearanceKeys = 'default' | 'dark' | 'light';
18
10
  export declare type ThemeColorMetaGroup = Partial<Record<ThemeColorMetaAppearanceKeys, HTMLMetaElement>>;
19
11
  export declare interface SetThemeColorOptions {
@@ -22,3 +14,10 @@ export declare interface SetThemeColorOptions {
22
14
  easingFunction?: EasingSyntax | EasingKeyword;
23
15
  defaultColor?: string;
24
16
  }
17
+ export declare interface ThemeInstance {
18
+ setThemeColor: (color: Color, options?: SetThemeColorOptions) => Promise<string | undefined>;
19
+ getThemeColor: () => Color | undefined;
20
+ removeThemeColor: (appearance?: ThemeColorMetaAppearanceKeys) => void;
21
+ detectAppearance: () => Promise<Appearances>;
22
+ onAppearanceChange: (listener: (appearance?: Appearances) => any, options?: boolean | AddEventListenerOptions) => () => void;
23
+ }
@@ -15,7 +15,7 @@ export declare interface SetThemeColorOptions {
15
15
  easingFunction?: EasingSyntax | EasingKeyword;
16
16
  defaultColor?: string;
17
17
  }
18
- export declare interface ThemeModule {
18
+ export declare interface ThemeInstance {
19
19
  setThemeColor: (color: Color, options?: SetThemeColorOptions) => Promise<string | undefined>;
20
20
  getThemeColor: () => Color | undefined;
21
21
  removeThemeColor: (appearance?: ThemeColorMetaAppearanceKeys) => void;
@@ -1,2 +1,2 @@
1
- import type { RGBA } from '../types/color';
1
+ import type { RGBA } from '../types';
2
2
  export default function parseColor(color: string): RGBA;
@@ -1,2 +1,2 @@
1
- import type { EasingFunction, EasingKeyword, EasingSyntax } from '../types/easing-syntax';
1
+ import type { EasingFunction, EasingKeyword, EasingSyntax } from '../types';
2
2
  export default function parseEasingFunction(easingFunction: EasingSyntax | EasingKeyword): EasingFunction;
@@ -1,14 +1,14 @@
1
- export declare interface NativePlugin<T> {
1
+ export declare interface ModuleBase {
2
+ Constants: Record<string, any>;
3
+ Errors: Record<string, ErrorConstructor>;
4
+ }
5
+ export declare interface NativePlugin<T> extends ModuleBase {
2
6
  installed: boolean;
3
7
  name: string;
4
8
  module: T;
5
- constants: Record<string, any>;
6
- errors: Record<string, ErrorConstructor>;
7
9
  }
8
- export declare interface NativeBase {
10
+ export declare interface NativeBase extends ModuleBase {
9
11
  Version: string;
10
- Constants: Record<string, any>;
11
- Errors: Record<string, ErrorConstructor>;
12
- extends: <T>(plugin: NativePlugin<T>) => Native;
12
+ extends: <T>(plugin: NativePlugin<T>) => NativeInstance;
13
13
  }
14
- export declare type Native = NativeBase & Record<Exclude<string, keyof NativeBase>, any>;
14
+ export declare type NativeInstance = NativeBase & Record<Exclude<string, keyof NativeBase>, any>;
@@ -1,3 +1,3 @@
1
- import type { AppModule } from '../types/appModule';
2
- declare const App: AppModule;
1
+ import type { AppInstance } from '../types';
2
+ declare const App: AppInstance;
3
3
  export default App;
@@ -1,5 +1,5 @@
1
1
  import type { NativePlugin } from '../../types';
2
- import type { AppModule } from "./types";
2
+ import type { AppInstance } from "./types";
3
3
  export * from './types';
4
- declare const AppPlugin: NativePlugin<AppModule>;
5
- export default AppPlugin;
4
+ declare const NativeAppPlugin: NativePlugin<AppInstance>;
5
+ export default NativeAppPlugin;
@@ -48,7 +48,7 @@ export declare type MessengerOpenOptions = {
48
48
  body?: Stringifiable;
49
49
  } | HTMLFormElement | FormData;
50
50
  export declare type Messenger = Record<Messengers, (options: MessengerOpenOptions, self?: WindowProxy) => Promise<void>>;
51
- export declare interface App {
51
+ export declare interface AppInstance {
52
52
  open: (options: AppOpenOptions, target?: WindowProxy) => Promise<AppOpenState>;
53
53
  messenger: Messenger;
54
54
  }
@@ -48,7 +48,7 @@ export declare type MessengerOpenOptions = {
48
48
  body?: Stringifiable;
49
49
  } | HTMLFormElement | FormData;
50
50
  export declare type Messenger = Record<Messengers, (options: MessengerOpenOptions, self?: WindowProxy) => Promise<void>>;
51
- export declare interface AppModule {
51
+ export declare interface AppInstance {
52
52
  open: (options: AppOpenOptions, target?: WindowProxy) => Promise<AppOpenState>;
53
53
  messenger: Messenger;
54
54
  }
@@ -1 +1 @@
1
- export * from './appModule';
1
+ export * from './app';
@@ -1,3 +1,3 @@
1
- import type { EventListenerUtil } from '../types/appModule';
1
+ import type { EventListenerUtil } from '../types';
2
2
  declare const EventListenerUtils: EventListenerUtil;
3
3
  export default EventListenerUtils;
@@ -1,3 +1,3 @@
1
- import type { PlatformModule } from '../types/platformModule';
2
- declare const Platform: PlatformModule;
1
+ import type { PlatformInstance } from '../types';
2
+ declare const Platform: PlatformInstance;
3
3
  export default Platform;
@@ -1,5 +1,5 @@
1
1
  import type { NativePlugin } from '../../types';
2
- import type { PlatformModule } from "./types";
2
+ import type { PlatformInstance } from "./types";
3
3
  export * from './types';
4
- declare const PlatformPlugin: NativePlugin<PlatformModule>;
5
- export default PlatformPlugin;
4
+ declare const NativePlatformPlugin: NativePlugin<PlatformInstance>;
5
+ export default NativePlatformPlugin;
@@ -1 +1 @@
1
- export * from './platformModule';
1
+ export * from './platform';
@@ -1,5 +1,5 @@
1
1
  import { Devices, Engines, OS } from '../../../constants/platform';
2
- export declare interface Platform {
2
+ export declare interface PlatformInstance {
3
3
  os: OS;
4
4
  device: Devices;
5
5
  engine: Engines;
@@ -1,5 +1,5 @@
1
1
  import { Devices, Engines, OS } from '../../../constants/platform';
2
- export declare interface PlatformModule {
2
+ export declare interface PlatformInstance {
3
3
  os: OS;
4
4
  device: Devices;
5
5
  engine: Engines;
@@ -1,4 +1,4 @@
1
- import type { ListenerEntry } from '../types/themeModule';
1
+ import type { ListenerEntry } from '../types';
2
2
  export declare enum Appearances {
3
3
  Unknown = "unknown",
4
4
  Light = "light",
@@ -1,3 +1,3 @@
1
- import type { ThemeModule } from '../types/themeModule';
2
- declare const Theme: ThemeModule;
1
+ import type { ThemeInstance } from '../types';
2
+ declare const Theme: ThemeInstance;
3
3
  export default Theme;
@@ -1,5 +1,5 @@
1
1
  import type { NativePlugin } from '../../types';
2
- import type { ThemeModule } from "./types";
2
+ import type { ThemeInstance } from "./types";
3
3
  export * from './types';
4
- declare const ThemePlugin: NativePlugin<ThemeModule>;
5
- export default ThemePlugin;
4
+ declare const NativeThemePlugin: NativePlugin<ThemeInstance>;
5
+ export default NativeThemePlugin;
@@ -1,3 +1,3 @@
1
1
  export * from './color';
2
2
  export * from './easing-syntax';
3
- export * from './themeModule';
3
+ export * from './theme';
@@ -1,19 +1,11 @@
1
1
  import { Appearances } from '../constants/theme';
2
- import type { EasingKeyword, EasingSyntax } from '../types/easing-syntax';
3
- import type { Color } from '../types/color';
2
+ import type { EasingKeyword, EasingSyntax, Color } from '../types';
4
3
  export declare interface ListenerEntry {
5
4
  fn: (appearance: Appearances) => any;
6
5
  capture: boolean;
7
6
  once: boolean;
8
7
  signal?: AbortSignal;
9
8
  }
10
- export declare interface Theme {
11
- setThemeColor: (color: Color, options?: SetThemeColorOptions) => Promise<string | undefined>;
12
- getThemeColor: () => Color | undefined;
13
- removeThemeColor: (appearance?: ThemeColorMetaAppearanceKeys) => void;
14
- detectAppearance: () => Promise<Appearances>;
15
- onAppearanceChange: (listener: (appearance?: Appearances) => any, options?: boolean | AddEventListenerOptions) => () => void;
16
- }
17
9
  export declare type ThemeColorMetaAppearanceKeys = 'default' | 'dark' | 'light';
18
10
  export declare type ThemeColorMetaGroup = Partial<Record<ThemeColorMetaAppearanceKeys, HTMLMetaElement>>;
19
11
  export declare interface SetThemeColorOptions {
@@ -22,3 +14,10 @@ export declare interface SetThemeColorOptions {
22
14
  easingFunction?: EasingSyntax | EasingKeyword;
23
15
  defaultColor?: string;
24
16
  }
17
+ export declare interface ThemeInstance {
18
+ setThemeColor: (color: Color, options?: SetThemeColorOptions) => Promise<string | undefined>;
19
+ getThemeColor: () => Color | undefined;
20
+ removeThemeColor: (appearance?: ThemeColorMetaAppearanceKeys) => void;
21
+ detectAppearance: () => Promise<Appearances>;
22
+ onAppearanceChange: (listener: (appearance?: Appearances) => any, options?: boolean | AddEventListenerOptions) => () => void;
23
+ }
@@ -15,7 +15,7 @@ export declare interface SetThemeColorOptions {
15
15
  easingFunction?: EasingSyntax | EasingKeyword;
16
16
  defaultColor?: string;
17
17
  }
18
- export declare interface ThemeModule {
18
+ export declare interface ThemeInstance {
19
19
  setThemeColor: (color: Color, options?: SetThemeColorOptions) => Promise<string | undefined>;
20
20
  getThemeColor: () => Color | undefined;
21
21
  removeThemeColor: (appearance?: ThemeColorMetaAppearanceKeys) => void;
@@ -1,2 +1,2 @@
1
- import type { RGBA } from '../types/color';
1
+ import type { RGBA } from '../types';
2
2
  export default function parseColor(color: string): RGBA;
@@ -1,2 +1,2 @@
1
- import type { EasingFunction, EasingKeyword, EasingSyntax } from '../types/easing-syntax';
1
+ import type { EasingFunction, EasingKeyword, EasingSyntax } from '../types';
2
2
  export default function parseEasingFunction(easingFunction: EasingSyntax | EasingKeyword): EasingFunction;
@@ -1,14 +1,14 @@
1
- export declare interface NativePlugin<T> {
1
+ export declare interface ModuleBase {
2
+ Constants: Record<string, any>;
3
+ Errors: Record<string, ErrorConstructor>;
4
+ }
5
+ export declare interface NativePlugin<T> extends ModuleBase {
2
6
  installed: boolean;
3
7
  name: string;
4
8
  module: T;
5
- constants: Record<string, any>;
6
- errors: Record<string, ErrorConstructor>;
7
9
  }
8
- export declare interface NativeBase {
10
+ export declare interface NativeBase extends ModuleBase {
9
11
  Version: string;
10
- Constants: Record<string, any>;
11
- Errors: Record<string, ErrorConstructor>;
12
- extends: <T>(plugin: NativePlugin<T>) => Native;
12
+ extends: <T>(plugin: NativePlugin<T>) => NativeInstance;
13
13
  }
14
- export declare type Native = NativeBase & Record<Exclude<string, keyof NativeBase>, any>;
14
+ export declare type NativeInstance = NativeBase & Record<Exclude<string, keyof NativeBase>, any>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "native-fn",
3
- "version": "1.0.31",
3
+ "version": "1.0.32",
4
4
  "description": " ",
5
5
  "type": "module",
6
6