jinbi-utils 1.0.21 → 1.0.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintignore +7 -0
- package/dist/index.esm.js +3079 -0
- package/dist/index.esm.min.js +15 -0
- package/dist/index.umd.js +3192 -0
- package/dist/index.umd.min.js +16 -0
- package/package.json +1 -1
- package/src/common/index.ts +105 -105
- package/src/constant/common.constant.ts +1 -1
- package/src/file/index.ts +8 -8
- package/src/http/apiBuilder/api-builder.ts +3 -3
- package/src/http/http.ts +2 -2
- package/src/http/httpEnums.ts +7 -7
- package/src/iam/index.ts +3 -3
- package/src/index.ts +6 -6
- package/src/middleware/requestLogger.middware.ts +21 -7
- package/src/middleware/requestLoggerUnified.ts +22 -8
- package/src/number/index.ts +4 -4
- package/src/string/index.ts +1 -1
- package/src/utils/curl.ts +76 -85
- package/src/websocket/emitter.ts +2 -2
- package/src/websocket/manager.ts +4 -4
- package/src/websocket/pinia-store.ts +6 -6
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import t from"axios";import{defineStore as e}from"pinia";var r={isWxWork:"wecom",isWeixin:"wechat",isMobile:"mobile",isMobileAny:"mobile"};function n(t){return new Promise((function(e){return setTimeout(e,t)}))}function o(){if("undefined"==typeof window)return!1;var t=navigator.userAgent.toLowerCase(),e=/midp/i.test(t),r=/ucweb/i.test(t),n=/android/i.test(t),o=/iphone os/i.test(t),i=/windows ce/i.test(t),s=/windows mobile/i.test(t),a=/rv:1.2.3.4/i.test(t);return e||r||n||o||i||s||a}function i(t){return null===t||""===t||void 0===t}var s=function(){localStorage.removeItem("wecom_userinfo"),localStorage.removeItem("wecom_token"),localStorage.removeItem("projectActive"),localStorage.removeItem("loginTime"),localStorage.removeItem("projectInfo")},a=function(t,e){var r=new RegExp("&{1}"+e+"\\=[a-zA-Z0-9_-]+","g"),n=t.replace(/\?/g,"&").match(r)[0];return n.substr(n.indexOf("=")+1)},u=function(t){for(var e=window.location.search.substring(1).split("&"),r=0;r<e.length;r++){var n=e[r].split("=");if(n[0]===t)return n[1]}return!1},c=function(){return localStorage.getItem("wecom_token")},f=function(){var t=navigator.userAgent.toLowerCase(),e=/wxwork/.test(t),r=/micromessenger/.test(t)&&!e,n=window.innerWidth<=768;return{isWxWork:e,isWeixin:r,isMobileScreen:n,isMobileAny:e||r||n}},l=function(t){var e="wecom";for(var n in t){if(t[n]){e=r[n];break}}return e};function d(t){t=t||32;for(var e="ABCDEFGHJKMNPQRSTWXYZabcdefhijkmnprstwxyz2345678",r=e.length,n="",o=0;o<t;o++)n+=e.charAt(Math.floor(Math.random()*r));return n}var h=function(t){for(var e="",r=document.cookie.split("; "),n=0;n<r.length;n++){var o=r[n].split("=");if(o[0]===t){e=o[1];break}}return e},p=function(){for(var t=[],e=0;e<=15;e++)t[e]=e.toString(16);var r="";for(e=1;e<=36;e++)r+=9===e||14===e||19===e||24===e?"-":15===e?4:20===e?t[4*Math.random()|8]:t[16*Math.random()|0];return r.replace(/-/g,"")},v=function(){return localStorage.getItem("jsapiTicket")},g=function(t){return localStorage.setItem("jsapiTicket",t)},m=function(){return localStorage.removeItem("jsapiTicket")},y=function(t,e){if(void 0===e&&(e="YYYY年MM月DD日 hh:mm:ss"),!t)return"-";var r=new Date(t),n=r.getFullYear()+"",o=r.getMonth()+1,i=r.getDate(),s=r.getHours()>9?r.getHours():"0"+r.getHours(),a=r.getMinutes()>9?r.getMinutes():"0"+r.getMinutes(),u=r.getSeconds()>9?r.getSeconds():"0"+r.getSeconds();return e.replace("YYYY",n+"").replace("MM",o+"").replace("DD",i+"").replace("hh",s+"").replace("mm",a+"").replace("ss",u+"")},w=function(t){for(var e=window.atob(t.split(",")[1]),r=new ArrayBuffer(e.length),n=new Uint8Array(r),o=0;o<e.length;o++)n[o]=e.charCodeAt(o);return new Blob([r],{type:"image/png"})},b=function(){var t=window.navigator.userAgent.match(/(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone)/i),e=/micromessenger/i.test(navigator.userAgent),r=/wxwork/i.test(navigator.userAgent);return r&&t?"com-wx-mobile":r&&!t?"com-wx-pc":e&&t?"wx-mobile":e&&!t?"wx-pc":"other"},S=function(){return/wxwork/i.test(navigator.userAgent)},A=function(){var t=!1;return"uat2-h5-wecom.hengdayun.com"!==location.origin&&"127.0.0.1:8081"!==location.origin&&"localhost:8081"!==location.origin||(t=!0),t},M=function(t,e){var r=new Set;return t.filter((function(t){var n=t[e];return!r.has(n)&&(r.add(n),!0)}))},C=function(t){for(var e=t.split(","),r=e[0].match(/:(.\*?);/)[1],n=atob(e[1]),o=n.length,i=new Uint8Array(o);o--;)i[o]=n.charCodeAt(o);return new Blob([i],{type:r})},E=function(t,e){for(var r=t.split(","),n=r[0].match(/:(.*);/)[1],o=atob(r[1]),i=o.length,s=new Uint8Array(i);i--;)s[i]=o.charCodeAt(i);return new File([s],e,{type:n})},x=function(t){return/^image\//i.test(t)},k=function(t){var e=t.split(","),r=e[0],n=void 0===r?"":r,o=e[1],i=void 0===o?"":o;return{name:decodeURIComponent(n),url:decodeURIComponent(i)}},I=function(t){return!t||""===t||/^(\d+)(\.\d{1,2})?$/.test(t.toString())},O=function(t,e){var r,n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".split(""),o=[];if(e=e||n.length,t)for(r=0;r<t;r++)o[r]=n[0|Math.random()*e];else{var i=void 0;for(o[8]=o[13]=o[18]=o[23]="-",o[14]="4",r=0;r<36;r++)o[r]||(i=0|16*Math.random(),o[r]=n[19==r?3&i|8:i])}return o.join("")},N=function(t,e){void 0===e&&(e="token");var r=t.toLowerCase();return"localstorage"===r?localStorage.getItem(e)||"":"sessionstorage"===r?sessionStorage.getItem(e)||"":localStorage.getItem(e)||sessionStorage.getItem("token")||""},j=function(t,e){void 0===e&&(e="token");var r=t.toLowerCase();"localstorage"===r?localStorage.removeItem(e):("sessionstorage"===r||localStorage.removeItem(e),sessionStorage.removeItem(e))};function R(t){return"string"==typeof t?t.replace(/-/g,"/"):t}function q(t){return t?new Date(R(t)):new Date}function B(t,e){void 0===t&&(t=Date.now()),void 0===e&&(e="yyyy-MM-dd HH:mm:ss"),t=R(t);var r={"M+":(t=new Date(t)).getMonth()+1,"d+":t.getDate(),"h+":t.getHours()%12==0?12:t.getHours()%12,"H+":t.getHours(),"m+":t.getMinutes(),"s+":t.getSeconds(),"q+":Math.floor((t.getMonth()+3)/3),S:t.getMilliseconds()};return/(y+)/.test(e)&&(e=e.replace(RegExp.$1,(""+t.getFullYear()).substr(4-RegExp.$1.length))),Object.keys(r).forEach((function(t){new RegExp("("+t+")").test(e)&&(e=e.replace(RegExp.$1,1===RegExp.$1.length?r[t]:("00"+r[t]).substr((""+r[t]).length)))})),e}function T(t,e,r){if(void 0===e&&(e="yyyy年MM月dd日 HH时mm分ss秒"),void 0===r&&(r="-"),i(t))return r;t=R(t);var n=new Date(t),o=(Date.now()-n.getTime())/1e3;return o<0?t:o<30?"刚刚":o<3600?Math.ceil(o/60)+"分钟前":o<86400?Math.floor(o/3600)+"小时前":o<172800?"1天前":B(t,e)}function U(t,e,r){if(void 0===e&&(e=0),void 0===r&&(r="yyyy-MM-dd"),i(t))return"-";t=R(t);var n=new Date(t);return n.setDate(n.getDate()+Number(e)),B(n,r)}
|
|
2
|
+
/*! *****************************************************************************
|
|
3
|
+
Copyright (c) Microsoft Corporation.
|
|
4
|
+
|
|
5
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
6
|
+
purpose with or without fee is hereby granted.
|
|
7
|
+
|
|
8
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
9
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
10
|
+
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
11
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
12
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
13
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
14
|
+
PERFORMANCE OF THIS SOFTWARE.
|
|
15
|
+
***************************************************************************** */var D=function(t,e){return(D=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(t,e)};function F(t,e){function r(){this.constructor=t}D(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}var P=function(){return(P=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++)for(var o in e=arguments[r])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t}).apply(this,arguments)};function z(t,e,r,n){return new(r||(r=Promise))((function(o,i){function s(t){try{u(n.next(t))}catch(t){i(t)}}function a(t){try{u(n.throw(t))}catch(t){i(t)}}function u(t){var e;t.done?o(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(s,a)}u((n=n.apply(t,e||[])).next())}))}function H(t,e){var r,n,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;s;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,n=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!(o=s.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){s.label=i[1];break}if(6===i[0]&&s.label<o[1]){s.label=o[1],o=i;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(i);break}o[2]&&s.ops.pop(),s.trys.pop();continue}i=e.call(t,s)}catch(t){i=[6,t],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}}function L(){for(var t=0,e=0,r=arguments.length;e<r;e++)t+=arguments[e].length;var n=Array(t),o=0;for(e=0;e<r;e++)for(var i=arguments[e],s=0,a=i.length;s<a;s++,o++)n[o]=i[s];return n}function _(t,e){if(void 0===e&&(e=2),0===t)return"0 Bytes";var r=e<0?0:e,n=Math.floor(Math.log(t)/Math.log(1024));return parseFloat((t/Math.pow(1024,n)).toFixed(r))+" "+["Bytes","KB","MB","GB","TB","PB","EB","ZB","YB"][n]}var W={operation:"divide",factor:100,precision:2,formatAsCurrency:!1,currencySymbol:"¥"};function $(t,e){if(void 0===e&&(e="-"),i(t))return e;var r=t.toString();return r.includes(".")||(r+="."),r.replace(/\d(?=(\d{3})+\.)/g,(function(t){return t+","})).replace(/\.$/,"")}function G(t){void 0===t&&(t="");if(i(t))return"";if(Number(t)>=1e15)return t;var e,r,n,o=["零","壹","贰","叁","肆","伍","陆","柒","捌","玖"],s=["","拾","佰","仟"],a=["","万","亿","兆"],u=["角","分","毫","厘"],c="";if("0"===(t=parseFloat(t).toString()))return c=o[0]+"元整";if(-1===(t=t.toString()).indexOf(".")?(e=t,r=""):(e=(n=t.split("."))[0],r=n[1].substr(0,4)),parseInt(e,10)>0){for(var f=0,l=e.length,d=0;d<l;d+=1){var h=e.substr(d,1),p=l-d-1,v=p/4,g=p%4;"0"===h?f+=1:(f>0&&(c+=o[0]),f=0,c+=o[parseInt(h,10)]+s[g]),0===g&&f<4&&(c+=a[v])}c+="元"}if(""!==r){var m=r.length;for(d=0;d<m;d+=1){var y=r.substr(d,1);"0"!==y&&(c+=o[Number(y)]+u[d])}}return""===c?c+=o[0]+"元整":""===r&&(c+="整"),c}function J(t,e){void 0===e&&(e=2);var r=parseFloat(String(t));if(Number.isNaN(r))return"";var n=(r=Math.round(Number(t)*Math.pow(10,e))/Math.pow(10,e)).toString(),o=n.indexOf(".");for(o<0&&(o=n.length,n+=".");n.length<=o+e;)n+="0";return n}function Y(t,e){if(void 0===e&&(e=0),i(t))return t;var r=Math.pow(10,e),n=Number(t)*r;return Math.ceil(n)/r}function Z(t,e){if(void 0===e&&(e=0),i(t))return t;var r=Math.pow(10,e),n=Number(t)*r;return Math.floor(n)/r}function K(t,e){var r=V(t,e),n=P(P({},W),e);if(n.formatter)return n.formatter(r);if(n.formatAsCurrency){var o=r.toFixed(n.precision),i=r>=1e3?$(o):o;return""+n.currencySymbol+i}return r.toFixed(n.precision)}function V(t,e){var r,n,o=P(P({},W),e);if(null==t||""===t)return 0;if("string"==typeof t){var i=t.replace(/[^\d.-]/g,"");r=i?parseFloat(i):0}else r=t;if(isNaN(r))return 0;if(n="multiply"===o.operation?r*o.factor:0!==o.factor?r/o.factor:0,void 0!==o.precision){var s=Math.pow(10,o.precision);n=Math.round(n*s)/s}return n}function Q(t,e){return K(t,P({operation:"divide",factor:100,formatAsCurrency:!0},e))}function X(t,e){void 0===e&&(e="B");var r=["B","KB","MB","GB","TB"],n=r.indexOf(e.toUpperCase());for(n=-1===n?0:n;t>=1024&&n<r.length;)t/=1024,n+=1;return{size:t,unit:r[n]}}function tt(t,e,r){if(void 0===e&&(e="B"),void 0===r&&(r="-"),i(t))return r;var n=X(parseFloat(t.toString()),e);return""+Y(n.size,2)+n.unit}function et(t){for(var e=t.match(/:(.*?);/)[1],r=window.atob(t.split(",")[1]),n=new ArrayBuffer(r.length),o=new Uint8Array(n),i=0;i<r.length;i+=1)o[i]=r.charCodeAt(i);return new Blob([n],{type:e})}function rt(t){return new Promise((function(e,r){var n=new FileReader;n.onload=function(t){t&&t.target?e(t.target.result):r(t)},n.onerror=function(t){r(t)},n.readAsDataURL(t)}))}function nt(t,e,r){return new Promise((function(n,o){var i=parseFloat((t.size/1024/1024).toString()),s=new FileReader;s.onload=function(s){var a=new Image;a.onload=function(){var o=a.width,s=a.height,u=document.createElement("canvas"),c=u.getContext("2d"),f=e?e(o,s):1;(Number.isNaN(f)||"number"!=typeof f)&&(f=1);var l=r?r(i,f,o,s):1;if((Number.isNaN(l)||"number"!=typeof l)&&(l=1),c){var d=parseInt((o*f).toString(),10),h=parseInt((s*f).toString(),10);u.setAttribute("width",d.toString()),u.setAttribute("height",h.toString()),c.drawImage(a,0,0,d,h)}var p=u.toDataURL(t.type,l);n(et(p))},a.onerror=function(t){o(t)},s.target&&(a.src=s.target.result)},s.onerror=function(t){o(t)},s.readAsDataURL(t)}))}function ot(t){var e=t.axiosRequest,r=t.notWithCredentials,n=void 0===r?[]:r;return function(t){var r=this,o=t.filename,i=t.url,s=t.data,a=void 0===s?{}:s,u=t.params,c=void 0===u?{}:u,f=t.method,l=void 0===f?"post":f;return new Promise((function(t,s){e({method:l,url:i,data:a,params:c,responseType:"blob",config:{withCredentials:n.some((function(t){return!i.includes(t)}))}}).then((function(e){return z(r,void 0,void 0,(function(){var r,n,i,a,u,c,f,l,d,h;return H(this,(function(p){switch(p.label){case 0:return"application/json"!==(r=null==e?void 0:e.data).type?[3,1]:((n=new FileReader).readAsText(r,"utf-8"),n.onload=function(){var t={};try{t=JSON.parse(n.result)}catch(e){t=r}s(t)},[3,3]);case 1:try{i=e.headers,a=i["content-disposition"],u=decodeURIComponent(a.split(";")[1].split("filename=")[1]),o&&!o.includes(".")?(c=u.split("."),f=c[c.length-1],o+="."+f):o||(o=u)}catch(t){o||(o="download.xlsx")}return l=new Blob([e.data]),d=document.createElement("a"),[4,rt(l)];case 2:h=p.sent(),d.href=h,d.download=o,document.body.appendChild(d),d.click(),document.body.removeChild(d),t(e),p.label=3;case 3:return[2]}}))}))})).catch((function(t){s(t)}))}))}}function it(t,e){return z(this,void 0,void 0,(function(){var r,n,o,i,s,a,u,c;return H(this,(function(f){for(r=t.split(","),n=r[0],o=r[1],i=n.match(/:(.*?);/)[1],s=atob(o),a=s.length,u=new Uint8Array(a),c=0;c<a;c++)u[c]=s.charCodeAt(c);return e?[2,new File([u],e,{type:i})]:[2,new Blob([u],{type:i})]}))}))}function st(t,e){var r=Object.keys,n=typeof t;return t&&e&&"object"===n&&n===typeof e?r(t).length===r(e).length&&r(t).every((function(r){return st(t[r],e[r])})):t===e}function at(t,e,r,n,o){if(void 0===o&&(o=[]),o.push(t),t[r]===e)throw"GOT IT!";if(t[n]&&t[n].length>0)for(var i=0;i<t[n].length;i++)at(t[n][i],e,r,n,o);o.pop()}function ut(t,e,r,n){var o=[];try{for(var i=0;i<r.length;i++)at(r[i],t,e,n,o)}catch(t){return o}}function ct(t){return/^(https?:|mailto:|tel:)/.test(t)}function ft(t){if(!t)return t;return t.replace(/^\s+|\s+$/g,"")}function lt(t){return/^0?(13[0-9]|14[5-9]|15[012356789]|166|17[0-8]|18[0-9]|19[8-9])[0-9]{8}$/.test(t.toString())}function dt(t){return t=t.toString(),/^1/.test(t)&&11===t.length}function ht(t){return/^0[1-9][0-9]{1,2}-[2-8][0-9]{6,7}$/.test(String(t))}function pt(t){return/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/.test(t)}function vt(t){return/^[1-9][0-9]{4,9}$/gim.test(String(t))}function gt(t){return/^[1](([3][0-9])|([4][0,1,4-9])|([5][0-3,5-9])|([6][2,5,6,7])|([7][0-8])|([8][0-9])|([9][0-3,5-9]))[0-9]{8}$/.test(t)}function mt(t){return new RegExp("^(?:(https?|ftp|rtsp|mms|ws|wss):\\/\\/)?(?:\\S+(?::\\S*)?@)?(?:(?:localhost)|(?:[1-9]\\d{0,2}(?:\\.\\d{1,3}){3})|(?:$[0-9a-fA-F:]+$)|(?:(?:[a-zA-Z0-9-_]+\\.)+[a-zA-Z]{2,63}))(?::\\d{1,5})?(?:[/?#]\\S*)?$","i").test(t)}function yt(t,e){return void 0===e&&(e="-"),i(t)?e:t}function wt(t,e,r){if(void 0===e&&(e=" "),void 0===r&&(r="-"),i(t))return r;if(11!==t.toString().length)return t;var n=t.toString().replace(/[^\d]/g,"").split(""),o="";return n.forEach((function(t,r){3!==r&&7!==r||(o+=e),o+=t})),o}function bt(t,e){if(void 0===e&&(e=""),i(t))return e;if(11!==t.toString().length)return t;var r=t.toString();return r.substr(0,3)+"****"+r.substr(7,11)}function St(t,e){return void 0===e&&(e=""),i(t)?e:t.toString().replace(/\s/g,"").replace(/(.{4})/g,"$1 ")}function At(){for(var t=[],e=65;e<91;e+=1)t.push(String.fromCharCode(e));return t}function Mt(t){void 0===t&&(t="");return t.replace(/\B([A-Z])/g,"-$1").toLowerCase()}function Ct(t,e){return t&&"string"==typeof e?t.substring(0,t.indexOf(e)):""}function Et(t){if(!/^(?:(https?|ftp|rtsp|mms|ws|wss):\/\/)?/i.test(t))return console.error(t+"不符合超链接规范"),{};var e=t.indexOf("?");if(-1===e)return{};for(var r={},n=0,o=t.slice(e+1).split("&");n<o.length;n++){var i=o[n].split("="),s=i[0],a=i[1];s&&(r[s]=a||"")}return r}function xt(t,e,r){void 0===r&&(r="*"),"number"==typeof t&&(t=t.toString()),Array.isArray(e)||(e=[e]);for(var n=t.split(""),o=0,i=e;o<i.length;o++){var s=i[o];if("object"!=typeof s||Array.isArray(s))"number"==typeof s&&Number.isInteger(s)&&s>=0&&s<n.length&&(n[s]=r);else{var a=s.start,u=s.end;a>=0&&a<u&&u<n.length&&n.fill(r,a,u+1)}}return n.join("")}var kt={HTTP_STATUS:{TEMP_RESPOND:{Continue:100,SwitchingProtocal:101},SUCCESS:{Ok:200,Created:201,Accepted:202,NoAuthoritativeInformation:203,NoContent:204,ResetContent:205,ParticalContent:206},REDIRECT:{MultipleChoice:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,TemporaryRedirect:307,PermanentRedirect:308},REQUEST_ERROR:{BadRequest:400,UnAuthorized:401,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAccepted:406,ProxyAuthorizationRequired:407,RequestTimeout:408,UpgradeRequired:426,TokenUnAuthorized:499},SERVER_ERROR:{InternalServerError:500,BadGateway:502,ServiceUnavailable:503,GateTimeout:504,HttpVersionNotSupported:505}},CODES:{Success:"00000",UnAuthorized:"00099",UnAuthorizedPhone:"11001",UnAuthorizedWecom:"11000",UnAuthorizedHavePhone:"11002"},ERR_CODE_WHITE_LIST:[]},It=t.create({timeout:15e3,headers:{"Content-Type":"application/json"}}),Ot=function(t){var e=t.cacheType,r=t.currentMode,n=t.errorCb,o=t.getTokenCb,i=t.tokenKey;return It.interceptors.request.use((function(t){return z(void 0,void 0,void 0,(function(){var r,n;return H(this,(function(o){return r=N(e,i),n=f(),t.headers.Authorization=r,t.headers.token=r,t.headers.FrontType=l(n),[2,t]}))}))}),(function(t){return Promise.reject(t)})),It.interceptors.response.use((function(t){return z(void 0,void 0,void 0,(function(){var n,s,a;return H(this,(function(u){return n=t.data,s=n.code||t.status,n instanceof Blob||s===kt.CODES.Success?[2,n]:s===kt.CODES.UnAuthorized?("local"!==r&&"dev"!==r&&"development"!==r&&(j(e,i),o&&"function"==typeof o&&o()),[2,Promise.reject(new Error("token过期!"))]):(a=n.message||n.msg,[2,Promise.reject(new Error(a||"Error"))])}))}))}),(function(t){return z(void 0,void 0,void 0,(function(){return H(this,(function(e){return n&&"function"==typeof n&&n(t),[2,Promise.reject(t)]}))}))})),It},Nt=function(){function t(t){this.fieldCatalog=t,this.params=t?{field_catalog:t}:{}}return t.prototype.build=function(){return this.params},t}(),jt=function(){function t(t){this.fieldCatalog=t}return t.prototype.query=function(){return new qt(this.fieldCatalog)},t.prototype.insert=function(){return new Bt(this.fieldCatalog)},t.prototype.update=function(){return new Tt(this.fieldCatalog)},t.query=function(t){return new qt(t)},t.insert=function(t){return new Bt(t)},t.update=function(t){return new Tt(t)},t}(),Rt=function(){function t(t,e){this.parent=e,this.nestedFilters={logic:t,filters:[]}}return t.prototype.where=function(t,e,r){var n=this;return"object"==typeof t?(Object.entries(t).forEach((function(t){var e=t[0],r=t[1];n.nestedFilters.filters.push({field:e,op:"=",value:r})})),this):void 0===r?(this.nestedFilters.filters.push({field:t,op:"=",value:e}),this):(this.nestedFilters.filters.push({field:t,op:e,value:r}),this)},t.prototype.group=function(e){return void 0===e&&(e="and"),new t(e,this)},t.prototype.endGroup=function(){return this.parent instanceof t?(this.parent.addNestedFilters(this.nestedFilters),this.parent):(this.parent.whereNested(this.nestedFilters),this.parent)},t.prototype.addNestedFilters=function(t){this.nestedFilters.filters.push(t)},t.prototype.build=function(){return this.nestedFilters},t}(),qt=function(t){function e(e){var r=t.call(this,e)||this;return r.params=P(P({},r.params),{filters:{logic:"and",filters:[]},order_by:[],limit:100,offset:0}),r}return F(e,t),e.prototype.where=function(t,e,r){var n=this;return"object"==typeof t?(Object.entries(t).forEach((function(t){var e=t[0],r=t[1];n.params.filters.filters.push({field:e,op:"=",value:r})})),this):void 0===r?(this.params.filters.filters.push({field:t,op:"=",value:e}),this):(this.params.filters.filters.push({field:t,op:e,value:r}),this)},e.prototype.whereNested=function(t){return this.params.filters.filters.push(t),this},e.prototype.group=function(t){return void 0===t&&(t="and"),new Rt(t,this)},e.prototype.orWhere=function(t,e,r){var n,o={logic:"or",filters:[]};if("object"==typeof t?Object.entries(t).forEach((function(t){var e=t[0],r=t[1];o.filters.push({field:e,op:"=",value:r})})):void 0===r?o.filters.push({field:t,op:"=",value:e}):o.filters.push({field:t,op:e,value:r}),0===this.params.filters.filters.length||"or"===this.params.filters.logic)(n=this.params.filters.filters).push.apply(n,o.filters),this.params.filters.logic="or";else{var i={logic:"and",filters:L(this.params.filters.filters)};this.params.filters.filters=[i,o],this.params.filters.logic="and"}return this},e.prototype.whereIn=function(t,e){return this.params.filters.filters.push({field:t,op:"in",value:e}),this},e.prototype.whereNotIn=function(t,e){return this.params.filters.filters.push({field:t,op:"not in",value:e}),this},e.prototype.whereLike=function(t,e){return this.params.filters.filters.push({field:t,op:"like",value:e}),this},e.prototype.whereBetween=function(t,e,r){return this.params.filters.filters.push({field:t,op:"between",value:[e,r]}),this},e.prototype.whereNull=function(t){return this.params.filters.filters.push({field:t,op:"is null",value:null}),this},e.prototype.whereNotNull=function(t){return this.params.filters.filters.push({field:t,op:"is not null",value:null}),this},e.prototype.logic=function(t){return this.params.filters.logic=t,this},e.prototype.orderBy=function(t,e){return void 0===e&&(e="asc"),this.params.order_by.push({field:t,direction:e}),this},e.prototype.limit=function(t){return this.params.limit=t,this},e.prototype.offset=function(t){return this.params.offset=t,this},e.prototype.paginate=function(t,e){return void 0===e&&(e=0),this.params.limit=t,this.params.offset=e,this},e}(Nt),Bt=function(t){function e(e){var r=t.call(this,e)||this;return r.params=P(P({},r.params),{insert:[]}),r}return F(e,t),e.prototype.add=function(t){return this.params.insert.push(t),this},e.prototype.addBatch=function(t){var e;return(e=this.params.insert).push.apply(e,t),this},e}(Nt),Tt=function(t){function e(e){var r=t.call(this,e)||this;return r.currentUpdate=null,r.params=P(P({},r.params),{update:[]}),r}return F(e,t),e.prototype.set=function(t){return this.currentUpdate={set:t,where:{}},this},e.prototype.where=function(t,e){if(!this.currentUpdate)throw new Error("必须先调用 set() 方法");return"object"==typeof t?this.currentUpdate.where=P(P({},this.currentUpdate.where),t):this.currentUpdate.where[t]=e,this},e.prototype.and=function(){return this.currentUpdate&&(this.params.update.push(this.currentUpdate),this.currentUpdate=null),this},e.prototype.setBatch=function(t){var e;return(e=this.params.update).push.apply(e,t),this},e.prototype.build=function(){return this.currentUpdate&&(this.params.update.push(this.currentUpdate),this.currentUpdate=null),this.params},e}(Nt);var Ut=new(function(){function t(){}return t.prototype.request=function(t){return z(this,void 0,void 0,(function(){var e,r,n,o,i,s,a,u,c,f,l,d;return H(this,(function(h){switch(h.label){case 0:e=(t.method||"GET").toUpperCase(),r="number"==typeof t.timeoutMs&&t.timeoutMs>0?t.timeoutMs:15e3,n=function(t){return P({},t||{})}(t.headers),o=void 0!==t.data&&null!==t.data,i=void 0,o&&("string"==typeof t.data||"undefined"!=typeof FormData&&t.data instanceof FormData||"undefined"!=typeof Blob&&t.data instanceof Blob||"undefined"!=typeof ArrayBuffer&&t.data instanceof ArrayBuffer?i=t.data:(Object.keys(n).some((function(t){return"content-type"===t.toLowerCase()}))||(n["Content-Type"]="application/json"),i=JSON.stringify(t.data))),s="undefined"!=typeof AbortController?new AbortController:null,a=s?setTimeout((function(){return s.abort()}),r):null,h.label=1;case 1:return h.trys.push([1,,4,5]),[4,fetch(t.url,{method:e,headers:n,body:i,redirect:!1===t.followRedirects?"manual":"follow",signal:s?s.signal:void 0})];case 2:return[4,(u=h.sent()).text()];case 3:return c=h.sent(),f=function(t){var e={};return t.forEach((function(t,r){e[r.toLowerCase()]=t})),e}(u.headers),l=f["content-type"]||"",d=l.includes("application/json")?function(t){try{return JSON.parse(t)}catch(t){return}}(c):void 0,[2,{status:u.status,headers:f,body:c,json:d}];case 4:return a&&clearTimeout(a),[7];case 5:return[2]}}))}))},t.prototype.get=function(t,e){return z(this,void 0,void 0,(function(){return H(this,(function(r){return[2,this.request(P(P({},e||{}),{url:t,method:"GET"}))]}))}))},t.prototype.post=function(t,e,r){return z(this,void 0,void 0,(function(){return H(this,(function(n){return[2,this.request(P(P({},r||{}),{url:t,method:"POST",data:e}))]}))}))},t}());function Dt(){var t=new Date;return String(t.getFullYear())+"年"+String(t.getMonth()+1)+"月"+String(t.getDate())+"日"+String(t.getHours())+":"+String(t.getMinutes())}function Ft(t){return z(this,void 0,void 0,(function(){var e,r;return H(this,(function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),"https://fe-log-producer.jinbizhihui.com",[4,Ut.post("https://fe-log-producer.jinbizhihui.com/log/save",t)];case 1:return e=n.sent(),console.log("[RequestLogger] 远程日志发送成功, result",e),[3,3];case 2:return r=n.sent(),console.error("[RequestLogger] 远程日志发送失败:",(null==r?void 0:r.message)||r),[3,3];case 3:return[2]}}))}))}function Pt(t){return z(this,void 0,void 0,(function(){var e,r,n;return H(this,(function(o){switch(o.label){case 0:e=t.req.header("content-type")||"",o.label=1;case 1:return o.trys.push([1,4,,5]),(r=t.req.raw)&&"function"==typeof r.clone?[4,r.clone().text()]:[3,3];case 2:if(!(n=o.sent()))return[2,void 0];if(e.includes("application/json"))try{return[2,JSON.parse(n)]}catch(t){return[2,n]}return[2,n];case 3:return[3,5];case 4:return o.sent(),[3,5];case 5:return[2,void 0]}}))}))}function zt(t){var e={};try{t.res.headers.forEach((function(t,r){e[r]=t}))}catch(t){}return e}function Ht(t,e,r){return z(this,void 0,void 0,(function(){var n,o,i,s,a,u,c,f,l,d;return H(this,(function(h){switch(h.label){case 0:return n=t.req.header("x-forwarded-for")||t.req.header("x-real-ip")||"unknown",o=t.req.method,i=t.req.url,s=t.req.query(),a=function(t){var e={};try{var r=t.req.raw,n=null==r?void 0:r.headers;n&&n.forEach((function(t,r){e[r]=t}))}catch(t){}return e}(t),[4,Pt(t)];case 1:return u=h.sent(),c=Dt(),f=Date.now(),[4,e()];case 2:return h.sent(),l=Date.now()-f,d={status:t.res.status,headers:zt(t),duration:l},[4,Ft({system:r,ip:n,path:i,method:o,time:c,params:{method:o,url:i,query:s,body:u},headers:a,result:d})];case 3:return h.sent(),[2]}}))}))}function Lt(t){var e,r={};try{for(var n=(null===(e=t.response)||void 0===e?void 0:e.headers)||{},o=0,i=Object.entries(n);o<i.length;o++){var s=i[o],a=s[0],u=s[1];r[a]=String(u)}}catch(t){}return r}function _t(t,e,r){var n,o,i,s,a,u;return z(this,void 0,void 0,(function(){var c,f,l,d,h,p,v,g,m,y,w;return H(this,(function(b){switch(b.label){case 0:return c=t.ip||(null===(n=t.request)||void 0===n?void 0:n.ip)||"unknown",f=t.path||(null===(o=t.request)||void 0===o?void 0:o.path)||"",l=t.method||(null===(i=t.request)||void 0===i?void 0:i.method)||"",d=t.url||(null===(s=t.request)||void 0===s?void 0:s.url)||"",h=t.query||(null===(a=t.request)||void 0===a?void 0:a.query)||{},p=(null===(u=t.request)||void 0===u?void 0:u.body)||{},v=function(t){var e,r={};try{for(var n=t.headers||(null===(e=t.request)||void 0===e?void 0:e.headers)||{},o=0,i=Object.entries(n);o<i.length;o++){var s=i[o],a=s[0],u=s[1];r[a]=String(u)}}catch(t){}return r}(t),g=Dt(),m=Date.now(),[4,e()];case 1:return b.sent(),y=Date.now()-m,w={status:t.status,body:t.body,headers:Lt(t),duration:y},[4,Ft({system:r,ip:c,path:f,method:l,time:g,params:{method:l,url:d,query:h,body:p},headers:v,result:w})];case 2:return b.sent(),[2]}}))}))}function Wt(t){var e,r={};try{for(var n=(null===(e=t.getHeaders)||void 0===e?void 0:e.call(t))||{},o=0,i=Object.entries(n);o<i.length;o++){var s=i[o],a=s[0],u=s[1];void 0!==u&&(r[a]=String(u))}}catch(t){}return r}function $t(t,e,r){return z(this,void 0,void 0,(function(){var n,o,i,s,a,u,c,f,l,d;return H(this,(function(h){switch(h.label){case 0:return n=t.headers["x-forwarded-for"]||t.headers["x-real-ip"]||t.ip||"unknown",o=t.url||"",i=t.method||"",s=t.query||{},a=t.body||{},u=function(t){var e={};try{for(var r=t.headers||{},n=0,o=Object.entries(r);n<o.length;n++){var i=o[n],s=i[0],a=i[1];e[s]=String(a)}}catch(t){}return e}(t),c=Dt(),f=Date.now(),l=Date.now()-f,d={status:e.statusCode,headers:Wt(e),duration:l},[4,Ft({system:r,ip:n,path:o,method:i,time:c,params:{method:i,url:o,query:s,body:a},headers:u,result:d})];case 1:return h.sent(),[2]}}))}))}function Gt(t){var e=this;return function(r,n){return z(e,void 0,void 0,(function(){return H(this,(function(e){switch(function(t,e){var r;return function(t){var e,r;return t&&"string"==typeof t.method&&"string"==typeof t.url&&t.headers&&(void 0!==t.routerPath||void 0!==t.routeOptions||"function"==typeof t.getValidationFunction||"IncomingMessage"===(null===(r=null===(e=t.raw)||void 0===e?void 0:e.constructor)||void 0===r?void 0:r.name))}(t)&&void 0!==(null==e?void 0:e.statusCode)?"fastify":t&&t.req&&"function"==typeof t.req.header&&"function"==typeof t.req.query&&void 0!==t.req.raw?"hono":t&&t.request&&t.response&&"function"==typeof t.throw?t.requestContext||(null===(r=t.app)||void 0===r?void 0:r.getApplicationContext)?"midway":"koa":"unknown"}(r,n)){case"hono":return[2,Ht(r,n,t)];case"fastify":return[2,$t(r,n,t)];case"koa":case"midway":return[2,_t(r,n,t)];default:return console.warn("[requestLoggerUnified] Unknown framework detected, falling back to Koa-style handling"),[2,_t(r,n,t)]}return[2]}))}))}}function Jt(t){var e=this;return function(r,n){return z(e,void 0,void 0,(function(){return H(this,(function(e){return[2,Ht(r,n,t)]}))}))}}function Yt(t){var e=this;return function(r,n){return z(e,void 0,void 0,(function(){return H(this,(function(e){return[2,_t(r,n,t)]}))}))}}function Zt(t){var e=this;return function(r,n){return z(e,void 0,void 0,(function(){return H(this,(function(e){return[2,_t(r,n,t)]}))}))}}function Kt(t){var e=this;return function(r,n){return z(e,void 0,void 0,(function(){return H(this,(function(e){return[2,$t(r,n,t)]}))}))}}var Vt=function(t,e){void 0===t&&(t="state");var r=function(t,e){void 0===e&&(e="state");for(var r,n=t;"string"==typeof n;)try{r=n,n=decodeURIComponent(n),n=JSON.parse(n)}catch(t){n=r;break}for(;n&&"object"==typeof n&&e in n&&("string"==typeof n[e]||"object"==typeof n[e]);)if("string"==typeof(n=n[e]))try{n=decodeURIComponent(n),n=JSON.parse(n)}catch(t){break}return n}(e,t);return"object"==typeof r?JSON.stringify(r):String(r)};function Qt(t){var e=t.replace("#","").match(/../g);return e?e.map((function(t){return parseInt(t,16)})):[0,0,0]}function Xt(t,e,r){var n=function(t){var e=t.toString(16);return 1===e.length?"0"+e:e};return"#"+n(t)+n(e)+n(r)}function te(t,e){var r=Qt(t).map((function(t){return Math.floor(t*(1-e))}));return Xt(r[0],r[1],r[2])}function ee(t,e){var r=Qt(t).map((function(t){return Math.floor((255-t)*e+t)}));return Xt(r[0],r[1],r[2])}function re(t,e){if(!Array.isArray(t))return[];for(var r=[],n=0,o=t;n<o.length;n++){var i=o[n];i&&void 0!==i[e]&&null!==i[e]&&r.push(i[e])}return r}function ne(t,e,r){if(!Array.isArray(t)||!Array.isArray(e))return!1;var n=r||function(t,e){return JSON.stringify(t)===JSON.stringify(e)};return e.every((function(e){return t.some((function(t){return n(t,e)}))}))}function oe(t){return null==t||("string"==typeof t?0===t.trim().length:Array.isArray(t)?0===t.length:"object"==typeof t&&0===Object.keys(t).length)}function ie(t,e){return Array.isArray(t)&&Array.isArray(e)?t.filter((function(t){return e.includes(t)})):[]}function se(t){return Array.isArray(t)&&t.length>0?t.reduce((function(t,e){return t+e}),0):0}function ae(t,e){return!("undefined"==typeof window||!t)&&!!t.className.match(new RegExp("(\\s|^)"+e+"(\\s|$)"))}function ue(t,e){"undefined"!=typeof window&&t&&(ae(t,e)||(t.className+=" "+e))}function ce(t,e){if("undefined"!=typeof window&&t&&ae(t,e)){var r=new RegExp("(\\s|^)"+e+"(\\s|$)");t.className=t.className.replace(r," ").trim()}}function fe(t,e,r){if("undefined"!=typeof window){var n=r||document.body,o=n.className;o=o.replace(e,"").trim(),n.className=t?(o+" "+e).trim():o}}function le(t,e){if(void 0===e&&(e="_blank"),"undefined"!=typeof window){var r=document.createElement("a");r.setAttribute("href",t),r.setAttribute("target",e),r.setAttribute("rel","noreferrer noopener"),r.setAttribute("id","external");var n=document.getElementById("external");n&&document.body.removeChild(n),document.body.appendChild(r),r.click(),r.remove()}}function de(t){if("undefined"==typeof window||"undefined"==typeof document)return!1;var e=document.createElement("textarea"),r=document.activeElement;e.value=t,e.setAttribute("readonly",""),e.style.position="absolute",e.style.left="-9999px",e.style.fontSize="12pt",e.style.border="0",e.style.padding="0",e.style.margin="0";var n=document.getSelection(),o=null;n&&n.rangeCount>0&&(o=n.getRangeAt(0)),document.body.appendChild(e),e.select(),e.selectionStart=0,e.selectionEnd=t.length;var i=!1;try{i=document.execCommand("copy")}catch(t){console.error("复制失败:",t)}return e.remove(),o&&n&&(n.removeAllRanges(),n.addRange(o)),r&&r.focus(),i}function he(t){if("undefined"==typeof window||"undefined"==typeof DOMParser)return t;try{var e=(new DOMParser).parseFromString(t,"image/svg+xml").querySelector("svg");if(!e)return t;var r=e.getAttribute("viewBox");if(!r)throw new Error("Invalid SVG string: Missing viewBox attribute.");var n=r.split(" ");return{width:parseInt(n[2],10),height:parseInt(n[3],10),body:Array.from(e.querySelectorAll("path")).map((function(t){return t.outerHTML})).join(" ")}}catch(e){return console.error("解析 SVG 失败:",e),t}}var pe=function(){function t(t){this.ws=null,this.reconnectAttempts=0,this.heartbeatTimer=null,this.listeners=new Map,this.opts={url:t.url,reconnectAttemptsLimit:t.reconnectAttemptsLimit||5,reconnectInterval:t.reconnectInterval||5e3,heartbeatInterval:t.heartbeatInterval||3e4,registerMessage:t.registerMessage}}return Object.defineProperty(t.prototype,"url",{get:function(){return this.opts.url},enumerable:!1,configurable:!0}),t.prototype.on=function(t,e){this.listeners.has(t)||this.listeners.set(t,new Set);var r=this.listeners.get(t);return r.add(e),function(){return r.delete(e)}},t.prototype.emit=function(t,e){var r=this.listeners.get(t);r&&r.forEach((function(t){try{t(e)}catch(t){}}))},t.prototype.connect=function(){try{this.ws=new WebSocket(this.opts.url),this.setupEventListeners()}catch(t){this.emit("error",{message:"WebSocket create failed"})}},t.prototype.setupEventListeners=function(){var t=this;this.ws&&(this.ws.onopen=function(){t.reconnectAttempts=0,t.opts.registerMessage&&t.send(t.opts.registerMessage),t.startHeartbeat(),t.emit("connected",!0)},this.ws.onmessage=function(e){try{var r=JSON.parse(e.data);t.emit("message",r)}catch(e){t.emit("error",{message:"Message parse failed"})}},this.ws.onclose=function(){t.stopHeartbeat(),t.emit("connected",!1),t.emit("closed",void 0),t.reconnect()},this.ws.onerror=function(){t.emit("error",{message:"WebSocket error"})})},t.prototype.send=function(t){if(this.ws&&1===this.ws.readyState)try{this.ws.send(JSON.stringify(t))}catch(t){}},t.prototype.startHeartbeat=function(){var t=this;this.stopHeartbeat(),this.heartbeatTimer=setInterval((function(){t.send({type:"ping"})}),this.opts.heartbeatInterval)},t.prototype.stopHeartbeat=function(){null!=this.heartbeatTimer&&(clearInterval(this.heartbeatTimer),this.heartbeatTimer=null)},t.prototype.reconnect=function(){var t=this;this.reconnectAttempts<this.opts.reconnectAttemptsLimit&&(this.reconnectAttempts++,setTimeout((function(){t.connect()}),this.opts.reconnectInterval))},t.prototype.disconnect=function(){if(this.stopHeartbeat(),this.ws)try{this.ws.close()}catch(t){}this.ws=null},Object.defineProperty(t.prototype,"isConnected",{get:function(){return!!this.ws&&1===this.ws.readyState},enumerable:!1,configurable:!0}),t}(),ve=function(){function t(){this.initialized=!1,this.manager=null}return t.getInstance=function(){return t.instance||(t.instance=new t),t.instance},t.prototype.init=function(t){return z(this,void 0,void 0,(function(){return H(this,(function(e){return this.initialized||(this.manager=new pe(t),this.manager.connect(),this.initialized=!0),[2]}))}))},t.prototype.destroy=function(){this.manager&&this.manager.disconnect(),this.manager=null,this.initialized=!1},t.prototype.getManager=function(){return this.manager},t}().getInstance(),ge=new(function(){function t(){this.listeners=new Map}return t.prototype.on=function(t,e){this.listeners.has(t)||this.listeners.set(t,new Set);var r=this.listeners.get(t);return r.add(e),function(){return r.delete(e)}},t.prototype.off=function(t,e){var r=this.listeners.get(t);r&&r.delete(e)},t.prototype.emit=function(t,e){var r=this.listeners.get(t);r&&r.forEach((function(t){try{t(e)}catch(t){}}))},t}()),me=function(t){return void 0===t&&(t="websocket"),e(t,{state:function(){return{isConnected:!1,wsManager:null,messages:[],connectionError:null}},getters:{connectionStatus:function(t){return t.isConnected?"已连接":"未连接"},lastMessage:function(t){return t.messages[t.messages.length-1]||null}},actions:{connect:function(t){var e;return z(this,void 0,void 0,(function(){return H(this,(function(r){return(null===(e=this.wsManager)||void 0===e?void 0:e.isConnected)||(this.wsManager=new pe(t),this.setupEventListeners(),this.wsManager.connect()),[2]}))}))},setupEventListeners:function(){var t=this;this.wsManager&&(this.wsManager.on("connected",(function(e){t.isConnected=e,e&&(t.connectionError=null),ge.emit("websocket-connected",e)})),this.wsManager.on("message",(function(e){t.addMessage(e),ge.emit("websocket-message",e)})),this.wsManager.on("error",(function(e){t.connectionError=(null==e?void 0:e.message)||"WebSocket error",ge.emit("websocket-error",{message:t.connectionError})})),this.wsManager.on("closed",(function(){t.isConnected=!1,ge.emit("websocket-closed",void 0)})))},sendMessage:function(t){var e;null===(e=this.wsManager)||void 0===e||e.send(t)},addMessage:function(t){var e=P(P({},t),{timestamp:Date.now(),id:Math.random().toString(36).substring(2,11)});this.messages.push(e),this.messages.length>100&&this.messages.shift()},clearMessages:function(){this.messages=[]},disconnect:function(){var t;null===(t=this.wsManager)||void 0===t||t.disconnect(),this.wsManager=null,this.isConnected=!1,this.connectionError=null},reset:function(){this.disconnect(),this.clearMessages()}}})};export{jt as ApiBuilder,Bt as InsertBuilder,qt as QueryBuilder,Tt as UpdateBuilder,pe as WebsocketManager,ue as addClass,U as addDays,C as base64ToBlob,E as base64ToFile,it as base64ToFileOrBlob,rt as blobToDataURL,p as buildUUID,X as calcFileSize,Y as ceil,s as clearLoginData,R as compatibleDate,nt as compressImg,V as computeMoney,w as convertBase64UrlToBlob,G as convertCurrency,de as copyTextToClipboard,me as createWebSocketStore,te as darken,et as dataURLtoBlob,st as deepEqual,n as delay,o as deviceDetection,ge as emitter,tt as fileSizeFormat,M as filterRepeat,ut as findNodePath,Z as floor,St as formatBank,_ as formatBytes,Q as formatCentsToYuan,yt as formatEmptyValue,J as formatFloat,K as formatMoney,wt as formatPhone,bt as formatPhoneHide,B as formatTime,y as formateTimestamp,T as fromNow,ot as genExportByBlob,At as generateEnglishLetters,h as getCookie,f as getDeviceType,b as getEnvironment,k as getFileData,l as getFromType,S as getIsComWx,A as getIsDevelopment,re as getKeyList,Et as getQueryMap,a as getQueryString,u as getQueryVariable,he as getSvgInfo,v as getTicket,N as getToken,c as getWecomToken,Vt as handleFlatStr,ae as hasClass,Qt as hexToRgb,xt as hideTextAtIndex,Ot as http,kt as httpEnum,Mt as humpTurnDashed,ie as intersection,oe as isAllEmpty,pt as isEmail,i as isEmpty,ct as isExternal,x as isImage,ne as isIncludeAllChildren,lt as isMobile,dt as isMobileSimple,gt as isPhone,vt as isQQ,ht as isTelephone,mt as isUrl,ee as lighten,q as newDate,le as openLink,d as randomString,Gt as recordLogMiddleware,Kt as recordLogMiddlewareFastify,Jt as recordLogMiddlewareHono,Yt as recordLogMiddlewareKoa,Zt as recordLogMiddlewareMidway,ce as removeClass,m as removeTicket,j as removeToken,Xt as rgbToHex,Ft as sendLog,g as setTicket,Ct as subBefore,se as sum,$ as toThousands,fe as toggleClass,ft as trimVal,O as uuid,I as validateTwoDecimal,ve as websocketService};
|