/**
 * Skipped minification because the original files appears to be already minified.
 * Original file: /npm/use-idb@0.0.1/lib/index.js
 *
 * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files
 */
"use strict";function e(e){return"object"==typeof e&&!function(e){return null==e||e!=e}(e)&&/Iterator\]$/.test(e.toString())}function t(t){try{if(e(t))return"Iterator";const n=Object.prototype.toString.call(t).match(/\[object (\w+)\]/)[1];return"Number"===n&&isNaN(t)?"NaN":n}catch(t){return"Undefined"}}function n(e,n,o){return["Object","Array"].includes(t(e))?JSON.stringify(e,n,o):JSON.stringify(function(e){return"String"===t(e)?e:["Function","AsyncFunction","GeneratorFunction","Symbol","RegExp","Promise","Date","NaN","Map","Set","WeakMap","WeakSet","BigInt"].includes(t(e))?e.toString():e===1/0?"Infinity":e===-1/0?"-Infinity":void 0===e?"undefined":null===e?"null":JSON.stringify(e)}(e),n,o).replace(/^(")+|(")+$/g,"")}function o(e){return null==e||e!=e}const r=Array.isArray;function c(e){return!o(e)&&(r(e)&&e.length>0)}function s(e){try{if("object"==typeof(t=e)&&!o(t)&&/Iterator\]$/.test(t.toString()))return"Iterator";const n=Object.prototype.toString.call(e).match(/\[object (\w+)\]/)[1];return"Number"===n&&isNaN(e)?"NaN":n}catch(e){return"Undefined"}var t}function i(e,t=!1){return t?"function"==typeof e:"Function"===s(e)}function u(e){return null!==e&&"object"==typeof e&&"Object"===s(e)}function a(e){return"string"==typeof e}const l=e=>"number"==typeof e&&"Number"===s(e);function d(e,t,n=!1){if(!r(t))return new RegExp("(^|\\s)"+t+"(\\s|$)").test(e.className);for(let o=0;o<t.length;o++){if(new RegExp("(^|\\s)"+t[o]+"(\\s|$)").test(e.className))return!0;if(n)return!1}return!1}const f=/ios|iphone|ipad|ipod/.test(navigator.userAgent.toLowerCase()),p=/android/.test(navigator.userAgent.toLowerCase());const m=window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches;function g(e,t={},n={}){const o=new Notification(e,t);for(const e in n)o[e]=n[e]}class x{length;storage;defaultValue;setCallback;getCallback;constructor(e,t){this.storage=e,this.length=e.length;const{defaultValue:n=null,getCallback:o,setCallback:r}=t||{};this.defaultValue=n,i(o)&&(this.getCallback=o),i(r)&&(this.setCallback=r)}getItem(e){return this.storage.getItem(e)}get(e,t=this.defaultValue){const n=this.storage.getItem(e);return i(this.getCallback)?this.getCallback(e,n,t):o(n)?t:n}getNumber(e,t=(l(this.defaultValue)?this.defaultValue:0)){const n=Number(this.get(e));return l(n)?n:t}getString(e,t=(a(this.defaultValue)?this.defaultValue:"")){const n=this.get(e);return a(n)?n:t}getObject(e,t=(u(this.defaultValue)?this.defaultValue:{})){try{const n=JSON.parse(this.get(e)||"{}");return u(n)?n:t}catch(e){return t}}getArray(e,t=(r(this.defaultValue)?this.defaultValue:[])){try{const n=JSON.parse(this.get(e)||"{}");return r(n)?n:t}catch(e){return t}}setItem(e,t){return this.setItem(e,JSON.stringify(t))}key(e){return this.storage.key(e)}removeItem(e){return this.storage.removeItem(e)}clear(){return this.storage.clear()}}const w=new x(localStorage),b=new x(sessionStorage);exports.MyDb=function(){return"my db"},exports.addClass=function(e,t){try{if(d(e,t))return!1;const n=e.className.split(" ");return n.concat(t),e.className=n.join(" "),!0}catch(e){return!1}},exports.addData=function(e,t,n){var o=e.transaction([t],"readwrite").objectStore(t).add(n);o.onsuccess=function(e){console.log("数据写入成功")},o.onerror=function(e){console.log("数据写入失败")}},exports.banConsole=function(e=3e3){const t=setInterval((function(){!function(){try{!function e(t){(function(){}).constructor("debugger")(),e()}()}catch(e){console.error(e)}}()}),e);window.__ban__console__timer__=t},exports.banCopy=function(){["contextmenu","selectstart","copy"].forEach((function(e){document.addEventListener(e,(function(e){return e.returnValue=!1}))}))},exports.checkSupportWebp=function(){return 0===document.createElement("canvas").toDataURL("image/webp").indexOf("data:image/webp")},exports.classNames=function(...e){const t=new Set,n={};function o(e,n){!1===e&&t.has(n)&&t.delete(n),!0!==e||t.has(n)||t.add(n)}!function e(r){r.forEach((r=>{if(r){if(Array.isArray(r))return e(r);if("string"!=typeof r&&"number"!=typeof r)if("Object"!==s(r));else for(const e in r){const t=!!r[e];n[e]=t,o(t,e)}else t.add(r)}}))}(e);for(const e in n)o(n[e],e);return[...t].join(" ")},exports.clearClass=function(e){try{if(e.className)return e.className="",!0}catch(e){return!1}return!1},exports.clearCookie=()=>document.cookie.split(";").forEach((e=>document.cookie=e.replace(/^ +/,"").replace(/=.*/,`=;expires=${new Date(0).toUTCString()};path=/`))),exports.closeDB=function(e){e.close(),console.log("数据库已关闭")},exports.copyText=function(e){const t=window.clipboardData;if(navigator.clipboard)return navigator.clipboard.writeText(e),!0;if(t)return t.clearData(),t.setData("Text",e),!0;if(document.execCommand){const t=document.createElement("textarea");return t.value=e,t.setAttribute("readonly",""),t.style.position="absolute",t.style.left="-9999px",document.body.appendChild(t),t.select(),document.execCommand("copy"),document.body.removeChild(t),!0}return!1},exports.cursorDelete=function(e,t,n,o){var r=e.transaction(t,"readwrite").objectStore(t).index(n).openCursor(IDBKeyRange.only(o));r.onsuccess=function(e){var t,n=e.target.result;n&&((t=n.delete()).onerror=function(){console.log("游标删除该记录失败")},t.onsuccess=function(){console.log("游标删除该记录成功")},n.continue())},r.onerror=function(e){}},exports.cursorGetData=function(e,t){let n=[];e.transaction(t,"readwrite").objectStore(t).openCursor().onsuccess=function(e){var t=e.target.result;t?(n.push(t.value),t.continue()):console.log("游标读取的数据：",n)}},exports.cursorGetDataByIndex=function(e,t,n,o){let r=[],c=e.transaction(t,"readwrite").objectStore(t).index(n).openCursor(IDBKeyRange.only(o));c.onsuccess=function(e){var t=e.target.result;t?(r.push(t.value),t.continue()):console.log("游标索引查询结果：",r)},c.onerror=function(e){}},exports.cursorGetDataByIndexAndPage=function(e,t,n,o,r,c){let s=[],i=0,u=!0;var a=e.transaction(t,"readwrite").objectStore(t).index(n).openCursor(IDBKeyRange.only(o));a.onsuccess=function(e){var t=e.target.result;if(r>1&&u)return u=!1,void t.advance((r-1)*c);t?(s.push(t.value),i++,i<c?t.continue():(t=null,console.log("分页查询结果",s))):console.log("分页查询结果",s)},a.onerror=function(e){}},exports.deleteDB=function(e,t,n){var o=e.transaction([t],"readwrite").objectStore(t).delete(n);o.onsuccess=function(){console.log("数据删除成功")},o.onerror=function(){console.log("数据删除失败")}},exports.deleteDBAll=function(e){console.log(e);let t=window.indexedDB.deleteDatabase(e);t.onerror=function(e){console.log("删除失败")},t.onsuccess=function(e){console.log("删除成功")}},exports.downloadFile=function(e){if(o(e))return;const t=document.createElement("a");t.href=e,t.click()},exports.exitFullScreen=function(){document.exitFullScreen?document.exitFullScreen():document.mozCancelFullScreen?document.mozCancelFullScreen():document.webkitExitFullscreen?document.webkitExitFullscreen():document.msExitFullscreen&&document.msExitFullscreen()},exports.exitFullscreen=function(e){const t=e.document;t.webkitCancelFullScreen?t.webkitCancelFullScreen():t.mozCancelFullScreen?t.mozCancelFullScreen():t.cancelFullScreen?t.cancelFullScreen():t.msExitFullscreen?t.msExitFullscreen():t.exitFullscreen?t.exitFullscreen():console.error("切换失败,可尝试Esc退出")},exports.fullScreen=function(e=document.body){e.requestFullscreen?e.requestFullscreen():e.mozRequestFullScreen?e.mozRequestFullScreen():e.webkitRequestFullscreen?e.webkitRequestFullscreen():e.msRequestFullscreen&&e.msRequestFullscreen()},exports.getCookie=function(e){if(o(document.cookie))return;const t=RegExp("(^|; )"+encodeURIComponent(e)+"=([^;]*)").exec(document.cookie);if(c(t)&&t.length>1){const e=t[2],n=/(.+)(<[a-zA-Z]+>)/.exec(e);if(c(n)&&n.length>1){const e=n[1],t=n[2]||"String";if("<Number>"===t)return Number(e);if(["<Array>","<Object>"].includes(t))try{return JSON.parse(e)}catch(t){return e}return e}return e}},exports.getDataByIndex=function(e,t,n,o){var r=e.transaction(t,"readwrite").objectStore(t).index(n).get(o);r.onerror=function(){console.log("事务失败")},r.onsuccess=function(e){var t=e.target.result;console.log("索引查询结果：",t)}},exports.getDataByKey=function(e,t,n){return new Promise(((o,r)=>{var c=e.transaction([t]).objectStore(t).get(n);c.onerror=function(e){console.log("事务失败")},c.onsuccess=function(e){console.log("主键查询结果: ",c.result),o(c.result)}}))},exports.getDeviceType=function(){const e=navigator.userAgent.toLowerCase();let t=(e.match(/firefox|chrome|safari|opera/g)||"other")[0];(e.match(/msie|trident/g)||[])[0]&&(t="msie");let n="",o="",r="";switch(n="ontouchstart"in window||-1!==e.indexOf("touch")||-1!==e.indexOf("mobile")?-1!==e.indexOf("ipad")?"pad":-1!==e.indexOf("mobile")?"mobile":-1!==e.indexOf("android")?"androidPad":"pc":"pc",t){case"chrome":case"safari":case"mobile":default:o="webkit";break;case"msie":o="ms";break;case"firefox":o="Moz";break;case"opera":o="O"}return r=e.indexOf("android")>0?"android":navigator.platform.toLowerCase(),{version:(e.match(/[\s\S]+(?:rv|it|ra|ie)[/: ]([\d.]+)/)||[])[1],plat:r,type:t,pc:n,prefix:o,isMobile:"pc"!=n}},exports.getFullScreenElement=function(){return document.fullscreenElement||document.mozFullScreenElement||document.msFullScreenElement||document.webkitFullscreenElement||null},exports.getHashQueryString=function(e){const t=window.location.href.split("?")[1];if(o(t))return null;const n=new RegExp(`(^|&)${e}=([^&]*)(&|$)`),r=t.match(n);return null!=r?decodeURIComponent(r[2]):null},exports.getQueryString=function(e=window.location.href,t){const n=new RegExp("(^|&)"+t+"=([^&]*)(&|$)?","i"),o=e.substr(1).match(n);return null!==o?decodeURI(o[2]):null},exports.getScrollPosition=(e=window)=>({}),exports.getSelectedText=function(){return window.getSelection().toString()},exports.getUrlParamIterator=function(e){return new URLSearchParams(e)},exports.getUrlParams=function(e){try{return JSON.parse(`{"${decodeURI(e.split("?")[1]).replace(/"/g,'\\"').replace(/&/g,'","').replace(/=/g,'":"')}"}`)}catch(e){return{}}},exports.hasClass=d,exports.isActiveTabView=()=>!document.hidden,exports.isAndroid=p,exports.isDarkMode=m,exports.isDesktop=function(){return!/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)},exports.isFocus=e=>e===document.activeElement,exports.isFullScreen=function(){return!!(document.fullscreen||document.mozFullScreen||document.webkitIsFullScreen||document.webkitFullScreen||document.msFullScreen)},exports.isFullScreenEnabled=function(){return document.fullscreenEnabled||document.mozFullScreenEnabled||document.webkitFullscreenEnabled||document.msFullscreenEnabled},exports.isIOS=f,exports.isMobile=function(){const e=navigator.userAgent,t=["android","iphone","ipod","ipad","windows phone","mqqbrowser"];if(/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(e))return!0;let n=!1;if((e.indexOf("Windows NT")<0||e.indexOf("Windows NT")>=0&&e.indexOf("compatible; MSIE 9.0;")>=0)&&e.indexOf("Windows NT")<0&&e.indexOf("Macintosh")<0)for(const o of t)if(e.indexOf(o)>=0){n=!0;break}return n},exports.isSupportIntersection=function(){return"IntersectionObserver"in window&&"IntersectionObserverEntry"in window&&"intersectionRatio"in window.IntersectionObserverEntry.prototype},exports.localStorageClass=w,exports.notBanConsole=function(){delete window.__ban__console__timer__},exports.notBanCopy=function(){["contextmenu","selectstart","copy"].forEach((function(e){document.addEventListener(e,(function(e){return e.returnValue=!0}))}))},exports.notify=function(e,t={},n={}){if(!("Notification"in window))return console.error("This browser does not support desktop notification");"granted"===Notification.permission?g(e,t,n):"denied"!==Notification.permission&&Notification.requestPermission().then((function(o){"granted"===o&&g(e,t,n)}))},exports.openDB=function(e,t=1){let n=window||{};return new Promise(((o,r)=>{let c=n.indexedDB||n.mozIndexedDB||n.webkitIndexedDB||n.msIndexedDB,s=null;const i=c.open(e,t);i.onsuccess=function(e){s=e.target.result,console.log("数据库打开成功"),o(s)},i.onerror=function(e){console.log("数据库打开报错")},i.onupgradeneeded=function(e){var t;console.log("onupgradeneeded"),s=e.target.result,(t=s.createObjectStore("signalChat",{keyPath:"sequenceId"})).createIndex("link","link",{unique:!1}),t.createIndex("sequenceId","sequenceId",{unique:!1}),t.createIndex("messageType","messageType",{unique:!1})}}))},exports.parseQueryString=function(e=window.location.href){const t="?"===e[0]?e:e.substring(e.lastIndexOf("?")),n={};return t.replace(/([^?&=]+)=([^&]+)/g,((e,t,o)=>n[t]=decodeURIComponent(o))),n},exports.redirect=e=>location.href=e,exports.removeClass=function(e,t){if(!d(e,t))return!1;try{if(r(t))return e.className=e.className.split(" ").filter((e=>!t.includes(e))).join(" "),!0;const n=new RegExp("(^|\\s)"+t+"(\\s|$)","g");return e.className=e.className.replace(n," "),!0}catch(e){return!1}},exports.requestAnimationFrameAdapter=function(){return window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||function(e,t=1e3){return setTimeout(e,t)}},exports.scrollTo=function(){},exports.scrollTop=function(){window.scrollTo({top:0,behavior:"smooth"})},exports.sessionStorageClass=b,exports.setCookie=function(e,t,o){const{expiryDays:r,domain:c,path:i}=o||{},u=r||10,a=new Date;a.setTime(a.getTime()+24*u*60*60*1e3);let l=`${e}=${n(t)}<${s(t)}>;expires=${a.toUTCString()}`;c&&(l+=";domain="+c),i&&(l+=";path="+i),document.cookie=l},exports.showPrintDialog=()=>window.print(),exports.toFullScreen=function(){const e=document.body;e.webkitRequestFullScreen?e.webkitRequestFullScreen():e.mozRequestFullScreen?e.mozRequestFullScreen():e.msRequestFullscreen?e.msRequestFullscreen():e.requestFullScreen?e.requestFullScreen():console.error("浏览器不支持全屏")},exports.updateDB=function(e,t,n){var o=e.transaction([t],"readwrite").objectStore(t).put(n);o.onsuccess=function(){console.log("数据更新成功")},o.onerror=function(){console.log("数据更新失败")}};
//# sourceMappingURL=index.js.map
