ranuts 0.3.0-alpha.1 → 0.4.0-alpha.2
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/CLAUDE.md +23 -12
- package/dist/{color-Dohr9BXX.js → color-Bh_QUad2.js} +1 -1
- package/dist/i18n-D1p8_7wC.js +1 -0
- package/dist/index.js +1 -1
- package/dist/src/node/index.js +1 -1
- package/dist/src/sw/index.d.ts +109 -0
- package/dist/src/sw/index.js +1 -0
- package/dist/src/utils/dom.d.ts +23 -0
- package/dist/src/utils/file.d.ts +7 -2
- package/dist/src/utils/i18n/index.js +1 -1
- package/dist/src/utils/i18n.d.ts +64 -14
- package/dist/src/utils/idb.d.ts +40 -0
- package/dist/src/utils/index.d.ts +15 -10
- package/dist/src/utils/index.js +1 -1
- package/dist/src/utils/paginate.d.ts +73 -0
- package/dist/src/utils/speech.d.ts +86 -0
- package/dist/src/utils/str.d.ts +35 -0
- package/dist/src/utils/time.d.ts +73 -3
- package/dist/src/utils/worker.d.ts +49 -0
- package/dist/test/sw.test.d.ts +1 -0
- package/dist/test/utils/autosize.test.d.ts +1 -0
- package/dist/test/utils/i18n.test.d.ts +1 -0
- package/dist/test/utils/idb-collection.test.d.ts +1 -0
- package/dist/test/utils/paginate.test.d.ts +1 -0
- package/dist/test/utils/speech.test.d.ts +1 -0
- package/dist/test/utils/time.test.d.ts +1 -0
- package/dist/test/utils/truncate.test.d.ts +1 -0
- package/dist/test/utils/worker-serve.test.d.ts +1 -0
- package/dist/umd/index.umd.cjs +1 -1
- package/dist/umd/utils/utils.umd.cjs +1 -1
- package/dist/utils-vTF6lLZZ.js +1 -0
- package/docs/API.md +65 -13
- package/package.json +5 -1
- package/dist/i18n-Cf5TtRb4.js +0 -1
- package/dist/utils-BDtXHcK8.js +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var e=()=>{},t=(e,t=2)=>String(e).padStart(t,"0"),n=e=>null==e?/* @__PURE__ */new Date:new Date(e),r=/YYYY|YY|MM|M|DD|D|HH|H|hh|h|mm|m|ss|s|SSS|A|a|\[([^\]]*)]/g,s=(e,s="YYYY-MM-DD HH:mm:ss")=>{const a=n(e);if(Number.isNaN(a.getTime()))return"Invalid Date";const i=a.getHours(),o=i%12||12,c={YYYY:String(a.getFullYear()),YY:t(a.getFullYear()%100),MM:t(a.getMonth()+1),M:String(a.getMonth()+1),DD:t(a.getDate()),D:String(a.getDate()),HH:t(i),H:String(i),hh:t(o),h:String(o),mm:t(a.getMinutes()),m:String(a.getMinutes()),ss:t(a.getSeconds()),s:String(a.getSeconds()),SSS:t(a.getMilliseconds(),3),A:i<12?"AM":"PM",a:i<12?"am":"pm"};return s.replace(r,(e,t)=>void 0!==t?t:c[e])};function a(e){const t=e?new Date(e):/* @__PURE__ */new Date;return t.format=(e="YYYY-MM-DD HH:mm:ss")=>s(t,e),t}var i=e=>{if(!Number.isFinite(e))return"";const n=Math.max(0,Math.trunc(e)),r=Math.trunc(n/3600),s=Math.trunc(n%3600/60),a=t(n%60);return 0===r?`${t(s)}:${a}`:`${t(r)}:${t(s)}:${a}`},o=e=>i(e),c=[["year",315576e5],["month",26298e5],["week",6048e5],["day",864e5],["hour",36e5],["minute",6e4],["second",1e3]],u={year:"y",quarter:"q",month:"mo",week:"w",day:"d",hour:"h",minute:"m",second:"s"},d=/* @__PURE__ */new Map,l=(e,t={})=>{const{now:r,locale:s,style:a="long",numeric:i="auto"}=t,o=n(e).getTime(),l=n(r).getTime();if(Number.isNaN(o)||Number.isNaN(l))return"";const h=o-l,f=Math.abs(h);let g=c.findIndex(([,e])=>f>=e);-1===g&&(g=c.length-1);const w=h<0?-1:1;let[m,p]=c[g],y=w*Math.round(f/p);if(g>0&&Math.abs(y)*p>=c[g-1][1]&&([m,p]=c[g-1],y=w*Math.round(f/p)),"compact"===a)return`${Math.abs(y)}${u[m]??""}`;const v=((e,t,n)=>{if("undefined"==typeof Intl||"function"!=typeof Intl.RelativeTimeFormat)return;const r=`${String(e)}|${t}|${n}`;let s=d.get(r);return s||(s=new Intl.RelativeTimeFormat(e,{style:t,numeric:n}),d.set(r,s)),s})(s,a,i);return v?v.format(y,m):`${Math.abs(y)}${u[m]??""}`},h=()=>{if("undefined"!=typeof document)return performance.now();if("undefined"!=typeof process){const[e,t]=process.hrtime();return 1e3*e+t/1e6}return Date.now()},f=/* @__PURE__ */function(e){return e.IPAD="ipad",e.ANDROID="android",e.IPhONE="iphone",e.PC="pc",e}({}),g=()=>{if("undefined"!=typeof window){const e=navigator.userAgent.toLowerCase();return/ipad|ipod/.test(e)?"ipad":/android/.test(e)?"android":/iphone/.test(e)?"iphone":"pc"}return"pc"},w="undefined"!=typeof window,m="(max-width: 768px)",p=e=>"undefined"!=typeof window&&"function"==typeof window.matchMedia&&window.matchMedia(e).matches,y=(e,t)=>{if("undefined"==typeof window||"function"!=typeof window.matchMedia)return t(!1),()=>{};const n=window.matchMedia(e),r=()=>t(n.matches);if(r(),"function"==typeof n.addEventListener)return n.addEventListener("change",r),()=>n.removeEventListener("change",r);const s=n;return s.addListener(r),()=>s.removeListener(r)},v=()=>!!w&&window.navigator.userAgent.toLowerCase().includes("micromessenger"),A=()=>{if(!w)return!1;const e=window.navigator.userAgent;return!!/Android|webOS|iPhone|iPod|iPad|BlackBerry/i.test(e)},_=()=>{if(!w)return!1;const e=/iphone/i.test(window.navigator.userAgent),t=window.devicePixelRatio&&2===window.devicePixelRatio,n=window.devicePixelRatio&&3===window.devicePixelRatio,r=360===window.screen.width&&780===window.screen.height,s=375===window.screen.width&&812===window.screen.height,a=390===window.screen.width&&844===window.screen.height,i=414===window.screen.width&&896===window.screen.height,o=428===window.screen.width&&926===window.screen.height;switch(!0){case e&&n&&r:case e&&n&&s:case e&&n&&a:case e&&t&&i:case e&&n&&i:case e&&n&&o:return!0;default:return!1}},M=(t=e)=>{const n=()=>{t(),w&&window.removeEventListener("popstate",n)};w&&window.history.pushState(null,"",window.location.href),setTimeout(()=>{w&&window.addEventListener("popstate",n)},500)},x=e=>{const t=document.cookie.split("; ");for(let n=0;n<t.length;n++){const r=t[n].split("=");if(r[0]===e)return decodeURIComponent(r[1])}return""},b=(e,t)=>new Promise(function(n,r){const s=new XMLHttpRequest;s.open(t.method||"GET",e,!0),s.responseType=t.responseType||"arraybuffer",s.onload=function(){200===s.status?n({success:!0,data:s.response,message:""}):r({success:!1,data:s.status,message:`The request status is${s.status}`})},s.onerror=function(e){r({success:!1,data:e,message:""})},s.onprogress=e=>{t.onProgress&&t.onProgress(e)},s.withCredentials=t.withCredentials||!1,t.headers&&Object.keys(t.headers).forEach(function(e){t.headers?.[e]&&s.setRequestHeader(e,t.headers[e])}),s.send(t.body)}),D=e=>{const t=e.backingStorePixelRatio||e.webkitBackingStorePixelRatio||e.mozBackingStorePixelRatio||e.msBackingStorePixelRatio||e.oBackingStorePixelRatio||1;return(w&&window.devicePixelRatio||1)/t},S=async e=>{if("string"==typeof e)return e;if(e instanceof Blob)return URL.createObjectURL(e);if(e instanceof ArrayBuffer)return URL.createObjectURL(new Blob([e]));if(e instanceof Response){const t=await e.blob();return URL.createObjectURL(t)}return e},R=(e=10)=>{const t=[];let n,r=0;return new Promise(s=>{const a=()=>{const i=h(),o=i-r;0!==r&&t.push(o),r=i,t.length>e&&(s(1/(t.reduce((e,t)=>e+t)/e)),cancelAnimationFrame(n)),n=requestAnimationFrame(a)};t.length<=e&&(n=requestAnimationFrame(a))})},L=e=>{const t={},n=(e=>{const t=e??("undefined"==typeof window?"":window.location.href),n=t.indexOf("?");if(-1===n)return"";const r=t.slice(n+1),s=r.indexOf("#");return-1===s?r:r.slice(0,s)})(e);if(!n)return t;for(const r of n.split("&")){if(!r)continue;const e=r.indexOf("="),n=-1===e?r:r.slice(0,e),s=-1===e?"":r.slice(e+1);if(n)try{t[decodeURIComponent(n.replace(/\+/g," "))]=decodeURIComponent(s.replace(/\+/g," "))}catch{t[n]=s}}return t},P=e=>L(e),k=(e,t)=>{const n=L(t)[e];if(void 0===n)return!1;const r=n.toLowerCase();return""===r||"1"===r||"true"===r},O=()=>{if("undefined"==typeof window)return!1;try{return window.parent!==window}catch{return!0}};function I(e,t={}){let n=e;0===n.indexOf("//")&&(n=n.replace("//","https://"));const r=new URL(n);return t&&Object.keys(t).forEach(e=>{t[e]&&r.searchParams.set(e,t[e])}),r.href}var F=e=>{const t=document.createElement("img");t.src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",t.width=0,t.height=0,t.style.opacity="0",e.dataTransfer&&e.dataTransfer.setDragImage(t,0,0)};function Y(e){if("undefined"!=typeof window){const t=new RegExp(`(^| )${e}(?:=([^;]*))?(;|$)`).exec(document.cookie);if(t&&t[2])return t[2]}return""}var $=()=>"undefined"!=typeof window?{width:window.innerWidth,height:window.innerHeight}:{width:0,height:0},B=()=>{if("undefined"!=typeof window)return window.navigator.connection},N=/(?:[^\x21\x25\x26-\x3B\x3D\x3F-\x5B\x5D\x5F\x7E]|%(?:[^\da-f]|[\da-f][^\da-f]|$))+/gi,C=/(^|[^\uD800-\uDBFF])[\uDC00-\uDFFF]|[\uD800-\uDBFF]([^\uDC00-\uDFFF]|$)/g;function H(e){return String(e).replace(C,"$1�$2").replace(N,encodeURI)}var T=e=>new Promise((t,n)=>{const r=new Image,s=/* @__PURE__ */(new Date).getTime();r.src=e||`https://github.com/favicon.ico?d=${s}`,r.onload=()=>{t(/* @__PURE__ */(new Date).getTime()-s)},r.onerror=e=>{n(e)}}),E=(e,...t)=>n=>new Promise((r,s)=>{setTimeout(async()=>{try{r(await e(...t))}catch(n){s(n)}},n)}),U=async e=>{const{url:t,duration:n=3e3,count:r=5}=e;let s=0,a=0;const i=[];for(let o=0;o<r;o++){const e=await E(T,t)(n);i.push(e)}return s=Math.max(...i)-Math.min(...i),a=i.reduce((e,t)=>e+t)/i.length,{ping:a,jitter:s}},j=()=>{if("undefined"!=typeof navigator)return navigator.vendor&&navigator.vendor.indexOf("Apple")>-1&&navigator.userAgent&&!navigator.userAgent.includes("CriOS")&&!navigator.userAgent.includes("FxiOS")},q=()=>{try{return"undefined"==typeof localStorage?null:localStorage}catch{return null}},z=(e,t)=>{try{q()?.setItem(e,t)}catch{}},K=e=>{try{return q()?.getItem(e)??""}catch{return""}},W=e=>{try{q()?.removeItem(e)}catch{}},G=(e="")=>{const t=t=>`${e}${t}`;return{keyOf:t,get:(e,n)=>{const r=K(t(e));if(!r)return n;try{return JSON.parse(r)}catch{return n}},set:(e,n)=>{let r;try{r=JSON.stringify(n)}catch{return!1}return z(t(e),r),K(t(e))===r},remove:e=>W(t(e))}},J=(e,t=2e4)=>{const n=e.slice(0,t);let r=0,s=0;for(const a of n){const e=a.codePointAt(0)??0;e>=19968&&e<=40959||e>=13312&&e<=19903?r++:(e>=65&&e<=90||e>=97&&e<=122)&&s++}return 0===r&&0===s?"other":r>=s?"zh":s>3*r?"en":"zh"},Q=()=>{if("undefined"==typeof navigator)return"other";const e=(navigator.language||"").toLowerCase();return e.startsWith("zh")?"zh":e.startsWith("en")?"en":"other"},V=e=>{const{supported:t,query:n,cookie:r,storageKey:s,useNavigator:a=!0,url:i}=e,o=e.fallback??t[0]??"en";if(0===t.length)return o;const c=t.map(e=>e.toLowerCase()),u=e=>{if(!e)return;const n=e.trim().toLowerCase();if(!n)return;const r=c.indexOf(n);if(-1!==r)return t[r];const s=n.split("-")[0],a=c.findIndex(e=>e===s||e.split("-")[0]===s);return-1===a?void 0:t[a]},d=[];if(n&&d.push(L(i)[n]),r&&d.push(Y(r)),s&&d.push(K(s)),a&&"undefined"!=typeof navigator){const{languages:e,language:t}=navigator;d.push(...e??[],t)}for(const l of d){const e=u(l);if(e)return e}return o},X=Object.freeze({}),Z=class{_locale;_fallback;_messages;_persist;_storageKey;_handlers=/* @__PURE__ */new Set;constructor(e={}){this._messages={...e.messages},this._fallback=e.fallbackLocale??"en",this._persist=e.persist??!1,this._storageKey=e.storageKey??"ran-locale",this._locale=this._resolveInitialLocale(e)}_resolveInitialLocale(e){const t=Object.keys(this._messages),n=this._persist&&K(this._storageKey)||null;if(n&&(this._messages[n]||0===t.length))return n;if(e.locale)return e.locale;if(e.detectNavigator){const e=V({supported:t,useNavigator:!0,fallback:""});if(e)return e}return this._fallback}get locale(){return this._locale}getLocale(){return this._locale}setLocale(e){e!==this._locale&&(this._locale=e,this._persist&&z(this._storageKey,e),this._notify())}addMessages(e,t){this._messages[e]={...this._messages[e],...t}}getMessages(e=this._locale){return this._messages[e]??{}}get availableLocales(){return Object.keys(this._messages)}t(e,t){const n=this._messages[this._locale]?.[e]??this._messages[this._fallback]?.[e]??e;return this._interpolate(n,t)}_interpolate(e,t){const n=t??X;return e.replace(/\{\{|\}\}|\{(\w+)\}/g,(e,t)=>"{{"===e?"{":"}}"===e?"}":null!=n[t]?String(n[t]):e)}onChange(e){return this._handlers.add(e),()=>{this._handlers.delete(e)}}_notify(){for(const e of this._handlers)e(this._locale)}destroy(){this._handlers.clear()}},ee=null;function te(e={}){const t=new Z(e);return ee=t,t}function ne(){return ee}export{M as A,s as B,T as C,k as D,U as E,w as F,a as G,l as H,A as I,e as K,v as L,m as M,g as N,F as O,_ as P,p as R,$ as S,j as T,h as U,i as V,o as W,x as _,Q as a,D as b,K as c,I as d,B as f,L as g,H as h,J as i,f as j,b as k,W as l,E as m,te as n,V as o,S as p,ne as r,G as s,Z as t,z as u,Y as v,O as w,P as x,R as y,y as z};
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as s}from"./enums-BAgbyGdH.js";import{
|
|
1
|
+
import{i as s}from"./enums-BAgbyGdH.js";import{$ as a,A as t,B as n,C as o,D as r,E as m,F as i,G as p,H as f,I as j,J as c,K as l,L as u,M as d,N as h,O as x,P as b,Q as e,R as g,S as k,T as v,U as w,V as y,W as z,X as A,Y as B,Z as C,_ as D,a as E,b as F,c as G,d as H,f as I,g as K,h as L,i as M,j as N,k as O,l as P,m as R,n as S,o as T,p as U,q as V,r as W,s as _,t as q,u as J,v as Q,w as X,x as Y,y as Z,z as $}from"./color-Bh_QUad2.js";import{$ as ss,$t as as,A as ts,At as ns,B as os,Bt as rs,C as ms,Ct as is,D as ps,Dt as fs,E as js,Et as cs,F as ls,Ft as us,G as ds,Gt as hs,H as xs,Ht as bs,I as es,It as gs,J as ks,Jt as vs,K as ws,Kt as ys,L as zs,Lt as As,M as Bs,Mt as Cs,N as Ds,Nt as Es,O as Fs,Ot as Gs,P as Hs,Pt as Is,Q as Ks,Qt as Ls,R as Ms,Rt as Ns,S as Os,St as Ps,T as Rs,Tt as Ss,U as Ts,Ut as Us,V as Vs,Vt as Ws,W as _s,Wt as qs,X as Js,Xt as Qs,Y as Xs,Yt as Ys,Z as Zs,Zt as $s,_ as sa,_t as aa,a as ta,an as na,at as oa,b as ra,bt as ma,c as ia,cn as pa,ct as fa,d as ja,dn as ca,dt as la,en as ua,et as da,f as ha,fn as xa,ft as ba,g as ea,gt as ga,h as ka,ht as va,i as wa,in as ya,it as za,j as Aa,jt as Ba,k as Ca,kt as Da,l as Ea,ln as Fa,lt as Ga,m as Ha,mt as Ia,n as Ka,nn as La,nt as Ma,o as Na,on as Oa,ot as Pa,p as Ra,pn as Sa,pt as Ta,q as Ua,qt as Va,r as Wa,rn as _a,rt as qa,s as Ja,sn as Qa,st as Xa,t as Ya,tn as Za,tt as $a,u as st,un as at,ut as tt,v as nt,vt as ot,w as rt,wt as mt,x as it,xt as pt,y as ft,yt as jt,z as ct,zt as lt}from"./utils-vTF6lLZZ.js";import{A as ut,B as dt,C as ht,D as xt,E as bt,F as et,G as gt,H as kt,I as vt,K as wt,L as yt,M as zt,N as At,O as Bt,P as Ct,R as Dt,S as Et,T as Ft,U as Gt,V as Ht,W as It,_ as Kt,a as Lt,b as Mt,c as Nt,d as Ot,f as Pt,g as Rt,h as St,i as Tt,k as Ut,l as Vt,m as Wt,n as _t,o as qt,p as Jt,r as Qt,s as Xt,t as Yt,u as Zt,v as $t,w as sn,x as an,y as tn,z as nn}from"./i18n-D1p8_7wC.js";import{n as on,t as rn}from"./chain-CTywmh_H.js";export{ks as ADOPTED_SHEET_MARKER,Xs as ADOPTED_STYLE_MARKER,Is as AudioRecorder,Va as BRIDGE_MARKER,vs as BridgeManager,rn as Chain,Ys as Client,q as Color,S as ColorScheme,Qs as DEFAULT_CHANNEL,aa as EventManager,W as FMT,M as HEX_COLOR_REGEX,E as Hsl,T as Hsla,Yt as I18nCore,zt as MOBILE_MEDIA_QUERY,na as Mathjs,j as MessageCodec,d as MimeType,Na as Monitor,$s as Platform,Ls as PostMessageBridge,Wa as QuestQueue,_ as RGBA_REGEX,G as RGB_REGEX,P as Rgb,J as Rgba,s as SyncHook,Gs as TOTP,rt as TimeoutError,ws as WebDB,ls as WorkerClient,ka as ZIP_DEFLATE,ea as ZIP_STORED,as as acceptPortBridge,jt as addClassToElement,Oa as addNumSym,Js as adoptSheetText,Zs as adoptStyles,Ot as appendUrl,u as arrayBufferToString,Da as audioVendor,ma as autosizeTextarea,ua as bridgeManager,Ts as buildOffsets,ns as canvasVendor,g as changeHumpToLowerCase,$ as checkEncoding,tt as circ,n as clearBr,y as clearStr,us as cloneDeep,H as componentToHex,fs as compose,Pt as connection,Ks as convertImageToBase64,sa as crc32,on as create,st as createData,pt as createDocumentFragment,Ua as createHandoff,_t as createI18n,Vs as createLocalePath,Jt as createObjectURL,Za as createPortBridge,Cs as createSignal,_a as createSpeechRecognizer,Xt as createStore,nt as createZip,la as cubic,At as currentDevice,ss as cutRound,Ss as debounce,Rs as deferred,js as delay,Tt as detectLanguage,Wt as durationHandler,St as encodeUrl,Ps as escapeHtml,ba as expo,za as fanShapedByArc,gs as filterObj,dt as formatDate,Ht as formatDuration,As as formatJson,kt as formatRelative,Rt as getAllQueryString,oa as getAngle,Pa as getArcPointerByDeg,Kt as getCookie,$t as getCookieByName,h as getExtensions,tn as getFrame,da as getImage,Xa as getLinearGradient,f as getMatchingSentences,$a as getMatrix,b as getMime,Ha as getPerformance,Mt as getPixelRatio,an as getQuery,w as getRandomString,ja as getReportUrl,wa as getStatus,fa as getTangentByPointer,Et as getWindow,cs as handleConsole,ot as handleError,ia as handleFetchHook,Ea as handleXhrHook,I as hexToAlpha,U as hexToHsb,R as hexToHsv,L as hexToRgb,K as hsbToHsl,D as hsbToRgb,Q as hslToHsb,Z as hslToHsv,F as hslToRgb,Y as hsvToHsl,k as hsvToRgb,o as hue2rgb,ht as imageRequest,_s as indexForOffset,ft as inflateRaw,Ct as isBangDevice,et as isClient,Ns as isEqual,Ma as isImageSize,sn as isInIframe,vt as isMobile,Ft as isSafari,ya as isSpeechRecognitionSupported,z as isString,Ca as isUrlCached,yt as isWeiXin,Ya as loadScript,Nt as localStorageGetItem,Vt as localStorageRemoveItem,Zt as localStorageSetItem,Dt as matchMediaQuery,Qa as mathjs,p as md5,qs as memoize,lt as merge,rs as mergeExports,Lt as navigatorLanguage,ts as networkAllowsDownload,bt as networkSpeed,wt as noop,hs as once,qa as opacity,La as openPortBridge,xs as paginateText,pa as parseChineseNumber,Fa as parseEnglishNumber,at as parseRomanNumber,ca as perToNum,Gt as performanceTime,Aa as prefetchUrl,Bs as prefetchUrls,Ds as prefetchWhenIdle,Ta as quad,Ia as quart,xt as queryFlag,Ws as querystring,va as quint,X as randomColor,l as randomString,xa as range,zs as readFileAsArrayBuffer,Ms as readFileAsDataURL,ct as readFileAsText,os as readFileAsUint8Array,ra as readZipEntries,it as readZipEntry,is as removeClassToElement,Bt as removeGhosting,bs as replaceOld,ha as report,Ut as requestUrlToBuffer,qt as resolveLocale,ut as retain,Os as rewriteZip,v as rgbToHex,m as rgbToHsb,r as rgbToHsl,x as rgbToHsv,O as rgbaString,t as rgbaToHex,N as rgbaToRgb,Ga as roundRectByArc,Ka as scriptOnLoad,ds as segmentByRanges,es as serveWorker,Us as setAttributeByGlobal,mt as setFontSize2html,i as setMime,Ra as setReportUrl,ga as sine,ys as singleFlight,ta as status,V as str2Xml,c as strParse,Es as subscribers,Ja as throttle,It as timeFormat,gt as timestampToTime,B as toFullWidth,A as toHalfWidth,C as toString,Sa as transformNumber,e as transformText,a as truncate,Qt as useI18n,nn as watchMediaQuery,Ba as webglVendor,Hs as whenIdle,ps as withTimeout,Fs as withTimeoutFallback,ms as zipHasEntry};
|
package/dist/src/node/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{F as e,J as t,P as n,r}from"../../color-Dohr9BXX.js";import{Socket as o}from"node:net";import s from"node:http";import i from"node:os";import a,{createReadStream as c,createWriteStream as d,readdir as l,readdirSync as u,stat as f,statSync as h}from"node:fs";import p from"node:tty";import m,{hrtime as w}from"node:process";import g from"node:child_process";import y from"node:readline";import b from"node:https";import E,{join as v,resolve as x}from"node:path";import{promisify as T}from"node:util";import{Buffer as S}from"node:buffer";import P from"node:crypto";function O(){const e=i.networkInterfaces();for(const t in e){const n=e[t];if(n)for(let e=0;e<n.length;e++){const t=n[e];if("IPv4"===t.family&&"127.0.0.1"!==t.address&&!t.internal)return t.address}}}var q=class{middleware;ctx;constructor(){const e=new s.IncomingMessage(new o),t=new s.ServerResponse(e);this.ctx={ipv4:O,req:e,res:t},this.middleware=[]}use(e){if(!e)throw new Error("the use function has an incorrect argument");this.middleware.push(e)}listen(...e){const t=function(e){if(!Array.isArray(e))throw new TypeError("Middleware stack must be an array!");for(const t of e)if("function"!=typeof t)throw new TypeError("Middleware must be composed of functions!");return function(t,n){let r=-1;function o(s){if(s<=r)return Promise.reject(/* @__PURE__ */new Error("next() called multiple times"));r=s;let i=e[s];if(s===e.length&&n&&(i=n),!i)return Promise.resolve();try{return Promise.resolve(i(t,o.bind(null,s+1)))}catch(a){return Promise.reject(a)}}return o(0)}}(this.middleware);return s.createServer((e,n)=>{this.ctx.req=e,this.ctx.res=n,t(this.ctx).catch(C)}).listen(...e)}};function C(e){console.error(e.stack||e.toString())}var H=a,F=(e,t="utf-8")=>{const n=new AbortController,r=n.signal,o=new Promise((o,s)=>{H.readFile(e,{encoding:t,signal:r},(e,t)=>{e?(n.abort(),s({success:!1,_identification:!1,data:e})):o({success:!0,_identification:!0,data:t})})});return o.abort=n.abort,o},M=(e,t)=>new Promise((n,r)=>{H.appendFile(e,t,t=>{t?r({success:!1,_identification:!1,data:t}):F(e).then(e=>{n(e)})})}),_=m?.env&&!("NO_COLOR"in m.env||m.argv.includes("--no-color"))&&("FORCE_COLOR"in m.env||m.argv.includes("--color")||"win32"===m.platform||p.isatty(1)&&"dumb"!==m.env.TERM||"CI"in m.env),U=(e,t,n=e)=>r=>{const o=""+r,s=o.indexOf(t,e.length);return~s?e+j(o,t,n,s)+t:e+o+t},j=(e,t,n,r)=>{const o=e.substring(0,r)+n,s=e.substring(r+t.length),i=s.indexOf(t);return~i?o+j(s,t,n,i):o+s},k=Object.assign({},((e=_)=>{const t={};return Object.keys(r).forEach(n=>t[n]=e?U(r[n][0],r[n][1]):String),t})(),((e=_)=>({isColorSupported:e,reset:e?e=>`${r.reset[0]}${e}${r.reset[1]}`:String,bold:e?U(r.bold[0],r.bold[1],`${r.bold[1]}${r.bold[0]}`):String,dim:e?U(r.dim[0],r.dim[1],`${r.dim[1]}${r.dim[0]}`):String}))()),$=(e={})=>{const{uploadDir:n=".",encoding:r="",json:o=!0}=e;return(e,s)=>{const{req:i,res:c}=e,{url:d,method:l}=i,[u="",f=""]=d?.split("?")||[],h=f?new URLSearchParams(f):{};e.request||(e.request={}),e.request.method=l,e.request.path=u,e.request.url=d,e.request.query=h;const p=i.headers["content-type"];if("application/json"===p){r?i.setEncoding(r):i.setEncoding("utf-8");let t="";i.on("data",e=>{t+=e}),i.on("end",()=>{c.setHeader("content-type","application/json;charset=UTF-8");try{e.request.body=o?JSON.parse(t):t}catch{e.request.body=t}s()})}if(p?.includes("multipart/form-data;")){const[e,o]=i.headers["content-type"]?.split(";").map(e=>e.trim())||[],[d,l]=o.split("=");r?i.setEncoding(r):i.setEncoding("binary");let u="";i.on("data",e=>{u+=e}),i.on("end",()=>{const e={};u.split("\r\n").slice(0,4).forEach(n=>{Object.assign(e,t(n,";",/=|:/))});const r=e["Content-Type"],o=Buffer.from(e.filename,"latin1").toString("utf8"),i=u.indexOf(r)+r.length,d=u.substring(i).replace(/^\s+/,""),f=d.substring(0,d.indexOf(`--${l}--`));a.writeFile(`${n}/${o}`,f,{encoding:"binary"},e=>{if(e)throw e;c.setHeader("content-type","application/json;charset=UTF-8"),s()})})}}},I=(e,t)=>new Promise((n,r)=>{const o=g.spawn(e,t,{stdio:"inherit",shell:!1});o.on("error",e=>r(e)),o.on("exit",e=>0===e?n():r(/* @__PURE__ */new Error(`Command exited with code ${e}`)))}),A=({message:e,stream:t=process.stderr,defaultResponse:n="Y"})=>{const r=y.createInterface({input:process.stdin,output:t});return new Promise(t=>{r.question(`${e} `,e=>{r.close();const o=(e||n).toLowerCase();t("y"===o||"yes"===o)})})},B=()=>{};function D(e,t,n){return t(e.req,e.res,B),n()}function L(e,t,n){return new Promise((r,o)=>{t(e.req,e.res,e=>{e?o(e):r(n())})})}function R(e){const t=e.length<3?D:L;return function(n,r){return t(n,e,r)}}var N=e=>new Promise((t,n)=>{H.stat(e,(e,r)=>{e?n({success:!1,_identification:!1,data:e}):t({success:!0,_identification:!0,data:r})})}),J=({url:e})=>new Promise((t,n)=>{b.get(e,e=>{const n=[];e.on("data",e=>{n.push(e)}),e.on("end",()=>{const{data:e=[]}=JSON.parse(Buffer.concat(n).toString());e.forEach(e=>{}),t({success:!0,data:e,message:"request success"})})}).on("error",e=>{e.message,n({success:!1,data:e,message:e.message})})}),K=()=>{const e=i.networkInterfaces();for(const t in e){const n=e[t];for(let e=0;e<n.length;e++){const t=n[e];if("IPv4"===t.family&&"127.0.0.1"!==t.address&&!t.internal)return t.address}}};function z(e){const t=e.url;if(void 0===t)return;let n=e._parsedUrl;if(n&&n._raw===t)return n;n={},n.query=n.search=void 0,n.href=n.path=n.pathname=t;const r=t.indexOf("?",1);return-1!==r&&(n.search=t.substring(r),n.query=n.search.substring(1),n.pathname=t.substring(0,r)),n._raw=t,e._parsedUrl=n}var W=e=>{const{dirPath:t}=e;try{return H.readdirSync(t)}catch(n){throw n}},G=class{ctx;map;methods;paths;constructor(){this.map=/* @__PURE__ */new Map,this.methods=/* @__PURE__ */new Set,this.paths=/* @__PURE__ */new Set}get(e,t){this.addHandlerToMap("GET")(e,t)}post(e,t){this.addHandlerToMap("POST")(e,t)}put(e,t){this.addHandlerToMap("PUT")(e,t)}patch(e,t){this.addHandlerToMap("PATCH")(e,t)}del(e,t){this.addHandlerToMap("DELETE")(e,t)}head(e,t){this.addHandlerToMap("HEAD")(e,t)}options(e,t){this.addHandlerToMap("OPTIONS")(e,t)}addHandlerToMap(e){return this.methods.add(e),(t,n)=>{this.paths.add(t);let r=this.map.get(e);r||(r=/* @__PURE__ */new Map,this.map.set(e,r)),r.set(t,n)}}routes(){return(e,t)=>{this.ctx=e;const{path:n,method:r}=e.request,o=this.map.get(r),s=o?o.get(n):t;s&&s(e,t)}}allowedMethods(){return e=>{const{res:t}=e,{path:n,method:r}=e.request;!this.methods.has(r)&&this.paths.has(n)&&(t.statusCode=405,t.end("405, method is not allowed")),this.methods.has(r)&&!this.paths.has(n)&&(t.statusCode=404,t.end("404, the request address does not exist")),this.methods.has(r)||this.paths.has(n)||(t.statusCode=501,t.end("501, not support the functionality needed to satisfy the request"))}}},Y=(t={})=>{const{pathname:r,fileTypes:o={}}=t;return async(t,s)=>{try{const{req:i,res:c}=t;if(i.url){const t="text/html",s=r||process.cwd(),d=E.normalize(E.resolve(s)),l=E.extname(i.url).slice(1);Object.keys(o).forEach(t=>e(t,o[t]));const u=l?n(l):t;if(!Boolean(u))return c.writeHead(404,{"Content-Type":"text/html"}),void c.end("404: File not found");let f=i.url;if("/"===i.url)f="index.html";else if(!l)try{a.accessSync(E.join(d,i.url+".html"),a.constants.F_OK),f=i.url+".html"}catch{f=E.join(i.url,"index.html")}const h=E.join(d,f);if(!E.normalize(E.resolve(h)).startsWith(d))return c.writeHead(404,{"Content-Type":"text/html"}),void c.end("404: File not found");a.readFile(h,(e,t)=>{e?(c.writeHead(404,{"Content-Type":"text/html"}),c.end("404: File not found")):(c.writeHead(200,{"Content-Type":u}),c.end(t))})}await s()}catch{}}},Q=()=>{if("undefined"!=typeof window){const e=window.performance.now();return Symbol.for(`${e}`)}if("undefined"!=typeof process){const e=w.bigint();return Symbol.for(`${e}`)}return Symbol.for(`${Date.now()}`)},V=e=>{const{path:t}=e;if(t)return c(t);throw new Error("path is not defined")},X=e=>{const{path:t}=e;if(t)return d(t);throw new Error("path is not defined")},Z=e=>{const t=Symbol.keyFor(e);return"undefined"!=typeof window&&t?window.performance.now()-Number(t):"undefined"!=typeof process&&t?w.bigint()-BigInt(t):Date.now()-Number(t)},ee=T(f),te=T(l);async function ne(e,t,n=""){e=x(".",e);const r=await te(e);await Promise.all(r.map(async r=>{const o=v(e,r),s=await ee(o);return s.isDirectory()?ne(o,t,v(n,r)):t(v(n,r),o,s)}))}function re(e,t,n=""){e=x(".",e);const r=u(e);let o,s,i=0;for(;i<r.length;i++)o=v(e,r[i]),s=h(o),s.isDirectory()?re(o,t,v(n,r[i])):t(v(n,r[i]),o,s)}var oe=(e,t=20)=>new Promise(n=>{H.watchFile(e,{interval:t},(t,r)=>{t.mtime!==r.mtime?(H.unwatchFile(e),n({success:!0,_identification:!0,data:{},message:"file is changed"})):n({success:!1,_identification:!1,data:{},message:"file is not changed"})})});function se(e,t){const n=S.byteLength(e);let r=null;if(n>65535?(r=S.alloc(10+n),r[1]=127,r.writeUInt32BE(n,6),r.write(e,10)):n>125?(r=S.alloc(4+n),r[1]=126,r.writeUInt16BE(n,2),r.write(e,4)):(r=S.alloc(2+n),r[1]=n,r.write(e,2)),t){const e=t.opcode;e&&e<15&&e>=0&&(r[0]=128|e)}else r[0]=129;return r}function ie(e,t){if(!t)return e;const n=S.from(e);for(let r=0;r<n.length;++r)n[r]=n[r]^t[r%4];return n}function ae(){const e={};this.on=(t,n)=>{e[t]?e[t].push(n):e[t]=[n]},this.off=(t,n)=>{const r=e[t],o=r.indexOf(n);r&&-1!==o&&r.splice(o,1)},this.emit=(t,n)=>{e[t]&&e[t].forEach(e=>e(n))}}function ce(e){ae.call(this);const t=[];this.server=e,this.clients=t,this.broadcast=e=>{t.forEach(t=>{t.send(e)})},e.on("upgrade",(e,n)=>{n.write(["HTTP/1.1 101 Switching Protocols","Upgrade: websocket","Connection: Upgrade","Sec-WebSocket-Accept: "+P.createHash("sha1").update(e.headers["sec-websocket-key"]+"258EAFA5-E914-47DA-95CA-C5AB0DC85B11").digest("base64")].join("\n")+"\n\n");const r={send(e,t){n.write(se(e,t))},ping(){n.write(se("",{opcode:9}))},pong(){n.write(se("",{opcode:10}))},close(){if(-1===t.indexOf(r))return!1;t.splice(t.indexOf(r),1),n.write(se("",{opcode:8})),r.emit("close"),n.destroy()},socket:n};ae.call(r),this.emit("connect",r),t.push(r);let o=S.allocUnsafe(0),s=S.allocUnsafe(0);const i=[];let a=!0;function c(){const e=function(e){const t=S.from(e),n=127&t[1];let r=0,o=0;const s=t[1]>=128;return 127===n?(r=t.readUInt32BE(6),o=10):126===n?(r=t.readUInt16BE(2),o=4):(r=n,o=2),{fin:t[0]>=128,opcode:15&t[0],mask:s,maskKey:s?t.subarray(o,o+(s?4:0)):null,len7:n,len:r,lenMeta:o+(s?4:0)}}(o);i.push({l:e.lenMeta,f:()=>{a=!1,i.push({l:e.len,f:t=>{if(s=S.concat([s,ie(t,e.maskKey)]),a=!0,e.fin){if(8===e.opcode)return r.close();if(9===e.opcode)return r.pong();r.emit("message",s),s=S.allocUnsafe(0)}}})}})}n.on("data",e=>{for(o=S.concat([o,e]),a&&c();i[0]&&o.byteLength>=i[0].l;){const e=i[0].l;i[0].f(o.subarray(0,e)),o=o.subarray(e),i.splice(0,1)}}),n.on("end",()=>{r.close()}),n.on("error",e=>{r.emit("error",e),r.close()})})}var de=(e,t)=>new Promise((n,r)=>{H.writeFile(e,t,{mode:438,flag:"w+",encoding:"utf-8"},o=>{if(o)throw r({success:!1,_identification:!1,data:o}),o;n({success:!0,_identification:!1,data:{path:e,content:t}})})});export{G as Router,q as Server,ce as WSS,M as appendFile,$ as body,k as colors,R as connect,J as get,K as getIPAdress,_ as isColorSupported,z as paresUrl,A as prompt,N as queryFileInfo,W as readDir,F as readFile,V as readStream,I as runCommand,Q as startTask,Y as staticMiddleware,Z as taskEnd,ne as traverse,re as traverseSync,oe as watchFile,de as writeFile,X as writeStream};
|
|
1
|
+
import{F as e,J as t,P as n,r}from"../../color-Bh_QUad2.js";import{Socket as o}from"node:net";import s from"node:http";import i from"node:os";import a,{createReadStream as c,createWriteStream as d,readdir as l,readdirSync as u,stat as f,statSync as h}from"node:fs";import p from"node:tty";import m,{hrtime as w}from"node:process";import g from"node:child_process";import y from"node:readline";import b from"node:https";import E,{join as v,resolve as x}from"node:path";import{promisify as T}from"node:util";import{Buffer as S}from"node:buffer";import P from"node:crypto";function O(){const e=i.networkInterfaces();for(const t in e){const n=e[t];if(n)for(let e=0;e<n.length;e++){const t=n[e];if("IPv4"===t.family&&"127.0.0.1"!==t.address&&!t.internal)return t.address}}}var q=class{middleware;ctx;constructor(){const e=new s.IncomingMessage(new o),t=new s.ServerResponse(e);this.ctx={ipv4:O,req:e,res:t},this.middleware=[]}use(e){if(!e)throw new Error("the use function has an incorrect argument");this.middleware.push(e)}listen(...e){const t=function(e){if(!Array.isArray(e))throw new TypeError("Middleware stack must be an array!");for(const t of e)if("function"!=typeof t)throw new TypeError("Middleware must be composed of functions!");return function(t,n){let r=-1;function o(s){if(s<=r)return Promise.reject(/* @__PURE__ */new Error("next() called multiple times"));r=s;let i=e[s];if(s===e.length&&n&&(i=n),!i)return Promise.resolve();try{return Promise.resolve(i(t,o.bind(null,s+1)))}catch(a){return Promise.reject(a)}}return o(0)}}(this.middleware);return s.createServer((e,n)=>{this.ctx.req=e,this.ctx.res=n,t(this.ctx).catch(C)}).listen(...e)}};function C(e){console.error(e.stack||e.toString())}var H=a,F=(e,t="utf-8")=>{const n=new AbortController,r=n.signal,o=new Promise((o,s)=>{H.readFile(e,{encoding:t,signal:r},(e,t)=>{e?(n.abort(),s({success:!1,_identification:!1,data:e})):o({success:!0,_identification:!0,data:t})})});return o.abort=n.abort,o},M=(e,t)=>new Promise((n,r)=>{H.appendFile(e,t,t=>{t?r({success:!1,_identification:!1,data:t}):F(e).then(e=>{n(e)})})}),_=m?.env&&!("NO_COLOR"in m.env||m.argv.includes("--no-color"))&&("FORCE_COLOR"in m.env||m.argv.includes("--color")||"win32"===m.platform||p.isatty(1)&&"dumb"!==m.env.TERM||"CI"in m.env),U=(e,t,n=e)=>r=>{const o=""+r,s=o.indexOf(t,e.length);return~s?e+j(o,t,n,s)+t:e+o+t},j=(e,t,n,r)=>{const o=e.substring(0,r)+n,s=e.substring(r+t.length),i=s.indexOf(t);return~i?o+j(s,t,n,i):o+s},k=Object.assign({},((e=_)=>{const t={};return Object.keys(r).forEach(n=>t[n]=e?U(r[n][0],r[n][1]):String),t})(),((e=_)=>({isColorSupported:e,reset:e?e=>`${r.reset[0]}${e}${r.reset[1]}`:String,bold:e?U(r.bold[0],r.bold[1],`${r.bold[1]}${r.bold[0]}`):String,dim:e?U(r.dim[0],r.dim[1],`${r.dim[1]}${r.dim[0]}`):String}))()),$=(e={})=>{const{uploadDir:n=".",encoding:r="",json:o=!0}=e;return(e,s)=>{const{req:i,res:c}=e,{url:d,method:l}=i,[u="",f=""]=d?.split("?")||[],h=f?new URLSearchParams(f):{};e.request||(e.request={}),e.request.method=l,e.request.path=u,e.request.url=d,e.request.query=h;const p=i.headers["content-type"];if("application/json"===p){r?i.setEncoding(r):i.setEncoding("utf-8");let t="";i.on("data",e=>{t+=e}),i.on("end",()=>{c.setHeader("content-type","application/json;charset=UTF-8");try{e.request.body=o?JSON.parse(t):t}catch{e.request.body=t}s()})}if(p?.includes("multipart/form-data;")){const[e,o]=i.headers["content-type"]?.split(";").map(e=>e.trim())||[],[d,l]=o.split("=");r?i.setEncoding(r):i.setEncoding("binary");let u="";i.on("data",e=>{u+=e}),i.on("end",()=>{const e={};u.split("\r\n").slice(0,4).forEach(n=>{Object.assign(e,t(n,";",/=|:/))});const r=e["Content-Type"],o=Buffer.from(e.filename,"latin1").toString("utf8"),i=u.indexOf(r)+r.length,d=u.substring(i).replace(/^\s+/,""),f=d.substring(0,d.indexOf(`--${l}--`));a.writeFile(`${n}/${o}`,f,{encoding:"binary"},e=>{if(e)throw e;c.setHeader("content-type","application/json;charset=UTF-8"),s()})})}}},I=(e,t)=>new Promise((n,r)=>{const o=g.spawn(e,t,{stdio:"inherit",shell:!1});o.on("error",e=>r(e)),o.on("exit",e=>0===e?n():r(/* @__PURE__ */new Error(`Command exited with code ${e}`)))}),A=({message:e,stream:t=process.stderr,defaultResponse:n="Y"})=>{const r=y.createInterface({input:process.stdin,output:t});return new Promise(t=>{r.question(`${e} `,e=>{r.close();const o=(e||n).toLowerCase();t("y"===o||"yes"===o)})})},B=()=>{};function D(e,t,n){return t(e.req,e.res,B),n()}function L(e,t,n){return new Promise((r,o)=>{t(e.req,e.res,e=>{e?o(e):r(n())})})}function R(e){const t=e.length<3?D:L;return function(n,r){return t(n,e,r)}}var N=e=>new Promise((t,n)=>{H.stat(e,(e,r)=>{e?n({success:!1,_identification:!1,data:e}):t({success:!0,_identification:!0,data:r})})}),J=({url:e})=>new Promise((t,n)=>{b.get(e,e=>{const n=[];e.on("data",e=>{n.push(e)}),e.on("end",()=>{const{data:e=[]}=JSON.parse(Buffer.concat(n).toString());e.forEach(e=>{}),t({success:!0,data:e,message:"request success"})})}).on("error",e=>{e.message,n({success:!1,data:e,message:e.message})})}),K=()=>{const e=i.networkInterfaces();for(const t in e){const n=e[t];for(let e=0;e<n.length;e++){const t=n[e];if("IPv4"===t.family&&"127.0.0.1"!==t.address&&!t.internal)return t.address}}};function z(e){const t=e.url;if(void 0===t)return;let n=e._parsedUrl;if(n&&n._raw===t)return n;n={},n.query=n.search=void 0,n.href=n.path=n.pathname=t;const r=t.indexOf("?",1);return-1!==r&&(n.search=t.substring(r),n.query=n.search.substring(1),n.pathname=t.substring(0,r)),n._raw=t,e._parsedUrl=n}var W=e=>{const{dirPath:t}=e;try{return H.readdirSync(t)}catch(n){throw n}},G=class{ctx;map;methods;paths;constructor(){this.map=/* @__PURE__ */new Map,this.methods=/* @__PURE__ */new Set,this.paths=/* @__PURE__ */new Set}get(e,t){this.addHandlerToMap("GET")(e,t)}post(e,t){this.addHandlerToMap("POST")(e,t)}put(e,t){this.addHandlerToMap("PUT")(e,t)}patch(e,t){this.addHandlerToMap("PATCH")(e,t)}del(e,t){this.addHandlerToMap("DELETE")(e,t)}head(e,t){this.addHandlerToMap("HEAD")(e,t)}options(e,t){this.addHandlerToMap("OPTIONS")(e,t)}addHandlerToMap(e){return this.methods.add(e),(t,n)=>{this.paths.add(t);let r=this.map.get(e);r||(r=/* @__PURE__ */new Map,this.map.set(e,r)),r.set(t,n)}}routes(){return(e,t)=>{this.ctx=e;const{path:n,method:r}=e.request,o=this.map.get(r),s=o?o.get(n):t;s&&s(e,t)}}allowedMethods(){return e=>{const{res:t}=e,{path:n,method:r}=e.request;!this.methods.has(r)&&this.paths.has(n)&&(t.statusCode=405,t.end("405, method is not allowed")),this.methods.has(r)&&!this.paths.has(n)&&(t.statusCode=404,t.end("404, the request address does not exist")),this.methods.has(r)||this.paths.has(n)||(t.statusCode=501,t.end("501, not support the functionality needed to satisfy the request"))}}},Y=(t={})=>{const{pathname:r,fileTypes:o={}}=t;return async(t,s)=>{try{const{req:i,res:c}=t;if(i.url){const t="text/html",s=r||process.cwd(),d=E.normalize(E.resolve(s)),l=E.extname(i.url).slice(1);Object.keys(o).forEach(t=>e(t,o[t]));const u=l?n(l):t;if(!Boolean(u))return c.writeHead(404,{"Content-Type":"text/html"}),void c.end("404: File not found");let f=i.url;if("/"===i.url)f="index.html";else if(!l)try{a.accessSync(E.join(d,i.url+".html"),a.constants.F_OK),f=i.url+".html"}catch{f=E.join(i.url,"index.html")}const h=E.join(d,f);if(!E.normalize(E.resolve(h)).startsWith(d))return c.writeHead(404,{"Content-Type":"text/html"}),void c.end("404: File not found");a.readFile(h,(e,t)=>{e?(c.writeHead(404,{"Content-Type":"text/html"}),c.end("404: File not found")):(c.writeHead(200,{"Content-Type":u}),c.end(t))})}await s()}catch{}}},Q=()=>{if("undefined"!=typeof window){const e=window.performance.now();return Symbol.for(`${e}`)}if("undefined"!=typeof process){const e=w.bigint();return Symbol.for(`${e}`)}return Symbol.for(`${Date.now()}`)},V=e=>{const{path:t}=e;if(t)return c(t);throw new Error("path is not defined")},X=e=>{const{path:t}=e;if(t)return d(t);throw new Error("path is not defined")},Z=e=>{const t=Symbol.keyFor(e);return"undefined"!=typeof window&&t?window.performance.now()-Number(t):"undefined"!=typeof process&&t?w.bigint()-BigInt(t):Date.now()-Number(t)},ee=T(f),te=T(l);async function ne(e,t,n=""){e=x(".",e);const r=await te(e);await Promise.all(r.map(async r=>{const o=v(e,r),s=await ee(o);return s.isDirectory()?ne(o,t,v(n,r)):t(v(n,r),o,s)}))}function re(e,t,n=""){e=x(".",e);const r=u(e);let o,s,i=0;for(;i<r.length;i++)o=v(e,r[i]),s=h(o),s.isDirectory()?re(o,t,v(n,r[i])):t(v(n,r[i]),o,s)}var oe=(e,t=20)=>new Promise(n=>{H.watchFile(e,{interval:t},(t,r)=>{t.mtime!==r.mtime?(H.unwatchFile(e),n({success:!0,_identification:!0,data:{},message:"file is changed"})):n({success:!1,_identification:!1,data:{},message:"file is not changed"})})});function se(e,t){const n=S.byteLength(e);let r=null;if(n>65535?(r=S.alloc(10+n),r[1]=127,r.writeUInt32BE(n,6),r.write(e,10)):n>125?(r=S.alloc(4+n),r[1]=126,r.writeUInt16BE(n,2),r.write(e,4)):(r=S.alloc(2+n),r[1]=n,r.write(e,2)),t){const e=t.opcode;e&&e<15&&e>=0&&(r[0]=128|e)}else r[0]=129;return r}function ie(e,t){if(!t)return e;const n=S.from(e);for(let r=0;r<n.length;++r)n[r]=n[r]^t[r%4];return n}function ae(){const e={};this.on=(t,n)=>{e[t]?e[t].push(n):e[t]=[n]},this.off=(t,n)=>{const r=e[t],o=r.indexOf(n);r&&-1!==o&&r.splice(o,1)},this.emit=(t,n)=>{e[t]&&e[t].forEach(e=>e(n))}}function ce(e){ae.call(this);const t=[];this.server=e,this.clients=t,this.broadcast=e=>{t.forEach(t=>{t.send(e)})},e.on("upgrade",(e,n)=>{n.write(["HTTP/1.1 101 Switching Protocols","Upgrade: websocket","Connection: Upgrade","Sec-WebSocket-Accept: "+P.createHash("sha1").update(e.headers["sec-websocket-key"]+"258EAFA5-E914-47DA-95CA-C5AB0DC85B11").digest("base64")].join("\n")+"\n\n");const r={send(e,t){n.write(se(e,t))},ping(){n.write(se("",{opcode:9}))},pong(){n.write(se("",{opcode:10}))},close(){if(-1===t.indexOf(r))return!1;t.splice(t.indexOf(r),1),n.write(se("",{opcode:8})),r.emit("close"),n.destroy()},socket:n};ae.call(r),this.emit("connect",r),t.push(r);let o=S.allocUnsafe(0),s=S.allocUnsafe(0);const i=[];let a=!0;function c(){const e=function(e){const t=S.from(e),n=127&t[1];let r=0,o=0;const s=t[1]>=128;return 127===n?(r=t.readUInt32BE(6),o=10):126===n?(r=t.readUInt16BE(2),o=4):(r=n,o=2),{fin:t[0]>=128,opcode:15&t[0],mask:s,maskKey:s?t.subarray(o,o+(s?4:0)):null,len7:n,len:r,lenMeta:o+(s?4:0)}}(o);i.push({l:e.lenMeta,f:()=>{a=!1,i.push({l:e.len,f:t=>{if(s=S.concat([s,ie(t,e.maskKey)]),a=!0,e.fin){if(8===e.opcode)return r.close();if(9===e.opcode)return r.pong();r.emit("message",s),s=S.allocUnsafe(0)}}})}})}n.on("data",e=>{for(o=S.concat([o,e]),a&&c();i[0]&&o.byteLength>=i[0].l;){const e=i[0].l;i[0].f(o.subarray(0,e)),o=o.subarray(e),i.splice(0,1)}}),n.on("end",()=>{r.close()}),n.on("error",e=>{r.emit("error",e),r.close()})})}var de=(e,t)=>new Promise((n,r)=>{H.writeFile(e,t,{mode:438,flag:"w+",encoding:"utf-8"},o=>{if(o)throw r({success:!1,_identification:!1,data:o}),o;n({success:!0,_identification:!1,data:{path:e,content:t}})})});export{G as Router,q as Server,ce as WSS,M as appendFile,$ as body,k as colors,R as connect,J as get,K as getIPAdress,_ as isColorSupported,z as paresUrl,A as prompt,N as queryFileInfo,W as readDir,F as readFile,V as readStream,I as runCommand,Q as startTask,Y as staticMiddleware,Z as taskEnd,ne as traverse,re as traverseSync,oe as watchFile,de as writeFile,X as writeStream};
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Service Worker building blocks.
|
|
3
|
+
*
|
|
4
|
+
* A companion to `prefetchUrls` / `prefetchWhenIdle` in `ranuts/utils`: those ship the page
|
|
5
|
+
* side of the "warm the cache in the background" protocol, and {@link servePrecache} is the
|
|
6
|
+
* worker side that answers them. The two caching strategies below are the standard pair every
|
|
7
|
+
* SW ends up writing.
|
|
8
|
+
*
|
|
9
|
+
* Its own entry point (`ranuts/sw`) rather than part of `ranuts/utils`, because this code runs
|
|
10
|
+
* in a `ServiceWorkerGlobalScope` where `window` and `document` do not exist — pulling in the
|
|
11
|
+
* general utils barrel would drag DOM-facing modules into a worker bundle.
|
|
12
|
+
*
|
|
13
|
+
* All of it assumes a bundled service worker. A hand-written `sw.js` served as a static file
|
|
14
|
+
* cannot import from node_modules; either bundle it, or copy the pieces you need.
|
|
15
|
+
*/
|
|
16
|
+
/**
|
|
17
|
+
* The bit of `ExtendableMessageEvent` used here, declared locally rather than pulled from
|
|
18
|
+
* `lib.webworker` — that lib conflicts with `lib.dom` in a project that compiles both, and
|
|
19
|
+
* this package must stay importable from either.
|
|
20
|
+
*/
|
|
21
|
+
export interface PrecacheMessageEvent {
|
|
22
|
+
data: unknown;
|
|
23
|
+
waitUntil: (promise: Promise<unknown>) => void;
|
|
24
|
+
}
|
|
25
|
+
/** Minimal view of the SW global the helpers touch, so they can be unit-tested with a stub. */
|
|
26
|
+
export interface SWScope {
|
|
27
|
+
caches: CacheStorage;
|
|
28
|
+
fetch: typeof fetch;
|
|
29
|
+
addEventListener: (type: string, listener: (event: never) => void) => void;
|
|
30
|
+
removeEventListener: (type: string, listener: (event: never) => void) => void;
|
|
31
|
+
}
|
|
32
|
+
export interface CacheStrategyOptions {
|
|
33
|
+
/** Cache to read and write. */
|
|
34
|
+
cacheName: string;
|
|
35
|
+
/** Whether a response may be stored. Default: any GET answered with 200. */
|
|
36
|
+
shouldCache?: (request: Request, response: Response) => boolean;
|
|
37
|
+
/** Scope override, for tests or a non-global worker. */
|
|
38
|
+
scope?: SWScope;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* @description: Cache-first: serve the stored copy when there is one, otherwise fetch and
|
|
42
|
+
* store. For immutable, content-hashed assets — scripts, styles, fonts, model weights.
|
|
43
|
+
*
|
|
44
|
+
* @param {Request} request
|
|
45
|
+
* @param {CacheStrategyOptions} options
|
|
46
|
+
* @return {Promise<Response>} never rejects; a network failure resolves to a 408
|
|
47
|
+
*/
|
|
48
|
+
export declare const cacheFirst: (request: Request, options: CacheStrategyOptions) => Promise<Response>;
|
|
49
|
+
/**
|
|
50
|
+
* @description: Network-first: go to the network, store what comes back, and fall back to the
|
|
51
|
+
* cache when offline. For anything that must reflect a deploy immediately — HTML navigations,
|
|
52
|
+
* a manifest, an API response you also want available offline.
|
|
53
|
+
*
|
|
54
|
+
* @param {Request} request
|
|
55
|
+
* @param {CacheStrategyOptions} options
|
|
56
|
+
* @return {Promise<Response>} never rejects; offline with nothing cached resolves to a 408
|
|
57
|
+
*/
|
|
58
|
+
export declare const networkFirst: (request: Request, options: CacheStrategyOptions) => Promise<Response>;
|
|
59
|
+
/**
|
|
60
|
+
* @description: Fill a cache with a list of URLs, skipping what is already there. Failures are
|
|
61
|
+
* per-URL and silent — one 404 in a precache list must not abort the install.
|
|
62
|
+
*
|
|
63
|
+
* @param {string} cacheName
|
|
64
|
+
* @param {string[]} urls
|
|
65
|
+
* @param {object} options
|
|
66
|
+
* @return {Promise<void>}
|
|
67
|
+
*/
|
|
68
|
+
export declare const precache: (cacheName: string, urls: readonly string[], options?: {
|
|
69
|
+
scope?: SWScope;
|
|
70
|
+
}) => Promise<void>;
|
|
71
|
+
/**
|
|
72
|
+
* @description: Delete every cache except the ones named. Call it on `activate` so a new
|
|
73
|
+
* build's caches replace the previous build's instead of accumulating.
|
|
74
|
+
*
|
|
75
|
+
* @param {string[]} keep cache names to preserve
|
|
76
|
+
* @param {object} options
|
|
77
|
+
* @return {Promise<string[]>} the names that were deleted
|
|
78
|
+
*/
|
|
79
|
+
export declare const dropCachesExcept: (keep: readonly string[], options?: {
|
|
80
|
+
scope?: SWScope;
|
|
81
|
+
}) => Promise<string[]>;
|
|
82
|
+
export interface ServePrecacheOptions {
|
|
83
|
+
/** Cache the URLs land in. */
|
|
84
|
+
cacheName: string;
|
|
85
|
+
/** Message `type` to answer. Must match `prefetchUrls({ serviceWorkerMessage })`. */
|
|
86
|
+
type: string;
|
|
87
|
+
scope?: SWScope;
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* @description: Answer the precache messages that `prefetchUrls({ serviceWorkerMessage })`
|
|
91
|
+
* posts from the page — the worker half of that protocol.
|
|
92
|
+
*
|
|
93
|
+
* Downloading here rather than on the page is the whole point: the work is wrapped in
|
|
94
|
+
* `event.waitUntil`, so the service worker stays alive through navigations. A page-side fetch
|
|
95
|
+
* is aborted the moment the user clicks away, and a large asset then restarts from zero on the
|
|
96
|
+
* next visit.
|
|
97
|
+
*
|
|
98
|
+
* @param {ServePrecacheOptions} options
|
|
99
|
+
* @return {Function} stop — removes the listener
|
|
100
|
+
* @example
|
|
101
|
+
* ```ts
|
|
102
|
+
* // sw.ts
|
|
103
|
+
* servePrecache({ type: 'precache-models', cacheName: 'models' });
|
|
104
|
+
*
|
|
105
|
+
* // page
|
|
106
|
+
* prefetchUrls(modelFiles, { serviceWorkerMessage: 'precache-models' });
|
|
107
|
+
* ```
|
|
108
|
+
*/
|
|
109
|
+
export declare const servePrecache: (options: ServePrecacheOptions) => (() => void);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var e=()=>globalThis,t=()=>new Response("Network error happened",{status:408,headers:{"Content-Type":"text/plain"}}),c=(e,t)=>"GET"===e.method&&200===t.status,a=(e,t,c,a)=>{const s=a.clone();return e.caches.open(t).then(e=>e.put(c.url,s)).catch(()=>{})},s=async(s,n)=>{const r=n.scope??e(),o=n.shouldCache??c;try{const e=await r.caches.match(s.url);if(e)return e;const t=await r.fetch(s);return o(s,t)&&a(r,n.cacheName,s,t),t}catch{return t()}},n=async(s,n)=>{const r=n.scope??e(),o=n.shouldCache??c;try{const e=await r.fetch(s);return o(s,e)&&a(r,n.cacheName,s,e),e}catch{return await r.caches.match(s.url).catch(()=>{})??t()}},r=async(t,c,a={})=>{const s=a.scope??e(),n=await s.caches.open(t);for(const e of c)try{if(await n.match(e))continue;const t=await s.fetch(e,{cache:"force-cache"});t.ok&&await n.put(e,t.clone())}catch{}},o=async(t,c={})=>{const a=c.scope??e(),s=(await a.caches.keys()).filter(e=>!t.includes(e));return await Promise.all(s.map(e=>a.caches.delete(e))),s},h=t=>{const c=t.scope??e(),a=e=>{const a=e.data;a&&a.type===t.type&&Array.isArray(a.urls)&&e.waitUntil(r(t.cacheName,a.urls,{scope:c}))};return c.addEventListener("message",a),()=>c.removeEventListener("message",a)};export{s as cacheFirst,o as dropCachesExcept,n as networkFirst,r as precache,h as servePrecache};
|
package/dist/src/utils/dom.d.ts
CHANGED
|
@@ -23,4 +23,27 @@ export declare function escapeHtml(string?: string | number | null): string;
|
|
|
23
23
|
* @return {*}
|
|
24
24
|
*/
|
|
25
25
|
export declare const setFontSize2html: (designWidth?: number) => void;
|
|
26
|
+
/**
|
|
27
|
+
* @description: Make a `<textarea>` grow and shrink with its content, so a long message is
|
|
28
|
+
* readable without an inner scrollbar.
|
|
29
|
+
*
|
|
30
|
+
* Set the ceiling in CSS with `max-height` rather than here — once the element hits it, the
|
|
31
|
+
* measured `scrollHeight` stops growing and the textarea scrolls internally, which is the
|
|
32
|
+
* behaviour you want at the limit.
|
|
33
|
+
*
|
|
34
|
+
* Two details make this work where the naive version does not: the height is reset to `auto`
|
|
35
|
+
* before each measurement (`scrollHeight` never reports *less* than the current height, so
|
|
36
|
+
* without the reset the box could only ever grow), and `box-sizing` decides whether padding is
|
|
37
|
+
* already inside `scrollHeight`, which is why the border is added back for `content-box`.
|
|
38
|
+
*
|
|
39
|
+
* @param {HTMLTextAreaElement} element the textarea to manage
|
|
40
|
+
* @return {() => void} detaches the listener and restores the inline height
|
|
41
|
+
* @example
|
|
42
|
+
* ```ts
|
|
43
|
+
* const stop = autosizeTextarea(document.querySelector('textarea')!);
|
|
44
|
+
* // later
|
|
45
|
+
* stop();
|
|
46
|
+
* ```
|
|
47
|
+
*/
|
|
48
|
+
export declare const autosizeTextarea: (element: HTMLTextAreaElement) => (() => void);
|
|
26
49
|
export { Chain, create } from './chain';
|
package/dist/src/utils/file.d.ts
CHANGED
|
@@ -11,10 +11,15 @@
|
|
|
11
11
|
export declare const readFileAsArrayBuffer: (blob: Blob) => Promise<ArrayBuffer>;
|
|
12
12
|
/**
|
|
13
13
|
* @description: Read a File / Blob as a Uint8Array (pair with checkEncoding / arrayBufferToString for encoding sniffing)
|
|
14
|
+
*
|
|
15
|
+
* Typed as `Uint8Array<ArrayBuffer>`, not the default `Uint8Array<ArrayBufferLike>`: a
|
|
16
|
+
* FileReader never yields a SharedArrayBuffer, and the loose form does not satisfy APIs that
|
|
17
|
+
* ask for an ArrayBuffer-backed view, forcing callers into a pointless cast.
|
|
18
|
+
*
|
|
14
19
|
* @param {Blob} blob
|
|
15
|
-
* @return {Promise<Uint8Array
|
|
20
|
+
* @return {Promise<Uint8Array<ArrayBuffer>>}
|
|
16
21
|
*/
|
|
17
|
-
export declare const readFileAsUint8Array: (blob: Blob) => Promise<Uint8Array
|
|
22
|
+
export declare const readFileAsUint8Array: (blob: Blob) => Promise<Uint8Array<ArrayBuffer>>;
|
|
18
23
|
/**
|
|
19
24
|
* @description: Read a File / Blob as text
|
|
20
25
|
* @param {Blob} blob
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as r,r as s,t as a}from"../../../i18n-
|
|
1
|
+
import{n as r,r as s,t as a}from"../../../i18n-D1p8_7wC.js";export{a as I18nCore,r as createI18n,s as useI18n};
|
package/dist/src/utils/i18n.d.ts
CHANGED
|
@@ -1,14 +1,40 @@
|
|
|
1
1
|
export type MessageDict = Record<string, string>;
|
|
2
|
-
|
|
2
|
+
/**
|
|
3
|
+
* "An object whose values are all strings" — the constraint the dictionary type parameter
|
|
4
|
+
* uses, instead of `Record<string, string>`.
|
|
5
|
+
*
|
|
6
|
+
* The difference matters in practice: an `interface Messages { save: string }` does **not**
|
|
7
|
+
* satisfy `Record<string, string>`, because TypeScript only gives implicit index signatures
|
|
8
|
+
* to type aliases, never to interfaces. Constraining that way would have forced every
|
|
9
|
+
* consumer to declare their dictionary as a `type` — and an interface is the natural thing
|
|
10
|
+
* to reach for. This self-referential mapped constraint accepts both.
|
|
11
|
+
*/
|
|
12
|
+
export type StringValues<T> = {
|
|
13
|
+
[K in keyof T]: string;
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* Locale → dictionary. Parameterised by the dictionary shape so an app can hand in its own
|
|
17
|
+
* `interface Messages { … }` and get `t()` checked against it at compile time.
|
|
18
|
+
*/
|
|
19
|
+
export type LocaleMessages<TDict extends StringValues<TDict> = MessageDict> = Record<string, Partial<TDict>>;
|
|
3
20
|
export type TranslateParams = Record<string, string | number>;
|
|
4
21
|
export type LocaleChangeHandler = (locale: string) => void;
|
|
5
|
-
export interface I18nConfig {
|
|
22
|
+
export interface I18nConfig<TDict extends StringValues<TDict> = MessageDict> {
|
|
6
23
|
/** Initial locale. Overridden by a persisted choice when `persist` is on. */
|
|
7
24
|
locale?: string;
|
|
8
25
|
/** Locale used when a key is missing in the active locale. Defaults to 'en'. */
|
|
9
26
|
fallbackLocale?: string;
|
|
10
|
-
/**
|
|
11
|
-
|
|
27
|
+
/**
|
|
28
|
+
* Locale → key → string. Each locale is `Partial`, because a translation in progress is
|
|
29
|
+
* the normal state — the fallback locale covers what a locale has not filled in yet.
|
|
30
|
+
*
|
|
31
|
+
* Wrapped in `NoInfer` so the dictionary type comes from the type argument and is never
|
|
32
|
+
* reverse-engineered from this data. Without it, passing locales with different key sets
|
|
33
|
+
* makes TypeScript infer their *intersection*, and a key that only the fallback locale
|
|
34
|
+
* defines gets rejected at every call site — the incomplete translation would break the
|
|
35
|
+
* build rather than fall back at runtime.
|
|
36
|
+
*/
|
|
37
|
+
messages?: Record<string, Partial<NoInfer<TDict>>>;
|
|
12
38
|
/** Persist the active locale to localStorage. Defaults to false. */
|
|
13
39
|
persist?: boolean;
|
|
14
40
|
/** localStorage key used when `persist` is on. Defaults to 'ran-locale'. */
|
|
@@ -16,23 +42,39 @@ export interface I18nConfig {
|
|
|
16
42
|
/** Seed the initial locale from the browser's language preferences when nothing else applies. */
|
|
17
43
|
detectNavigator?: boolean;
|
|
18
44
|
}
|
|
19
|
-
|
|
45
|
+
/**
|
|
46
|
+
* @description: The engine. Optionally parameterised by your dictionary shape.
|
|
47
|
+
*
|
|
48
|
+
* The default `MessageDict` is `Record<string, string>`, whose `keyof` is `string` — so
|
|
49
|
+
* untyped use keeps working exactly as before. Passing your own interface instead turns every
|
|
50
|
+
* `t()` call into a compile-time check, which is what stops a renamed or mistyped key from
|
|
51
|
+
* degrading silently into "render the key itself" at runtime.
|
|
52
|
+
*
|
|
53
|
+
* @example
|
|
54
|
+
* ```ts
|
|
55
|
+
* interface Messages { save: string; cancel: string }
|
|
56
|
+
* const i18n = createI18n<Messages>({ messages: { en: { save: 'Save', cancel: 'Cancel' } } });
|
|
57
|
+
* i18n.t('save'); // ok
|
|
58
|
+
* i18n.t('saev'); // compile error, instead of rendering "saev" to the user
|
|
59
|
+
* ```
|
|
60
|
+
*/
|
|
61
|
+
export declare class I18nCore<TDict extends StringValues<TDict> = MessageDict> {
|
|
20
62
|
private _locale;
|
|
21
63
|
private _fallback;
|
|
22
64
|
private _messages;
|
|
23
65
|
private _persist;
|
|
24
66
|
private _storageKey;
|
|
25
67
|
private _handlers;
|
|
26
|
-
constructor(config?: I18nConfig);
|
|
68
|
+
constructor(config?: I18nConfig<TDict>);
|
|
27
69
|
private _resolveInitialLocale;
|
|
28
70
|
/** The active locale. */
|
|
29
71
|
get locale(): string;
|
|
30
72
|
getLocale(): string;
|
|
31
73
|
/** Switch locale; persists (when enabled) and notifies subscribers. No-op if unchanged. */
|
|
32
74
|
setLocale(locale: string): void;
|
|
33
|
-
/** Merge a dictionary into a locale (creating it if needed). */
|
|
34
|
-
addMessages(locale: string, dict:
|
|
35
|
-
getMessages(locale?: string):
|
|
75
|
+
/** Merge a dictionary into a locale (creating it if needed). Partial, so a locale can be filled in lazily. */
|
|
76
|
+
addMessages(locale: string, dict: Partial<NoInfer<TDict>>): void;
|
|
77
|
+
getMessages(locale?: string): Partial<TDict>;
|
|
36
78
|
/** Locales that have a dictionary registered. */
|
|
37
79
|
get availableLocales(): string[];
|
|
38
80
|
/**
|
|
@@ -40,7 +82,7 @@ export declare class I18nCore {
|
|
|
40
82
|
* locale and finally the key itself. `{param}` placeholders are interpolated;
|
|
41
83
|
* `{{` / `}}` are escapes for literal `{` / `}` (see {@link I18nCore._interpolate}).
|
|
42
84
|
*/
|
|
43
|
-
t(key: string, params?: TranslateParams): string;
|
|
85
|
+
t(key: keyof TDict & string, params?: TranslateParams): string;
|
|
44
86
|
/**
|
|
45
87
|
* Substitute `{param}` placeholders and unescape literal braces.
|
|
46
88
|
*
|
|
@@ -63,7 +105,15 @@ export declare class I18nCore {
|
|
|
63
105
|
/** Remove all subscribers. */
|
|
64
106
|
destroy(): void;
|
|
65
107
|
}
|
|
66
|
-
/**
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
108
|
+
/**
|
|
109
|
+
* @description: Create and register the global i18n singleton.
|
|
110
|
+
* @param {I18nConfig<TDict>} config
|
|
111
|
+
* @return {I18nCore<TDict>}
|
|
112
|
+
*/
|
|
113
|
+
export declare function createI18n<TDict extends StringValues<TDict> = MessageDict>(config?: I18nConfig<TDict>): I18nCore<TDict>;
|
|
114
|
+
/**
|
|
115
|
+
* @description: The active global instance, or null when none was created. Pass the same
|
|
116
|
+
* dictionary type you gave `createI18n` to keep `t()` checked.
|
|
117
|
+
* @return {I18nCore<TDict> | null}
|
|
118
|
+
*/
|
|
119
|
+
export declare function useI18n<TDict extends StringValues<TDict> = MessageDict>(): I18nCore<TDict> | null;
|
package/dist/src/utils/idb.d.ts
CHANGED
|
@@ -132,6 +132,46 @@ export declare class WebDB {
|
|
|
132
132
|
clear: ({ storeName }: {
|
|
133
133
|
storeName: string;
|
|
134
134
|
}) => Promise<IDBResult>;
|
|
135
|
+
/**
|
|
136
|
+
* @description: A typed, forgiving handle on one object store. Binds the store name once
|
|
137
|
+
* instead of repeating it at every call, and returns plain values rather than `IDBResult`.
|
|
138
|
+
*
|
|
139
|
+
* **Every method swallows failures** and answers with the empty case (`null` / `[]` /
|
|
140
|
+
* `false` / `0`). That is the right default for the storage most apps put in IndexedDB —
|
|
141
|
+
* reading progress, drafts, caches — where a failed read should degrade the feature, not
|
|
142
|
+
* take down the screen. It is the wrong default when the write *is* the user's action
|
|
143
|
+
* (saving a document, completing a purchase): there, call the `IDBResult` methods above and
|
|
144
|
+
* handle the error.
|
|
145
|
+
*
|
|
146
|
+
* @param {string} name object store name (must be declared in `stores`)
|
|
147
|
+
* @return {IDBCollection<T>}
|
|
148
|
+
* @example
|
|
149
|
+
* ```ts
|
|
150
|
+
* const notes = db.collection<BookNote>('books_notes');
|
|
151
|
+
* await notes.put(note); // false if it failed
|
|
152
|
+
* const all = await notes.all(); // [] if it failed
|
|
153
|
+
* const one = await notes.get(id); // null if missing or failed
|
|
154
|
+
* ```
|
|
155
|
+
*/
|
|
156
|
+
collection: <T = unknown>(name: string) => IDBCollection<T>;
|
|
157
|
+
}
|
|
158
|
+
/** A store name bound once, values unwrapped, failures folded into the empty case */
|
|
159
|
+
export interface IDBCollection<T> {
|
|
160
|
+
readonly name: string;
|
|
161
|
+
/** The record, or `null` when missing or unreadable */
|
|
162
|
+
get: (key: IDBValidKey) => Promise<T | null>;
|
|
163
|
+
/** Every record, or `[]` on failure */
|
|
164
|
+
all: () => Promise<T[]>;
|
|
165
|
+
/** Record count, or `0` on failure */
|
|
166
|
+
count: () => Promise<number>;
|
|
167
|
+
/** Insert; `false` if the key already exists or the write failed */
|
|
168
|
+
add: (value: T) => Promise<boolean>;
|
|
169
|
+
/** Insert or overwrite; `false` on failure */
|
|
170
|
+
put: (value: T) => Promise<boolean>;
|
|
171
|
+
/** Delete one record; `false` on failure */
|
|
172
|
+
remove: (key: IDBValidKey) => Promise<boolean>;
|
|
173
|
+
/** Empty the store; `false` on failure */
|
|
174
|
+
clear: () => Promise<boolean>;
|
|
135
175
|
}
|
|
136
176
|
export interface HandoffOptions {
|
|
137
177
|
/** Database name. Both sides of the handoff must agree on this. */
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { SyncHook } from './subscribe';
|
|
2
2
|
import { Mathjs, addNumSym, mathjs, parseChineseNumber, parseEnglishNumber, parseRomanNumber, perToNum, range, transformNumber } from './number';
|
|
3
|
-
import { MessageCodec, arrayBufferToString, changeHumpToLowerCase, checkEncoding, clearBr, clearStr, getMatchingSentences, getRandomString, isString, md5, randomString, str2Xml, strParse, toFullWidth, toHalfWidth, toString, transformText } from './str';
|
|
4
|
-
import type { TransformText } from './str';
|
|
3
|
+
import { MessageCodec, arrayBufferToString, changeHumpToLowerCase, checkEncoding, clearBr, clearStr, getMatchingSentences, getRandomString, isString, md5, randomString, str2Xml, strParse, toFullWidth, toHalfWidth, toString, transformText, truncate } from './str';
|
|
4
|
+
import type { TransformText, TruncateOptions, TruncatePosition } from './str';
|
|
5
|
+
import { createSpeechRecognizer, isSpeechRecognitionSupported } from './speech';
|
|
6
|
+
import type { SpeechError, SpeechErrorKind, SpeechRecognizer, SpeechRecognizerOptions } from './speech';
|
|
5
7
|
import { appendUrl, connection, createObjectURL, durationHandler, encodeUrl, getAllQueryString, getCookie, getCookieByName, getFrame, getPixelRatio, getQuery, getWindow, imageRequest, isInIframe, isSafari, networkSpeed, queryFlag, removeGhosting, requestUrlToBuffer, retain } from './bom';
|
|
6
8
|
import { BRIDGE_MARKER, BridgeManager, Client, DEFAULT_CHANNEL, Platform, PostMessageBridge, acceptPortBridge, bridgeManager, createPortBridge, openPortBridge } from './bridge';
|
|
7
9
|
import type { AcceptPortBridgeOptions, BridgeManagerOptions, BroadcastPayload, CallToPayload, MessageData, MessageHandler, OpenPortBridgeOptions, PendingRequest, PortBridge } from './bridge';
|
|
@@ -17,7 +19,7 @@ import { compose } from './compose';
|
|
|
17
19
|
import { handleConsole } from './console';
|
|
18
20
|
import { debounce } from './debounce';
|
|
19
21
|
import type { Debounced } from './debounce';
|
|
20
|
-
import { Chain, addClassToElement, create, createDocumentFragment, escapeHtml, removeClassToElement, setFontSize2html } from './dom';
|
|
22
|
+
import { Chain, addClassToElement, autosizeTextarea, create, createDocumentFragment, escapeHtml, removeClassToElement, setFontSize2html } from './dom';
|
|
21
23
|
import { handleError } from './error';
|
|
22
24
|
import { EventManager } from './event';
|
|
23
25
|
import { circ, cubic, expo, quad, quart, quint, sine } from './tween';
|
|
@@ -29,18 +31,20 @@ import { ADOPTED_SHEET_MARKER, ADOPTED_STYLE_MARKER, adoptSheetText, adoptStyles
|
|
|
29
31
|
import { memoize, once, singleFlight } from './memoize';
|
|
30
32
|
import type { SingleFlight } from './memoize';
|
|
31
33
|
import { WebDB, createHandoff } from './idb';
|
|
32
|
-
import type { Handoff, HandoffOptions, IDBResult, IDBStoreSchema, WebDBOptions } from './idb';
|
|
34
|
+
import type { Handoff, HandoffOptions, IDBCollection, IDBResult, IDBStoreSchema, WebDBOptions } from './idb';
|
|
33
35
|
import { buildOffsets, indexForOffset, segmentByRanges } from './segment';
|
|
36
|
+
import { paginateText } from './paginate';
|
|
37
|
+
import type { PaginateOptions, PaginateResult, TextBox, TextGridMetrics, TextPage } from './paginate';
|
|
34
38
|
import type { OffsetRange, Segment } from './segment';
|
|
35
39
|
import { detectLanguage, navigatorLanguage, resolveLocale } from './lang';
|
|
36
40
|
import { I18nCore, createI18n, useI18n } from './i18n';
|
|
37
|
-
import type { I18nConfig, LocaleChangeHandler, LocaleMessages, MessageDict, TranslateParams } from './i18n';
|
|
41
|
+
import type { I18nConfig, LocaleChangeHandler, LocaleMessages, MessageDict, StringValues, TranslateParams } from './i18n';
|
|
38
42
|
import { createLocalePath } from './localePath';
|
|
39
43
|
import type { LocalePath, LocalePathConfig, LocaleRoute } from './localePath';
|
|
40
44
|
import type { ResolveLocaleOptions, TextLanguage } from './lang';
|
|
41
45
|
import { readFileAsArrayBuffer, readFileAsDataURL, readFileAsText, readFileAsUint8Array } from './file';
|
|
42
|
-
import { WorkerClient } from './worker';
|
|
43
|
-
import type { WorkerClientOptions, WorkerResponseBase } from './worker';
|
|
46
|
+
import { WorkerClient, serveWorker } from './worker';
|
|
47
|
+
import type { ServeWorkerOptions, WorkerClientOptions, WorkerHandlerContext, WorkerRequestBase, WorkerResponseBase } from './worker';
|
|
44
48
|
import { isUrlCached, networkAllowsDownload, prefetchUrl, prefetchUrls, prefetchWhenIdle, whenIdle } from './prefetch';
|
|
45
49
|
import type { NetworkAllowanceOptions, PrefetchOptions, WhenIdleOptions } from './prefetch';
|
|
46
50
|
import { TimeoutError, deferred, delay, withTimeout, withTimeoutFallback } from './async';
|
|
@@ -59,9 +63,10 @@ import { loadScript, scriptOnLoad } from './script';
|
|
|
59
63
|
import type { LoadScriptOptions } from './script';
|
|
60
64
|
import { throttle } from './throttle';
|
|
61
65
|
import type { Throttled } from './throttle';
|
|
62
|
-
import { formatDate, performanceTime, timeFormat, timestampToTime } from './time';
|
|
66
|
+
import { formatDate, formatDuration, formatRelative, performanceTime, timeFormat, timestampToTime } from './time';
|
|
67
|
+
import type { DateInput, FormatRelativeOptions, RelativeStyle } from './time';
|
|
63
68
|
import type { CurrentDevice } from './device';
|
|
64
69
|
import { MOBILE_MEDIA_QUERY, currentDevice, isBangDevice, isClient, isMobile, isWeiXin, matchMediaQuery, watchMediaQuery } from './device';
|
|
65
70
|
import { Color, ColorScheme, FMT, HEX_COLOR_REGEX, Hsl, Hsla, RGBA_REGEX, RGB_REGEX, Rgb, Rgba, componentToHex, hexToAlpha, hexToHsb, hexToHsv, hexToRgb, hsbToHsl, hsbToRgb, hslToHsb, hslToHsv, hslToRgb, hsvToHsl, hsvToRgb, hue2rgb, randomColor, rgbToHex, rgbToHsb, rgbToHsl, rgbToHsv, rgbaString, rgbaToHex, rgbaToRgb } from '@/utils/color';
|
|
66
|
-
export { performanceTime, timeFormat, timestampToTime, throttle, SyncHook, changeHumpToLowerCase, clearBr, clearStr, isString, randomString, str2Xml, strParse, scriptOnLoad, handleFetchHook, createData, report, QuestQueue, noop, getPerformance, querystring, formatJson, filterObj, merge, replaceOld, mergeExports, perToNum, range, Mathjs, mathjs, getStatus, status, Monitor, MimeType, getExtensions, setMime, getMime, memoize, once, isImageSize, convertImageToBase64, handleError, addClassToElement, removeClassToElement, createDocumentFragment, escapeHtml, isClient, isWeiXin, isMobile, debounce, currentDevice, handleConsole, compose, Color, FMT, Hsl, Hsla, Rgb, Rgba, randomColor, hexToRgb, componentToHex, rgbToHex, rgbToHsl, hue2rgb, hslToRgb, rgbToHsb, hsbToRgb, hsvToRgb, hsvToHsl, ColorScheme, AudioRecorder, webglVendor, canvasVendor, audioVendor, retain, getCookie, requestUrlToBuffer, getPixelRatio, createObjectURL, getFrame, getAllQueryString, queryFlag, isInIframe, appendUrl, removeGhosting, getCookieByName, getWindow, connection, encodeUrl, imageRequest, durationHandler, networkSpeed, TOTP, isBangDevice, localStorageGetItem, localStorageSetItem, localStorageRemoveItem, createStore, setAttributeByGlobal, setFontSize2html, Chain, create, isEqual, cloneDeep, createSignal, subscribers, getMatchingSentences, transformNumber, toString, addNumSym, getQuery, checkEncoding, transformText, isSafari, md5, getRandomString, bridgeManager, Client, BridgeManager, PostMessageBridge, MessageCodec, Platform, openPortBridge, acceptPortBridge, createPortBridge, BRIDGE_MARKER, DEFAULT_CHANNEL, singleFlight, WebDB, createHandoff, buildOffsets, indexForOffset, segmentByRanges, detectLanguage, navigatorLanguage, resolveLocale, readFileAsArrayBuffer, readFileAsUint8Array, readFileAsText, readFileAsDataURL, WorkerClient, whenIdle, networkAllowsDownload, isUrlCached, prefetchUrl, prefetchUrls, prefetchWhenIdle, deferred, withTimeout, withTimeoutFallback, delay, TimeoutError, crc32, inflateRaw, readZipEntries, readZipEntry, zipHasEntry, rewriteZip, createZip, ZIP_STORED, ZIP_DEFLATE, arrayBufferToString, toHalfWidth, toFullWidth, parseChineseNumber, parseRomanNumber, parseEnglishNumber, MOBILE_MEDIA_QUERY, matchMediaQuery, watchMediaQuery, createLocalePath, setReportUrl, getReportUrl, formatDate, handleXhrHook, EventManager, quad, cubic, quart, quint, sine, expo, circ, getImage, cutRound, opacity, getMatrix, getAngle, getArcPointerByDeg, getTangentByPointer, fanShapedByArc, roundRectByArc, getLinearGradient, adoptStyles, adoptSheetText, ADOPTED_STYLE_MARKER, ADOPTED_SHEET_MARKER, rgbToHsv, hexToHsb, hexToHsv, hsbToHsl, hslToHsb, hslToHsv, hexToAlpha, rgbaString, rgbaToRgb, rgbaToHex, HEX_COLOR_REGEX, RGB_REGEX, RGBA_REGEX, loadScript, I18nCore, createI18n, useI18n, };
|
|
67
|
-
export type { EasingFn, SpeedType, ImgSource, LoadScriptOptions, I18nConfig, MessageDict, LocaleMessages, TranslateParams, LocaleChangeHandler, Debounced, Throttled, BeaconPayload, ReportConfig, LocalePath, LocalePathConfig, LocaleRoute, SingleFlight, IDBResult, IDBStoreSchema, WebDBOptions, Handoff, HandoffOptions, JsonStore, Deferred, ZipEntry, RewriteZipOptions, ResolveLocaleOptions, OffsetRange, Segment, TextLanguage, WorkerClientOptions, WorkerResponseBase, WhenIdleOptions, NetworkAllowanceOptions, PrefetchOptions, CurrentDevice, TransformText, MessageHandler, MessageData, PendingRequest, BridgeManagerOptions, BroadcastPayload, CallToPayload, PortBridge, OpenPortBridgeOptions, AcceptPortBridgeOptions, };
|
|
71
|
+
export { performanceTime, timeFormat, timestampToTime, throttle, SyncHook, changeHumpToLowerCase, clearBr, clearStr, isString, randomString, str2Xml, strParse, scriptOnLoad, handleFetchHook, createData, report, QuestQueue, noop, getPerformance, querystring, formatJson, filterObj, merge, replaceOld, mergeExports, perToNum, range, Mathjs, mathjs, getStatus, status, Monitor, MimeType, getExtensions, setMime, getMime, memoize, once, isImageSize, convertImageToBase64, handleError, addClassToElement, removeClassToElement, createDocumentFragment, escapeHtml, isClient, isWeiXin, isMobile, debounce, currentDevice, handleConsole, compose, Color, FMT, Hsl, Hsla, Rgb, Rgba, randomColor, hexToRgb, componentToHex, rgbToHex, rgbToHsl, hue2rgb, hslToRgb, rgbToHsb, hsbToRgb, hsvToRgb, hsvToHsl, ColorScheme, AudioRecorder, webglVendor, canvasVendor, audioVendor, retain, getCookie, requestUrlToBuffer, getPixelRatio, createObjectURL, getFrame, getAllQueryString, queryFlag, isInIframe, appendUrl, removeGhosting, getCookieByName, getWindow, connection, encodeUrl, imageRequest, durationHandler, networkSpeed, TOTP, isBangDevice, localStorageGetItem, localStorageSetItem, localStorageRemoveItem, createStore, setAttributeByGlobal, setFontSize2html, autosizeTextarea, createSpeechRecognizer, isSpeechRecognitionSupported, Chain, create, isEqual, cloneDeep, createSignal, subscribers, getMatchingSentences, transformNumber, toString, addNumSym, getQuery, checkEncoding, transformText, isSafari, md5, getRandomString, bridgeManager, Client, BridgeManager, PostMessageBridge, MessageCodec, Platform, openPortBridge, acceptPortBridge, createPortBridge, BRIDGE_MARKER, DEFAULT_CHANNEL, singleFlight, WebDB, createHandoff, buildOffsets, paginateText, indexForOffset, segmentByRanges, detectLanguage, navigatorLanguage, resolveLocale, readFileAsArrayBuffer, readFileAsUint8Array, readFileAsText, readFileAsDataURL, WorkerClient, serveWorker, whenIdle, networkAllowsDownload, isUrlCached, prefetchUrl, prefetchUrls, prefetchWhenIdle, deferred, withTimeout, withTimeoutFallback, delay, TimeoutError, crc32, inflateRaw, readZipEntries, readZipEntry, zipHasEntry, rewriteZip, createZip, ZIP_STORED, ZIP_DEFLATE, arrayBufferToString, toHalfWidth, toFullWidth, truncate, parseChineseNumber, parseRomanNumber, parseEnglishNumber, MOBILE_MEDIA_QUERY, matchMediaQuery, watchMediaQuery, createLocalePath, setReportUrl, getReportUrl, formatDate, formatDuration, formatRelative, handleXhrHook, EventManager, quad, cubic, quart, quint, sine, expo, circ, getImage, cutRound, opacity, getMatrix, getAngle, getArcPointerByDeg, getTangentByPointer, fanShapedByArc, roundRectByArc, getLinearGradient, adoptStyles, adoptSheetText, ADOPTED_STYLE_MARKER, ADOPTED_SHEET_MARKER, rgbToHsv, hexToHsb, hexToHsv, hsbToHsl, hslToHsb, hslToHsv, hexToAlpha, rgbaString, rgbaToRgb, rgbaToHex, HEX_COLOR_REGEX, RGB_REGEX, RGBA_REGEX, loadScript, I18nCore, createI18n, useI18n, };
|
|
72
|
+
export type { DateInput, FormatRelativeOptions, RelativeStyle, TruncateOptions, TruncatePosition, SpeechError, SpeechErrorKind, SpeechRecognizer, SpeechRecognizerOptions, EasingFn, SpeedType, ImgSource, LoadScriptOptions, I18nConfig, MessageDict, StringValues, LocaleMessages, TranslateParams, LocaleChangeHandler, Debounced, Throttled, BeaconPayload, ReportConfig, LocalePath, LocalePathConfig, LocaleRoute, SingleFlight, IDBCollection, IDBResult, IDBStoreSchema, WebDBOptions, Handoff, HandoffOptions, JsonStore, Deferred, ZipEntry, RewriteZipOptions, ResolveLocaleOptions, OffsetRange, PaginateOptions, PaginateResult, TextBox, TextGridMetrics, TextPage, Segment, TextLanguage, ServeWorkerOptions, WorkerClientOptions, WorkerHandlerContext, WorkerRequestBase, WorkerResponseBase, WhenIdleOptions, NetworkAllowanceOptions, PrefetchOptions, CurrentDevice, TransformText, MessageHandler, MessageData, PendingRequest, BridgeManagerOptions, BroadcastPayload, CallToPayload, PortBridge, OpenPortBridgeOptions, AcceptPortBridgeOptions, };
|
package/dist/src/utils/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as s}from"../../enums-BAgbyGdH.js";import{
|
|
1
|
+
import{i as s}from"../../enums-BAgbyGdH.js";import{$ as a,A as t,B as n,C as o,D as r,E as m,F as i,G as p,H as f,I as j,J as c,K as l,L as u,M as d,N as h,O as x,P as b,Q as e,R as g,S as k,T as v,U as w,V as y,W as z,X as A,Y as B,Z as C,_ as D,a as E,b as F,c as G,d as H,f as I,g as K,h as L,i as M,j as N,k as O,l as P,m as R,n as S,o as T,p as U,q as V,r as W,s as _,t as q,u as J,v as Q,w as X,x as Y,y as Z,z as $}from"../../color-Bh_QUad2.js";import{$ as ss,$t as as,A as ts,At as ns,B as os,Bt as rs,C as ms,Ct as is,D as ps,Dt as fs,E as js,Et as cs,F as ls,Ft as us,G as ds,Gt as hs,H as xs,Ht as bs,I as es,It as gs,J as ks,Jt as vs,K as ws,Kt as ys,L as zs,Lt as As,M as Bs,Mt as Cs,N as Ds,Nt as Es,O as Fs,Ot as Gs,P as Hs,Pt as Is,Q as Ks,Qt as Ls,R as Ms,Rt as Ns,S as Os,St as Ps,T as Rs,Tt as Ss,U as Ts,Ut as Us,V as Vs,Vt as Ws,W as _s,Wt as qs,X as Js,Xt as Qs,Y as Xs,Yt as Ys,Z as Zs,Zt as $s,_ as sa,_t as aa,a as ta,an as na,at as oa,b as ra,bt as ma,c as ia,cn as pa,ct as fa,d as ja,dn as ca,dt as la,en as ua,et as da,f as ha,fn as xa,ft as ba,g as ea,gt as ga,h as ka,ht as va,i as wa,in as ya,it as za,j as Aa,jt as Ba,k as Ca,kt as Da,l as Ea,ln as Fa,lt as Ga,m as Ha,mt as Ia,n as Ka,nn as La,nt as Ma,o as Na,on as Oa,ot as Pa,p as Ra,pn as Sa,pt as Ta,q as Ua,qt as Va,r as Wa,rn as _a,rt as qa,s as Ja,sn as Qa,st as Xa,t as Ya,tn as Za,tt as $a,u as st,un as at,ut as tt,v as nt,vt as ot,w as rt,wt as mt,x as it,xt as pt,y as ft,yt as jt,z as ct,zt as lt}from"../../utils-vTF6lLZZ.js";import{A as ut,B as dt,C as ht,D as xt,E as bt,F as et,G as gt,H as kt,I as vt,K as wt,L as yt,M as zt,N as At,O as Bt,P as Ct,R as Dt,S as Et,T as Ft,U as Gt,V as Ht,W as It,_ as Kt,a as Lt,b as Mt,c as Nt,d as Ot,f as Pt,g as Rt,h as St,i as Tt,k as Ut,l as Vt,m as Wt,n as _t,o as qt,p as Jt,r as Qt,s as Xt,t as Yt,u as Zt,v as $t,w as sn,x as an,y as tn,z as nn}from"../../i18n-D1p8_7wC.js";import{n as on,t as rn}from"../../chain-CTywmh_H.js";export{ks as ADOPTED_SHEET_MARKER,Xs as ADOPTED_STYLE_MARKER,Is as AudioRecorder,Va as BRIDGE_MARKER,vs as BridgeManager,rn as Chain,Ys as Client,q as Color,S as ColorScheme,Qs as DEFAULT_CHANNEL,aa as EventManager,W as FMT,M as HEX_COLOR_REGEX,E as Hsl,T as Hsla,Yt as I18nCore,zt as MOBILE_MEDIA_QUERY,na as Mathjs,j as MessageCodec,d as MimeType,Na as Monitor,$s as Platform,Ls as PostMessageBridge,Wa as QuestQueue,_ as RGBA_REGEX,G as RGB_REGEX,P as Rgb,J as Rgba,s as SyncHook,Gs as TOTP,rt as TimeoutError,ws as WebDB,ls as WorkerClient,ka as ZIP_DEFLATE,ea as ZIP_STORED,as as acceptPortBridge,jt as addClassToElement,Oa as addNumSym,Js as adoptSheetText,Zs as adoptStyles,Ot as appendUrl,u as arrayBufferToString,Da as audioVendor,ma as autosizeTextarea,ua as bridgeManager,Ts as buildOffsets,ns as canvasVendor,g as changeHumpToLowerCase,$ as checkEncoding,tt as circ,n as clearBr,y as clearStr,us as cloneDeep,H as componentToHex,fs as compose,Pt as connection,Ks as convertImageToBase64,sa as crc32,on as create,st as createData,pt as createDocumentFragment,Ua as createHandoff,_t as createI18n,Vs as createLocalePath,Jt as createObjectURL,Za as createPortBridge,Cs as createSignal,_a as createSpeechRecognizer,Xt as createStore,nt as createZip,la as cubic,At as currentDevice,ss as cutRound,Ss as debounce,Rs as deferred,js as delay,Tt as detectLanguage,Wt as durationHandler,St as encodeUrl,Ps as escapeHtml,ba as expo,za as fanShapedByArc,gs as filterObj,dt as formatDate,Ht as formatDuration,As as formatJson,kt as formatRelative,Rt as getAllQueryString,oa as getAngle,Pa as getArcPointerByDeg,Kt as getCookie,$t as getCookieByName,h as getExtensions,tn as getFrame,da as getImage,Xa as getLinearGradient,f as getMatchingSentences,$a as getMatrix,b as getMime,Ha as getPerformance,Mt as getPixelRatio,an as getQuery,w as getRandomString,ja as getReportUrl,wa as getStatus,fa as getTangentByPointer,Et as getWindow,cs as handleConsole,ot as handleError,ia as handleFetchHook,Ea as handleXhrHook,I as hexToAlpha,U as hexToHsb,R as hexToHsv,L as hexToRgb,K as hsbToHsl,D as hsbToRgb,Q as hslToHsb,Z as hslToHsv,F as hslToRgb,Y as hsvToHsl,k as hsvToRgb,o as hue2rgb,ht as imageRequest,_s as indexForOffset,ft as inflateRaw,Ct as isBangDevice,et as isClient,Ns as isEqual,Ma as isImageSize,sn as isInIframe,vt as isMobile,Ft as isSafari,ya as isSpeechRecognitionSupported,z as isString,Ca as isUrlCached,yt as isWeiXin,Ya as loadScript,Nt as localStorageGetItem,Vt as localStorageRemoveItem,Zt as localStorageSetItem,Dt as matchMediaQuery,Qa as mathjs,p as md5,qs as memoize,lt as merge,rs as mergeExports,Lt as navigatorLanguage,ts as networkAllowsDownload,bt as networkSpeed,wt as noop,hs as once,qa as opacity,La as openPortBridge,xs as paginateText,pa as parseChineseNumber,Fa as parseEnglishNumber,at as parseRomanNumber,ca as perToNum,Gt as performanceTime,Aa as prefetchUrl,Bs as prefetchUrls,Ds as prefetchWhenIdle,Ta as quad,Ia as quart,xt as queryFlag,Ws as querystring,va as quint,X as randomColor,l as randomString,xa as range,zs as readFileAsArrayBuffer,Ms as readFileAsDataURL,ct as readFileAsText,os as readFileAsUint8Array,ra as readZipEntries,it as readZipEntry,is as removeClassToElement,Bt as removeGhosting,bs as replaceOld,ha as report,Ut as requestUrlToBuffer,qt as resolveLocale,ut as retain,Os as rewriteZip,v as rgbToHex,m as rgbToHsb,r as rgbToHsl,x as rgbToHsv,O as rgbaString,t as rgbaToHex,N as rgbaToRgb,Ga as roundRectByArc,Ka as scriptOnLoad,ds as segmentByRanges,es as serveWorker,Us as setAttributeByGlobal,mt as setFontSize2html,i as setMime,Ra as setReportUrl,ga as sine,ys as singleFlight,ta as status,V as str2Xml,c as strParse,Es as subscribers,Ja as throttle,It as timeFormat,gt as timestampToTime,B as toFullWidth,A as toHalfWidth,C as toString,Sa as transformNumber,e as transformText,a as truncate,Qt as useI18n,nn as watchMediaQuery,Ba as webglVendor,Hs as whenIdle,ps as withTimeout,Fs as withTimeoutFallback,ms as zipHasEntry};
|