import{an as r,ah as c}from"./D3l4Cb4m.js";import{v as l}from"./BbpBKUVh.js";function m(o,e=50){if(!o)return;const t=o.scrollHeight,n=o.clientHeight;let s=o.scrollTop;function i(){s<t-n&&(s+=e,s>=t-n&&(s=t-n),o.scrollTop=s,requestAnimationFrame(i))}if(e===0){o.scrollTop=t-n;return}i()}function h(){const o=navigator.userAgent;let e="Unknown",t="";return/Chrom(e|ium)\/(\d+\.\d+)/.test(o)?(e="Chrome",t=RegExp.$2):/Firefox\/(\d+\.\d+)/.test(o)?(e="Firefox",t=RegExp.$1):/Version\/(\d+(\.\d+)+).*Safari/.test(o)?(e="Safari",t=RegExp.$1):/Edge\/(\d+(\.\d+)+)/.test(o)?(e="Edge",t=RegExp.$1):/OPR\/(\d+(\.\d+)+)/.test(o)||/Opera\/(\d+(\.\d+)+)/.test(o)?(e="Opera",t=RegExp.$1):/MSIE (\d+\.\d+);/.test(o)&&(e="Internet Explorer",t=RegExp.$1),{browserName:e,browserVersion:t}}function g(){const o=navigator.userAgent;let e="Unknown OS",t="";if(/Windows NT 10.0/.test(o)?e="Windows 10":/Windows NT 6.3/.test(o)?e="Windows 8.1":/Windows NT 6.2/.test(o)?e="Windows 8":/Windows NT 6.1/.test(o)?e="Windows 7":/Windows NT 6.0/.test(o)?e="Windows Vista":/Windows NT 5.1/.test(o)?e="Windows XP":/Windows NT 5.0/.test(o)?e="Windows 2000":/Windows/.test(o)&&(e="Windows (unknown version)"),/iPad|iPhone|iPod/.test(o)&&!window.MSStream){const n=o.match(/OS (\d+)_(\d+)_?(\d+)?/);n&&(e="iOS",t=`${n[1]}.${n[2]||0}.${n[3]||0}`)}return/Macintosh/.test(o)&&(e="macOS"),/Android/.test(o)&&(e="Android",t=o.match(/Android (\d+(\.\d+)+)/)[1]),{systemName:e,systemVersion:t}}function $(o){const e=new Audio(o);return e.addEventListener("canplaythrough",()=>{e.play()}),e.addEventListener("ended",()=>{e.remove(),e.src=""}),e}function w(){const o=window.location.hostname,e=window.location.protocol,t=window.location.port?`:${window.location.port}`:"",n=`${e}//${o}${t}`;return n.includes("localhost")?"https://linkasia-test.linkcircle.cn:30087":n}function f(o){return window.btoa(encodeURIComponent(o).replace(/%([0-9A-F]{2})/g,(e,t)=>String.fromCharCode(+`0x${t}`)))}function b(o,e){const t=w(),n="/preview/onlinePreview",s=`${l()}_${e}`,i=new URL(o);i.searchParams.set("fullfilename",s);const a=f(i.toString()),d=`${t}${n}?url=${a}`;window.open(d)}async function E(o,e){try{const t=await fetch(o);if(!t.ok)throw new Error(`HTTP error! status: ${t.status}`);const n=await t.blob();if(n.type==="application/json")throw new Error(r.global.t("文件下载失败"));const s=window.URL.createObjectURL(n),i=document.createElement("a");i.href=s,i.download=e,document.body.appendChild(i),i.click(),window.URL.revokeObjectURL(s),document.body.removeChild(i)}catch{c.error(r.global.t("文件下载失败"))}}export{$ as a,h as b,E as f,g,b as p,m as s};
