minimal-shared 1.0.14 → 1.0.15

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/index.cjs CHANGED
@@ -1,2 +1,2 @@
1
- "use strict";var D=Object.defineProperty;var X=Object.getOwnPropertyDescriptor;var Z=Object.getOwnPropertyNames;var ee=Object.prototype.hasOwnProperty;var te=(e,t)=>{for(var n in t)D(e,n,{get:t[n],enumerable:!0})},ne=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Z(t))!ee.call(e,o)&&o!==n&&D(e,o,{get:()=>t[o],enumerable:!(r=X(t,o))||r.enumerable});return e};var oe=e=>ne(D({},"__esModule",{value:!0}),e);var $e={};te($e,{createPaletteChannel:()=>ue,getCookie:()=>j,getStorage:()=>N,hasKeys:()=>fe,hasParams:()=>P,hexToRgbChannel:()=>Y,isActiveLink:()=>Te,isEqualPath:()=>re,isExternalLink:()=>H,localStorageAvailable:()=>q,mergeClasses:()=>me,mergeRefs:()=>se,parseCssVar:()=>ge,pxToRem:()=>le,remToPx:()=>ae,removeCookie:()=>F,removeLastSlash:()=>y,removeParams:()=>$,removeStorage:()=>B,setCookie:()=>w,setFont:()=>ie,setStorage:()=>k,transformNumber:()=>he,transformValue:()=>W,transformValueOnBlur:()=>K,transformValueOnChange:()=>G,updateSelectedItems:()=>Q,useBackToTop:()=>Ee,useBoolean:()=>Se,useClientRect:()=>ke,useCookies:()=>ye,useCopyToClipboard:()=>Pe,useCountdownDate:()=>Le,useCountdownSeconds:()=>De,useDebounce:()=>ve,useDoubleClick:()=>Oe,useIsClient:()=>Re,useLocalStorage:()=>Me,useMultiSelect:()=>Ue,usePopover:()=>xe,usePopoverHover:()=>Ve,useScrollOffsetTop:()=>Ae,useSetState:()=>Ce,useTabs:()=>be,uuidv4:()=>de,varAlpha:()=>pe});module.exports=oe($e);var z=require("es-toolkit");function P(e){try{let t=new URL(e,window.location.origin);return Array.from(t.searchParams.keys()).length>0}catch{return!1}}function y(e){return e!=="/"&&e.endsWith("/")?e.slice(0,-1):e}function re(e,t,n={deep:!0}){let r=o=>{try{let{pathname:s,searchParams:i}=new URL(o.trim(),"http://dummy");return n.deep?{pathname:y(s),params:Object.fromEntries(i)}:{pathname:y(s)}}catch{return{pathname:""}}};return(0,z.isEqual)(r(t),r(e))}function $(e){try{let t=new URL(e,window.location.origin);return y(t.pathname)}catch{return e}}function H(e){return/^https?:\/\//i.test(e)}function se(e){return t=>{if(e.length!==0)for(let n of e)n&&(typeof n=="function"?n(t):"current"in n&&(n.current=t))}}var J='-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"';function ie(e){return e?`"${e}", ${J}`:J}function ae(e){let t=parseFloat(e);return Math.round(t*16)}function le(e){if(typeof e!="number"||isNaN(e))throw new Error(`Invalid pixel value: ${e}`);return`${e/16}rem`}function Y(e){if(!e)throw new Error("Hex color is undefined!");if(!/^#[0-9A-F]{6}$/i.test(e))throw new Error(`Invalid hex color: ${e}`);let t=parseInt(e.substring(1,3),16),n=parseInt(e.substring(3,5),16),r=parseInt(e.substring(5,7),16);return`${t} ${n} ${r}`}function ue(e){let t={};return Object.entries(e).forEach(([n,r])=>{r&&(t[`${n}Channel`]=Y(r))}),{...e,...t}}function ce(e,t){let n=s=>s.includes("var(--"),r=s=>s.trim().endsWith("%"),o={invalid:`[Alpha]: Invalid opacity "${e}" for ${t}.`,range:"Must be a number between 0 and 1 (e.g., 0.48).",format:'Must be a percentage (e.g., "48%") or CSS variable (e.g., "var(--opacity)").'};if(typeof e=="string"){if(r(e))return e;if(n(e))return`calc(${e} * 100%)`;throw new Error(`${o.invalid} ${o.format}`)}if(typeof e=="number"){if(e>=0&&e<=1)return`${Number((e*100).toFixed(2))}%`;throw new Error(`${o.invalid} ${o.range}`)}throw new Error(`${o.invalid}`)}function pe(e,t=1){if(!e?.trim())throw new Error("[Alpha]: Color is undefined or empty!");if(e.startsWith("#")||e.startsWith("rgb")||e.startsWith("rgba")||!e.includes("var")&&e.includes("Channel"))throw new Error([`[Alpha]: Unsupported color format "${e}"`,"\u2705 Supported formats:",'- RGB channels: "0 184 217"','- CSS variables with "Channel" prefix: "var(--palette-common-blackChannel, #000000)"',"\u274C Unsupported formats:",'- Hex: "#00B8D9"','- RGB: "rgb(0, 184, 217)"','- RGBA: "rgba(0, 184, 217, 1)"'].join(`
2
- `));let r=ce(t,e);return e.toLowerCase()==="currentcolor"?`color-mix(in srgb, currentColor ${r}, transparent)`:`rgba(${e} / ${r})`}function fe(e,t){return!e||!t.length||typeof e!="object"?!1:t.every(n=>n in e)}function de(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{let t=Math.random()*16|0;return(e==="x"?t:t&3|8).toString(16)})}function me(e,t){let n=e?Array.isArray(e)?e:[e]:[],r=Object.entries(t||{}).filter(([o,s])=>s!==void 0&&s!==!1).map(([o,s])=>Array.isArray(s)?s[0]?s[1]:"":s?o:"").filter(Boolean);return[...n.filter(Boolean),...r].join(" ")}function j(e){if(!e||typeof e!="string")return console.warn("Invalid cookie key provided"),null;try{let t=`${e}=`,o=decodeURIComponent(document.cookie).split("; ").find(i=>i.startsWith(t));if(!o)return null;let s=o.substring(t.length);try{return JSON.parse(s)}catch{return s}}catch(t){return console.error("Error retrieving cookie:",t),null}}function w(e,t,n){if(!e||typeof e!="string"){console.error("Invalid cookie key provided");return}let{daysUntilExpiration:r=0,sameSite:o="Strict",secure:s=!1,path:i="/",domain:l}=n??{};try{let a=encodeURIComponent(typeof t=="string"?t:JSON.stringify(t)),c=[`${e}=${a}`,`path=${i}`,o&&`SameSite=${o}`,s&&"Secure",l&&`domain=${l}`];if(r>0){let p=new Date(Date.now()+r*24*60*60*1e3);c.push(`expires=${p.toUTCString()}`)}document.cookie=c.filter(Boolean).join("; ")}catch(a){console.error("Error setting cookie:",a)}}function F(e,t){if(!e||typeof e!="string"){console.error("Invalid cookie key provided");return}let{path:n="/",domain:r}=t??{};try{let o=[`${e}=`,"expires=Thu, 01 Jan 1970 00:00:00 GMT",`path=${n}`,r&&`domain=${r}`,"Secure"];document.cookie=o.filter(Boolean).join("; ")}catch(o){console.error("Error removing cookie:",o)}}function Te(e,t,n=!0){if(!e||!t)return console.warn("isActiveLink: pathname or itemPath is empty!"),!1;if(t.startsWith("#")||H(t))return!1;let r=y(e),o=y($(t));return n||P(t)?r===o||r.startsWith(`${o}/`)||r.startsWith(`${o}?`):r===o}function N(e,t){if(!q())return t??null;let n=localStorage.getItem(e);if(n!=="undefined"){if(n)try{return JSON.parse(n)}catch{return n??t??null}return t??null}}function k(e,t){try{let n=JSON.stringify(t);window.localStorage.setItem(e,n)}catch(n){console.error("Error while setting storage:",n)}}function B(e){try{window.localStorage.removeItem(e)}catch(t){console.error("Error while removing from storage:",t)}}function q(){try{let e="__some_random_key_you_are_not_going_to_use__";return window.localStorage.setItem(e,e),window.localStorage.removeItem(e),!0}catch{return!1}}function ge(e){if(typeof e!="string"||!e.trim())return console.error("Invalid input: CSS value must be a non-empty string"),"";let t=e.match(/var\(\s*(--[\w-]+)(?:\s*,[^)]*)?\s*\)/);return t?t[1]:(console.error(`Invalid CSS variable format: "${e}". Expected format: var(--variable-name)`),"")}function W(e,t=""){return e==null||typeof e=="number"&&Number.isNaN(e)?t:e.toString()}function G(e){let n=W(e).replace(/[^0-9.]/g,""),[r,...o]=n.split(".");return o.length>0?`${r}.${o.join("")}`:r}function K(e,t=""){if(e==null||typeof e=="number"&&Number.isNaN(e))return t;let n=parseFloat(e.toString());return Number.isNaN(n)?t:n}var he={onChange:G,onBlur:K,value:W};var U=require("react");function be(e=!1){let[t,n]=(0,U.useState)(e),r=(0,U.useCallback)((s,i)=>{n(i)},[]),o=(0,U.useCallback)(()=>{n(e)},[e]);return{value:t,setValue:n,onChange:r,reset:o}}var C=require("react");function Se(e=!1){let[t,n]=(0,C.useState)(e),r=(0,C.useCallback)(()=>{n(!0)},[]),o=(0,C.useCallback)(()=>{n(!1)},[]),s=(0,C.useCallback)(()=>{n(i=>!i)},[]);return{value:t,onTrue:r,onFalse:o,onToggle:s,setValue:n}}var O=require("react");function xe(){let[e,t]=(0,O.useState)(null),n=(0,O.useCallback)(o=>{t(o.currentTarget)},[]),r=(0,O.useCallback)(()=>{t(null)},[]);return{open:!!e,anchorEl:e,onOpen:n,onClose:r,setAnchorEl:t}}var m=require("react");function ye(e,t,n){let{initializeWithValue:r=!0,...o}=n??{},s=t&&typeof t=="object",[i,l]=(0,m.useState)(t);(0,m.useEffect)(()=>{let u=j(e);u?l(s?g=>({...g,...u}):u):t&&r&&w(e,t,o)},[]);let a=(0,m.useCallback)(u=>{s?l(g=>{let _={...g,...u};return w(e,_,o),_}):(w(e,u,o),l(u))},[o,s,e]),c=(0,m.useCallback)((u,g)=>{s&&a({[u]:g})},[s,a]),p=(0,m.useCallback)(u=>{l(u??t),F(e)},[t,e]);return(0,m.useMemo)(()=>({state:i,setState:a,setField:c,resetState:p}),[p,c,a,i])}var V=require("react");function ve(e,t=1e3){let[n,r]=(0,V.useState)(e);return(0,V.useEffect)(()=>{let o=setTimeout(()=>{r(e)},t);return()=>{clearTimeout(o)}},[e,t]),n}var R=require("react");function Ce(e){let[t,n]=(0,R.useState)(e),r=(0,R.useCallback)(i=>{n(l=>({...l,...i}))},[]),o=(0,R.useCallback)((i,l)=>{r({[i]:l})},[r]),s=(0,R.useCallback)(i=>{n(i??e)},[e]);return{state:t,setState:r,setField:o,resetState:s}}var L=require("react");function Re(){let[e,t]=(0,L.useState)(!1);return(0,L.useEffect)(()=>{t(!0)},[]),e}var h=require("react");function Ee(e,t){let[n,r]=(0,h.useState)(!1),o=we(e),s=(0,h.useCallback)(()=>{let a=window.innerHeight,c=Math.round(window.scrollY),p=document.body.offsetHeight,f=Math.round(c/(p-a)*100);if(o.type==="percentage")r(f>=o.value);else{let u=p-a-c;r(o.value>=u)}},[o.type,o.value]),i=(0,h.useMemo)(()=>{let a;return()=>{clearTimeout(a),a=setTimeout(s,100)}},[s]);return(0,h.useEffect)(()=>{let a=t?i:s;return window.addEventListener("scroll",a),()=>{window.removeEventListener("scroll",a)}},[i,s,t]),{isVisible:n,onBackToTop:()=>{window.scrollTo({top:0,behavior:"smooth"})},setIsVisible:r}}function we(e){let t,n;if(typeof e=="string")if(e.endsWith("%")){if(t=Number(e.slice(0,-1)),isNaN(t))throw new Error("Invalid percentage value");n="percentage"}else throw new Error("String input must end with %");else t=e,n="number";return{value:t,type:n}}var d=require("react");function ke(e,t){let n=(0,d.useRef)(null),r=e||n,[o,s]=(0,d.useState)(void 0),[i,l]=(0,d.useState)(void 0),a=typeof window<"u"?d.useLayoutEffect:d.useEffect,c=(0,d.useCallback)(()=>{if(r.current){let u=r.current.getBoundingClientRect();s(u),l({scrollWidth:r.current.scrollWidth,scrollHeight:r.current.scrollHeight})}},[r]);a(()=>{c()},[c]),(0,d.useEffect)(()=>{let u=t||"resize";return window.addEventListener(u,c),()=>{window.removeEventListener(u,c)}},[t,c]);let p=(0,d.useMemo)(()=>o,[o]),f=(0,d.useMemo)(()=>i,[i]);return{elementRef:r,top:p?.top??0,right:p?.right??0,bottom:p?.bottom??0,left:p?.left??0,x:p?.x??0,y:p?.y??0,width:p?.width??0,height:p?.height??0,scrollWidth:f?.scrollWidth??0,scrollHeight:f?.scrollHeight??0}}var b=require("react");function Ue(e,t){let[n,r]=(0,b.useState)(t??[]),o=(0,b.useCallback)(a=>{r(c=>Q(c,a))},[]),s=(0,b.useCallback)(()=>{r(a=>a.length===e.length?[]:e)},[e]),i=(0,b.useCallback)(()=>{r([])},[]),l=(0,b.useMemo)(()=>n.length===0?"unchecked":n.length===e.length?"checked":"indeterminate",[e.length,n.length]);return{values:n,status:l,setValues:r,onSelectAllItems:s,onDeSelectAllItems:i,onToggleSelectItem:o}}function Q(e,t){return e.includes(t)?e.filter(n=>n!==t):[...e,t]}var M=require("react");function Oe({click:e,doubleClick:t,timeout:n=250}){let r=(0,M.useRef)(null),o=(0,M.useCallback)(()=>{r.current&&(clearTimeout(r.current),r.current=null)},[]);return(0,M.useCallback)(i=>{o(),e&&i.detail===1&&(r.current=setTimeout(()=>{e(i)},n)),i.detail%2===0&&t(i)},[e,t,n,o])}var T=require("react");function Me(e,t,n){let{initializeWithValue:r=!0}=n??{},o=t&&typeof t=="object",[s,i]=(0,T.useState)(t);(0,T.useEffect)(()=>{let f=N(e);f?i(o?u=>({...u,...f}):f):t&&r&&k(e,t)},[]);let l=(0,T.useCallback)(f=>{o?i(u=>{let g={...u,...f};return k(e,g),g}):(k(e,f),i(f))},[e,o]),a=(0,T.useCallback)((f,u)=>{o&&l({[f]:u})},[o,l]),c=(0,T.useCallback)(f=>{i(f??t),B(e)},[t,e]);return(0,T.useMemo)(()=>({state:s,setState:l,setField:a,resetState:c}),[c,a,l,s])}var v=require("react");function Ve(e){let t=(0,v.useRef)(null),n=e||t,[r,o]=(0,v.useState)(!1),s=(0,v.useCallback)(()=>{o(!0)},[]),i=(0,v.useCallback)(()=>{o(!1)},[]);return{elementRef:n,anchorEl:n.current,open:r,onOpen:s,onClose:i,setOpen:o}}var E=require("react");function Le(e,t="- -"){let[n,r]=(0,E.useState)({days:t,hours:t,minutes:t,seconds:t}),o=(0,E.useCallback)(()=>{let s=new Date,{days:i,hours:l,minutes:a,seconds:c}=Ie(e,s);r({days:I(i),hours:I(l),minutes:I(a),seconds:I(c)})},[e]);return(0,E.useEffect)(()=>{o();let s=setInterval(o,1e3);return()=>clearInterval(s)},[]),n}function I(e){return String(e).length===1?`0${e}`:`${e}`}function Ie(e,t){let n=e.getTime()-t.getTime();return{days:Math.floor(n/(1e3*60*60*24)),hours:Math.floor(n%(1e3*60*60*24)/(1e3*60*60)),minutes:Math.floor(n%(1e3*60*60)/(1e3*60)),seconds:Math.floor(n%(1e3*60)/1e3)}}var S=require("react");function Ae(e=0){let t=(0,S.useRef)(null),[n,r]=(0,S.useState)(!1),o=(0,S.useCallback)(()=>{let s=window.scrollY;if(t.current){let i=t.current.offsetTop;r(s>i-e)}else r(s>e)},[e]);return(0,S.useEffect)(()=>(o(),window.addEventListener("scroll",o),()=>{window.removeEventListener("scroll",o)}),[o]),{elementRef:t,offsetTop:n}}var x=require("react");function De(e){let[t,n]=(0,x.useState)(e),[r,o]=(0,x.useState)(!1),s=(0,x.useCallback)(()=>{o(!0)},[]),i=(0,x.useCallback)(()=>{o(!1),n(e)},[e]);return(0,x.useEffect)(()=>{let l=null;return r&&t>0?l=setInterval(()=>{n(a=>a-1)},1e3):t<=0&&o(!1),()=>{l&&clearInterval(l)}},[r,t]),{value:t,setValue:n,isCounting:r,start:s,reset:i}}var A=require("react");function Pe(){let[e,t]=(0,A.useState)(null);return{copy:(0,A.useCallback)(async r=>{if(!navigator?.clipboard)return console.warn("Clipboard not supported"),!1;try{return await navigator.clipboard.writeText(r),t(r),!0}catch(o){return console.warn("Copy failed",o),t(null),!1}},[t]),copiedText:e}}0&&(module.exports={createPaletteChannel,getCookie,getStorage,hasKeys,hasParams,hexToRgbChannel,isActiveLink,isEqualPath,isExternalLink,localStorageAvailable,mergeClasses,mergeRefs,parseCssVar,pxToRem,remToPx,removeCookie,removeLastSlash,removeParams,removeStorage,setCookie,setFont,setStorage,transformNumber,transformValue,transformValueOnBlur,transformValueOnChange,updateSelectedItems,useBackToTop,useBoolean,useClientRect,useCookies,useCopyToClipboard,useCountdownDate,useCountdownSeconds,useDebounce,useDoubleClick,useIsClient,useLocalStorage,useMultiSelect,usePopover,usePopoverHover,useScrollOffsetTop,useSetState,useTabs,uuidv4,varAlpha});
1
+ "use strict";var I=Object.defineProperty;var X=Object.getOwnPropertyDescriptor;var Z=Object.getOwnPropertyNames;var ee=Object.prototype.hasOwnProperty;var te=(e,t)=>{for(var n in t)I(e,n,{get:t[n],enumerable:!0})},ne=(e,t,n,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of Z(t))!ee.call(e,r)&&r!==n&&I(e,r,{get:()=>t[r],enumerable:!(o=X(t,r))||o.enumerable});return e};var oe=e=>ne(I({},"__esModule",{value:!0}),e);var He={};te(He,{createPaletteChannel:()=>ce,getCookie:()=>j,getStorage:()=>N,hasKeys:()=>de,hasParams:()=>A,hexToRgbChannel:()=>Y,isActiveLink:()=>ge,isEqualPath:()=>re,isExternalLink:()=>H,localStorageAvailable:()=>q,mergeClasses:()=>Te,mergeRefs:()=>ie,parseCssVar:()=>he,pxToRem:()=>ue,remToPx:()=>le,removeCookie:()=>F,removeLastSlash:()=>y,removeParams:()=>D,removeStorage:()=>W,safeReturnUrl:()=>se,setCookie:()=>E,setFont:()=>ae,setStorage:()=>k,transformNumber:()=>be,transformValue:()=>B,transformValueOnBlur:()=>K,transformValueOnChange:()=>G,updateSelectedItems:()=>Q,useBackToTop:()=>Ee,useBoolean:()=>xe,useClientRect:()=>Ue,useCookies:()=>ve,useCopyToClipboard:()=>De,useCountdownDate:()=>$e,useCountdownSeconds:()=>Ae,useDebounce:()=>Ce,useDoubleClick:()=>Me,useIsClient:()=>Re,useLocalStorage:()=>Ve,useMultiSelect:()=>Oe,usePopover:()=>ye,usePopoverHover:()=>Le,useScrollOffsetTop:()=>Ie,useSetState:()=>we,useTabs:()=>Se,uuidv4:()=>me,varAlpha:()=>fe});module.exports=oe(He);var z=require("es-toolkit");function A(e){try{let t=new URL(e,window.location.origin);return Array.from(t.searchParams.keys()).length>0}catch{return!1}}function y(e){return e!=="/"&&e.endsWith("/")?e.slice(0,-1):e}function re(e,t,n={deep:!0}){let o=r=>{try{let{pathname:s,searchParams:i}=new URL(r.trim(),"http://dummy");return n.deep?{pathname:y(s),params:Object.fromEntries(i)}:{pathname:y(s)}}catch{return{pathname:""}}};return(0,z.isEqual)(o(t),o(e))}function D(e){try{let t=new URL(e,window.location.origin);return y(t.pathname)}catch{return e}}function H(e){return/^https?:\/\//i.test(e)}function se(e,t){let n=t??"/";if(!e||typeof window>"u"||!window.location?.origin)return n;try{let o=new URL(e,window.location.origin),r=o.origin===window.location.origin,s=o.pathname.startsWith("/")&&!o.pathname.startsWith("//"),i=/^\/:+$/.test(o.pathname),a=o.pathname==="/"&&!o.search&&o.hash;return r&&s&&!i&&!a?`${o.pathname}${o.search}${o.hash}`:n}catch{return e.startsWith("/")&&!e.startsWith("//")?e:n}}function ie(e){return t=>{if(e.length!==0)for(let n of e)n&&(typeof n=="function"?n(t):"current"in n&&(n.current=t))}}var J='-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"';function ae(e){return e?`"${e}", ${J}`:J}function le(e){let t=parseFloat(e);return Math.round(t*16)}function ue(e){if(typeof e!="number"||isNaN(e))throw new Error(`Invalid pixel value: ${e}`);return`${e/16}rem`}function Y(e){if(!e)throw new Error("Hex color is undefined!");if(!/^#[0-9A-F]{6}$/i.test(e))throw new Error(`Invalid hex color: ${e}`);let t=parseInt(e.substring(1,3),16),n=parseInt(e.substring(3,5),16),o=parseInt(e.substring(5,7),16);return`${t} ${n} ${o}`}function ce(e){let t={};return Object.entries(e).forEach(([n,o])=>{o&&(t[`${n}Channel`]=Y(o))}),{...e,...t}}function pe(e,t){let n=s=>s.includes("var(--"),o=s=>s.trim().endsWith("%"),r={invalid:`[Alpha]: Invalid opacity "${e}" for ${t}.`,range:"Must be a number between 0 and 1 (e.g., 0.48).",format:'Must be a percentage (e.g., "48%") or CSS variable (e.g., "var(--opacity)").'};if(typeof e=="string"){if(o(e))return e;if(n(e))return`calc(${e} * 100%)`;let s=parseFloat(e.trim());if(!isNaN(s)&&s>=0&&s<=1)return`${Number((s*100).toFixed(2))}%`;throw new Error(`${r.invalid} ${r.format}`)}if(typeof e=="number"){if(e>=0&&e<=1)return`${Number((e*100).toFixed(2))}%`;throw new Error(`${r.invalid} ${r.range}`)}throw new Error(`${r.invalid}`)}function fe(e,t=1){if(!e?.trim())throw new Error("[Alpha]: Color is undefined or empty!");if(e.startsWith("#")||e.startsWith("rgb")||e.startsWith("rgba")||!e.includes("var")&&e.includes("Channel"))throw new Error([`[Alpha]: Unsupported color format "${e}"`,"\u2705 Supported formats:",'- RGB channels: "0 184 217"','- CSS variables with "Channel" prefix: "var(--palette-common-blackChannel, #000000)"',"\u274C Unsupported formats:",'- Hex: "#00B8D9"','- RGB: "rgb(0, 184, 217)"','- RGBA: "rgba(0, 184, 217, 1)"'].join(`
2
+ `));let o=pe(t,e);return e.toLowerCase()==="currentcolor"?`color-mix(in srgb, currentColor ${o}, transparent)`:`rgba(${e} / ${o})`}function de(e,t){return!e||!t.length||typeof e!="object"?!1:t.every(n=>n in e)}function me(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{let t=Math.random()*16|0;return(e==="x"?t:t&3|8).toString(16)})}function Te(e,t){let n=e?Array.isArray(e)?e:[e]:[],o=Object.entries(t||{}).filter(([r,s])=>s!==void 0&&s!==!1).map(([r,s])=>Array.isArray(s)?s[0]?s[1]:"":s?r:"").filter(Boolean);return[...n.filter(Boolean),...o].join(" ")}function j(e){if(!e||typeof e!="string")return console.warn("Invalid cookie key provided"),null;try{let t=`${e}=`,r=decodeURIComponent(document.cookie).split("; ").find(i=>i.startsWith(t));if(!r)return null;let s=r.substring(t.length);try{return JSON.parse(s)}catch{return s}}catch(t){return console.error("Error retrieving cookie:",t),null}}function E(e,t,n){if(!e||typeof e!="string"){console.error("Invalid cookie key provided");return}let{daysUntilExpiration:o=0,sameSite:r="Strict",secure:s=!1,path:i="/",domain:a}=n??{};try{let l=encodeURIComponent(typeof t=="string"?t:JSON.stringify(t)),c=[`${e}=${l}`,`path=${i}`,r&&`SameSite=${r}`,s&&"Secure",a&&`domain=${a}`];if(o>0){let p=new Date(Date.now()+o*24*60*60*1e3);c.push(`expires=${p.toUTCString()}`)}document.cookie=c.filter(Boolean).join("; ")}catch(l){console.error("Error setting cookie:",l)}}function F(e,t){if(!e||typeof e!="string"){console.error("Invalid cookie key provided");return}let{path:n="/",domain:o}=t??{};try{let r=[`${e}=`,"expires=Thu, 01 Jan 1970 00:00:00 GMT",`path=${n}`,o&&`domain=${o}`,"Secure"];document.cookie=r.filter(Boolean).join("; ")}catch(r){console.error("Error removing cookie:",r)}}function ge(e,t,n=!0){if(!e||!t)return console.warn("isActiveLink: pathname or itemPath is empty!"),!1;if(t.startsWith("#")||H(t))return!1;let o=y(e),r=y(D(t));return n||A(t)?o===r||o.startsWith(`${r}/`)||o.startsWith(`${r}?`):o===r}function N(e,t){if(!q())return t??null;let n=localStorage.getItem(e);if(n!=="undefined"){if(n)try{return JSON.parse(n)}catch{return n??t??null}return t??null}}function k(e,t){try{let n=JSON.stringify(t);window.localStorage.setItem(e,n)}catch(n){console.error("Error while setting storage:",n)}}function W(e){try{window.localStorage.removeItem(e)}catch(t){console.error("Error while removing from storage:",t)}}function q(){try{let e="__some_random_key_you_are_not_going_to_use__";return window.localStorage.setItem(e,e),window.localStorage.removeItem(e),!0}catch{return!1}}function he(e){if(typeof e!="string"||!e.trim())return console.error("Invalid input: CSS value must be a non-empty string"),"";let t=e.match(/var\(\s*(--[\w-]+)(?:\s*,[^)]*)?\s*\)/);return t?t[1]:(console.error(`Invalid CSS variable format: "${e}". Expected format: var(--variable-name)`),"")}function B(e,t=""){return e==null||typeof e=="number"&&Number.isNaN(e)?t:e.toString()}function G(e){let n=B(e).replace(/[^0-9.]/g,""),[o,...r]=n.split(".");return r.length>0?`${o}.${r.join("")}`:o}function K(e,t=""){if(e==null||typeof e=="number"&&Number.isNaN(e))return t;let n=parseFloat(e.toString());return Number.isNaN(n)?t:n}var be={onChange:G,onBlur:K,value:B};var U=require("react");function Se(e=!1){let[t,n]=(0,U.useState)(e),o=(0,U.useCallback)((s,i)=>{n(i)},[]),r=(0,U.useCallback)(()=>{n(e)},[e]);return{value:t,setValue:n,onChange:o,reset:r}}var C=require("react");function xe(e=!1){let[t,n]=(0,C.useState)(e),o=(0,C.useCallback)(()=>{n(!0)},[]),r=(0,C.useCallback)(()=>{n(!1)},[]),s=(0,C.useCallback)(()=>{n(i=>!i)},[]);return{value:t,onTrue:o,onFalse:r,onToggle:s,setValue:n}}var O=require("react");function ye(){let[e,t]=(0,O.useState)(null),n=(0,O.useCallback)(r=>{t(r.currentTarget)},[]),o=(0,O.useCallback)(()=>{t(null)},[]);return{open:!!e,anchorEl:e,onOpen:n,onClose:o,setAnchorEl:t}}var m=require("react");function ve(e,t,n){let{initializeWithValue:o=!0,...r}=n??{},s=t&&typeof t=="object",[i,a]=(0,m.useState)(t);(0,m.useEffect)(()=>{let u=j(e);u?a(s?g=>({...g,...u}):u):t&&o&&E(e,t,r)},[]);let l=(0,m.useCallback)(u=>{s?a(g=>{let _={...g,...u};return E(e,_,r),_}):(E(e,u,r),a(u))},[r,s,e]),c=(0,m.useCallback)((u,g)=>{s&&l({[u]:g})},[s,l]),p=(0,m.useCallback)(u=>{a(u??t),F(e)},[t,e]);return(0,m.useMemo)(()=>({state:i,setState:l,setField:c,resetState:p}),[p,c,l,i])}var V=require("react");function Ce(e,t=1e3){let[n,o]=(0,V.useState)(e);return(0,V.useEffect)(()=>{let r=setTimeout(()=>{o(e)},t);return()=>{clearTimeout(r)}},[e,t]),n}var w=require("react");function we(e){let[t,n]=(0,w.useState)(e),o=(0,w.useCallback)(i=>{n(a=>({...a,...i}))},[]),r=(0,w.useCallback)((i,a)=>{o({[i]:a})},[o]),s=(0,w.useCallback)(i=>{n(i??e)},[e]);return{state:t,setState:o,setField:r,resetState:s}}var L=require("react");function Re(){let[e,t]=(0,L.useState)(!1);return(0,L.useEffect)(()=>{t(!0)},[]),e}var h=require("react");function Ee(e,t){let[n,o]=(0,h.useState)(!1),r=ke(e),s=(0,h.useCallback)(()=>{let l=window.innerHeight,c=Math.round(window.scrollY),p=document.body.offsetHeight,f=Math.round(c/(p-l)*100);if(r.type==="percentage")o(f>=r.value);else{let u=p-l-c;o(r.value>=u)}},[r.type,r.value]),i=(0,h.useMemo)(()=>{let l;return()=>{clearTimeout(l),l=setTimeout(s,100)}},[s]);return(0,h.useEffect)(()=>{let l=t?i:s;return window.addEventListener("scroll",l),()=>{window.removeEventListener("scroll",l)}},[i,s,t]),{isVisible:n,onBackToTop:()=>{window.scrollTo({top:0,behavior:"smooth"})},setIsVisible:o}}function ke(e){let t,n;if(typeof e=="string")if(e.endsWith("%")){if(t=Number(e.slice(0,-1)),isNaN(t))throw new Error("Invalid percentage value");n="percentage"}else throw new Error("String input must end with %");else t=e,n="number";return{value:t,type:n}}var d=require("react");function Ue(e,t){let n=(0,d.useRef)(null),o=e||n,[r,s]=(0,d.useState)(void 0),[i,a]=(0,d.useState)(void 0),l=typeof window<"u"?d.useLayoutEffect:d.useEffect,c=(0,d.useCallback)(()=>{if(o.current){let u=o.current.getBoundingClientRect();s(u),a({scrollWidth:o.current.scrollWidth,scrollHeight:o.current.scrollHeight})}},[o]);l(()=>{c()},[c]),(0,d.useEffect)(()=>{let u=t||"resize";return window.addEventListener(u,c),()=>{window.removeEventListener(u,c)}},[t,c]);let p=(0,d.useMemo)(()=>r,[r]),f=(0,d.useMemo)(()=>i,[i]);return{elementRef:o,top:p?.top??0,right:p?.right??0,bottom:p?.bottom??0,left:p?.left??0,x:p?.x??0,y:p?.y??0,width:p?.width??0,height:p?.height??0,scrollWidth:f?.scrollWidth??0,scrollHeight:f?.scrollHeight??0}}var b=require("react");function Oe(e,t){let[n,o]=(0,b.useState)(t??[]),r=(0,b.useCallback)(l=>{o(c=>Q(c,l))},[]),s=(0,b.useCallback)(()=>{o(l=>l.length===e.length?[]:e)},[e]),i=(0,b.useCallback)(()=>{o([])},[]),a=(0,b.useMemo)(()=>n.length===0?"unchecked":n.length===e.length?"checked":"indeterminate",[e.length,n.length]);return{values:n,status:a,setValues:o,onSelectAllItems:s,onDeSelectAllItems:i,onToggleSelectItem:r}}function Q(e,t){return e.includes(t)?e.filter(n=>n!==t):[...e,t]}var M=require("react");function Me({click:e,doubleClick:t,timeout:n=250}){let o=(0,M.useRef)(null),r=(0,M.useCallback)(()=>{o.current&&(clearTimeout(o.current),o.current=null)},[]);return(0,M.useCallback)(i=>{r(),e&&i.detail===1&&(o.current=setTimeout(()=>{e(i)},n)),i.detail%2===0&&t(i)},[e,t,n,r])}var T=require("react");function Ve(e,t,n){let{initializeWithValue:o=!0}=n??{},r=t&&typeof t=="object",[s,i]=(0,T.useState)(t);(0,T.useEffect)(()=>{let f=N(e);f?i(r?u=>({...u,...f}):f):t&&o&&k(e,t)},[]);let a=(0,T.useCallback)(f=>{r?i(u=>{let g={...u,...f};return k(e,g),g}):(k(e,f),i(f))},[e,r]),l=(0,T.useCallback)((f,u)=>{r&&a({[f]:u})},[r,a]),c=(0,T.useCallback)(f=>{i(f??t),W(e)},[t,e]);return(0,T.useMemo)(()=>({state:s,setState:a,setField:l,resetState:c}),[c,l,a,s])}var v=require("react");function Le(e){let t=(0,v.useRef)(null),n=e||t,[o,r]=(0,v.useState)(!1),s=(0,v.useCallback)(()=>{r(!0)},[]),i=(0,v.useCallback)(()=>{r(!1)},[]);return{elementRef:n,anchorEl:n.current,open:o,onOpen:s,onClose:i,setOpen:r}}var R=require("react");function $e(e,t="- -"){let[n,o]=(0,R.useState)({days:t,hours:t,minutes:t,seconds:t}),r=(0,R.useCallback)(()=>{let s=new Date,{days:i,hours:a,minutes:l,seconds:c}=Pe(e,s);o({days:$(i),hours:$(a),minutes:$(l),seconds:$(c)})},[e]);return(0,R.useEffect)(()=>{r();let s=setInterval(r,1e3);return()=>clearInterval(s)},[]),n}function $(e){return String(e).length===1?`0${e}`:`${e}`}function Pe(e,t){let n=e.getTime()-t.getTime();return{days:Math.floor(n/(1e3*60*60*24)),hours:Math.floor(n%(1e3*60*60*24)/(1e3*60*60)),minutes:Math.floor(n%(1e3*60*60)/(1e3*60)),seconds:Math.floor(n%(1e3*60)/1e3)}}var S=require("react");function Ie(e=0){let t=(0,S.useRef)(null),[n,o]=(0,S.useState)(!1),r=(0,S.useCallback)(()=>{let s=window.scrollY;if(t.current){let i=t.current.offsetTop;o(s>i-e)}else o(s>e)},[e]);return(0,S.useEffect)(()=>(r(),window.addEventListener("scroll",r),()=>{window.removeEventListener("scroll",r)}),[r]),{elementRef:t,offsetTop:n}}var x=require("react");function Ae(e){let[t,n]=(0,x.useState)(e),[o,r]=(0,x.useState)(!1),s=(0,x.useCallback)(()=>{r(!0)},[]),i=(0,x.useCallback)(()=>{r(!1),n(e)},[e]);return(0,x.useEffect)(()=>{let a=null;return o&&t>0?a=setInterval(()=>{n(l=>l-1)},1e3):t<=0&&r(!1),()=>{a&&clearInterval(a)}},[o,t]),{value:t,setValue:n,isCounting:o,start:s,reset:i}}var P=require("react");function De(){let[e,t]=(0,P.useState)(null);return{copy:(0,P.useCallback)(async o=>{if(!navigator?.clipboard)return console.warn("Clipboard not supported"),!1;try{return await navigator.clipboard.writeText(o),t(o),!0}catch(r){return console.warn("Copy failed",r),t(null),!1}},[t]),copiedText:e}}0&&(module.exports={createPaletteChannel,getCookie,getStorage,hasKeys,hasParams,hexToRgbChannel,isActiveLink,isEqualPath,isExternalLink,localStorageAvailable,mergeClasses,mergeRefs,parseCssVar,pxToRem,remToPx,removeCookie,removeLastSlash,removeParams,removeStorage,safeReturnUrl,setCookie,setFont,setStorage,transformNumber,transformValue,transformValueOnBlur,transformValueOnChange,updateSelectedItems,useBackToTop,useBoolean,useClientRect,useCookies,useCopyToClipboard,useCountdownDate,useCountdownSeconds,useDebounce,useDoubleClick,useIsClient,useLocalStorage,useMultiSelect,usePopover,usePopoverHover,useScrollOffsetTop,useSetState,useTabs,uuidv4,varAlpha});
package/dist/index.d.cts CHANGED
@@ -1,4 +1,4 @@
1
- export { EqualPathOptions, hasParams, isEqualPath, isExternalLink, removeLastSlash, removeParams } from './utils/url/url.cjs';
1
+ export { EqualPathOptions, hasParams, isEqualPath, isExternalLink, removeLastSlash, removeParams, safeReturnUrl } from './utils/url/url.cjs';
2
2
  export { mergeRefs } from './utils/refs/refs.cjs';
3
3
  export { pxToRem, remToPx, setFont } from './utils/font/font.cjs';
4
4
  export { ChannelPalette, InputPalette, createPaletteChannel, hexToRgbChannel, varAlpha } from './utils/color/color.cjs';
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export { EqualPathOptions, hasParams, isEqualPath, isExternalLink, removeLastSlash, removeParams } from './utils/url/url.js';
1
+ export { EqualPathOptions, hasParams, isEqualPath, isExternalLink, removeLastSlash, removeParams, safeReturnUrl } from './utils/url/url.js';
2
2
  export { mergeRefs } from './utils/refs/refs.js';
3
3
  export { pxToRem, remToPx, setFont } from './utils/font/font.js';
4
4
  export { ChannelPalette, InputPalette, createPaletteChannel, hexToRgbChannel, varAlpha } from './utils/color/color.js';
package/dist/index.js CHANGED
@@ -1,2 +1,2 @@
1
- import{isEqual as B}from"es-toolkit";function R(e){try{let t=new URL(e,window.location.origin);return Array.from(t.searchParams.keys()).length>0}catch{return!1}}function m(e){return e!=="/"&&e.endsWith("/")?e.slice(0,-1):e}function Ae(e,t,n={deep:!0}){let r=o=>{try{let{pathname:s,searchParams:i}=new URL(o.trim(),"http://dummy");return n.deep?{pathname:m(s),params:Object.fromEntries(i)}:{pathname:m(s)}}catch{return{pathname:""}}};return B(r(t),r(e))}function E(e){try{let t=new URL(e,window.location.origin);return m(t.pathname)}catch{return e}}function w(e){return/^https?:\/\//i.test(e)}function Pe(e){return t=>{if(e.length!==0)for(let n of e)n&&(typeof n=="function"?n(t):"current"in n&&(n.current=t))}}var k='-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"';function He(e){return e?`"${e}", ${k}`:k}function je(e){let t=parseFloat(e);return Math.round(t*16)}function Fe(e){if(typeof e!="number"||isNaN(e))throw new Error(`Invalid pixel value: ${e}`);return`${e/16}rem`}function W(e){if(!e)throw new Error("Hex color is undefined!");if(!/^#[0-9A-F]{6}$/i.test(e))throw new Error(`Invalid hex color: ${e}`);let t=parseInt(e.substring(1,3),16),n=parseInt(e.substring(3,5),16),r=parseInt(e.substring(5,7),16);return`${t} ${n} ${r}`}function Be(e){let t={};return Object.entries(e).forEach(([n,r])=>{r&&(t[`${n}Channel`]=W(r))}),{...e,...t}}function _(e,t){let n=s=>s.includes("var(--"),r=s=>s.trim().endsWith("%"),o={invalid:`[Alpha]: Invalid opacity "${e}" for ${t}.`,range:"Must be a number between 0 and 1 (e.g., 0.48).",format:'Must be a percentage (e.g., "48%") or CSS variable (e.g., "var(--opacity)").'};if(typeof e=="string"){if(r(e))return e;if(n(e))return`calc(${e} * 100%)`;throw new Error(`${o.invalid} ${o.format}`)}if(typeof e=="number"){if(e>=0&&e<=1)return`${Number((e*100).toFixed(2))}%`;throw new Error(`${o.invalid} ${o.range}`)}throw new Error(`${o.invalid}`)}function We(e,t=1){if(!e?.trim())throw new Error("[Alpha]: Color is undefined or empty!");if(e.startsWith("#")||e.startsWith("rgb")||e.startsWith("rgba")||!e.includes("var")&&e.includes("Channel"))throw new Error([`[Alpha]: Unsupported color format "${e}"`,"\u2705 Supported formats:",'- RGB channels: "0 184 217"','- CSS variables with "Channel" prefix: "var(--palette-common-blackChannel, #000000)"',"\u274C Unsupported formats:",'- Hex: "#00B8D9"','- RGB: "rgb(0, 184, 217)"','- RGBA: "rgba(0, 184, 217, 1)"'].join(`
2
- `));let r=_(t,e);return e.toLowerCase()==="currentcolor"?`color-mix(in srgb, currentColor ${r}, transparent)`:`rgba(${e} / ${r})`}function ze(e,t){return!e||!t.length||typeof e!="object"?!1:t.every(n=>n in e)}function Ye(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{let t=Math.random()*16|0;return(e==="x"?t:t&3|8).toString(16)})}function Ge(e,t){let n=e?Array.isArray(e)?e:[e]:[],r=Object.entries(t||{}).filter(([o,s])=>s!==void 0&&s!==!1).map(([o,s])=>Array.isArray(s)?s[0]?s[1]:"":s?o:"").filter(Boolean);return[...n.filter(Boolean),...r].join(" ")}function U(e){if(!e||typeof e!="string")return console.warn("Invalid cookie key provided"),null;try{let t=`${e}=`,o=decodeURIComponent(document.cookie).split("; ").find(i=>i.startsWith(t));if(!o)return null;let s=o.substring(t.length);try{return JSON.parse(s)}catch{return s}}catch(t){return console.error("Error retrieving cookie:",t),null}}function T(e,t,n){if(!e||typeof e!="string"){console.error("Invalid cookie key provided");return}let{daysUntilExpiration:r=0,sameSite:o="Strict",secure:s=!1,path:i="/",domain:l}=n??{};try{let a=encodeURIComponent(typeof t=="string"?t:JSON.stringify(t)),c=[`${e}=${a}`,`path=${i}`,o&&`SameSite=${o}`,s&&"Secure",l&&`domain=${l}`];if(r>0){let p=new Date(Date.now()+r*24*60*60*1e3);c.push(`expires=${p.toUTCString()}`)}document.cookie=c.filter(Boolean).join("; ")}catch(a){console.error("Error setting cookie:",a)}}function O(e,t){if(!e||typeof e!="string"){console.error("Invalid cookie key provided");return}let{path:n="/",domain:r}=t??{};try{let o=[`${e}=`,"expires=Thu, 01 Jan 1970 00:00:00 GMT",`path=${n}`,r&&`domain=${r}`,"Secure"];document.cookie=o.filter(Boolean).join("; ")}catch(o){console.error("Error removing cookie:",o)}}function Ze(e,t,n=!0){if(!e||!t)return console.warn("isActiveLink: pathname or itemPath is empty!"),!1;if(t.startsWith("#")||w(t))return!1;let r=m(e),o=m(E(t));return n||R(t)?r===o||r.startsWith(`${o}/`)||r.startsWith(`${o}?`):r===o}function M(e,t){if(!z())return t??null;let n=localStorage.getItem(e);if(n!=="undefined"){if(n)try{return JSON.parse(n)}catch{return n??t??null}return t??null}}function g(e,t){try{let n=JSON.stringify(t);window.localStorage.setItem(e,n)}catch(n){console.error("Error while setting storage:",n)}}function V(e){try{window.localStorage.removeItem(e)}catch(t){console.error("Error while removing from storage:",t)}}function z(){try{let e="__some_random_key_you_are_not_going_to_use__";return window.localStorage.setItem(e,e),window.localStorage.removeItem(e),!0}catch{return!1}}function nt(e){if(typeof e!="string"||!e.trim())return console.error("Invalid input: CSS value must be a non-empty string"),"";let t=e.match(/var\(\s*(--[\w-]+)(?:\s*,[^)]*)?\s*\)/);return t?t[1]:(console.error(`Invalid CSS variable format: "${e}". Expected format: var(--variable-name)`),"")}function L(e,t=""){return e==null||typeof e=="number"&&Number.isNaN(e)?t:e.toString()}function J(e){let n=L(e).replace(/[^0-9.]/g,""),[r,...o]=n.split(".");return o.length>0?`${r}.${o.join("")}`:r}function Y(e,t=""){if(e==null||typeof e=="number"&&Number.isNaN(e))return t;let n=parseFloat(e.toString());return Number.isNaN(n)?t:n}var rt={onChange:J,onBlur:Y,value:L};import{useState as q,useCallback as I}from"react";function at(e=!1){let[t,n]=q(e),r=I((s,i)=>{n(i)},[]),o=I(()=>{n(e)},[e]);return{value:t,setValue:n,onChange:r,reset:o}}import{useState as G,useCallback as b}from"react";function ct(e=!1){let[t,n]=G(e),r=b(()=>{n(!0)},[]),o=b(()=>{n(!1)},[]),s=b(()=>{n(i=>!i)},[]);return{value:t,onTrue:r,onFalse:o,onToggle:s,setValue:n}}import{useState as K,useCallback as A}from"react";function dt(){let[e,t]=K(null),n=A(o=>{t(o.currentTarget)},[]),r=A(()=>{t(null)},[]);return{open:!!e,anchorEl:e,onOpen:n,onClose:r,setAnchorEl:t}}import{useMemo as Q,useState as X,useEffect as Z,useCallback as S}from"react";function ht(e,t,n){let{initializeWithValue:r=!0,...o}=n??{},s=t&&typeof t=="object",[i,l]=X(t);Z(()=>{let u=U(e);u?l(s?d=>({...d,...u}):u):t&&r&&T(e,t,o)},[]);let a=S(u=>{s?l(d=>{let C={...d,...u};return T(e,C,o),C}):(T(e,u,o),l(u))},[o,s,e]),c=S((u,d)=>{s&&a({[u]:d})},[s,a]),p=S(u=>{l(u??t),O(e)},[t,e]);return Q(()=>({state:i,setState:a,setField:c,resetState:p}),[p,c,a,i])}import{useState as ee,useEffect as te}from"react";function xt(e,t=1e3){let[n,r]=ee(e);return te(()=>{let o=setTimeout(()=>{r(e)},t);return()=>{clearTimeout(o)}},[e,t]),n}import{useState as ne,useCallback as x}from"react";function Ct(e){let[t,n]=ne(e),r=x(i=>{n(l=>({...l,...i}))},[]),o=x((i,l)=>{r({[i]:l})},[r]),s=x(i=>{n(i??e)},[e]);return{state:t,setState:r,setField:o,resetState:s}}import{useState as oe,useEffect as re}from"react";function wt(){let[e,t]=oe(!1);return re(()=>{t(!0)},[]),e}import{useMemo as se,useState as ie,useEffect as ae,useCallback as le}from"react";function Ot(e,t){let[n,r]=ie(!1),o=ue(e),s=le(()=>{let a=window.innerHeight,c=Math.round(window.scrollY),p=document.body.offsetHeight,f=Math.round(c/(p-a)*100);if(o.type==="percentage")r(f>=o.value);else{let u=p-a-c;r(o.value>=u)}},[o.type,o.value]),i=se(()=>{let a;return()=>{clearTimeout(a),a=setTimeout(s,100)}},[s]);return ae(()=>{let a=t?i:s;return window.addEventListener("scroll",a),()=>{window.removeEventListener("scroll",a)}},[i,s,t]),{isVisible:n,onBackToTop:()=>{window.scrollTo({top:0,behavior:"smooth"})},setIsVisible:r}}function ue(e){let t,n;if(typeof e=="string")if(e.endsWith("%")){if(t=Number(e.slice(0,-1)),isNaN(t))throw new Error("Invalid percentage value");n="percentage"}else throw new Error("String input must end with %");else t=e,n="number";return{value:t,type:n}}import{useRef as ce,useMemo as D,useState as P,useEffect as $,useCallback as pe,useLayoutEffect as fe}from"react";function Lt(e,t){let n=ce(null),r=e||n,[o,s]=P(void 0),[i,l]=P(void 0),a=typeof window<"u"?fe:$,c=pe(()=>{if(r.current){let u=r.current.getBoundingClientRect();s(u),l({scrollWidth:r.current.scrollWidth,scrollHeight:r.current.scrollHeight})}},[r]);a(()=>{c()},[c]),$(()=>{let u=t||"resize";return window.addEventListener(u,c),()=>{window.removeEventListener(u,c)}},[t,c]);let p=D(()=>o,[o]),f=D(()=>i,[i]);return{elementRef:r,top:p?.top??0,right:p?.right??0,bottom:p?.bottom??0,left:p?.left??0,x:p?.x??0,y:p?.y??0,width:p?.width??0,height:p?.height??0,scrollWidth:f?.scrollWidth??0,scrollHeight:f?.scrollHeight??0}}import{useMemo as de,useState as me,useCallback as y}from"react";function Dt(e,t){let[n,r]=me(t??[]),o=y(a=>{r(c=>Te(c,a))},[]),s=y(()=>{r(a=>a.length===e.length?[]:e)},[e]),i=y(()=>{r([])},[]),l=de(()=>n.length===0?"unchecked":n.length===e.length?"checked":"indeterminate",[e.length,n.length]);return{values:n,status:l,setValues:r,onSelectAllItems:s,onDeSelectAllItems:i,onToggleSelectItem:o}}function Te(e,t){return e.includes(t)?e.filter(n=>n!==t):[...e,t]}import{useRef as ge,useCallback as H}from"react";function Ht({click:e,doubleClick:t,timeout:n=250}){let r=ge(null),o=H(()=>{r.current&&(clearTimeout(r.current),r.current=null)},[]);return H(i=>{o(),e&&i.detail===1&&(r.current=setTimeout(()=>{e(i)},n)),i.detail%2===0&&t(i)},[e,t,n,o])}import{useMemo as he,useState as be,useEffect as Se,useCallback as v}from"react";function Bt(e,t,n){let{initializeWithValue:r=!0}=n??{},o=t&&typeof t=="object",[s,i]=be(t);Se(()=>{let f=M(e);f?i(o?u=>({...u,...f}):f):t&&r&&g(e,t)},[]);let l=v(f=>{o?i(u=>{let d={...u,...f};return g(e,d),d}):(g(e,f),i(f))},[e,o]),a=v((f,u)=>{o&&l({[f]:u})},[o,l]),c=v(f=>{i(f??t),V(e)},[t,e]);return he(()=>({state:s,setState:l,setField:a,resetState:c}),[c,a,l,s])}import{useRef as xe,useState as ye,useCallback as j}from"react";function zt(e){let t=xe(null),n=e||t,[r,o]=ye(!1),s=j(()=>{o(!0)},[]),i=j(()=>{o(!1)},[]);return{elementRef:n,anchorEl:n.current,open:r,onOpen:s,onClose:i,setOpen:o}}import{useState as ve,useEffect as Ce,useCallback as Re}from"react";function qt(e,t="- -"){let[n,r]=ve({days:t,hours:t,minutes:t,seconds:t}),o=Re(()=>{let s=new Date,{days:i,hours:l,minutes:a,seconds:c}=Ee(e,s);r({days:h(i),hours:h(l),minutes:h(a),seconds:h(c)})},[e]);return Ce(()=>{o();let s=setInterval(o,1e3);return()=>clearInterval(s)},[]),n}function h(e){return String(e).length===1?`0${e}`:`${e}`}function Ee(e,t){let n=e.getTime()-t.getTime();return{days:Math.floor(n/(1e3*60*60*24)),hours:Math.floor(n%(1e3*60*60*24)/(1e3*60*60)),minutes:Math.floor(n%(1e3*60*60)/(1e3*60)),seconds:Math.floor(n%(1e3*60)/1e3)}}import{useRef as we,useState as ke,useEffect as Ue,useCallback as Oe}from"react";function Qt(e=0){let t=we(null),[n,r]=ke(!1),o=Oe(()=>{let s=window.scrollY;if(t.current){let i=t.current.offsetTop;r(s>i-e)}else r(s>e)},[e]);return Ue(()=>(o(),window.addEventListener("scroll",o),()=>{window.removeEventListener("scroll",o)}),[o]),{elementRef:t,offsetTop:n}}import{useState as F,useEffect as Me,useCallback as N}from"react";function en(e){let[t,n]=F(e),[r,o]=F(!1),s=N(()=>{o(!0)},[]),i=N(()=>{o(!1),n(e)},[e]);return Me(()=>{let l=null;return r&&t>0?l=setInterval(()=>{n(a=>a-1)},1e3):t<=0&&o(!1),()=>{l&&clearInterval(l)}},[r,t]),{value:t,setValue:n,isCounting:r,start:s,reset:i}}import{useState as Ve,useCallback as Le}from"react";function on(){let[e,t]=Ve(null);return{copy:Le(async r=>{if(!navigator?.clipboard)return console.warn("Clipboard not supported"),!1;try{return await navigator.clipboard.writeText(r),t(r),!0}catch(o){return console.warn("Copy failed",o),t(null),!1}},[t]),copiedText:e}}export{Be as createPaletteChannel,U as getCookie,M as getStorage,ze as hasKeys,R as hasParams,W as hexToRgbChannel,Ze as isActiveLink,Ae as isEqualPath,w as isExternalLink,z as localStorageAvailable,Ge as mergeClasses,Pe as mergeRefs,nt as parseCssVar,Fe as pxToRem,je as remToPx,O as removeCookie,m as removeLastSlash,E as removeParams,V as removeStorage,T as setCookie,He as setFont,g as setStorage,rt as transformNumber,L as transformValue,Y as transformValueOnBlur,J as transformValueOnChange,Te as updateSelectedItems,Ot as useBackToTop,ct as useBoolean,Lt as useClientRect,ht as useCookies,on as useCopyToClipboard,qt as useCountdownDate,en as useCountdownSeconds,xt as useDebounce,Ht as useDoubleClick,wt as useIsClient,Bt as useLocalStorage,Dt as useMultiSelect,dt as usePopover,zt as usePopoverHover,Qt as useScrollOffsetTop,Ct as useSetState,at as useTabs,Ye as uuidv4,We as varAlpha};
1
+ import{isEqual as W}from"es-toolkit";function w(e){try{let t=new URL(e,window.location.origin);return Array.from(t.searchParams.keys()).length>0}catch{return!1}}function m(e){return e!=="/"&&e.endsWith("/")?e.slice(0,-1):e}function Pe(e,t,n={deep:!0}){let o=r=>{try{let{pathname:s,searchParams:i}=new URL(r.trim(),"http://dummy");return n.deep?{pathname:m(s),params:Object.fromEntries(i)}:{pathname:m(s)}}catch{return{pathname:""}}};return W(o(t),o(e))}function R(e){try{let t=new URL(e,window.location.origin);return m(t.pathname)}catch{return e}}function E(e){return/^https?:\/\//i.test(e)}function Ie(e,t){let n=t??"/";if(!e||typeof window>"u"||!window.location?.origin)return n;try{let o=new URL(e,window.location.origin),r=o.origin===window.location.origin,s=o.pathname.startsWith("/")&&!o.pathname.startsWith("//"),i=/^\/:+$/.test(o.pathname),a=o.pathname==="/"&&!o.search&&o.hash;return r&&s&&!i&&!a?`${o.pathname}${o.search}${o.hash}`:n}catch{return e.startsWith("/")&&!e.startsWith("//")?e:n}}function De(e){return t=>{if(e.length!==0)for(let n of e)n&&(typeof n=="function"?n(t):"current"in n&&(n.current=t))}}var k='-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"';function je(e){return e?`"${e}", ${k}`:k}function Fe(e){let t=parseFloat(e);return Math.round(t*16)}function Ne(e){if(typeof e!="number"||isNaN(e))throw new Error(`Invalid pixel value: ${e}`);return`${e/16}rem`}function B(e){if(!e)throw new Error("Hex color is undefined!");if(!/^#[0-9A-F]{6}$/i.test(e))throw new Error(`Invalid hex color: ${e}`);let t=parseInt(e.substring(1,3),16),n=parseInt(e.substring(3,5),16),o=parseInt(e.substring(5,7),16);return`${t} ${n} ${o}`}function Be(e){let t={};return Object.entries(e).forEach(([n,o])=>{o&&(t[`${n}Channel`]=B(o))}),{...e,...t}}function _(e,t){let n=s=>s.includes("var(--"),o=s=>s.trim().endsWith("%"),r={invalid:`[Alpha]: Invalid opacity "${e}" for ${t}.`,range:"Must be a number between 0 and 1 (e.g., 0.48).",format:'Must be a percentage (e.g., "48%") or CSS variable (e.g., "var(--opacity)").'};if(typeof e=="string"){if(o(e))return e;if(n(e))return`calc(${e} * 100%)`;let s=parseFloat(e.trim());if(!isNaN(s)&&s>=0&&s<=1)return`${Number((s*100).toFixed(2))}%`;throw new Error(`${r.invalid} ${r.format}`)}if(typeof e=="number"){if(e>=0&&e<=1)return`${Number((e*100).toFixed(2))}%`;throw new Error(`${r.invalid} ${r.range}`)}throw new Error(`${r.invalid}`)}function _e(e,t=1){if(!e?.trim())throw new Error("[Alpha]: Color is undefined or empty!");if(e.startsWith("#")||e.startsWith("rgb")||e.startsWith("rgba")||!e.includes("var")&&e.includes("Channel"))throw new Error([`[Alpha]: Unsupported color format "${e}"`,"\u2705 Supported formats:",'- RGB channels: "0 184 217"','- CSS variables with "Channel" prefix: "var(--palette-common-blackChannel, #000000)"',"\u274C Unsupported formats:",'- Hex: "#00B8D9"','- RGB: "rgb(0, 184, 217)"','- RGBA: "rgba(0, 184, 217, 1)"'].join(`
2
+ `));let o=_(t,e);return e.toLowerCase()==="currentcolor"?`color-mix(in srgb, currentColor ${o}, transparent)`:`rgba(${e} / ${o})`}function Je(e,t){return!e||!t.length||typeof e!="object"?!1:t.every(n=>n in e)}function qe(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{let t=Math.random()*16|0;return(e==="x"?t:t&3|8).toString(16)})}function Ke(e,t){let n=e?Array.isArray(e)?e:[e]:[],o=Object.entries(t||{}).filter(([r,s])=>s!==void 0&&s!==!1).map(([r,s])=>Array.isArray(s)?s[0]?s[1]:"":s?r:"").filter(Boolean);return[...n.filter(Boolean),...o].join(" ")}function U(e){if(!e||typeof e!="string")return console.warn("Invalid cookie key provided"),null;try{let t=`${e}=`,r=decodeURIComponent(document.cookie).split("; ").find(i=>i.startsWith(t));if(!r)return null;let s=r.substring(t.length);try{return JSON.parse(s)}catch{return s}}catch(t){return console.error("Error retrieving cookie:",t),null}}function T(e,t,n){if(!e||typeof e!="string"){console.error("Invalid cookie key provided");return}let{daysUntilExpiration:o=0,sameSite:r="Strict",secure:s=!1,path:i="/",domain:a}=n??{};try{let l=encodeURIComponent(typeof t=="string"?t:JSON.stringify(t)),c=[`${e}=${l}`,`path=${i}`,r&&`SameSite=${r}`,s&&"Secure",a&&`domain=${a}`];if(o>0){let p=new Date(Date.now()+o*24*60*60*1e3);c.push(`expires=${p.toUTCString()}`)}document.cookie=c.filter(Boolean).join("; ")}catch(l){console.error("Error setting cookie:",l)}}function O(e,t){if(!e||typeof e!="string"){console.error("Invalid cookie key provided");return}let{path:n="/",domain:o}=t??{};try{let r=[`${e}=`,"expires=Thu, 01 Jan 1970 00:00:00 GMT",`path=${n}`,o&&`domain=${o}`,"Secure"];document.cookie=r.filter(Boolean).join("; ")}catch(r){console.error("Error removing cookie:",r)}}function et(e,t,n=!0){if(!e||!t)return console.warn("isActiveLink: pathname or itemPath is empty!"),!1;if(t.startsWith("#")||E(t))return!1;let o=m(e),r=m(R(t));return n||w(t)?o===r||o.startsWith(`${r}/`)||o.startsWith(`${r}?`):o===r}function M(e,t){if(!z())return t??null;let n=localStorage.getItem(e);if(n!=="undefined"){if(n)try{return JSON.parse(n)}catch{return n??t??null}return t??null}}function g(e,t){try{let n=JSON.stringify(t);window.localStorage.setItem(e,n)}catch(n){console.error("Error while setting storage:",n)}}function V(e){try{window.localStorage.removeItem(e)}catch(t){console.error("Error while removing from storage:",t)}}function z(){try{let e="__some_random_key_you_are_not_going_to_use__";return window.localStorage.setItem(e,e),window.localStorage.removeItem(e),!0}catch{return!1}}function ot(e){if(typeof e!="string"||!e.trim())return console.error("Invalid input: CSS value must be a non-empty string"),"";let t=e.match(/var\(\s*(--[\w-]+)(?:\s*,[^)]*)?\s*\)/);return t?t[1]:(console.error(`Invalid CSS variable format: "${e}". Expected format: var(--variable-name)`),"")}function L(e,t=""){return e==null||typeof e=="number"&&Number.isNaN(e)?t:e.toString()}function J(e){let n=L(e).replace(/[^0-9.]/g,""),[o,...r]=n.split(".");return r.length>0?`${o}.${r.join("")}`:o}function Y(e,t=""){if(e==null||typeof e=="number"&&Number.isNaN(e))return t;let n=parseFloat(e.toString());return Number.isNaN(n)?t:n}var st={onChange:J,onBlur:Y,value:L};import{useState as q,useCallback as $}from"react";function lt(e=!1){let[t,n]=q(e),o=$((s,i)=>{n(i)},[]),r=$(()=>{n(e)},[e]);return{value:t,setValue:n,onChange:o,reset:r}}import{useState as G,useCallback as b}from"react";function pt(e=!1){let[t,n]=G(e),o=b(()=>{n(!0)},[]),r=b(()=>{n(!1)},[]),s=b(()=>{n(i=>!i)},[]);return{value:t,onTrue:o,onFalse:r,onToggle:s,setValue:n}}import{useState as K,useCallback as P}from"react";function mt(){let[e,t]=K(null),n=P(r=>{t(r.currentTarget)},[]),o=P(()=>{t(null)},[]);return{open:!!e,anchorEl:e,onOpen:n,onClose:o,setAnchorEl:t}}import{useMemo as Q,useState as X,useEffect as Z,useCallback as S}from"react";function bt(e,t,n){let{initializeWithValue:o=!0,...r}=n??{},s=t&&typeof t=="object",[i,a]=X(t);Z(()=>{let u=U(e);u?a(s?d=>({...d,...u}):u):t&&o&&T(e,t,r)},[]);let l=S(u=>{s?a(d=>{let C={...d,...u};return T(e,C,r),C}):(T(e,u,r),a(u))},[r,s,e]),c=S((u,d)=>{s&&l({[u]:d})},[s,l]),p=S(u=>{a(u??t),O(e)},[t,e]);return Q(()=>({state:i,setState:l,setField:c,resetState:p}),[p,c,l,i])}import{useState as ee,useEffect as te}from"react";function yt(e,t=1e3){let[n,o]=ee(e);return te(()=>{let r=setTimeout(()=>{o(e)},t);return()=>{clearTimeout(r)}},[e,t]),n}import{useState as ne,useCallback as x}from"react";function wt(e){let[t,n]=ne(e),o=x(i=>{n(a=>({...a,...i}))},[]),r=x((i,a)=>{o({[i]:a})},[o]),s=x(i=>{n(i??e)},[e]);return{state:t,setState:o,setField:r,resetState:s}}import{useState as oe,useEffect as re}from"react";function kt(){let[e,t]=oe(!1);return re(()=>{t(!0)},[]),e}import{useMemo as se,useState as ie,useEffect as ae,useCallback as le}from"react";function Mt(e,t){let[n,o]=ie(!1),r=ue(e),s=le(()=>{let l=window.innerHeight,c=Math.round(window.scrollY),p=document.body.offsetHeight,f=Math.round(c/(p-l)*100);if(r.type==="percentage")o(f>=r.value);else{let u=p-l-c;o(r.value>=u)}},[r.type,r.value]),i=se(()=>{let l;return()=>{clearTimeout(l),l=setTimeout(s,100)}},[s]);return ae(()=>{let l=t?i:s;return window.addEventListener("scroll",l),()=>{window.removeEventListener("scroll",l)}},[i,s,t]),{isVisible:n,onBackToTop:()=>{window.scrollTo({top:0,behavior:"smooth"})},setIsVisible:o}}function ue(e){let t,n;if(typeof e=="string")if(e.endsWith("%")){if(t=Number(e.slice(0,-1)),isNaN(t))throw new Error("Invalid percentage value");n="percentage"}else throw new Error("String input must end with %");else t=e,n="number";return{value:t,type:n}}import{useRef as ce,useMemo as I,useState as A,useEffect as D,useCallback as pe,useLayoutEffect as fe}from"react";function $t(e,t){let n=ce(null),o=e||n,[r,s]=A(void 0),[i,a]=A(void 0),l=typeof window<"u"?fe:D,c=pe(()=>{if(o.current){let u=o.current.getBoundingClientRect();s(u),a({scrollWidth:o.current.scrollWidth,scrollHeight:o.current.scrollHeight})}},[o]);l(()=>{c()},[c]),D(()=>{let u=t||"resize";return window.addEventListener(u,c),()=>{window.removeEventListener(u,c)}},[t,c]);let p=I(()=>r,[r]),f=I(()=>i,[i]);return{elementRef:o,top:p?.top??0,right:p?.right??0,bottom:p?.bottom??0,left:p?.left??0,x:p?.x??0,y:p?.y??0,width:p?.width??0,height:p?.height??0,scrollWidth:f?.scrollWidth??0,scrollHeight:f?.scrollHeight??0}}import{useMemo as de,useState as me,useCallback as y}from"react";function At(e,t){let[n,o]=me(t??[]),r=y(l=>{o(c=>Te(c,l))},[]),s=y(()=>{o(l=>l.length===e.length?[]:e)},[e]),i=y(()=>{o([])},[]),a=de(()=>n.length===0?"unchecked":n.length===e.length?"checked":"indeterminate",[e.length,n.length]);return{values:n,status:a,setValues:o,onSelectAllItems:s,onDeSelectAllItems:i,onToggleSelectItem:r}}function Te(e,t){return e.includes(t)?e.filter(n=>n!==t):[...e,t]}import{useRef as ge,useCallback as H}from"react";function jt({click:e,doubleClick:t,timeout:n=250}){let o=ge(null),r=H(()=>{o.current&&(clearTimeout(o.current),o.current=null)},[]);return H(i=>{r(),e&&i.detail===1&&(o.current=setTimeout(()=>{e(i)},n)),i.detail%2===0&&t(i)},[e,t,n,r])}import{useMemo as he,useState as be,useEffect as Se,useCallback as v}from"react";function Bt(e,t,n){let{initializeWithValue:o=!0}=n??{},r=t&&typeof t=="object",[s,i]=be(t);Se(()=>{let f=M(e);f?i(r?u=>({...u,...f}):f):t&&o&&g(e,t)},[]);let a=v(f=>{r?i(u=>{let d={...u,...f};return g(e,d),d}):(g(e,f),i(f))},[e,r]),l=v((f,u)=>{r&&a({[f]:u})},[r,a]),c=v(f=>{i(f??t),V(e)},[t,e]);return he(()=>({state:s,setState:a,setField:l,resetState:c}),[c,l,a,s])}import{useRef as xe,useState as ye,useCallback as j}from"react";function Jt(e){let t=xe(null),n=e||t,[o,r]=ye(!1),s=j(()=>{r(!0)},[]),i=j(()=>{r(!1)},[]);return{elementRef:n,anchorEl:n.current,open:o,onOpen:s,onClose:i,setOpen:r}}import{useState as ve,useEffect as Ce,useCallback as we}from"react";function Gt(e,t="- -"){let[n,o]=ve({days:t,hours:t,minutes:t,seconds:t}),r=we(()=>{let s=new Date,{days:i,hours:a,minutes:l,seconds:c}=Re(e,s);o({days:h(i),hours:h(a),minutes:h(l),seconds:h(c)})},[e]);return Ce(()=>{r();let s=setInterval(r,1e3);return()=>clearInterval(s)},[]),n}function h(e){return String(e).length===1?`0${e}`:`${e}`}function Re(e,t){let n=e.getTime()-t.getTime();return{days:Math.floor(n/(1e3*60*60*24)),hours:Math.floor(n%(1e3*60*60*24)/(1e3*60*60)),minutes:Math.floor(n%(1e3*60*60)/(1e3*60)),seconds:Math.floor(n%(1e3*60)/1e3)}}import{useRef as Ee,useState as ke,useEffect as Ue,useCallback as Oe}from"react";function Xt(e=0){let t=Ee(null),[n,o]=ke(!1),r=Oe(()=>{let s=window.scrollY;if(t.current){let i=t.current.offsetTop;o(s>i-e)}else o(s>e)},[e]);return Ue(()=>(r(),window.addEventListener("scroll",r),()=>{window.removeEventListener("scroll",r)}),[r]),{elementRef:t,offsetTop:n}}import{useState as F,useEffect as Me,useCallback as N}from"react";function tn(e){let[t,n]=F(e),[o,r]=F(!1),s=N(()=>{r(!0)},[]),i=N(()=>{r(!1),n(e)},[e]);return Me(()=>{let a=null;return o&&t>0?a=setInterval(()=>{n(l=>l-1)},1e3):t<=0&&r(!1),()=>{a&&clearInterval(a)}},[o,t]),{value:t,setValue:n,isCounting:o,start:s,reset:i}}import{useState as Ve,useCallback as Le}from"react";function rn(){let[e,t]=Ve(null);return{copy:Le(async o=>{if(!navigator?.clipboard)return console.warn("Clipboard not supported"),!1;try{return await navigator.clipboard.writeText(o),t(o),!0}catch(r){return console.warn("Copy failed",r),t(null),!1}},[t]),copiedText:e}}export{Be as createPaletteChannel,U as getCookie,M as getStorage,Je as hasKeys,w as hasParams,B as hexToRgbChannel,et as isActiveLink,Pe as isEqualPath,E as isExternalLink,z as localStorageAvailable,Ke as mergeClasses,De as mergeRefs,ot as parseCssVar,Ne as pxToRem,Fe as remToPx,O as removeCookie,m as removeLastSlash,R as removeParams,V as removeStorage,Ie as safeReturnUrl,T as setCookie,je as setFont,g as setStorage,st as transformNumber,L as transformValue,Y as transformValueOnBlur,J as transformValueOnChange,Te as updateSelectedItems,Mt as useBackToTop,pt as useBoolean,$t as useClientRect,bt as useCookies,rn as useCopyToClipboard,Gt as useCountdownDate,tn as useCountdownSeconds,yt as useDebounce,jt as useDoubleClick,kt as useIsClient,Bt as useLocalStorage,At as useMultiSelect,mt as usePopover,Jt as usePopoverHover,Xt as useScrollOffsetTop,wt as useSetState,lt as useTabs,qe as uuidv4,_e as varAlpha};
@@ -1 +1 @@
1
- "use strict";var o=Object.defineProperty;var m=Object.getOwnPropertyDescriptor;var p=Object.getOwnPropertyNames;var u=Object.prototype.hasOwnProperty;var h=(t,r)=>{for(var s in r)o(t,s,{get:r[s],enumerable:!0})},f=(t,r,s,e)=>{if(r&&typeof r=="object"||typeof r=="function")for(let n of p(r))!u.call(t,n)&&n!==s&&o(t,n,{get:()=>r[n],enumerable:!(e=m(r,n))||e.enumerable});return t};var d=t=>f(o({},"__esModule",{value:!0}),t);var x={};h(x,{isActiveLink:()=>b});module.exports=d(x);var g=require("es-toolkit");function a(t){try{let r=new URL(t,window.location.origin);return Array.from(r.searchParams.keys()).length>0}catch{return!1}}function i(t){return t!=="/"&&t.endsWith("/")?t.slice(0,-1):t}function c(t){try{let r=new URL(t,window.location.origin);return i(r.pathname)}catch{return t}}function l(t){return/^https?:\/\//i.test(t)}function b(t,r,s=!0){if(!t||!r)return console.warn("isActiveLink: pathname or itemPath is empty!"),!1;if(r.startsWith("#")||l(r))return!1;let e=i(t),n=i(c(r));return s||a(r)?e===n||e.startsWith(`${n}/`)||e.startsWith(`${n}?`):e===n}0&&(module.exports={isActiveLink});
1
+ "use strict";var a=Object.defineProperty;var l=Object.getOwnPropertyDescriptor;var u=Object.getOwnPropertyNames;var p=Object.prototype.hasOwnProperty;var m=(t,n)=>{for(var s in n)a(t,s,{get:n[s],enumerable:!0})},f=(t,n,s,i)=>{if(n&&typeof n=="object"||typeof n=="function")for(let r of u(n))!p.call(t,r)&&r!==s&&a(t,r,{get:()=>n[r],enumerable:!(i=l(n,r))||i.enumerable});return t};var g=t=>f(a({},"__esModule",{value:!0}),t);var y={};m(y,{isActiveLink:()=>w});module.exports=g(y);var d=require("es-toolkit");function o(t){try{let n=new URL(t,window.location.origin);return Array.from(n.searchParams.keys()).length>0}catch{return!1}}function e(t){return t!=="/"&&t.endsWith("/")?t.slice(0,-1):t}function c(t){try{let n=new URL(t,window.location.origin);return e(n.pathname)}catch{return t}}function h(t){return/^https?:\/\//i.test(t)}function w(t,n,s=!0){if(!t||!n)return console.warn("isActiveLink: pathname or itemPath is empty!"),!1;if(n.startsWith("#")||h(n))return!1;let i=e(t),r=e(c(n));return s||o(n)?i===r||i.startsWith(`${r}/`)||i.startsWith(`${r}?`):i===r}0&&(module.exports={isActiveLink});
@@ -1 +1 @@
1
- import{isEqual as p}from"es-toolkit";function i(t){try{let r=new URL(t,window.location.origin);return Array.from(r.searchParams.keys()).length>0}catch{return!1}}function s(t){return t!=="/"&&t.endsWith("/")?t.slice(0,-1):t}function o(t){try{let r=new URL(t,window.location.origin);return s(r.pathname)}catch{return t}}function a(t){return/^https?:\/\//i.test(t)}function f(t,r,c=!0){if(!t||!r)return console.warn("isActiveLink: pathname or itemPath is empty!"),!1;if(r.startsWith("#")||a(r))return!1;let n=s(t),e=s(o(r));return c||i(r)?n===e||n.startsWith(`${e}/`)||n.startsWith(`${e}?`):n===e}export{f as isActiveLink};
1
+ import{isEqual as u}from"es-toolkit";function e(t){try{let n=new URL(t,window.location.origin);return Array.from(n.searchParams.keys()).length>0}catch{return!1}}function s(t){return t!=="/"&&t.endsWith("/")?t.slice(0,-1):t}function a(t){try{let n=new URL(t,window.location.origin);return s(n.pathname)}catch{return t}}function o(t){return/^https?:\/\//i.test(t)}function f(t,n,c=!0){if(!t||!n)return console.warn("isActiveLink: pathname or itemPath is empty!"),!1;if(n.startsWith("#")||o(n))return!1;let r=s(t),i=s(a(n));return c||e(n)?r===i||r.startsWith(`${i}/`)||r.startsWith(`${i}?`):r===i}export{f as isActiveLink};
@@ -1 +1 @@
1
- "use strict";var o=Object.defineProperty;var m=Object.getOwnPropertyDescriptor;var p=Object.getOwnPropertyNames;var u=Object.prototype.hasOwnProperty;var h=(t,r)=>{for(var s in r)o(t,s,{get:r[s],enumerable:!0})},f=(t,r,s,e)=>{if(r&&typeof r=="object"||typeof r=="function")for(let n of p(r))!u.call(t,n)&&n!==s&&o(t,n,{get:()=>r[n],enumerable:!(e=m(r,n))||e.enumerable});return t};var d=t=>f(o({},"__esModule",{value:!0}),t);var b={};h(b,{isActiveLink:()=>x});module.exports=d(b);var g=require("es-toolkit");function a(t){try{let r=new URL(t,window.location.origin);return Array.from(r.searchParams.keys()).length>0}catch{return!1}}function i(t){return t!=="/"&&t.endsWith("/")?t.slice(0,-1):t}function c(t){try{let r=new URL(t,window.location.origin);return i(r.pathname)}catch{return t}}function l(t){return/^https?:\/\//i.test(t)}function x(t,r,s=!0){if(!t||!r)return console.warn("isActiveLink: pathname or itemPath is empty!"),!1;if(r.startsWith("#")||l(r))return!1;let e=i(t),n=i(c(r));return s||a(r)?e===n||e.startsWith(`${n}/`)||e.startsWith(`${n}?`):e===n}0&&(module.exports={isActiveLink});
1
+ "use strict";var o=Object.defineProperty;var l=Object.getOwnPropertyDescriptor;var p=Object.getOwnPropertyNames;var u=Object.prototype.hasOwnProperty;var m=(t,n)=>{for(var s in n)o(t,s,{get:n[s],enumerable:!0})},f=(t,n,s,i)=>{if(n&&typeof n=="object"||typeof n=="function")for(let r of p(n))!u.call(t,r)&&r!==s&&o(t,r,{get:()=>n[r],enumerable:!(i=l(n,r))||i.enumerable});return t};var g=t=>f(o({},"__esModule",{value:!0}),t);var x={};m(x,{isActiveLink:()=>w});module.exports=g(x);var d=require("es-toolkit");function a(t){try{let n=new URL(t,window.location.origin);return Array.from(n.searchParams.keys()).length>0}catch{return!1}}function e(t){return t!=="/"&&t.endsWith("/")?t.slice(0,-1):t}function c(t){try{let n=new URL(t,window.location.origin);return e(n.pathname)}catch{return t}}function h(t){return/^https?:\/\//i.test(t)}function w(t,n,s=!0){if(!t||!n)return console.warn("isActiveLink: pathname or itemPath is empty!"),!1;if(n.startsWith("#")||h(n))return!1;let i=e(t),r=e(c(n));return s||a(n)?i===r||i.startsWith(`${r}/`)||i.startsWith(`${r}?`):i===r}0&&(module.exports={isActiveLink});
@@ -1 +1 @@
1
- import{isEqual as p}from"es-toolkit";function i(t){try{let r=new URL(t,window.location.origin);return Array.from(r.searchParams.keys()).length>0}catch{return!1}}function s(t){return t!=="/"&&t.endsWith("/")?t.slice(0,-1):t}function o(t){try{let r=new URL(t,window.location.origin);return s(r.pathname)}catch{return t}}function a(t){return/^https?:\/\//i.test(t)}function f(t,r,c=!0){if(!t||!r)return console.warn("isActiveLink: pathname or itemPath is empty!"),!1;if(r.startsWith("#")||a(r))return!1;let n=s(t),e=s(o(r));return c||i(r)?n===e||n.startsWith(`${e}/`)||n.startsWith(`${e}?`):n===e}export{f as isActiveLink};
1
+ import{isEqual as p}from"es-toolkit";function e(t){try{let n=new URL(t,window.location.origin);return Array.from(n.searchParams.keys()).length>0}catch{return!1}}function s(t){return t!=="/"&&t.endsWith("/")?t.slice(0,-1):t}function o(t){try{let n=new URL(t,window.location.origin);return s(n.pathname)}catch{return t}}function a(t){return/^https?:\/\//i.test(t)}function f(t,n,c=!0){if(!t||!n)return console.warn("isActiveLink: pathname or itemPath is empty!"),!1;if(n.startsWith("#")||a(n))return!1;let r=s(t),i=s(o(n));return c||e(n)?r===i||r.startsWith(`${i}/`)||r.startsWith(`${i}?`):r===i}export{f as isActiveLink};
@@ -1,2 +1,2 @@
1
- "use strict";var a=Object.defineProperty;var u=Object.getOwnPropertyDescriptor;var g=Object.getOwnPropertyNames;var l=Object.prototype.hasOwnProperty;var d=(n,r)=>{for(var e in r)a(n,e,{get:r[e],enumerable:!0})},f=(n,r,e,t)=>{if(r&&typeof r=="object"||typeof r=="function")for(let s of g(r))!l.call(n,s)&&s!==e&&a(n,s,{get:()=>r[s],enumerable:!(t=u(r,s))||t.enumerable});return n};var p=n=>f(a({},"__esModule",{value:!0}),n);var $={};d($,{createPaletteChannel:()=>h,hexToRgbChannel:()=>o,varAlpha:()=>c});module.exports=p($);function o(n){if(!n)throw new Error("Hex color is undefined!");if(!/^#[0-9A-F]{6}$/i.test(n))throw new Error(`Invalid hex color: ${n}`);let r=parseInt(n.substring(1,3),16),e=parseInt(n.substring(3,5),16),t=parseInt(n.substring(5,7),16);return`${r} ${e} ${t}`}function h(n){let r={};return Object.entries(n).forEach(([e,t])=>{t&&(r[`${e}Channel`]=o(t))}),{...n,...r}}function b(n,r){let e=i=>i.includes("var(--"),t=i=>i.trim().endsWith("%"),s={invalid:`[Alpha]: Invalid opacity "${n}" for ${r}.`,range:"Must be a number between 0 and 1 (e.g., 0.48).",format:'Must be a percentage (e.g., "48%") or CSS variable (e.g., "var(--opacity)").'};if(typeof n=="string"){if(t(n))return n;if(e(n))return`calc(${n} * 100%)`;throw new Error(`${s.invalid} ${s.format}`)}if(typeof n=="number"){if(n>=0&&n<=1)return`${Number((n*100).toFixed(2))}%`;throw new Error(`${s.invalid} ${s.range}`)}throw new Error(`${s.invalid}`)}function c(n,r=1){if(!n?.trim())throw new Error("[Alpha]: Color is undefined or empty!");if(n.startsWith("#")||n.startsWith("rgb")||n.startsWith("rgba")||!n.includes("var")&&n.includes("Channel"))throw new Error([`[Alpha]: Unsupported color format "${n}"`,"\u2705 Supported formats:",'- RGB channels: "0 184 217"','- CSS variables with "Channel" prefix: "var(--palette-common-blackChannel, #000000)"',"\u274C Unsupported formats:",'- Hex: "#00B8D9"','- RGB: "rgb(0, 184, 217)"','- RGBA: "rgba(0, 184, 217, 1)"'].join(`
2
- `));let t=b(r,n);return n.toLowerCase()==="currentcolor"?`color-mix(in srgb, currentColor ${t}, transparent)`:`rgba(${n} / ${t})`}0&&(module.exports={createPaletteChannel,hexToRgbChannel,varAlpha});
1
+ "use strict";var a=Object.defineProperty;var u=Object.getOwnPropertyDescriptor;var g=Object.getOwnPropertyNames;var d=Object.prototype.hasOwnProperty;var l=(n,r)=>{for(var t in r)a(n,t,{get:r[t],enumerable:!0})},f=(n,r,t,e)=>{if(r&&typeof r=="object"||typeof r=="function")for(let s of g(r))!d.call(n,s)&&s!==t&&a(n,s,{get:()=>r[s],enumerable:!(e=u(r,s))||e.enumerable});return n};var p=n=>f(a({},"__esModule",{value:!0}),n);var $={};l($,{createPaletteChannel:()=>h,hexToRgbChannel:()=>o,varAlpha:()=>c});module.exports=p($);function o(n){if(!n)throw new Error("Hex color is undefined!");if(!/^#[0-9A-F]{6}$/i.test(n))throw new Error(`Invalid hex color: ${n}`);let r=parseInt(n.substring(1,3),16),t=parseInt(n.substring(3,5),16),e=parseInt(n.substring(5,7),16);return`${r} ${t} ${e}`}function h(n){let r={};return Object.entries(n).forEach(([t,e])=>{e&&(r[`${t}Channel`]=o(e))}),{...n,...r}}function b(n,r){let t=i=>i.includes("var(--"),e=i=>i.trim().endsWith("%"),s={invalid:`[Alpha]: Invalid opacity "${n}" for ${r}.`,range:"Must be a number between 0 and 1 (e.g., 0.48).",format:'Must be a percentage (e.g., "48%") or CSS variable (e.g., "var(--opacity)").'};if(typeof n=="string"){if(e(n))return n;if(t(n))return`calc(${n} * 100%)`;let i=parseFloat(n.trim());if(!isNaN(i)&&i>=0&&i<=1)return`${Number((i*100).toFixed(2))}%`;throw new Error(`${s.invalid} ${s.format}`)}if(typeof n=="number"){if(n>=0&&n<=1)return`${Number((n*100).toFixed(2))}%`;throw new Error(`${s.invalid} ${s.range}`)}throw new Error(`${s.invalid}`)}function c(n,r=1){if(!n?.trim())throw new Error("[Alpha]: Color is undefined or empty!");if(n.startsWith("#")||n.startsWith("rgb")||n.startsWith("rgba")||!n.includes("var")&&n.includes("Channel"))throw new Error([`[Alpha]: Unsupported color format "${n}"`,"\u2705 Supported formats:",'- RGB channels: "0 184 217"','- CSS variables with "Channel" prefix: "var(--palette-common-blackChannel, #000000)"',"\u274C Unsupported formats:",'- Hex: "#00B8D9"','- RGB: "rgb(0, 184, 217)"','- RGBA: "rgba(0, 184, 217, 1)"'].join(`
2
+ `));let e=b(r,n);return n.toLowerCase()==="currentcolor"?`color-mix(in srgb, currentColor ${e}, transparent)`:`rgba(${n} / ${e})`}0&&(module.exports={createPaletteChannel,hexToRgbChannel,varAlpha});
@@ -1,2 +1,2 @@
1
- function a(n){if(!n)throw new Error("Hex color is undefined!");if(!/^#[0-9A-F]{6}$/i.test(n))throw new Error(`Invalid hex color: ${n}`);let t=parseInt(n.substring(1,3),16),e=parseInt(n.substring(3,5),16),r=parseInt(n.substring(5,7),16);return`${t} ${e} ${r}`}function u(n){let t={};return Object.entries(n).forEach(([e,r])=>{r&&(t[`${e}Channel`]=a(r))}),{...n,...t}}function o(n,t){let e=i=>i.includes("var(--"),r=i=>i.trim().endsWith("%"),s={invalid:`[Alpha]: Invalid opacity "${n}" for ${t}.`,range:"Must be a number between 0 and 1 (e.g., 0.48).",format:'Must be a percentage (e.g., "48%") or CSS variable (e.g., "var(--opacity)").'};if(typeof n=="string"){if(r(n))return n;if(e(n))return`calc(${n} * 100%)`;throw new Error(`${s.invalid} ${s.format}`)}if(typeof n=="number"){if(n>=0&&n<=1)return`${Number((n*100).toFixed(2))}%`;throw new Error(`${s.invalid} ${s.range}`)}throw new Error(`${s.invalid}`)}function g(n,t=1){if(!n?.trim())throw new Error("[Alpha]: Color is undefined or empty!");if(n.startsWith("#")||n.startsWith("rgb")||n.startsWith("rgba")||!n.includes("var")&&n.includes("Channel"))throw new Error([`[Alpha]: Unsupported color format "${n}"`,"\u2705 Supported formats:",'- RGB channels: "0 184 217"','- CSS variables with "Channel" prefix: "var(--palette-common-blackChannel, #000000)"',"\u274C Unsupported formats:",'- Hex: "#00B8D9"','- RGB: "rgb(0, 184, 217)"','- RGBA: "rgba(0, 184, 217, 1)"'].join(`
2
- `));let r=o(t,n);return n.toLowerCase()==="currentcolor"?`color-mix(in srgb, currentColor ${r}, transparent)`:`rgba(${n} / ${r})`}export{u as createPaletteChannel,a as hexToRgbChannel,g as varAlpha};
1
+ function a(n){if(!n)throw new Error("Hex color is undefined!");if(!/^#[0-9A-F]{6}$/i.test(n))throw new Error(`Invalid hex color: ${n}`);let e=parseInt(n.substring(1,3),16),s=parseInt(n.substring(3,5),16),r=parseInt(n.substring(5,7),16);return`${e} ${s} ${r}`}function u(n){let e={};return Object.entries(n).forEach(([s,r])=>{r&&(e[`${s}Channel`]=a(r))}),{...n,...e}}function o(n,e){let s=t=>t.includes("var(--"),r=t=>t.trim().endsWith("%"),i={invalid:`[Alpha]: Invalid opacity "${n}" for ${e}.`,range:"Must be a number between 0 and 1 (e.g., 0.48).",format:'Must be a percentage (e.g., "48%") or CSS variable (e.g., "var(--opacity)").'};if(typeof n=="string"){if(r(n))return n;if(s(n))return`calc(${n} * 100%)`;let t=parseFloat(n.trim());if(!isNaN(t)&&t>=0&&t<=1)return`${Number((t*100).toFixed(2))}%`;throw new Error(`${i.invalid} ${i.format}`)}if(typeof n=="number"){if(n>=0&&n<=1)return`${Number((n*100).toFixed(2))}%`;throw new Error(`${i.invalid} ${i.range}`)}throw new Error(`${i.invalid}`)}function g(n,e=1){if(!n?.trim())throw new Error("[Alpha]: Color is undefined or empty!");if(n.startsWith("#")||n.startsWith("rgb")||n.startsWith("rgba")||!n.includes("var")&&n.includes("Channel"))throw new Error([`[Alpha]: Unsupported color format "${n}"`,"\u2705 Supported formats:",'- RGB channels: "0 184 217"','- CSS variables with "Channel" prefix: "var(--palette-common-blackChannel, #000000)"',"\u274C Unsupported formats:",'- Hex: "#00B8D9"','- RGB: "rgb(0, 184, 217)"','- RGBA: "rgba(0, 184, 217, 1)"'].join(`
2
+ `));let r=o(e,n);return n.toLowerCase()==="currentcolor"?`color-mix(in srgb, currentColor ${r}, transparent)`:`rgba(${n} / ${r})`}export{u as createPaletteChannel,a as hexToRgbChannel,g as varAlpha};
@@ -1,2 +1,2 @@
1
- "use strict";var a=Object.defineProperty;var u=Object.getOwnPropertyDescriptor;var g=Object.getOwnPropertyNames;var f=Object.prototype.hasOwnProperty;var l=(n,r)=>{for(var e in r)a(n,e,{get:r[e],enumerable:!0})},d=(n,r,e,t)=>{if(r&&typeof r=="object"||typeof r=="function")for(let s of g(r))!f.call(n,s)&&s!==e&&a(n,s,{get:()=>r[s],enumerable:!(t=u(r,s))||t.enumerable});return n};var p=n=>d(a({},"__esModule",{value:!0}),n);var $={};l($,{createPaletteChannel:()=>h,hexToRgbChannel:()=>o,varAlpha:()=>c});module.exports=p($);function o(n){if(!n)throw new Error("Hex color is undefined!");if(!/^#[0-9A-F]{6}$/i.test(n))throw new Error(`Invalid hex color: ${n}`);let r=parseInt(n.substring(1,3),16),e=parseInt(n.substring(3,5),16),t=parseInt(n.substring(5,7),16);return`${r} ${e} ${t}`}function h(n){let r={};return Object.entries(n).forEach(([e,t])=>{t&&(r[`${e}Channel`]=o(t))}),{...n,...r}}function b(n,r){let e=i=>i.includes("var(--"),t=i=>i.trim().endsWith("%"),s={invalid:`[Alpha]: Invalid opacity "${n}" for ${r}.`,range:"Must be a number between 0 and 1 (e.g., 0.48).",format:'Must be a percentage (e.g., "48%") or CSS variable (e.g., "var(--opacity)").'};if(typeof n=="string"){if(t(n))return n;if(e(n))return`calc(${n} * 100%)`;throw new Error(`${s.invalid} ${s.format}`)}if(typeof n=="number"){if(n>=0&&n<=1)return`${Number((n*100).toFixed(2))}%`;throw new Error(`${s.invalid} ${s.range}`)}throw new Error(`${s.invalid}`)}function c(n,r=1){if(!n?.trim())throw new Error("[Alpha]: Color is undefined or empty!");if(n.startsWith("#")||n.startsWith("rgb")||n.startsWith("rgba")||!n.includes("var")&&n.includes("Channel"))throw new Error([`[Alpha]: Unsupported color format "${n}"`,"\u2705 Supported formats:",'- RGB channels: "0 184 217"','- CSS variables with "Channel" prefix: "var(--palette-common-blackChannel, #000000)"',"\u274C Unsupported formats:",'- Hex: "#00B8D9"','- RGB: "rgb(0, 184, 217)"','- RGBA: "rgba(0, 184, 217, 1)"'].join(`
2
- `));let t=b(r,n);return n.toLowerCase()==="currentcolor"?`color-mix(in srgb, currentColor ${t}, transparent)`:`rgba(${n} / ${t})`}0&&(module.exports={createPaletteChannel,hexToRgbChannel,varAlpha});
1
+ "use strict";var a=Object.defineProperty;var u=Object.getOwnPropertyDescriptor;var g=Object.getOwnPropertyNames;var d=Object.prototype.hasOwnProperty;var f=(r,n)=>{for(var t in n)a(r,t,{get:n[t],enumerable:!0})},l=(r,n,t,e)=>{if(n&&typeof n=="object"||typeof n=="function")for(let s of g(n))!d.call(r,s)&&s!==t&&a(r,s,{get:()=>n[s],enumerable:!(e=u(n,s))||e.enumerable});return r};var p=r=>l(a({},"__esModule",{value:!0}),r);var $={};f($,{createPaletteChannel:()=>h,hexToRgbChannel:()=>o,varAlpha:()=>c});module.exports=p($);function o(r){if(!r)throw new Error("Hex color is undefined!");if(!/^#[0-9A-F]{6}$/i.test(r))throw new Error(`Invalid hex color: ${r}`);let n=parseInt(r.substring(1,3),16),t=parseInt(r.substring(3,5),16),e=parseInt(r.substring(5,7),16);return`${n} ${t} ${e}`}function h(r){let n={};return Object.entries(r).forEach(([t,e])=>{e&&(n[`${t}Channel`]=o(e))}),{...r,...n}}function b(r,n){let t=i=>i.includes("var(--"),e=i=>i.trim().endsWith("%"),s={invalid:`[Alpha]: Invalid opacity "${r}" for ${n}.`,range:"Must be a number between 0 and 1 (e.g., 0.48).",format:'Must be a percentage (e.g., "48%") or CSS variable (e.g., "var(--opacity)").'};if(typeof r=="string"){if(e(r))return r;if(t(r))return`calc(${r} * 100%)`;let i=parseFloat(r.trim());if(!isNaN(i)&&i>=0&&i<=1)return`${Number((i*100).toFixed(2))}%`;throw new Error(`${s.invalid} ${s.format}`)}if(typeof r=="number"){if(r>=0&&r<=1)return`${Number((r*100).toFixed(2))}%`;throw new Error(`${s.invalid} ${s.range}`)}throw new Error(`${s.invalid}`)}function c(r,n=1){if(!r?.trim())throw new Error("[Alpha]: Color is undefined or empty!");if(r.startsWith("#")||r.startsWith("rgb")||r.startsWith("rgba")||!r.includes("var")&&r.includes("Channel"))throw new Error([`[Alpha]: Unsupported color format "${r}"`,"\u2705 Supported formats:",'- RGB channels: "0 184 217"','- CSS variables with "Channel" prefix: "var(--palette-common-blackChannel, #000000)"',"\u274C Unsupported formats:",'- Hex: "#00B8D9"','- RGB: "rgb(0, 184, 217)"','- RGBA: "rgba(0, 184, 217, 1)"'].join(`
2
+ `));let e=b(n,r);return r.toLowerCase()==="currentcolor"?`color-mix(in srgb, currentColor ${e}, transparent)`:`rgba(${r} / ${e})`}0&&(module.exports={createPaletteChannel,hexToRgbChannel,varAlpha});
@@ -1,2 +1,2 @@
1
- function a(n){if(!n)throw new Error("Hex color is undefined!");if(!/^#[0-9A-F]{6}$/i.test(n))throw new Error(`Invalid hex color: ${n}`);let t=parseInt(n.substring(1,3),16),e=parseInt(n.substring(3,5),16),r=parseInt(n.substring(5,7),16);return`${t} ${e} ${r}`}function u(n){let t={};return Object.entries(n).forEach(([e,r])=>{r&&(t[`${e}Channel`]=a(r))}),{...n,...t}}function o(n,t){let e=i=>i.includes("var(--"),r=i=>i.trim().endsWith("%"),s={invalid:`[Alpha]: Invalid opacity "${n}" for ${t}.`,range:"Must be a number between 0 and 1 (e.g., 0.48).",format:'Must be a percentage (e.g., "48%") or CSS variable (e.g., "var(--opacity)").'};if(typeof n=="string"){if(r(n))return n;if(e(n))return`calc(${n} * 100%)`;throw new Error(`${s.invalid} ${s.format}`)}if(typeof n=="number"){if(n>=0&&n<=1)return`${Number((n*100).toFixed(2))}%`;throw new Error(`${s.invalid} ${s.range}`)}throw new Error(`${s.invalid}`)}function g(n,t=1){if(!n?.trim())throw new Error("[Alpha]: Color is undefined or empty!");if(n.startsWith("#")||n.startsWith("rgb")||n.startsWith("rgba")||!n.includes("var")&&n.includes("Channel"))throw new Error([`[Alpha]: Unsupported color format "${n}"`,"\u2705 Supported formats:",'- RGB channels: "0 184 217"','- CSS variables with "Channel" prefix: "var(--palette-common-blackChannel, #000000)"',"\u274C Unsupported formats:",'- Hex: "#00B8D9"','- RGB: "rgb(0, 184, 217)"','- RGBA: "rgba(0, 184, 217, 1)"'].join(`
2
- `));let r=o(t,n);return n.toLowerCase()==="currentcolor"?`color-mix(in srgb, currentColor ${r}, transparent)`:`rgba(${n} / ${r})`}export{u as createPaletteChannel,a as hexToRgbChannel,g as varAlpha};
1
+ function a(r){if(!r)throw new Error("Hex color is undefined!");if(!/^#[0-9A-F]{6}$/i.test(r))throw new Error(`Invalid hex color: ${r}`);let e=parseInt(r.substring(1,3),16),s=parseInt(r.substring(3,5),16),n=parseInt(r.substring(5,7),16);return`${e} ${s} ${n}`}function u(r){let e={};return Object.entries(r).forEach(([s,n])=>{n&&(e[`${s}Channel`]=a(n))}),{...r,...e}}function o(r,e){let s=t=>t.includes("var(--"),n=t=>t.trim().endsWith("%"),i={invalid:`[Alpha]: Invalid opacity "${r}" for ${e}.`,range:"Must be a number between 0 and 1 (e.g., 0.48).",format:'Must be a percentage (e.g., "48%") or CSS variable (e.g., "var(--opacity)").'};if(typeof r=="string"){if(n(r))return r;if(s(r))return`calc(${r} * 100%)`;let t=parseFloat(r.trim());if(!isNaN(t)&&t>=0&&t<=1)return`${Number((t*100).toFixed(2))}%`;throw new Error(`${i.invalid} ${i.format}`)}if(typeof r=="number"){if(r>=0&&r<=1)return`${Number((r*100).toFixed(2))}%`;throw new Error(`${i.invalid} ${i.range}`)}throw new Error(`${i.invalid}`)}function g(r,e=1){if(!r?.trim())throw new Error("[Alpha]: Color is undefined or empty!");if(r.startsWith("#")||r.startsWith("rgb")||r.startsWith("rgba")||!r.includes("var")&&r.includes("Channel"))throw new Error([`[Alpha]: Unsupported color format "${r}"`,"\u2705 Supported formats:",'- RGB channels: "0 184 217"','- CSS variables with "Channel" prefix: "var(--palette-common-blackChannel, #000000)"',"\u274C Unsupported formats:",'- Hex: "#00B8D9"','- RGB: "rgb(0, 184, 217)"','- RGBA: "rgba(0, 184, 217, 1)"'].join(`
2
+ `));let n=o(e,r);return r.toLowerCase()==="currentcolor"?`color-mix(in srgb, currentColor ${n}, transparent)`:`rgba(${r} / ${n})`}export{u as createPaletteChannel,a as hexToRgbChannel,g as varAlpha};
@@ -1,2 +1,2 @@
1
- "use strict";var c=Object.defineProperty;var k=Object.getOwnPropertyDescriptor;var T=Object.getOwnPropertyNames;var v=Object.prototype.hasOwnProperty;var C=(r,e)=>{for(var t in e)c(r,t,{get:e[t],enumerable:!0})},I=(r,e,t,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of T(e))!v.call(r,n)&&n!==t&&c(r,n,{get:()=>e[n],enumerable:!(o=k(e,n))||o.enumerable});return r};var E=r=>I(c({},"__esModule",{value:!0}),r);var z={};C(z,{createPaletteChannel:()=>U,getCookie:()=>F,getStorage:()=>J,hasKeys:()=>V,hasParams:()=>l,hexToRgbChannel:()=>b,isActiveLink:()=>M,isEqualPath:()=>P,isExternalLink:()=>f,localStorageAvailable:()=>y,mergeClasses:()=>B,mergeRefs:()=>A,parseCssVar:()=>H,pxToRem:()=>N,remToPx:()=>O,removeCookie:()=>D,removeLastSlash:()=>s,removeParams:()=>p,removeStorage:()=>G,setCookie:()=>W,setFont:()=>R,setStorage:()=>q,transformNumber:()=>K,transformValue:()=>m,transformValueOnBlur:()=>w,transformValueOnChange:()=>S,uuidv4:()=>j,varAlpha:()=>_});module.exports=E(z);var x=require("es-toolkit");function l(r){try{let e=new URL(r,window.location.origin);return Array.from(e.searchParams.keys()).length>0}catch{return!1}}function s(r){return r!=="/"&&r.endsWith("/")?r.slice(0,-1):r}function P(r,e,t={deep:!0}){let o=n=>{try{let{pathname:i,searchParams:a}=new URL(n.trim(),"http://dummy");return t.deep?{pathname:s(i),params:Object.fromEntries(a)}:{pathname:s(i)}}catch{return{pathname:""}}};return(0,x.isEqual)(o(e),o(r))}function p(r){try{let e=new URL(r,window.location.origin);return s(e.pathname)}catch{return r}}function f(r){return/^https?:\/\//i.test(r)}function A(r){return e=>{if(r.length!==0)for(let t of r)t&&(typeof t=="function"?t(e):"current"in t&&(t.current=e))}}var h='-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"';function R(r){return r?`"${r}", ${h}`:h}function O(r){let e=parseFloat(r);return Math.round(e*16)}function N(r){if(typeof r!="number"||isNaN(r))throw new Error(`Invalid pixel value: ${r}`);return`${r/16}rem`}function b(r){if(!r)throw new Error("Hex color is undefined!");if(!/^#[0-9A-F]{6}$/i.test(r))throw new Error(`Invalid hex color: ${r}`);let e=parseInt(r.substring(1,3),16),t=parseInt(r.substring(3,5),16),o=parseInt(r.substring(5,7),16);return`${e} ${t} ${o}`}function U(r){let e={};return Object.entries(r).forEach(([t,o])=>{o&&(e[`${t}Channel`]=b(o))}),{...r,...e}}function L(r,e){let t=i=>i.includes("var(--"),o=i=>i.trim().endsWith("%"),n={invalid:`[Alpha]: Invalid opacity "${r}" for ${e}.`,range:"Must be a number between 0 and 1 (e.g., 0.48).",format:'Must be a percentage (e.g., "48%") or CSS variable (e.g., "var(--opacity)").'};if(typeof r=="string"){if(o(r))return r;if(t(r))return`calc(${r} * 100%)`;throw new Error(`${n.invalid} ${n.format}`)}if(typeof r=="number"){if(r>=0&&r<=1)return`${Number((r*100).toFixed(2))}%`;throw new Error(`${n.invalid} ${n.range}`)}throw new Error(`${n.invalid}`)}function _(r,e=1){if(!r?.trim())throw new Error("[Alpha]: Color is undefined or empty!");if(r.startsWith("#")||r.startsWith("rgb")||r.startsWith("rgba")||!r.includes("var")&&r.includes("Channel"))throw new Error([`[Alpha]: Unsupported color format "${r}"`,"\u2705 Supported formats:",'- RGB channels: "0 184 217"','- CSS variables with "Channel" prefix: "var(--palette-common-blackChannel, #000000)"',"\u274C Unsupported formats:",'- Hex: "#00B8D9"','- RGB: "rgb(0, 184, 217)"','- RGBA: "rgba(0, 184, 217, 1)"'].join(`
2
- `));let o=L(e,r);return r.toLowerCase()==="currentcolor"?`color-mix(in srgb, currentColor ${o}, transparent)`:`rgba(${r} / ${o})`}function V(r,e){return!r||!e.length||typeof r!="object"?!1:e.every(t=>t in r)}function j(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,r=>{let e=Math.random()*16|0;return(r==="x"?e:e&3|8).toString(16)})}function B(r,e){let t=r?Array.isArray(r)?r:[r]:[],o=Object.entries(e||{}).filter(([n,i])=>i!==void 0&&i!==!1).map(([n,i])=>Array.isArray(i)?i[0]?i[1]:"":i?n:"").filter(Boolean);return[...t.filter(Boolean),...o].join(" ")}function F(r){if(!r||typeof r!="string")return console.warn("Invalid cookie key provided"),null;try{let e=`${r}=`,n=decodeURIComponent(document.cookie).split("; ").find(a=>a.startsWith(e));if(!n)return null;let i=n.substring(e.length);try{return JSON.parse(i)}catch{return i}}catch(e){return console.error("Error retrieving cookie:",e),null}}function W(r,e,t){if(!r||typeof r!="string"){console.error("Invalid cookie key provided");return}let{daysUntilExpiration:o=0,sameSite:n="Strict",secure:i=!1,path:a="/",domain:g}=t??{};try{let u=encodeURIComponent(typeof e=="string"?e:JSON.stringify(e)),d=[`${r}=${u}`,`path=${a}`,n&&`SameSite=${n}`,i&&"Secure",g&&`domain=${g}`];if(o>0){let $=new Date(Date.now()+o*24*60*60*1e3);d.push(`expires=${$.toUTCString()}`)}document.cookie=d.filter(Boolean).join("; ")}catch(u){console.error("Error setting cookie:",u)}}function D(r,e){if(!r||typeof r!="string"){console.error("Invalid cookie key provided");return}let{path:t="/",domain:o}=e??{};try{let n=[`${r}=`,"expires=Thu, 01 Jan 1970 00:00:00 GMT",`path=${t}`,o&&`domain=${o}`,"Secure"];document.cookie=n.filter(Boolean).join("; ")}catch(n){console.error("Error removing cookie:",n)}}function M(r,e,t=!0){if(!r||!e)return console.warn("isActiveLink: pathname or itemPath is empty!"),!1;if(e.startsWith("#")||f(e))return!1;let o=s(r),n=s(p(e));return t||l(e)?o===n||o.startsWith(`${n}/`)||o.startsWith(`${n}?`):o===n}function J(r,e){if(!y())return e??null;let t=localStorage.getItem(r);if(t!=="undefined"){if(t)try{return JSON.parse(t)}catch{return t??e??null}return e??null}}function q(r,e){try{let t=JSON.stringify(e);window.localStorage.setItem(r,t)}catch(t){console.error("Error while setting storage:",t)}}function G(r){try{window.localStorage.removeItem(r)}catch(e){console.error("Error while removing from storage:",e)}}function y(){try{let r="__some_random_key_you_are_not_going_to_use__";return window.localStorage.setItem(r,r),window.localStorage.removeItem(r),!0}catch{return!1}}function H(r){if(typeof r!="string"||!r.trim())return console.error("Invalid input: CSS value must be a non-empty string"),"";let e=r.match(/var\(\s*(--[\w-]+)(?:\s*,[^)]*)?\s*\)/);return e?e[1]:(console.error(`Invalid CSS variable format: "${r}". Expected format: var(--variable-name)`),"")}function m(r,e=""){return r==null||typeof r=="number"&&Number.isNaN(r)?e:r.toString()}function S(r){let t=m(r).replace(/[^0-9.]/g,""),[o,...n]=t.split(".");return n.length>0?`${o}.${n.join("")}`:o}function w(r,e=""){if(r==null||typeof r=="number"&&Number.isNaN(r))return e;let t=parseFloat(r.toString());return Number.isNaN(t)?e:t}var K={onChange:S,onBlur:w,value:m};0&&(module.exports={createPaletteChannel,getCookie,getStorage,hasKeys,hasParams,hexToRgbChannel,isActiveLink,isEqualPath,isExternalLink,localStorageAvailable,mergeClasses,mergeRefs,parseCssVar,pxToRem,remToPx,removeCookie,removeLastSlash,removeParams,removeStorage,setCookie,setFont,setStorage,transformNumber,transformValue,transformValueOnBlur,transformValueOnChange,uuidv4,varAlpha});
1
+ "use strict";var l=Object.defineProperty;var k=Object.getOwnPropertyDescriptor;var T=Object.getOwnPropertyNames;var C=Object.prototype.hasOwnProperty;var v=(r,t)=>{for(var e in t)l(r,e,{get:t[e],enumerable:!0})},I=(r,t,e,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of T(t))!C.call(r,o)&&o!==e&&l(r,o,{get:()=>t[o],enumerable:!(n=k(t,o))||n.enumerable});return r};var E=r=>I(l({},"__esModule",{value:!0}),r);var Y={};v(Y,{createPaletteChannel:()=>L,getCookie:()=>B,getStorage:()=>q,hasKeys:()=>W,hasParams:()=>p,hexToRgbChannel:()=>b,isActiveLink:()=>J,isEqualPath:()=>P,isExternalLink:()=>m,localStorageAvailable:()=>y,mergeClasses:()=>F,mergeRefs:()=>R,parseCssVar:()=>K,pxToRem:()=>U,remToPx:()=>N,removeCookie:()=>M,removeLastSlash:()=>a,removeParams:()=>f,removeStorage:()=>H,safeReturnUrl:()=>A,setCookie:()=>D,setFont:()=>O,setStorage:()=>G,transformNumber:()=>z,transformValue:()=>g,transformValueOnBlur:()=>S,transformValueOnChange:()=>w,uuidv4:()=>j,varAlpha:()=>_});module.exports=E(Y);var h=require("es-toolkit");function p(r){try{let t=new URL(r,window.location.origin);return Array.from(t.searchParams.keys()).length>0}catch{return!1}}function a(r){return r!=="/"&&r.endsWith("/")?r.slice(0,-1):r}function P(r,t,e={deep:!0}){let n=o=>{try{let{pathname:i,searchParams:s}=new URL(o.trim(),"http://dummy");return e.deep?{pathname:a(i),params:Object.fromEntries(s)}:{pathname:a(i)}}catch{return{pathname:""}}};return(0,h.isEqual)(n(t),n(r))}function f(r){try{let t=new URL(r,window.location.origin);return a(t.pathname)}catch{return r}}function m(r){return/^https?:\/\//i.test(r)}function A(r,t){let e=t??"/";if(!r||typeof window>"u"||!window.location?.origin)return e;try{let n=new URL(r,window.location.origin),o=n.origin===window.location.origin,i=n.pathname.startsWith("/")&&!n.pathname.startsWith("//"),s=/^\/:+$/.test(n.pathname),c=n.pathname==="/"&&!n.search&&n.hash;return o&&i&&!s&&!c?`${n.pathname}${n.search}${n.hash}`:e}catch{return r.startsWith("/")&&!r.startsWith("//")?r:e}}function R(r){return t=>{if(r.length!==0)for(let e of r)e&&(typeof e=="function"?e(t):"current"in e&&(e.current=t))}}var x='-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"';function O(r){return r?`"${r}", ${x}`:x}function N(r){let t=parseFloat(r);return Math.round(t*16)}function U(r){if(typeof r!="number"||isNaN(r))throw new Error(`Invalid pixel value: ${r}`);return`${r/16}rem`}function b(r){if(!r)throw new Error("Hex color is undefined!");if(!/^#[0-9A-F]{6}$/i.test(r))throw new Error(`Invalid hex color: ${r}`);let t=parseInt(r.substring(1,3),16),e=parseInt(r.substring(3,5),16),n=parseInt(r.substring(5,7),16);return`${t} ${e} ${n}`}function L(r){let t={};return Object.entries(r).forEach(([e,n])=>{n&&(t[`${e}Channel`]=b(n))}),{...r,...t}}function V(r,t){let e=i=>i.includes("var(--"),n=i=>i.trim().endsWith("%"),o={invalid:`[Alpha]: Invalid opacity "${r}" for ${t}.`,range:"Must be a number between 0 and 1 (e.g., 0.48).",format:'Must be a percentage (e.g., "48%") or CSS variable (e.g., "var(--opacity)").'};if(typeof r=="string"){if(n(r))return r;if(e(r))return`calc(${r} * 100%)`;let i=parseFloat(r.trim());if(!isNaN(i)&&i>=0&&i<=1)return`${Number((i*100).toFixed(2))}%`;throw new Error(`${o.invalid} ${o.format}`)}if(typeof r=="number"){if(r>=0&&r<=1)return`${Number((r*100).toFixed(2))}%`;throw new Error(`${o.invalid} ${o.range}`)}throw new Error(`${o.invalid}`)}function _(r,t=1){if(!r?.trim())throw new Error("[Alpha]: Color is undefined or empty!");if(r.startsWith("#")||r.startsWith("rgb")||r.startsWith("rgba")||!r.includes("var")&&r.includes("Channel"))throw new Error([`[Alpha]: Unsupported color format "${r}"`,"\u2705 Supported formats:",'- RGB channels: "0 184 217"','- CSS variables with "Channel" prefix: "var(--palette-common-blackChannel, #000000)"',"\u274C Unsupported formats:",'- Hex: "#00B8D9"','- RGB: "rgb(0, 184, 217)"','- RGBA: "rgba(0, 184, 217, 1)"'].join(`
2
+ `));let n=V(t,r);return r.toLowerCase()==="currentcolor"?`color-mix(in srgb, currentColor ${n}, transparent)`:`rgba(${r} / ${n})`}function W(r,t){return!r||!t.length||typeof r!="object"?!1:t.every(e=>e in r)}function j(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,r=>{let t=Math.random()*16|0;return(r==="x"?t:t&3|8).toString(16)})}function F(r,t){let e=r?Array.isArray(r)?r:[r]:[],n=Object.entries(t||{}).filter(([o,i])=>i!==void 0&&i!==!1).map(([o,i])=>Array.isArray(i)?i[0]?i[1]:"":i?o:"").filter(Boolean);return[...e.filter(Boolean),...n].join(" ")}function B(r){if(!r||typeof r!="string")return console.warn("Invalid cookie key provided"),null;try{let t=`${r}=`,o=decodeURIComponent(document.cookie).split("; ").find(s=>s.startsWith(t));if(!o)return null;let i=o.substring(t.length);try{return JSON.parse(i)}catch{return i}}catch(t){return console.error("Error retrieving cookie:",t),null}}function D(r,t,e){if(!r||typeof r!="string"){console.error("Invalid cookie key provided");return}let{daysUntilExpiration:n=0,sameSite:o="Strict",secure:i=!1,path:s="/",domain:c}=e??{};try{let u=encodeURIComponent(typeof t=="string"?t:JSON.stringify(t)),d=[`${r}=${u}`,`path=${s}`,o&&`SameSite=${o}`,i&&"Secure",c&&`domain=${c}`];if(n>0){let $=new Date(Date.now()+n*24*60*60*1e3);d.push(`expires=${$.toUTCString()}`)}document.cookie=d.filter(Boolean).join("; ")}catch(u){console.error("Error setting cookie:",u)}}function M(r,t){if(!r||typeof r!="string"){console.error("Invalid cookie key provided");return}let{path:e="/",domain:n}=t??{};try{let o=[`${r}=`,"expires=Thu, 01 Jan 1970 00:00:00 GMT",`path=${e}`,n&&`domain=${n}`,"Secure"];document.cookie=o.filter(Boolean).join("; ")}catch(o){console.error("Error removing cookie:",o)}}function J(r,t,e=!0){if(!r||!t)return console.warn("isActiveLink: pathname or itemPath is empty!"),!1;if(t.startsWith("#")||m(t))return!1;let n=a(r),o=a(f(t));return e||p(t)?n===o||n.startsWith(`${o}/`)||n.startsWith(`${o}?`):n===o}function q(r,t){if(!y())return t??null;let e=localStorage.getItem(r);if(e!=="undefined"){if(e)try{return JSON.parse(e)}catch{return e??t??null}return t??null}}function G(r,t){try{let e=JSON.stringify(t);window.localStorage.setItem(r,e)}catch(e){console.error("Error while setting storage:",e)}}function H(r){try{window.localStorage.removeItem(r)}catch(t){console.error("Error while removing from storage:",t)}}function y(){try{let r="__some_random_key_you_are_not_going_to_use__";return window.localStorage.setItem(r,r),window.localStorage.removeItem(r),!0}catch{return!1}}function K(r){if(typeof r!="string"||!r.trim())return console.error("Invalid input: CSS value must be a non-empty string"),"";let t=r.match(/var\(\s*(--[\w-]+)(?:\s*,[^)]*)?\s*\)/);return t?t[1]:(console.error(`Invalid CSS variable format: "${r}". Expected format: var(--variable-name)`),"")}function g(r,t=""){return r==null||typeof r=="number"&&Number.isNaN(r)?t:r.toString()}function w(r){let e=g(r).replace(/[^0-9.]/g,""),[n,...o]=e.split(".");return o.length>0?`${n}.${o.join("")}`:n}function S(r,t=""){if(r==null||typeof r=="number"&&Number.isNaN(r))return t;let e=parseFloat(r.toString());return Number.isNaN(e)?t:e}var z={onChange:w,onBlur:S,value:g};0&&(module.exports={createPaletteChannel,getCookie,getStorage,hasKeys,hasParams,hexToRgbChannel,isActiveLink,isEqualPath,isExternalLink,localStorageAvailable,mergeClasses,mergeRefs,parseCssVar,pxToRem,remToPx,removeCookie,removeLastSlash,removeParams,removeStorage,safeReturnUrl,setCookie,setFont,setStorage,transformNumber,transformValue,transformValueOnBlur,transformValueOnChange,uuidv4,varAlpha});
@@ -1,4 +1,4 @@
1
- export { EqualPathOptions, hasParams, isEqualPath, isExternalLink, removeLastSlash, removeParams } from './url/url.cjs';
1
+ export { EqualPathOptions, hasParams, isEqualPath, isExternalLink, removeLastSlash, removeParams, safeReturnUrl } from './url/url.cjs';
2
2
  export { mergeRefs } from './refs/refs.cjs';
3
3
  export { pxToRem, remToPx, setFont } from './font/font.cjs';
4
4
  export { ChannelPalette, InputPalette, createPaletteChannel, hexToRgbChannel, varAlpha } from './color/color.cjs';
@@ -1,4 +1,4 @@
1
- export { EqualPathOptions, hasParams, isEqualPath, isExternalLink, removeLastSlash, removeParams } from './url/url.js';
1
+ export { EqualPathOptions, hasParams, isEqualPath, isExternalLink, removeLastSlash, removeParams, safeReturnUrl } from './url/url.js';
2
2
  export { mergeRefs } from './refs/refs.js';
3
3
  export { pxToRem, remToPx, setFont } from './font/font.js';
4
4
  export { ChannelPalette, InputPalette, createPaletteChannel, hexToRgbChannel, varAlpha } from './color/color.js';
@@ -1,2 +1,2 @@
1
- import{isEqual as h}from"es-toolkit";function p(r){try{let e=new URL(r,window.location.origin);return Array.from(e.searchParams.keys()).length>0}catch{return!1}}function s(r){return r!=="/"&&r.endsWith("/")?r.slice(0,-1):r}function T(r,e,t={deep:!0}){let n=o=>{try{let{pathname:i,searchParams:a}=new URL(o.trim(),"http://dummy");return t.deep?{pathname:s(i),params:Object.fromEntries(a)}:{pathname:s(i)}}catch{return{pathname:""}}};return h(n(e),n(r))}function f(r){try{let e=new URL(r,window.location.origin);return s(e.pathname)}catch{return r}}function m(r){return/^https?:\/\//i.test(r)}function C(r){return e=>{if(r.length!==0)for(let t of r)t&&(typeof t=="function"?t(e):"current"in t&&(t.current=e))}}var g='-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"';function E(r){return r?`"${r}", ${g}`:g}function P(r){let e=parseFloat(r);return Math.round(e*16)}function A(r){if(typeof r!="number"||isNaN(r))throw new Error(`Invalid pixel value: ${r}`);return`${r/16}rem`}function b(r){if(!r)throw new Error("Hex color is undefined!");if(!/^#[0-9A-F]{6}$/i.test(r))throw new Error(`Invalid hex color: ${r}`);let e=parseInt(r.substring(1,3),16),t=parseInt(r.substring(3,5),16),n=parseInt(r.substring(5,7),16);return`${e} ${t} ${n}`}function O(r){let e={};return Object.entries(r).forEach(([t,n])=>{n&&(e[`${t}Channel`]=b(n))}),{...r,...e}}function y(r,e){let t=i=>i.includes("var(--"),n=i=>i.trim().endsWith("%"),o={invalid:`[Alpha]: Invalid opacity "${r}" for ${e}.`,range:"Must be a number between 0 and 1 (e.g., 0.48).",format:'Must be a percentage (e.g., "48%") or CSS variable (e.g., "var(--opacity)").'};if(typeof r=="string"){if(n(r))return r;if(t(r))return`calc(${r} * 100%)`;throw new Error(`${o.invalid} ${o.format}`)}if(typeof r=="number"){if(r>=0&&r<=1)return`${Number((r*100).toFixed(2))}%`;throw new Error(`${o.invalid} ${o.range}`)}throw new Error(`${o.invalid}`)}function N(r,e=1){if(!r?.trim())throw new Error("[Alpha]: Color is undefined or empty!");if(r.startsWith("#")||r.startsWith("rgb")||r.startsWith("rgba")||!r.includes("var")&&r.includes("Channel"))throw new Error([`[Alpha]: Unsupported color format "${r}"`,"\u2705 Supported formats:",'- RGB channels: "0 184 217"','- CSS variables with "Channel" prefix: "var(--palette-common-blackChannel, #000000)"',"\u274C Unsupported formats:",'- Hex: "#00B8D9"','- RGB: "rgb(0, 184, 217)"','- RGBA: "rgba(0, 184, 217, 1)"'].join(`
2
- `));let n=y(e,r);return r.toLowerCase()==="currentcolor"?`color-mix(in srgb, currentColor ${n}, transparent)`:`rgba(${r} / ${n})`}function L(r,e){return!r||!e.length||typeof r!="object"?!1:e.every(t=>t in r)}function V(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,r=>{let e=Math.random()*16|0;return(r==="x"?e:e&3|8).toString(16)})}function B(r,e){let t=r?Array.isArray(r)?r:[r]:[],n=Object.entries(e||{}).filter(([o,i])=>i!==void 0&&i!==!1).map(([o,i])=>Array.isArray(i)?i[0]?i[1]:"":i?o:"").filter(Boolean);return[...t.filter(Boolean),...n].join(" ")}function W(r){if(!r||typeof r!="string")return console.warn("Invalid cookie key provided"),null;try{let e=`${r}=`,o=decodeURIComponent(document.cookie).split("; ").find(a=>a.startsWith(e));if(!o)return null;let i=o.substring(e.length);try{return JSON.parse(i)}catch{return i}}catch(e){return console.error("Error retrieving cookie:",e),null}}function D(r,e,t){if(!r||typeof r!="string"){console.error("Invalid cookie key provided");return}let{daysUntilExpiration:n=0,sameSite:o="Strict",secure:i=!1,path:a="/",domain:c}=t??{};try{let u=encodeURIComponent(typeof e=="string"?e:JSON.stringify(e)),l=[`${r}=${u}`,`path=${a}`,o&&`SameSite=${o}`,i&&"Secure",c&&`domain=${c}`];if(n>0){let x=new Date(Date.now()+n*24*60*60*1e3);l.push(`expires=${x.toUTCString()}`)}document.cookie=l.filter(Boolean).join("; ")}catch(u){console.error("Error setting cookie:",u)}}function M(r,e){if(!r||typeof r!="string"){console.error("Invalid cookie key provided");return}let{path:t="/",domain:n}=e??{};try{let o=[`${r}=`,"expires=Thu, 01 Jan 1970 00:00:00 GMT",`path=${t}`,n&&`domain=${n}`,"Secure"];document.cookie=o.filter(Boolean).join("; ")}catch(o){console.error("Error removing cookie:",o)}}function G(r,e,t=!0){if(!r||!e)return console.warn("isActiveLink: pathname or itemPath is empty!"),!1;if(e.startsWith("#")||m(e))return!1;let n=s(r),o=s(f(e));return t||p(e)?n===o||n.startsWith(`${o}/`)||n.startsWith(`${o}?`):n===o}function K(r,e){if(!S())return e??null;let t=localStorage.getItem(r);if(t!=="undefined"){if(t)try{return JSON.parse(t)}catch{return t??e??null}return e??null}}function z(r,e){try{let t=JSON.stringify(e);window.localStorage.setItem(r,t)}catch(t){console.error("Error while setting storage:",t)}}function Y(r){try{window.localStorage.removeItem(r)}catch(e){console.error("Error while removing from storage:",e)}}function S(){try{let r="__some_random_key_you_are_not_going_to_use__";return window.localStorage.setItem(r,r),window.localStorage.removeItem(r),!0}catch{return!1}}function X(r){if(typeof r!="string"||!r.trim())return console.error("Invalid input: CSS value must be a non-empty string"),"";let e=r.match(/var\(\s*(--[\w-]+)(?:\s*,[^)]*)?\s*\)/);return e?e[1]:(console.error(`Invalid CSS variable format: "${r}". Expected format: var(--variable-name)`),"")}function d(r,e=""){return r==null||typeof r=="number"&&Number.isNaN(r)?e:r.toString()}function w(r){let t=d(r).replace(/[^0-9.]/g,""),[n,...o]=t.split(".");return o.length>0?`${n}.${o.join("")}`:n}function $(r,e=""){if(r==null||typeof r=="number"&&Number.isNaN(r))return e;let t=parseFloat(r.toString());return Number.isNaN(t)?e:t}var rr={onChange:w,onBlur:$,value:d};export{O as createPaletteChannel,W as getCookie,K as getStorage,L as hasKeys,p as hasParams,b as hexToRgbChannel,G as isActiveLink,T as isEqualPath,m as isExternalLink,S as localStorageAvailable,B as mergeClasses,C as mergeRefs,X as parseCssVar,A as pxToRem,P as remToPx,M as removeCookie,s as removeLastSlash,f as removeParams,Y as removeStorage,D as setCookie,E as setFont,z as setStorage,rr as transformNumber,d as transformValue,$ as transformValueOnBlur,w as transformValueOnChange,V as uuidv4,N as varAlpha};
1
+ import{isEqual as x}from"es-toolkit";function p(r){try{let t=new URL(r,window.location.origin);return Array.from(t.searchParams.keys()).length>0}catch{return!1}}function a(r){return r!=="/"&&r.endsWith("/")?r.slice(0,-1):r}function T(r,t,e={deep:!0}){let n=o=>{try{let{pathname:i,searchParams:s}=new URL(o.trim(),"http://dummy");return e.deep?{pathname:a(i),params:Object.fromEntries(s)}:{pathname:a(i)}}catch{return{pathname:""}}};return x(n(t),n(r))}function f(r){try{let t=new URL(r,window.location.origin);return a(t.pathname)}catch{return r}}function m(r){return/^https?:\/\//i.test(r)}function C(r,t){let e=t??"/";if(!r||typeof window>"u"||!window.location?.origin)return e;try{let n=new URL(r,window.location.origin),o=n.origin===window.location.origin,i=n.pathname.startsWith("/")&&!n.pathname.startsWith("//"),s=/^\/:+$/.test(n.pathname),c=n.pathname==="/"&&!n.search&&n.hash;return o&&i&&!s&&!c?`${n.pathname}${n.search}${n.hash}`:e}catch{return r.startsWith("/")&&!r.startsWith("//")?r:e}}function I(r){return t=>{if(r.length!==0)for(let e of r)e&&(typeof e=="function"?e(t):"current"in e&&(e.current=t))}}var g='-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"';function P(r){return r?`"${r}", ${g}`:g}function A(r){let t=parseFloat(r);return Math.round(t*16)}function R(r){if(typeof r!="number"||isNaN(r))throw new Error(`Invalid pixel value: ${r}`);return`${r/16}rem`}function b(r){if(!r)throw new Error("Hex color is undefined!");if(!/^#[0-9A-F]{6}$/i.test(r))throw new Error(`Invalid hex color: ${r}`);let t=parseInt(r.substring(1,3),16),e=parseInt(r.substring(3,5),16),n=parseInt(r.substring(5,7),16);return`${t} ${e} ${n}`}function N(r){let t={};return Object.entries(r).forEach(([e,n])=>{n&&(t[`${e}Channel`]=b(n))}),{...r,...t}}function y(r,t){let e=i=>i.includes("var(--"),n=i=>i.trim().endsWith("%"),o={invalid:`[Alpha]: Invalid opacity "${r}" for ${t}.`,range:"Must be a number between 0 and 1 (e.g., 0.48).",format:'Must be a percentage (e.g., "48%") or CSS variable (e.g., "var(--opacity)").'};if(typeof r=="string"){if(n(r))return r;if(e(r))return`calc(${r} * 100%)`;let i=parseFloat(r.trim());if(!isNaN(i)&&i>=0&&i<=1)return`${Number((i*100).toFixed(2))}%`;throw new Error(`${o.invalid} ${o.format}`)}if(typeof r=="number"){if(r>=0&&r<=1)return`${Number((r*100).toFixed(2))}%`;throw new Error(`${o.invalid} ${o.range}`)}throw new Error(`${o.invalid}`)}function U(r,t=1){if(!r?.trim())throw new Error("[Alpha]: Color is undefined or empty!");if(r.startsWith("#")||r.startsWith("rgb")||r.startsWith("rgba")||!r.includes("var")&&r.includes("Channel"))throw new Error([`[Alpha]: Unsupported color format "${r}"`,"\u2705 Supported formats:",'- RGB channels: "0 184 217"','- CSS variables with "Channel" prefix: "var(--palette-common-blackChannel, #000000)"',"\u274C Unsupported formats:",'- Hex: "#00B8D9"','- RGB: "rgb(0, 184, 217)"','- RGBA: "rgba(0, 184, 217, 1)"'].join(`
2
+ `));let n=y(t,r);return r.toLowerCase()==="currentcolor"?`color-mix(in srgb, currentColor ${n}, transparent)`:`rgba(${r} / ${n})`}function V(r,t){return!r||!t.length||typeof r!="object"?!1:t.every(e=>e in r)}function W(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,r=>{let t=Math.random()*16|0;return(r==="x"?t:t&3|8).toString(16)})}function F(r,t){let e=r?Array.isArray(r)?r:[r]:[],n=Object.entries(t||{}).filter(([o,i])=>i!==void 0&&i!==!1).map(([o,i])=>Array.isArray(i)?i[0]?i[1]:"":i?o:"").filter(Boolean);return[...e.filter(Boolean),...n].join(" ")}function D(r){if(!r||typeof r!="string")return console.warn("Invalid cookie key provided"),null;try{let t=`${r}=`,o=decodeURIComponent(document.cookie).split("; ").find(s=>s.startsWith(t));if(!o)return null;let i=o.substring(t.length);try{return JSON.parse(i)}catch{return i}}catch(t){return console.error("Error retrieving cookie:",t),null}}function M(r,t,e){if(!r||typeof r!="string"){console.error("Invalid cookie key provided");return}let{daysUntilExpiration:n=0,sameSite:o="Strict",secure:i=!1,path:s="/",domain:c}=e??{};try{let u=encodeURIComponent(typeof t=="string"?t:JSON.stringify(t)),l=[`${r}=${u}`,`path=${s}`,o&&`SameSite=${o}`,i&&"Secure",c&&`domain=${c}`];if(n>0){let h=new Date(Date.now()+n*24*60*60*1e3);l.push(`expires=${h.toUTCString()}`)}document.cookie=l.filter(Boolean).join("; ")}catch(u){console.error("Error setting cookie:",u)}}function J(r,t){if(!r||typeof r!="string"){console.error("Invalid cookie key provided");return}let{path:e="/",domain:n}=t??{};try{let o=[`${r}=`,"expires=Thu, 01 Jan 1970 00:00:00 GMT",`path=${e}`,n&&`domain=${n}`,"Secure"];document.cookie=o.filter(Boolean).join("; ")}catch(o){console.error("Error removing cookie:",o)}}function H(r,t,e=!0){if(!r||!t)return console.warn("isActiveLink: pathname or itemPath is empty!"),!1;if(t.startsWith("#")||m(t))return!1;let n=a(r),o=a(f(t));return e||p(t)?n===o||n.startsWith(`${o}/`)||n.startsWith(`${o}?`):n===o}function z(r,t){if(!w())return t??null;let e=localStorage.getItem(r);if(e!=="undefined"){if(e)try{return JSON.parse(e)}catch{return e??t??null}return t??null}}function Y(r,t){try{let e=JSON.stringify(t);window.localStorage.setItem(r,e)}catch(e){console.error("Error while setting storage:",e)}}function Q(r){try{window.localStorage.removeItem(r)}catch(t){console.error("Error while removing from storage:",t)}}function w(){try{let r="__some_random_key_you_are_not_going_to_use__";return window.localStorage.setItem(r,r),window.localStorage.removeItem(r),!0}catch{return!1}}function Z(r){if(typeof r!="string"||!r.trim())return console.error("Invalid input: CSS value must be a non-empty string"),"";let t=r.match(/var\(\s*(--[\w-]+)(?:\s*,[^)]*)?\s*\)/);return t?t[1]:(console.error(`Invalid CSS variable format: "${r}". Expected format: var(--variable-name)`),"")}function d(r,t=""){return r==null||typeof r=="number"&&Number.isNaN(r)?t:r.toString()}function S(r){let e=d(r).replace(/[^0-9.]/g,""),[n,...o]=e.split(".");return o.length>0?`${n}.${o.join("")}`:n}function $(r,t=""){if(r==null||typeof r=="number"&&Number.isNaN(r))return t;let e=parseFloat(r.toString());return Number.isNaN(e)?t:e}var tr={onChange:S,onBlur:$,value:d};export{N as createPaletteChannel,D as getCookie,z as getStorage,V as hasKeys,p as hasParams,b as hexToRgbChannel,H as isActiveLink,T as isEqualPath,m as isExternalLink,w as localStorageAvailable,F as mergeClasses,I as mergeRefs,Z as parseCssVar,R as pxToRem,A as remToPx,J as removeCookie,a as removeLastSlash,f as removeParams,Q as removeStorage,C as safeReturnUrl,M as setCookie,P as setFont,Y as setStorage,tr as transformNumber,d as transformValue,$ as transformValueOnBlur,S as transformValueOnChange,W as uuidv4,U as varAlpha};
@@ -1 +1 @@
1
- "use strict";var s=Object.defineProperty;var p=Object.getOwnPropertyDescriptor;var l=Object.getOwnPropertyNames;var m=Object.prototype.hasOwnProperty;var h=(t,r)=>{for(var e in r)s(t,e,{get:r[e],enumerable:!0})},g=(t,r,e,o)=>{if(r&&typeof r=="object"||typeof r=="function")for(let n of l(r))!m.call(t,n)&&n!==e&&s(t,n,{get:()=>r[n],enumerable:!(o=p(r,n))||o.enumerable});return t};var f=t=>g(s({},"__esModule",{value:!0}),t);var y={};h(y,{hasParams:()=>d,isEqualPath:()=>x,isExternalLink:()=>w,removeLastSlash:()=>a,removeParams:()=>b});module.exports=f(y);var c=require("es-toolkit");function d(t){try{let r=new URL(t,window.location.origin);return Array.from(r.searchParams.keys()).length>0}catch{return!1}}function a(t){return t!=="/"&&t.endsWith("/")?t.slice(0,-1):t}function x(t,r,e={deep:!0}){let o=n=>{try{let{pathname:i,searchParams:u}=new URL(n.trim(),"http://dummy");return e.deep?{pathname:a(i),params:Object.fromEntries(u)}:{pathname:a(i)}}catch{return{pathname:""}}};return(0,c.isEqual)(o(r),o(t))}function b(t){try{let r=new URL(t,window.location.origin);return a(r.pathname)}catch{return t}}function w(t){return/^https?:\/\//i.test(t)}0&&(module.exports={hasParams,isEqualPath,isExternalLink,removeLastSlash,removeParams});
1
+ "use strict";var c=Object.defineProperty;var u=Object.getOwnPropertyDescriptor;var p=Object.getOwnPropertyNames;var m=Object.prototype.hasOwnProperty;var f=(t,n)=>{for(var i in n)c(t,i,{get:n[i],enumerable:!0})},g=(t,n,i,r)=>{if(n&&typeof n=="object"||typeof n=="function")for(let a of p(n))!m.call(t,a)&&a!==i&&c(t,a,{get:()=>n[a],enumerable:!(r=u(n,a))||r.enumerable});return t};var d=t=>g(c({},"__esModule",{value:!0}),t);var L={};f(L,{hasParams:()=>w,isEqualPath:()=>y,isExternalLink:()=>x,removeLastSlash:()=>s,removeParams:()=>P,safeReturnUrl:()=>b});module.exports=d(L);var h=require("es-toolkit");function w(t){try{let n=new URL(t,window.location.origin);return Array.from(n.searchParams.keys()).length>0}catch{return!1}}function s(t){return t!=="/"&&t.endsWith("/")?t.slice(0,-1):t}function y(t,n,i={deep:!0}){let r=a=>{try{let{pathname:e,searchParams:o}=new URL(a.trim(),"http://dummy");return i.deep?{pathname:s(e),params:Object.fromEntries(o)}:{pathname:s(e)}}catch{return{pathname:""}}};return(0,h.isEqual)(r(n),r(t))}function P(t){try{let n=new URL(t,window.location.origin);return s(n.pathname)}catch{return t}}function x(t){return/^https?:\/\//i.test(t)}function b(t,n){let i=n??"/";if(!t||typeof window>"u"||!window.location?.origin)return i;try{let r=new URL(t,window.location.origin),a=r.origin===window.location.origin,e=r.pathname.startsWith("/")&&!r.pathname.startsWith("//"),o=/^\/:+$/.test(r.pathname),l=r.pathname==="/"&&!r.search&&r.hash;return a&&e&&!o&&!l?`${r.pathname}${r.search}${r.hash}`:i}catch{return t.startsWith("/")&&!t.startsWith("//")?t:i}}0&&(module.exports={hasParams,isEqualPath,isExternalLink,removeLastSlash,removeParams,safeReturnUrl});
@@ -1 +1 @@
1
- export { EqualPathOptions, hasParams, isEqualPath, isExternalLink, removeLastSlash, removeParams } from './url.cjs';
1
+ export { EqualPathOptions, hasParams, isEqualPath, isExternalLink, removeLastSlash, removeParams, safeReturnUrl } from './url.cjs';
@@ -1 +1 @@
1
- export { EqualPathOptions, hasParams, isEqualPath, isExternalLink, removeLastSlash, removeParams } from './url.js';
1
+ export { EqualPathOptions, hasParams, isEqualPath, isExternalLink, removeLastSlash, removeParams, safeReturnUrl } from './url.js';
@@ -1 +1 @@
1
- import{isEqual as c}from"es-toolkit";function p(t){try{let r=new URL(t,window.location.origin);return Array.from(r.searchParams.keys()).length>0}catch{return!1}}function n(t){return t!=="/"&&t.endsWith("/")?t.slice(0,-1):t}function l(t,r,a={deep:!0}){let e=s=>{try{let{pathname:o,searchParams:i}=new URL(s.trim(),"http://dummy");return a.deep?{pathname:n(o),params:Object.fromEntries(i)}:{pathname:n(o)}}catch{return{pathname:""}}};return c(e(r),e(t))}function m(t){try{let r=new URL(t,window.location.origin);return n(r.pathname)}catch{return t}}function h(t){return/^https?:\/\//i.test(t)}export{p as hasParams,l as isEqualPath,h as isExternalLink,n as removeLastSlash,m as removeParams};
1
+ import{isEqual as h}from"es-toolkit";function u(t){try{let r=new URL(t,window.location.origin);return Array.from(r.searchParams.keys()).length>0}catch{return!1}}function o(t){return t!=="/"&&t.endsWith("/")?t.slice(0,-1):t}function p(t,r,i={deep:!0}){let n=e=>{try{let{pathname:a,searchParams:s}=new URL(e.trim(),"http://dummy");return i.deep?{pathname:o(a),params:Object.fromEntries(s)}:{pathname:o(a)}}catch{return{pathname:""}}};return h(n(r),n(t))}function m(t){try{let r=new URL(t,window.location.origin);return o(r.pathname)}catch{return t}}function f(t){return/^https?:\/\//i.test(t)}function g(t,r){let i=r??"/";if(!t||typeof window>"u"||!window.location?.origin)return i;try{let n=new URL(t,window.location.origin),e=n.origin===window.location.origin,a=n.pathname.startsWith("/")&&!n.pathname.startsWith("//"),s=/^\/:+$/.test(n.pathname),c=n.pathname==="/"&&!n.search&&n.hash;return e&&a&&!s&&!c?`${n.pathname}${n.search}${n.hash}`:i}catch{return t.startsWith("/")&&!t.startsWith("//")?t:i}}export{u as hasParams,p as isEqualPath,f as isExternalLink,o as removeLastSlash,m as removeParams,g as safeReturnUrl};
@@ -1 +1 @@
1
- "use strict";var s=Object.defineProperty;var l=Object.getOwnPropertyDescriptor;var p=Object.getOwnPropertyNames;var h=Object.prototype.hasOwnProperty;var m=(t,r)=>{for(var e in r)s(t,e,{get:r[e],enumerable:!0})},g=(t,r,e,a)=>{if(r&&typeof r=="object"||typeof r=="function")for(let n of p(r))!h.call(t,n)&&n!==e&&s(t,n,{get:()=>r[n],enumerable:!(a=l(r,n))||a.enumerable});return t};var d=t=>g(s({},"__esModule",{value:!0}),t);var y={};m(y,{hasParams:()=>f,isEqualPath:()=>b,isExternalLink:()=>x,removeLastSlash:()=>o,removeParams:()=>w});module.exports=d(y);var c=require("es-toolkit");function f(t){try{let r=new URL(t,window.location.origin);return Array.from(r.searchParams.keys()).length>0}catch{return!1}}function o(t){return t!=="/"&&t.endsWith("/")?t.slice(0,-1):t}function b(t,r,e={deep:!0}){let a=n=>{try{let{pathname:i,searchParams:u}=new URL(n.trim(),"http://dummy");return e.deep?{pathname:o(i),params:Object.fromEntries(u)}:{pathname:o(i)}}catch{return{pathname:""}}};return(0,c.isEqual)(a(r),a(t))}function w(t){try{let r=new URL(t,window.location.origin);return o(r.pathname)}catch{return t}}function x(t){return/^https?:\/\//i.test(t)}0&&(module.exports={hasParams,isEqualPath,isExternalLink,removeLastSlash,removeParams});
1
+ "use strict";var c=Object.defineProperty;var u=Object.getOwnPropertyDescriptor;var p=Object.getOwnPropertyNames;var m=Object.prototype.hasOwnProperty;var g=(t,n)=>{for(var i in n)c(t,i,{get:n[i],enumerable:!0})},f=(t,n,i,r)=>{if(n&&typeof n=="object"||typeof n=="function")for(let a of p(n))!m.call(t,a)&&a!==i&&c(t,a,{get:()=>n[a],enumerable:!(r=u(n,a))||r.enumerable});return t};var d=t=>f(c({},"__esModule",{value:!0}),t);var L={};g(L,{hasParams:()=>w,isEqualPath:()=>y,isExternalLink:()=>b,removeLastSlash:()=>e,removeParams:()=>P,safeReturnUrl:()=>x});module.exports=d(L);var h=require("es-toolkit");function w(t){try{let n=new URL(t,window.location.origin);return Array.from(n.searchParams.keys()).length>0}catch{return!1}}function e(t){return t!=="/"&&t.endsWith("/")?t.slice(0,-1):t}function y(t,n,i={deep:!0}){let r=a=>{try{let{pathname:s,searchParams:o}=new URL(a.trim(),"http://dummy");return i.deep?{pathname:e(s),params:Object.fromEntries(o)}:{pathname:e(s)}}catch{return{pathname:""}}};return(0,h.isEqual)(r(n),r(t))}function P(t){try{let n=new URL(t,window.location.origin);return e(n.pathname)}catch{return t}}function b(t){return/^https?:\/\//i.test(t)}function x(t,n){let i=n??"/";if(!t||typeof window>"u"||!window.location?.origin)return i;try{let r=new URL(t,window.location.origin),a=r.origin===window.location.origin,s=r.pathname.startsWith("/")&&!r.pathname.startsWith("//"),o=/^\/:+$/.test(r.pathname),l=r.pathname==="/"&&!r.search&&r.hash;return a&&s&&!o&&!l?`${r.pathname}${r.search}${r.hash}`:i}catch{return t.startsWith("/")&&!t.startsWith("//")?t:i}}0&&(module.exports={hasParams,isEqualPath,isExternalLink,removeLastSlash,removeParams,safeReturnUrl});
@@ -58,5 +58,17 @@ declare function removeParams(url: string): string;
58
58
  * isExternalLink('/internal'); // false
59
59
  */
60
60
  declare function isExternalLink(url: string): boolean;
61
+ /**
62
+ * Safely returns a URL or a fallback if the URL is invalid or not same-origin.
63
+ *
64
+ * @param value - The URL to validate.
65
+ * @param fallback - The fallback URL to return if the value is invalid.
66
+ * @returns A safe URL or the fallback.
67
+ *
68
+ * @example
69
+ * safeReturnUrl('/dashboard', '/home'); // '/dashboard'
70
+ * safeReturnUrl('https://example.com', '/home'); // '/'
71
+ */
72
+ declare function safeReturnUrl(value: string | null, fallback?: string | null): string;
61
73
 
62
- export { type EqualPathOptions, hasParams, isEqualPath, isExternalLink, removeLastSlash, removeParams };
74
+ export { type EqualPathOptions, hasParams, isEqualPath, isExternalLink, removeLastSlash, removeParams, safeReturnUrl };
@@ -58,5 +58,17 @@ declare function removeParams(url: string): string;
58
58
  * isExternalLink('/internal'); // false
59
59
  */
60
60
  declare function isExternalLink(url: string): boolean;
61
+ /**
62
+ * Safely returns a URL or a fallback if the URL is invalid or not same-origin.
63
+ *
64
+ * @param value - The URL to validate.
65
+ * @param fallback - The fallback URL to return if the value is invalid.
66
+ * @returns A safe URL or the fallback.
67
+ *
68
+ * @example
69
+ * safeReturnUrl('/dashboard', '/home'); // '/dashboard'
70
+ * safeReturnUrl('https://example.com', '/home'); // '/'
71
+ */
72
+ declare function safeReturnUrl(value: string | null, fallback?: string | null): string;
61
73
 
62
- export { type EqualPathOptions, hasParams, isEqualPath, isExternalLink, removeLastSlash, removeParams };
74
+ export { type EqualPathOptions, hasParams, isEqualPath, isExternalLink, removeLastSlash, removeParams, safeReturnUrl };
@@ -1 +1 @@
1
- import{isEqual as c}from"es-toolkit";function l(t){try{let r=new URL(t,window.location.origin);return Array.from(r.searchParams.keys()).length>0}catch{return!1}}function n(t){return t!=="/"&&t.endsWith("/")?t.slice(0,-1):t}function p(t,r,o={deep:!0}){let e=s=>{try{let{pathname:a,searchParams:i}=new URL(s.trim(),"http://dummy");return o.deep?{pathname:n(a),params:Object.fromEntries(i)}:{pathname:n(a)}}catch{return{pathname:""}}};return c(e(r),e(t))}function h(t){try{let r=new URL(t,window.location.origin);return n(r.pathname)}catch{return t}}function m(t){return/^https?:\/\//i.test(t)}export{l as hasParams,p as isEqualPath,m as isExternalLink,n as removeLastSlash,h as removeParams};
1
+ import{isEqual as h}from"es-toolkit";function u(t){try{let r=new URL(t,window.location.origin);return Array.from(r.searchParams.keys()).length>0}catch{return!1}}function o(t){return t!=="/"&&t.endsWith("/")?t.slice(0,-1):t}function p(t,r,i={deep:!0}){let n=s=>{try{let{pathname:a,searchParams:e}=new URL(s.trim(),"http://dummy");return i.deep?{pathname:o(a),params:Object.fromEntries(e)}:{pathname:o(a)}}catch{return{pathname:""}}};return h(n(r),n(t))}function m(t){try{let r=new URL(t,window.location.origin);return o(r.pathname)}catch{return t}}function g(t){return/^https?:\/\//i.test(t)}function f(t,r){let i=r??"/";if(!t||typeof window>"u"||!window.location?.origin)return i;try{let n=new URL(t,window.location.origin),s=n.origin===window.location.origin,a=n.pathname.startsWith("/")&&!n.pathname.startsWith("//"),e=/^\/:+$/.test(n.pathname),c=n.pathname==="/"&&!n.search&&n.hash;return s&&a&&!e&&!c?`${n.pathname}${n.search}${n.hash}`:i}catch{return t.startsWith("/")&&!t.startsWith("//")?t:i}}export{u as hasParams,p as isEqualPath,g as isExternalLink,o as removeLastSlash,m as removeParams,f as safeReturnUrl};
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "minimal-shared",
3
3
  "author": "Minimals",
4
- "version": "1.0.14",
4
+ "version": "1.0.15",
5
5
  "description": "Shared hooks and utils used by Minimal UI and Zone UI.",
6
6
  "keywords": [
7
7
  "typescript",
@@ -66,8 +66,8 @@
66
66
  "tsup": "^8.3.6",
67
67
  "typescript": "^5.7.3",
68
68
  "vitest": "^3.0.6",
69
- "internal-eslint-config": "1.0.0",
70
- "internal-ts-config": "1.0.0"
69
+ "internal-ts-config": "1.0.0",
70
+ "internal-eslint-config": "1.0.0"
71
71
  },
72
72
  "peerDependencies": {
73
73
  "react": "^18.0.0 || ^19.0.0"