@movk/core 1.0.3 → 1.2.0
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/README.md +72 -96
- package/dist/index.d.mts +2137 -1438
- package/dist/index.d.ts +2137 -1438
- package/dist/index.mjs +1 -1
- package/package.json +15 -17
package/dist/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{useStorage as M}from"@vueuse/core";import{z as m}from"zod/v4";const E=m.enum(["localStorage","sessionStorage"]);function j(e){return m.object({key:m.string().min(1,{message:"Key cannot be empty"}),schema:m.custom(t=>t instanceof m.ZodType,{message:"Schema must be a valid Zod schema"}),defaultValue:m.custom(t=>e.safeParse(t).success,{message:"Default value must match the provided schema"}),prefix:m.string().default("movk"),storage:E.default("localStorage")})}function T(e){const t=j(e.schema).parse(e),{key:n,defaultValue:r,schema:o,storage:c,prefix:i}=t,a=`${i}:${n}`,s=(()=>{if(!(typeof window>"u"))return c==="localStorage"?localStorage:sessionStorage})();function u(d){if(d===null)return r;try{const g=JSON.parse(d),y=o.safeParse(g);return y.success?y.data:(console.warn(`[AppStorage] Validation failed for key "${a}". Using default value.`,y.error.issues),r)}catch(g){return console.warn(`[AppStorage] Failed to parse value for key "${a}". Using default value.`,g),r}}const l=M(a,r,s,{mergeDefaults:!0,serializer:{read:u,write:d=>JSON.stringify(d)}});function f(){if(!s)return r;const d=s.getItem(a);return u(d)}function h(d){const g=o.safeParse(d);if(!g.success){console.warn(`[AppStorage] Invalid value for key "${a}". Aborting setItem.`,g.error.issues);return}l.value=g.data}function p(){s&&(l.value=null)}return{state:l,getItem:f,setItem:h,removeItem:p}}async function F(e){if(typeof e!="string")throw new TypeError("Text must be a string");if(typeof window>"u")return console.warn("useCopyCode: Not available in server environment"),!1;if(navigator.clipboard&&window.isSecureContext)try{return await navigator.clipboard.writeText(e),!0}catch(t){console.warn("Clipboard API failed, falling back to legacy method:",t)}try{return D(e)}catch(t){return console.error("Failed to copy text:",t),!1}}function D(e){if(typeof document>"u")return console.warn("copyTextLegacy: Document not available"),!1;const t=document.createElement("textarea"),n=document.activeElement,r=document.getSelection(),o=r&&r.rangeCount>0?r.getRangeAt(0):null;try{return t.value=e,t.setAttribute("readonly",""),t.setAttribute("contenteditable","true"),Object.assign(t.style,{contain:"strict",position:"absolute",left:"-9999px",top:"-9999px",fontSize:"12pt",border:"0",padding:"0",margin:"0",outline:"none",boxShadow:"none",background:"transparent"}),document.body.appendChild(t),t.focus(),t.select(),t.setSelectionRange&&t.setSelectionRange(0,e.length),document.execCommand("copy")}catch(c){return console.error("Legacy copy method failed:",c),!1}finally{t.parentNode&&document.body.removeChild(t),o&&r&&(r.removeAllRanges(),r.addRange(o)),n instanceof HTMLElement&&n.focus()}}function R(e){return[...new Set(e)]}function V(e,t){const n=[];for(let r=0;r<e.length;r+=t)n.push(e.slice(r,r+t));return n}function B(e,t=1){return t===1?e.flat():e.flat(t)}function z(e,t){let n;return(...r)=>{clearTimeout(n),n=setTimeout(()=>e(...r),t)}}function Z(e){return new Promise(t=>setTimeout(t,e))}function q(e){let t,n;return{promise:new Promise((r,o)=>{n=o,t=setTimeout(r,e)}),cancel:()=>{clearTimeout(t),n(new Error("Sleep was cancelled"))}}}function K(e,t){let n=!1;return function(...r){n||(e.apply(this,r),n=!0,setTimeout(()=>{n=!1},t))}}async function W(e){if(!e||typeof e!="string")throw new Error("Invalid SVG string provided");if(typeof window>"u"||typeof document>"u")throw new TypeError("convertSvgToPng is only available in browser environment");return new Promise((t,n)=>{const r=new Image,o=document.createElement("canvas"),c=o.getContext("2d");if(!c){n(new Error("Canvas context not available"));return}r.onload=()=>{try{o.width=r.width,o.height=r.height,c.drawImage(r,0,0),o.toBlob(i=>{i?t(i):n(new Error("Failed to convert canvas to Blob"))},"image/png")}catch(i){n(new Error(`Error during canvas conversion: ${i}`))}},r.onerror=()=>{n(new Error("Failed to load SVG image"))};try{r.src=`data:image/svg+xml;base64,${btoa(e)}`}catch(i){n(new Error(`Failed to encode SVG: ${i}`))}})}function H(e,t="file"){if(!e)return t;const n=e.get("content-disposition");if(n){const r=n.match(/filename\*?=(?:"([^"]+)"|([^;]+))/i);if(r){let o=r[1]??r[2];if(o.startsWith('"')&&o.endsWith('"')&&(o=o.slice(1,-1)),n.includes("filename*=")){const c=o.split("''");if(c.length===2)try{o=decodeURIComponent(c[1])}catch{return t}}return o}}return t}function J(e,t){if(typeof window>"u"||typeof document>"u"){console.warn("triggerDownload: Not available in server environment");return}const n=URL.createObjectURL(e),r=document.createElement("a");r.href=n,r.download=t,r.style.display="none",document.body.appendChild(r),r.click(),document.body.removeChild(r),URL.revokeObjectURL(n)}function X(e){if(!Number.isFinite(e)||e<0||e===0)return"0 Bytes";const t=1024,n=["Bytes","KB","MB","GB","TB","PB"],r=Math.floor(Math.log(e)/Math.log(t));return r>=n.length?`${Number.parseFloat((e/t**(n.length-1)).toFixed(2))} ${n[n.length-1]}`:`${Number.parseFloat((e/t**r).toFixed(2))} ${n[r]}`}async function Q(e,t){if(!e||typeof e!="string")throw new Error("Invalid SVG path provided");try{const n=await fetch(e);if(!n.ok)throw new Error(`Failed to fetch SVG file: ${n.status} ${n.statusText}`);const r=await n.text();if(!t)return r;if(typeof window>"u"||typeof DOMParser>"u")return console.warn("replaceCurrentColor: DOM manipulation not available in server environment, returning original SVG"),r;const o=new DOMParser().parseFromString(r,"image/svg+xml");if(o.querySelector("parsererror"))throw new Error("Invalid SVG content");const c=o.querySelector("svg");if(!c)throw new Error("No SVG element found in the document");c.hasAttribute("fill")||c.setAttribute("fill","currentColor");const i=a=>{a.getAttribute("fill")==="currentColor"&&a.setAttribute("fill",t),a.getAttribute("stroke")==="currentColor"&&a.setAttribute("stroke",t),Array.from(a.children).forEach(s=>{i(s)})};return i(c),new XMLSerializer().serializeToString(o)}catch(n){throw n instanceof Error?n:new Error(`Unexpected error occurred: ${n}`)}}function O(e,t=!1){if(!e||typeof e!="object"||Array.isArray(e))return e;const n=o=>o.replace(/([a-z\d])([A-Z])/g,"$1-$2").toLowerCase(),r={};for(const o in e)if(Object.prototype.hasOwnProperty.call(e,o)){const c=n(o),i=e[o];t&&i&&typeof i=="object"&&!Array.isArray(i)?r[c]=O(i,!0):r[c]=i}return r}function v(e,t=new WeakMap){if(e===null||typeof e!="object")return e;try{const a=globalThis.structuredClone;if(typeof a=="function")return a(e)}catch(a){console.error("Error occurred while cloning:",a)}const n=e,r=t.get(n);if(r)return r;if(e instanceof Date)return new Date(e.getTime());if(e instanceof RegExp)return new RegExp(e.source,e.flags);if(e instanceof Map){const a=new Map;t.set(n,a);for(const[s,u]of e.entries())a.set(v(s,t),v(u,t));return a}if(e instanceof Set){const a=new Set;t.set(n,a);for(const s of e.values())a.add(v(s,t));return a}if(e instanceof ArrayBuffer)return e.slice(0);if(ArrayBuffer.isView(e)){const a=e.constructor;return new a(e)}if(e instanceof URL)return new URL(e.toString());if(e instanceof Error){const a=new e.constructor(e.message);return a.name=e.name,a.stack=e.stack,a}if(Array.isArray(e)){const a=[];t.set(n,a);for(const s of e)a.push(v(s,t));return a}const o=Object.getPrototypeOf(e),c=Object.create(o);t.set(n,c);const i=[...Object.getOwnPropertyNames(e),...Object.getOwnPropertySymbols(e)];for(const a of i){const s=Object.getOwnPropertyDescriptor(e,a);s&&("value"in s&&(s.value=v(e[a],t)),Object.defineProperty(c,a,s))}return c}function Y(e,t){if(!e||typeof e!="object")return{};const n=new Set(t),r={};for(const o in e)Object.prototype.hasOwnProperty.call(e,o)&&!n.has(o)&&(r[o]=e[o]);return r}function _(e){return!e||typeof e!="object"||Array.isArray(e)?e:Object.fromEntries(Object.entries(e).filter(([,t])=>t!==void 0))}function k(e){return e!==null&&typeof e=="object"}function C(e){if(Array.isArray(e))return e.slice();const t=[];if(e==="")return t;let n=0;const r=e,o=r.length;function c(a){let s="",u=a;for(;u<o;){const l=r.charCodeAt(u);if(l===46)break;if(l===92){u++,u<o&&(s+=r[u]),u++;continue}if(l===91)break;s+=r[u],u++}return{value:s,next:u}}function i(a){let s=a+1;for(;s<o&&/\s/.test(r[s]);)s++;if(s>=o)throw new Error('Invalid path: missing closing "]"');const u=r[s];if(u==='"'||u==="'"){const h=u;s++;let p="",d=!1;for(;s<o;){if(r.charCodeAt(s)===92){s++,s<o&&(p+=r[s]),s++;continue}if(r[s]===h){d=!0,s++;break}p+=r[s],s++}if(!d)throw new Error("Invalid path: missing closing quote in bracket");for(;s<o&&/\s/.test(r[s]);)s++;if(s>=o||r[s]!=="]")throw new Error('Invalid path: missing closing "]"');return s++,{segment:p,next:s}}let l="";for(;s<o&&r[s]!=="]";)l+=r[s],s++;if(s>=o)throw new Error('Invalid path: missing closing "]"');const f=l.trim();return/^(?:0|[1-9]\d*)$/.test(f)?(s++,{segment:Number(f),next:s}):(s++,{segment:f,next:s})}for(;n<o;){const a=r.charCodeAt(n);if(a===46){n++;continue}if(a===91){const{segment:l,next:f}=i(n);l!==null&&t.push(l),n=f;continue}const{value:s,next:u}=c(n);(s.length>0||u<o&&r[u]===".")&&t.push(s),n=u}return t}function ee(e,t,n){const r=C(t);if(r.length===0)return e;let o=e;for(let c=0;c<r.length;c++){if(o==null)return n;const i=r[c];o=o[i]}return o===void 0?n:o}function te(e,t,n){const r=C(t);if(r.length===0)return e;let o=e;for(let c=0;c<r.length;c++){const i=r[c];if(c===r.length-1){o[i]=n;break}const a=r[c+1];let s=o[i];const u=typeof a=="number";if(k(s)?u&&!Array.isArray(s)&&(s=[],o[i]=s):(s=u?[]:{},o[i]=s),u&&Array.isArray(s)){const l=Number(a);Number.isInteger(l)&&l>=0&&s.length<=l&&(s.length=l+1)}o=s}return e}function re(e){let t="";for(let n=0;n<e.length;n++){const r=e[n];if(typeof r=="number"&&Number.isInteger(r)&&r>=0){t+=`[${r}]`;continue}const o=String(r),c=/^[A-Z_$][\w$]*$/i.test(o);if(t.length===0&&c){t+=o;continue}if(c){t+=`.${o}`;continue}const i=o.replace(/\\/g,"\\\\").replace(/'/g,"\\'");t+=`['${i}']`}return t}function ne(e,t){if(!e||typeof e!="object")return{};const n={};for(const r of t)Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=e[r]);return n}function oe(e,t){if(!e||typeof e!="object")return{picked:{},omitted:{}};if(t.length===0)return{picked:{},omitted:{...e}};const n=new Set(t),r={},o={};for(const c in e)if(Object.hasOwn(e,c)){const i=c;n.has(i)?r[c]=e[i]:o[c]=e[i]}return{picked:r,omitted:o}}function se(e,t){if(!e||typeof e!="object")return{...Object.fromEntries(Object.keys(t).map(c=>[c,{}])),others:{}};const n=Object.keys(t),r=new Map;for(const c of n){const i=new Set(t[c]);r.set(c,i)}const o=Object.create(null);for(const c of n)o[c]={};o.others={};for(const c in e)if(Object.hasOwn(e,c)){const i=c;let a=!1;for(const s of n)if(r.get(s).has(i)){o[s][c]=e[i],a=!0;break}a||(o.others[c]=e[i])}return o}function A(e){return e?e.replace(/[_-]/g," ").match(/[A-Z]{2,}(?=[A-Z][a-z]|\b)|[A-Z]?[a-z]+|\d+/g)||[]:[]}function ae(e){return e?A(e).map(t=>t.toUpperCase()===t&&t.length>1?t:t.charAt(0).toUpperCase()+t.slice(1).toLowerCase()).join(" "):""}function $(e){if(!e)return"";const t=A(e);return t.length===0?"":t.map((n,r)=>{const o=n.toLowerCase();return r===0?o:o.charAt(0).toUpperCase()+o.slice(1)}).join("")}function P(e){return e?A(e).map(t=>t.toLowerCase()).join("-"):""}function ie(e){return e?A(e).map(t=>t.toLowerCase()).join("_"):""}function ce(e){return e?A(e).map(t=>{const n=t.toLowerCase();return n.charAt(0).toUpperCase()+n.slice(1)}).join(""):""}function ue(e){return e?e.charAt(0).toUpperCase()+e.slice(1).toLowerCase():""}function le(e){return e?e.charAt(0).toUpperCase()+e.slice(1):""}function fe(e){return e?e.charAt(0).toLowerCase()+e.slice(1):""}function de(e){return e?A(e).map(t=>t.toUpperCase()).join(" "):""}function pe(e){return e?A(e).map(t=>t.toLowerCase()).join(" "):""}const he=P,ge=$,b=m.object({id:m.string().default("id"),pid:m.string().default("pid"),children:m.string().default("children")});m.object({total:m.number().int().nonnegative(),leaves:m.number().int().nonnegative(),depth:m.number().int().nonnegative(),branches:m.number().int().nonnegative()});class w{static*dfsGenerator(t,n={},r=[]){const{children:o}=b.parse(n);let c=0;for(const i of t){const a=[...r,i];yield{node:i,path:a,depth:r.length,index:c++};const s=i[o];s&&s.length>0&&(yield*w.dfsGenerator(s,n,a))}}static*bfsGenerator(t,n={}){const{children:r}=b.parse(n),o=t.map((i,a)=>({node:i,path:[i],depth:0,index:a}));let c=t.length;for(;o.length>0;){const i=o.shift();yield i;const a=i.node[r];a&&a.length>0&&a.forEach(s=>{const u=[...i.path,s];o.push({node:s,path:u,depth:i.depth+1,index:c++})})}}static selectStrategy(t){switch(t){case"find":case"findAll":case"filter":case"transform":case"forEach":case"stats":case"validate":return"dfs";default:return"dfs"}}static fromList(t,n={}){const r=b.parse(n),{id:o,pid:c,children:i}=r;if(!Array.isArray(t)||t.length===0)return[];const a=new Map,s=[];return t.forEach(u=>{const{[i]:l,...f}=u,h={...f,[i]:[]};a.set(u[o],h)}),t.forEach(u=>{const l=a.get(u[o]),f=u[c];f&&a.has(f)?a.get(f)[i].push(l):s.push(l)}),s}static toList(t,n={}){const r=b.parse(n),{children:o}=r,c=[],i=Array.isArray(t)?t:[t],a=s=>{const{[o]:u,...l}=s;c.push(l),u&&u.length>0&&u.forEach(a)};return i.forEach(a),c}static estimateSize(t,n={}){const r=b.parse(n),{children:o}=r,c=Array.isArray(t)?t:[t];let i=0;const a=s=>{i++;const u=s[o];u&&u.length>0&&u.forEach(a)};return c.forEach(a),i}static find(t,n,r={}){const o=Array.isArray(t)?t:[t],c=w.selectStrategy("find")==="dfs"?w.dfsGenerator(o,r):w.bfsGenerator(o,r);for(const i of c)if(n({node:i.node,depth:i.depth,path:i.path,index:i.index}))return i.node}static findAll(t,n,r={}){const o=Array.isArray(t)?t:[t],c=w.selectStrategy("findAll"),i=[],a=c==="dfs"?w.dfsGenerator(o,r):w.bfsGenerator(o,r);for(const s of a)n({node:s.node,depth:s.depth,path:s.path,index:s.index})&&i.push(s.node);return i}static findById(t,n,r={}){const o=b.parse(r),{id:c}=o;return this.find(t,({node:i})=>i[c]===n,r)}static getStats(t,n={}){const r=b.parse(n),{children:o}=r,c=Array.isArray(t)?t:[t];let i=0,a=0,s=0,u=0;const l=(f,h)=>{i++,s=Math.max(s,h);const p=f[o];p&&p.length>0?(u++,p.forEach(d=>l(d,h+1))):a++};return c.forEach(f=>l(f,1)),{total:i,leaves:a,depth:s,branches:u}}static filter(t,n,r={}){const o=b.parse(r),{children:c}=o,i=Array.isArray(t)?t:[t],a=[],s=(u,l,f,h=0)=>{const p=u[c],d=[];if(p&&p.length>0){const g=[...f,u];p.forEach((y,x)=>{const S=s(y,l+1,g,x);S&&d.push(S)})}if(n({node:u,depth:l,path:f,index:h})||d.length>0){const{[c]:g,...y}=u;return{...y,[c]:d}}return null};return i.forEach((u,l)=>{const f=s(u,0,[u],l);f&&a.push(f)}),a}static transform(t,n,r={}){const o=b.parse(r),{children:c}=o,i=Array.isArray(t)?t:[t],a=[],s=(u,l,f,h=0)=>{const p=u[c],d=[];if(p&&p.length>0){const S=[...f,u];p.forEach((U,G)=>{d.push(s(U,l+1,S,G))})}const g=n({node:u,depth:l,path:f,index:h}),{[c]:y,...x}=g;return{...x,[c]:d}};return i.forEach((u,l)=>{a.push(s(u,0,[u],l))}),a}static forEach(t,n,r={}){const o=Array.isArray(t)?t:[t],c=w.selectStrategy("forEach")==="dfs"?w.dfsGenerator(o,r):w.bfsGenerator(o,r);for(const i of c)if(n({node:i.node,depth:i.depth,path:i.path,index:i.index})===!1)break}static insertBefore(t,n,r,o={}){const c=b.parse(o),{id:i,children:a}=c,{[a]:s,...u}=r,l={...u,[a]:[]},f=(h,p)=>{for(let d=0;d<h.length;d++){const g=h[d];if(g[i]===n)return h.splice(d,0,l),!0;const y=g[a];if(y&&y.length>0){const x=[...p,g];if(f(y,x))return!0}}return!1};return f(t,[])}static insertAfter(t,n,r,o={}){const c=b.parse(o),{id:i,children:a}=c,{[a]:s,...u}=r,l={...u,[a]:[]},f=(h,p)=>{for(let d=0;d<h.length;d++){const g=h[d];if(g[i]===n)return h.splice(d+1,0,l),!0;const y=g[a];if(y&&y.length>0){const x=[...p,g];if(f(y,x))return!0}}return!1};return f(t,[])}static remove(t,n,r={}){const o=b.parse(r),{id:c,children:i}=o,a=s=>{for(let u=0;u<s.length;u++){const l=s[u];if(l[c]===n)return s.splice(u,1)[0];const f=l[i];if(f&&f.length>0){const h=a(f);if(h)return h}}};return a(t)}static validate(t,n={}){const r=b.parse(n),{id:o,children:c}=r,i=Array.isArray(t)?t:[t],a=[],s=new Set,u=(l,f,h)=>{const p=l[o];if(!p||typeof p!="string"){a.push(`Node at depth ${f} has invalid or missing ID`);return}if(s.has(p)){a.push(`Duplicate ID found: ${p}`);return}if(s.add(p),h.some(g=>g[o]===p)){a.push(`Circular reference detected for ID: ${p}`);return}const d=l[c];if(d!==void 0&&!Array.isArray(d)){a.push(`Node ${p} has invalid children property (not an array)`);return}if(d&&d.length>0){const g=[...h,l];d.forEach(y=>{u(y,f+1,g)})}};return i.forEach(l=>u(l,0,[])),{isValid:a.length===0,errors:a}}}function ye(e){let t=0;for(let n=0;n<e.length;n++){const r=e.charCodeAt(n);t=(t<<5)-t+r,t=t&t}return Math.abs(t).toString(36)}function me(){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)})}function I(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function L(e){return Array.isArray(e)}function N(e){return typeof e=="string"}function be(e){return typeof e=="number"&&!Number.isNaN(e)}function we(e){return typeof e=="function"}function Ae(e){return e==null?!0:L(e)||N(e)?e.length===0:I(e)?Object.keys(e).length===0:!1}function xe(e){return!!e&&typeof e=="object"&&!Array.isArray(e)&&Object.prototype.toString.call(e)==="[object Object]"}export{E as StorageTypeSchema,w as Tree,$ as camelCase,he as camelToKebab,ue as capitalize,V as chunk,W as convertSvgToPng,O as convertToKebabCase,j as createStorageConfigSchema,z as debounce,v as deepClone,H as extractFilename,B as flatten,X as formatFileSize,ee as getPath,me as getRandomUUID,L as isArray,Ae as isEmpty,we as isFunction,be as isNumber,I as isObject,xe as isPlainObject,N as isString,k as isValidContainer,re as joinPath,P as kebabCase,ge as kebabToCamel,pe as lowerCase,fe as lowerFirst,Y as omit,_ as omitUndefined,ce as pascalCase,ne as pick,Q as replaceCurrentColor,oe as separate,se as separateMany,te as setPath,ye as simpleHash,Z as sleep,q as sleepWithCancel,ie as snakeCase,ae as startCase,K as throttle,C as toPath,J as triggerDownload,R as unique,de as upperCase,le as upperFirst,T as useAppStorage,F as useCopyCode,A as words};
|
|
1
|
+
import{useStorage as H}from"@vueuse/core";function Z(e){const{key:t,defaultValue:r,storage:n="localStorage",prefix:i="movk"}=e,o=`${i}:${t}`,s=(()=>{if(!(typeof window>"u"))return n==="localStorage"?localStorage:sessionStorage})();function a(h){if(h===null)return r;try{return JSON.parse(h)}catch(p){return console.warn(`[AppStorage] Failed to parse value for key "${o}". Using default value.`,p),r}}const c=H(o,r,s,{mergeDefaults:!0,serializer:{read:a,write:h=>JSON.stringify(h)}});function u(){if(!s)return r;const h=s.getItem(o);return a(h)}function l(h){c.value=h}function f(){s&&(c.value=null)}return{state:c,getItem:u,setItem:l,removeItem:f}}async function K(e){if(typeof e!="string")throw new TypeError("Text must be a string");if(typeof window>"u")return console.warn("useCopyCode: Not available in server environment"),!1;if(navigator.clipboard&&window.isSecureContext)try{return await navigator.clipboard.writeText(e),!0}catch(t){console.warn("Clipboard API failed, falling back to legacy method:",t)}try{return J(e)}catch(t){return console.error("Failed to copy text:",t),!1}}function J(e){if(typeof document>"u")return console.warn("copyTextLegacy: Document not available"),!1;const t=document.createElement("textarea"),r=document.activeElement,n=document.getSelection(),i=n&&n.rangeCount>0?n.getRangeAt(0):null;try{return t.value=e,t.setAttribute("readonly",""),t.setAttribute("contenteditable","true"),Object.assign(t.style,{contain:"strict",position:"absolute",left:"-9999px",top:"-9999px",fontSize:"12pt",border:"0",padding:"0",margin:"0",outline:"none",boxShadow:"none",background:"transparent"}),document.body.appendChild(t),t.focus(),t.select(),t.setSelectionRange&&t.setSelectionRange(0,e.length),document.execCommand("copy")}catch(o){return console.error("Legacy copy method failed:",o),!1}finally{t.parentNode&&document.body.removeChild(t),i&&n&&(n.removeAllRanges(),n.addRange(i)),r instanceof HTMLElement&&r.focus()}}async function X(e){if(!e||typeof e!="string")throw new Error("Invalid SVG string provided");if(typeof window>"u"||typeof document>"u")throw new TypeError("convertSvgToPng is only available in browser environment");return new Promise((t,r)=>{const n=new Image,i=document.createElement("canvas"),o=i.getContext("2d");if(!o){r(new Error("Canvas context not available"));return}n.onload=()=>{try{i.width=n.width,i.height=n.height,o.drawImage(n,0,0),i.toBlob(s=>{s?t(s):r(new Error("Failed to convert canvas to Blob"))},"image/png")}catch(s){r(new Error(`Error during canvas conversion: ${s}`))}},n.onerror=()=>{r(new Error("Failed to load SVG image"))};try{n.src=`data:image/svg+xml;base64,${btoa(e)}`}catch(s){r(new Error(`Failed to encode SVG: ${s}`))}})}function Y(e,t="file"){if(!e)return t;const r=e.get("content-disposition");if(r){const n=r.match(/filename\*?=(?:"([^"]+)"|([^;]+))/i);if(n){let i=n[1]??n[2];if(!i)return t;if(i.startsWith('"')&&i.endsWith('"')&&(i=i.slice(1,-1)),r.includes("filename*=")){const o=i.split("''");if(o.length===2&&o[1])try{i=decodeURIComponent(o[1])}catch{return t}}return i}}return t}function ee(e){if(!Number.isFinite(e)||e<0||e===0)return"0 Bytes";const t=1024,r=["Bytes","KB","MB","GB","TB","PB"],n=Math.floor(Math.log(e)/Math.log(t));return n>=r.length?`${Number.parseFloat((e/t**(r.length-1)).toFixed(2))} ${r[r.length-1]}`:`${Number.parseFloat((e/t**n).toFixed(2))} ${r[n]}`}async function te(e,t){if(!e||typeof e!="string")throw new Error("Invalid SVG path provided");try{const r=await fetch(e);if(!r.ok)throw new Error(`Failed to fetch SVG file: ${r.status} ${r.statusText}`);const n=await r.text();if(!t)return n;if(typeof window>"u"||typeof DOMParser>"u")return console.warn("replaceCurrentColor: DOM manipulation not available in server environment, returning original SVG"),n;const i=new DOMParser().parseFromString(n,"image/svg+xml");if(i.querySelector("parsererror"))throw new Error("Invalid SVG content");const o=i.querySelector("svg");if(!o)throw new Error("No SVG element found in the document");o.hasAttribute("fill")||o.setAttribute("fill","currentColor");const s=a=>{a.getAttribute("fill")==="currentColor"&&a.setAttribute("fill",t),a.getAttribute("stroke")==="currentColor"&&a.setAttribute("stroke",t),Array.from(a.children).forEach(c=>{s(c)})};return s(o),new XMLSerializer().serializeToString(i)}catch(r){throw r instanceof Error?r:new Error(`Unexpected error occurred: ${r}`)}}function ne(e,t){if(typeof window>"u"||typeof document>"u"){console.warn("triggerDownload: Not available in server environment");return}const r=URL.createObjectURL(e),n=document.createElement("a");n.href=r,n.download=t,n.style.display="none",document.body.appendChild(n),n.click(),document.body.removeChild(n),URL.revokeObjectURL(r)}function w(e,t=new WeakMap){if(e===null||typeof e!="object")return e;try{const a=globalThis.structuredClone;if(typeof a=="function")return a(e)}catch(a){console.error("Error occurred while cloning:",a)}const r=e,n=t.get(r);if(n)return n;if(e instanceof Date)return new Date(e.getTime());if(e instanceof RegExp)return new RegExp(e.source,e.flags);if(e instanceof Map){const a=new Map;t.set(r,a);for(const[c,u]of e.entries())a.set(w(c,t),w(u,t));return a}if(e instanceof Set){const a=new Set;t.set(r,a);for(const c of e.values())a.add(w(c,t));return a}if(e instanceof ArrayBuffer)return e.slice(0);if(ArrayBuffer.isView(e)){const a=e.constructor;return new a(e)}if(e instanceof URL)return new URL(e.toString());if(e instanceof Error){const a=new e.constructor(e.message);return a.name=e.name,a.stack=e.stack,a}if(Array.isArray(e)){const a=[];t.set(r,a);for(const c of e)a.push(w(c,t));return a}const i=Object.getPrototypeOf(e),o=Object.create(i);t.set(r,o);const s=[...Object.getOwnPropertyNames(e),...Object.getOwnPropertySymbols(e)];for(const a of s){const c=Object.getOwnPropertyDescriptor(e,a);c&&("value"in c&&(c.value=w(e[a],t)),Object.defineProperty(o,a,c))}return o}function v(e){return!!e&&typeof e=="object"&&!Array.isArray(e)&&Object.prototype.toString.call(e)==="[object Object]"}const re=new Set(["__proto__","constructor"]);function oe(e){return{arrayStrategy:e?.arrayStrategy??"concat",nullHandling:e?.nullHandling??"skip",customMerger:e?.customMerger}}function ie(e){return[...Object.keys(e),...Object.getOwnPropertySymbols(e).filter(t=>Object.prototype.propertyIsEnumerable.call(e,t))]}function $(e,t,r,n,i){const o={...e};for(const s of ie(t)){if(typeof s=="string"&&re.has(s))continue;const a=o[s],c=t[s];if(r.customMerger){const u=r.customMerger(s,a,c,n);if(u!==void 0){o[s]=u;continue}}if(c==null){if(r.nullHandling==="skip"&&s in o)continue;o[s]=c;continue}if(Array.isArray(c)){if(Array.isArray(a))switch(r.arrayStrategy){case"replace":o[s]=[...c];break;case"unique":o[s]=[...new Set([...a,...c])];break;case"concat":default:o[s]=[...a,...c];break}else o[s]=[...c];continue}if(v(c)){if(i.has(c)){o[s]=i.get(c);continue}const u=[...n,s],l={};if(i.set(c,l),v(a)){const f=$(a,c,r,u,i);Object.assign(l,f),o[s]=l}else{const f=$({},c,r,u,i);Object.assign(l,f),o[s]=l}continue}o[s]=c}return o}function R(e,t){if(!Array.isArray(e))return{};const r=oe(t),n=e.filter(v);if(n.length===0)return{};const i=new WeakMap;return n.reduce((o,s)=>$(o,s,r,[],i),{})}function se(e){return t=>R(t,e)}function ce(e,t){if(!e||typeof e!="object")return{};const r=new Set(t),n={};for(const i in e)Object.prototype.hasOwnProperty.call(e,i)&&!r.has(i)&&(n[i]=e[i]);return n}function ae(e){return!e||typeof e!="object"||Array.isArray(e)?e:Object.fromEntries(Object.entries(e).filter(([,t])=>t!==void 0))}function ue(e,t){if(!e||typeof e!="object")return{};const r={};for(const n of t)Object.prototype.hasOwnProperty.call(e,n)&&(r[n]=e[n]);return r}function le(e,t){if(!e||typeof e!="object")return{picked:{},omitted:{}};if(t.length===0)return{picked:{},omitted:{...e}};const r=new Set(t),n={},i={};for(const o in e)if(Object.hasOwn(e,o)){const s=o;r.has(s)?n[o]=e[s]:i[o]=e[s]}return{picked:n,omitted:i}}function fe(e,t){if(!e||typeof e!="object")return{...Object.fromEntries(Object.keys(t).map(o=>[o,{}])),others:{}};const r=Object.keys(t),n=new Map;for(const o of r){const s=new Set(t[o]);n.set(o,s)}const i=Object.create(null);for(const o of r)i[o]={};i.others={};for(const o in e)if(Object.hasOwn(e,o)){const s=o;let a=!1;for(const c of r)if(n.get(c).has(s)){i[c][o]=e[s],a=!0;break}a||(i.others[o]=e[s])}return i}function j(e){if(Array.isArray(e))return e.slice();const t=[];if(e==="")return t;let r=0;const n=e,i=n.length;function o(a){let c="",u=a;for(;u<i;){const l=n.charCodeAt(u);if(l===46)break;if(l===92){u++,u<i&&(c+=n[u]),u++;continue}if(l===91)break;c+=n[u],u++}return{value:c,next:u}}function s(a){let c=a+1;for(;c<i&&/\s/.test(n[c]);)c++;if(c>=i)throw new Error('Invalid path: missing closing "]"');const u=n[c];if(u==='"'||u==="'"){const h=u;c++;let p="",d=!1;for(;c<i;){if(n.charCodeAt(c)===92){c++,c<i&&(p+=n[c]),c++;continue}if(n[c]===h){d=!0,c++;break}p+=n[c],c++}if(!d)throw new Error("Invalid path: missing closing quote in bracket");for(;c<i&&/\s/.test(n[c]);)c++;if(c>=i||n[c]!=="]")throw new Error('Invalid path: missing closing "]"');return c++,{segment:p,next:c}}let l="";for(;c<i&&n[c]!=="]";)l+=n[c],c++;if(c>=i)throw new Error('Invalid path: missing closing "]"');const f=l.trim();return/^(?:0|[1-9]\d*)$/.test(f)?(c++,{segment:Number(f),next:c}):(c++,{segment:f,next:c})}for(;r<i;){const a=n.charCodeAt(r);if(a===46){r++;continue}if(a===91){const{segment:l,next:f}=s(r);l!==null&&t.push(l),r=f;continue}const{value:c,next:u}=o(r);(c.length>0||u<i&&n[u]===".")&&t.push(c),r=u}return t}function he(e,t,r){const n=j(t);if(n.length===0)return e;let i=e;for(let o=0;o<n.length;o++){if(i==null)return r;const s=n[o];i=i[s]}return i===void 0?r:i}function pe(e){let t="";for(let r=0;r<e.length;r++){const n=e[r];if(typeof n=="number"&&Number.isInteger(n)&&n>=0){t+=`[${n}]`;continue}const i=String(n),o=/^[A-Z_$][\w$]*$/i.test(i);if(t.length===0&&o){t+=i;continue}if(o){t+=`.${i}`;continue}const s=i.replace(/\\/g,"\\\\").replace(/'/g,"\\'");t+=`['${s}']`}return t}function I(e){return e!==null&&typeof e=="object"}function de(e,t,r){const n=j(t);if(n.length===0)return e;let i=e;for(let o=0;o<n.length;o++){const s=n[o];if(o===n.length-1){i[s]=r;break}const a=n[o+1];let c=i[s];const u=typeof a=="number";if(I(c)?u&&!Array.isArray(c)&&(c=[],i[s]=c):(c=u?[]:{},i[s]=c),u&&Array.isArray(c)){const l=Number(a);Number.isInteger(l)&&l>=0&&c.length<=l&&(c.length=l+1)}i=c}return e}function ge(e){let t=0;for(let r=0;r<e.length;r++){const n=e.charCodeAt(r);t=(t<<5)-t+n,t=t&t}return Math.abs(t).toString(36)}function me(){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)})}function P(e,t=!1){if(!e||typeof e!="object"||Array.isArray(e))return e;const r=i=>i.replace(/([a-z\d])([A-Z])/g,"$1-$2").toLowerCase(),n={};for(const i in e)if(Object.prototype.hasOwnProperty.call(e,i)){const o=r(i),s=e[i];t&&s&&typeof s=="object"&&!Array.isArray(s)?n[o]=P(s,!0):n[o]=s}return n}function E(e){return e?e.replace(/[_-]/g," ").match(/[A-Z]{2,}(?=[A-Z][a-z]|\b)|[A-Z]?[a-z]+|\d+/g)||[]:[]}function b(e,t){if(!e)return"";const r=E(e);return r.length===0?"":r.map((n,i)=>{const o=n.toLowerCase(),s=n.toUpperCase();if(t.transform)return t.transform(n,i,o,s);switch(t.casing){case"lower":return o;case"upper":return s;case"capitalize":return o.charAt(0).toUpperCase()+o.slice(1);default:return n}}).join(t.separator??"")}function L(e,t){if(!e)return"";const r=e.charAt(0);return(t?r.toUpperCase():r.toLowerCase())+e.slice(1)}function ye(e){return b(e,{separator:"",transform:(t,r,n)=>r===0?n:n.charAt(0).toUpperCase()+n.slice(1)})}function we(e){return e?e.charAt(0).toUpperCase()+e.slice(1).toLowerCase():""}function be(e){return b(e,{separator:"-",casing:"lower"})}function Ae(e){return b(e,{separator:" ",casing:"lower"})}function xe(e){return L(e,!1)}function ve(e){return b(e,{separator:"",casing:"capitalize"})}function Se(e){return b(e,{separator:"_",casing:"lower"})}function Ce(e){return e?E(e).map(t=>t.toUpperCase()===t&&t.length>1?t:t.charAt(0).toUpperCase()+t.slice(1).toLowerCase()).join(" "):""}function $e(e){return b(e,{separator:" ",casing:"upper"})}function je(e){return L(e,!0)}const U={id:"id",pid:"pid",children:"children"};function g(e={}){return{id:e.id??U.id,pid:e.pid??U.pid,children:e.children??U.children}}function*S(e,t={},r=[]){const{children:n}=g(t);let i=0;for(const o of e){const s=[...r,o];yield{node:o,path:s,depth:r.length,index:i++};const a=o[n];a&&a.length>0&&(yield*S(a,t,s))}}function*O(e,t={}){const{children:r}=g(t),n=e.map((o,s)=>({node:o,path:[o],depth:0,index:s}));let i=e.length;for(;n.length>0;){const o=n.shift();yield o;const s=o.node[r];s&&s.length>0&&s.forEach(a=>{const c=[...o.path,a];n.push({node:a,path:c,depth:o.depth+1,index:i++})})}}function k(e){switch(e){case"find":case"findAll":case"filter":case"transform":case"forEach":case"stats":case"validate":return"dfs";default:return"dfs"}}function Ee(e,t={}){const{id:r,pid:n,children:i}=g(t);if(!Array.isArray(e)||e.length===0)return[];const o=new Map,s=[];return e.forEach(a=>{const{[i]:c,...u}=a,l={...u,[i]:[]};o.set(a[r],l)}),e.forEach(a=>{const c=o.get(a[r]),u=a[n];u&&o.has(u)?o.get(u)[i].push(c):s.push(c)}),s}function Ue(e,t={}){const{children:r}=g(t),n=[],i=Array.isArray(e)?e:[e],o=s=>{const{[r]:a,...c}=s;n.push(c),a&&a.length>0&&a.forEach(o)};return i.forEach(o),n}function Oe(e,t={}){const{children:r}=g(t),n=Array.isArray(e)?e:[e];let i=0;const o=s=>{i++;const a=s[r];a&&a.length>0&&a.forEach(o)};return n.forEach(o),i}function ke(e,t,r,n={}){const{id:i,children:o}=g(n),{[o]:s,...a}=r,c={...a,[o]:[]},u=(l,f)=>{for(let h=0;h<l.length;h++){const p=l[h];if(!p)continue;if(p[i]===t)return l.splice(h,0,c),!0;const d=p[o];if(d&&d.length>0){const y=[...f,p];if(u(d,y))return!0}}return!1};return u(e,[])}function Re(e,t,r,n={}){const{id:i,children:o}=g(n),{[o]:s,...a}=r,c={...a,[o]:[]},u=(l,f)=>{for(let h=0;h<l.length;h++){const p=l[h];if(!p)continue;if(p[i]===t)return l.splice(h+1,0,c),!0;const d=p[o];if(d&&d.length>0){const y=[...f,p];if(u(d,y))return!0}}return!1};return u(e,[])}function Ie(e,t,r={}){const{id:n,children:i}=g(r),o=s=>{for(let a=0;a<s.length;a++){const c=s[a];if(!c)continue;if(c[n]===t)return s.splice(a,1)[0];const u=c[i];if(u&&u.length>0){const l=o(u);if(l)return l}}};return o(e)}function T(e,t,r={}){const n=Array.isArray(e)?e:[e],i=k("find")==="dfs"?S(n,r):O(n,r);for(const o of i)if(t({node:o.node,depth:o.depth,path:o.path,index:o.index}))return o.node}function Pe(e,t,r={}){const n=Array.isArray(e)?e:[e],i=k("findAll"),o=[],s=i==="dfs"?S(n,r):O(n,r);for(const a of s)t({node:a.node,depth:a.depth,path:a.path,index:a.index})&&o.push(a.node);return o}function Le(e,t,r={}){const{id:n}=g(r);return T(e,({node:i})=>i[n]===t,r)}function Te(e,t,r={}){const{children:n}=g(r),i=Array.isArray(e)?e:[e],o=[],s=(a,c,u,l=0)=>{const f=a[n],h=[];if(f&&f.length>0){const p=[...u,a];f.forEach((d,y)=>{const x=s(d,c+1,p,y);x&&h.push(x)})}if(t({node:a,depth:c,path:u,index:l})||h.length>0){const{[n]:p,...d}=a;return{...d,[n]:h}}return null};return i.forEach((a,c)=>{const u=s(a,0,[a],c);u&&o.push(u)}),o}function Me(e,t,r={}){const{children:n}=g(r),i=Array.isArray(e)?e:[e],o=[],s=(a,c,u,l=0)=>{const f=a[n],h=[];if(f&&f.length>0){const x=[...u,a];f.forEach((_,q)=>{h.push(s(_,c+1,x,q))})}const p=t({node:a,depth:c,path:u,index:l}),{[n]:d,...y}=p;return{...y,[n]:h}};return i.forEach((a,c)=>{o.push(s(a,0,[a],c))}),o}function Ne(e,t,r={}){const n=Array.isArray(e)?e:[e],i=k("forEach")==="dfs"?S(n,r):O(n,r);for(const o of i)if(t({node:o.node,depth:o.depth,path:o.path,index:o.index})===!1)break}function Fe(e,t={}){const{children:r}=g(t),n=Array.isArray(e)?e:[e];let i=0,o=0,s=0,a=0;const c=(u,l)=>{i++,s=Math.max(s,l);const f=u[r];f&&f.length>0?(a++,f.forEach(h=>c(h,l+1))):o++};return n.forEach(u=>c(u,1)),{total:i,leaves:o,depth:s,branches:a}}function De(e,t={}){const{id:r,children:n}=g(t),i=Array.isArray(e)?e:[e],o=[],s=new Set,a=(c,u,l)=>{const f=c[r];if(!f||typeof f!="string"){o.push(`Node at depth ${u} has invalid or missing ID`);return}if(s.has(f)){o.push(`Duplicate ID found: ${f}`);return}if(s.add(f),l.some(p=>p[r]===f)){o.push(`Circular reference detected for ID: ${f}`);return}const h=c[n];if(h!==void 0&&!Array.isArray(h)){o.push(`Node ${f} has invalid children property (not an array)`);return}if(h&&h.length>0){const p=[...l,c];h.forEach(d=>{a(d,u+1,p)})}};return i.forEach(c=>a(c,0,[])),{isValid:o.length===0,errors:o}}class ze{static fromList=Ee;static toList=Ue;static estimateSize=Oe;static find=T;static findAll=Pe;static findById=Le;static insertBefore=ke;static insertAfter=Re;static remove=Ie;static filter=Te;static transform=Me;static forEach=Ne;static getStats=Fe;static validate=De}function Be(e,t){const r=[];for(let n=0;n<e.length;n+=t)r.push(e.slice(n,n+t));return r}function We(e,t=1){return t===1?e.flat():e.flat(t)}function Ve(e){return[...new Set(e)]}function Ge(e,t){let r;return(...n)=>{clearTimeout(r),r=setTimeout(()=>e(...n),t)}}function Qe(e){return new Promise(t=>setTimeout(t,e))}function _e(e){let t,r;return{promise:new Promise((n,i)=>{r=i,t=setTimeout(n,e)}),cancel:()=>{clearTimeout(t),r(new Error("Sleep was cancelled"))}}}function qe(e,t){let r=!1;return function(...n){r||(e.apply(this,n),r=!0,setTimeout(()=>{r=!1},t))}}function m(e,t){if(!e)return null;try{const r=t?new URL(e,t):new URL(e);return{href:r.href,protocol:r.protocol,host:r.host,hostname:r.hostname,port:r.port,pathname:r.pathname,search:r.search,hash:r.hash,auth:r.username?`${r.username}${r.password?`:${r.password}`:""}`:"",origin:r.origin}}catch{return null}}function He(e){if(!e)return!1;try{return!!new URL(e)}catch{return!1}}function M(e){return e?e.startsWith("//")?!0:/^[a-z][a-z0-9+.-]*:/i.test(e):!1}function Ze(e){return e?!M(e):!1}function N(e){return m(e)?.hostname??""}function Ke(e){const t=N(e);if(!t)return"";const r=["co.uk","co.jp","co.kr","co.nz","co.za","co.in","com.au","com.br","com.cn","com.tw","com.hk","com.sg","org.uk","org.au","net.au","net.cn","gov.uk","gov.au","edu.au","edu.cn","ac.uk","ac.jp"],n=t.split(".");if(n.length>=3){const i=n.slice(-2).join(".");if(r.includes(i))return n.slice(-3).join(".")}return n.length>=2?n.slice(-2).join("."):t}function Je(e){const t=m(e);if(!t)return"";const r=t.pathname.split("/").pop()||"",n=r.lastIndexOf(".");return n===-1||n===0?"":r.slice(n+1).toLowerCase()}function Xe(e,t=!0){const r=m(e);if(!r)return"";const n=r.pathname.split("/").pop()||"";if(!n||n==="/")return"";if(t)return n;const i=n.lastIndexOf(".");return i>0?n.slice(0,i):n}function A(e){if(!e)return{};const t=e.startsWith("?")?e.slice(1):e;if(!t)return{};const r={},n=new URLSearchParams(t);for(const[i,o]of n.entries()){const s=r[i];s!==void 0?Array.isArray(s)?s.push(o):r[i]=[s,o]:r[i]=o}return r}function C(e,t={}){const{skipNull:r=!1,skipEmpty:n=!1,arrayFormat:i="repeat"}=t,o=[];for(const[s,a]of Object.entries(e)){if(a==null){if(r)continue;o.push(`${encodeURIComponent(s)}=`);continue}if(Array.isArray(a)){const u=a.filter(l=>l==null?!r:l===""?!n:!0);if(u.length===0)continue;switch(i){case"bracket":for(const l of u)o.push(`${encodeURIComponent(s)}[]=${encodeURIComponent(String(l??""))}`);break;case"index":u.forEach((l,f)=>{o.push(`${encodeURIComponent(s)}[${f}]=${encodeURIComponent(String(l??""))}`)});break;case"comma":o.push(`${encodeURIComponent(s)}=${u.map(l=>encodeURIComponent(String(l??""))).join(",")}`);break;default:for(const l of u)o.push(`${encodeURIComponent(s)}=${encodeURIComponent(String(l??""))}`)}continue}const c=String(a);c===""&&n||o.push(`${encodeURIComponent(s)}=${encodeURIComponent(c)}`)}return o.join("&")}function Ye(e,t){if(!e||!t)return null;try{return new URL(e,"http://localhost").searchParams.get(t)}catch{const r=e.indexOf("?");if(r===-1)return null;const n=A(e.slice(r))[t];return Array.isArray(n)?n[0]??null:n??null}}function et(e,t){if(!e||!t)return[];try{return new URL(e,"http://localhost").searchParams.getAll(t)}catch{const r=e.indexOf("?");if(r===-1)return[];const n=A(e.slice(r))[t];return n?Array.isArray(n)?n:[n]:[]}}function F(e,t,r){if(!e||!t)return e;try{const n=new URL(e);return r==null?n.searchParams.delete(t):n.searchParams.set(t,String(r)),n.toString()}catch{const n=e.indexOf("#"),i=n!==-1?e.slice(n+1):"",o=n!==-1?e.slice(0,n):e,s=o.indexOf("?"),a=s!==-1?o.slice(0,s):o,c=s!==-1?o.slice(s+1):"",u=A(c);r==null?delete u[t]:u[t]=String(r);const l=C(u);let f=a;return l&&(f+=`?${l}`),i&&(f+=`#${i}`),f}}function tt(e,t){let r=e;for(const[n,i]of Object.entries(t))if(Array.isArray(i)){r=z(r,n);for(const o of i)r=D(r,n,o)}else r=F(r,n,i);return r}function D(e,t,r){if(!e||!t||r===null||r===void 0)return e;try{const n=new URL(e);return n.searchParams.append(t,String(r)),n.toString()}catch{const[n,i]=e.split("?"),[o,s]=(i||"").split("#"),a=o?"&":"",c=`${encodeURIComponent(t)}=${encodeURIComponent(String(r))}`;let u=n||"";return u+=`?${o||""}${a}${c}`,s&&(u+=`#${s}`),u}}function z(e,t){if(!e||!t)return e;try{const r=new URL(e);return r.searchParams.delete(t),r.toString()}catch{const[r,n]=e.split("?"),[i,o]=(n||"").split("#"),s=A(i||"");delete s[t];const a=C(s);let c=r||"";return a&&(c+=`?${a}`),o&&(c+=`#${o}`),c}}function nt(e,t){if(!e||!t)return!1;try{return new URL(e,"http://localhost").searchParams.has(t)}catch{const r=e.indexOf("?");if(r===-1)return!1;const n=A(e.slice(r));return t in n}}function B(...e){if(e.length===0)return"";const t=e.filter(n=>n!=null&&n!=="");if(t.length===0)return"";let r=t[0];for(let n=1;n<t.length;n++){const i=t[n],o=r.endsWith("/"),s=i.startsWith("/");o&&s?r+=i.slice(1):!o&&!s?r+=`/${i}`:r+=i}return r}function rt(e){if(!e)return"";const t=m(e);if(t){const i=W(t.pathname);return`${t.origin}${i}${t.search}${t.hash}`}const[r,n]=e.split(/(?=[?#])/);return W(r||"")+(n||"")}function W(e){if(!e)return"";const t=e.startsWith("/"),r=e.endsWith("/")&&e.length>1,n=e.split("/").filter(Boolean),i=[];for(const s of n)if(s!=="."){if(s===".."){i.pop();continue}i.push(s)}let o=i.join("/");return t&&(o=`/${o}`),r&&o!=="/"&&(o+="/"),o||(t?"/":"")}function ot(e){if(!e)return"";const[t,...r]=e.split(/(?=[?#])/);return t?(t.length>1&&t.endsWith("/")?t.slice(0,-1):t)+r.join(""):e}function it(e){if(!e)return"/";const t=e.search(/[?#]/),r=t===-1?e:e.slice(0,t),n=t===-1?"":e.slice(t);return r?(r.endsWith("/")?r:`${r}/`)+n:`/${n}`}function st(e){return e?e.replace(/^\/+/,""):""}function ct(e){return e?e.startsWith("/")?e:`/${e}`:"/"}function at(e,t,r,n){let i=e;if(t&&(i=B(i,t)),r&&Object.keys(r).length>0){const o=C(r);o&&(i+=(i.includes("?")?"&":"?")+o)}if(n){const o=n.startsWith("#")?n:`#${n}`;i+=o}return i}function ut(e){if(!e)return"";try{return decodeURIComponent(e)}catch{return e}}function lt(e){if(!e)return"";try{return encodeURIComponent(e)}catch{return e}}function ft(e,t){const r=m(e),n=m(t);return!r||!n?!1:r.origin===n.origin}function ht(e,t){if(!e)return t;try{return new URL(e,t).href}catch{return e}}function pt(e,t){const r=m(e),n=m(t);if(!r||!n||r.origin!==n.origin)return t;const i=r.pathname.split("/").filter(Boolean),o=n.pathname.split("/").filter(Boolean);let s=0;const a=Math.min(i.length,o.length);for(let h=0;h<a&&i[h]===o[h];h++)s++;const c=i.length-s,u=o.slice(s),l=[];for(let h=0;h<c;h++)l.push("..");l.push(...u);let f=l.join("/")||".";return n.search&&(f+=n.search),n.hash&&(f+=n.hash),f}function V(e){return Array.isArray(e)}function G(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function Q(e){return typeof e=="string"}function dt(e){return e==null?!0:V(e)||Q(e)?e.length===0:G(e)?Object.keys(e).length===0:!1}function gt(e){return typeof e=="function"}function mt(e){return typeof e=="number"&&!Number.isNaN(e)}export{ze as Tree,D as appendQueryParam,at as buildUrl,ye as camelCase,we as capitalize,Be as chunk,X as convertSvgToPng,P as convertToKebabCase,se as createDeepMerge,Ge as debounce,w as deepClone,R as deepMerge,ct as ensureLeadingSlash,it as ensureTrailingSlash,Y as extractFilename,We as flatten,ee as formatFileSize,N as getDomain,he as getPath,Ye as getQueryParam,et as getQueryParams,me as getRandomUUID,pt as getRelativePath,Ke as getRootDomain,Je as getUrlExtension,Xe as getUrlFilename,nt as hasQueryParam,M as isAbsoluteUrl,V as isArray,dt as isEmpty,gt as isFunction,mt as isNumber,G as isObject,v as isPlainObject,Ze as isRelativeUrl,ft as isSameOrigin,Q as isString,I as isValidContainer,He as isValidUrl,pe as joinPath,B as joinUrl,be as kebabCase,Ae as lowerCase,xe as lowerFirst,rt as normalizeUrl,ce as omit,ae as omitUndefined,A as parseQuery,m as parseUrl,ve as pascalCase,ue as pick,st as removeLeadingSlash,z as removeQueryParam,ot as removeTrailingSlash,te as replaceCurrentColor,ut as safeDecodeURIComponent,lt as safeEncodeURIComponent,le as separate,fe as separateMany,de as setPath,F as setQueryParam,tt as setQueryParams,ge as simpleHash,Qe as sleep,_e as sleepWithCancel,Se as snakeCase,Ce as startCase,C as stringifyQuery,qe as throttle,ht as toAbsoluteUrl,j as toPath,ne as triggerDownload,Ve as unique,$e as upperCase,je as upperFirst,Z as useAppStorage,K as useCopyCode,E as words};
|
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@movk/core",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.0
|
|
5
|
-
"packageManager": "pnpm@10.
|
|
6
|
-
"description": "
|
|
4
|
+
"version": "1.2.0",
|
|
5
|
+
"packageManager": "pnpm@10.30.3",
|
|
6
|
+
"description": "为 TypeScript 项目设计的现代化、支持 Tree-Shaking 的工具函数库。",
|
|
7
7
|
"author": "YiXuan <mhaibaraai@gmail.com>",
|
|
8
8
|
"license": "MIT",
|
|
9
9
|
"homepage": "https://core.mhaibaraai.cn",
|
|
@@ -38,13 +38,13 @@
|
|
|
38
38
|
"scripts": {
|
|
39
39
|
"build": "unbuild",
|
|
40
40
|
"dev": "unbuild --stub",
|
|
41
|
-
"docs": "cd docs &&
|
|
42
|
-
"docs:build": "cd docs &&
|
|
41
|
+
"docs": "cd docs && pnpm dev",
|
|
42
|
+
"docs:build": "cd docs && pnpm build",
|
|
43
43
|
"lint": "eslint .",
|
|
44
44
|
"lint:fix": "eslint . --fix",
|
|
45
|
-
"prepack": "
|
|
45
|
+
"prepack": "pnpm build",
|
|
46
46
|
"release": "release-it && npm publish",
|
|
47
|
-
"typecheck": "tsc --noEmit && cd docs &&
|
|
47
|
+
"typecheck": "tsc --noEmit && cd docs && pnpm typecheck",
|
|
48
48
|
"test": "vitest",
|
|
49
49
|
"clean": "node bin/clean.mjs"
|
|
50
50
|
},
|
|
@@ -52,19 +52,17 @@
|
|
|
52
52
|
"vue": "^3.5.25"
|
|
53
53
|
},
|
|
54
54
|
"dependencies": {
|
|
55
|
-
"@vueuse/core": "^14.1
|
|
56
|
-
"fast-glob": "^3.3.3"
|
|
57
|
-
"zod": "^4.2.1"
|
|
55
|
+
"@vueuse/core": "^14.2.1",
|
|
56
|
+
"fast-glob": "^3.3.3"
|
|
58
57
|
},
|
|
59
58
|
"devDependencies": {
|
|
60
|
-
"@antfu/eslint-config": "^6.
|
|
61
|
-
"@
|
|
62
|
-
"@
|
|
63
|
-
"
|
|
64
|
-
"
|
|
65
|
-
"release-it": "^19.2.1",
|
|
59
|
+
"@antfu/eslint-config": "^7.6.1",
|
|
60
|
+
"@release-it/conventional-changelog": "^10.0.5",
|
|
61
|
+
"@types/node": "^25.3.3",
|
|
62
|
+
"eslint": "^10.0.2",
|
|
63
|
+
"release-it": "^19.2.4",
|
|
66
64
|
"typescript": "^5.9.3",
|
|
67
65
|
"unbuild": "^3.6.1",
|
|
68
|
-
"vitest": "^4.0.
|
|
66
|
+
"vitest": "^4.0.18"
|
|
69
67
|
}
|
|
70
68
|
}
|