"use strict";function _toConsumableArray(e){return _arrayWithoutHoles(e)||_iterableToArray(e)||_unsupportedIterableToArray(e)||_nonIterableSpread()}function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _iterableToArray(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function _arrayWithoutHoles(e){if(Array.isArray(e))return _arrayLikeToArray(e)}function _slicedToArray(e,t){return _arrayWithHoles(e)||_iterableToArrayLimit(e,t)||_unsupportedIterableToArray(e,t)||_nonIterableRest()}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _iterableToArrayLimit(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,o,a,i,u=[],c=!0,l=!1;try{if(a=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=a.call(r)).done)&&(u.push(n.value),u.length!==t);c=!0);}catch(e){l=!0,o=e}finally{try{if(!c&&null!=r.return&&(i=r.return(),Object(i)!==i))return}finally{if(l)throw o}}return u}}function _arrayWithHoles(e){if(Array.isArray(e))return e}function _regeneratorRuntime(){_regeneratorRuntime=function(){return e};var e={},t=Object.prototype,r=t.hasOwnProperty,n=Object.defineProperty||function(e,t,r){e[t]=r.value},o="function"==typeof Symbol?Symbol:{},a=o.iterator||"@@iterator",i=o.asyncIterator||"@@asyncIterator",u=o.toStringTag||"@@toStringTag";function c(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{c({},"")}catch(e){c=function(e,t,r){return e[t]=r}}function l(e,t,r,o){var a=t&&t.prototype instanceof p?t:p,i=Object.create(a.prototype),u=new w(o||[]);return n(i,"_invoke",{value:E(e,r,u)}),i}function s(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}e.wrap=l;var f={};function p(){}function d(){}function v(){}var y={};c(y,a,function(){return this});var h=Object.getPrototypeOf,m=h&&h(h(I([])));m&&m!==t&&r.call(m,a)&&(y=m);var g=v.prototype=p.prototype=Object.create(y);function x(e){["next","throw","return"].forEach(function(t){c(e,t,function(e){return this._invoke(t,e)})})}function b(e,t){function o(n,a,i,u){var c=s(e[n],e,a);if("throw"!==c.type){var l=c.arg,f=l.value;return f&&"object"==_typeof(f)&&r.call(f,"__await")?t.resolve(f.__await).then(function(e){o("next",e,i,u)},function(e){o("throw",e,i,u)}):t.resolve(f).then(function(e){l.value=e,i(l)},function(e){return o("throw",e,i,u)})}u(c.arg)}var a;n(this,"_invoke",{value:function(e,r){function n(){return new t(function(t,n){o(e,r,t,n)})}return a=a?a.then(n,n):n()}})}function E(e,t,r){var n="suspendedStart";return function(o,a){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===o)throw a;return{value:void 0,done:!0}}for(r.method=o,r.arg=a;;){var i=r.delegate;if(i){var u=_(i,r);if(u){if(u===f)continue;return u}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var c=s(e,t,r);if("normal"===c.type){if(n=r.done?"completed":"suspendedYield",c.arg===f)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(n="completed",r.method="throw",r.arg=c.arg)}}}function _(e,t){var r=t.method,n=e.iterator[r];if(void 0===n)return t.delegate=null,"throw"===r&&e.iterator.return&&(t.method="return",t.arg=void 0,_(e,t),"throw"===t.method)||"return"!==r&&(t.method="throw",t.arg=new TypeError("The iterator does not provide a '"+r+"' method")),f;var o=s(n,e.iterator,t.arg);if("throw"===o.type)return t.method="throw",t.arg=o.arg,t.delegate=null,f;var a=o.arg;return a?a.done?(t[e.resultName]=a.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,f):a:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,f)}function S(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function L(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function w(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(S,this),this.reset(!0)}function I(e){if(e){var t=e[a];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var n=-1,o=function t(){for(;++n=0;--o){var a=this.tryEntries[o],i=a.completion;if("root"===a.tryLoc)return n("end");if(a.tryLoc<=this.prev){var u=r.call(a,"catchLoc"),c=r.call(a,"finallyLoc");if(u&&c){if(this.prev=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),L(r),f}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var o=n.arg;L(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,r){return this.delegate={iterator:I(e),resultName:t,nextLoc:r},"next"===this.method&&(this.arg=void 0),f}},e}function asyncGeneratorStep(e,t,r,n,o,a,i){try{var u=e[a](i),c=u.value}catch(e){return void r(e)}u.done?t(c):Promise.resolve(c).then(n,o)}function _asyncToGenerator(e){return function(){var t=this,r=arguments;return new Promise(function(n,o){var a=e.apply(t,r);function i(e){asyncGeneratorStep(a,n,o,i,u,"next",e)}function u(e){asyncGeneratorStep(a,n,o,i,u,"throw",e)}i(void 0)})}}function _createForOfIteratorHelper(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=_unsupportedIterableToArray(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,o=function(){};return{s:o,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,i=!0,u=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return i=e.done,e},e:function(e){u=!0,a=e},f:function(){try{i||null==r.return||r.return()}finally{if(u)throw a}}}}function _unsupportedIterableToArray(e,t){if(e){if("string"==typeof e)return _arrayLikeToArray(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?_arrayLikeToArray(e,t):void 0}}function _arrayLikeToArray(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);rn[o])return 1;if(r[o]=HIGH_DEVICE_BENCHMARK_LEVEL?DEVICE_PERFORMANCE_LEVEL.HIGH:t>=MIDDLE_DEVICE_BENCHMARK_LEVEL?DEVICE_PERFORMANCE_LEVEL.MIDDLE:DEVICE_PERFORMANCE_LEVEL.LOW};exports.resolveDevicePerformanceLevel=resolveDevicePerformanceLevel;var getDevicePerformanceProfile=function(){var e,t,r,n,o,a,i,u,c=null;try{var l,s,f;"function"==typeof(null===(l=wx)||void 0===l?void 0:l.getDeviceBenchmarkInfo)&&(u=wx.getDeviceBenchmarkInfo()),"number"!=typeof u&&"function"==typeof(null===(s=wx)||void 0===s?void 0:s.getDeviceInfo)?c=wx.getDeviceInfo():"number"!=typeof u&&"function"==typeof(null===(f=wx)||void 0===f?void 0:f.getSystemInfoSync)&&(c=wx.getSystemInfoSync())}catch(e){}var p=Number(null===(e=c)||void 0===e?void 0:e.benchmarkLevel),d=Number.isFinite(Number(u))?Number(u):Number.isFinite(p)?p:-1,v=resolveDevicePerformanceLevel(d);return omitUndefined({brand:null===(t=c)||void 0===t?void 0:t.brand,model:null===(r=c)||void 0===r?void 0:r.model,platform:null===(n=c)||void 0===n?void 0:n.platform,system:null===(o=c)||void 0===o?void 0:o.system,abi:null===(a=c)||void 0===a?void 0:a.abi,deviceAbi:null===(i=c)||void 0===i?void 0:i.deviceAbi,benchmarkLevel:d,performanceLevel:v})};exports.getDevicePerformanceProfile=getDevicePerformanceProfile;var isHighPerformanceDevice=function(e){return(null==e?void 0:e.performanceLevel)===DEVICE_PERFORMANCE_LEVEL.HIGH};exports.isHighPerformanceDevice=isHighPerformanceDevice;var isWeakNetwork=function(e){if(!e)return!1;if(!0===e.weakNet)return!0;var t=e.networkType;return"2g"===t||"3g"===t||"none"===t};exports.isWeakNetwork=isWeakNetwork;var safeDecodeURIComponent=function(e){if("string"!=typeof e||!e)return e;try{return decodeURIComponent(e)}catch(t){return e}};exports.safeDecodeURIComponent=safeDecodeURIComponent;var getDefaultUniqueId=function(){var e="volcmini_live_unique_id",t="".concat(Date.now()).concat(Math.random().toString().slice(2,5));try{var r=wx.getStorageSync(e);return r||(wx.setStorage({key:e,data:t}),r=t),r}catch(e){return console.error(e.message),t||""}},setJwtToken=function(e,t,r){var n="VOLCMINILive-".concat(r);e&&1===t&&wx.setStorage({key:n,data:JSON.stringify({time:(new Date).getTime(),token:e})})},getJwtToken=function(e){var t="",r="VOLCMINILive-".concat(e);try{var n=wx.getStorageSync(r),o=JSON.parse(n||"{}");o.time&&(new Date).getTime()-o.time<130464e4?t=o.token:wx.removeStorageSync({key:r})}catch(e){console.error("error",e)}return t},hexToRGBA=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"ff",r=/^#?([a-fA-F\d]{2})([a-fA-F\d]{2})([a-fA-F\d]{2})$/i.exec(e),n=e.includes("#")&&e.length<=4;n&&(r=/^#?([a-fA-F\d]{1})([a-fA-F\d]{1})([a-fA-F\d]{1})$/i.exec(e));var o=("0x".concat(t)/255).toFixed(2);if(null==r)return"rgba(255, 255, 255, ".concat(o,")");var a=r.map(function(e){return n?parseInt("".concat(e).concat(e),16):parseInt(e,16)}),i=a[1],u=a[2],c=a[3];return t?"rgba(".concat(i,", ").concat(u,", ").concat(c,", ").concat(o,")"):"rgb(".concat(i,", ").concat(u,", ").concat(c,")")};exports.hexToRGBA=hexToRGBA;var getValidStr=function(e){var t,r=_createForOfIteratorHelper(e);try{for(r.s();!(t=r.n()).done;){var n=t.value;if(n&&n.length>0)return n}}catch(e){r.e(e)}finally{r.f()}return""},getBySplit=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";if(!e)return"";var t=e.split(/\|||/);return getValidStr([t[0],t[-1],t[0],e])};exports.getBySplit=getBySplit;var HTTP_LINK_REG=/https?:\/\/(?:(?!https?:\/\/)[a-zA-Z]|[0-9]|[$\-_@.&+/]|[?!*(),=]|(?:%[0-9a-fA-F][0-9a-fA-F]))+/g,parseTextWithLinks=function(){var e,t=String((arguments.length>0&&void 0!==arguments[0]?arguments[0]:"")||""),r=[],n=0;for(HTTP_LINK_REG.lastIndex=0;e=HTTP_LINK_REG.exec(t);){var o=e[0];e.index>n&&r.push({type:"text",text:t.slice(n,e.index)}),r.push({type:"link",text:o,url:o}),n=e.index+o.length}return n1&&void 0!==arguments[1]?arguments[1]:SYSTEM_FONT_SCALE_FACTOR;return"calc(".concat(e.trim()," + ").concat(t," * (1rem - ").concat(SYSTEM_FONT_BASE_PX,"px))")},scaleNumberBySystemFont=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"px",r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:SYSTEM_FONT_SCALE_FACTOR;if(null==e||""===e)return"";var n="".concat(e).concat(t);return shouldSkipSystemFontValue(n)?n:buildSystemFontCalcValue(n,r)};exports.scaleNumberBySystemFont=scaleNumberBySystemFont;var generateUUID=function(){var e=(new Date).getTime();return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(t){var r=(e+16*Math.random())%16|0;return e=Math.floor(e/16),("x"===t?r:3&r|8).toString(16)})};function deepCopy(e){if("object"!==_typeof(e)||null===e)return e;var t={};return Object.keys(e).forEach(function(r){var n=e[r];"object"!==_typeof(n)||null===n?t[r]=n:Array.isArray(n)?t[r]=_toConsumableArray(n):n instanceof Set?t[r]=new Set(_toConsumableArray(n)):n instanceof Map?t[r]=new Map(_toConsumableArray(n)):t[r]=deepCopy(n)}),t}var _default={isString:isString,isObj:isObj,omitUndefined:omitUndefined,getValueByPath:getValueByPath,getChangedPatch:getChangedPatch,setDataIfChanged:setDataIfChanged,normalizePullUrl:normalizePullUrl,toSafeInt:toSafeInt,compareVersion:compareVersion,isWeakNetwork:isWeakNetwork,getCurrentLoopVideoProgram:getCurrentLoopVideoProgram,safeDecodeURIComponent:safeDecodeURIComponent,getDefaultUniqueId:getDefaultUniqueId,setJwtToken:setJwtToken,getJwtToken:getJwtToken,hexToRGBA:hexToRGBA,scaleNumberBySystemFont:scaleNumberBySystemFont,generateUUID:generateUUID,deepCopy:deepCopy};exports.default=_default;