@wener/utils 1.1.8 → 1.1.9
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/dist/LICENSE.txt +1 -0
- package/dist/cjs/index.cjs +1 -1
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/cjs/server.cjs +1 -1
- package/dist/cjs/server.cjs.map +1 -1
- package/dist/esm/index.js +1 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/server.js +1 -1
- package/dist/esm/server.js.map +1 -1
- package/dist/system/index.js +1 -1
- package/dist/system/index.js.map +1 -1
- package/dist/system/server.js +1 -1
- package/dist/system/server.js.map +1 -1
- package/lib/asyncs/createLazyPromise.js +3 -1
- package/lib/asyncs/createLazyPromise.js.map +1 -1
- package/lib/crypto/getRandomValues.js +2 -12
- package/lib/crypto/getRandomValues.js.map +1 -1
- package/lib/crypto/randomUUID.js +1 -1
- package/lib/crypto/randomUUID.js.map +1 -1
- package/lib/crypto/ulid.js +3 -3
- package/lib/crypto/ulid.js.map +1 -1
- package/lib/index.js +3 -1
- package/lib/index.js.map +1 -1
- package/lib/logging/createChildLogger.js +2 -2
- package/lib/logging/createChildLogger.js.map +1 -1
- package/lib/logging/createLogger.js +26 -0
- package/lib/logging/createLogger.js.map +1 -0
- package/lib/server/polyfillFetch.js +17 -24
- package/lib/server/polyfillFetch.js.map +1 -1
- package/lib/validations/parseBoolean.js +31 -0
- package/lib/validations/parseBoolean.js.map +1 -0
- package/lib/validations/parseTimestamp.js +25 -0
- package/lib/validations/parseTimestamp.js.map +1 -0
- package/package.json +5 -8
- package/src/asyncs/createLazyPromise.ts +2 -1
- package/src/asyncs/isThenable.ts +4 -0
- package/src/crypto/getRandomValues.ts +13 -11
- package/src/crypto/randomUUID.ts +1 -1
- package/src/crypto/ulid.test.ts +11 -3
- package/src/crypto/ulid.ts +5 -4
- package/src/index.ts +5 -1
- package/src/logging/createChildLogger.ts +2 -2
- package/src/logging/{createWriteLogger.ts → createLogger.ts} +19 -3
- package/src/logging/logger.test.ts +5 -3
- package/src/server/polyfillBrowser.test.ts +5 -1
- package/src/server/polyfillFetch.ts +22 -24
- package/src/validations/parseBoolean.ts +30 -0
- package/src/validations/parseTimestamp.test.ts +7 -0
- package/src/validations/parseTimestamp.ts +29 -0
- package/lib/logging/createWriteLogger.js +0 -13
- package/lib/logging/createWriteLogger.js.map +0 -1
package/dist/esm/server.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
async function
|
|
1
|
+
async function p(){return"crypto"in globalThis?!1:(globalThis.crypto=(await import("node:crypto")).webcrypto,!0)}function u(s){if("fetch"in globalThis)return!1;if(s){const{default:n,Response:a,Headers:l,Request:c,AbortError:f,FetchError:e,FormData:o,Blob:i,File:t}=s;return Object.assign(globalThis,{fetch:n,Response:a,Headers:l,Request:c,AbortError:f,FetchError:e,FormData:o,Blob:i,File:t}),!0}return import("node-fetch").then(n=>u(n))}async function y(){if(typeof window<"u")return!1;const{ResourceLoader:s,JSDOM:n}=await import("jsdom");class a{constructor(o={}){const{proxy:i,strictSSL:t,userAgent:r,...b}=o,w=new s({proxy:i,strictSSL:t,userAgent:r});return new n("",Object.assign(b,{resources:w})).window}}const l={},c=(()=>Object.getOwnPropertyNames(new a(l)).filter(e=>typeof globalThis[e]<"u"))();function f(...e){const o=e.filter(r=>Array.isArray(r))[0],i=e.filter(r=>!Array.isArray(r))[0],t=new a(Object.assign({},i,l));return Object.getOwnPropertyNames(t).filter(r=>!c.includes(r)).filter(r=>!(o&&o.indexOf(r)===-1)).filter(r=>{switch(r){case"undefined":return!1}return!0}).forEach(r=>{Object.defineProperty(globalThis,r,{configurable:!0,get:()=>t[r]})}),t}return f({url:"http://localhost"}),!0}async function h(){await p(),await u(),await y()}export{h as polyfillBrowser,p as polyfillCrypto,u as polyfillFetch,y as polyfillJsDom};
|
|
2
2
|
//# sourceMappingURL=server.js.map
|
package/dist/esm/server.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.js","sources":["../../src/server/polyfillCrypto.ts","../../src/server/polyfillFetch.ts","../../src/server/polyfillJsDom.ts","../../src/server/polyfillBrowser.ts"],"sourcesContent":["export async function polyfillCrypto() {\n if ('crypto' in globalThis) {\n return false;\n }\n globalThis.crypto = (await import('node:crypto')).webcrypto as Crypto;\n return true;\n}\n","export async function polyfillFetch() {\n if ('fetch' in globalThis) {\n return false;\n }\n const {\n default: fetch,\n Response,\n Headers,\n Request,\n AbortError,\n FetchError,\n FormData,\n Blob,\n File,\n } = await import('node-fetch');\n Object.assign(globalThis, {\n fetch,\n Response,\n Headers,\n Request,\n AbortError,\n FetchError,\n FormData,\n Blob,\n File,\n });\n return true;\n}\n","import type { ConstructorOptions, ResourceLoaderConstructorOptions } from 'jsdom';\n\nexport async function polyfillJsDom() {\n if (typeof window !== 'undefined') {\n return false;\n }\n\n const { ResourceLoader, JSDOM } = await import('jsdom');\n\n // https://github.com/lukechilds/window/blob/master/src/index.js\n // eslint-disable-next-line @typescript-eslint/no-extraneous-class\n class Window {\n constructor(opts: ResourceLoaderConstructorOptions & ConstructorOptions = {}) {\n const { proxy, strictSSL, userAgent, ...jsdomOpts } = opts;\n const resources = new ResourceLoader({\n proxy,\n strictSSL,\n userAgent,\n });\n return new JSDOM(\n '',\n Object.assign(jsdomOpts, {\n resources,\n }),\n ).window;\n }\n }\n\n // https://github.com/lukechilds/browser-env/blob/master/src/index.js\n // Default jsdom config.\n // These settings must override any custom settings to make sure we can iterate\n // over the window object.\n const defaultJsdomConfig = {\n // features: {\n // FetchExternalResources: false,\n // ProcessExternalResources: false,\n // },\n };\n // IIFE executed on import to return an array of global Node.js properties that\n // conflict with global browser properties.\n const protectedProperties = (() =>\n Object.getOwnPropertyNames(new Window(defaultJsdomConfig)).filter(\n (prop) => typeof globalThis[prop as keyof typeof globalThis] !== 'undefined',\n ))();\n\n function installEnv(...args: any[]) {\n // Sets up global browser environment\n // Extract options from args\n const properties = args.filter((arg: any) => Array.isArray(arg))[0];\n const userJsdomConfig = args.filter((arg: any) => !Array.isArray(arg))[0];\n\n // Create window object\n const window = new Window(Object.assign({}, userJsdomConfig, defaultJsdomConfig));\n\n // Get all global browser properties\n Object.getOwnPropertyNames(window)\n\n // Remove protected properties\n .filter((prop) => !protectedProperties.includes(prop))\n\n // If we're only applying specific required properties remove everything else\n .filter((prop) => !(properties && properties.indexOf(prop) === -1))\n .filter((prop) => {\n switch (prop) {\n case 'undefined':\n return false;\n }\n return true;\n })\n\n // Copy what's left to the Node.js global scope\n .forEach((prop) => {\n // console.debug(`define globalThis.${prop}`);\n Object.defineProperty(globalThis, prop, {\n configurable: true,\n get: () => window[prop as keyof Window] as any,\n });\n });\n\n return window;\n }\n\n installEnv({ url: 'http://localhost' });\n return true;\n}\n","import { polyfillCrypto } from './polyfillCrypto';\nimport { polyfillFetch } from './polyfillFetch';\nimport { polyfillJsDom } from './polyfillJsDom';\n\n/**\n * Polyfills the browser environment with the necessary APIs for the server.\n * Currently, this includes:\n * - `window`\n * - `document`\n * - `fetch`\n * - `crypto`\n */\nexport async function polyfillBrowser() {\n await polyfillCrypto();\n await polyfillFetch();\n await polyfillJsDom();\n}\n"],"names":["polyfillCrypto","polyfillFetch","fetch","Response","Headers","Request","AbortError","FetchError","FormData","Blob","File","polyfillJsDom","ResourceLoader","JSDOM","Window","opts","proxy","strictSSL","userAgent","jsdomOpts","resources","defaultJsdomConfig","protectedProperties","prop","installEnv","args","properties","arg","userJsdomConfig","window","polyfillBrowser"],"mappings":"AAAA,eAAsBA,GAAiB,CACrC,MAAI,WAAY,WACP,IAET,WAAW,QAAU,KAAM,QAAO,gBAAgB,UAC3C,GACT,CCNsB,eAAAC,GAAgB,CACpC,GAAI,UAAW,WACb,MAAO,GAET,KAAM,CACJ,QAASC,EACT,SAAAC,EACA,QAAAC,EACA,QAAAC,EACA,WAAAC,EACA,WAAAC,EACA,SAAAC,EACA,KAAAC,EACA,KAAAC,CACF,EAAI,KAAM,QAAO,cACjB,OA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aAAc,GACd,IAAK,IAAMM,EAAON,EACpB,CAAC,CACH,CAAC,EAEIM,CACT,CAEA,OAAAL,EAAW,CAAE,IAAK,kBAAmB,CAAC,EAC/B,EACT,gBCxEsBM,GAAkB,CACtC,MAAM9B,EAAe,EACrB,MAAMC,EAAc,EACpB,MAAMU,EACR,CAAA"}
|
|
1
|
+
{"version":3,"file":"server.js","sources":["../../src/server/polyfillCrypto.ts","../../src/server/polyfillFetch.ts","../../src/server/polyfillJsDom.ts","../../src/server/polyfillBrowser.ts"],"sourcesContent":["export async function polyfillCrypto() {\n if ('crypto' in globalThis) {\n return false;\n }\n globalThis.crypto = (await import('node:crypto')).webcrypto as Crypto;\n return true;\n}\n","import type { MaybePromise } from '../asyncs/MaybePromise';\n\nexport function polyfillFetch(nodeFetch: typeof import('node-fetch')): boolean;\nexport function polyfillFetch(nodeFetch?: undefined): Promise<boolean>;\nexport function polyfillFetch(nodeFetch?: typeof import('node-fetch')): MaybePromise<boolean> {\n if ('fetch' in globalThis) {\n return false;\n }\n // sync mode\n if (nodeFetch) {\n const { default: fetch, Response, Headers, Request, AbortError, FetchError, FormData, Blob, File } = nodeFetch;\n Object.assign(globalThis, {\n fetch,\n Response,\n Headers,\n Request,\n AbortError,\n FetchError,\n FormData,\n Blob,\n File,\n });\n return true;\n }\n return import('node-fetch').then((v) => polyfillFetch(v));\n}\n","import type { ConstructorOptions, ResourceLoaderConstructorOptions } from 'jsdom';\n\nexport async function polyfillJsDom() {\n if (typeof window !== 'undefined') {\n return false;\n }\n\n const { ResourceLoader, JSDOM } = await import('jsdom');\n\n // https://github.com/lukechilds/window/blob/master/src/index.js\n // eslint-disable-next-line @typescript-eslint/no-extraneous-class\n class Window {\n constructor(opts: ResourceLoaderConstructorOptions & ConstructorOptions = {}) {\n const { proxy, strictSSL, userAgent, ...jsdomOpts } = opts;\n const resources = new ResourceLoader({\n proxy,\n strictSSL,\n userAgent,\n });\n return new JSDOM(\n '',\n Object.assign(jsdomOpts, {\n resources,\n }),\n ).window;\n }\n }\n\n // https://github.com/lukechilds/browser-env/blob/master/src/index.js\n // Default jsdom config.\n // These settings must override any custom settings to make sure we can iterate\n // over the window object.\n const defaultJsdomConfig = {\n // features: {\n // FetchExternalResources: false,\n // ProcessExternalResources: false,\n // },\n };\n // IIFE executed on import to return an array of global Node.js properties that\n // conflict with global browser properties.\n const protectedProperties = (() =>\n Object.getOwnPropertyNames(new Window(defaultJsdomConfig)).filter(\n (prop) => typeof globalThis[prop as keyof typeof globalThis] !== 'undefined',\n ))();\n\n function installEnv(...args: any[]) {\n // Sets up global browser environment\n // Extract options from args\n const properties = args.filter((arg: any) => Array.isArray(arg))[0];\n const userJsdomConfig = args.filter((arg: any) => !Array.isArray(arg))[0];\n\n // Create window object\n const window = new Window(Object.assign({}, userJsdomConfig, defaultJsdomConfig));\n\n // Get all global browser properties\n Object.getOwnPropertyNames(window)\n\n // Remove protected properties\n .filter((prop) => !protectedProperties.includes(prop))\n\n // If we're only applying specific required properties remove everything else\n .filter((prop) => !(properties && properties.indexOf(prop) === -1))\n .filter((prop) => {\n switch (prop) {\n case 'undefined':\n return false;\n }\n return true;\n })\n\n // Copy what's left to the Node.js global scope\n .forEach((prop) => {\n // console.debug(`define globalThis.${prop}`);\n Object.defineProperty(globalThis, prop, {\n configurable: true,\n get: () => window[prop as keyof Window] as any,\n });\n });\n\n return window;\n }\n\n installEnv({ url: 'http://localhost' });\n return true;\n}\n","import { polyfillCrypto } from './polyfillCrypto';\nimport { polyfillFetch } from './polyfillFetch';\nimport { polyfillJsDom } from './polyfillJsDom';\n\n/**\n * Polyfills the browser environment with the necessary APIs for the server.\n * Currently, this includes:\n * - `window`\n * - `document`\n * - `fetch`\n * - `crypto`\n */\nexport async function polyfillBrowser() {\n await polyfillCrypto();\n await polyfillFetch();\n await polyfillJsDom();\n}\n"],"names":["polyfillCrypto","polyfillFetch","nodeFetch","fetch","Response","Headers","Request","AbortError","FetchError","FormData","Blob","File","v","polyfillJsDom","ResourceLoader","JSDOM","Window","opts","proxy","strictSSL","userAgent","jsdomOpts","resources","defaultJsdomConfig","protectedProperties","prop","installEnv","args","properties","arg","userJsdomConfig","window","polyfillBrowser"],"mappings":"AAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAsBA,CAAiB,CAAA,CAAA,CACrC,CAAI,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAY,WACP,CAET,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAW,CAAU,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAM,CAAO,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAgB,CAC3C,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CACT,CCFO,CAASC,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAcC,CAAgE,CAAA,CAC5F,CAAI,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAW,CACb,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAO,GAGT,CAAIA,CAAAA,CAAAA,CAAAA,CAAW,CACb,CAAA,CAAA,CAAA,CAAA,CAAM,CAAE,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAASC,CAAO,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAAC,EAAU,CAAA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AA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA;"}
|
package/dist/system/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
System.register([],function(u,se){"use strict";return{execute:function(){u({arrayOfMaybeArray:fe,camelCase:q,classOf:A,clearAsyncInterval:pe,copy:Re,createChildLogger:Ee,createLazyPromise:ye,createNoopLogger:W,createRandom:nt,createTranslate:$e,createULID:ae,createWriteLogger:$,deepEqual:w,download:Ie,firstOfMaybeArray:R,formatBytes:Se,get:T,getFileFromDataTransfer:Ne,hex:Ke,isBuffer:v,isClass:Ae,isDefined:ve,isEmptyObject:Oe,isModule:Ce,isPlainObject:F,isPromise:he,isTransferable:Pe,isULID:Ye,isUUID:je,lastOfMaybeArray:le,loadScripts:Y,loadStyles:ze,objectOfMaybeArray:ce,parseModuleId:Ue,parseObjectPath:x,parseULID:et,pascalCase:Te,renderTemplate:Z,set:ue,setAsyncInterval:de,sha1:qe,sha256:Ze,sha384:He,sha512:Ge,shallowClone:we,shallowEqual:me,timeout:ge});function ce(e,t=null,r=R){return Object.fromEntries(t===null?Object.entries(e).map(([n,o])=>[n,r(o)]):t.map(n=>[n,r(n)]))}function R(e){return Array.isArray(e)?e[0]:e}function le(e){return Array.isArray(e)?e[e.length-1]:e}function fe(e){return Array.isArray(e)?e:e==null?[]:[e]}function x(e){if(typeof e!="string")return Array.isArray(e)?e:[e];const t=e.split(".");if(!e.includes("["))return t;const r=[];for(const n of t)if(!n.endsWith("]"))r.push(n);else{const o=n.split("[");for(let a of o)a.endsWith("]")&&(a=a.slice(0,-1)),r.push(a)}return r}function T(e,t,r){const n=x(t);let o=e;for(const a of n)o=o?o[a]:void 0;return o===void 0?r:o}function ue(e,t,r,n=!0){const o=x(t);let a=0;const i=o.length;let s=e,l,d;for(;a<i&&(d=o[a++],!(d==="__proto__"||d==="constructor"||d==="prototype"));)s=s[d]=a===i?n?S(s[d],r):r:typeof(l=s[d])==typeof o?l:o[a]*0!==0||!!~(""+o[a]).indexOf(".")?{}:[]}function S(e,t){let r;if(typeof e=="object"&&typeof t=="object"){if(Array.isArray(e)&&Array.isArray(t))for(r=0;r<t.length;r++)e[r]=S(e[r],t[r]);else for(r in t){if(r==="__proto__"||r==="constructor"||r==="prototype")break;e[r]=S(e[r],t[r])}return e}return t}function ye(e){const t={resolve(n){throw new Error("pending resolve")},reject(n){throw new Error("pending reject")}},r=Object.assign(new Promise((n,o)=>{t.reject=o,t.resolve=n}),{resolve(n){t.resolve(n)},reject(n){t.resolve(n)}});if(e){const n=t.resolve;let o=!0;t.resolve=s=>{o=!1,n(s)};const a=r.then.bind(r);r.then=(...s)=>{if(o){o=!1;try{const l=e(t.resolve,t.reject);l&&"then"in l?l.then(t.resolve,t.reject):l!==void 0&&t.resolve(l)}catch(l){t.reject(l)}}return a(...s)};const i=t;return i.then=r.then,i.catch=r.catch.bind(r),r.finally&&(i.finally=r.finally),Object.defineProperty(i,Symbol.species,{get(){return Promise}}),i}return r}function de(e,t,r=t){let n;const o=async()=>{await e(),n=setTimeout(o,t)};return n=setTimeout(o,r),()=>n}function pe(e){clearTimeout(e==null?void 0:e())}const ot=u("sleep",e=>new Promise(t=>setTimeout(t,e)));function ge(e,t){const r=new I;let n;return Promise.race([e,new Promise((o,a)=>{n=setTimeout(()=>a(r),t)})]).then(o=>(clearTimeout(n),o),o=>{throw clearTimeout(n),o})}class I extends Error{constructor(){super("TimeoutError")}}u("TimeoutError",I);function he(e){return e&&(e instanceof Promise||e.then&&e.catch)}function me(e,t){if(Object.is(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;const r=Object.keys(e);if(r.length!==Object.keys(t).length)return!1;for(let n=0;n<r.length;n++)if(!Object.prototype.hasOwnProperty.call(t,r[n])||!Object.is(e[r[n]],t[r[n]]))return!1;return!0}const z=Object.prototype.hasOwnProperty,be=typeof Element<"u";function N(e,t,r){for(r of e.keys())if(w(r,t))return r}function w(e,t){let r,n,o;if(e===t)return!0;if(e&&t&&(r=e.constructor)===t.constructor){if(r===Date)return e.getTime()===t.getTime();if(r===RegExp)return e.toString()===t.toString();if(r===Array){if((n=e.length)===t.length)for(;n--&&w(e[n],t[n]););return n===-1}if(r===Set){if(e.size!==t.size)return!1;for(n of e)if(o=n,o&&typeof o=="object"&&(o=N(t,o),!o)||!t.has(o))return!1;return!0}if(r===Map){if(e.size!==t.size)return!1;for(n of e)if(o=n[0],o&&typeof o=="object"&&(o=N(t,o),!o)||!w(n[1],t.get(o)))return!1;return!0}if(r===ArrayBuffer)e=new Uint8Array(e),t=new Uint8Array(t);else if(r===DataView){if((n=e.byteLength)===t.byteLength)for(;n--&&e.getInt8(n)===t.getInt8(n););return n===-1}if(ArrayBuffer.isView(e)){if((n=e.byteLength)===t.byteLength)for(;n--&&e[n]===t[n];);return n===-1}if(be&&e instanceof Element)return!1;if(!r||typeof e=="object"){n=0;for(r in e)if(!((r==="_owner"||r==="__v"||r==="__o")&&e.$$typeof)&&(z.call(e,r)&&++n&&!z.call(t,r)||!(r in t)||!w(e[r],t[r])))return!1;return Object.keys(t).length===n}}return e!==e&&t!==t}function A(e){return Object.prototype.toString.call(e).slice(8,-1)}function we(e){return e&&(Array.isArray(e)?e.slice():typeof e=="object"?Object.assign({},e):e)}function Ae(e){return typeof e=="function"&&/^class\s/.test(Function.prototype.toString.call(e))}function ve(e){return e!=null}function F(e){return A(e)!=="Object"?!1:e.constructor===Object&&Object.getPrototypeOf(e)===Object.prototype}function Oe(e){return F(e)&&Object.keys(e).length===0}function je(e){return/^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(e)}const Be=/^(?<n>(?:@(?<org>[a-z0-9-~][a-z0-9-._~]*)\/)?(?<pkg>[a-z0-9-~][a-z0-9-._~]*))(?:@(?<v>[-a-z0-9><=_.^~]+))?(?<p>\/[^\r\n]*)?$/;function Ue(e){var t;const r=(t=e.match(Be))==null?void 0:t.groups;if(!r)return;const{n,v:o,p:a,org:i,pkg:s}=r,l=Boolean(i),d=/^\d+\.\d+\.\d+/.test(o)?o:void 0,ie=o||"latest",B={id:`${n}@${ie}`,name:n,range:ie,scoped:l,pkg:s,org:i,versioned:Boolean(o)};return d&&(B.version=d),a&&(B.path=a),B.scoped||delete B.org,B}function Ce(e){return e&&e[Symbol.toStringTag]==="Module"}function $(e,t={}){return{trace:(...r)=>e({...t,level:"trace",values:r}),debug:(...r)=>e({...t,level:"debug",values:r}),info:(...r)=>e({...t,level:"info",values:r}),warn:(...r)=>e({...t,level:"warn",values:r}),error:(...r)=>e({...t,level:"error",values:r}),child:r=>$(e,{...t,...r})}}function W(){const e=(...t)=>{};return{trace:e,debug:e,info:e,warn:e,error:e,child:()=>W()}}function Ee(e,t){return e.child?e.child(t):$(r=>{const{level:n,values:o,...a}=r;Object.keys(a).length?e[n](a,...o):e[n](...o)},t)}function xe(e){let t=!1,r=!1,n=!1;for(let o=0;o<e.length;o++){const a=e[o];t&&/[a-zA-Z]/.test(a)&&a.toUpperCase()===a?(e=e.slice(0,o)+"-"+e.slice(o),t=!1,n=r,r=!0,o++):r&&n&&/[a-zA-Z]/.test(a)&&a.toLowerCase()===a?(e=e.slice(0,o-1)+"-"+e.slice(o-1),n=r,r=!1,t=!0):(t=a.toLowerCase()===a&&a.toUpperCase()!==a,n=r,r=a.toUpperCase()===a&&a.toLowerCase()!==a)}return e}function Te(e){return q(e,{pascalCase:!0})}function q(e,t={pascalCase:!1}){if(!(typeof e=="string"||Array.isArray(e)))throw new TypeError("Expected the input to be `string | string[]`");const r=n=>t.pascalCase?n.charAt(0).toUpperCase()+n.slice(1):n;return Array.isArray(e)?e=e.map(n=>n.trim()).filter(n=>n.length).join("-"):e=e.trim(),e.length===0?"":e.length===1?t.pascalCase?e.toUpperCase():e.toLowerCase():(e!==e.toLowerCase()&&(e=xe(e)),e=e.replace(/^[_.\- ]+/,"").toLowerCase().replace(/[_.\- ]+(\w|$)/g,(n,o)=>o.toUpperCase()).replace(/\d+(\w|$)/g,n=>n.toUpperCase()),r(e))}function Z(e,t,r="js"){let n;return t?typeof t=="function"?n=t:n=o=>T(t,o):n=()=>"",typeof r=="string"&&(r=H[r]||H.js),e.replace(r,(o,a)=>n(a.trim()))}const H={js:/\${(.*?)}/g,common:/{{(.*?)}}/g};function Se(e,t=!1,r=1){const n=t?1e3:1024;if(Math.abs(e)<n)return`${e} B`;const o=t?["kB","MB","GB","TB","PB","EB","ZB","YB"]:["KiB","MiB","GiB","TiB","PiB","EiB","ZiB","YiB"];let a=-1;const i=10**r;do e/=n,++a;while(Math.round(Math.abs(e)*i)/i>=n&&a<o.length-1);return e.toFixed(r)+" "+o[a]}function $e(e){let t="";const r=e||{},n=o=>{if(Array.isArray(o))return o;const a=o.split(/[_-]/);return a.length>1?[o,a[0]]:[o]};return{locale(o){return t=o||t},dict:(o,a)=>{if(a){r[o]=Object.assign(r[o]||{},a);return}return r[o]},t(o,a,i){let s;for(const l of n(i||t))if(s=T(r[l],o,""),s)break;return typeof s=="function"?s(a):typeof s=="string"?Z(s,a,"common"):s}}}function v(e){var t,r;return(r=(t=e==null?void 0:e.constructor)==null?void 0:t.isBuffer)==null?void 0:r.call(t,e)}function Pe(e){return G||=ke(),G.some(t=>e instanceof t)}let G;function ke(){const e=globalThis.window||globalThis||global;return[e.ArrayBuffer,e.MessagePort,e.ReadableStream,e.WritableStream,e.TransformStream,e.AudioData,e.ImageBitmap,e.VideoFrame,e.OffscreenCanvas,e.RTCDataChannel].filter(Boolean)}var P=(e,t,r)=>{if(!t.has(e))throw TypeError("Cannot "+r)},Le=(e,t,r)=>(P(e,t,"read from private field"),r?r.call(e):t.get(e)),J=(e,t,r)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,r)},Me=(e,t,r,n)=>(P(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r),k=(e,t,r)=>(P(e,t,"access private method"),r),U,O,C;const f=class{static setAllowedNativeBuffer(t){Me(this,U,t)}};let c=u("ArrayBuffers",f);U=new WeakMap,O=new WeakSet,C=function(){var e,t;return Le(this,U)&&!((t=(e=globalThis.Buffer)==null?void 0:e.isPollyfill)!=null&&t.call(e))},J(c,O),J(c,U,!0),c.isArrayBuffer=e=>e instanceof ArrayBuffer,c.slice=(e,t,r)=>v(e)?Uint8Array.prototype.slice.call(e,t,r):e.slice(t,r),c.asView=(e,t,r,n)=>{var o;return t instanceof e&&(r??0)===0&&n===void 0?t:ArrayBuffer.isView(t)||v(t)?k(o=f,O,C).call(o)&&e===Buffer?Buffer.from(t.buffer,r,n):new e(t.buffer,t.byteOffset+(r??0),n??t.byteLength):new e(t,r,n)},c.toString=(e,t="utf8")=>{var r;if(typeof e=="string")return e;if(k(r=f,O,C).call(r))return Buffer.from(f.asView(Uint8Array,e)).toString(t);switch(t){case"hex":return[...f.asView(Uint8Array,e)].map(n=>De[n]).join("");case"base64":{const n=f.asView(Uint8Array,e);return btoa(String.fromCharCode(...n))}case"utf8":case"utf-8":return new TextDecoder().decode(e);case"ascii":{const n=f.asView(Uint8Array,e);return String.fromCharCode(...n.map(o=>o&127))}case"latin1":case"binary":{const n=f.asView(Uint8Array,e);return String.fromCharCode(...n)}case"ucs2":case"ucs-2":case"utf16le":{const n=f.asView(Uint8Array,e);let o="";for(let a=0;a<n.length-1;a+=2)o+=String.fromCharCode(n[a]+n[a+1]*256);return o}default:throw new Error(`[ArrayBuffers.toString] Unknown encoding: ${t}`)}},c.toJSON=(e,t)=>JSON.parse(f.toString(e),t),c.alloc=(e,t,r)=>t!==void 0?typeof t=="number"?new Uint8Array(e).fill(t):f.asView(Uint8Array,f.from(t,r)).slice(0,e):new ArrayBuffer(e),c.from=(e,t="utf8")=>{var r;if(!e)return new ArrayBuffer(0);if(typeof e=="string"){if(k(r=f,O,C).call(r))return Buffer.from(e,t);switch(t){case"utf-8":case"utf8":return new TextEncoder().encode(e).buffer;case"base64":return Uint8Array.from(atob(e.replace(/[^0-9a-zA-Z=+/_ \r\n]/g,"")),o=>o.charCodeAt(0));default:throw new Error(`[ArrayBuffers.from] Unknown encoding: ${t}`)}}if(e instanceof ArrayBuffer)return e;if(ArrayBuffer.isView(e)||v(e)){if(e.byteOffset!==0)throw new Error("ArrayBuffers.from do not support view with offset");return e.buffer}if(Array.isArray(e))return new Uint8Array(e);const n=A(e);throw new TypeError(`ArrayBuffers.from unsupported type ${n}`)},c.isEncoding=e=>{switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":return!0;default:return!1}},c.concat=(e,t,r=0)=>{const n=e.reduce((a,i)=>a+i.byteLength,0),o=t?new Uint8Array(t):new Uint8Array(n);for(const a of e){if(!a||!a.byteLength)continue;let i;if(a instanceof ArrayBuffer)i=new Uint8Array(a);else if(ArrayBuffer.isView(a))i=new Uint8Array(a.buffer,a.byteOffset,a.byteLength);else throw new Error(`ArrayBuffers.concat unsupported type ${A(a)}`);o.set(i,r),r+=a.byteLength}return o.buffer};const De=function(){const e="0123456789abcdef",t=new Array(256);for(let r=0;r<16;++r){const n=r*16;for(let o=0;o<16;++o)t[n+o]=e[r]+e[o]}return t}(),L=class extends Uint8Array{static get isPolyfill(){return!0}static isBuffer(e){return e instanceof L||v(e)}static from(e,t){return new L(c.from(e,t))}toString(e){return c.toString(this,e)}};let _e=u("Buffer",L);_e.isEncoding=c.isEncoding;let M;function Ve(){let e;function t(){return navigator.userAgent.match(/ipad|iphone/i)}function r(a){e=document.createElement("textArea"),e.value=a,document.body.appendChild(e)}function n(){let a,i;if(t()){if(a=document.createRange(),a.selectNodeContents(e),i=window.getSelection(),i===null){console.error("no selection");return}i.removeAllRanges(),i.addRange(a),e.setSelectionRange(0,999999)}else e.select()}function o(){document.execCommand("copy"),document.body.removeChild(e)}M=a=>{r(a),n(),o()}}function Re(e){var t,r;return(r=(t=window.navigator)==null?void 0:t.clipboard)!=null&&r.writeText?window.navigator.clipboard.writeText(e):(M||Ve(),M(e))}function Ie(e,t,{type:r="application/octet-stream",raw:n=!1}={}){const o=document.createElement("a");let a=()=>null;try{if(o.download=e,typeof t=="string"&&/^(https?:|data:)/.test(t)&&!n?o.href=t:typeof t=="string"&&(t=new TextEncoder().encode(t)),t instanceof Uint8Array&&(t=new Blob([t],{type:r})),t instanceof File||t instanceof Blob||t instanceof MediaSource)o.href=URL.createObjectURL(t),a=()=>URL.revokeObjectURL(o.href);else throw console.error("invalid download data",t),new Error(`can not download ${Object.getPrototypeOf(t)}`);o.click()}finally{a()}}function K(e,t,r,n){e.onload=()=>t(e),e.onerror=a=>{e.remove(),r(a)};const{attributes:o={}}=n||{};Object.entries(o).forEach(([a,i])=>e.setAttribute(a,i)),document.head.appendChild(e)}function Y(e,t){if(Array.isArray(e))return Promise.resolve().then(async()=>{const n=[];for(const o of e)n.push(await Y(o));return n});const r=document.querySelector(`script[src="${e}"]`);return r?Promise.resolve(r):new Promise((n,o)=>{const a=document.createElement("script");a.src=e,K(a,n,o,t)})}function ze(e,t){const r=document.querySelector(`link[href="${e}"]`);return r?Promise.resolve(r):new Promise((n,o)=>{const a=document.createElement("link");a.rel="stylesheet",a.href=e,K(a,n,o,t)})}function Ne(e){var t;if(!e)return{};const r=e.items??[];if(r.length>=2&&r[0].kind==="string"&&r[1].kind==="file"){const n=e.getData("text"),o=r[1].getAsFile()??((t=e.files)==null?void 0:t.item(0));return o?{file:o,name:n}:(console.error(`no file ${n}`,r[1]),{})}else if(r[0].kind==="file"){const n=r[0].getAsFile();return n?{file:n,name:n.name}:(console.error("no file",r[0]),{})}else console.debug("file item not match",Array.from(r).map(n=>({type:n.type,kind:n.kind})));return{}}const at=u("getGlobalThis",()=>{if(typeof globalThis<"u")return globalThis;if(typeof self<"u")return self;if(typeof window<"u")return window;if(typeof global<"u")return global;throw new Error("Unable to locate global `this`")}),it=u("structuredClone",globalThis.structuredClone||m);function Q(e,t,r){typeof r.value=="object"&&(r.value=m(r.value)),!r.enumerable||r.get||r.set||!r.configurable||!r.writable||t==="__proto__"?Object.defineProperty(e,t,r):e[t]=r.value}function m(e){if(typeof e!="object")return e;let t=0,r,n,o;const a=A(e);switch(a){case"Array":o=Array(e.length);break;case"Object":o=Object.create(e.__proto__||null);break;case"Set":o=new Set,e.forEach(function(i){o.add(m(i))});break;case"Map":o=new Map,e.forEach(function(i,s){o.set(m(s),m(i))});break;case"Date":o=new Date(+e);break;case"RegExp":o=new RegExp(e.source,e.flags);break;case"DataView":o=new e.constructor(m(e.buffer));break;case"ArrayBuffer":o=e.slice(0);break;default:a.endsWith("Array")&&(o=new e.constructor(e))}if(o){for(n=Object.getOwnPropertySymbols(e);t<n.length;t++)Q(o,n[t],Object.getOwnPropertyDescriptor(e,n[t]));for(t=0,n=Object.getOwnPropertyNames(e);t<n.length;t++)Object.hasOwnProperty.call(o,r=n[t])&&o[r]===e[r]||Q(o,r,Object.getOwnPropertyDescriptor(e,r))}return o||e}var X;const st=u("randomUUID",((X=globalThis.crypto)==null?void 0:X.randomUUID)||Fe);function Fe(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{const t=Math.random()*16|0;return(e==="x"?t:t&3|8).toString(16)})}var ee,te;let y;if(!process.browser)try{typeof require>"u"?se.import("node:crypto").then(e=>y=e.default):y=require("node:crypto")}catch{}let re=u("getRandomValues",((ee=globalThis.crypto)==null?void 0:ee.getRandomValues)||((te=globalThis.msCrypto)==null?void 0:te.getRandomValues)||We);function We(e){var t,r;if((t=y==null?void 0:y.webcrypto)!=null&&t.getRandomValues)return u("getRandomValues",re=(r=y==null?void 0:y.webcrypto)==null?void 0:r.getRandomValues),y.webcrypto.getRandomValues(e);if(y!=null&&y.randomBytes){if(!(e instanceof Uint8Array))throw new TypeError("expected Uint8Array");if(e.length>65536){const o=new Error;throw o.code=22,o.message=`Failed to execute 'getRandomValues' on 'Crypto': The ArrayBufferView's byte length (${e.length}) exceeds the number of bytes of entropy available via this API (65536).`,o.name="QuotaExceededError",o}const n=y.randomBytes(e.length);return e.set(n),e}throw new Error("No secure random number generator available.")}function qe(e){return E("SHA-1",e)}function Ze(e){return E("SHA-256",e)}function He(e){return E("SHA-384",e)}function Ge(e){return E("SHA-512",e)}function E(e,t){return crypto.subtle.digest(e,Je(t))}function Je(e){return typeof e=="string"?new TextEncoder().encode(e):e}function Ke(e){return Array.from(new Uint8Array(e)).map(t=>t.toString(16).padStart(2,"0")).join("")}function p(e){const t=new Error(e);return t.source="ulid",t}const g="0123456789ABCDEFGHJKMNPQRSTVWXYZ",h=g.length,D=Math.pow(2,48)-1,b=10,_=16;function Ye(e){return(e==null?void 0:e.length)===26&&/^[0-9A-HJKMNP-TV-Z]{26}$/.test(e)}function ne(e,t,r){return t>e.length-1?e:e.substr(0,t)+r+e.substr(t+1)}function Qe(e){let t,r=e.length,n,o;const a=h-1;for(;!t&&r-->=0;){if(n=e[r],o=g.indexOf(n),o===-1)throw p("incorrectly encoded string");if(o===a){e=ne(e,r,g[0]);continue}t=ne(e,r,g[o+1])}if(typeof t=="string")return t;throw p("cannot increment this string")}function Xe(e){let t=Math.floor(e()*h);return t===h&&(t=h-1),g.charAt(t)}function V(e,t){if(isNaN(e))throw new Error(`${e} must be a number`);if(e>D)throw p(`cannot encode time greater than ${D}`);if(e<0)throw p("time must be positive");if(!Number.isInteger(e))throw p("time must be an integer");let r,n="";for(;t>0;t--)r=e%h,n=g.charAt(r)+n,e=(e-r)/h;return n}function oe(e,t){let r="";for(;e>0;e--)r=Xe(t)+r;return r}function et(e){if(e.length!==b+_)throw p("malformed ulid");const t=e.substr(0,b).split("").reverse().reduce((r,n,o)=>{const a=g.indexOf(n);if(a===-1)throw p("invalid character found: "+n);return r+=a*Math.pow(h,o)},0);if(t>D)throw p("malformed ulid, timestamp too large");return{time:t,random:e.substring(b)}}function tt(){return()=>{const e=new Uint8Array(1);return re(e),e[0]/255}}function ae({monotonic:e=!0,random:t=tt(),now:r=Date.now}={}){if(!e)return function(a){return a||=r(),V(a,b)+oe(_,t)};let n=0,o;return function(a){if(a||=r(),a<=n){const s=o=Qe(o);return V(n,b)+s}n=a;const i=o=oe(_,t);return V(a,b)+i}}let rt=u("ulid",(...e)=>j?j(...e):(j=ae(),u("ulid",rt=j),j(...e))),j;function nt(e={}){let t=typeof e.seed=="string"?0:e.seed??0;if(typeof e.seed=="string"){let r=0;for(let n=0;n<e.seed.length;n++)r+=e.seed.charCodeAt(n);t=r}return()=>{const r=Math.sin(t++)*1e4;return r-Math.floor(r)}}}}});
|
|
1
|
+
System.register([],function(u){"use strict";return{execute:function(){u({arrayOfMaybeArray:ue,camelCase:Z,classOf:w,clearAsyncInterval:ge,copy:ze,createChildLogger:xe,createLazyPromise:ye,createLogger:x,createNoopLogger:W,createRandom:st,createTranslate:ke,createULID:se,deepEqual:b,download:Fe,firstOfMaybeArray:V,formatBytes:Le,get:E,getFileFromDataTransfer:Ze,hex:et,isBuffer:A,isClass:Ae,isDefined:ve,isEmptyObject:Oe,isModule:Ee,isPlainObject:F,isPromise:R,isTransferable:De,isULID:tt,isUUID:je,lastOfMaybeArray:fe,loadScripts:Y,loadStyles:We,objectOfMaybeArray:le,parseBoolean:Ce,parseModuleId:Ue,parseObjectPath:U,parseTimestamp:Be,parseULID:ot,pascalCase:Pe,renderTemplate:q,set:de,setAsyncInterval:pe,sha1:Je,sha256:Ke,sha384:Ye,sha512:Qe,shallowClone:we,shallowEqual:me,timeout:he});function le(e,t=null,r=V){return Object.fromEntries(t===null?Object.entries(e).map(([n,o])=>[n,r(o)]):t.map(n=>[n,r(n)]))}function V(e){return Array.isArray(e)?e[0]:e}function fe(e){return Array.isArray(e)?e[e.length-1]:e}function ue(e){return Array.isArray(e)?e:e==null?[]:[e]}function U(e){if(typeof e!="string")return Array.isArray(e)?e:[e];const t=e.split(".");if(!e.includes("["))return t;const r=[];for(const n of t)if(!n.endsWith("]"))r.push(n);else{const o=n.split("[");for(let a of o)a.endsWith("]")&&(a=a.slice(0,-1)),r.push(a)}return r}function E(e,t,r){const n=U(t);let o=e;for(const a of n)o=o?o[a]:void 0;return o===void 0?r:o}function de(e,t,r,n=!0){const o=U(t);let a=0;const i=o.length;let s=e,f,d;for(;a<i&&(d=o[a++],!(d==="__proto__"||d==="constructor"||d==="prototype"));)s=s[d]=a===i?n?S(s[d],r):r:typeof(f=s[d])==typeof o?f:o[a]*0!==0||!!~(""+o[a]).indexOf(".")?{}:[]}function S(e,t){let r;if(typeof e=="object"&&typeof t=="object"){if(Array.isArray(e)&&Array.isArray(t))for(r=0;r<t.length;r++)e[r]=S(e[r],t[r]);else for(r in t){if(r==="__proto__"||r==="constructor"||r==="prototype")break;e[r]=S(e[r],t[r])}return e}return t}function R(e){return e&&(e instanceof Promise||e.then&&e.catch)}function ye(e){const t={resolve(n){throw new Error("pending resolve")},reject(n){throw new Error("pending reject")}},r=Object.assign(new Promise((n,o)=>{t.reject=o,t.resolve=n}),{resolve(n){t.resolve(n)},reject(n){t.resolve(n)}});if(e){const n=t.resolve;let o=!0;t.resolve=s=>{o=!1,n(s)};const a=r.then.bind(r);r.then=(...s)=>{if(o){o=!1;try{const f=e(t.resolve,t.reject);R(f)?f.then(t.resolve,t.reject):f!==void 0&&t.resolve(f)}catch(f){t.reject(f)}}return a(...s)};const i=t;return i.then=r.then,i.catch=r.catch.bind(r),r.finally&&(i.finally=r.finally),Object.defineProperty(i,Symbol.species,{get(){return Promise}}),i}return r}function pe(e,t,r=t){let n;const o=async()=>{await e(),n=setTimeout(o,t)};return n=setTimeout(o,r),()=>n}function ge(e){clearTimeout(e==null?void 0:e())}const ct=u("sleep",e=>new Promise(t=>setTimeout(t,e)));function he(e,t){const r=new I;let n;return Promise.race([e,new Promise((o,a)=>{n=setTimeout(()=>a(r),t)})]).then(o=>(clearTimeout(n),o),o=>{throw clearTimeout(n),o})}class I extends Error{constructor(){super("TimeoutError")}}u("TimeoutError",I);function me(e,t){if(Object.is(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;const r=Object.keys(e);if(r.length!==Object.keys(t).length)return!1;for(let n=0;n<r.length;n++)if(!Object.prototype.hasOwnProperty.call(t,r[n])||!Object.is(e[r[n]],t[r[n]]))return!1;return!0}const N=Object.prototype.hasOwnProperty,be=typeof Element<"u";function z(e,t,r){for(r of e.keys())if(b(r,t))return r}function b(e,t){let r,n,o;if(e===t)return!0;if(e&&t&&(r=e.constructor)===t.constructor){if(r===Date)return e.getTime()===t.getTime();if(r===RegExp)return e.toString()===t.toString();if(r===Array){if((n=e.length)===t.length)for(;n--&&b(e[n],t[n]););return n===-1}if(r===Set){if(e.size!==t.size)return!1;for(n of e)if(o=n,o&&typeof o=="object"&&(o=z(t,o),!o)||!t.has(o))return!1;return!0}if(r===Map){if(e.size!==t.size)return!1;for(n of e)if(o=n[0],o&&typeof o=="object"&&(o=z(t,o),!o)||!b(n[1],t.get(o)))return!1;return!0}if(r===ArrayBuffer)e=new Uint8Array(e),t=new Uint8Array(t);else if(r===DataView){if((n=e.byteLength)===t.byteLength)for(;n--&&e.getInt8(n)===t.getInt8(n););return n===-1}if(ArrayBuffer.isView(e)){if((n=e.byteLength)===t.byteLength)for(;n--&&e[n]===t[n];);return n===-1}if(be&&e instanceof Element)return!1;if(!r||typeof e=="object"){n=0;for(r in e)if(!((r==="_owner"||r==="__v"||r==="__o")&&e.$$typeof)&&(N.call(e,r)&&++n&&!N.call(t,r)||!(r in t)||!b(e[r],t[r])))return!1;return Object.keys(t).length===n}}return e!==e&&t!==t}function w(e){return Object.prototype.toString.call(e).slice(8,-1)}function we(e){return e&&(Array.isArray(e)?e.slice():typeof e=="object"?Object.assign({},e):e)}function Ae(e){return typeof e=="function"&&/^class\s/.test(Function.prototype.toString.call(e))}function ve(e){return e!=null}function F(e){return w(e)!=="Object"?!1:e.constructor===Object&&Object.getPrototypeOf(e)===Object.prototype}function Oe(e){return F(e)&&Object.keys(e).length===0}function je(e){return/^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(e)}function Be(e){if(e){if(e instanceof Date)return e;if(typeof e=="string"&&/^[0-9.]+$/.test(e)){let t=parseFloat(e);return Math.floor(t).toString().length<=11&&(t*=1e3),new Date(t)}else if(typeof e=="string"){const t=new Date(e);if(!isNaN(+t))return t}throw new Error(`parseTimestamp: invalid "${e}"`)}}function Ce(e,t=!1){if(typeof e=="boolean")return e;if(typeof e=="string")switch(e.toLowerCase()){case"f":case"false":case"0":return!1;case"1":case"t":case"true":return!0}else if(typeof e=="number")switch(e){case 0:return!1;case 1:return!0}if(!t)return Boolean(e)}const Te=/^(?<n>(?:@(?<org>[a-z0-9-~][a-z0-9-._~]*)\/)?(?<pkg>[a-z0-9-~][a-z0-9-._~]*))(?:@(?<v>[-a-z0-9><=_.^~]+))?(?<p>\/[^\r\n]*)?$/;function Ue(e){var t;const r=(t=e.match(Te))==null?void 0:t.groups;if(!r)return;const{n,v:o,p:a,org:i,pkg:s}=r,f=Boolean(i),d=/^\d+\.\d+\.\d+/.test(o)?o:void 0,ce=o||"latest",j={id:`${n}@${ce}`,name:n,range:ce,scoped:f,pkg:s,org:i,versioned:Boolean(o)};return d&&(j.version=d),a&&(j.path=a),j.scoped||delete j.org,j}function Ee(e){return e&&e[Symbol.toStringTag]==="Module"}function x(e=({level:r,values:n,...o})=>{var a;({values:n,...o}=Se(o,n)),(a=console[r])==null||a.call(console,...n,o)},t={}){return{trace:(...r)=>e({...t,level:"trace",values:r}),debug:(...r)=>e({...t,level:"debug",values:r}),info:(...r)=>e({...t,level:"info",values:r}),warn:(...r)=>e({...t,level:"warn",values:r}),error:(...r)=>e({...t,level:"error",values:r}),child:r=>x(e,{...t,...r})}}function Se(e,t){return t[0]&&typeof t[0]=="object"?{...e,...t[0],values:t.slice(1)}:{...e,values:t}}function W(){const e=(...t)=>{};return{trace:e,debug:e,info:e,warn:e,error:e,child:()=>W()}}function xe(e,t){return e.child?e.child(t):x(r=>{const{level:n,values:o,...a}=r;Object.keys(a).length?e[n](a,...o):e[n](...o)},t)}function $e(e){let t=!1,r=!1,n=!1;for(let o=0;o<e.length;o++){const a=e[o];t&&/[a-zA-Z]/.test(a)&&a.toUpperCase()===a?(e=e.slice(0,o)+"-"+e.slice(o),t=!1,n=r,r=!0,o++):r&&n&&/[a-zA-Z]/.test(a)&&a.toLowerCase()===a?(e=e.slice(0,o-1)+"-"+e.slice(o-1),n=r,r=!1,t=!0):(t=a.toLowerCase()===a&&a.toUpperCase()!==a,n=r,r=a.toUpperCase()===a&&a.toLowerCase()!==a)}return e}function Pe(e){return Z(e,{pascalCase:!0})}function Z(e,t={pascalCase:!1}){if(!(typeof e=="string"||Array.isArray(e)))throw new TypeError("Expected the input to be `string | string[]`");const r=n=>t.pascalCase?n.charAt(0).toUpperCase()+n.slice(1):n;return Array.isArray(e)?e=e.map(n=>n.trim()).filter(n=>n.length).join("-"):e=e.trim(),e.length===0?"":e.length===1?t.pascalCase?e.toUpperCase():e.toLowerCase():(e!==e.toLowerCase()&&(e=$e(e)),e=e.replace(/^[_.\- ]+/,"").toLowerCase().replace(/[_.\- ]+(\w|$)/g,(n,o)=>o.toUpperCase()).replace(/\d+(\w|$)/g,n=>n.toUpperCase()),r(e))}function q(e,t,r="js"){let n;return t?typeof t=="function"?n=t:n=o=>E(t,o):n=()=>"",typeof r=="string"&&(r=H[r]||H.js),e.replace(r,(o,a)=>n(a.trim()))}const H={js:/\${(.*?)}/g,common:/{{(.*?)}}/g};function Le(e,t=!1,r=1){const n=t?1e3:1024;if(Math.abs(e)<n)return`${e} B`;const o=t?["kB","MB","GB","TB","PB","EB","ZB","YB"]:["KiB","MiB","GiB","TiB","PiB","EiB","ZiB","YiB"];let a=-1;const i=10**r;do e/=n,++a;while(Math.round(Math.abs(e)*i)/i>=n&&a<o.length-1);return e.toFixed(r)+" "+o[a]}function ke(e){let t="";const r=e||{},n=o=>{if(Array.isArray(o))return o;const a=o.split(/[_-]/);return a.length>1?[o,a[0]]:[o]};return{locale(o){return t=o||t},dict:(o,a)=>{if(a){r[o]=Object.assign(r[o]||{},a);return}return r[o]},t(o,a,i){let s;for(const f of n(i||t))if(s=E(r[f],o,""),s)break;return typeof s=="function"?s(a):typeof s=="string"?q(s,a,"common"):s}}}function A(e){var t,r;return(r=(t=e==null?void 0:e.constructor)==null?void 0:t.isBuffer)==null?void 0:r.call(t,e)}function De(e){return G||=Me(),G.some(t=>e instanceof t)}let G;function Me(){const e=globalThis.window||globalThis||global;return[e.ArrayBuffer,e.MessagePort,e.ReadableStream,e.WritableStream,e.TransformStream,e.AudioData,e.ImageBitmap,e.VideoFrame,e.OffscreenCanvas,e.RTCDataChannel].filter(Boolean)}var $=(e,t,r)=>{if(!t.has(e))throw TypeError("Cannot "+r)},_e=(e,t,r)=>($(e,t,"read from private field"),r?r.call(e):t.get(e)),J=(e,t,r)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,r)},Ve=(e,t,r,n)=>($(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r),P=(e,t,r)=>($(e,t,"access private method"),r),B,v,C;const l=class{static setAllowedNativeBuffer(t){Ve(this,B,t)}};let c=u("ArrayBuffers",l);B=new WeakMap,v=new WeakSet,C=function(){var e,t;return _e(this,B)&&!((t=(e=globalThis.Buffer)==null?void 0:e.isPollyfill)!=null&&t.call(e))},J(c,v),J(c,B,!0),c.isArrayBuffer=e=>e instanceof ArrayBuffer,c.slice=(e,t,r)=>A(e)?Uint8Array.prototype.slice.call(e,t,r):e.slice(t,r),c.asView=(e,t,r,n)=>{var o;return t instanceof e&&(r??0)===0&&n===void 0?t:ArrayBuffer.isView(t)||A(t)?P(o=l,v,C).call(o)&&e===Buffer?Buffer.from(t.buffer,r,n):new e(t.buffer,t.byteOffset+(r??0),n??t.byteLength):new e(t,r,n)},c.toString=(e,t="utf8")=>{var r;if(typeof e=="string")return e;if(P(r=l,v,C).call(r))return Buffer.from(l.asView(Uint8Array,e)).toString(t);switch(t){case"hex":return[...l.asView(Uint8Array,e)].map(n=>Re[n]).join("");case"base64":{const n=l.asView(Uint8Array,e);return btoa(String.fromCharCode(...n))}case"utf8":case"utf-8":return new TextDecoder().decode(e);case"ascii":{const n=l.asView(Uint8Array,e);return String.fromCharCode(...n.map(o=>o&127))}case"latin1":case"binary":{const n=l.asView(Uint8Array,e);return String.fromCharCode(...n)}case"ucs2":case"ucs-2":case"utf16le":{const n=l.asView(Uint8Array,e);let o="";for(let a=0;a<n.length-1;a+=2)o+=String.fromCharCode(n[a]+n[a+1]*256);return o}default:throw new Error(`[ArrayBuffers.toString] Unknown encoding: ${t}`)}},c.toJSON=(e,t)=>JSON.parse(l.toString(e),t),c.alloc=(e,t,r)=>t!==void 0?typeof t=="number"?new Uint8Array(e).fill(t):l.asView(Uint8Array,l.from(t,r)).slice(0,e):new ArrayBuffer(e),c.from=(e,t="utf8")=>{var r;if(!e)return new ArrayBuffer(0);if(typeof e=="string"){if(P(r=l,v,C).call(r))return Buffer.from(e,t);switch(t){case"utf-8":case"utf8":return new TextEncoder().encode(e).buffer;case"base64":return Uint8Array.from(atob(e.replace(/[^0-9a-zA-Z=+/_ \r\n]/g,"")),o=>o.charCodeAt(0));default:throw new Error(`[ArrayBuffers.from] Unknown encoding: ${t}`)}}if(e instanceof ArrayBuffer)return e;if(ArrayBuffer.isView(e)||A(e)){if(e.byteOffset!==0)throw new Error("ArrayBuffers.from do not support view with offset");return e.buffer}if(Array.isArray(e))return new Uint8Array(e);const n=w(e);throw new TypeError(`ArrayBuffers.from unsupported type ${n}`)},c.isEncoding=e=>{switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":return!0;default:return!1}},c.concat=(e,t,r=0)=>{const n=e.reduce((a,i)=>a+i.byteLength,0),o=t?new Uint8Array(t):new Uint8Array(n);for(const a of e){if(!a||!a.byteLength)continue;let i;if(a instanceof ArrayBuffer)i=new Uint8Array(a);else if(ArrayBuffer.isView(a))i=new Uint8Array(a.buffer,a.byteOffset,a.byteLength);else throw new Error(`ArrayBuffers.concat unsupported type ${w(a)}`);o.set(i,r),r+=a.byteLength}return o.buffer};const Re=function(){const e="0123456789abcdef",t=new Array(256);for(let r=0;r<16;++r){const n=r*16;for(let o=0;o<16;++o)t[n+o]=e[r]+e[o]}return t}(),L=class extends Uint8Array{static get isPolyfill(){return!0}static isBuffer(e){return e instanceof L||A(e)}static from(e,t){return new L(c.from(e,t))}toString(e){return c.toString(this,e)}};let Ie=u("Buffer",L);Ie.isEncoding=c.isEncoding;let k;function Ne(){let e;function t(){return navigator.userAgent.match(/ipad|iphone/i)}function r(a){e=document.createElement("textArea"),e.value=a,document.body.appendChild(e)}function n(){let a,i;if(t()){if(a=document.createRange(),a.selectNodeContents(e),i=window.getSelection(),i===null){console.error("no selection");return}i.removeAllRanges(),i.addRange(a),e.setSelectionRange(0,999999)}else e.select()}function o(){document.execCommand("copy"),document.body.removeChild(e)}k=a=>{r(a),n(),o()}}function ze(e){var t,r;return(r=(t=window.navigator)==null?void 0:t.clipboard)!=null&&r.writeText?window.navigator.clipboard.writeText(e):(k||Ne(),k(e))}function Fe(e,t,{type:r="application/octet-stream",raw:n=!1}={}){const o=document.createElement("a");let a=()=>null;try{if(o.download=e,typeof t=="string"&&/^(https?:|data:)/.test(t)&&!n?o.href=t:typeof t=="string"&&(t=new TextEncoder().encode(t)),t instanceof Uint8Array&&(t=new Blob([t],{type:r})),t instanceof File||t instanceof Blob||t instanceof MediaSource)o.href=URL.createObjectURL(t),a=()=>URL.revokeObjectURL(o.href);else throw console.error("invalid download data",t),new Error(`can not download ${Object.getPrototypeOf(t)}`);o.click()}finally{a()}}function K(e,t,r,n){e.onload=()=>t(e),e.onerror=a=>{e.remove(),r(a)};const{attributes:o={}}=n||{};Object.entries(o).forEach(([a,i])=>e.setAttribute(a,i)),document.head.appendChild(e)}function Y(e,t){if(Array.isArray(e))return Promise.resolve().then(async()=>{const n=[];for(const o of e)n.push(await Y(o));return n});const r=document.querySelector(`script[src="${e}"]`);return r?Promise.resolve(r):new Promise((n,o)=>{const a=document.createElement("script");a.src=e,K(a,n,o,t)})}function We(e,t){const r=document.querySelector(`link[href="${e}"]`);return r?Promise.resolve(r):new Promise((n,o)=>{const a=document.createElement("link");a.rel="stylesheet",a.href=e,K(a,n,o,t)})}function Ze(e){var t;if(!e)return{};const r=e.items??[];if(r.length>=2&&r[0].kind==="string"&&r[1].kind==="file"){const n=e.getData("text"),o=r[1].getAsFile()??((t=e.files)==null?void 0:t.item(0));return o?{file:o,name:n}:(console.error(`no file ${n}`,r[1]),{})}else if(r[0].kind==="file"){const n=r[0].getAsFile();return n?{file:n,name:n.name}:(console.error("no file",r[0]),{})}else console.debug("file item not match",Array.from(r).map(n=>({type:n.type,kind:n.kind})));return{}}const lt=u("getGlobalThis",()=>{if(typeof globalThis<"u")return globalThis;if(typeof self<"u")return self;if(typeof window<"u")return window;if(typeof global<"u")return global;throw new Error("Unable to locate global `this`")}),ft=u("structuredClone",globalThis.structuredClone||h);function Q(e,t,r){typeof r.value=="object"&&(r.value=h(r.value)),!r.enumerable||r.get||r.set||!r.configurable||!r.writable||t==="__proto__"?Object.defineProperty(e,t,r):e[t]=r.value}function h(e){if(typeof e!="object")return e;let t=0,r,n,o;const a=w(e);switch(a){case"Array":o=Array(e.length);break;case"Object":o=Object.create(e.__proto__||null);break;case"Set":o=new Set,e.forEach(function(i){o.add(h(i))});break;case"Map":o=new Map,e.forEach(function(i,s){o.set(h(s),h(i))});break;case"Date":o=new Date(+e);break;case"RegExp":o=new RegExp(e.source,e.flags);break;case"DataView":o=new e.constructor(h(e.buffer));break;case"ArrayBuffer":o=e.slice(0);break;default:a.endsWith("Array")&&(o=new e.constructor(e))}if(o){for(n=Object.getOwnPropertySymbols(e);t<n.length;t++)Q(o,n[t],Object.getOwnPropertyDescriptor(e,n[t]));for(t=0,n=Object.getOwnPropertyNames(e);t<n.length;t++)Object.hasOwnProperty.call(o,r=n[t])&&o[r]===e[r]||Q(o,r,Object.getOwnPropertyDescriptor(e,r))}return o||e}var X;const ut=u("randomUUID",((X=globalThis.crypto)==null?void 0:X.randomUUID.bind(globalThis.crypto))||qe);function qe(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{const t=Math.random()*16|0;return(e==="x"?t:t&3|8).toString(16)})}var ee,te,re,ne;let He,oe=u("getRandomValues",((te=(ee=globalThis.crypto)==null?void 0:ee.getRandomValues)==null?void 0:te.bind(globalThis.crypto))||((ne=(re=globalThis.msCrypto)==null?void 0:re.getRandomValues)==null?void 0:ne.bind(globalThis.msCrypto))||Ge);function Ge(e){var t,r,n;if((t=void 0)!=null&&t.getRandomValues)return u("getRandomValues",oe=(n=(r=void 0)==null?void 0:r.getRandomValues)==null?void 0:n.bind(void 0)),He.webcrypto.getRandomValues(e);throw new Error("No secure random number generator available.")}function Je(e){return T("SHA-1",e)}function Ke(e){return T("SHA-256",e)}function Ye(e){return T("SHA-384",e)}function Qe(e){return T("SHA-512",e)}function T(e,t){return crypto.subtle.digest(e,Xe(t))}function Xe(e){return typeof e=="string"?new TextEncoder().encode(e):e}function et(e){return Array.from(new Uint8Array(e)).map(t=>t.toString(16).padStart(2,"0")).join("")}function y(e){const t=new Error(e);return t.source="ulid",t}const p="0123456789ABCDEFGHJKMNPQRSTVWXYZ",g=p.length,D=Math.pow(2,48)-1,m=10,M=16;function tt(e){return(e==null?void 0:e.length)===26&&/^[0-9A-HJKMNP-TV-Z]{26}$/i.test(e)}function ae(e,t,r){return t>e.length-1?e:e.substr(0,t)+r+e.substr(t+1)}function rt(e){let t,r=e.length,n,o;const a=g-1;for(;!t&&r-->=0;){if(n=e[r],o=p.indexOf(n),o===-1)throw y("incorrectly encoded string");if(o===a){e=ae(e,r,p[0]);continue}t=ae(e,r,p[o+1])}if(typeof t=="string")return t;throw y("cannot increment this string")}function nt(e){let t=Math.floor(e()*g);return t===g&&(t=g-1),p.charAt(t)}function _(e,t){if(isNaN(e))throw new Error(`${e} must be a number`);if(e>D)throw y(`cannot encode time greater than ${D}`);if(e<0)throw y("time must be positive");if(!Number.isInteger(e))throw y("time must be an integer");let r,n="";for(;t>0;t--)r=e%g,n=p.charAt(r)+n,e=(e-r)/g;return n}function ie(e,t){let r="";for(;e>0;e--)r=nt(t)+r;return r}function ot(e){if(e.length!==m+M)throw y("malformed ulid");const t=e.substr(0,m).split("").reverse().reduce((r,n,o)=>{const a=p.indexOf(n);if(a===-1)throw y("invalid character found: "+n);return r+=a*Math.pow(g,o)},0);if(t>D)throw y("malformed ulid, timestamp too large");return{timestamp:t,random:e.substring(m)}}function at(){return()=>{const e=new Uint8Array(1);return oe(e),e[0]/255}}function se({monotonic:e=!0,random:t=at(),now:r=Date.now}={}){if(!e)return function(a){return a||=r(),_(a,m)+ie(M,t)};let n=0,o;return function(a){if(a||=r(),a<=n&&o){const s=o=rt(o);return _(n,m)+s}n=a;const i=o=ie(M,t);return _(a,m)+i}}let it=u("ulid",(...e)=>O?O(...e):(O=se(),u("ulid",it=O),O(...e))),O;function st(e={}){let t=typeof e.seed=="string"?0:e.seed??0;if(typeof e.seed=="string"){let r=0;for(let n=0;n<e.seed.length;n++)r+=e.seed.charCodeAt(n);t=r}return()=>{const r=Math.sin(t++)*1e4;return r-Math.floor(r)}}}}});
|
|
2
2
|
//# sourceMappingURL=index.js.map
|