dphelper 3.3.6 → 3.3.7

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.
Files changed (3) hide show
  1. package/index.cjs +1 -1
  2. package/index.js +1 -1
  3. package/package.json +1 -1
package/index.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";var e=globalThis.dphelper;if(e&&e.version&&function(e,t){const o=String(e??""),a=String(t);if(o===a)return 0;const n=o.split("."),r=a.split("."),i=Math.max(n.length,r.length);for(let e=0;e<i;e++){const t=parseInt(n[e]??"0",10),o=parseInt(r[e]??"0",10);if(Number.isNaN(t)||Number.isNaN(o)){const t=n[e]??"",o=r[e]??"";if(t<o)return-1;if(t>o)return 1}else{if(t<o)return-1;if(t>o)return 1}}return 0}(e.version,"3.3.6")<0)try{delete globalThis.dphelper}catch{console.debug("Could not delete existing dphelper (likely non-configurable)")}var t=Object.getOwnPropertyDescriptor(globalThis,"dphelper");t&&!t.configurable?t.writable?void 0===globalThis.dphelper&&(globalThis.dphelper={}):console.debug("dphelper already defined on globalThis and is not writable/configurable"):Object.defineProperty(globalThis,"dphelper",{value:globalThis.dphelper||{},writable:!0,configurable:!0,enumerable:!1}),globalThis.dphelper&&Object.defineProperties(globalThis.dphelper,{_list:{value:{scripts:[],sockets:[],info:{title:"List",description:"Complete list of tools"},categories:["3party","system","financial","memory","numbers","time","path","file","forms","ui","other","development"]},configurable:!0,writable:!0},version:{value:"3.3.6",configurable:!0,writable:!0},isServer:{value:"undefined"==typeof window,configurable:!0,writable:!0},isBrowser:{value:"undefined"!=typeof window,configurable:!0,writable:!0}});var o=globalThis.dphelper;Object.defineProperty(o,"setProps",{value:(e,t,o)=>{Object.defineProperty(e,t.name,o||{writable:!1,configurable:!1,enumerable:!1}),o?.lock&&Object.freeze(e[t.name])},writable:!1,configurable:!1,enumerable:!1}),Object.defineProperty(o,"setDescription",{value:(e,t)=>{Object.defineProperties(o,{[e.name]:{value:t,writable:!1,configurable:!1,enumerable:!1}}),Object.keys(t).map(t=>(Object.defineProperties(o[e.name],{[t]:{writable:!1,configurable:!1,enumerable:!1}}),null)),o.setProps(o,e,{writable:!1,configurable:!1,enumerable:!1}),o._list.scripts.push(e)}});var a=e=>null===e||"object"!=typeof e,n=e=>null===e?"null":"string"==typeof e?e.includes(",")||e.includes(":")||e.includes('"')||e.includes("\n")||e.trim()!==e?`"${e.replace(/"/g,'\\"')}"`:e||'""':String(e),r=(e,t=0)=>{const o=" ".repeat(t);if(a(e))return n(e);if(Array.isArray(e)){if(0===e.length)return"[0]:";const t=e[0];if(a(t)||Array.isArray(t))return`[${e.length}]: `+e.map(n).join(",");{const a=Object.keys(t);let r=`[${e.length}]{${a.join(",")}}:`;for(const t of e){const e=a.map(e=>n(t[e])).join(",");r+=`\n${o} ${e}`}return r}}return Object.entries(e).map(([e,i])=>{const s=e.includes(" ")||e.includes(":")?`"${e}"`:e;if(!a(i)){const e=r(i,t+1);return e.startsWith("[")?`${s}${e}`:`${s}:\n ${o}${e}`}return`${s}: ${n(i)}`}).join(`\n${o}`)},i={tokenCount:e=>{const t="string"==typeof e?e:r(e);if(!t)return 0;const o=t.trim().split(/\s+/).length,a=t.length;return Math.ceil((a/4+1.3*o)/2)},smartSanitize:e=>e?e.replace(/[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}/g,"[EMAIL]").replace(/(?:\+?\d{1,3}[- ]?)?\(?\d{3}\)?[- ]?\d{3}[- ]?\d{4}/g,"[PHONE]").replace(/\b\d{4}[- ]?\d{4}[- ]?\d{4}[- ]?\d{4}\b/g,"[CREDIT_CARD]").replace(/\b\d{3}-\d{2}-\d{4}\b/g,"[SSN]"):"",toon:e=>r(e),toonToJson:e=>{if(!e)return null;const t=e.split("\n").filter(e=>""!==e.trim()),o={},a=[{indent:-1,obj:o}],n=e=>"true"===(e=e.trim())||"false"!==e&&("null"===e?null:isNaN(Number(e))||""===e?e.startsWith('"')&&e.endsWith('"')?e.slice(1,-1).replace(/\\"/g,'"'):e:Number(e)),r=e=>{const t=[];let o="",a=!1;for(let n=0;n<e.length;n++){const r=e[n];'"'===r&&"\\"!==e[n-1]?a=!a:","!==r||a?o+=r:(t.push(o.trim()),o="")}return t.push(o.trim()),t.map(n)};for(let e=0;e<t.length;e++){const o=t[e],i=o.search(/\S/),s=o.trim();if(!s)continue;for(;a.length>1&&i<=a[a.length-1].indent;)a.pop();const l=a[a.length-1];if(l.fields){const e=r(s),t={};l.fields.forEach((o,a)=>t[o]=e[a]),l.obj.push(t);continue}const c=s.indexOf(":");if(-1===c)continue;const d=s.slice(0,c).trim(),p=s.slice(c+1).trim(),u=d.match(/^(.+?)\[(\d+)\](?:{(.+?)})?$/);if(u){const[e,t,o,n]=u,s=[];l.obj[t]=s,n?a.push({indent:i,obj:s,key:t,fields:n.split(",").map(e=>e.trim())}):p?r(p).forEach(e=>s.push(e)):a.push({indent:i,obj:s,key:t})}else{const o=t[e+1],r=o?o.search(/\S/):-1;if(""===p&&r>i){const e={};l.obj[d]=e,a.push({indent:i,obj:e,key:d})}else l.obj[d]=n(p)}}return o},chunker:(e,t={})=>{if(!e)return[];const o=t.size||1e3,a=t.overlap||200,n=[];let r=0;for(;r<e.length;)n.push(e.slice(r,r+o)),r+=o-a;return n},similarity:(e,t)=>{if(e.length!==t.length)return 0;let o=0,a=0,n=0;for(let r=0;r<e.length;r++)o+=e[r]*t[r],a+=e[r]*e[r],n+=t[r]*t[r];return o/(Math.sqrt(a)*Math.sqrt(n))},extractReasoning:e=>{const t=e.match(/<think>([\s\S]*?)<\/think>/);return{reasoning:t?t[1].trim():"",content:e.replace(/<think>[\s\S]*?<\/think>/,"").trim()}},prompt:(e,t)=>e.replace(/{{(.*?)}}/g,(e,o)=>{const a=t[o.trim()];return void 0!==a?"object"==typeof a?r(a):String(a):`{{${o}}}`}),schema:e=>{const t=e=>null===e?"any":Array.isArray(e)?e.length>0&&"object"==typeof e[0]?`Array<{${Object.keys(e[0]).map(o=>`${o}:${t(e[0][o])}`).join(", ")}}>`:"Array<primitive>":typeof e;return"object"!=typeof e||null===e?t(e):Object.entries(e).map(([e,o])=>`${e}: ${t(o)}`).join("\n")},snapshot:()=>{const e="undefined"!=typeof window,t={context:{env:e?"browser":"server",time:(new Date).toISOString()}};e?(t.context.url=window.location.href.split("?")[0],t.context.title=document.title,t.state=window.gState||"No global state detected",t.logs=dphelper?.log?.list?.()?.slice(-10)||[],t.system={lang:navigator.language,screen:`${window.screen.width}x${window.screen.height}`,zoom:dphelper?.browser?.zoom?.()||100}):t.system={platform:"undefined"!=typeof process?process.platform:"unknown",node:"undefined"!=typeof process?process.version:"unknown",arch:"undefined"!=typeof process?process.arch:"unknown"};const o=r(t);return i.smartSanitize(o)}};dphelper?.setDescription({name:"ai",active:!0,subCommand:[{name:"tokenCount",version:"0.0.3",example:"dphelper.ai.tokenCount({ users: [1,2,3] })",author:"Dario Passariello",creationDate:"20260220",lastMod:"20260221",type:"function",active:!0,description:"Estimate token count for LLMs. If an object is passed, it uses TOON format for calculation.",env:"both",subCommand:[]},{name:"smartSanitize",version:"0.0.2",example:"dphelper.ai.smartSanitize('My email is test@example.com')",author:"Dario Passariello & Jo",creationDate:"20260220",lastMod:"20260220",type:"function",active:!0,description:"Remove PII (emails, phones, etc) from text for AI privacy",subCommand:[]},{name:"toon",version:"0.0.1",example:"dphelper.ai.toon({ users: [{id: 1, name: 'Ada'}] })",author:"TOON + Dario Passariello",creationDate:"20260221",lastMod:"20260221",type:"function",active:!0,description:"Convert JSON to TOON format (Token-Oriented Object Notation)",subCommand:[]},{name:"toonToJson",version:"0.0.1",example:"dphelper.ai.toonToJson('users[1]{id,name}:\\n 1,Ada')",author:"Dario Passariello",creationDate:"20260221",lastMod:"20260221",type:"function",active:!0,description:"Convert TOON format back to JSON/Object",subCommand:[]},{name:"chunker",version:"0.0.1",example:"dphelper.ai.chunker(text, { size: 1000, overlap: 200 })",author:"Dario Passariello",creationDate:"20260221",lastMod:"20260221",type:"function",active:!0,description:"Split long text into chunks for RAG or AI processing.",subCommand:[]},{name:"similarity",version:"0.0.1",example:"dphelper.ai.similarity(vecA, vecB)",author:"Dario Passariello",creationDate:"20260221",lastMod:"20260221",type:"function",active:!0,description:"Calculate cosine similarity between two embedding vectors.",subCommand:[]},{name:"extractReasoning",version:"0.0.1",example:"dphelper.ai.extractReasoning(aiResponse)",author:"Dario Passariello",creationDate:"20260221",lastMod:"20260221",type:"function",active:!0,description:"Extract <think> tags or internal reasoning from AI responses.",subCommand:[]},{name:"prompt",version:"0.0.1",example:"dphelper.ai.prompt('Hello {{name}}', { name: 'Ada' })",author:"Dario Passariello",creationDate:"20260221",lastMod:"20260221",type:"function",active:!0,description:"Simple prompt template engine with variable injection.",subCommand:[]},{name:"schema",version:"0.0.1",example:"dphelper.ai.schema({ id: 1, name: 'Ada' })",author:"Dario Passariello",creationDate:"20260221",lastMod:"20260221",type:"function",active:!0,description:"Generate a TOON-style schema definition for AI instructions.",subCommand:[]},{name:"snapshot",version:"0.0.1",example:"dphelper.ai.snapshot()",author:"Dario Passariello",creationDate:"20260221",lastMod:"20260221",type:"function",active:!0,description:"Capture a 'mental snapshot' of the app state (logs/globals) in TOON format for AI debugging.",env:"both",subCommand:[]}]},i);var s={name:"anchor",active:!0,subCommand:[{name:"toOnClick",type:"function",version:"0.0.2",example:"dphelper.anchor.toOnClick([element, 'foo' | '.foo' | '#foo'])",description:"This tool allows you to convert all links in an element to 'onclick'.\n It allows you to avoid the message with the path relative to the requested address\n and it is very useful when you work with SPA but you want to keep even older browsers.",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",active:!0,env:"client",subCommand:[]}]},l={toOnClick:e=>{const t=document.querySelector(e);if(!t)return;t.querySelectorAll("a").forEach(e=>{const t=e.getAttribute("href");if(!t)return;e.style.cursor="pointer";const o=dphelper.pathRail()?.[3]?.replace(/\//g,"")||"";o&&e.classList.add(o);const a=e.cloneNode(!0);e.parentNode?.replaceChild(a,e),a.removeAttribute("href"),a.addEventListener("mouseup",e=>{t.startsWith("/")?(history.pushState({href:t},"",t),dphelper.navigation.load(t),e.stopPropagation()):dphelper.browser.href(t)})})}};dphelper?.setDescription(s,l);var c={find:(e,t)=>{if(Array.isArray(e)){for(const o of e){if(o[t]===t)return o;if(o.children){const e=dphelper.array.find(t,o.children);if(e)return e}}return!1}},delete:(e,t)=>{Array.isArray(e)&&e.some(function e(o,a,n){if(o[t]===t)return n.splice(a,1),!0;for(const t of Object.keys(o)){const a=o[t];if(Array.isArray(a))return a.some(e)}return null})},merge:(e,t)=>{if(!e||!t)return t||e;for(const o of Object.keys(e))"__proto__"!==o&&"constructor"!==o&&"prototype"!==o&&e[o]instanceof Object&&t[o]&&Object.assign(e[o],dphelper.array.merge(t[o],e[o]));return Object.assign(t,e)},mergeByKey:(e,t,o)=>e.map(e=>{const a=t.find(t=>e[o]===t[o]);return a?Object.assign({},e,a):e}),duplicates:e=>{if(!Array.isArray(e))return;const t=new Set,o=new Set;for(const a of e)t.has(a)?o.add(a):t.add(a);return Array.from(o)},even:e=>{if(Array.isArray(e))return e.filter(e=>e%2==0)},odd:e=>{if(Array.isArray(e))return e.filter(e=>e%2!=0)},sumColumn:(e=[],t=0)=>Array.isArray(e)?void 0===t?"provide a column":e.reduce((e,o)=>e+(o[t]||0),0):"provide a multidimensional array",shuffle:e=>{if(Array.isArray(e)){for(let t=e.length-1;t>0;t--){const o=Math.floor(Math.random()*(t+1));[e[t],e[o]]=[e[o],e[t]]}return e}},generate:e=>{if(Number.isNaN(e))return;const t=Array.from({length:e},(e,t)=>t+1);return dphelper.array.shuffle(t)},testArrayInt:e=>{if(!Array.isArray(e))return;const t=[];for(let o=1;o<=e.length;o++)e.includes(o)||t.push(o);return t},rand32:e=>{const t=performance.now(),o=[];o.nums=[],o.time=[];for(let t=0;t<e;++t)o.nums.push(crypto.getRandomValues(new Uint32Array(1))[0]);const a=performance.now();return o.time.push(a-t),o},match:(e,t)=>e.filter(e=>t.includes(e)),pathToJson:(e,t="/")=>{const o={};let a;for(const n of e){a=o;const e=n.split(t);for(const t of e.slice(1,-1)){if(""===t)return;t in a||(a[t]={}),a=a[t]}e.at(-1)&&(a[e.at(-1)]=null)}return o}};dphelper?.setDescription({name:"array",active:!0,subCommand:[{name:"find",version:"0.0.2",example:"dphelper.array.find(array, 'key')",description:"Find an item in the array recursively.",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:!0,env:"both",subCommand:[]},{name:"delete",version:"0.0.2",example:"dphelper.array.delete(array, 'key')",description:"Delete an item from the array recursively.",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:!0,env:"both",subCommand:[]},{name:"unique",version:"0.0.2",example:"dphelper.array.unique(array)",description:"Remove duplicate values from an array.",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:!0,env:"both",subCommand:[]},{name:"merge",version:"0.0.2",example:"dphelper.array.merge(arrA, arrB)",description:"Merge two arrays into one.",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:!0,env:"both",subCommand:[]},{name:"mergeByKey",version:"0.0.2",example:"dphelper.array.mergeByKey(arrA, arrB, 'id')",author:"Dario Passariello",creationDate:"20230603",lastMod:"20260220",type:"function",active:!0,description:"Merge two arrays of objects by a specific key.",env:"both",subCommand:[]},{name:"asc",version:"0.0.2",example:"dphelper.array.asc(array)",description:"Sort array in ascending order.",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:!0,env:"both",subCommand:[]},{name:"desc",version:"0.0.2",example:"dphelper.array.desc(array)",description:"Sort array in descending order.",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:!0,env:"both",subCommand:[]},{name:"duplicates",version:"0.0.2",example:"dphelper.array.duplicates(array)",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:!0,description:"Find duplicate items in an array.",env:"both",subCommand:[]},{name:"even",version:"0.0.2",example:"dphelper.array.even(array)",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:!0,description:"Filter even numbers from an array.",env:"both",subCommand:[]},{name:"odd",version:"0.0.2",example:"dphelper.array.odd(array)",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:!0,description:"Filter odd numbers from an array.",env:"both",subCommand:[]},{name:"toObj",version:"0.0.2",example:"dphelper.array.toObj(array)",description:"Convert an array to an object.",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:!0,env:"both",subCommand:[]},{name:"sumColumn",version:"0.0.2",example:"dphelper.array.sumColumn(arr, 0)",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:!0,description:"Sum the values of a specified column in a multidimensional array.",env:"both",subCommand:[]},{name:"shuffle",version:"0.0.2",example:"dphelper.array.shuffle(array)",author:"Dario Passariello",creationDate:"20230527",lastMod:"20260220",type:"function",active:!0,description:"Randomly shuffle the elements of an array.",env:"both",subCommand:[]},{name:"generate",version:"0.0.2",example:"dphelper.array.generate(10)",author:"Dario Passariello",creationDate:"20230527",lastMod:"20260220",type:"function",active:!0,description:"Generate an array of random numbers (max 500000).",env:"both",subCommand:[]},{name:"testArrayInt",version:"0.0.2",example:"dphelper.array.testArrayInt([1,2,4])",author:"Dario Passariello",creationDate:"20230527",lastMod:"20260220",type:"function",active:!0,description:"Check if an array contains consecutive integers.",env:"both",subCommand:[]},{name:"rand32",version:"0.0.2",example:"dphelper.array.rand32(5)",author:"Dario Passariello",creationDate:"20230527",lastMod:"20260220",type:"function",active:!0,description:"Generate an array of random 32-bit unsigned integers.",env:"both",subCommand:[]},{name:"findindex",version:"0.0.2",example:"dphelper.array.findindex(array, 'name')",description:"Find the index of an item in an array by key.",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:!0,env:"both",subCommand:[]},{name:"pathToJson",version:"0.0.2",example:"dphelper.array.pathToJson(paths, '/')",description:"Convert an array of paths into a JSON object.",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:!0,env:"both",subCommand:[]},{name:"deepClone",version:"0.0.2",example:"dphelper.array.deepClone(array)",description:"Create a deep clone of an array using structuredClone.",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:!0,env:"both",subCommand:[]},{name:"match",version:"0.0.2",example:"dphelper.array.match(arrA, arrB)",author:"Dario Passariello",creationDate:"20250101",lastMod:"20260220",type:"function",active:!0,description:"Find a perfect match between an array of words and an array to check.",env:"both",subCommand:[]}]},c);var d={play:(e,t="",o=!1)=>{if(e){if(!document.querySelector(`#audio_${e}`)){const a=document.createElement("audio");a.id=`audio_${e}`,a.dataset.dphelper="audio",a.src=t+e,a.loop=o,document.body.appendChild(a),a.load(),a.play()?.catch?.(e=>console.error("Error playing audio:",e))}}else document.querySelectorAll("audio[data-dphelper='audio']").forEach(e=>e.remove())}};dphelper?.setDescription({name:"audio",active:!0,subCommand:[{name:"play",version:"0.0.2",example:"dphelper.audio.play([audiofile])",description:"Plays an audio file or removes all audio elements from the document.",author:"Dario Passariello",creationDate:"20240924",lastMod:"20240924",type:"function",active:!0,env:"client",subCommand:[]}]},d);var p={cache:e=>{if("string"!=typeof e)throw new Error("The provided URI must be a string");return e.concat(/\?/.test(e)?"&":"?","t=",Math.random().toString(36).substring(2))}};dphelper?.setDescription({name:"avoid",active:!0,subCommand:[{name:"cache",version:"0.0.2",example:"dphelper.avoid.cache()",description:"Appends a cache-busting query parameter to a given URI.",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:!0,env:"both",subCommand:[]}]},p);var u=()=>!!navigator.credentials&&!!navigator.credentials.create,m=(e=32)=>{const t=new Uint8Array(e);return crypto.getRandomValues(t),t},h=new Map,v={isAvailable:u,getWebAuthnSupport:()=>{if(!u())return{supported:!1,platformAuthenticator:!1,hybridTransport:!1,uvToken:!1};const e=navigator.userAgent,t=e.includes("Windows"),o=e.includes("Mac"),a=e.includes("Linux");return{supported:!0,platformAuthenticator:t||o||a,hybridTransport:!1,uvToken:!1}},isSensorAvailable:async e=>{if(!u())return!1;if("undefined"!=typeof PublicKeyCredential)try{if("fingerprint"===e)return await PublicKeyCredential.isUserVerifyingPlatformAuthenticatorAvailable();if("face"===e)return await PublicKeyCredential.isUserVerifyingPlatformAuthenticatorAvailable();if("iris"===e)return await PublicKeyCredential.isUserVerifyingPlatformAuthenticatorAvailable()}catch{return!1}return!1},register:async(e,t=window.location.hostname,o=window.location.hostname,a=e)=>{if(!u())return{success:!1,error:"WebAuthn not supported"};try{const n=m(),r={challenge:n.buffer,rp:{id:t,name:o},user:{id:(new TextEncoder).encode(e),name:a,displayName:a},pubKeyCredParams:[{type:"public-key",alg:-7},{type:"public-key",alg:-257}],timeout:6e4,attestation:"none",authenticatorSelection:{authenticatorAttachment:"platform",userVerification:"preferred"}},i=await navigator.credentials.create({publicKey:r});if(!i)return{success:!1,error:"Credential creation failed"};const s=(e=>{const t=e instanceof Uint8Array?e:new Uint8Array(e);let o="";return t.forEach(e=>o+=String.fromCharCode(e)),btoa(o)})(i.rawId);return h.set(s,{type:"public-key",id:i.rawId}),{success:!0,credentialId:s}}catch(e){return{success:!1,error:e.message||"Registration failed"}}},authenticate:async(e,t=window.location.hostname,o)=>{if(!u())return{success:!1,error:"WebAuthn not supported"};try{const e=m(),a=[];if(o){const e=(e=>{const t=atob(e),o=new Uint8Array(t.length);for(let e=0;e<t.length;e++)o[e]=t.charCodeAt(e);return o})(o).buffer;a.push({type:"public-key",id:e})}else h.size>0&&h.forEach(e=>{a.push(e)});const n={challenge:e.buffer,rpId:t,timeout:6e4,userVerification:"preferred",allowCredentials:a.length>0?a:void 0};return await navigator.credentials.get({publicKey:n})?{success:!0}:{success:!1,error:"Authentication failed"}}catch(e){return{success:!1,error:e.message||"Authentication failed"}}},getCredential:e=>h.get(e),deleteCredential:e=>h.delete(e),listCredentials:()=>Array.from(h.keys())};dphelper?.setDescription({name:"biometric",active:!0,subCommand:[{name:"isAvailable",version:"0.0.1",example:"dphelper.biometric.isAvailable()",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:!0,description:"Check if WebAuthn/biometric authentication is available",env:"client",subCommand:[]},{name:"register",version:"0.0.1",example:"dphelper.biometric.register('user123', 'https://example.com')",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:!0,description:"Register a new credential for biometric authentication",env:"client",subCommand:[]},{name:"authenticate",version:"0.0.1",example:"dphelper.biometric.authenticate('user123', 'https://example.com')",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:!0,description:"Authenticate using stored biometric credential",env:"client",subCommand:[]},{name:"getCredential",version:"0.0.1",example:"dphelper.biometric.getCredential(credentialId)",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:!0,description:"Get a stored credential by ID",env:"client",subCommand:[]},{name:"deleteCredential",version:"0.0.1",example:"dphelper.biometric.deleteCredential(credentialId)",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:!0,description:"Delete a stored credential",env:"client",subCommand:[]},{name:"listCredentials",version:"0.0.1",example:"dphelper.biometric.listCredentials()",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:!0,description:"List all stored credentials",env:"client",subCommand:[]},{name:"isSensorAvailable",version:"0.0.1",example:"dphelper.biometric.isSensorAvailable('fingerprint')",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:!0,description:"Check if specific biometric sensor is available",env:"client",subCommand:[]},{name:"getWebAuthnSupport",version:"0.0.1",example:"dphelper.biometric.getWebAuthnSupport()",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:!0,description:"Get detailed WebAuthn support information",env:"client",subCommand:[]}]},v);var f={"1xx":{code:"1xx",message:"Information",description:"1xx codes are often interim responses for sharing connection status information. Not intended for final request or response action."},100:{code:100,message:"Continue",description:"The server has received the request headers, and the client should proceed to send the request body."},101:{code:101,message:"Switching Protocols",description:"The requester has asked the server to switch protocols."},102:{code:102,message:"Processing",description:"This code indicates that the server has received and is processing the request, but no response is available yet. This prevents the client from timing out and assuming the request was lost."},103:{code:103,message:"Early Hints",description:"Used to return some response headers before final HTTP message."},"2xx":{code:"2xx",message:"Successful",description:"2xx codes indicate successful responses usually this means the action requested by the client was received, understood and accepted successfully."},200:{code:200,message:"OK",description:"The request is OK (this is the standard response for successful HTTP requests)."},201:{code:201,message:"Created",description:"The request has been fulfilled, and a new resource is created."},202:{code:202,message:"Accepted",description:"The request has been accepted for processing, but the processing has not been completed."},203:{code:203,message:"Non-Authoritative Information",description:"The request has been successfully processed, but is returning information that may be from another source."},204:{code:204,message:"No Content",description:"The request has been successfully processed, but is not returning any content."},205:{code:205,message:"Reset Content",description:"The request has been successfully processed, but is not returning any content, and requires that the requester reset the document view."},206:{code:206,message:"Partial Content",description:"The server is delivering only part of the resource due to a range header sent by the client."},207:{code:207,message:"Multi-Status",description:"The message body that follows is by default an XML message and can contain a number of separate response codes, depending on how many sub-requests were made."},208:{code:208,message:"Already Reported",description:"The members of a DAV binding have already been enumerated in a preceding part of the (multi-status) response, and are not being included again."},218:{code:218,message:"This is fine (Apache Web Server)",description:"Used as a catch-all error condition for allowing response bodies to flow through Apache when ProxyErrorOverride is enabled."},226:{code:226,message:"IM Used",description:"The server has fulfilled a request for the resource, and the response is a representation of the result of one or more instance-manipulations applied to the current instance."},"3xx":{code:"3xx",message:"Redirection",description:"3xx codes are a class of responses that suggest the User-Agent must follow another course of action to obtain the complete requested resource."},300:{code:300,message:"Multiple Choices",description:"A link list. The user can select a link and go to that location. Maximum five addresses."},301:{code:301,message:"Moved Permanently",description:"The requested page has moved to a new URL."},302:{code:302,message:"Found",description:"The requested page has moved temporarily to a new URL."},303:{code:303,message:"See Other",description:"The requested page can be found under a different URL."},304:{code:304,message:"Not Modified",description:"Indicates the requested page has not been modified since last requested."},306:{code:306,message:"Switch Proxy",description:'No longer used. Originally meant "Subsequent requests should use the specified proxy."'},307:{code:307,message:"Temporary Redirect",description:"The requested page has moved temporarily to a new URL."},308:{code:308,message:"Resume Incomplete",description:"Used in the resumable requests proposal to resume aborted PUT or POST requests."},"4xx":{code:"4xx",message:"Client Error",description:"4xx codes generally are error responses specifying an issue at the client’s end. Potentially a network issue."},400:{code:400,message:"Bad Request",description:"The request cannot be fulfilled due to bad syntax."},401:{code:401,message:"Unauthorized",description:"The request was a legal request, but the server is refusing to respond to it. For use when authentication is possible but has failed or not yet been provided."},402:{code:402,message:"Payment Required",description:"Not yet implemented by RFC standards, but reserved for future use."},403:{code:403,message:"Forbidden",description:"The request was a legal request, but the server is refusing to respond to it."},404:{code:404,message:"Not Found",description:"The requested page could not be found but may be available again in the future."},405:{code:405,message:"Method Not Allowed",description:"A request was made of a page using a request method not supported by that page."},406:{code:406,message:"Not Acceptable",description:"The server can only generate a response that is not accepted by the client."},407:{code:407,message:"Proxy Authentication Required",description:"The client must first authenticate itself with the proxy."},408:{code:408,message:"Request Timeout",description:"The server timed out waiting for the request."},409:{code:409,message:"Conflict",description:"The request could not be completed because of a conflict in the request."},410:{code:410,message:"Gone",description:"The requested page is no longer available."},411:{code:411,message:"Length Required",description:'The "Content-Length" is not defined. The server will not accept the request without it.'},412:{code:412,message:"Precondition Failed",description:"The precondition given in the request evaluated to false by the server."},413:{code:413,message:"Request Entity Too Large",description:"The server will not accept the request, because the request entity is too large."},414:{code:414,message:"Request-URI Too Long",description:"The server will not accept the request, because the URL is too long. Occurs when you convert a POST request to a GET request with a long query information."},415:{code:415,message:"Unsupported Media Type",description:"The server will not accept the request, because the media type is not supported."},416:{code:416,message:"Requested Range Not Satisfiable",description:"The client has asked for a portion of the file, but the server cannot supply that portion."},417:{code:417,message:"Expectation Failed",description:"The server cannot meet the requirements of the Expect request-header field."},418:{code:418,message:"I'm a teapot",description:'Any attempt to brew coffee with a teapot should result in the error code "418 I\'m a teapot". The resulting entity body MAY be short and stout.'},419:{code:419,message:"Page Expired (Laravel Framework)",description:"Used by the Laravel Framework when a CSRF Token is missing or expired."},420:{code:420,message:"Method Failure (Spring Framework)",description:"A deprecated response used by the Spring Framework when a method has failed."},421:{code:421,message:"Misdirected Request",description:"The request was directed at a server that is not able to produce a response (for example because a connection reuse)."},422:{code:422,message:"Unprocessable Entity",description:"The request was well-formed but was unable to be followed due to semantic errors."},423:{code:423,message:"Locked",description:"The resource that is being accessed is locked."},424:{code:424,message:"Failed Dependency",description:"The request failed due to failure of a previous request (e.g., a PROPPATCH)."},426:{code:426,message:"Upgrade Required",description:"The client should switch to a different protocol such as TLS/1.0, given in the Upgrade header field."},428:{code:428,message:"Precondition Required",description:"The origin server requires the request to be conditional."},429:{code:429,message:"Too Many Requests",description:"The user has sent too many requests in a given amount of time. Intended for use with rate limiting schemes."},431:{code:431,message:"Request Header Fields Too Large",description:"The server is unwilling to process the request because either an individual header field, or all the header fields collectively, are too large."},440:{code:440,message:"Login Time-out",description:"The client's session has expired and must log in again. (IIS)"},444:{code:444,message:"Connection Closed Without Response",description:"A non-standard status code used to instruct nginx to close the connection without sending a response to the client, most commonly used to deny malicious or malformed requests."},449:{code:449,message:"Retry With",description:"The server cannot honour the request because the user has not provided the required information. (IIS)"},450:{code:450,message:"Blocked by Windows Parental Controls",description:"The Microsoft extension code indicated when Windows Parental Controls are turned on and are blocking access to the requested webpage."},451:{code:451,message:"Unavailable For Legal Reasons",description:"A server operator has received a legal demand to deny access to a resource or to a set of resources that includes the requested resource."},494:{code:494,message:"Request Header Too Large",description:"Used by nginx to indicate the client sent too large of a request or header line that is too long."},495:{code:495,message:"SSL Certificate Error",description:"An expansion of the 400 Bad Request response code, used when the client has provided an invalid client certificate."},496:{code:496,message:"SSL Certificate Required",description:"An expansion of the 400 Bad Request response code, used when a client certificate is required but not provided."},497:{code:497,message:"HTTP Request Sent to HTTPS Port",description:"An expansion of the 400 Bad Request response code, used when the client has made a HTTP request to a port listening for HTTPS requests."},498:{code:498,message:"Invalid Token (Esri)",description:"Returned by ArcGIS for Server. Code 498 indicates an expired or otherwise invalid token."},499:{code:499,message:"Client Closed Request",description:"A non-standard status code introduced by nginx for the case when a client closes the connection while nginx is processing the request."},"5xx":{code:"5xx",message:"Server Error",description:"5xx error codes indicate that an error or unresolvable request occurred on the server side, whether that is a proxy or the origin host."},500:{code:500,message:"Internal Server Error",description:"An error has occurred in a server side script, a no more specific message is suitable."},501:{code:501,message:"Not Implemented",description:"The server either does not recognize the request method, or it lacks the ability to fulfill the request."},502:{code:502,message:"Bad Gateway",description:"The server was acting as a gateway or proxy and received an invalid response from the upstream server."},503:{code:503,message:"Service Unavailable",description:"The server is currently unavailable (overloaded or down)."},504:{code:504,message:"Gateway Timeout",description:"The server was acting as a gateway or proxy and did not receive a timely response from the upstream server."},505:{code:505,message:"HTTP Version Not Supported",description:"The server does not support the HTTP protocol version used in the request."},506:{code:506,message:"Variant Also Negotiates",description:"Transparent content negotiation for the request results in a circular reference."},507:{code:507,message:"Insufficient Storage",description:"The server is unable to store the representation needed to complete the request."},508:{code:508,message:"Loop Detected",description:"The server detected an infinite loop while processing the request (sent instead of 208 Already Reported)."},509:{code:509,message:"Bandwidth Limit Exceeded",description:"The server has exceeded the bandwidth specified by the server administrator; this is often used by shared hosting providers to limit the bandwidth of customers."},510:{code:510,message:"Not Extended",description:"Further extensions to the request are required for the server to fulfil it."},511:{code:511,message:"Network Authentication Required",description:"The client needs to authenticate to gain network access."},520:{code:520,message:"Unknown Error",description:'The 520 error is used as a "catch-all response for when the origin server returns something unexpected", listing connection resets, large headers, and empty or invalid responses as common triggers.'},521:{code:521,message:"Web Server Is Down",description:"The origin server has refused the connection from Cloudflare."},522:{code:522,message:"Connection Timed Out",description:"Cloudflare could not negotiate a TCP handshake with the origin server."},523:{code:523,message:"Origin Is Unreachable",description:"Cloudflare could not reach the origin server; for example, if the DNS records for the origin server are incorrect."},524:{code:524,message:"A Timeout Occurred",description:"Cloudflare was able to complete a TCP connection to the origin server, but did not receive a timely HTTP response."},525:{code:525,message:"SSL Handshake Failed",description:"Cloudflare could not negotiate a SSL/TLS handshake with the origin server."},526:{code:526,message:"Invalid SSL Certificate",description:"Used by Cloudflare and Cloud Foundry's gorouter to indicate failure to validate the SSL/TLS certificate that the origin server presented."},527:{code:527,message:"Railgun Listener to Origin Error",description:"Error 527 indicates that the request timed out or failed after the WAN connection had been established."},530:{code:530,message:"Origin DNS Error",description:"Error 530 indicates that the requested host name could not be resolved on the Cloudflare network to an origin server."},598:{code:598,message:"Network Read Timeout Error",description:"Used by some HTTP proxies to signal a network read timeout behind the proxy to a client in front of the proxy."}},b={interlock:e=>{const t=new BroadcastChannel("dp_interlock");let o=1;t.onmessage=a=>{a.origin!==window.location.origin&&a.origin||"ping"!==a.data&&"pong"!==a.data||("ping"===a.data&&t.postMessage("pong"),"pong"===a.data&&e(++o))},t.postMessage("ping"),e(o)},state:(e,t,o)=>{history.pushState(e,t,o)},forw:e=>{history.go(e)},back:e=>{history.go(-Math.abs(e))},reload:()=>{location.href="/"},href:e=>{location.href=e},offLine:(e="You are offline.")=>{window.addEventListener("online",()=>document.querySelectorAll("[o]").forEach(e=>e.remove())),window.addEventListener("offline",()=>{const t=String(e).replace(/["\\]/g,"\\$&").slice(0,200),o=document.createElement("style");o.setAttribute("o",""),o.textContent=`\n html {\n\n &:before {\n content: "";\n display: flex;\n justify-content: center;\n align-items: center;\n position: absolute;\n top: 0;\n bottom: 0;\n left: 0;\n right: 0;\n background-color: #00000082;\n z-index: 9999;\n -webkit-backdrop-filter: blur(2px);\n backdrop-filter: blur(2px);\n\n }\n\n &:after{\n position: absolute;\n content: "${t}";\n font-size: 1em;\n background-color: orange;\n color: black;\n text-align: center;\n padding: 10px 30px;\n z-index: 10000;\n border-radius: 20px;\n top: calc(50% - 22px);\n left: calc(50% - 92px);\n border: 6px solid #00000026;\n }\n\n }\n `,document.body.appendChild(o)})},zoom:()=>Math.round(100*devicePixelRatio),status:e=>f[e]||"Unknown status"};dphelper?.setDescription({name:"browser",active:!0,subCommand:[{name:"state",version:"0.0.2",example:"dphelper.browser.state([state, title, url])",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:!0,description:"Pushes a new state to the browser history.",env:"client",subCommand:[]},{name:"forw",version:"0.0.2",example:"dphelper.browser.forw([number])",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:!0,description:"Moves forward in the browser history.",env:"client",subCommand:[]},{name:"back",version:"0.0.2",example:"dphelper.browser.back([number])",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:!0,description:"Moves backward in the browser history.",env:"client",subCommand:[]},{name:"reload",version:"0.0.2",example:"dphelper.browser.reload()",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:!0,description:"Reloads the current page.",env:"client",subCommand:[]},{name:"href",version:"0.0.2",example:"dphelper.browser.href([url])",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:!0,description:"Navigates to the specified URL.",env:"client",subCommand:[]},{name:"offLine",version:"0.0.2",example:"dphelper.browser.offline([text])",author:"Dario Passariello",creationDate:"20190727",lastMod:"20240727",type:"function",active:!0,description:"Displays an offline message when the browser is offline.",env:"client",subCommand:[]},{name:"zoom",version:"0.0.2",example:"dphelper.browser.zoom()",author:"Dario Passariello",creationDate:"20190727",lastMod:"20240727",type:"function",active:!0,description:"Returns the current zoom level of the browser.",env:"client",subCommand:[]},{name:"status",version:"0.0.2",example:"dphelper.browser.status(404)",author:"Dario Passariello",creationDate:"20240912",lastMod:"20240912",type:"function",active:!0,description:"Returns a description of the specified HTTP status code.",env:"client",subCommand:[]},{name:"interlock",version:"0.0.1",example:"dphelper.browser.interlock((tabs) => ...)",author:"Dario Passariello",creationDate:"20260221",lastMod:"20260221",type:"function",active:!0,description:"Detect and monitor other active tabs of the same app.",env:"client",subCommand:[]}]},b);var g={version:(e,t,o)=>{if(!e||!t)return Number.NaN;const a=o?.lex,n=o?.zero;let r=e.split("."),i=t.split(".");const s=e=>(a?/^\d+[A-Za-z]*$/:/^\d+$/).test(e);if(!r.every(s)||!i.every(s))return Number.NaN;if(n){for(;r.length<i.length;)r.push("0");for(;i.length<r.length;)i.push("0")}a||(r=r.map(Number),i=i.map(Number));for(let e=0;e<r.length;e++){if(i.length===e)return 1;if(r[e]!==i[e])return r[e]>i[e]?1:-1}return r.length!==i.length?-1:0}};dphelper?.setDescription({name:"check",active:!0,subCommand:[{name:"version",version:"0.0.2",example:"dphelper.check.version([v1], [v2], [opts])",description:"Compares two versions.",author:"Dario Passariello",creationDate:"20240829",lastMod:"20240829",type:"function",active:!0,env:"both",subCommand:[]}]},g);var y={hex:e=>{let t=Number.parseInt(e.toString(),10);return Number.isNaN(t)?"00":(t=Math.round(Math.max(0,Math.min(255,t))),t.toString(16).padStart(2,"0"))},toHex:e=>dphelper.color.hex(e[0])+dphelper.color.hex(e[1])+dphelper.color.hex(e[2]),toRGB:e=>{const t=[];return t[0]=Number.parseInt(dphelper.text.trim(e,"#",1,7).substring(0,2),16),t[1]=Number.parseInt(dphelper.text.trim(e,"#",1,7).substring(2,4),16),t[2]=Number.parseInt(dphelper.text.trim(e,"#",1,7).substring(4,6),16),t},oleColor:e=>{const t=e.replace("#","").match(/.{1,2}/g);return!t||t.length<3?"0":(Number.parseInt(t[0],16)+256*Number.parseInt(t[1],16)+65536*Number.parseInt(t[2],16)).toString()},gradient:(e,t,o)=>{const a=dphelper.color.toRGB(e),n=dphelper.color.toRGB(t),r=o,i=[];let s=0;const l=[];for(let e=0;e<r;e++)s+=1/r,l[0]=a[0]*s+(1-s)*n[0],l[1]=a[1]*s+(1-s)*n[1],l[2]=a[2]*s+(1-s)*n[2],i.push(dphelper.color.toHex(l));return i}};dphelper?.setDescription({name:"color",active:!0,subCommand:[{name:"hex",version:"0.0.2",example:"dphelper.color.hex(255)",description:"Converts a number to a hexadecimal string.",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:!0,env:"client",subCommand:[]},{name:"toHex",version:"0.0.2",example:"dphelper.color.toHex([255, 255, 255])",description:"Converts an RGB array to a hexadecimal string.",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:!0,env:"client",subCommand:[]},{name:"toRGB",version:"0.0.2",example:"dphelper.color.toRGB('#ffffff')",description:"Converts a hexadecimal string to an RGB array.",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:!0,env:"client",subCommand:[]},{name:"oleColor",version:"0.0.2",example:"dphelper.color.oleColor('#ffffff')",description:"Converts a hexadecimal string to an OLE color.",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:!0,env:"client",subCommand:[]},{name:"gradient",version:"0.0.2",example:"dphelper.color.gradient([colorStart, colorEnd, colorCount])",description:"Generates a gradient between two colors.",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:!0,env:"client",subCommand:[]}]},y);var D={gzip:async e=>{const t="string"==typeof e?(new TextEncoder).encode(e):e,o=new CompressionStream("gzip"),a=o.writable.getWriter();return a.write(t.buffer),a.close(),new Response(o.readable).blob()},gunzip:async e=>{const t=new DecompressionStream("gzip"),o=t.writable.getWriter();o.write(await e.arrayBuffer()),o.close();const a=await new Response(t.readable).arrayBuffer();return(new TextDecoder).decode(a)},deflate:async e=>{const t="string"==typeof e?(new TextEncoder).encode(e):e,o=new CompressionStream("deflate"),a=o.writable.getWriter();return a.write(t.buffer),a.close(),new Response(o.readable).blob()},inflate:async e=>{const t=new DecompressionStream("deflate"),o=t.writable.getWriter();o.write(await e.arrayBuffer()),o.close();const a=await new Response(t.readable).arrayBuffer();return(new TextDecoder).decode(a)},compress:e=>{const t={};let o="",a=[],n=256;for(let e=0;e<256;e++)t[String.fromCharCode(e)]=e;for(let r=0;r<e.length;r++){const i=e[r],s=o+i;void 0!==t[s]?o=s:(a.push(String(t[o])),t[s]=n++,o=i)}return""!==o&&a.push(String(t[o])),String.fromCharCode(...a.map(Number))},decompress:e=>{const t={};let o=[],a=256;for(let e=0;e<256;e++)t[e]=String.fromCharCode(e);const n=e.split("").map(e=>e.charCodeAt(0));let r=t[n[0]];o.push(r);for(let e=1;e<n.length;e++){let i=t[n[e]];void 0===i&&(i=r+r[0]),o.push(i),t[a++]=r+i[0],r=i}return o.join("")},base64Encode:e=>{const t=(new TextEncoder).encode(e);let o="";return t.forEach(e=>o+=String.fromCharCode(e)),btoa(o)},base64Decode:e=>{const t=atob(e),o=new Uint8Array(t.length);for(let e=0;e<t.length;e++)o[e]=t.charCodeAt(e);return(new TextDecoder).decode(o)},urlEncode:e=>encodeURIComponent(e),urlDecode:e=>decodeURIComponent(e),htmlEncode:e=>{const t={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"};return e.replace(/[&<>"']/g,e=>t[e]||e)},htmlDecode:e=>{const t={"&amp;":"&","&lt;":"<","&gt;":">","&quot;":'"',"&#39;":"'"};return e.replace(/&(amp|lt|gt|quot|#39);/g,(e,o)=>t[`&${o};`]||e)}};dphelper?.setDescription({name:"compress",active:!0,subCommand:[{name:"gzip",version:"0.0.1",example:"dphelper.compress.gzip('Hello World')",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:!0,description:"Compress data using gzip",env:"both",subCommand:[]},{name:"gunzip",version:"0.0.1",example:"dphelper.compress.gunzip(compressedData)",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:!0,description:"Decompress gzip data",env:"both",subCommand:[]},{name:"deflate",version:"0.0.1",example:"dphelper.compress.deflate('Hello World')",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:!0,description:"Compress data using deflate",env:"both",subCommand:[]},{name:"inflate",version:"0.0.1",example:"dphelper.compress.inflate(compressedData)",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:!0,description:"Decompress deflate data",env:"both",subCommand:[]},{name:"compress",version:"0.0.1",example:"dphelper.compress.compress('Hello World')",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:!0,description:"Compress data using LZW algorithm (JavaScript compatible)",env:"both",subCommand:[]},{name:"decompress",version:"0.0.1",example:"dphelper.compress.decompress(compressedString)",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:!0,description:"Decompress LZW compressed data",env:"both",subCommand:[]},{name:"base64Encode",version:"0.0.1",example:"dphelper.compress.base64Encode('Hello')",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:!0,description:"Encode string to base64",env:"both",subCommand:[]},{name:"base64Decode",version:"0.0.1",example:"dphelper.compress.base64Decode('SGVsbG8=')",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:!0,description:"Decode base64 string",env:"both",subCommand:[]},{name:"urlEncode",version:"0.0.1",example:"dphelper.compress.urlEncode('Hello World!')",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:!0,description:"URL encode a string",env:"both",subCommand:[]},{name:"urlDecode",version:"0.0.1",example:"dphelper.compress.urlDecode('Hello%20World!')",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:!0,description:"URL decode a string",env:"both",subCommand:[]},{name:"htmlEncode",version:"0.0.1",example:"dphelper.compress.htmlEncode('<script>')",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:!0,description:"HTML encode a string",env:"both",subCommand:[]},{name:"htmlDecode",version:"0.0.1",example:"dphelper.compress.htmlDecode('<script>')",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:!0,description:"HTML decode a string",env:"both",subCommand:[]}]},D);var w={set:e=>{const t=new Date;if(t.setTime(t.getTime()+31536e6),!e.name)return;const{name:o,value:a,time:n=e.time||t.toUTCString(),path:r=e.path||"/",sameSite:i=e.sameSite||"Lax",secure:s=e.secure??"https:"===location.protocol}=e,l=encodeURIComponent(a),c=s?"Secure":"",d=i;document.cookie=`${o}=${l}; expires=${n}; path=${r}; SameSite=${d}; ${c}`},get:e=>{const t=document.cookie.split(";"),o=t.length;for(let a=0;a<o;a++){const o=t[a];if(!o)continue;const n=o.trim().split("=");if(e===n[0])return decodeURIComponent(n[1]||"")}return null},delete:e=>dphelper.cookie.set({name:e,value:"",time:"Thu, 01 Jan 1970 00:00:00 GMT"}),removeAll:()=>{const e=document.cookie.split(";"),t=e.length;for(let o=0;o<t;o++){const t=e[o];if(!t)continue;const a=t.indexOf("="),n=a>-1?t.slice(0,a):t;dphelper.cookie.delete(n.trim())}}};dphelper?.setDescription({name:"cookie",active:!0,subCommand:[{name:"set",version:"0.0.2",example:"dphelper.cookie.set({name, value, time, path = '/'})",description:"Creates a cookie with specified properties.",author:"Dario Passariello",creationDate:"20210101",lastMod:"20240613",type:"function",active:!0,env:"client",subCommand:[]},{name:"get",version:"0.0.2",example:"dphelper.cookie.get(name)",description:"Retrieves the value of a specified cookie.",author:"Dario Passariello",creationDate:"20210101",lastMod:"20240613",type:"function",active:!0,env:"client",subCommand:[]},{name:"delete",version:"0.0.2",example:"dphelper.cookie.delete(name)",description:"Deletes a specified cookie.",author:"Dario Passariello",creationDate:"20210101",lastMod:"20240613",type:"function",active:!0,env:"client",subCommand:[]},{name:"removeAll",version:"0.0.2",example:"dphelper.cookie.removeAll()",description:"Clears all cookies.",author:"Dario Passariello",creationDate:"20210101",lastMod:"20240613",type:"function",active:!0,env:"client",subCommand:[]}]},w);var x={name:"coords",active:!0,subCommand:[{name:"degreesToRadians",version:"0.0.2",example:"dphelper.coords.degreesToRadians(45)",author:"Dario Passariello",creationDate:"2021-01-01",lastMod:"2021-01-01",type:"function",active:!0,description:"Convert degrees to radians",env:"client",subCommand:[]},{name:"latToMeters",version:"0.0.2",example:"dphelper.coords.latToMeters([40.689202777778, -74.044219444444])",author:"Dario Passariello",creationDate:"2021-01-01",lastMod:"2021-01-01",type:"function",active:!0,description:"Convert latitude to meters",env:"client",subCommand:[]},{name:"toVector",version:"0.0.2",example:"dphelper.coords.toVector([40.689202777778, -74.044219444444, 1])",author:"Dario Passariello",creationDate:"2021-01-01",lastMod:"2021-01-01",type:"function",active:!0,description:"Convert coordinates to vector",env:"client",subCommand:[]},{name:"convertToDecDegrees",version:"0.0.2",example:"dphelper.coords.convertToDecDegrees([39, 5, 59, 'N'])",author:"Dario Passariello",creationDate:"2021-01-01",lastMod:"2021-01-01",type:"function",active:!0,description:"Convert coordinates to decimal degrees",env:"client",subCommand:[]},{name:"distance",version:"0.0.2",example:"dphelper.coords.distance([40.718788808171105, -74.0114768663747],[38.909309636475875, -77.01712459058946])",author:"Dario Passariello",creationDate:"2021-01-01",lastMod:"2021-01-01",type:"function",active:!0,description:"\n Haversine formula:\n a = sin²(Δφ/2) + cos φ1 ⋅ cos φ2 ⋅ sin²(Δλ/2)\n c = 2 ⋅ atan2( √a, √(1-a) )\n d = R ⋅ c\n where φ is latitude, λ is longitude, R is earth's radius (mean radius = 6,371km);\n note that angles need to be in radians to pass to trig functions!\n ",env:"client",subCommand:[]},{name:"polarToCartesian",version:"0.0.2",example:"dphelper.coords.polarToCartesian([centerX, centerY, radius, angleInDegrees])",author:"Dario Passariello",creationDate:"2024-09-28",lastMod:"2024-09-28",type:"function",active:!0,description:"Convert polar coordinates to Cartesian coordinates",env:"client",subCommand:[]},{name:"mapDegreesToPixels",version:"0.0.2",example:"dphelper.coords.mapDegreesToPixels([degree, minDegree, maxDegree, minPixel, maxPixel, padding])",author:"Dario Passariello",creationDate:"2024-09-28",lastMod:"2024-09-28",type:"function",active:!0,description:"Map degrees to pixels",env:"client",subCommand:[]}]},C=6371e3,M={degreesToRadians:e=>e*Math.PI/180,latToMeters:e=>{if(!Array.isArray(e))return;return C*Math.cos(e[0])*Math.cos(e[1])/1e3},toVector:e=>{if(!Array.isArray(e))return;return[C*Math.cos(e[1]*Math.PI/180)*Math.cos(e[0]*Math.PI/180),C*Math.cos(e[1]*Math.PI/180)*Math.sin(e[0]*Math.PI/180),C*Math.sin(e[2]*Math.PI/180)]},convertToDecDegrees:(e,t,o,a)=>{let n=e+t/60+o/3600;return"S"!==a&&"W"!==a||(n*=-1),n},distance:(e,t)=>{if(!Array.isArray(e)||!Array.isArray(t))return;const o=e[0]*Math.PI/180,a=t[0]*Math.PI/180,n=(t[0]-e[0])*Math.PI/180,r=(t[1]-e[1])*Math.PI/180,i=Math.sin(n/2)*Math.sin(n/2)+Math.cos(o)*Math.cos(a)*Math.sin(r/2)*Math.sin(r/2),s=2*Math.atan2(Math.sqrt(i),Math.sqrt(1-i)),l=C*s;return{km:Number((l/1e3).toFixed(2)),mi:Number((l/1e3*.621371).toFixed(2)),nMi:Number((l/1e3/1.852).toFixed(2))}},polarToCartesian:(e,t,o,a)=>{const n=(a-90)*Math.PI/180;return{x:e+o*Math.cos(n),y:t+o*Math.sin(n)}},mapDegreesToPixels:(e,t,o,a,n,r)=>{const i=n-(a+(e-t)/(o-t)*(n-a)-r)-r/20;return i<r?r:i}};dphelper?.setDescription(x,M);var S=globalThis.dphelper;S?.setDescription?.({name:"credits",active:!0,subCommand:[]},()=>{console.groupCollapsed("%cdphelper v3.3.6%c","color:orange",""),console.debug("%cdphelper v3.3.6%c by Dario Passariello started","color:orange",""),console.debug("name: %cdphelper","color:orange",""),console.debug("version: %c3.3.6","color:orange",""),console.groupEnd()});var P={en:["January","February","March","April","May","June","July","August","September","October","November","December"],it:["Gennaio","Febbraio","Marzo","Aprile","Maggio","Giugno","Luglio","Agosto","Settembre","Ottobre","Novembre","Dicembre"]},k={days:(e="en")=>({en:["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"],it:["lunedì","martedì","mercoledì","giovedì","venerdì","sabato","domenica"]}[e]),months:(e="en")=>P[e],year:()=>(new Date).getFullYear(),toIso:(e,t="en")=>{e||(e="");const o=new Date(e);if("Invalid Date"===String(o))return null;return new Intl.DateTimeFormat(t,{year:"numeric",month:"long",day:"numeric"}).format(o)},toMMDDYYYY:e=>{try{const t=new Date(e);return isNaN(t.getTime())?"":`0${t.getMonth()+1}`.slice(-2)+""+`0${t.getDate()}`.slice(-2)+t.getFullYear()}catch(e){return""}},toYYYYMMDD:e=>{if(e)return e.toISOString().split("T")[0].replaceAll("-","")},toHuman:e=>e.toLocaleDateString(void 0,{weekday:"long",year:"numeric",month:"long",day:"numeric"}),convert:(e,t)=>{if(!e)return null;t||(t=dphelper.date.months("en"));const o=e.substring(0,2).replace("0",""),a=e.substring(2,4),n=e.substring(e.length-4);return`${a} ${t[Number(o)-1]} ${n}`},iso2Epoch:e=>{e||(e="");return new Date(e).getTime()},localIsoTime:e=>{e||(e=new Date);const t=new Date(e);if(isNaN(t.getTime()))return"";const o=6e4*t.getTimezoneOffset();return new Date(Date.now()-o).toISOString().slice(0,-1)},utc:()=>(new Date).toUTCString(),parse:(e,t="/")=>{if(!e)return null;return e.substring(0,2)+t+e.substring(2,4)+t+e.substring(4,8)},addDays:(e,t)=>{const o=new Date(Number(e));return o.setDate(e.getDate()+t),o},dateTimeToString:e=>{try{return`${e.getFullYear()}${e.getMonth().toString().length>1?e.getMonth()+1:`0${e.getMonth()+1}`}\n ${e.getDate().toString().length>1?e.getDate():`0${e.getDate()}`}_${e.getHours()}${e.getMinutes()}${e.getSeconds()}`}catch(t){return console.error(t),e}},isoToHuman:(e,t="@")=>{if(!e)return null;const o=dphelper.date.months("en"),a=new Date(e),n=a.getFullYear(),r=e.split("T")[1].split(":").slice(0,2).join(":");let i=(a.getMonth()+1).toString(),s=a.getDate().toString();return s.length<2&&(s=`0${s}`),i.length<2&&(i=`0${i}`),`${s} ${o[Number(i)-1]} ${n} ${t} ${r}`},fullDate:()=>{const e=new Date,t=Number(e.getDate()),o=Number(e.getMonth()+1),a=Number(e.getFullYear()),n=Number(e.getHours()),r=Number(e.getMinutes()),i=Number(e.getSeconds());return(t<10?`0${t}`:t)+"-"+(o<10?`0${o}`:o)+"-"+a+" "+(n<10?`0${n}`:n)+":"+(r<10?`0${r}`:r)+":"+(i<10?`0${i}`:i)},epoch:()=>Date.now(),diffInDays:(e,t)=>{const o=t.getTime(),a=e.getTime();return Math.floor((o-a)/864e5)},diffInWeeks:(e,t)=>{const o=t.getTime(),a=e.getTime();return Number(Number.parseInt(String((o-a)/6048e5),10))},diffInMonths:(e,t)=>{const o=e.getFullYear(),a=t.getFullYear(),n=e.getMonth();return t.getMonth()+12*a-(n+12*o)},diffInYears:(e,t)=>t.getFullYear()-e.getFullYear(),dateToYMD:e=>{const t=e.getDate(),o=e.getMonth()+1;return`${e.getFullYear()}-${o<=9?`0${o}`:o}-${t<=9?`0${t}`:t}`},collection:({date:e=new Date,type:t="",locale:o="en-US"})=>{let a;switch(!e&&t&&o&&console.debug('\n "toDateString" -> Tue Jan 02 2024\n "toISOString" -> 2024-01-02T18:44:43.590Z\n "toJSON" -> 2024-01-02T18:44:43.590Z\n "toLocaleDateString" -> 1/2/2024\n "toLocaleString" -> 1/2/2024, 11:44:43 AM\n "toLocaleTimeString" -> 11:44:43 AM\n "toString" -> Tue Jan 02 2024 11:44:43 GMT-0700 (Mountain Standard Time)\n "toISOStringShort" -> 2024-01-02\n "toLocaleString (en-GB)" -> 02/01/2024, 11:47:56 am\n '),t){case"toDateString":a=e.toDateString();break;case"toISOString":a=e.toISOString();break;case"toJSON":a=e.toJSON();break;case"toLocaleDateString":a=e.toLocaleDateString(o);break;case"toLocaleString":a=e.toLocaleString(o);break;case"toLocaleTimeString":a=e.toLocaleTimeString(o);break;case"toString":a=e.toString();break;case"toISOStringShort":a=e.toISOString().slice(0,10)}return a},timeZones:()=>{const e=[],t=Intl.supportedValuesOf("timeZone");for(const o of t)e.push(o);return e}};dphelper?.setDescription({name:"date",active:!0,subCommand:[{name:"toIso",version:"0.0.2",example:"dphelper.date.toIso(value, 'en')",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:!0,description:"Converts a date value to ISO format.",env:"both",subCommand:[]},{name:"toMMDDYYYY",version:"0.0.2",example:"dphelper.date.toMMDDYYYY(value)",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:!0,description:"Converts a date value to MMDDYYYY format.",env:"both",subCommand:[]},{name:"toYYYYMMDD",version:"0.0.2",example:"dphelper.date.toYYYYMMDD(value)",author:"Dario Passariello",creationDate:"20230101",lastMod:"20260220",type:"function",active:!0,description:"Converts a date value to YYYYMMDD format.",env:"both",subCommand:[]},{name:"toHuman",version:"0.0.2",example:"dphelper.date.toHuman(value)",author:"Dario Passariello",creationDate:"20230101",lastMod:"20260220",type:"function",active:!0,description:"Converts a date value to a human-readable format.",env:"both",subCommand:[]},{name:"convert",version:"0.0.2",example:"dphelper.date.convert(value, format)",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:!0,description:"Converts a date value to a specified format.",env:"both",subCommand:[]},{name:"iso2Epoch",version:"0.0.2",example:"dphelper.date.iso2Epoch(value)",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:!0,description:"Converts an ISO date value to epoch time.",env:"both",subCommand:[]},{name:"localIsoTime",version:"0.0.2",example:"dphelper.date.localIsoTime(value)",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:!0,description:"Gets the local ISO time for a given date value.",env:"both",subCommand:[]},{name:"utc",version:"0.0.2",example:"dphelper.date.utc()",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:!0,description:"Gets the current UTC time.",env:"both",subCommand:[]},{name:"parse",version:"0.0.2",example:"dphelper.date.parse(value, '/')",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:!0,description:"Parses a date value with a specified separator.",env:"both",subCommand:[]},{name:"year",version:"0.0.2",example:"dphelper.date.year()",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:!0,description:"Gets the current year.",env:"both",subCommand:[]},{name:"addDays",version:"0.0.2",example:"dphelper.date.addDays(date, days)",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:!0,description:"Adds a specified number of days to a date.",env:"both",subCommand:[]},{name:"dateTimeToString",version:"0.0.2",example:"dphelper.date.dateTimeToString(dateObject)",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:!0,description:"Converts a date object to a string.",env:"both",subCommand:[]},{name:"isoToHuman",version:"0.0.2",example:"dphelper.date.isoToHuman(value, '@')",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:!0,description:"Converts an ISO date value to a human-readable format with a specified symbol.",env:"both",subCommand:[]},{name:"fullDate",version:"0.0.2",example:"dphelper.date.fullDate()",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:!0,description:"Gets the full date and time in the format DD-MM-YYYY HH:MM:SS.",env:"both",subCommand:[]},{name:"epoch",version:"0.0.2",example:"dphelper.date.epoch()",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:!0,description:"Gets the current epoch time.",env:"both",subCommand:[]},{name:"diffInDays",version:"0.0.2",example:"dphelper.date.diffInDays(d1, d2)",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:!0,description:"Calculates the difference in days between two dates.",env:"both",subCommand:[]},{name:"diffInWeeks",version:"0.0.2",example:"dphelper.date.diffInWeeks(d1, d2)",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:!0,description:"Calculates the difference in weeks between two dates.",env:"both",subCommand:[]},{name:"diffInMonths",version:"0.0.2",example:"dphelper.date.diffInMonths(d1, d2)",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:!0,description:"Calculates the difference in months between two dates.",env:"both",subCommand:[]},{name:"diffInYears",version:"0.0.2",example:"dphelper.date.diffInYears(d1, d2)",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:!0,description:"Calculates the difference in years between two dates.",env:"both",subCommand:[]},{name:"dateToYMD",version:"0.0.2",example:"dphelper.date.dateToYMD(date)",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:!0,description:"Converts a date to the format YYYY-MM-DD.",env:"both",subCommand:[]},{name:"collection",version:"0.0.2",example:"dphelper.date.collection()",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:!0,description:"Gets various date representations based on the type and locale.",env:"both",subCommand:[]},{name:"timeZones",version:"0.0.2",example:"dphelper.date.timeZones()",author:"Dario Passariello",creationDate:"20240901",lastMod:"20260220",type:"function",active:!0,description:"Returns an array of all supported timezones.",env:"both",subCommand:[]}]},k);var A={select:(e="body")=>{try{if("undefined"==typeof document)return;const t="string"==typeof e?document.querySelector(e):e;if(!t||"function"!=typeof t.addEventListener)return;const o=e=>{const t=e.target,o=t.tagName.toLowerCase();if(!["input","button","select","textarea"].includes(o)&&!t.classList.contains("selectable"))return document.querySelectorAll("*").forEach(e=>e.blur()),e.preventDefault(),!1;document.querySelectorAll("img, a, input, button").forEach(e=>{e.addEventListener("dragstart",e=>(e.preventDefault(),!1))})};t.addEventListener("mousedown",o),console.debug("%cSelection Disabled: %ctrue","color:orange","")}catch(e){console.debug("dphelper.disable.select:",e)}},spellCheck:(e=5e3)=>{setInterval(()=>{const e=document.querySelectorAll("input[type=text], textarea, code");for(const t of e)t.getAttribute("spellcheck")||t.setAttribute("spellcheck","false")},e)},rightClick:(e="body")=>{try{if("undefined"==typeof document)return;const t="string"==typeof e?document.querySelector(e):e;t&&"function"==typeof t.addEventListener&&t.addEventListener("contextmenu",e=>e.preventDefault())}catch(e){console.debug("dphelper.disable.rightClick:",e)}},copy:(e="body")=>{try{if("undefined"==typeof document)return;const t="string"==typeof e?document.querySelector(e):e;t&&"function"==typeof t.addEventListener&&t.addEventListener("copy",e=>e.preventDefault())}catch(e){console.debug("dphelper.disable.copy:",e)}},paste:(e="body")=>{try{if("undefined"==typeof document)return;const t="string"==typeof e?document.querySelector(e):e;t&&"function"==typeof t.addEventListener&&t.addEventListener("paste",e=>e.preventDefault())}catch(e){console.debug("dphelper.disable.paste:",e)}},cut:(e="body")=>{try{if("undefined"==typeof document)return;const t="string"==typeof e?document.querySelector(e):e;t&&"function"==typeof t.addEventListener&&t.addEventListener("cut",e=>e.preventDefault())}catch(e){console.debug("dphelper.disable.cut:",e)}},drag:(e="body")=>{try{if("undefined"==typeof document)return;const t="string"==typeof e?document.querySelector(e):e;t&&"function"==typeof t.addEventListener&&t.addEventListener("dragstart",e=>e.preventDefault())}catch(e){console.debug("dphelper.disable.drag:",e)}}};dphelper?.setDescription?.({name:"disable",active:!0,subCommand:[{name:"select",version:"0.0.2",example:"dphelper.disable.select([el = 'body'])",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:!0,description:"Disable text selection on the specified element.",env:"client",subCommand:[]},{name:"spellCheck",version:"0.0.2",example:"dphelper.disable.spellCheck([tmr = 5000])",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:!0,description:"Disable spell check on the specified element after a delay.",env:"client",subCommand:[]},{name:"rightClick",version:"0.0.2",example:"dphelper.disable.rightClick([el = 'body'])",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:!0,description:"Disable right-click context menu on the specified element.",env:"client",subCommand:[]},{name:"copy",version:"0.0.2",example:"dphelper.disable.copy([el = 'body'])",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:!0,description:"Disable copy functionality on the specified element.",env:"client",subCommand:[]},{name:"paste",version:"0.0.2",example:"dphelper.disable.paste([el = 'body'])",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:!0,description:"Disable paste functionality on the specified element.",env:"client",subCommand:[]},{name:"cut",version:"0.0.2",example:"dphelper.disable.cut([el = 'body'])",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:!0,description:"Disable cut functionality on the specified element.",env:"client",subCommand:[]},{name:"drag",version:"0.0.2",example:"dphelper.disable.drag([el = 'body'])",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:!0,description:"Disable drag functionality on the specified element.",env:"client",subCommand:[]}]},A);var T={},E={set:(e,t={})=>dispatchEvent(new CustomEvent(String(e),t)),listen:(e,t)=>{T[e]&&T[e].length>0&&dphelper.dispatch.remove(e);const o=e=>t?setTimeout(()=>t(e),0):null;window.addEventListener(e,o),T[e]||(T[e]=[]),T[e].push(o)},remove:e=>{const t=T[e];t&&(t.forEach(t=>window.removeEventListener(e,t)),delete T[e])}};dphelper?.setDescription({name:"dispatch",active:!0,subCommand:[{name:"set",version:"0.0.2",example:"dphelper.dispatch.set([name, value])",author:"Dario Passariello",creationDate:"20231231",lastMod:"20240612",type:"function",active:!0,description:"Dispatches a custom event with the specified name and value.",env:"client",subCommand:[]},{name:"listen",version:"0.0.2",example:"dphelper.dispatch.listen([eventNames, callback=null], flag = true)",author:"Dario Passariello",creationDate:"20231231",lastMod:"20240612",type:"function",active:!0,description:"Listens for the specified event names and executes the callback when the event is triggered.",env:"client",subCommand:[]},{name:"remove",version:"0.0.2",example:"dphelper.dispatch.remove([eventNames, callback=null], flag = true)",author:"Dario Passariello",creationDate:"20231231",lastMod:"20240612",type:"function",active:!0,description:"Removes the event listener for the specified event names.",env:"client",subCommand:[]}]},E);var N={fitScale:(e,t=1,o=!1)=>addEventListener("resize",a=>dphelper.element.scaleBasedOnWindow(e,t,o)),scaleBasedOnWindow:(e,t,o)=>{if(!e)return;const a="string"==typeof e?document.querySelector(e):e;if(!a)return;const n=a.offsetWidth||1,r=a.offsetHeight||1,i=o?t/Math.max(n/window.innerWidth,r/window.innerHeight):t/Math.min(n/window.innerWidth,r/window.innerHeight);a.style.transform=`scale(${i})`}};dphelper?.setDescription({name:"element",active:!0,subCommand:[{name:"fitScale",version:"0.0.2",example:"dphelper.element.fitScale([el = 'root', scale = 1, fit = false])",author:"Dario Passariello",creationDate:"20230527",lastMod:"20230527",type:"function",active:!0,description:"Scales an element based on the window size.",env:"client",subCommand:[]}]},N);var L={list:e=>window.getEventListeners(e),multi:(e,t,o)=>{const a=t.split(" ");for(const t of a)e.addEventListener(t,o,!1)},copy:e=>{const t=document.querySelector(e);t&&t.addEventListener("click",async e=>{if(navigator.clipboard)try{const t=e.target;t&&(await navigator.clipboard.writeText(t.textContent||""),alert("Copied"))}catch(e){console.error("Can't copy the value",e)}})},onDrag:e=>{const t=`.popup_overflow_${e}`,o=document.querySelector(t);if(!o)return;const a=o=>{const a=document.querySelector(t),n=a?.offsetHeight||0,r=a?.offsetWidth||0,i=Math.max(o.pageY,0)-n/2,s=Math.max(o.pageX,0)-r/2;localStorage.setItem(e,JSON.stringify([i,s]))};o.addEventListener("mousedown",()=>{window.addEventListener("mousemove",a)}),window.addEventListener("mouseup",()=>{window.removeEventListener("mousemove",a)})},keys:e=>({key:e.key,ctrl:e.ctrlKey,alt:e.altKey,shift:e.shiftKey})};dphelper?.setDescription({name:"event",active:!0,subCommand:[{name:"list",version:"0.0.2",example:"dphelper.event.list([element])",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:!0,description:"Show attached events.",env:"client",subCommand:[]},{name:"multi",version:"0.0.2",example:"dphelper.event.multi([element, eventNames, listener])",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:!0,description:"Attach multiple event listeners to an element.",env:"client",subCommand:[]},{name:"copy",version:"0.0.2",example:"dphelper.event.copy([element])",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:!0,description:"Copy text content of an element to the clipboard.",env:"client",subCommand:[]},{name:"onDrag",version:"0.0.2",example:"dphelper.event.onDrag([element])",author:"Dario Passariello",creationDate:"20230527",lastMod:"20230527",type:"function",active:!0,description:"Handle dragging functionality for elements.",env:"client",subCommand:[]},{name:"keys",version:"0.0.2",example:"dphelper.event.keys(e)",author:"Dario Passariello",creationDate:"20230527",lastMod:"20230527",type:"function",active:!0,description:"Return key event properties.",env:"client",subCommand:[]}]},L);var j=async(e,t={},o=3,a=1e3)=>{try{const a=await globalThis.fetch(e,t);if(!a.ok&&o>0)throw new Error(a.statusText);return a}catch(n){if(0===o)throw n;return console.warn(`[dphelper] Fetch failed, retrying in ${a}ms... (${o} retries left)`),await new Promise(e=>setTimeout(e,a)),j(e,t,o-1,2*a)}},q=(e,t)=>j(e,t);q.get=(e,t)=>j(e,{...t,method:"GET"}),q.post=(e,t,o={})=>{const a="object"==typeof t&&null!==t;return j(e,{...o,method:"POST",headers:{...a?{"Content-Type":"application/json"}:{},...o.headers||{}},body:a?JSON.stringify(t):t})},dphelper?.setDescription({name:"fetch",active:!0,subCommand:[{name:"get",version:"0.0.1",example:"dphelper.fetch.get('https://api.example.com')",author:"Dario Passariello",creationDate:"20260221",lastMod:"20260221",type:"function",active:!0,description:"Perform a GET request with automatic retries and exponential backoff.",env:"both",subCommand:[]},{name:"post",version:"0.0.1",example:"dphelper.fetch.post('/api', { data: 123 })",author:"Dario Passariello",creationDate:"20260221",lastMod:"20260221",type:"function",active:!0,description:"Perform a POST request with JSON support.",env:"both",subCommand:[]}]},q);var $={serialize:e=>{const t="string"==typeof e?document.querySelector(e):e;if(!t)return{};const o={};if(!/[a-zA-Z][a-zA-Z0-9-_.]/.test(t.name))return;const a=(e,t)=>{let o=e[0];"]"===o.slice(-1)&&(o=o.slice(0,-1));const n={};return 1===e.length?n[o]=(e=>(""===e&&(e=null),"null"===e&&(e=null),"undefined"===e&&(e=void 0),"false"===e&&(e=Boolean(!1)),"true"===e&&(e=Boolean(!0)),"off"===e&&(e=Boolean(!1)),"on"===e&&(e=Boolean(!0)),"[]"===e&&(e=Array),"{}"===e&&(e=Object),0!==["null","undefined","false","true","on","off"].filter(t=>t.includes(e)).length||Number.isNaN(e)||(e=Number(e)),e))(t):(e.shift(),n[o]=a(e,t)),n},n=t.serializeArray();for(const e of n){const t=e.value,n=e.name.split("["),r=a(n,t);Object.assign(o,r)}return o},confirmType:(e,t)=>{if("number"===e){return/^\d+$/.test(t.toString())}if("email"===e){return/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/.test(t.toString().toLowerCase())}return!0},required:e=>null==e?"Required":void 0,minLength:(e,t=1)=>!e||e.length<t?"Must Enter a Value":void 0,maxLength:(e,t=10)=>e.length>t?"Exceeds Max Length":void 0,maxPhoneNumber:(e,t=10)=>e.toString().length>t?"Exceeds Max Length":void 0,isNumeric:e=>!Number.isNaN(e),isEmail:e=>/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/.test(e.toString().toLowerCase()),pattern:e=>{const t=e.target;if(!t.type||!t.value)return;let o;switch(t.type){case"text":case"password":o=/^[a-zA-Z0-9.\- !$@]+$/;break;case"email":o=/^([a-zA-Z0-9._%-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,6})*$/;break;case"number":o=/^[0-9\-+]*$/;break;case"tel":o=/^[0-9\s()\-+]*$/;break;default:return}t.value.match(o)||(t.value=t.value.slice(0,-1),e.preventDefault())},noSpecialChars:e=>{const t=e.target,o=t.value.trim();o.length>2&&(t.value=o.replace(/[^\w\s]/gi,""))},table:(e,t,o)=>{const a=e[0]||7,n=e[1]||24,r=e=>String(e).replace(/[&<>"']/g,e=>({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"}[e]||e));let i=`<form id='${r(t)}'>`;i+="<div class='table'>",i+="<div class='title'>";for(let e=1;e<=a;e++)i+=`<span>${e}</span>`;i+="</div>";for(let e=1;e<=n;e++){i+=`<div class='row'><span>${e}</span>`;for(let t=1;t<=a;t++)i+=`<input name='data[${t}][${e}]' tabindex='${t.toString().padStart(2,"0")}${e.toString().padStart(2,"0")}' type='number' onclick="this.select()" value='${Math.floor(100*Math.random())}' title='${r(t)} to ${r(e)}' />`;i+="</div>"}i+="</div>",i+="</form>",o&&(o.innerHTML=i)},sanitize:e=>{if(e)return e.replace(/[^\w ]/g,"").replace(/[&/\\#, +()$~%.'":*?<>{}]/g,"")}};dphelper?.setDescription({name:"form",active:!0,subCommand:[{name:"serialize",version:"0.0.2",example:"dphelper.form.serialize([form])",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:!0,description:"Serialize form data into an object.",env:"client",subCommand:[]},{name:"confirmType",version:"0.0.2",example:"dphelper.form.confirmType([type, value])",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:!0,description:"Confirm the type of a value.",env:"client",subCommand:[]},{name:"required",version:"0.0.2",example:"dphelper.form.required([value])",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:!0,description:"Check if a value is required.",env:"client",subCommand:[]},{name:"minLength",version:"0.0.2",example:"dphelper.form.minLength([value, num = 1])",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:!0,description:"Check if a value meets the minimum length.",env:"client",subCommand:[]},{name:"maxLength",version:"0.0.2",example:"dphelper.form.maxLength([value, num = 10])",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:!0,description:"Check if a value exceeds the maximum length.",env:"client",subCommand:[]},{name:"maxPhoneNumber",version:"0.0.2",example:"dphelper.form.maxPhoneNumber([value, num = 10])",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:!0,description:"Check if a phone number exceeds the maximum length.",env:"client",subCommand:[]},{name:"isNumeric",version:"0.0.2",example:"dphelper.form.isNumeric([value])",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:!0,description:"Check if a value is numeric.",env:"client",subCommand:[]},{name:"isEmail",version:"0.0.2",example:"dphelper.form.isEmail([value])",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:!0,description:"Validate an email format.",env:"client",subCommand:[]},{name:"pattern",version:"0.0.2",example:"dphelper.form.pattern(event)",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:!0,description:"Pattern validation using onChange on inputs when you provide a pattern.",env:"client",subCommand:[]},{name:"noSpecialChars",version:"0.0.2",example:"dphelper.form.noSpecialChars(event)",author:"Dario Passariello",creationDate:"20230527",lastMod:"20230527",type:"function",active:!0,description:"Avoid special characters in an input.",env:"client",subCommand:[]},{name:"table",version:"0.0.2",example:"dphelper.form.table(size = [7, 24], id, elem)",author:"Dario Passariello",creationDate:"20240101",lastMod:"20240101",type:"function",active:!0,description:"Generate a table (default 7x24).",env:"client",subCommand:[]},{name:"sanitize",version:"0.0.2",example:"dphelper.form.sanitize(input)",author:"Dario Passariello",creationDate:"20240318",lastMod:"20240318",type:"function",active:!0,description:"Sanitize input value to avoid injection.",env:"client",subCommand:[]}]},$);var I={currency:(e,t="en-US",o="USD")=>new Intl.NumberFormat(t,{style:"currency",currency:o}).format(e),phoneNumber:(e,t="US")=>{const o=`${e}`.replace(/\D/g,"");let a;return"US"===t&&(a=o.match(/^(\d{3})(\d{3})(\d{4})$/),a)?`(${a[1]}) ${a[2]}-${a[3]}`:e}};dphelper?.setDescription({name:"format",active:!0,subCommand:[{name:"currency",version:"0.0.2",example:"dphelper.format.currency(value, locale, currency)",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:!0,description:"Format a number as currency.",env:"both",subCommand:[]},{name:"phoneNumber",version:"0.0.2",example:"dphelper.format.phoneNumber(value, countryCode)",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:!0,description:"Format a string as a phone number.",env:"both",subCommand:[]}]},I);var O=new Map,R="en";O.set("en",{hello:"Hello {name}!",goodbye:"Goodbye!",welcome:"Welcome to our app!",loading:"Loading...",error:"An error occurred",success:"Success!",confirm:"Are you sure?",cancel:"Cancel",save:"Save",delete:"Delete",edit:"Edit",close:"Close"});var z={setLocale:e=>{R=e,"auto"===e&&"undefined"!=typeof navigator&&(R=navigator.language.split("-")[0]||"en")},getLocale:()=>R,addTranslations:(e,t)=>{const o=O.get(e)||{};O.set(e,{...o,...t})},t:(e,t={})=>{let o=(O.get(R)||O.get("en")||{})[e]||e;return Object.entries(t).forEach(([e,t])=>{o=o.replace(new RegExp(`\\{${e}\\}`,"g"),String(t))}),o},pluralize:(e,t,o)=>{const a=o||R;if(0===e&&t.zero)return t.zero;if(1===e)return t.one||t.other||"";if(2===e&&t.two)return t.two;if("pl"===a&&e%10>=2&&e%10<=4&&(e%100<10||e%100>=20))return t.few||t.other||"";if("ru"===a||"uk"===a){if(e%10==1&&e%100!=11)return t.one||t.other||"";if(e%10>=2&&e%10<=4&&(e%100<10||e%100>=20))return t.few||t.other||""}return t.other||String(e)},number:(e,t,o)=>{const a=t||R;return new Intl.NumberFormat(a,o).format(e)},date:(e,t,o)=>{const a=t||R,n="number"==typeof e?new Date(e):e;return new Intl.DateTimeFormat(a,o).format(n)},relativeTime:(e,t)=>{const o=t||R,a=Date.now()-("number"==typeof e?e:e.getTime()),n=new Intl.RelativeTimeFormat(o,{numeric:"auto"}),r=Math.floor(a/1e3),i=Math.floor(r/60),s=Math.floor(i/60),l=Math.floor(s/24),c=Math.floor(l/7),d=Math.floor(l/30),p=Math.floor(l/365);return Math.abs(r)<60?n.format(-r,"second"):Math.abs(i)<60?n.format(-i,"minute"):Math.abs(s)<24?n.format(-s,"hour"):Math.abs(l)<7?n.format(-l,"day"):Math.abs(c)<4?n.format(-c,"week"):Math.abs(d)<12?n.format(-d,"month"):n.format(-p,"year")},list:(e,t,o)=>{const a=t||R;return new Intl.ListFormat(a,o).format(e)},getSupportedLocales:()=>Array.from(O.keys())};dphelper?.setDescription({name:"i18n",active:!0,subCommand:[{name:"setLocale",version:"0.0.1",example:"dphelper.i18n.setLocale('it')",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:!0,description:"Set the current locale",env:"both",subCommand:[]},{name:"t",version:"0.0.1",example:"dphelper.i18n.t('hello', { name: 'World' })",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:!0,description:"Translate a key with optional interpolation",env:"both",subCommand:[]},{name:"addTranslations",version:"0.0.1",example:"dphelper.i18n.addTranslations('it', { hello: 'Ciao {name}!' })",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:!0,description:"Add translation strings for a locale",env:"both",subCommand:[]},{name:"getLocale",version:"0.0.1",example:"dphelper.i18n.getLocale()",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:!0,description:"Get the current locale",env:"both",subCommand:[]},{name:"pluralize",version:"0.0.1",example:"dphelper.i18n.pluralize(5, { one: 'item', other: 'items' })",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:!0,description:"Get pluralized string based on count",env:"both",subCommand:[]},{name:"number",version:"0.0.1",example:"dphelper.i18n.number(1234.56, 'de-DE', { style: 'currency', currency: 'EUR' })",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:!0,description:"Format a number according to locale",env:"both",subCommand:[]},{name:"date",version:"0.0.1",example:"dphelper.i18n.date(new Date(), 'en-US', { dateStyle: 'long' })",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:!0,description:"Format a date according to locale",env:"both",subCommand:[]},{name:"relativeTime",version:"0.0.1",example:"dphelper.i18n.relativeTime(Date.now() - 3600000)",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:!0,description:"Get relative time string (e.g., '2 hours ago')",env:"both",subCommand:[]},{name:"list",version:"0.0.1",example:"dphelper.i18n.list(['a', 'b', 'c'], 'en')",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:!0,description:"Format a list according to locale",env:"both",subCommand:[]},{name:"getSupportedLocales",version:"0.0.1",example:"dphelper.i18n.getSupportedLocales()",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:!0,description:"Get list of supported locales",env:"both",subCommand:[]}]},z);var U=new Map,F=(e,t=1,o={})=>new Promise((a,n)=>{if(U.has(e))return void a(U.get(e));const r=indexedDB.open(e,t);r.onerror=()=>n(new Error(`Failed to open database: ${e}`)),r.onsuccess=()=>{const t=r.result;U.set(e,t),a(t)},r.onupgradeneeded=e=>{const t=e.target.result;Array.from(t.objectStoreNames).forEach(e=>{o[e]||t.deleteObjectStore(e)}),Object.entries(o).forEach(([e,o])=>{const{keyPath:a,autoIncrement:n,indexes:r}=(e=>{const[t,o]=e.split(":").map(e=>e.trim()),a=t||"store";if(!o)return{name:a,keyPath:"id",autoIncrement:!0,indexes:[]};const n=o.split(",").map(e=>e.trim()),r=n.find(e=>e.includes("++")||e.includes("*"));return{name:a,keyPath:r?r.replace("++","").replace("*",""):"id",autoIncrement:!!n.find(e=>e.includes("++")),indexes:n.filter(e=>!e.includes("++")&&!e.includes("*")).map(e=>({name:e,keyPath:e,unique:e.endsWith("!")}))}})(o);if(!t.objectStoreNames.contains(e)){const o=t.createObjectStore(e,{keyPath:a,autoIncrement:n});r.forEach(e=>{o.createIndex(e.name,e.keyPath,{unique:e.unique})})}})}}),H={open:F,put:async(e,t,o)=>{const a=await F(e);return new Promise((e,n)=>{const r=a.transaction(t,"readwrite").objectStore(t).put(o);r.onsuccess=()=>e(r.result),r.onerror=()=>n(new Error("Failed to put record"))})},get:async(e,t,o)=>{const a=await F(e);return new Promise((e,n)=>{const r=a.transaction(t,"readonly").objectStore(t).get(o);r.onsuccess=()=>e(r.result),r.onerror=()=>n(new Error(`Failed to get key: ${o}`))})},getAll:async(e,t)=>{const o=await F(e);return new Promise((e,a)=>{const n=o.transaction(t,"readonly").objectStore(t).getAll();n.onsuccess=()=>e(n.result||[]),n.onerror=()=>a(new Error("Failed to get all records"))})},delete:async(e,t,o)=>{const a=await F(e);return new Promise((e,n)=>{const r=a.transaction(t,"readwrite").objectStore(t).delete(o);r.onsuccess=()=>e(),r.onerror=()=>n(new Error(`Failed to delete key: ${o}`))})},clear:async(e,t)=>{const o=await F(e);return new Promise((e,a)=>{const n=o.transaction(t,"readwrite").objectStore(t).clear();n.onsuccess=()=>e(),n.onerror=()=>a(new Error("Failed to clear store"))})},count:async(e,t)=>{const o=await F(e);return new Promise((e,a)=>{const n=o.transaction(t,"readonly").objectStore(t).count();n.onsuccess=()=>e(n.result),n.onerror=()=>a(new Error("Failed to count records"))})},query:async(e,t,o,a,n)=>{const r=await F(e);return new Promise((e,i)=>{const s=r.transaction(t,"readonly").objectStore(t).index(o),l=[],c=s.openCursor(n?.range,n?.direction||"next");c.onsuccess=t=>{const r=t.target.result;r&&(!n?.limit||l.length<n.limit)?(void 0!==a&&r.value[o]!==a||l.push(r.value),r.continue()):e(l)},c.onerror=()=>i(new Error("Failed to query records"))})},bulkPut:async(e,t,o)=>{const a=await F(e);return new Promise((e,n)=>{const r=a.transaction(t,"readwrite"),i=r.objectStore(t),s=[];o.forEach(e=>{const t=i.put(e);t.onsuccess=()=>s.push(t.result)}),r.oncomplete=()=>e(s),r.onerror=()=>n(new Error("Failed to bulk put records"))})},close:e=>{const t=U.get(e);t&&(t.close(),U.delete(e))}};dphelper?.setDescription({name:"idb",active:!0,subCommand:[{name:"open",version:"0.0.1",example:"dphelper.idb.open('mydb', 1, { users: 'id++,name,email' })",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:!0,description:"Open or create an IndexedDB database",env:"client",subCommand:[]},{name:"put",version:"0.0.1",example:"dphelper.idb.put('mydb', 'users', { name: 'John', email: 'john@example.com' })",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:!0,description:"Insert or update a record in an object store",env:"client",subCommand:[]},{name:"get",version:"0.0.1",example:"dphelper.idb.get('mydb', 'users', 1)",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:!0,description:"Get a record by key from an object store",env:"client",subCommand:[]},{name:"getAll",version:"0.0.1",example:"dphelper.idb.getAll('mydb', 'users')",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:!0,description:"Get all records from an object store",env:"client",subCommand:[]},{name:"delete",version:"0.0.1",example:"dphelper.idb.delete('mydb', 'users', 1)",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:!0,description:"Delete a record by key from an object store",env:"client",subCommand:[]},{name:"clear",version:"0.0.1",example:"dphelper.idb.clear('mydb', 'users')",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:!0,description:"Clear all records from an object store",env:"client",subCommand:[]},{name:"count",version:"0.0.1",example:"dphelper.idb.count('mydb', 'users')",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:!0,description:"Count records in an object store",env:"client",subCommand:[]},{name:"query",version:"0.0.1",example:"dphelper.idb.query('mydb', 'users', 'name', 'John')",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:!0,description:"Query records by index with optional range",env:"client",subCommand:[]},{name:"bulkPut",version:"0.0.1",example:"dphelper.idb.bulkPut('mydb', 'users', [{name: 'A'}, {name: 'B'}])",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:!0,description:"Insert or update multiple records at once",env:"client",subCommand:[]},{name:"close",version:"0.0.1",example:"dphelper.idb.close('mydb')",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:!0,description:"Close a database connection",env:"client",subCommand:[]}]},H);var _=(e,t)=>{const o=document.createElement("canvas");return o.width=e,o.height=t,o},W=e=>new Promise((t,o)=>{const a=new Image;a.onload=()=>t(a),a.onerror=o,a.src=e}),B=(e,t)=>{const o=[];void 0!==t.brightness&&o.push(`brightness(${t.brightness})`),void 0!==t.contrast&&o.push(`contrast(${t.contrast})`),void 0!==t.saturate&&o.push(`saturate(${t.saturate})`),void 0!==t.hueRotate&&o.push(`hue-rotate(${t.hueRotate}deg)`),void 0!==t.invert&&o.push(`invert(${t.invert})`),void 0!==t.sepia&&o.push(`sepia(${t.sepia})`),void 0!==t.blur&&o.push(`blur(${t.blur}px)`),void 0!==t.grayscale&&o.push(`grayscale(${t.grayscale})`);const a=_(e.width,e.height),n=a.getContext("2d");return n.filter=o.join(" "),n.drawImage(e,0,0),a.toDataURL("image/png")},J={resize:(e,t,o,a="auto")=>{const n=_(t,o),r=n.getContext("2d");return r.imageSmoothingEnabled="pixelated"!==a,r.imageSmoothingQuality="high",r.drawImage(e,0,0,t,o),n.toDataURL("image/png")},crop:(e,t)=>{const o=_(t.width,t.height);return o.getContext("2d").drawImage(e,t.x,t.y,t.width,t.height,0,0,t.width,t.height),o.toDataURL("image/png")},toDataURL:(e,t="image/png",o=.92)=>{const a=_(e.width,e.height),n=a.getContext("2d");return HTMLImageElement,n.drawImage(e,0,0),a.toDataURL(t,o)},fromDataURL:e=>W(e),filter:B,rotate:(e,t)=>{const o=t*Math.PI/180,a=Math.abs(Math.sin(o)),n=Math.abs(Math.cos(o)),r=e.width*n+e.height*a,i=e.width*a+e.height*n,s=_(r,i),l=s.getContext("2d");return l.translate(r/2,i/2),l.rotate(o),l.drawImage(e,-e.width/2,-e.height/2),s.toDataURL("image/png")},flip:(e,t)=>{const o=_(e.width,e.height),a=o.getContext("2d");return"horizontal"===t?(a.translate(e.width,0),a.scale(-1,1)):(a.translate(0,e.height),a.scale(1,-1)),a.drawImage(e,0,0),o.toDataURL("image/png")},grayscale:e=>B(e,{grayscale:1}),blur:(e,t)=>B(e,{blur:t}),getDimensions:e=>({width:e.width,height:e.height}),load:W,composite:(e,t,o="source-over",a=0,n=0)=>{const r=Math.max(e.width,t.width+a),i=Math.max(e.height,t.height+n),s=_(r,i),l=s.getContext("2d");return l.drawImage(e,0,0),l.globalCompositeOperation=o,l.drawImage(t,a,n),s.toDataURL("image/png")}};dphelper?.setDescription({name:"image",active:!0,subCommand:[{name:"resize",version:"0.0.1",example:"dphelper.image.resize(img, 100, 100)",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:!0,description:"Resize an image to specified dimensions",env:"client",subCommand:[]},{name:"crop",version:"0.0.1",example:"dphelper.image.crop(img, { x: 0, y: 0, width: 100, height: 100 })",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:!0,description:"Crop an image to specified region",env:"client",subCommand:[]},{name:"toDataURL",version:"0.0.1",example:"dphelper.image.toDataURL(img, 'image/webp', 0.8)",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:!0,description:"Convert image to data URL with optional format and quality",env:"client",subCommand:[]},{name:"fromDataURL",version:"0.0.1",example:"dphelper.image.fromDataURL(dataUrl)",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:!0,description:"Create an Image element from a data URL",env:"client",subCommand:[]},{name:"filter",version:"0.0.1",example:"dphelper.image.filter(img, { brightness: 1.2, contrast: 1.1 })",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:!0,description:"Apply CSS filters to an image",env:"client",subCommand:[]},{name:"rotate",version:"0.0.1",example:"dphelper.image.rotate(img, 90)",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:!0,description:"Rotate an image by degrees",env:"client",subCommand:[]},{name:"flip",version:"0.0.1",example:"dphelper.image.flip(img, 'horizontal')",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:!0,description:"Flip an image horizontally or vertically",env:"client",subCommand:[]},{name:"grayscale",version:"0.0.1",example:"dphelper.image.grayscale(img)",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:!0,description:"Convert image to grayscale",env:"client",subCommand:[]},{name:"blur",version:"0.0.1",example:"dphelper.image.blur(img, 5)",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:!0,description:"Apply blur effect to an image",env:"client",subCommand:[]},{name:"getDimensions",version:"0.0.1",example:"dphelper.image.getDimensions(img)",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:!0,description:"Get image dimensions",env:"client",subCommand:[]},{name:"load",version:"0.0.1",example:"dphelper.image.load('image.jpg')",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:!0,description:"Load an image from URL",env:"client",subCommand:[]},{name:"composite",version:"0.0.1",example:"dphelper.image.composite(img1, img2, 'multiply')",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:!0,description:"Composite two images together",env:"client",subCommand:[]}]},J);var G={counter:(e,t,o)=>e?t&&o?e.items&&Array.isArray(e.items)?e.items.filter(e=>e[t]===o).length:Object.keys(e).length:0:null,toCsv:e=>{const t=e,o=(e,t)=>null===t?"":t,a=Object.keys(t[0]),n=t.map(e=>a.map(t=>JSON.stringify(e[t],o)).join(","));return n.unshift(a.join(",")),n.join("\r\n")},saveCsvAs:(e,t)=>{const o=new Blob([e],{type:"text/csv;charset=utf-8;"}),a=document.createElement("a"),n=`${t}_${dphelper.date.dateTimeToString(new Date(Date.now()))}.csv`,r=URL.createObjectURL(o);a.setAttribute("href",r),a.setAttribute("download",n),a.style.visibility="hidden",document.body.appendChild(a),a.click(),document.body.removeChild(a)},is:e=>{try{JSON.parse(e)}catch(e){return console.warn(e),!1}return!0},parse:e=>{try{return JSON.parse(e)}catch(e){return console.warn(e),"Json not parsable"}},sanitize:e=>{if(!e)return"{}";return"{"+e.trim().replace(/^\{/,"").replace(/\}$/,"").split(/,(?=(?:[^"]*"[^"]*")*[^"]*$)/).map(e=>{const[t,...o]=e.split(":"),a=dphelper.json.sanitizeJsonValue(t?.trim()??"");if(!t)return"";let n=o.join(":");return n?(n=n.trim(),n="null"===n?'""':"true"===n||"false"===n||/^\d+$/.test(n)?`"${n}"`:dphelper.json.sanitizeJsonValue(n)):n='""',`${a}:${n}`}).filter(e=>""!==e).join(",")+"}"},sanitizeJsonValue:e=>e?`"${e.replace(/^"(.*)"$/,"$1").replace(/\\/g,"").replace(/\//g,"/").replace(/\n/g,"\\n").replace(/\f/g,"\\f").replace(/\r/g,"\\r").replace(/"/g,'\\"').replace(/\t/g," ").trim()}"`:'""'};dphelper?.setDescription({name:"json",active:!0,subCommand:[{name:"counter",version:"0.0.2",example:"dphelper.json.counter()",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:!0,description:"Count occurrences of a key-value pair in a JSON object.",env:"both",subCommand:[]},{name:"toCsv",version:"0.0.2",example:"dphelper.json.toCsv()",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:!0,description:"Convert JSON data to CSV format.",env:"both",subCommand:[]},{name:"saveCsvAs",version:"0.0.2",example:"dphelper.json.saveCsvAs()",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:!0,description:"Save CSV data as a file.",env:"both",subCommand:[]},{name:"is",version:"0.0.2",example:"dphelper.json.is()",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:!0,description:"Check if a string is valid JSON.",env:"both",subCommand:[]},{name:"parse",version:"0.0.2",example:"dphelper.json.parse()",author:"Dario Passariello",creationDate:"20241107",lastMod:"20241107",type:"function",active:!0,description:"Parse a JSON string.",env:"both",subCommand:[]},{name:"sanitize",version:"0.0.2",example:"dphelper.json.sanitize()",author:"Dario Passariello",creationDate:"20241107",lastMod:"20241107",type:"function",active:!0,description:"Sanitize a JSON string.",env:"both",subCommand:[]},{name:"sanitizeJsonValue",version:"0.0.2",example:"dphelper.json.sanitizeJsonValue()",author:"Dario Passariello",creationDate:"20241107",lastMod:"20241107",type:"function",active:!0,description:"Sanitize individual JSON values.",env:"both",subCommand:[]}]},G);var Y={all:(e,t="")=>{if(e)if(t&&!window.cacheName&&(window.cacheName=[]),"object"!=typeof e||e.keys){if("function"==typeof e&&e.keys)for(const o of e.keys())t&&window.cacheName.push(o),e(o)}else for(const o in e)t&&window.cacheName.push(o)},file:()=>null,fileToElement:async(e,t)=>{try{const o=await dphelper.load.file(t),a=document.querySelector(e);a?a.innerHTML=dphelper.sanitize.html(o):console.error(`Element not found: ${e}`)}catch(e){console.error("Error loading file to element:",e)}},script:(e,t="html")=>{const o=document.querySelector(t);if(o)for(const t of e){const e=document.createElement("script");e.src=t,e.async=!0,e.defer=!0,o.appendChild(e)}else console.error(`Element not found: ${t}`)},toJson:(e,t="")=>{const o={};if(e){if(t&&(o[t]=[]),"object"!=typeof e||e.keys){if("function"==typeof e&&e.keys)for(const a of e.keys())t&&o[t]&&o[t].push(a),e(a)}else for(const a in e)t&&o[t]&&o[t].push(a);t&&o[t]&&Object.defineProperty(window,t,{value:dphelper.array.pathToJson(o[t]),writable:!1,enumerable:!1,configurable:!1})}}};dphelper?.setDescription?.({name:"load",active:!0,subCommand:[{name:"all",version:"0.0.3",example:"dphelper.load.all(import.meta.glob('./Scripts/*.ts', { eager: true }))",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260228",type:"function",active:!0,description:"Load all files from a glob object (Vite/esbuild) or require context. If you add a 'cacheName', the list is stored in cache.",env:"client",subCommand:[]},{name:"file",version:"0.0.2",example:"dphelper.load.file(filePath)",author:"Dario Passariello",creationDate:"20240101",lastMod:"20240101",type:"function",active:!0,description:"Load a specific file.",env:"client",subCommand:[]},{name:"fileToElement",version:"0.0.2",example:"dphelper.load.fileToElement(filePath, elementSelector)",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:!0,description:"Load a file and insert its content into an element.",env:"client",subCommand:[]},{name:"script",version:"0.0.2",example:"dphelper.load.script(scripts, elementSelector)",author:"Dario Passariello",creationDate:"20240525",lastMod:"20240525",type:"function",active:!0,description:"Append script tags to an element.",env:"client",subCommand:[]},{name:"toJson",version:"0.0.3",example:"dphelper.load.toJson(import.meta.glob('./router/*.ts', { eager: true }), 'router')",author:"Dario Passariello",creationDate:"20250101",lastMod:"20260228",type:"function",active:!0,description:"Create JSON from folder recursion using glob object.",env:"client",subCommand:[]}]},Y);var V={log:[]},Z={list:()=>V.log,reg:e=>{V.log.push({type:"reg",message:e}),V.log.length>1e3&&V.log.shift()},debug:e=>{V.log.push({type:"debug",message:e}),V.log.length>1e3&&V.log.shift()},error:e=>{V.log.push({type:"error",message:e}),V.log.length>1e3&&V.log.shift()}};Object.defineProperty(V,"log",{writable:!1,enumerable:!1,configurable:!1}),dphelper?.setDescription({name:"logging",active:!0,subCommand:[{name:"list",version:"0.0.2",example:"dphelper.log.list()",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:!0,description:"List all log entries.",env:"both",subCommand:[]},{name:"reg",version:"0.0.2",example:"dphelper.log.reg('message')",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:!0,description:"Log a regular message.",env:"both",subCommand:[]},{name:"debug",version:"0.0.2",example:"dphelper.log.debug('message')",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:!0,description:"Log a debug message.",env:"both",subCommand:[]},{name:"error",version:"0.0.2",example:"dphelper.log.error('message')",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:!0,description:"Log an error message.",env:"both",subCommand:[]}]},Z);var K={rnd:()=>Math.floor(1e5+Math.random()*dphelper.math.tmr()),tmr:()=>Math.round(dphelper.date.epoch()/1e3),isOdd:e=>Number(e)%2!=0,percent:(e,t)=>{if(0===t)throw new Error("Total cannot be zero");return Number(e)/Number(t)*100},isPrime:e=>{if(Number(e)<=1)return!1;for(let t=2;t<=Math.sqrt(Number(e));t++)if(Number(e)%t===0)return!1;return!0}};dphelper?.setDescription({name:"math",active:!0,subCommand:[{name:"rnd",version:"0.0.2",example:"dphelper.math.rnd()",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:!0,description:"Generate a random number.",env:"both",subCommand:[]},{name:"tmr",version:"0.0.2",example:"dphelper.math.tmr()",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:!0,description:"Measure the time taken by a function.",env:"both",subCommand:[]},{name:"isOdd",version:"0.0.2",example:"dphelper.math.isOdd(a)",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:!0,description:"Check if a number is odd.",env:"both",subCommand:[]},{name:"percent",version:"0.0.2",example:"dphelper.math.percent([n, tot])",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:!0,description:"Calculate the percentage of a number relative to a total. Example: total: 100, number: 25 -> 25%",env:"both",subCommand:[]},{name:"isPrime",version:"0.0.2",example:"dphelper.math.isPrime(a)",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:!0,description:"Check if a number is prime.",env:"both",subCommand:[]}]},K);var X={lock:e=>{if(!e)return;const t=window,o=e.split(".");if(o.length<2)return;const a=o[0],n=o[1];if(!a||!n)return;const r=t[a];r&&Object.defineProperty(r,n,{writable:!1,configurable:!1})},unlock:e=>{if(!e)return;const t=window,o=e.split(".");if(o.length<2)return;const a=o[0],n=o[1];if(!a||!n)return;const r=t[a];if(r)try{Object.defineProperty(r,n,{writable:!0,configurable:!0})}catch(e){}}};dphelper?.setDescription({name:"memory",active:!0,subCommand:[{name:"lock",version:"0.0.2",example:"dphelper.memory.lock('state[key]')",author:"Dario Passariello",creationDate:"20230101",lastMod:"20230111",type:"function",active:!0,description:"Lock a state",env:"client",subCommand:[]},{name:"unlock",version:"0.0.2",example:"dphelper.memory.unlock('state[key]')",author:"Dario Passariello",creationDate:"20230101",lastMod:"20230111",type:"function",active:!0,description:"Unlock a state",env:"client",subCommand:[]}]},X);var Q={load:async e=>{const t=document.body;let o=e.startsWith("/")?e.split("/")[1]||"home":e;if(o&&""!==o||(o="home"),!document.querySelector(".loader")){const e=document.createElement("div");e.className="loader",e.innerHTML="<i></i>",e.style.opacity="0",e.style.transition="opacity 1000ms",t.appendChild(e),setTimeout(()=>e.style.opacity="1",10)}try{const e=await fetch(`${o}/`);if(!e.ok)throw new Error("Page not found");const a=await e.text(),n=a.match(/<body[^>]*>([\s\S]*)<\/body>/i),r=n?n[1]:a,i=e=>{const t=document.createElement("div");return t.textContent=e,t.innerHTML},s=dphelper?.sanitize?.html?dphelper.sanitize.html(r||""):i(r||"");t.innerHTML=s,window.scrollTo({top:0,behavior:"smooth"}),document.title=o.charAt(0).toUpperCase()+o.slice(1);const l=dphelper.path.rail();l&&l.length>0&&(t.className=t.className.replace(/path-\w+/g,"").trim(),t.classList.add(`path-${l[l.length-1]}`)),globalThis.dphelper.navigation.ajax_running&&dphelper.navigation.ajax()}catch(t){console.error("Navigation error:",t);const o=window.location.origin;if(e.startsWith("/")&&!e.startsWith("//")&&!e.match(/^[a-zA-Z]:/)){new URL(e,o).href.startsWith(o)&&(window.location.href=e)}}},_bind:e=>{document.querySelectorAll(e).forEach(e=>{const t=e.getAttribute("href");if(!t||!t.startsWith("/")||t.includes("#"))return;const o=e.cloneNode(!0);e.parentNode?.replaceChild(o,e),o.addEventListener("mouseup",e=>{const a=o.getAttribute("data-href")||t;history.pushState({href:a},"",a),dphelper.navigation.load(a),o.removeAttribute("href"),e.stopPropagation()})})},ajax:()=>{globalThis.dphelper.navigation.ajax_running?dphelper.navigation._bind("a"):(globalThis.dphelper.navigation.ajax_running=!0,window.onpopstate=()=>dphelper.navigation.load(window.location.pathname),dphelper.navigation._bind("a"),globalThis.dp_hash_listener_set||(window.addEventListener("hashchange",()=>{const e=window.location.hash.substring(1);if(e){const t=document.getElementById(e);t?.scrollIntoView({behavior:"smooth"})}}),globalThis.dp_hash_listener_set=!0))}};dphelper?.setDescription({name:"navigation",active:!0,subCommand:[{name:"ajax",version:"0.0.2",example:"dphelper.navigation.ajax()",author:"Dario Passariello",creationDate:"20260223",lastMod:"20260223",type:"function",active:!0,description:"Vanilla AJAX Single Page Application (SPA) navigation engine.",env:"client",subCommand:[]},{name:"load",version:"0.0.1",example:"dphelper.navigation.load('/home')",author:"Dario Passariello",creationDate:"20260223",lastMod:"20260223",type:"function",active:!0,description:"Loads a page via AJAX and injects it into the body.",env:"client",subCommand:[]}]},Q);var ee={smartFetch:async(e,t={},o=3,a=1e3)=>{try{const a=await globalThis.fetch(e,t);if(!a.ok&&o>0)throw new Error(`HTTP ${a.status}: ${a.statusText}`);return a}catch(n){if(0===o)throw n;return console.warn(`[dphelper.net] Fetch failed, retrying in ${a}ms... (${o} retries left)`,n),await new Promise(e=>setTimeout(e,a)),ee.smartFetch(e,t,o-1,2*a)}}};dphelper?.setDescription({name:"net",active:!0,subCommand:[{name:"smartFetch",version:"0.0.1",example:"dphelper.net.smartFetch(url, options)",author:"Dario Passariello",creationDate:"20260220",lastMod:"20260220",type:"function",active:!0,description:"Fetch with automatic retry and exponential backoff",env:"both",subCommand:[]}]},ee);var te={replaceNullObjects:e=>{const t={...e};for(const o of Object.keys(e))null===t[o]&&(t[o]="")},serialize:e=>{if("function"==typeof e)return e.toString();if("object"==typeof e){const t={};for(const[o,a]of Object.entries(e))t[o]=dphelper.obj.serialize(a);return t}return e},deSerialize:e=>{if("object"==typeof e){const t={};for(const[o,a]of Object.entries(e))t[o]=dphelper.obj.deSerialize(a);return t}return e},sort:e=>Object.keys(e).sort().reduce((t,o)=>(t[o]=e[o],t),{}),toXML:e=>{const t=(e,o="")=>{let a="";for(const n in e)if(Object.hasOwn(e,n)){const r=e[n];a+="object"==typeof r&&null!==r?`${o}<${n}>\n${t(r,`${o} `)}${o}</${n}>\n`:`${o}<${n}>${r}</${n}>\n`}return a};return t(e)},updateByKey:(e,t,o)=>(Object.hasOwn(e,t)&&(e[t]=o),e),parse:e=>{try{return JSON.parse(e)}catch(t){return console.error(t),e}},isObject:e=>"object"==typeof e&&null!==e,diff:(e,t)=>{const o={};for(const a in e)Object.hasOwn(e,a)&&e[a]!==t[a]&&(o[a]={obj1:e[a],obj2:t[a]});for(const a in t)Object.hasOwn(t,a)&&e[a]!==t[a]&&(o[a]={obj1:e[a],obj2:t[a]});return o},path:(e,t,o=".")=>t.concat(e).join(o),setProps:(e,t)=>{Reflect.ownKeys(e).forEach(o=>{const a=Object.getOwnPropertyDescriptor(e,o);a&&(a.enumerable=t?.enumerable??!0,a.configurable=t?.configurable??!0,a.writable=t?.writable??!0,Object.defineProperty(e,o,a)),"object"==typeof e[o]&&null!==e[o]&&dphelper.obj.setProps(e[o],t)})}};dphelper?.setDescription({name:"obj",active:!0,subCommand:[{name:"replaceNullObjects",version:"0.0.2",example:"dphelper.obj.replaceNullObjects([obj])",description:"Replace null values in an object with empty objects.",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:!0,env:"both",subCommand:[]},{name:"serialize",version:"0.0.2",example:"dphelper.obj.serialize([obj])",description:"Serialize an object to a JSON string.",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:!0,env:"both",subCommand:[]},{name:"deSerialize",version:"0.0.2",example:"dphelper.obj.deSerialize([obj])",description:"Deserialize a JSON string to an object.",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:!0,env:"both",subCommand:[]},{name:"toXML",version:"0.0.2",example:"dphelper.obj.toXML([obj])",description:"Convert an object to an XML string.",author:"Dario Passariello",creationDate:"20240315",lastMod:"20240315",type:"function",active:!0,env:"both",subCommand:[]},{name:"updateByKey",version:"0.0.2",example:"dphelper.obj.updateByKey([obj, key, newValue])",description:"Update an object's property by key.",author:"Dario Passariello",creationDate:"20240929",lastMod:"20240929",type:"function",active:!0,env:"both",subCommand:[]},{name:"parse",version:"0.0.2",example:"dphelper.obj.parse(val)",description:"Check if value is an object or another type. Return object after parse or a different type. Used instead of JSON.parse to avoid crash.",author:"Dario Passariello",creationDate:"20241027",lastMod:"20240927",type:"function",active:!0,env:"both",subCommand:[]},{name:"diff",version:"0.0.2",example:"dphelper.obj.diff([obj1, obj2])",description:"Show the differences between two objects.",author:"Dario Passariello",creationDate:"20250101",lastMod:"20250101",type:"function",active:!0,env:"both",subCommand:[]},{name:"setProps",version:"0.0.2",example:"dphelper.obj.setProps( [object], {options} )",author:"Dario Passariello",creationDate:"20251224",lastMod:"20251224",type:"function",active:!0,description:"Set properties of an object.",env:"both",subCommand:[]}]},te);var oe={rail:()=>(location.href.split("?")[0]||"").replace(location.protocol,"").replace(location.host,"").replace(location.hash,"").split("/").filter(e=>e),hash:()=>{const e=location.hash.replace("#","").split("/");return e.length?e.filter(e=>e):["empty"]},query:()=>{const e=location.search.substring(1);return JSON.parse(`{"${decodeURI(e).replace(/"/g,'\\"').replace(/&/g,'","').replace(/=/g,'":"')}"}`)}};dphelper?.setDescription({name:"path",active:!0,subCommand:[{name:"rail",version:"0.0.2",example:"dphelper.path.rail()",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:!0,description:"Extract the path segments from the current URL.",env:"both",subCommand:[]},{name:"hash",version:"0.0.2",example:"dphelper.path.hash([hashUrl])",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:!0,description:"Extract the hash from a URL.",env:"both",subCommand:[]},{name:"query",version:"0.0.2",example:"dphelper.path.query([queryString])",author:"Dario Passariello",creationDate:"20210101",lastMod:"20250513",type:"function",active:!0,description:"Extract the query parameters from a URL.",env:"both",subCommand:[]}]},oe);var ae={check:e=>null!=e&&(e instanceof Promise||"[object Promise]"===Object.prototype.toString.call(e)||"object"==typeof e&&"function"==typeof e.then)};dphelper?.setDescription({name:"promise",active:!0,subCommand:[{name:"check",version:"0.0.2",example:"dphelper.promise.check(promise)",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:!0,description:"Check if a value is a Promise.",env:"both",subCommand:[]}]},ae);dphelper?.setDescription({name:"sanitize",active:!0,subCommand:[{name:"html",version:"0.0.2",example:"dphelper.sanitize.html([html])",author:"Dario Passariello",creationDate:"20241204",lastMod:"20241204",type:"function",active:!0,description:"Sanitize HTML by escaping special characters.",env:"both",subCommand:[]}]},{html:e=>"string"!=typeof e?"":e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;").replace(/\//g,"&#x2F;")});var ne="dphelper_popup_positions",re=(e,t,o,a)=>`${e}x${t}@${o},${a}`,ie=()=>{const e=[];return e.push({id:"primary",width:screen.width,height:screen.height,left:0,top:0,isPrimary:!0}),void 0!==window.screenLeft&&void 0!==window.screenTop&&(window.screenLeft>0||window.screenTop>0)&&e.push({id:`secondary_${Date.now()}`,width:window.innerWidth,height:window.innerHeight,left:window.screenLeft,top:window.screenTop,isPrimary:!1}),e},se=(e,t)=>{const o=ie();for(const a of o)if(e>=a.left&&e<a.left+a.width&&t>=a.top&&t<a.top+a.height)return a;if(!o.length)return{id:"default",width:screen.width,height:screen.height,left:0,top:0,isPrimary:!0};let a=o[0],n=1/0;for(const r of o){const o=r.left+r.width/2,i=r.top+r.height/2,s=Math.sqrt(Math.pow(o-e,2)+Math.pow(i-t,2));s<n&&(n=s,a=r)}return a},le=()=>{try{const e=localStorage.getItem(ne);if(e)return JSON.parse(e)}catch(e){console.warn("[dphelper] Failed to parse popup storage:",e)}return{monitors:[],popups:{}}},ce=(e,t)=>{if("undefined"==typeof window)return;const o=t||window,a=o.screenX||o.screenLeft||0,n=o.screenY||o.screenTop||0,r=o.outerWidth||800,i=o.outerHeight||600,s=ie(),l=se(a,n),{relX:c,relY:d}=((e,t,o)=>({relX:e-o.left,relY:t-o.top}))(a,n,l),p=re(l.width,l.height,l.left,l.top),u=le();u.monitors=s,u.popups[e]={id:e,monitorId:l.id,left:c,top:d,width:r,height:i,monitorFingerprint:p},localStorage.setItem(ne,JSON.stringify(u))},de=e=>{if("undefined"==typeof window)return null;const t=le().popups[e];if(!t)return null;const o=ie(),a=o.find(e=>re(e.width,e.height,e.left,e.top)===t.monitorFingerprint);let n;a?n=a:(console.warn(`[dphelper] Monitor changed, restoring popup "${e}" on closest available monitor`),n=se(t.left+(o[0]?.left||0),t.top+(o[0]?.top||0)));const{left:r,top:i}=(s=t.left,l=t.top,{left:(c=n).left+s,top:c.top+l});var s,l,c;return{left:r,top:i,width:t.width,height:t.height}},pe=e=>{const t=le();delete t.popups[e],localStorage.setItem(ne,JSON.stringify(t))},ue=()=>le().popups,me=()=>{localStorage.removeItem(ne)},he=()=>se(window.screenX||0,window.screenY||0),ve={fullScreen:e=>{const t=document.querySelector(e);t.requestFullscreen?t.requestFullscreen():t.mozRequestFullScreen?t.mozRequestFullScreen():t.webkitRequestFullscreen?t.webkitRequestFullscreen():t.msRequestFullscreen&&t.msRequestFullscreen()},toggle:e=>{const t=document,o=t.querySelector(e);o?t.fullscreenElement||t.mozFullScreenElement||t.webkitFullscreenElement?t.exitFullscreen?t.exitFullscreen():t.mozCancelFullScreen?t.mozCancelFullScreen():t.webkitExitFullscreen?t.webkitExitFullscreen():t.msExitFullscreen&&t.msExitFullscreen():o.requestFullscreen?o.requestFullscreen():o.mozRequestFullScreen?o.mozRequestFullScreen():o.webkitRequestFullscreen?o.webkitRequestFullscreen():o.msRequestFullscreen&&o.msRequestFullscreen():console.error(`Element not found: ${e}`)},info:()=>({width:screen.width,height:screen.height,availWidth:screen.availWidth,availHeight:screen.availHeight,colorDepth:screen.colorDepth,pixelDepth:screen.pixelDepth}),popup:{save:(e,t)=>{ce(e,t)},restore:e=>de(e),remove:e=>{pe(e)},list:()=>ue(),getCurrentMonitor:()=>he(),clear:()=>{me()}}};dphelper?.setDescription({name:"screen",active:!0,subCommand:[{name:"popup",version:"0.0.1",example:"dphelper.screen.popup.save('myPopup', window)",author:"Dario Passariello & Jo",creationDate:"20260221",lastMod:"20260221",type:"function",active:!0,description:"Manage popup windows positions across monitor changes.",env:"client",subCommand:[{name:"save",version:"0.0.1",example:"dphelper.screen.popup.save('myPopup', window)",author:"Dario Passariello & Jo",creationDate:"20260221",lastMod:"20260221",type:"function",active:!0,description:"Save popup position with monitor fingerprint",env:"client",subCommand:[]},{name:"restore",version:"0.0.1",example:"dphelper.screen.popup.restore('myPopup')",author:"Dario Passariello & Jo",creationDate:"20260221",lastMod:"20260221",type:"function",active:!0,description:"Restore popup position (auto-adjusts if monitor changed)",env:"client",subCommand:[]},{name:"remove",version:"0.0.1",example:"dphelper.screen.popup.remove('myPopup')",author:"Dario Passariello & Jo",creationDate:"20260221",lastMod:"20260221",type:"function",active:!0,description:"Remove saved popup position",env:"client",subCommand:[]},{name:"list",version:"0.0.1",example:"dphelper.screen.popup.list()",author:"Dario Passariello & Jo",creationDate:"20260221",lastMod:"20260221",type:"function",active:!0,description:"List all saved popup positions",env:"client",subCommand:[]},{name:"getCurrentMonitor",version:"0.0.1",example:"dphelper.screen.popup.getCurrentMonitor()",author:"Dario Passariello & Jo",creationDate:"20260221",lastMod:"20260221",type:"function",active:!0,description:"Get current monitor info",env:"client",subCommand:[]},{name:"clear",version:"0.0.1",example:"dphelper.screen.popup.clear()",author:"Dario Passariello & Jo",creationDate:"20260221",lastMod:"20260221",type:"function",active:!0,description:"Clear all saved popup positions",env:"client",subCommand:[]}]},{name:"fullScreen",version:"0.0.2",example:"dphelper.screen.fullScreen([element])",author:"Dario Passariello",creationDate:"20240101",lastMod:"20240101",type:"function",active:!0,description:"Enter full screen mode for a given element.",env:"client",subCommand:[]},{name:"toggle",version:"0.0.2",example:"dphelper.screen.toggle([element])",author:"Dario Passariello",creationDate:"20240101",lastMod:"20240101",type:"function",active:!0,description:"Toggle full screen mode for a given element.",env:"client",subCommand:[]}]},ve);var fe={custom:(e,t)=>{t.color_1=t?.color_1||"black",t.color_1_hover=t?.color_1_hover||"black",t.color_2=t?.color_2||"transparent",t.color_3=t?.color_3||"rgba(30,150,255,.5)",t.type=t?.type||"thin",t.behavior=t?.behavior||"smooth",t.width=t?.width||"16px",t.height=t?.height||"16px",t.rounded=t?.rounded||"10px",t.margin=t?.margin||0,t.border=t?.border||"5px",t.opacity=t?.opacity||1;const o=` ${e}::-webkit-scrollbar {\n scroll-behavior: ${t.behavior};\n width: ${t.width};\n height: ${t.height};\n }\n ${e}::-webkit-scrollbar-thumb {\n opacity: ${t.opacity} !important;\n -webkit-border-radius: ${t.rounded} !important;\n -webkit-box-shadow: none !important;\n box-shadow: none !important;\n border-radius: ${t.rounded} !important;\n background: ${t.color_1} !important;\n background-clip: content-box !important;\n border: ${t.border} solid transparent !important;\n min-height: 2px !important;\n min-width: 2px !important;\n }\n ${e}::-webkit-scrollbar-thumb:hover{\n background: ${t.color_1_hover} !important;\n }\n ${e}::-webkit-scrollbar-thumb:active{\n background: ${t.color_1} !important;\n background-clip: content-box !important;\n border: calc( ${t.border} - 1.5px ) solid transparent !important;\n }\n ${e}::-webkit-scrollbar-track {\n background: ${t.color_2};\n border-radius: ${t.rounded};\n }\n ${e}::-webkit-scrollbar-track:hover {\n /*background: rgba(128,128,128,.15) !important;*/\n }\n ${e}::-webkit-scrollbar-track:vertical:hover {\n /* border-left: 1px solid rgba(0,0,0,.1) !important; */\n }\n ${e}::-webkit-scrollbar-track:horizontal:hover {\n /* border-top: 1px solid rgba(0,0,0,.1) !important; */\n }\n ${e}::-webkit-scrollbar-corner {\n background:rgba(0,0,0,0)\n }\n /*\n ${e}::-webkit-scrollbar-thumb:window-inactive {\n background: ${t.color_3}\n }\n */\n select::-webkit-scrollbar-thumb {\n border: 4px solid hsl(0 0% 92% / 1) !important;\n }\n select::-webkit-scrollbar-track {\n background: hsl(0 0% 92% / 1) !important;\n }\n select::-webkit-scrollbar-track:vertical,\n select::-webkit-scrollbar-track:horizontal {\n border-top: none !important;\n border-left: none !important;\n }\n `,a=document.createElement("style");document.head.appendChild(a),a.innerHTML=o},indicator:e=>{const t=document.querySelector(e.el),o=document.querySelector(".scrollindicator");if(!o){const e=document.createElement("div");e.classList.add("scrollindicator"),document.querySelector("header")?.appendChild(e),e.style.cssText="\n height:5px;\n background:#65c45c;\n position:absolute;\n bottom:0;\n left:0;\n z-index:2\n "}if(e.el||!o)try{const e=document.querySelector(".scrollindicator");t.addEventListener("scroll",function(t){e.style.width="0%";const o=Number(this.scrollTop),a=Number(this.scrollHeight-this.clientHeight),n=Math.min(Math.max(o/a*100),100);e.style.width=`${n}%`,e.click()}),t.addEventListener("popstate",t=>{e.style.width=0})}catch(e){return void console.error(e)}else o.style.width="0%"},position:{set:e=>{const t="string"==typeof e?document.querySelector(e):e;if(!t)return;const o=[t.scrollTop,t.scrollLeft];null!=o[0]&&null!=o[1]&&localStorage.setItem(e,JSON.stringify(o))},get:e=>{if(localStorage.getItem(e))try{const t=localStorage.getItem(e),o="string"==typeof e?document.querySelector(e):e;o&&t&&(o.scrollTop=t[0],o.scrollLeft=t[1])}catch(e){console.error("Error getting scroll position:",e)}}},smooth:(e,t,o)=>{e===document&&(e=document.scrollingElement||document.documentElement||document.body.parentNode||document.body);let a=!1,n=e.scrollTop;const r=e===document.body&&document.documentElement?document.documentElement:e,i=o=>{o.preventDefault();const i=s(o);n+=-i*t,n=Math.max(0,Math.min(n,e.scrollHeight-r.clientHeight)),a||l()};e.addEventListener("mousewheel",i,{passive:!1}),e.addEventListener("DOMMouseScroll",i,{passive:!1});const s=e=>e.detail?e.wheelDelta?e.wheelDelta/e.detail/40*(e.detail>0?1:-1):-e.detail/3:e.wheelDelta/120,l=()=>{a=!0;const t=(n-e.scrollTop)/o;e.scrollTop+=t,Math.abs(t)>.5?c(l):a=!1},c=dphelper.window.animationframe()},scrollTo:(e,t,o=0)=>{const a=document.querySelector(e),n=document.querySelector(t);a&&n&&a.scrollTo({top:n.offsetTop-o,behavior:"smooth"})}};dphelper?.setDescription({name:"scrollbar",active:!0,subCommand:[{name:"custom",version:"0.0.2",example:"dphelper.scrollbar.custom(selector)",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:!0,description:"Apply custom styles to the scrollbar for the selected elements.",env:"client",subCommand:[]},{name:"indicator",version:"0.0.2",example:"dphelper.scrollbar.indicator(selector)",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:!0,description:"Add a scroll indicator to the selected elements.",env:"client",subCommand:[]},{name:"position.get",version:"0.0.2",example:"dphelper.scrollbar.position.get(selector)",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:!0,description:"Get the current scroll position of the selected elements.",env:"client",subCommand:[]},{name:"position.set",version:"0.0.2",example:"dphelper.scrollbar.position.set(selector, position)",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:!0,description:"Set the scroll position of the selected elements.",env:"client",subCommand:[]},{name:"smooth",version:"0.0.2",example:"dphelper.scrollbar.smooth(container, element, gap)",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:!0,description:"Smoothly scroll to a specific element within a container with an optional gap.",env:"client",subCommand:[]},{name:"scrollTo",version:"0.0.2",example:"dphelper.scrollbar.scrollTo(container, element, gap)",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:!0,description:"Scroll to a specific element within a container with an optional gap.",env:"client",subCommand:[]}]},fe);var be=new TextEncoder,ge=new TextDecoder,ye=async(e,t)=>{const o=be.encode(t),a=await crypto.subtle.importKey("raw",o,{name:"HMAC",hash:"SHA-256"},!1,["sign"]),n=await crypto.subtle.sign("HMAC",a,be.encode(e));return Array.from(new Uint8Array(n)).map(e=>e.toString(16).padStart(2,"0")).join("")},De=async(e,t,o)=>{const a=await crypto.subtle.importKey("raw",be.encode(e),"PBKDF2",!1,["deriveBits","deriveKey"]);return crypto.subtle.deriveKey({name:"PBKDF2",salt:t.buffer,iterations:o,hash:"SHA-256"},a,{name:"AES-GCM",length:256},!1,["encrypt","decrypt"])},we=async(e,t)=>{const o=crypto.getRandomValues(new Uint8Array(16)),a=crypto.getRandomValues(new Uint8Array(12)),n=await De(t,new Uint8Array(o.buffer),1e5),r=await crypto.subtle.encrypt({name:"AES-GCM",iv:new Uint8Array(a.buffer)},n,be.encode(e)),i=new Uint8Array(o.length+a.length+r.byteLength);return i.set(o,0),i.set(a,o.length),i.set(new Uint8Array(r),o.length+a.length),(e=>{const t=new Uint8Array(e);let o="";for(let e=0;e<t.byteLength;e++)o+=String.fromCharCode(t[e]);return btoa(o)})(i.buffer)},xe=async(e,t)=>{try{const o=new Uint8Array((e=>{const t=atob(e),o=new Uint8Array(t.length);for(let e=0;e<t.length;e++)o[e]=t.charCodeAt(e);return o.buffer})(e)),a=o.slice(0,16),n=o.slice(16,28),r=o.slice(28),i=await De(t,new Uint8Array(a.buffer),1e5),s=await crypto.subtle.decrypt({name:"AES-GCM",iv:new Uint8Array(n.buffer)},i,r);return ge.decode(s)}catch{return""}},Ce=-1,Me=["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","J","K","M","N","P","Q","R","S","T","V","W","X","Y","Z"],Se={uuid:{byVal:e=>{if(!e)return console.warn("You need to pass a value to obtain a fixed uuid"),"";const t=dphelper.security.SHA256_Hex(e);return[t.slice(0,8),t.slice(8,4),`4${t.slice(12,3)}`,`8${t.slice(15,3)}`,t.slice(18,12)].join("-")},v4:"10000000-1000-4000-8000-100000000000".replace(/[018]/g,e=>(+e^crypto.getRandomValues(new Uint8Array(1))[0]&15>>+e/4).toString(16)),v5:"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{const t=crypto.getRandomValues(new Uint8Array(1))[0];return("x"===e?t:3&t|8).toString(16)})},hashPass:async(e,t,o="SHA-256")=>{const a=crypto.getRandomValues(new Uint8Array(16)),n=Array.from(a).map(e=>e.toString(16).padStart(2,"0")).join(""),r=(new TextEncoder).encode(t.toLowerCase()+e.toLowerCase()+n),i=await crypto.subtle.digest(o,r.buffer);return n+Array.from(new Uint8Array(i)).map(e=>e.toString(16).padStart(2,"0")).join("")},crypt:async(e,t,o="AES")=>"AES"!==o?(console.warn("Only AES mode is supported in Web Crypto API"),""):we(e,t),deCrypt:async(e,t,o="AES")=>"AES"!==o?(console.warn("Only AES mode is supported in Web Crypto API"),""):xe(e,t),AES_KeyGen:async e=>{const t=e||crypto.randomUUID(),o=crypto.getRandomValues(new Uint8Array(16)),a=Array.from(o).map(e=>e.toString(16).padStart(2,"0")).join(""),n=await crypto.subtle.deriveBits({name:"PBKDF2",salt:o.buffer,iterations:6e5,hash:"SHA-256"},await crypto.subtle.importKey("raw",be.encode(t),"PBKDF2",!1,["deriveBits"]),512);return a+Array.from(new Uint8Array(n)).map(e=>e.toString(16).padStart(2,"0")).join("")},SHA256_Hex:async e=>(async e=>{const t=be.encode(e),o=await crypto.subtle.digest("SHA-256",t);return Array.from(new Uint8Array(o)).map(e=>e.toString(16).padStart(2,"0")).join("")})(e),ulid:()=>{const e=new Uint8Array(16),t=new DataView(e.buffer,0,6),o=new Uint8Array(e.buffer,6,10),a=new Array(26),n=Date.now();if(n===Ce)for(let e=9;e>=0;e--){if(void 0!==o[e]&&o[e]++<255)break}else Ce=n,t.setUint16(0,n/4294967296|0),t.setUint32(2,0|n),window.crypto.getRandomValues(o);return(e=>{a[0]=Me[e[0]>>5],a[1]=Me[31&e[0]];for(let t=0;t<3;t++)a[8*t+2]=Me[e[5*t+1]>>3],a[8*t+3]=Me[31&(e[5*t+1]<<2|e[5*t+2]>>6)],a[8*t+4]=Me[e[5*t+2]>>1&31],a[8*t+5]=Me[31&(e[5*t+2]<<4|e[5*t+3]>>4)],a[8*t+6]=Me[31&(e[5*t+3]<<1|e[5*t+4]>>7)],a[8*t+7]=Me[e[5*t+4]>>2&31],a[8*t+8]=Me[31&(e[5*t+4]<<3|e[5*t+5]>>5)],a[8*t+9]=Me[31&e[5*t+5]];return a.join("")})(e)},fingerprint:async()=>{const e=navigator,t=window.screen,o=document.createElement("canvas"),a=o.getContext("2d"),n="dphelper_fingerprint_v1";let r="";a&&(o.width=200,o.height=30,a.textBaseline="top",a.font="14px 'Arial'",a.textBaseline="alphabetic",a.fillStyle="#f60",a.fillRect(125,1,62,20),a.fillStyle="#069",a.fillText(n,2,15),a.fillStyle="rgba(102, 204, 0, 0.7)",a.fillText(n,4,17),r=o.toDataURL());const i=[e.userAgent,e.language,t.colorDepth,t.width+"x"+t.height,(new Date).getTimezoneOffset(),e.deviceMemory||"unknown",e.hardwareConcurrency||"unknown",r].join("|");return dphelper.security.SHA256_Hex(i)},saveEncrypted:async(e,t,o)=>{const a=await dphelper.security.crypt(t,o),n=await ye(a,o);localStorage.setItem(e,JSON.stringify({d:a,h:n,v:"2.0"}))},getEncrypted:async(e,t)=>{const o=localStorage.getItem(e);if(!o)return null;try{const a=JSON.parse(o);if(a&&a.h&&a.d){const o=await ye(a.d,t);return a.h!==o?(console.error(`[dphelper] Security Alert: Data tampering detected for key "${e}"`),null):dphelper.security.deCrypt(a.d,t)}return dphelper.security.deCrypt(o,t)}catch(a){try{return dphelper.security.deCrypt(o,t)}catch(t){return console.warn(`[dphelper] Persistence Error for key "${e}":`,t),null}}}};dphelper?.setDescription({name:"security",active:!0,subCommand:[{name:"uuid",version:"0.0.2",example:"dphelper.security.uuid",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:!0,description:"UUID related commands",subCommand:[{name:"byVal",version:"0.0.2",example:"dphelper.security.uuid.byVal('string')",author:"Dario Passariello",creationDate:"20250101",lastMod:"20250101",type:"function",active:!0,description:"Generate a UUID based on a given string",env:"both",subCommand:[]},{name:"v4",version:"0.0.2",example:"dphelper.security.uuid.v4",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"return",active:!0,description:"Generate a random UUID v4",env:"both",subCommand:[]},{name:"v5",version:"0.0.2",example:"dphelper.security.uuid.v5",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"return",active:!0,description:"Generate a random UUID v5",env:"both",subCommand:[]}]},{name:"hashPass",description:"Generate a crypto digest SHA-1 starting from user and password values (Please, think about security before using SHA-1)",example:"dphelper.security.hashPass(user, password)",version:"0.0.2",type:"function",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",active:!0,env:"both",subCommand:[]},{name:"crypt",description:"Encrypt your message using a secret_key in a default format AES",example:"dphelper.security.crypt(data, secret_key, [optional mode])",version:"0.0.2",type:"function",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",active:!0,env:"both",subCommand:[]},{name:"deCrypt",description:"Decrypt your message using a secret_key in a default format AES",example:"dphelper.security.deCrypt(data, secret_key, [optional mode])",version:"0.0.2",type:"function",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",active:!0,env:"both",subCommand:[]},{name:"AES_KeyGen",description:"Generate a key based on the AES algorithm",example:"dphelper.security.AES_KeyGen(secret_key)",version:"0.0.2",type:"function",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",active:!0,env:"both",subCommand:[]},{name:"SHA256_Hex",description:"Generate a SHA256 hash in hexadecimal format",example:"dphelper.security.SHA256_Hex(secret_key)",version:"0.0.2",type:"function",author:"Dario Passariello",creationDate:"20250101",lastMod:"20250101",active:!0,env:"both",subCommand:[]},{name:"ulid",description:"Generate ULID code",example:"dphelper.security.ulid()",version:"0.0.2",type:"function",author:"mix",creationDate:"20250212",lastMod:"20250212",active:!0,env:"both",subCommand:[]},{name:"fingerprint",description:"Generate a unique browser fingerprint",example:"dphelper.security.fingerprint()",version:"0.0.2",type:"function",author:"Dario Passariello",creationDate:"20260220",lastMod:"20260220",active:!0,env:"both",subCommand:[]},{name:"saveEncrypted",description:"Save encrypted data to localStorage",example:"dphelper.security.saveEncrypted('key', 'value', 'secret')",version:"0.0.2",type:"function",author:"Dario Passariello",creationDate:"20260220",lastMod:"20260220",active:!0,env:"both",subCommand:[]},{name:"getEncrypted",description:"Retrieve and decrypt data from localStorage",example:"dphelper.security.getEncrypted('key', 'secret')",version:"0.0.2",type:"function",author:"Dario Passariello",creationDate:"20260220",lastMod:"20260220",active:!0,env:"both",subCommand:[]}]},Se);var Pe={keys:(e,t)=>{const o=e.which?e.which:e.keyCode;t||(t={data:[{key:"83",ctrl:!0,active:!0,description:"CTRL+S",function:""},{key:"27",ctrl:!1,active:!0,description:"ESC",element:"",function:""},{key:"80",ctrl:!0,active:!0,description:"CTRL+P",element:"",function:"function(){ Print }"}]}),t.data&&t.data.map(t=>(e.ctrlKey||e.metaKey&&!0===t.ctrl)&&o===Number.parseInt(t.key)&&!0===t.active?(t.element&&t.element.click(),t.function?JSON.stringify(t.function):(e.preventDefault(),null)):null)}};dphelper?.setDescription({name:"shortcut",active:!0,subCommand:[{name:"keys",version:"0.0.2",example:"dphelper.shortcut.keys([e, trigger])",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:!0,description:"Handle keyboard shortcuts.",env:"client",subCommand:[]}]},Pe);var ke={ws:{}},Ae={info:()=>"Created by Dario Passariello",start:(e,t,o="general")=>{ke.ws={},dphelper.socket.connect(t,o),dphelper.socket.receive(e,o)},conn:(e,t,o)=>{if(e&&t)try{let a;try{a=new URL(t)}catch{if(t.startsWith("/")||t.startsWith("ws")||t.startsWith("wss"))return void console.error("Invalid WebSocket URL");a=new URL(t,window.location.origin)}if("ws:"===a.protocol)return void console.error("Insecure WebSocket protocol 'ws://' - must use 'wss://'");const n=new WebSocket(t);return n.binaryType="blob",n.onmessage=e=>{},[n,e,o]}catch(e){return void console.error(e)}else console.debug("please use connect!")},connect:(e,t)=>{e&&dphelper.socket.open(dphelper.security.uuid.v5,e,t)},open:(e,t,o)=>{if(e)try{const a=dphelper.socket.conn(e,t,o);if(!a)return;ke.ws[o]=a,-1===dphelper._list.sockets.indexOf(a[0])&&dphelper._list.sockets.push(a[0]),a[0].onopen=()=>dphelper.log.reg(`${e} connected`),a[0].onclose=e=>dphelper.log.debug(e.wasClean?"Disconnected":`Connection break: ${e.reason||e.code}`),a[0].onerror=e=>dphelper.log?.error(e)}catch(e){console.error(e)}},send:(e,t,o)=>{if(ke.ws[o]?.[1]&&e)try{const a=ke.ws[o];if(!a)return;const n=a[0],r=a[1],i=t?JSON.stringify({[t]:`(${r}:${e})`}):e;n.send(i)}catch(e){console.error(e)}},ping:e=>{if(ke.ws[e]?.[1])try{const t=ke.ws[e];t?.[0]?.send('{"debug":"__ping__"}')}catch(e){console.error(e)}},receive:(e,t)=>{if(ke.ws[t]?.[1])try{const o=ke.ws[t];o[0].onmessage=async t=>{try{if(e){const o="string"==typeof e?document.querySelector(e):e;if(o){const e="string"==typeof t.data?t.data:await t.data.text(),a=JSON.parse(e),n=String(Object.values(a)[0]);o.textContent=n}}}catch(e){}dphelper.log.reg(t.data)}}catch(e){console.error(e)}},keepAlive:e=>{try{const t=ke.ws[e];if(!t)return;let o;const a=t[0],n=(t=5e3)=>{o=setTimeout(()=>{dphelper.socket.ping(e)},t)},r=()=>clearTimeout(o);a.onopen=()=>setInterval(n,3e4),a.onmessage=e=>{try{return void("__ping__"===Object.values(JSON.parse(e.data))[0]&&r())}catch(e){console.error(e)}}}catch(e){console.error(e)}},check:()=>{dphelper._list.sockets=dphelper._list.sockets.filter(e=>e.readyState!==WebSocket.CLOSED)},list:()=>dphelper._list.sockets};dphelper?.setDescription({name:"socket",active:!0,subCommand:[{name:"info",version:"0.0.2",example:"dphelper.socket.info(...)",author:"Dario Passariello",creationDate:"2021-01-01",lastMod:"2021-01-01",type:"function",active:!0,description:"Retrieve socket information",env:"client",subCommand:[]},{name:"start",version:"0.0.2",example:"dphelper.socket.start(...)",author:"Dario Passariello",creationDate:"2021-01-01",lastMod:"2021-01-01",type:"function",active:!0,description:"Start a socket connection",env:"client",subCommand:[]},{name:"conn",version:"0.0.2",example:"dphelper.socket.conn(...)",author:"Dario Passariello",creationDate:"2021-01-01",lastMod:"2021-01-01",type:"function",active:!0,description:"Manage socket connections",env:"client",subCommand:[]},{name:"connect",version:"0.0.2",example:"dphelper.socket.connect(...)",author:"Dario Passariello",creationDate:"2021-01-01",lastMod:"2021-01-01",type:"function",active:!0,description:"Connect to a socket",env:"client",subCommand:[]},{name:"open",version:"0.0.2",example:"dphelper.socket.open(...)",author:"Dario Passariello",creationDate:"2021-01-01",lastMod:"2021-01-01",type:"function",active:!0,description:"Open a socket connection",env:"client",subCommand:[]},{name:"send",version:"0.0.2",example:"dphelper.socket.send(...)",author:"Dario Passariello",creationDate:"2021-01-01",lastMod:"2021-01-01",type:"function",active:!0,description:"Send data through a socket",env:"client",subCommand:[]},{name:"receive",version:"0.0.2",example:"dphelper.socket.receive(...)",author:"Dario Passariello",creationDate:"2021-01-01",lastMod:"2021-01-01",type:"function",active:!0,description:"Receive data from a socket",env:"client",subCommand:[]},{name:"keepAlive",version:"0.0.2",example:"dphelper.socket.keepAlive(...)",author:"Dario Passariello",creationDate:"2021-01-01",lastMod:"2021-01-01",type:"function",active:!0,description:"Keep the socket connection alive",env:"client",subCommand:[]},{name:"check",version:"0.0.2",example:"dphelper.socket.check()",author:"Dario Passariello",creationDate:"2023-05-27",lastMod:"2023-05-27",type:"function",active:!0,description:"Check how many websocket connections are open",env:"client",subCommand:[]},{name:"list",version:"0.0.2",example:"dphelper.socket.list()",author:"Dario Passariello",creationDate:"2023-05-27",lastMod:"2023-05-27",type:"function",active:!0,description:"List all websocket connections in real-time",env:"client",subCommand:[]}]},Ae),dphelper?.socket?.check();var Te={open:(e,t={})=>{const o={message:[],error:[],open:[]},a=new AbortController,n=(e,t)=>{o[e]?.forEach(e=>e(t))};return(async()=>{try{const o=await fetch(e,{...t,signal:a.signal,headers:{Accept:"text/event-stream",...t.headers||{}}});if(!o.ok)throw new Error(`SSE failed: ${o.statusText}`);n("open",{status:o.status});const r=o.body?.getReader(),i=new TextDecoder;if(!r)return;let s="";for(;;){const{done:e,value:t}=await r.read();if(e)break;s+=i.decode(t,{stream:!0});const o=s.split("\n");s=o.pop()||"";for(const e of o)if(e.startsWith("data:")){let t=e.replace("data:","").trim();try{(t.includes("[")||t.includes("{"))&&(t=JSON.parse(t))}catch(e){}n("message",t)}}}catch(e){"AbortError"!==e.name&&n("error",e)}})(),{on:(e,t)=>{o[e]&&o[e].push(t)},close:()=>a.abort()}}};dphelper?.setDescription({name:"sse",active:!0,subCommand:[{name:"open",version:"0.0.1",example:"dphelper.sse.open('/api/stream', { method: 'POST', body: ... })",author:"Dario Passariello",creationDate:"20260221",lastMod:"20260221",type:"function",active:!0,description:"Advanced Server-Sent Events client with POST and Custom Headers support.",env:"client",subCommand:[]}]},Te);var Ee={init:(e,t,o,a)=>{e.querySelector("svg")&&dphelper.svg.removeConnection(e),t=[dphelper.svg.setConnector(t[0],t[1]),t[1]],o=[dphelper.svg.setConnector(o[0],o[1]),o[1]];const n=e.getBoundingClientRect(),r="http://www.w3.org/2000/svg",i=10*e.offsetWidth,s=10*e.offsetHeight,l=document.createElementNS(r,"svg"),c=`conn_${Math.random().toString(36).substring(2,9)}`;l.setAttribute("xmlns",r),l.dataset.dphelper="svg-connection",l.setAttributeNS(null,"viewBox","0 0 "+i+" "+s),l.setAttributeNS(null,"width",String(i)),l.setAttributeNS(null,"height",String(s)),l.style.display="block";const d=document.createElementNS(r,"rect");let p=t[0].getBoundingClientRect();d.setAttributeNS(null,"x",String(p.left-n.left)),d.setAttributeNS(null,"y",String(p.top-n.top)),d.setAttributeNS(null,"width",String(p.width)),d.setAttributeNS(null,"height",String(p.height)),l.appendChild(d);const u=document.createElementNS(r,"rect");p=o[0].getBoundingClientRect(),u.setAttributeNS(null,"x",String(p.left-n.left)),u.setAttributeNS(null,"y",String(p.top-n.top)),u.setAttributeNS(null,"width",String(p.width)),u.setAttributeNS(null,"height",String(p.height)),l.appendChild(u);const m=document.createElementNS(r,"path");m.setAttributeNS(null,"id",c),m.setAttributeNS(null,"marker-end","url(#head)"),l.appendChild(m),e.appendChild(l),dphelper.svg.update(d,u,m),"function"==typeof a&&a(t,o)},check:()=>!(!document.createElementNS||!document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGRect),update:(e,t,o)=>{const a=Number.parseFloat(e.getAttribute("x")||"0"),n=Number.parseFloat(e.getAttribute("y")||"0"),r=Number.parseFloat(t.getAttribute("x")||"0"),i=Number.parseFloat(t.getAttribute("y")||"0"),s=Number.parseFloat(e.getAttribute("width")||"0")/2,l=Number.parseFloat(e.getAttribute("height")||"0")/2,c=Number.parseFloat(t.getAttribute("width")||"0")/2,d=Number.parseFloat(t.getAttribute("height")||"0")/2,p=a+s,u=n+l,m=r+c,h=i+d,v=m-p,f=h-u,b=dphelper.svg.getIntersection(v,f,p,u,s,l),g=dphelper.svg.getIntersection(-v,-f,m,h,c,d),y=g[0]-b[0],D=dphelper.svg.getCurve(b,g,y);o.setAttributeNS(null,"d","M"+p+","+u+D+m+","+h)},getCurve:(e,t,o)=>{const a=o/2;return" C"+(a+e[0])+","+e[1]+" "+(t[0]-a)+","+t[1]+" "},getIntersection:(e,t,o,a,n,r)=>Math.abs(t/e)<r/n?[o+(e>0?n:-n),a+t*n/Math.abs(e)]:[o+e*r/Math.abs(t),a+(t>0?r:-r)],setConnector:(e,t)=>{let o;const a=document.createElement("span");switch(e.style.position="relative",a.style.position="absolute",a.style.width="5px",a.style.height="5px",t){case"top":o={left:"50%",top:"2.5px",marginLeft:"2.5px"};break;case"right":o={top:"50%",right:"2.5px",marginTop:"-2.5px"};break;case"bottom":o={left:"50%",bottom:"-2.5px",marginLeft:"2.5px"};break;case"left":o={top:"50%",left:"-2.5px",marginTop:"-2.5px"};break;default:o={}}return Object.assign(a.style,o),e.appendChild(a),a},removeConnection:e=>{e.querySelectorAll("svg[data-dphelper='svg-connection']").forEach(e=>e.remove())},makeScrollable:(e,t,o,a,n,r)=>{const i=e.getBoundingClientRect(),s=[o,a],l=s.length,c=[n,r],d=[];for(let e=0;e<l;e++){const t=s[e],o=c[e];t&&o&&(d[e]=t.getBoundingClientRect(),o.setAttributeNS(null,"x",String(d[e].left-i.left)),o.setAttributeNS(null,"y",String(d[e].top-i.top)),o.setAttributeNS(null,"width",String(d[e].width)),o.setAttributeNS(null,"height",String(d[e].height)))}const p=e.querySelectorAll("rect"),u=p[0],m=p[1],h=document.getElementById("connection");u&&m&&h&&dphelper.svg.update(u,m,h)},makeDraggable:e=>{const t=e.target;function o(e){const o=t.getScreenCTM();return{x:(e.clientX-o.e)/o.a,y:(e.clientY-o.f)/o.d}}t.addEventListener("mousedown",function(e){e.target.classList.contains("draggable")&&(a=e.target,n=o(e),n.x-=Number.parseFloat(a.getAttributeNS(null,"x")||"0"),n.y-=Number.parseFloat(a.getAttributeNS(null,"y")||"0"));return}),t.addEventListener("mousemove",function(e){if(a&&n){const t=o(e);a.setAttributeNS(null,"x",String(t.x-n.x)),a.setAttributeNS(null,"y",String(t.y-n.y)),dphelper.svg.update(a,a,document.getElementById("connection"))}return}),t.addEventListener("mouseup",function(){return a=null,void(n=null)});let a=null,n=null},toggle:(e,t,o,a)=>{const n=e.target;if(n.checked&&o&&a)dphelper.cookie.set({name:`${n.id}`,value:1,time:365}),dphelper.svg.init(t,[o,"right"],[a,"left"],(e,o)=>{const a=document.getElementById("parts-left-body");a&&a.addEventListener("scroll",()=>{dphelper.svg.makeScrollable(t,a,e,o,document.querySelector("#parts svg rect"),document.querySelectorAll("#parts svg rect")[1])})});else{dphelper.svg.removeConnection(t);const e=document.getElementById("parts-left-body");e&&e.replaceWith(e.cloneNode(!0)),dphelper.cookie.set({name:`${n.id}`,value:0,time:365})}},convert:({children:e,active:t=!0,size:o=[1920,1080],fit:a=["100%","100%"],preserveAspectRatio:n="none",style:r=`width:${a[0]}; height:${a[1]}`,zoom:i=1})=>{if(!e)return"Please pass ID of element for SVG conversion";if(t){const t=document.querySelector(e),s=t.cloneNode(!0),l=`\n <svg\n viewBox="0 0 ${o[0]} ${o[1]}"\n preserveAspectRatio="${n}"\n xmlns="http://www.w3.org/2000/svg"\n style="${r}; zoom:${i}"\n >\n <foreignObject\n x="0"\n y="0"\n width="${a[0]}"\n height="${a[1]}"\n style="${r}; zoom:${i}"\n >\n </foreignObject>\n </svg >\n `;t.innerHTML=l;const c=t.querySelector("foreignObject");c&&c.appendChild(s)}}};dphelper?.setDescription({name:"svg",active:!0,subCommand:[{name:"init",version:"0.0.2",example:"dphelper.svg.init(...)",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:!0,description:"Initializes an SVG connection between two elements.",env:"client",subCommand:[]},{name:"check",version:"0.0.2",example:"dphelper.svg.check(...)",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:!0,description:"Checks if SVG support is available.",env:"client",subCommand:[]},{name:"update",version:"0.0.2",example:"dphelper.svg.update(...)",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:!0,description:"Updates the SVG connection between two elements.",env:"client",subCommand:[]},{name:"getCurve",version:"0.0.2",example:"dphelper.svg.getCurve(...)",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:!0,description:"Calculates the curve of the connection between two points.",env:"client",subCommand:[]},{name:"getIntersection",version:"0.0.2",example:"dphelper.svg.getIntersection(...) ",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:!0,description:"Calculates the intersection point between two elements.",env:"client",subCommand:[]},{name:"setConnector",version:"0.0.2",example:"dphelper.svg.setConnector(...)",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:!0,description:"Sets a connector on an element.",env:"client",subCommand:[]},{name:"removeConnection",version:"0.0.2",example:"dphelper.svg.removeConnection(...)",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:!0,description:"Removes an SVG connection from a container.",env:"client",subCommand:[]},{name:"makeScrollable",version:"0.0.2",example:"dphelper.svg.makeScrollable(...)",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:!0,description:"Makes an SVG container scrollable.",env:"client",subCommand:[]},{name:"makeDraggable",version:"0.0.2",example:"dphelper.svg.makeDraggable(...)",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:!0,description:"Makes an SVG element draggable.",env:"client",subCommand:[]},{name:"toggle",version:"0.0.2",example:"dphelper.svg.toggle(...)",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:!0,description:"Toggles an SVG connection on or off.",env:"client",subCommand:[]},{name:"convert",version:"0.0.2",example:"dphelper.svg.convert([Object])",author:"Dario Passariello",creationDate:"20190101",lastMod:"20240401",type:"function",active:!0,description:"Converts an element to SVG.",env:"client",subCommand:[]}]},Ee),dphelper?.svg?.check();var Ne={pulse:(e,t)=>{if("undefined"==typeof BroadcastChannel)return{emit:()=>{},stop:()=>{}};const o=new BroadcastChannel(`pulse_${e}`);return o.onmessage=e=>{if(e.origin===window.location.origin||!e.origin)try{const o=e.data;!o||"object"!=typeof o||o.__proto__||o.constructor||t(o)}catch(e){console.warn("[dphelper] Invalid message received in pulse:",e)}},{emit:e=>o.postMessage(e),stop:()=>o.close()}},tab:(e,t)=>{if("undefined"==typeof BroadcastChannel)return{post:()=>{},close:()=>{}};const o=new BroadcastChannel(e);return o.onmessage=e=>{if(e.origin===window.location.origin||!e.origin)try{const o=e.data;!o||"object"!=typeof o||o.__proto__||o.constructor||t(o)}catch(e){console.warn("[dphelper] Invalid message received in tab:",e)}},{post:e=>o.postMessage(e),close:()=>o.close()}},storageProxy:(e,t,o)=>{if("undefined"==typeof localStorage)return t;let a;const n=localStorage.getItem(e);if(n)if(o){const n=dphelper.security.getEncrypted(e,o);a=n?JSON.parse(n):t}else try{a=JSON.parse(n)}catch{a=t}else a=t;return new Proxy(a,{set(t,a,n){t[a]=n;const r=JSON.stringify(t);return o?dphelper.security.saveEncrypted(e,r,o):localStorage.setItem(e,r),!0}})}};dphelper?.setDescription({name:"sync",active:!0,subCommand:[{name:"tab",version:"0.0.2",example:"dphelper.sync.tab('my_channel', (data) => console.debug(data))",author:"Dario Passariello & Jo",creationDate:"20260220",lastMod:"20260220",type:"function",active:!0,description:"Synchronize data between tabs using BroadcastChannel",env:"client",subCommand:[]},{name:"storageProxy",version:"0.0.2",example:"const proxy = dphelper.sync.storageProxy('user_pref', {theme: 'dark'})",author:"Dario Passariello & Jo",creationDate:"20260220",lastMod:"20260220",type:"function",active:!0,description:"Create a Proxy object linked to localStorage for auto-sync",env:"client",subCommand:[]},{name:"pulse",version:"0.0.1",example:"dphelper.sync.pulse('chat', (msg) => ...)",author:"Dario Passariello",creationDate:"20260221",lastMod:"20260221",type:"function",active:!0,description:"Low-latency cross-tab event bus with automatic registration.",env:"client",subCommand:[]}]},Ne);dphelper?.setDescription({name:"system",active:!0,subCommand:[{name:"multiSplit",version:"0.0.2",example:"dphelper.system.multiSplit()",author:"Dario Passariello",creationDate:"20231121",lastMod:"20231121",type:"system",active:!0,description:"Run only one time when you load your App ... extend the .split with array as argument (example.split([',', ':', ';', '?', '/'])[0])",env:"both",subCommand:[]}]},{multiSplit:(e,t)=>{if(!e)return[];const o=t[0];if(!o)return[e];let a=e;for(let e=1;e<t.length;++e)a=a.split(t[e]).join(o);return a.split(o)}});var Le={name:"text",active:!0,subCommand:[{name:"trim",version:"0.0.2",example:"dphelper.text.trim(...)",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:!0,description:"Trims the specified characters from the start and end of a string.",env:"both",subCommand:[]},{name:"capitalize",version:"0.0.2",example:"dphelper.text.capitalize(...)",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:!0,description:"Capitalizes the first letter of each word in a string.",env:"both",subCommand:[]},{name:"lower",version:"0.0.2",example:"dphelper.text.lower(...)",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:!0,description:"Converts a string to lowercase.",env:"both",subCommand:[]},{name:"upper",version:"0.0.2",example:"dphelper.text.upper(...)",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:!0,description:"Converts a string to uppercase.",env:"both",subCommand:[]},{name:"nl2br",version:"0.0.2",example:"dphelper.text.nl2br(...)",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:!0,description:"Converts newlines in a string to HTML <br> tags.",env:"both",subCommand:[]},{name:"sanitize",version:"0.0.2",example:"dphelper.text.sanitize(...)",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:!0,description:"Sanitizes a string by removing HTML tags.",env:"both",subCommand:[]},{name:"camelCase",version:"0.0.2",example:"dphelper.text.camelCase(...)",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:!0,description:"Converts a string to camelCase.",subCommand:[{name:"toSpace",version:"0.0.2",example:"dphelper.text.camelCase.toSpace(...)",type:"function",active:!0,description:"Converts camelCase to space-separated words.",env:"both",subCommand:[],author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220"},{name:"toUnderscore",version:"0.0.2",example:"dphelper.text.camelCase.toUnderscore(...)",type:"function",active:!0,description:"Converts camelCase to underscore-separated words.",env:"both",subCommand:[],author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220"}]},{name:"fitContainer",version:"0.0.2",example:"dphelper.text.fitContainer([element])",type:"function",active:!0,description:"Adjusts the font size of an element to fit its container.",env:"both",subCommand:[],author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220"},{name:"keywords",version:"0.0.2",example:"dphelper.text.keywords([sentence])",type:"function",active:!0,description:"Extrapolate keywords from a sentence",env:"both",subCommand:[],author:"Dario Passariello",creationDate:"20250601",lastMod:"20250601"},{name:"replaceText",version:"0.0.2",example:"dphelper.text.replaceText([sentence, object])",type:"function",active:!0,description:'\n replace all occurrence from sentence using an object as list\n\n example:\n\n let text = replaceText(\n "Copyright 2022 (c) by dpHelper",\n {\n "(c)": \'&copy;\',\n "(r)": \'&reg;\'\n }\n )\n\n Copyright text (c) became an html symbol\n ',env:"both",subCommand:[],author:"Dario Passariello",creationDate:"20250612",lastMod:"20250612"}]},je={trim:(e,t,o,a)=>e.charAt(0)===t?e.substring(o,a):e,capitalize:e=>e.toLowerCase().replace(/\b\w/g,e=>e.toUpperCase()),lower:e=>e.toLowerCase(),upper:e=>e.toUpperCase(),nl2br:e=>e.replace(/(?:\r\n|\r|\n)/g,"<br>"),sanitize:e=>e.replace(/<(|\/|[^>\bi]|\/[^>bi]|[^/>][^>]+|\/[^>][^>]+)>/g,""),camelCase:{toSpace:e=>e.replace(/([A-Z])/g," $1").replace(/^./,e=>e.toUpperCase()),toUnderscore:e=>e.replace(/\.?([A-Z])/g,(e,t)=>`_${t.toLowerCase()}`).replace(/^_/,"")},fitContainer:e=>{e&&dphelper.addListenerMulti(window,"load resize",()=>function(e){const t=document.querySelectorAll(e),o=t.length;if(!(o<=0))for(let e=0;e<o;e++){const o=.05*t[e].offsetWidth;t[e].style.fontSize=`${o}px`}}(e))},keywords:e=>{const t=e.match(/\b[A-Z][a-z]+\b/g)?.filter(e=>e.length>3)||[];return[...new Set(t.map(e=>e.toLowerCase()))]},replaceText:(e,t)=>{let o=e;for(const e in t)Object.hasOwn(t,e)&&(o=o.replaceAll(e,t[e]||""));return o}};dphelper?.setDescription(Le,je);var qe={sleep:e=>new Promise(t=>setTimeout(t,e)),percentage:(e,t)=>{function o(e){const t=e.split(":");return 3600*Number.parseInt(t[0]||"",10)+60*Number.parseInt(t[1]||"",10)+Number.parseInt(t[2]||"",10)}return(100*o(e)/o(t)).toFixed(2)}};dphelper?.setDescription({name:"timer",active:!0,subCommand:[{name:"sleep",version:"0.0.2",example:"dphelper.timer.sleep([ms]) ",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:!0,description:"Pauses execution for a specified number of milliseconds.",env:"both",subCommand:[]},{name:"percentage",version:"0.0.2",example:"dphelper.timer.percentage([start], [end])",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:!0,description:"Calculates the percentage of time elapsed between two time strings.",env:"both",subCommand:[]}]},qe);var $e={byteSize:e=>{const t=1024;if(Math.abs(e)<t)return`${e}b`;const o=["Kb","Mb","Gb","Tb","Pb","Eb","Zb","Yb"];let a=-1,n=e;do{n/=t,++a}while(Math.abs(n)>=t&&a<o.length-1);return n.toFixed(1)+o[a]},zIndex:()=>Array.from(document.querySelectorAll("body *")).map(e=>Number.parseFloat(getComputedStyle(e).zIndex)).reduce((e,t)=>t>e?t:e,1),zeroToFalse:e=>0!==e&&e};dphelper?.setDescription({name:"tools",active:!0,subCommand:[{name:"byteSize",description:"Give you the total in 'Kb', 'Mb', 'Gb', 'Tb', 'Pb', 'Eb', 'Zb', 'Yb' starting from bytes",example:"dphelper.tools.byteSize(bytes)",version:"0.0.2",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:!0,env:"both",subCommand:[]},{name:"hashPass",description:"Hashes a password using a specified number and total.",example:"dphelper.tools.hashPass(number, total)",version:"0.0.2",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:!0,env:"both",subCommand:[]},{name:"zIndex",description:"Finds the highest z-index value in the document.",example:"dphelper.tools.zIndex()",version:"0.0.2",author:"Dario Passariello",creationDate:"20240807",lastMod:"20240807",type:"function",active:!0,env:"both",subCommand:[]},{name:"zeroToFalse",description:"Converts zero to false, otherwise returns the value.",example:"dphelper.tools.zeroToFalse(num)",version:"0.0.2",author:"Dario Passariello",creationDate:"20240924",lastMod:"20240924",type:"function",active:!0,env:"both",subCommand:[]}]},$e);var Ie={convertMatrixToScale:e=>{const t=e.split("(");if(t.length<2)return 0;const o=t[1].split(")")[0];if(!o)return 0;const a=o.split(","),n=Number.parseFloat(a[0]||"0"),r=Number.parseFloat(a[1]||"0");return Math.sqrt(n*n+r*r)}};dphelper?.setDescription({name:"translators",active:!0,subCommand:[{name:"convertMatrixToScale",version:"0.0.2",example:"dphelper.translators.convertMatrixToScale({value})",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:!0,description:"Converts a transformation matrix to a scale value.",env:"both",subCommand:[]}]},Ie);var Oe=new Map,Re={add:(e,t)=>{Oe.has(e)||Oe.set(e,new Set),Oe.get(e).add(t)},on:(e,t)=>{Re.add(e,t)},emit:(e,...t)=>{const o=Oe.get(e);o&&o.forEach(o=>{try{o(...t)}catch(t){console.error(`Error in trigger callback for event '${e}':`,t)}})},remove:e=>{Oe.delete(e)},off:(e,t)=>{const o=Oe.get(e);o&&o.delete(t)},clear:()=>{Oe.clear()},list:()=>Array.from(Oe.keys())};dphelper?.setDescription({name:"triggers",active:!0,subCommand:[{name:"add",version:"0.0.1",example:"dphelper.triggers.add('event', callback)",author:"Dario Passariello",creationDate:"20250220",lastMod:"20250220",type:"function",active:!0,description:"Add a trigger for custom events.",env:"client",subCommand:[]},{name:"on",version:"0.0.1",example:"dphelper.triggers.on('event', callback)",author:"Dario Passariello",creationDate:"20250220",lastMod:"20250220",type:"function",active:!0,description:"Listen for a trigger event.",env:"client",subCommand:[]},{name:"emit",version:"0.0.1",example:"dphelper.triggers.emit('event', data)",author:"Dario Passariello",creationDate:"20250220",lastMod:"20250220",type:"function",active:!0,description:"Emit a trigger event.",env:"client",subCommand:[]},{name:"remove",version:"0.0.1",example:"dphelper.triggers.remove('event')",author:"Dario Passariello",creationDate:"20250220",lastMod:"20250220",type:"function",active:!0,description:"Remove a trigger event.",env:"client",subCommand:[]}]},Re);var ze={of:e=>typeof e,instOfObj:e=>e instanceof Object,isNull:e=>t=>!e(t),isBool:e=>!e||null==e.length||"1"===e};dphelper?.setDescription({name:"type",active:!0,subCommand:[{name:"of",version:"0.0.2",example:"dphelper.type.of(...)",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:!0,description:"Returns the type of the given parameter.",env:"both",subCommand:[]},{name:"instOfObj",version:"0.0.2",example:"dphelper.type.instOfObj(...)",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:!0,description:"Checks if the given parameter is an instance of Object.",env:"both",subCommand:[]},{name:"isNaN",version:"0.0.2",example:"dphelper.type.isNaN(...)",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:!0,description:"Checks if the given parameter is NaN.",env:"both",subCommand:[]},{name:"isBool",version:"0.0.2",example:"dphelper.type.isBool(...)",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:!0,description:"Checks if the given parameter is a boolean.",env:"both",subCommand:[]}]},ze);var Ue={anchorContext:()=>{if("undefined"==typeof window||"undefined"==typeof localStorage)return;const e=`dp_anchor_${btoa(location.pathname).replace(/=/g,"")}`;window.addEventListener("beforeunload",()=>{const t={scroll:{x:window.scrollX,y:window.scrollY},inputs:Array.from(document.querySelectorAll("input, textarea, select")).filter(e=>"password"!==e.type&&!e.hasAttribute("data-private")&&"off"!==e.getAttribute("autocomplete")).map(e=>({id:e.id,name:e.name,value:e.value}))};localStorage.setItem(e,JSON.stringify(t))}),(()=>{const t=localStorage.getItem(e);if(t)try{const e=JSON.parse(t);window.scrollTo(e.scroll.x,e.scroll.y),e.inputs.forEach(e=>{const t=e.id?document.getElementById(e.id):document.querySelector(`[name="${e.name}"]`);t&&(t.value=e.value)})}catch(e){console.warn("dphelper: anchorContext restoration failed.")}})()},fps:(e=!0)=>{if("undefined"==typeof document)return;let t=document.getElementById("dphelper-fps-monitor");if(!e)return void t?.remove();t||(t=document.createElement("div"),t.id="dphelper-fps-monitor",Object.assign(t.style,{position:"fixed",top:"10px",right:"10px",padding:"8px 12px",background:"rgba(0,0,0,0.8)",color:"#0f0",fontFamily:"monospace",fontSize:"12px",zIndex:"99999",borderRadius:"4px",pointerEvents:"none",boxShadow:"0 2px 10px rgba(0,0,0,0.5)",border:"1px solid #333"}),document.body.appendChild(t));let o=0,a=performance.now();const n=()=>{if(!document.getElementById("dphelper-fps-monitor"))return;o++;const e=performance.now();if(e>=a+1e3){const n=Math.round(1e3*o/(e-a)),r=performance.memory?` | Mem: ${Math.round(performance.memory.usedJSHeapSize/1048576)}MB`:"";t.innerText=`FPS: ${n}${r}`,o=0,a=e}requestAnimationFrame(n)};requestAnimationFrame(n)},boxModel:(e=!0)=>{if("undefined"==typeof document)return;let t=document.getElementById("dphelper-boxmodel-style");e?t||(t=document.createElement("style"),t.id="dphelper-boxmodel-style",t.innerHTML="\n * { outline: 1px solid rgba(255, 0, 0, 0.3) !important; }\n * * { outline: 1px solid rgba(0, 255, 0, 0.3) !important; }\n * * * { outline: 1px solid rgba(0, 0, 255, 0.3) !important; }\n * * * * { outline: 1px solid rgba(255, 255, 0, 0.3) !important; }\n ",document.head.appendChild(t)):t?.remove()}};dphelper?.setDescription({name:"UI",active:!0,subCommand:[{name:"input",version:"0.0.2",example:"dphelper.UI.input(...)",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:!0,description:"Creates an input element with specified options.",env:"client",subCommand:[]},{name:"fps",version:"0.0.2",example:"dphelper.UI.fps(true)",author:"Dario Passariello & Jo",creationDate:"20260220",lastMod:"20260220",type:"function",active:!0,description:"Toggle a real-time FPS and Memory monitor overlay",env:"client",subCommand:[]},{name:"boxModel",version:"0.0.2",example:"dphelper.UI.boxModel(true)",author:"Dario Passariello & Jo",creationDate:"20260220",lastMod:"20260220",type:"function",active:!0,description:"Toggle visual box-model highlighter for all elements",env:"client",subCommand:[]},{name:"anchorContext",version:"0.0.1",example:"dphelper.UI.anchorContext()",author:"Dario Passariello",creationDate:"20260221",lastMod:"20260221",type:"function",active:!0,description:"Snapshot and auto-restore UI state (inputs, scroll) across reloads.",env:"client",subCommand:[]}]},Ue);var Fe=!1,He=!1,_e={enhancement:()=>{window.offScreenBuffering="auto",dphelper.window.animationframe()},animationframe:()=>window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||(e=>{window.setTimeout(e,1e3/120)}),center:({url:e,title:t,name:o,w:a,h:n})=>{const r=void 0!==screenLeft?screenLeft:screenX,i=void 0!==screenTop?screenTop:screenY,s=innerWidth||(document.documentElement.clientWidth?document.documentElement.clientWidth:screen.width),l=innerHeight||(document.documentElement.clientHeight?document.documentElement.clientHeight:screen.height),c=s/screen.availWidth,d=open(e,t,`\n scrollbars=yes,\n width=${a/c},\n height=${n/c},\n top=${(l-n)/2/c+i},\n left=${(s-a)/2/c+r}\n `);onfocus=()=>d?.focus()},onBeforeUnLoad:e=>{const t="You have made some changes which you might want to save.",o=e=>(e.preventDefault(),t),a=e?document.querySelector(e):null;a&&a.addEventListener("input",()=>{""!==a.value?(Fe=!0,addEventListener("beforeunload",o,{capture:!0})):(Fe=!1,removeEventListener("beforeunload",o,{capture:!0}))}),!1===He&&(document.body.addEventListener("click",e=>{const o=e.target;if(o&&"img"===o.tagName.toLowerCase()&&!0===Fe){if(!0===confirm(t))return void(Fe=!1);e.preventDefault()}}),He=!0),addEventListener("popstate",e=>{if(!0===Fe){return!0===confirm(t)?void(Fe=!1):(e.stopImmediatePropagation(),void e.preventDefault())}}),onbeforeunload=e=>{if(!0===Fe)return e.preventDefault(),e.returnValue=t}},purge:(e=document,t=1e4)=>{setTimeout(()=>{if(!e)return;let t=e.attributes;if(t){const o=t.length;for(let a=0;a<o;a+=1){const o=t[a].name;"function"==typeof e[o]&&(e[o]=null),void 0===e[o]&&(e[o]=null)}}if(t=e.childNodes,t){const o=t.length;for(let t=0;t<o;t+=1)dphelper.purge(e.childNodes[t])}},t)},stopZoomWheel:()=>{addEventListener("wheel",e=>{e.ctrlKey&&e.preventDefault()},{passive:!1}),addEventListener("keydown",e=>{const t=dphelper.event.keys(e);["+","-","="].includes(t.key)&&t.ctrl&&e.preventDefault()})},setZoom:(e="html",t=1)=>{t<0&&(t=1);const o=document.querySelector(e);return o&&(o.style.zoom=String(t)),`New zoom value: ${100*t}% (css: ${t})`},getZoom:(e="html")=>{const t=document.querySelector(e);return Number(t?.style.zoom||1)}};dphelper?.setDescription({name:"window",active:!0,subCommand:[{name:"enhancement",version:"0.0.2",example:"dphelper.window.enhancement()",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:!0,description:"Use only one time at end of application",env:"client",subCommand:[]},{name:"center",version:"0.0.2",example:"dphelper.window.center({ url, title, name, w, h })",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:!0,description:"Use to center popup to screen",env:"client",subCommand:[]},{name:"onBeforeUnLoad",version:"0.0.2",example:"dphelper.window.onBeforeUnLoad()",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:!0,description:"Message during leave the site",env:"client",subCommand:[]},{name:"purge",version:"0.0.2",example:"dphelper.window.purge()",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:!0,description:"Purge from memory",env:"client",subCommand:[]},{name:"stopZoomWheel",version:"0.0.2",example:"dphelper.window.stopZoomWheel(e)",author:"Dario Passariello",creationDate:"20230527",lastMod:"20230527",type:"function",active:!0,description:"Stop Zoom Generated by Mouse Wheel",env:"client",subCommand:[]},{name:"setZoom",version:"0.0.2",example:"dphelper.window.setZoom([el,1])",author:"Dario Passariello",creationDate:"20240727",lastMod:"20220727",type:"function",active:!0,description:"Set the zoom level of an element",env:"client",subCommand:[]},{name:"getZoom",version:"0.0.2",example:"dphelper.window.getZoom([el])",author:"Dario Passariello",creationDate:"20240727",lastMod:"20220727",type:"function",active:!0,description:"Get the zoom level of an element",env:"client",subCommand:[]}]},_e);var We=(e,t={})=>{const o=new Worker(e);return t.onmessage&&(o.onmessage=t.onmessage),t.onerror&&(o.onerror=t.onerror),o},Be=(e,t,o)=>{o?e.postMessage(t,o):e.postMessage(t)},Je={create:We,createInline:(e,t={})=>{const o=new Blob([e],{type:"application/javascript"}),a=URL.createObjectURL(o),n=We(a,t);return n.onmessage=e=>{t.onmessage?.(e)},n},post:Be,terminate:e=>{e.terminate()},pool:(e,t=4)=>{const o=[],a=new Set;for(let a=0;a<t;a++)o.push(We(e));return{workers:o,busy:a,queue:[],size:t}},poolExec:async(e,t)=>new Promise((o,a)=>{const n=new Array(t.length);let r=0;const i=()=>{for(;e.queue.length>0&&e.busy.size<e.size;){const{task:t,resolve:o,reject:a}=e.queue.shift();s(t.index,t.data,o)}},s=(o,a,s,l)=>{const c=e.workers.find(t=>!e.busy.has(t));if(!c)return;e.busy.add(c);const d=a=>{c.removeEventListener("message",d),e.busy.delete(c),n[o]=a.data,r++,r===t.length?s(n):i()};c.addEventListener("message",d),Be(c,{index:o,data:a})};t.forEach((t,o)=>{e.queue.push({task:{index:o,data:t},resolve:e=>{},reject:e=>{}})}),i()}),importScripts:(e,t)=>{const o=t.map(e=>`importScripts('${e}');`).join("\n"),a=new Blob([o],{type:"application/javascript"}),n=URL.createObjectURL(a);Be(e,{type:"import",url:n})},shared:(e,t={})=>{const o=new SharedWorker(e,t.name?{name:t.name}:void 0);return t.onmessage&&(o.port.onmessage=t.onmessage),o}};dphelper?.setDescription({name:"worker",active:!0,subCommand:[{name:"create",version:"0.0.1",example:"dphelper.worker.create('worker.js', { onmessage: (e) => console.log(e.data) })",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:!0,description:"Create a new Web Worker from a script URL or inline code",env:"client",subCommand:[]},{name:"createInline",version:"0.0.1",example:"dphelper.worker.createInline('self.onmessage = e => postMessage(e.data * 2)')",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:!0,description:"Create a Web Worker from inline JavaScript code",env:"client",subCommand:[]},{name:"post",version:"0.0.1",example:"dphelper.worker.post(worker, { type: 'compute', data: 42 })",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:!0,description:"Send a message to a worker",env:"client",subCommand:[]},{name:"terminate",version:"0.0.1",example:"dphelper.worker.terminate(worker)",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:!0,description:"Terminate a Web Worker",env:"client",subCommand:[]},{name:"pool",version:"0.0.1",example:"dphelper.worker.pool('worker.js', 4)",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:!0,description:"Create a pool of workers for parallel processing",env:"client",subCommand:[]},{name:"poolExec",version:"0.0.1",example:"dphelper.worker.poolExec(pool, tasks)",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:!0,description:"Execute tasks across a worker pool",env:"client",subCommand:[]},{name:"importScripts",version:"0.0.1",example:"dphelper.worker.importScripts(worker, ['lib1.js', 'lib2.js'])",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:!0,description:"Import external scripts into a worker",env:"client",subCommand:[]},{name:"shared",version:"0.0.1",example:"dphelper.worker.shared('my-shared-buffer')",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:!0,description:"Create a SharedWorker for cross-tab communication",env:"client",subCommand:[]}]},Je);var Ge=setInterval(()=>{dphelper._list||(dphelper._list={sockets:[],scripts:[]});const e=dphelper?.socket?.list(),t=[];e&&(e.map(e=>(t.push(e.url),!1)),dphelper._list.sockets=t,t.length>0&&clearInterval(Ge))},1e3);Object.preventExtensions(dphelper),Object.seal(dphelper);
1
+ "use strict";var e=globalThis.dphelper;if(e&&e.version&&function(e,t){const o=String(e??""),a=String(t);if(o===a)return 0;const n=o.split("."),r=a.split("."),i=Math.max(n.length,r.length);for(let e=0;e<i;e++){const t=parseInt(n[e]??"0",10),o=parseInt(r[e]??"0",10);if(Number.isNaN(t)||Number.isNaN(o)){const t=n[e]??"",o=r[e]??"";if(t<o)return-1;if(t>o)return 1}else{if(t<o)return-1;if(t>o)return 1}}return 0}(e.version,"3.3.7")<0)try{delete globalThis.dphelper}catch{console.debug("Could not delete existing dphelper (likely non-configurable)")}var t=Object.getOwnPropertyDescriptor(globalThis,"dphelper");t&&!t.configurable?t.writable?void 0===globalThis.dphelper&&(globalThis.dphelper={}):console.debug("dphelper already defined on globalThis and is not writable/configurable"):Object.defineProperty(globalThis,"dphelper",{value:globalThis.dphelper||{},writable:!0,configurable:!0,enumerable:!1}),globalThis.dphelper&&Object.defineProperties(globalThis.dphelper,{_list:{value:{scripts:[],sockets:[],info:{title:"List",description:"Complete list of tools"},categories:["3party","system","financial","memory","numbers","time","path","file","forms","ui","other","development"]},configurable:!0,writable:!0},version:{value:"3.3.7",configurable:!0,writable:!0},isServer:{value:"undefined"==typeof window,configurable:!0,writable:!0},isBrowser:{value:"undefined"!=typeof window,configurable:!0,writable:!0}});var o=globalThis.dphelper;Object.defineProperty(o,"setProps",{value:(e,t,o)=>{Object.defineProperty(e,t.name,o||{writable:!1,configurable:!1,enumerable:!1}),o?.lock&&Object.freeze(e[t.name])},writable:!1,configurable:!1,enumerable:!1}),Object.defineProperty(o,"setDescription",{value:(e,t)=>{Object.defineProperties(o,{[e.name]:{value:t,writable:!1,configurable:!1,enumerable:!1}}),Object.keys(t).map(t=>(Object.defineProperties(o[e.name],{[t]:{writable:!1,configurable:!1,enumerable:!1}}),null)),o.setProps(o,e,{writable:!1,configurable:!1,enumerable:!1}),o._list.scripts.push(e)}});var a=e=>null===e||"object"!=typeof e,n=e=>null===e?"null":"string"==typeof e?e.includes(",")||e.includes(":")||e.includes('"')||e.includes("\n")||e.trim()!==e?`"${e.replace(/"/g,'\\"')}"`:e||'""':String(e),r=(e,t=0)=>{const o=" ".repeat(t);if(a(e))return n(e);if(Array.isArray(e)){if(0===e.length)return"[0]:";const t=e[0];if(a(t)||Array.isArray(t))return`[${e.length}]: `+e.map(n).join(",");{const a=Object.keys(t);let r=`[${e.length}]{${a.join(",")}}:`;for(const t of e){const e=a.map(e=>n(t[e])).join(",");r+=`\n${o} ${e}`}return r}}return Object.entries(e).map(([e,i])=>{const s=e.includes(" ")||e.includes(":")?`"${e}"`:e;if(!a(i)){const e=r(i,t+1);return e.startsWith("[")?`${s}${e}`:`${s}:\n ${o}${e}`}return`${s}: ${n(i)}`}).join(`\n${o}`)},i={tokenCount:e=>{const t="string"==typeof e?e:r(e);if(!t)return 0;const o=t.trim().split(/\s+/).length,a=t.length;return Math.ceil((a/4+1.3*o)/2)},smartSanitize:e=>e?e.replace(/[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}/g,"[EMAIL]").replace(/(?:\+?\d{1,3}[- ]?)?\(?\d{3}\)?[- ]?\d{3}[- ]?\d{4}/g,"[PHONE]").replace(/\b\d{4}[- ]?\d{4}[- ]?\d{4}[- ]?\d{4}\b/g,"[CREDIT_CARD]").replace(/\b\d{3}-\d{2}-\d{4}\b/g,"[SSN]"):"",toon:e=>r(e),toonToJson:e=>{if(!e)return null;const t=e.split("\n").filter(e=>""!==e.trim()),o={},a=[{indent:-1,obj:o}],n=e=>"true"===(e=e.trim())||"false"!==e&&("null"===e?null:isNaN(Number(e))||""===e?e.startsWith('"')&&e.endsWith('"')?e.slice(1,-1).replace(/\\"/g,'"'):e:Number(e)),r=e=>{const t=[];let o="",a=!1;for(let n=0;n<e.length;n++){const r=e[n];'"'===r&&"\\"!==e[n-1]?a=!a:","!==r||a?o+=r:(t.push(o.trim()),o="")}return t.push(o.trim()),t.map(n)};for(let e=0;e<t.length;e++){const o=t[e],i=o.search(/\S/),s=o.trim();if(!s)continue;for(;a.length>1&&i<=a[a.length-1].indent;)a.pop();const l=a[a.length-1];if(l.fields){const e=r(s),t={};l.fields.forEach((o,a)=>t[o]=e[a]),l.obj.push(t);continue}const c=s.indexOf(":");if(-1===c)continue;const d=s.slice(0,c).trim(),p=s.slice(c+1).trim(),u=d.match(/^(.+?)\[(\d+)\](?:{(.+?)})?$/);if(u){const[e,t,o,n]=u,s=[];l.obj[t]=s,n?a.push({indent:i,obj:s,key:t,fields:n.split(",").map(e=>e.trim())}):p?r(p).forEach(e=>s.push(e)):a.push({indent:i,obj:s,key:t})}else{const o=t[e+1],r=o?o.search(/\S/):-1;if(""===p&&r>i){const e={};l.obj[d]=e,a.push({indent:i,obj:e,key:d})}else l.obj[d]=n(p)}}return o},chunker:(e,t={})=>{if(!e)return[];const o=t.size||1e3,a=t.overlap||200,n=[];let r=0;for(;r<e.length;)n.push(e.slice(r,r+o)),r+=o-a;return n},similarity:(e,t)=>{if(e.length!==t.length)return 0;let o=0,a=0,n=0;for(let r=0;r<e.length;r++)o+=e[r]*t[r],a+=e[r]*e[r],n+=t[r]*t[r];return o/(Math.sqrt(a)*Math.sqrt(n))},extractReasoning:e=>{const t=e.match(/<think>([\s\S]*?)<\/think>/);return{reasoning:t?t[1].trim():"",content:e.replace(/<think>[\s\S]*?<\/think>/,"").trim()}},prompt:(e,t)=>e.replace(/{{(.*?)}}/g,(e,o)=>{const a=t[o.trim()];return void 0!==a?"object"==typeof a?r(a):String(a):`{{${o}}}`}),schema:e=>{const t=e=>null===e?"any":Array.isArray(e)?e.length>0&&"object"==typeof e[0]?`Array<{${Object.keys(e[0]).map(o=>`${o}:${t(e[0][o])}`).join(", ")}}>`:"Array<primitive>":typeof e;return"object"!=typeof e||null===e?t(e):Object.entries(e).map(([e,o])=>`${e}: ${t(o)}`).join("\n")},snapshot:()=>{const e="undefined"!=typeof window,t={context:{env:e?"browser":"server",time:(new Date).toISOString()}};e?(t.context.url=window.location.href.split("?")[0],t.context.title=document.title,t.state=window.gState||"No global state detected",t.logs=dphelper?.log?.list?.()?.slice(-10)||[],t.system={lang:navigator.language,screen:`${window.screen.width}x${window.screen.height}`,zoom:dphelper?.browser?.zoom?.()||100}):t.system={platform:"undefined"!=typeof process?process.platform:"unknown",node:"undefined"!=typeof process?process.version:"unknown",arch:"undefined"!=typeof process?process.arch:"unknown"};const o=r(t);return i.smartSanitize(o)}};dphelper?.setDescription({name:"ai",active:!0,subCommand:[{name:"tokenCount",version:"0.0.3",example:"dphelper.ai.tokenCount({ users: [1,2,3] })",author:"Dario Passariello",creationDate:"20260220",lastMod:"20260221",type:"function",active:!0,description:"Estimate token count for LLMs. If an object is passed, it uses TOON format for calculation.",env:"both",subCommand:[]},{name:"smartSanitize",version:"0.0.2",example:"dphelper.ai.smartSanitize('My email is test@example.com')",author:"Dario Passariello & Jo",creationDate:"20260220",lastMod:"20260220",type:"function",active:!0,description:"Remove PII (emails, phones, etc) from text for AI privacy",subCommand:[]},{name:"toon",version:"0.0.1",example:"dphelper.ai.toon({ users: [{id: 1, name: 'Ada'}] })",author:"TOON + Dario Passariello",creationDate:"20260221",lastMod:"20260221",type:"function",active:!0,description:"Convert JSON to TOON format (Token-Oriented Object Notation)",subCommand:[]},{name:"toonToJson",version:"0.0.1",example:"dphelper.ai.toonToJson('users[1]{id,name}:\\n 1,Ada')",author:"Dario Passariello",creationDate:"20260221",lastMod:"20260221",type:"function",active:!0,description:"Convert TOON format back to JSON/Object",subCommand:[]},{name:"chunker",version:"0.0.1",example:"dphelper.ai.chunker(text, { size: 1000, overlap: 200 })",author:"Dario Passariello",creationDate:"20260221",lastMod:"20260221",type:"function",active:!0,description:"Split long text into chunks for RAG or AI processing.",subCommand:[]},{name:"similarity",version:"0.0.1",example:"dphelper.ai.similarity(vecA, vecB)",author:"Dario Passariello",creationDate:"20260221",lastMod:"20260221",type:"function",active:!0,description:"Calculate cosine similarity between two embedding vectors.",subCommand:[]},{name:"extractReasoning",version:"0.0.1",example:"dphelper.ai.extractReasoning(aiResponse)",author:"Dario Passariello",creationDate:"20260221",lastMod:"20260221",type:"function",active:!0,description:"Extract <think> tags or internal reasoning from AI responses.",subCommand:[]},{name:"prompt",version:"0.0.1",example:"dphelper.ai.prompt('Hello {{name}}', { name: 'Ada' })",author:"Dario Passariello",creationDate:"20260221",lastMod:"20260221",type:"function",active:!0,description:"Simple prompt template engine with variable injection.",subCommand:[]},{name:"schema",version:"0.0.1",example:"dphelper.ai.schema({ id: 1, name: 'Ada' })",author:"Dario Passariello",creationDate:"20260221",lastMod:"20260221",type:"function",active:!0,description:"Generate a TOON-style schema definition for AI instructions.",subCommand:[]},{name:"snapshot",version:"0.0.1",example:"dphelper.ai.snapshot()",author:"Dario Passariello",creationDate:"20260221",lastMod:"20260221",type:"function",active:!0,description:"Capture a 'mental snapshot' of the app state (logs/globals) in TOON format for AI debugging.",env:"both",subCommand:[]}]},i);var s={name:"anchor",active:!0,subCommand:[{name:"toOnClick",type:"function",version:"0.0.2",example:"dphelper.anchor.toOnClick([element, 'foo' | '.foo' | '#foo'])",description:"This tool allows you to convert all links in an element to 'onclick'.\n It allows you to avoid the message with the path relative to the requested address\n and it is very useful when you work with SPA but you want to keep even older browsers.",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",active:!0,env:"client",subCommand:[]}]},l={toOnClick:e=>{const t=document.querySelector(e);if(!t)return;t.querySelectorAll("a").forEach(e=>{const t=e.getAttribute("href");if(!t)return;e.style.cursor="pointer";const o=dphelper.pathRail()?.[3]?.replace(/\//g,"")||"";o&&e.classList.add(o);const a=e.cloneNode(!0);e.parentNode?.replaceChild(a,e),a.removeAttribute("href"),a.addEventListener("mouseup",e=>{t.startsWith("/")?(history.pushState({href:t},"",t),dphelper.navigation.load(t),e.stopPropagation()):dphelper.browser.href(t)})})}};dphelper?.setDescription(s,l);var c={find:(e,t)=>{if(Array.isArray(e)){for(const o of e){if(o[t]===t)return o;if(o.children){const e=dphelper.array.find(t,o.children);if(e)return e}}return!1}},delete:(e,t)=>{Array.isArray(e)&&e.some(function e(o,a,n){if(o[t]===t)return n.splice(a,1),!0;for(const t of Object.keys(o)){const a=o[t];if(Array.isArray(a))return a.some(e)}return null})},merge:(e,t)=>{if(!e||!t)return t||e;for(const o of Object.keys(e))"__proto__"!==o&&"constructor"!==o&&"prototype"!==o&&e[o]instanceof Object&&t[o]&&Object.assign(e[o],dphelper.array.merge(t[o],e[o]));return Object.assign(t,e)},mergeByKey:(e,t,o)=>e.map(e=>{const a=t.find(t=>e[o]===t[o]);return a?Object.assign({},e,a):e}),duplicates:e=>{if(!Array.isArray(e))return;const t=new Set,o=new Set;for(const a of e)t.has(a)?o.add(a):t.add(a);return Array.from(o)},even:e=>{if(Array.isArray(e))return e.filter(e=>e%2==0)},odd:e=>{if(Array.isArray(e))return e.filter(e=>e%2!=0)},sumColumn:(e=[],t=0)=>Array.isArray(e)?void 0===t?"provide a column":e.reduce((e,o)=>e+(o[t]||0),0):"provide a multidimensional array",shuffle:e=>{if(Array.isArray(e)){for(let t=e.length-1;t>0;t--){const o=Math.floor(Math.random()*(t+1));[e[t],e[o]]=[e[o],e[t]]}return e}},generate:e=>{if(Number.isNaN(e))return;const t=Array.from({length:e},(e,t)=>t+1);return dphelper.array.shuffle(t)},testArrayInt:e=>{if(!Array.isArray(e))return;const t=[];for(let o=1;o<=e.length;o++)e.includes(o)||t.push(o);return t},rand32:e=>{const t=performance.now(),o=[];o.nums=[],o.time=[];for(let t=0;t<e;++t)o.nums.push(crypto.getRandomValues(new Uint32Array(1))[0]);const a=performance.now();return o.time.push(a-t),o},match:(e,t)=>e.filter(e=>t.includes(e)),pathToJson:(e,t="/")=>{const o={};let a;for(const n of e){a=o;const e=n.split(t);for(const t of e.slice(1,-1)){if(""===t)return;t in a||(a[t]={}),a=a[t]}e.at(-1)&&(a[e.at(-1)]=null)}return o}};dphelper?.setDescription({name:"array",active:!0,subCommand:[{name:"find",version:"0.0.2",example:"dphelper.array.find(array, 'key')",description:"Find an item in the array recursively.",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:!0,env:"both",subCommand:[]},{name:"delete",version:"0.0.2",example:"dphelper.array.delete(array, 'key')",description:"Delete an item from the array recursively.",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:!0,env:"both",subCommand:[]},{name:"unique",version:"0.0.2",example:"dphelper.array.unique(array)",description:"Remove duplicate values from an array.",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:!0,env:"both",subCommand:[]},{name:"merge",version:"0.0.2",example:"dphelper.array.merge(arrA, arrB)",description:"Merge two arrays into one.",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:!0,env:"both",subCommand:[]},{name:"mergeByKey",version:"0.0.2",example:"dphelper.array.mergeByKey(arrA, arrB, 'id')",author:"Dario Passariello",creationDate:"20230603",lastMod:"20260220",type:"function",active:!0,description:"Merge two arrays of objects by a specific key.",env:"both",subCommand:[]},{name:"asc",version:"0.0.2",example:"dphelper.array.asc(array)",description:"Sort array in ascending order.",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:!0,env:"both",subCommand:[]},{name:"desc",version:"0.0.2",example:"dphelper.array.desc(array)",description:"Sort array in descending order.",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:!0,env:"both",subCommand:[]},{name:"duplicates",version:"0.0.2",example:"dphelper.array.duplicates(array)",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:!0,description:"Find duplicate items in an array.",env:"both",subCommand:[]},{name:"even",version:"0.0.2",example:"dphelper.array.even(array)",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:!0,description:"Filter even numbers from an array.",env:"both",subCommand:[]},{name:"odd",version:"0.0.2",example:"dphelper.array.odd(array)",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:!0,description:"Filter odd numbers from an array.",env:"both",subCommand:[]},{name:"toObj",version:"0.0.2",example:"dphelper.array.toObj(array)",description:"Convert an array to an object.",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:!0,env:"both",subCommand:[]},{name:"sumColumn",version:"0.0.2",example:"dphelper.array.sumColumn(arr, 0)",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:!0,description:"Sum the values of a specified column in a multidimensional array.",env:"both",subCommand:[]},{name:"shuffle",version:"0.0.2",example:"dphelper.array.shuffle(array)",author:"Dario Passariello",creationDate:"20230527",lastMod:"20260220",type:"function",active:!0,description:"Randomly shuffle the elements of an array.",env:"both",subCommand:[]},{name:"generate",version:"0.0.2",example:"dphelper.array.generate(10)",author:"Dario Passariello",creationDate:"20230527",lastMod:"20260220",type:"function",active:!0,description:"Generate an array of random numbers (max 500000).",env:"both",subCommand:[]},{name:"testArrayInt",version:"0.0.2",example:"dphelper.array.testArrayInt([1,2,4])",author:"Dario Passariello",creationDate:"20230527",lastMod:"20260220",type:"function",active:!0,description:"Check if an array contains consecutive integers.",env:"both",subCommand:[]},{name:"rand32",version:"0.0.2",example:"dphelper.array.rand32(5)",author:"Dario Passariello",creationDate:"20230527",lastMod:"20260220",type:"function",active:!0,description:"Generate an array of random 32-bit unsigned integers.",env:"both",subCommand:[]},{name:"findindex",version:"0.0.2",example:"dphelper.array.findindex(array, 'name')",description:"Find the index of an item in an array by key.",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:!0,env:"both",subCommand:[]},{name:"pathToJson",version:"0.0.2",example:"dphelper.array.pathToJson(paths, '/')",description:"Convert an array of paths into a JSON object.",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:!0,env:"both",subCommand:[]},{name:"deepClone",version:"0.0.2",example:"dphelper.array.deepClone(array)",description:"Create a deep clone of an array using structuredClone.",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:!0,env:"both",subCommand:[]},{name:"match",version:"0.0.2",example:"dphelper.array.match(arrA, arrB)",author:"Dario Passariello",creationDate:"20250101",lastMod:"20260220",type:"function",active:!0,description:"Find a perfect match between an array of words and an array to check.",env:"both",subCommand:[]}]},c);var d={play:(e,t="",o=!1)=>{if(e){if(!document.querySelector(`#audio_${e}`)){const a=document.createElement("audio");a.id=`audio_${e}`,a.dataset.dphelper="audio",a.src=t+e,a.loop=o,document.body.appendChild(a),a.load(),a.play()?.catch?.(e=>console.error("Error playing audio:",e))}}else document.querySelectorAll("audio[data-dphelper='audio']").forEach(e=>e.remove())}};dphelper?.setDescription({name:"audio",active:!0,subCommand:[{name:"play",version:"0.0.2",example:"dphelper.audio.play([audiofile])",description:"Plays an audio file or removes all audio elements from the document.",author:"Dario Passariello",creationDate:"20240924",lastMod:"20240924",type:"function",active:!0,env:"client",subCommand:[]}]},d);var p={cache:e=>{if("string"!=typeof e)throw new Error("The provided URI must be a string");return e.concat(/\?/.test(e)?"&":"?","t=",Math.random().toString(36).substring(2))}};dphelper?.setDescription({name:"avoid",active:!0,subCommand:[{name:"cache",version:"0.0.2",example:"dphelper.avoid.cache()",description:"Appends a cache-busting query parameter to a given URI.",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:!0,env:"both",subCommand:[]}]},p);var u=()=>!!navigator.credentials&&!!navigator.credentials.create,m=(e=32)=>{const t=new Uint8Array(e);return crypto.getRandomValues(t),t},h=new Map,v={isAvailable:u,getWebAuthnSupport:()=>{if(!u())return{supported:!1,platformAuthenticator:!1,hybridTransport:!1,uvToken:!1};const e=navigator.userAgent,t=e.includes("Windows"),o=e.includes("Mac"),a=e.includes("Linux");return{supported:!0,platformAuthenticator:t||o||a,hybridTransport:!1,uvToken:!1}},isSensorAvailable:async e=>{if(!u())return!1;if("undefined"!=typeof PublicKeyCredential)try{if("fingerprint"===e)return await PublicKeyCredential.isUserVerifyingPlatformAuthenticatorAvailable();if("face"===e)return await PublicKeyCredential.isUserVerifyingPlatformAuthenticatorAvailable();if("iris"===e)return await PublicKeyCredential.isUserVerifyingPlatformAuthenticatorAvailable()}catch{return!1}return!1},register:async(e,t=window.location.hostname,o=window.location.hostname,a=e)=>{if(!u())return{success:!1,error:"WebAuthn not supported"};try{const n=m(),r={challenge:n.buffer,rp:{id:t,name:o},user:{id:(new TextEncoder).encode(e),name:a,displayName:a},pubKeyCredParams:[{type:"public-key",alg:-7},{type:"public-key",alg:-257}],timeout:6e4,attestation:"none",authenticatorSelection:{authenticatorAttachment:"platform",userVerification:"preferred"}},i=await navigator.credentials.create({publicKey:r});if(!i)return{success:!1,error:"Credential creation failed"};const s=(e=>{const t=e instanceof Uint8Array?e:new Uint8Array(e);let o="";return t.forEach(e=>o+=String.fromCharCode(e)),btoa(o)})(i.rawId);return h.set(s,{type:"public-key",id:i.rawId}),{success:!0,credentialId:s}}catch(e){return{success:!1,error:e.message||"Registration failed"}}},authenticate:async(e,t=window.location.hostname,o)=>{if(!u())return{success:!1,error:"WebAuthn not supported"};try{const e=m(),a=[];if(o){const e=(e=>{const t=atob(e),o=new Uint8Array(t.length);for(let e=0;e<t.length;e++)o[e]=t.charCodeAt(e);return o})(o).buffer;a.push({type:"public-key",id:e})}else h.size>0&&h.forEach(e=>{a.push(e)});const n={challenge:e.buffer,rpId:t,timeout:6e4,userVerification:"preferred",allowCredentials:a.length>0?a:void 0};return await navigator.credentials.get({publicKey:n})?{success:!0}:{success:!1,error:"Authentication failed"}}catch(e){return{success:!1,error:e.message||"Authentication failed"}}},getCredential:e=>h.get(e),deleteCredential:e=>h.delete(e),listCredentials:()=>Array.from(h.keys())};dphelper?.setDescription({name:"biometric",active:!0,subCommand:[{name:"isAvailable",version:"0.0.1",example:"dphelper.biometric.isAvailable()",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:!0,description:"Check if WebAuthn/biometric authentication is available",env:"client",subCommand:[]},{name:"register",version:"0.0.1",example:"dphelper.biometric.register('user123', 'https://example.com')",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:!0,description:"Register a new credential for biometric authentication",env:"client",subCommand:[]},{name:"authenticate",version:"0.0.1",example:"dphelper.biometric.authenticate('user123', 'https://example.com')",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:!0,description:"Authenticate using stored biometric credential",env:"client",subCommand:[]},{name:"getCredential",version:"0.0.1",example:"dphelper.biometric.getCredential(credentialId)",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:!0,description:"Get a stored credential by ID",env:"client",subCommand:[]},{name:"deleteCredential",version:"0.0.1",example:"dphelper.biometric.deleteCredential(credentialId)",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:!0,description:"Delete a stored credential",env:"client",subCommand:[]},{name:"listCredentials",version:"0.0.1",example:"dphelper.biometric.listCredentials()",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:!0,description:"List all stored credentials",env:"client",subCommand:[]},{name:"isSensorAvailable",version:"0.0.1",example:"dphelper.biometric.isSensorAvailable('fingerprint')",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:!0,description:"Check if specific biometric sensor is available",env:"client",subCommand:[]},{name:"getWebAuthnSupport",version:"0.0.1",example:"dphelper.biometric.getWebAuthnSupport()",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:!0,description:"Get detailed WebAuthn support information",env:"client",subCommand:[]}]},v);var f={"1xx":{code:"1xx",message:"Information",description:"1xx codes are often interim responses for sharing connection status information. Not intended for final request or response action."},100:{code:100,message:"Continue",description:"The server has received the request headers, and the client should proceed to send the request body."},101:{code:101,message:"Switching Protocols",description:"The requester has asked the server to switch protocols."},102:{code:102,message:"Processing",description:"This code indicates that the server has received and is processing the request, but no response is available yet. This prevents the client from timing out and assuming the request was lost."},103:{code:103,message:"Early Hints",description:"Used to return some response headers before final HTTP message."},"2xx":{code:"2xx",message:"Successful",description:"2xx codes indicate successful responses usually this means the action requested by the client was received, understood and accepted successfully."},200:{code:200,message:"OK",description:"The request is OK (this is the standard response for successful HTTP requests)."},201:{code:201,message:"Created",description:"The request has been fulfilled, and a new resource is created."},202:{code:202,message:"Accepted",description:"The request has been accepted for processing, but the processing has not been completed."},203:{code:203,message:"Non-Authoritative Information",description:"The request has been successfully processed, but is returning information that may be from another source."},204:{code:204,message:"No Content",description:"The request has been successfully processed, but is not returning any content."},205:{code:205,message:"Reset Content",description:"The request has been successfully processed, but is not returning any content, and requires that the requester reset the document view."},206:{code:206,message:"Partial Content",description:"The server is delivering only part of the resource due to a range header sent by the client."},207:{code:207,message:"Multi-Status",description:"The message body that follows is by default an XML message and can contain a number of separate response codes, depending on how many sub-requests were made."},208:{code:208,message:"Already Reported",description:"The members of a DAV binding have already been enumerated in a preceding part of the (multi-status) response, and are not being included again."},218:{code:218,message:"This is fine (Apache Web Server)",description:"Used as a catch-all error condition for allowing response bodies to flow through Apache when ProxyErrorOverride is enabled."},226:{code:226,message:"IM Used",description:"The server has fulfilled a request for the resource, and the response is a representation of the result of one or more instance-manipulations applied to the current instance."},"3xx":{code:"3xx",message:"Redirection",description:"3xx codes are a class of responses that suggest the User-Agent must follow another course of action to obtain the complete requested resource."},300:{code:300,message:"Multiple Choices",description:"A link list. The user can select a link and go to that location. Maximum five addresses."},301:{code:301,message:"Moved Permanently",description:"The requested page has moved to a new URL."},302:{code:302,message:"Found",description:"The requested page has moved temporarily to a new URL."},303:{code:303,message:"See Other",description:"The requested page can be found under a different URL."},304:{code:304,message:"Not Modified",description:"Indicates the requested page has not been modified since last requested."},306:{code:306,message:"Switch Proxy",description:'No longer used. Originally meant "Subsequent requests should use the specified proxy."'},307:{code:307,message:"Temporary Redirect",description:"The requested page has moved temporarily to a new URL."},308:{code:308,message:"Resume Incomplete",description:"Used in the resumable requests proposal to resume aborted PUT or POST requests."},"4xx":{code:"4xx",message:"Client Error",description:"4xx codes generally are error responses specifying an issue at the client’s end. Potentially a network issue."},400:{code:400,message:"Bad Request",description:"The request cannot be fulfilled due to bad syntax."},401:{code:401,message:"Unauthorized",description:"The request was a legal request, but the server is refusing to respond to it. For use when authentication is possible but has failed or not yet been provided."},402:{code:402,message:"Payment Required",description:"Not yet implemented by RFC standards, but reserved for future use."},403:{code:403,message:"Forbidden",description:"The request was a legal request, but the server is refusing to respond to it."},404:{code:404,message:"Not Found",description:"The requested page could not be found but may be available again in the future."},405:{code:405,message:"Method Not Allowed",description:"A request was made of a page using a request method not supported by that page."},406:{code:406,message:"Not Acceptable",description:"The server can only generate a response that is not accepted by the client."},407:{code:407,message:"Proxy Authentication Required",description:"The client must first authenticate itself with the proxy."},408:{code:408,message:"Request Timeout",description:"The server timed out waiting for the request."},409:{code:409,message:"Conflict",description:"The request could not be completed because of a conflict in the request."},410:{code:410,message:"Gone",description:"The requested page is no longer available."},411:{code:411,message:"Length Required",description:'The "Content-Length" is not defined. The server will not accept the request without it.'},412:{code:412,message:"Precondition Failed",description:"The precondition given in the request evaluated to false by the server."},413:{code:413,message:"Request Entity Too Large",description:"The server will not accept the request, because the request entity is too large."},414:{code:414,message:"Request-URI Too Long",description:"The server will not accept the request, because the URL is too long. Occurs when you convert a POST request to a GET request with a long query information."},415:{code:415,message:"Unsupported Media Type",description:"The server will not accept the request, because the media type is not supported."},416:{code:416,message:"Requested Range Not Satisfiable",description:"The client has asked for a portion of the file, but the server cannot supply that portion."},417:{code:417,message:"Expectation Failed",description:"The server cannot meet the requirements of the Expect request-header field."},418:{code:418,message:"I'm a teapot",description:'Any attempt to brew coffee with a teapot should result in the error code "418 I\'m a teapot". The resulting entity body MAY be short and stout.'},419:{code:419,message:"Page Expired (Laravel Framework)",description:"Used by the Laravel Framework when a CSRF Token is missing or expired."},420:{code:420,message:"Method Failure (Spring Framework)",description:"A deprecated response used by the Spring Framework when a method has failed."},421:{code:421,message:"Misdirected Request",description:"The request was directed at a server that is not able to produce a response (for example because a connection reuse)."},422:{code:422,message:"Unprocessable Entity",description:"The request was well-formed but was unable to be followed due to semantic errors."},423:{code:423,message:"Locked",description:"The resource that is being accessed is locked."},424:{code:424,message:"Failed Dependency",description:"The request failed due to failure of a previous request (e.g., a PROPPATCH)."},426:{code:426,message:"Upgrade Required",description:"The client should switch to a different protocol such as TLS/1.0, given in the Upgrade header field."},428:{code:428,message:"Precondition Required",description:"The origin server requires the request to be conditional."},429:{code:429,message:"Too Many Requests",description:"The user has sent too many requests in a given amount of time. Intended for use with rate limiting schemes."},431:{code:431,message:"Request Header Fields Too Large",description:"The server is unwilling to process the request because either an individual header field, or all the header fields collectively, are too large."},440:{code:440,message:"Login Time-out",description:"The client's session has expired and must log in again. (IIS)"},444:{code:444,message:"Connection Closed Without Response",description:"A non-standard status code used to instruct nginx to close the connection without sending a response to the client, most commonly used to deny malicious or malformed requests."},449:{code:449,message:"Retry With",description:"The server cannot honour the request because the user has not provided the required information. (IIS)"},450:{code:450,message:"Blocked by Windows Parental Controls",description:"The Microsoft extension code indicated when Windows Parental Controls are turned on and are blocking access to the requested webpage."},451:{code:451,message:"Unavailable For Legal Reasons",description:"A server operator has received a legal demand to deny access to a resource or to a set of resources that includes the requested resource."},494:{code:494,message:"Request Header Too Large",description:"Used by nginx to indicate the client sent too large of a request or header line that is too long."},495:{code:495,message:"SSL Certificate Error",description:"An expansion of the 400 Bad Request response code, used when the client has provided an invalid client certificate."},496:{code:496,message:"SSL Certificate Required",description:"An expansion of the 400 Bad Request response code, used when a client certificate is required but not provided."},497:{code:497,message:"HTTP Request Sent to HTTPS Port",description:"An expansion of the 400 Bad Request response code, used when the client has made a HTTP request to a port listening for HTTPS requests."},498:{code:498,message:"Invalid Token (Esri)",description:"Returned by ArcGIS for Server. Code 498 indicates an expired or otherwise invalid token."},499:{code:499,message:"Client Closed Request",description:"A non-standard status code introduced by nginx for the case when a client closes the connection while nginx is processing the request."},"5xx":{code:"5xx",message:"Server Error",description:"5xx error codes indicate that an error or unresolvable request occurred on the server side, whether that is a proxy or the origin host."},500:{code:500,message:"Internal Server Error",description:"An error has occurred in a server side script, a no more specific message is suitable."},501:{code:501,message:"Not Implemented",description:"The server either does not recognize the request method, or it lacks the ability to fulfill the request."},502:{code:502,message:"Bad Gateway",description:"The server was acting as a gateway or proxy and received an invalid response from the upstream server."},503:{code:503,message:"Service Unavailable",description:"The server is currently unavailable (overloaded or down)."},504:{code:504,message:"Gateway Timeout",description:"The server was acting as a gateway or proxy and did not receive a timely response from the upstream server."},505:{code:505,message:"HTTP Version Not Supported",description:"The server does not support the HTTP protocol version used in the request."},506:{code:506,message:"Variant Also Negotiates",description:"Transparent content negotiation for the request results in a circular reference."},507:{code:507,message:"Insufficient Storage",description:"The server is unable to store the representation needed to complete the request."},508:{code:508,message:"Loop Detected",description:"The server detected an infinite loop while processing the request (sent instead of 208 Already Reported)."},509:{code:509,message:"Bandwidth Limit Exceeded",description:"The server has exceeded the bandwidth specified by the server administrator; this is often used by shared hosting providers to limit the bandwidth of customers."},510:{code:510,message:"Not Extended",description:"Further extensions to the request are required for the server to fulfil it."},511:{code:511,message:"Network Authentication Required",description:"The client needs to authenticate to gain network access."},520:{code:520,message:"Unknown Error",description:'The 520 error is used as a "catch-all response for when the origin server returns something unexpected", listing connection resets, large headers, and empty or invalid responses as common triggers.'},521:{code:521,message:"Web Server Is Down",description:"The origin server has refused the connection from Cloudflare."},522:{code:522,message:"Connection Timed Out",description:"Cloudflare could not negotiate a TCP handshake with the origin server."},523:{code:523,message:"Origin Is Unreachable",description:"Cloudflare could not reach the origin server; for example, if the DNS records for the origin server are incorrect."},524:{code:524,message:"A Timeout Occurred",description:"Cloudflare was able to complete a TCP connection to the origin server, but did not receive a timely HTTP response."},525:{code:525,message:"SSL Handshake Failed",description:"Cloudflare could not negotiate a SSL/TLS handshake with the origin server."},526:{code:526,message:"Invalid SSL Certificate",description:"Used by Cloudflare and Cloud Foundry's gorouter to indicate failure to validate the SSL/TLS certificate that the origin server presented."},527:{code:527,message:"Railgun Listener to Origin Error",description:"Error 527 indicates that the request timed out or failed after the WAN connection had been established."},530:{code:530,message:"Origin DNS Error",description:"Error 530 indicates that the requested host name could not be resolved on the Cloudflare network to an origin server."},598:{code:598,message:"Network Read Timeout Error",description:"Used by some HTTP proxies to signal a network read timeout behind the proxy to a client in front of the proxy."}},b={interlock:e=>{const t=new BroadcastChannel("dp_interlock");let o=1;t.onmessage=a=>{a.origin!==window.location.origin&&a.origin||"ping"!==a.data&&"pong"!==a.data||("ping"===a.data&&t.postMessage("pong"),"pong"===a.data&&e(++o))},t.postMessage("ping"),e(o)},state:(e,t,o)=>{history.pushState(e,t,o)},forw:e=>{history.go(e)},back:e=>{history.go(-Math.abs(e))},reload:()=>{location.href="/"},href:e=>{location.href=e},offLine:(e="You are offline.")=>{window.addEventListener("online",()=>document.querySelectorAll("[o]").forEach(e=>e.remove())),window.addEventListener("offline",()=>{const t=String(e).replace(/["\\]/g,"\\$&").slice(0,200),o=document.createElement("style");o.setAttribute("o",""),o.textContent=`\n html {\n\n &:before {\n content: "";\n display: flex;\n justify-content: center;\n align-items: center;\n position: absolute;\n top: 0;\n bottom: 0;\n left: 0;\n right: 0;\n background-color: #00000082;\n z-index: 9999;\n -webkit-backdrop-filter: blur(2px);\n backdrop-filter: blur(2px);\n\n }\n\n &:after{\n position: absolute;\n content: "${t}";\n font-size: 1em;\n background-color: orange;\n color: black;\n text-align: center;\n padding: 10px 30px;\n z-index: 10000;\n border-radius: 20px;\n top: calc(50% - 22px);\n left: calc(50% - 92px);\n border: 6px solid #00000026;\n }\n\n }\n `,document.body.appendChild(o)})},zoom:()=>Math.round(100*devicePixelRatio),status:e=>f[e]||"Unknown status"};dphelper?.setDescription({name:"browser",active:!0,subCommand:[{name:"state",version:"0.0.2",example:"dphelper.browser.state([state, title, url])",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:!0,description:"Pushes a new state to the browser history.",env:"client",subCommand:[]},{name:"forw",version:"0.0.2",example:"dphelper.browser.forw([number])",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:!0,description:"Moves forward in the browser history.",env:"client",subCommand:[]},{name:"back",version:"0.0.2",example:"dphelper.browser.back([number])",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:!0,description:"Moves backward in the browser history.",env:"client",subCommand:[]},{name:"reload",version:"0.0.2",example:"dphelper.browser.reload()",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:!0,description:"Reloads the current page.",env:"client",subCommand:[]},{name:"href",version:"0.0.2",example:"dphelper.browser.href([url])",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:!0,description:"Navigates to the specified URL.",env:"client",subCommand:[]},{name:"offLine",version:"0.0.2",example:"dphelper.browser.offline([text])",author:"Dario Passariello",creationDate:"20190727",lastMod:"20240727",type:"function",active:!0,description:"Displays an offline message when the browser is offline.",env:"client",subCommand:[]},{name:"zoom",version:"0.0.2",example:"dphelper.browser.zoom()",author:"Dario Passariello",creationDate:"20190727",lastMod:"20240727",type:"function",active:!0,description:"Returns the current zoom level of the browser.",env:"client",subCommand:[]},{name:"status",version:"0.0.2",example:"dphelper.browser.status(404)",author:"Dario Passariello",creationDate:"20240912",lastMod:"20240912",type:"function",active:!0,description:"Returns a description of the specified HTTP status code.",env:"client",subCommand:[]},{name:"interlock",version:"0.0.1",example:"dphelper.browser.interlock((tabs) => ...)",author:"Dario Passariello",creationDate:"20260221",lastMod:"20260221",type:"function",active:!0,description:"Detect and monitor other active tabs of the same app.",env:"client",subCommand:[]}]},b);var g={version:(e,t,o)=>{if(!e||!t)return Number.NaN;const a=o?.lex,n=o?.zero;let r=e.split("."),i=t.split(".");const s=e=>(a?/^\d+[A-Za-z]*$/:/^\d+$/).test(e);if(!r.every(s)||!i.every(s))return Number.NaN;if(n){for(;r.length<i.length;)r.push("0");for(;i.length<r.length;)i.push("0")}a||(r=r.map(Number),i=i.map(Number));for(let e=0;e<r.length;e++){if(i.length===e)return 1;if(r[e]!==i[e])return r[e]>i[e]?1:-1}return r.length!==i.length?-1:0}};dphelper?.setDescription({name:"check",active:!0,subCommand:[{name:"version",version:"0.0.2",example:"dphelper.check.version([v1], [v2], [opts])",description:"Compares two versions.",author:"Dario Passariello",creationDate:"20240829",lastMod:"20240829",type:"function",active:!0,env:"both",subCommand:[]}]},g);var y={hex:e=>{let t=Number.parseInt(e.toString(),10);return Number.isNaN(t)?"00":(t=Math.round(Math.max(0,Math.min(255,t))),t.toString(16).padStart(2,"0"))},toHex:e=>dphelper.color.hex(e[0])+dphelper.color.hex(e[1])+dphelper.color.hex(e[2]),toRGB:e=>{const t=[];return t[0]=Number.parseInt(dphelper.text.trim(e,"#",1,7).substring(0,2),16),t[1]=Number.parseInt(dphelper.text.trim(e,"#",1,7).substring(2,4),16),t[2]=Number.parseInt(dphelper.text.trim(e,"#",1,7).substring(4,6),16),t},oleColor:e=>{const t=e.replace("#","").match(/.{1,2}/g);return!t||t.length<3?"0":(Number.parseInt(t[0],16)+256*Number.parseInt(t[1],16)+65536*Number.parseInt(t[2],16)).toString()},gradient:(e,t,o)=>{const a=dphelper.color.toRGB(e),n=dphelper.color.toRGB(t),r=o,i=[];let s=0;const l=[];for(let e=0;e<r;e++)s+=1/r,l[0]=a[0]*s+(1-s)*n[0],l[1]=a[1]*s+(1-s)*n[1],l[2]=a[2]*s+(1-s)*n[2],i.push(dphelper.color.toHex(l));return i}};dphelper?.setDescription({name:"color",active:!0,subCommand:[{name:"hex",version:"0.0.2",example:"dphelper.color.hex(255)",description:"Converts a number to a hexadecimal string.",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:!0,env:"client",subCommand:[]},{name:"toHex",version:"0.0.2",example:"dphelper.color.toHex([255, 255, 255])",description:"Converts an RGB array to a hexadecimal string.",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:!0,env:"client",subCommand:[]},{name:"toRGB",version:"0.0.2",example:"dphelper.color.toRGB('#ffffff')",description:"Converts a hexadecimal string to an RGB array.",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:!0,env:"client",subCommand:[]},{name:"oleColor",version:"0.0.2",example:"dphelper.color.oleColor('#ffffff')",description:"Converts a hexadecimal string to an OLE color.",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:!0,env:"client",subCommand:[]},{name:"gradient",version:"0.0.2",example:"dphelper.color.gradient([colorStart, colorEnd, colorCount])",description:"Generates a gradient between two colors.",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:!0,env:"client",subCommand:[]}]},y);var D={gzip:async e=>{const t="string"==typeof e?(new TextEncoder).encode(e):e,o=new CompressionStream("gzip"),a=o.writable.getWriter();return a.write(t.buffer),a.close(),new Response(o.readable).blob()},gunzip:async e=>{const t=new DecompressionStream("gzip"),o=t.writable.getWriter();o.write(await e.arrayBuffer()),o.close();const a=await new Response(t.readable).arrayBuffer();return(new TextDecoder).decode(a)},deflate:async e=>{const t="string"==typeof e?(new TextEncoder).encode(e):e,o=new CompressionStream("deflate"),a=o.writable.getWriter();return a.write(t.buffer),a.close(),new Response(o.readable).blob()},inflate:async e=>{const t=new DecompressionStream("deflate"),o=t.writable.getWriter();o.write(await e.arrayBuffer()),o.close();const a=await new Response(t.readable).arrayBuffer();return(new TextDecoder).decode(a)},compress:e=>{const t={};let o="",a=[],n=256;for(let e=0;e<256;e++)t[String.fromCharCode(e)]=e;for(let r=0;r<e.length;r++){const i=e[r],s=o+i;void 0!==t[s]?o=s:(a.push(String(t[o])),t[s]=n++,o=i)}return""!==o&&a.push(String(t[o])),String.fromCharCode(...a.map(Number))},decompress:e=>{const t={},o=[];let a=256;for(let e=0;e<256;e++)t[e]=String.fromCharCode(e);const n=e.split("").map(e=>e.charCodeAt(0));let r=t[n[0]];o.push(r);for(let e=1;e<n.length;e++){let i=t[n[e]];void 0===i&&(i=r+r[0]),o.push(i),t[a++]=r+i[0],r=i}return o.join("")},base64Encode:e=>{const t=(new TextEncoder).encode(e);let o="";return t.forEach(e=>o+=String.fromCharCode(e)),btoa(o)},base64Decode:e=>{const t=atob(e),o=new Uint8Array(t.length);for(let e=0;e<t.length;e++)o[e]=t.charCodeAt(e);return(new TextDecoder).decode(o)},urlEncode:e=>encodeURIComponent(e),urlDecode:e=>decodeURIComponent(e),htmlEncode:e=>{const t={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"};return e.replace(/[&<>"']/g,e=>t[e]||e)},htmlDecode:e=>{const t={"&amp;":"&","&lt;":"<","&gt;":">","&quot;":'"',"&#39;":"'"};return e.replace(/&(amp|lt|gt|quot|#39);/g,(e,o)=>t[`&${o};`]||e)}};dphelper?.setDescription({name:"compress",active:!0,subCommand:[{name:"gzip",version:"0.0.1",example:"dphelper.compress.gzip('Hello World')",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:!0,description:"Compress data using gzip",env:"both",subCommand:[]},{name:"gunzip",version:"0.0.1",example:"dphelper.compress.gunzip(compressedData)",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:!0,description:"Decompress gzip data",env:"both",subCommand:[]},{name:"deflate",version:"0.0.1",example:"dphelper.compress.deflate('Hello World')",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:!0,description:"Compress data using deflate",env:"both",subCommand:[]},{name:"inflate",version:"0.0.1",example:"dphelper.compress.inflate(compressedData)",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:!0,description:"Decompress deflate data",env:"both",subCommand:[]},{name:"compress",version:"0.0.1",example:"dphelper.compress.compress('Hello World')",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:!0,description:"Compress data using LZW algorithm (JavaScript compatible)",env:"both",subCommand:[]},{name:"decompress",version:"0.0.1",example:"dphelper.compress.decompress(compressedString)",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:!0,description:"Decompress LZW compressed data",env:"both",subCommand:[]},{name:"base64Encode",version:"0.0.1",example:"dphelper.compress.base64Encode('Hello')",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:!0,description:"Encode string to base64",env:"both",subCommand:[]},{name:"base64Decode",version:"0.0.1",example:"dphelper.compress.base64Decode('SGVsbG8=')",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:!0,description:"Decode base64 string",env:"both",subCommand:[]},{name:"urlEncode",version:"0.0.1",example:"dphelper.compress.urlEncode('Hello World!')",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:!0,description:"URL encode a string",env:"both",subCommand:[]},{name:"urlDecode",version:"0.0.1",example:"dphelper.compress.urlDecode('Hello%20World!')",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:!0,description:"URL decode a string",env:"both",subCommand:[]},{name:"htmlEncode",version:"0.0.1",example:"dphelper.compress.htmlEncode('<script>')",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:!0,description:"HTML encode a string",env:"both",subCommand:[]},{name:"htmlDecode",version:"0.0.1",example:"dphelper.compress.htmlDecode('<script>')",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:!0,description:"HTML decode a string",env:"both",subCommand:[]}]},D);var w={set:e=>{const t=new Date;if(t.setTime(t.getTime()+31536e6),!e.name)return;const{name:o,value:a,time:n=e.time||t.toUTCString(),path:r=e.path||"/",sameSite:i=e.sameSite||"Lax",secure:s=e.secure??"https:"===location.protocol}=e,l=encodeURIComponent(a),c=s?"Secure":"",d=i;document.cookie=`${o}=${l}; expires=${n}; path=${r}; SameSite=${d}; ${c}`},get:e=>{const t=document.cookie.split(";"),o=t.length;for(let a=0;a<o;a++){const o=t[a];if(!o)continue;const n=o.trim().split("=");if(e===n[0])return decodeURIComponent(n[1]||"")}return null},delete:e=>dphelper.cookie.set({name:e,value:"",time:"Thu, 01 Jan 1970 00:00:00 GMT"}),removeAll:()=>{const e=document.cookie.split(";"),t=e.length;for(let o=0;o<t;o++){const t=e[o];if(!t)continue;const a=t.indexOf("="),n=a>-1?t.slice(0,a):t;dphelper.cookie.delete(n.trim())}}};dphelper?.setDescription({name:"cookie",active:!0,subCommand:[{name:"set",version:"0.0.2",example:"dphelper.cookie.set({name, value, time, path = '/'})",description:"Creates a cookie with specified properties.",author:"Dario Passariello",creationDate:"20210101",lastMod:"20240613",type:"function",active:!0,env:"client",subCommand:[]},{name:"get",version:"0.0.2",example:"dphelper.cookie.get(name)",description:"Retrieves the value of a specified cookie.",author:"Dario Passariello",creationDate:"20210101",lastMod:"20240613",type:"function",active:!0,env:"client",subCommand:[]},{name:"delete",version:"0.0.2",example:"dphelper.cookie.delete(name)",description:"Deletes a specified cookie.",author:"Dario Passariello",creationDate:"20210101",lastMod:"20240613",type:"function",active:!0,env:"client",subCommand:[]},{name:"removeAll",version:"0.0.2",example:"dphelper.cookie.removeAll()",description:"Clears all cookies.",author:"Dario Passariello",creationDate:"20210101",lastMod:"20240613",type:"function",active:!0,env:"client",subCommand:[]}]},w);var x={name:"coords",active:!0,subCommand:[{name:"degreesToRadians",version:"0.0.2",example:"dphelper.coords.degreesToRadians(45)",author:"Dario Passariello",creationDate:"2021-01-01",lastMod:"2021-01-01",type:"function",active:!0,description:"Convert degrees to radians",env:"client",subCommand:[]},{name:"latToMeters",version:"0.0.2",example:"dphelper.coords.latToMeters([40.689202777778, -74.044219444444])",author:"Dario Passariello",creationDate:"2021-01-01",lastMod:"2021-01-01",type:"function",active:!0,description:"Convert latitude to meters",env:"client",subCommand:[]},{name:"toVector",version:"0.0.2",example:"dphelper.coords.toVector([40.689202777778, -74.044219444444, 1])",author:"Dario Passariello",creationDate:"2021-01-01",lastMod:"2021-01-01",type:"function",active:!0,description:"Convert coordinates to vector",env:"client",subCommand:[]},{name:"convertToDecDegrees",version:"0.0.2",example:"dphelper.coords.convertToDecDegrees([39, 5, 59, 'N'])",author:"Dario Passariello",creationDate:"2021-01-01",lastMod:"2021-01-01",type:"function",active:!0,description:"Convert coordinates to decimal degrees",env:"client",subCommand:[]},{name:"distance",version:"0.0.2",example:"dphelper.coords.distance([40.718788808171105, -74.0114768663747],[38.909309636475875, -77.01712459058946])",author:"Dario Passariello",creationDate:"2021-01-01",lastMod:"2021-01-01",type:"function",active:!0,description:"\n Haversine formula:\n a = sin²(Δφ/2) + cos φ1 ⋅ cos φ2 ⋅ sin²(Δλ/2)\n c = 2 ⋅ atan2( √a, √(1-a) )\n d = R ⋅ c\n where φ is latitude, λ is longitude, R is earth's radius (mean radius = 6,371km);\n note that angles need to be in radians to pass to trig functions!\n ",env:"client",subCommand:[]},{name:"polarToCartesian",version:"0.0.2",example:"dphelper.coords.polarToCartesian([centerX, centerY, radius, angleInDegrees])",author:"Dario Passariello",creationDate:"2024-09-28",lastMod:"2024-09-28",type:"function",active:!0,description:"Convert polar coordinates to Cartesian coordinates",env:"client",subCommand:[]},{name:"mapDegreesToPixels",version:"0.0.2",example:"dphelper.coords.mapDegreesToPixels([degree, minDegree, maxDegree, minPixel, maxPixel, padding])",author:"Dario Passariello",creationDate:"2024-09-28",lastMod:"2024-09-28",type:"function",active:!0,description:"Map degrees to pixels",env:"client",subCommand:[]}]},C=6371e3,M={degreesToRadians:e=>e*Math.PI/180,latToMeters:e=>{if(!Array.isArray(e))return;return C*Math.cos(e[0])*Math.cos(e[1])/1e3},toVector:e=>{if(!Array.isArray(e))return;return[C*Math.cos(e[1]*Math.PI/180)*Math.cos(e[0]*Math.PI/180),C*Math.cos(e[1]*Math.PI/180)*Math.sin(e[0]*Math.PI/180),C*Math.sin(e[2]*Math.PI/180)]},convertToDecDegrees:(e,t,o,a)=>{let n=e+t/60+o/3600;return"S"!==a&&"W"!==a||(n*=-1),n},distance:(e,t)=>{if(!Array.isArray(e)||!Array.isArray(t))return;const o=e[0]*Math.PI/180,a=t[0]*Math.PI/180,n=(t[0]-e[0])*Math.PI/180,r=(t[1]-e[1])*Math.PI/180,i=Math.sin(n/2)*Math.sin(n/2)+Math.cos(o)*Math.cos(a)*Math.sin(r/2)*Math.sin(r/2),s=2*Math.atan2(Math.sqrt(i),Math.sqrt(1-i)),l=C*s;return{km:Number((l/1e3).toFixed(2)),mi:Number((l/1e3*.621371).toFixed(2)),nMi:Number((l/1e3/1.852).toFixed(2))}},polarToCartesian:(e,t,o,a)=>{const n=(a-90)*Math.PI/180;return{x:e+o*Math.cos(n),y:t+o*Math.sin(n)}},mapDegreesToPixels:(e,t,o,a,n,r)=>{const i=n-(a+(e-t)/(o-t)*(n-a)-r)-r/20;return i<r?r:i}};dphelper?.setDescription(x,M);var S=globalThis.dphelper;S?.setDescription?.({name:"credits",active:!0,subCommand:[]},()=>{console.groupCollapsed("%cdphelper v3.3.7%c","color:orange",""),console.debug("%cdphelper v3.3.7%c by Dario Passariello started","color:orange",""),console.debug("name: %cdphelper","color:orange",""),console.debug("version: %c3.3.7","color:orange",""),console.groupEnd()});var P={en:["January","February","March","April","May","June","July","August","September","October","November","December"],it:["Gennaio","Febbraio","Marzo","Aprile","Maggio","Giugno","Luglio","Agosto","Settembre","Ottobre","Novembre","Dicembre"]},k={days:(e="en")=>({en:["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"],it:["lunedì","martedì","mercoledì","giovedì","venerdì","sabato","domenica"]}[e]),months:(e="en")=>P[e],year:()=>(new Date).getFullYear(),toIso:(e,t="en")=>{e||(e="");const o=new Date(e);if("Invalid Date"===String(o))return null;return new Intl.DateTimeFormat(t,{year:"numeric",month:"long",day:"numeric"}).format(o)},toMMDDYYYY:e=>{try{const t=new Date(e);return isNaN(t.getTime())?"":`0${t.getMonth()+1}`.slice(-2)+""+`0${t.getDate()}`.slice(-2)+t.getFullYear()}catch(e){return""}},toYYYYMMDD:e=>{if(e)return e.toISOString().split("T")[0].replaceAll("-","")},toHuman:e=>e.toLocaleDateString(void 0,{weekday:"long",year:"numeric",month:"long",day:"numeric"}),convert:(e,t)=>{if(!e)return null;t||(t=dphelper.date.months("en"));const o=e.substring(0,2).replace("0",""),a=e.substring(2,4),n=e.substring(e.length-4);return`${a} ${t[Number(o)-1]} ${n}`},iso2Epoch:e=>{e||(e="");return new Date(e).getTime()},localIsoTime:e=>{e||(e=new Date);const t=new Date(e);if(isNaN(t.getTime()))return"";const o=6e4*t.getTimezoneOffset();return new Date(Date.now()-o).toISOString().slice(0,-1)},utc:()=>(new Date).toUTCString(),parse:(e,t="/")=>{if(!e)return null;return e.substring(0,2)+t+e.substring(2,4)+t+e.substring(4,8)},addDays:(e,t)=>{const o=new Date(Number(e));return o.setDate(e.getDate()+t),o},dateTimeToString:e=>{try{return`${e.getFullYear()}${e.getMonth().toString().length>1?e.getMonth()+1:`0${e.getMonth()+1}`}\n ${e.getDate().toString().length>1?e.getDate():`0${e.getDate()}`}_${e.getHours()}${e.getMinutes()}${e.getSeconds()}`}catch(t){return console.error(t),e}},isoToHuman:(e,t="@")=>{if(!e)return null;const o=dphelper.date.months("en"),a=new Date(e),n=a.getFullYear(),r=e.split("T")[1].split(":").slice(0,2).join(":");let i=(a.getMonth()+1).toString(),s=a.getDate().toString();return s.length<2&&(s=`0${s}`),i.length<2&&(i=`0${i}`),`${s} ${o[Number(i)-1]} ${n} ${t} ${r}`},fullDate:()=>{const e=new Date,t=Number(e.getDate()),o=Number(e.getMonth()+1),a=Number(e.getFullYear()),n=Number(e.getHours()),r=Number(e.getMinutes()),i=Number(e.getSeconds());return(t<10?`0${t}`:t)+"-"+(o<10?`0${o}`:o)+"-"+a+" "+(n<10?`0${n}`:n)+":"+(r<10?`0${r}`:r)+":"+(i<10?`0${i}`:i)},epoch:()=>Date.now(),diffInDays:(e,t)=>{const o=t.getTime(),a=e.getTime();return Math.floor((o-a)/864e5)},diffInWeeks:(e,t)=>{const o=t.getTime(),a=e.getTime();return Number(Number.parseInt(String((o-a)/6048e5),10))},diffInMonths:(e,t)=>{const o=e.getFullYear(),a=t.getFullYear(),n=e.getMonth();return t.getMonth()+12*a-(n+12*o)},diffInYears:(e,t)=>t.getFullYear()-e.getFullYear(),dateToYMD:e=>{const t=e.getDate(),o=e.getMonth()+1;return`${e.getFullYear()}-${o<=9?`0${o}`:o}-${t<=9?`0${t}`:t}`},collection:({date:e=new Date,type:t="",locale:o="en-US"})=>{let a;switch(!e&&t&&o&&console.debug('\n "toDateString" -> Tue Jan 02 2024\n "toISOString" -> 2024-01-02T18:44:43.590Z\n "toJSON" -> 2024-01-02T18:44:43.590Z\n "toLocaleDateString" -> 1/2/2024\n "toLocaleString" -> 1/2/2024, 11:44:43 AM\n "toLocaleTimeString" -> 11:44:43 AM\n "toString" -> Tue Jan 02 2024 11:44:43 GMT-0700 (Mountain Standard Time)\n "toISOStringShort" -> 2024-01-02\n "toLocaleString (en-GB)" -> 02/01/2024, 11:47:56 am\n '),t){case"toDateString":a=e.toDateString();break;case"toISOString":a=e.toISOString();break;case"toJSON":a=e.toJSON();break;case"toLocaleDateString":a=e.toLocaleDateString(o);break;case"toLocaleString":a=e.toLocaleString(o);break;case"toLocaleTimeString":a=e.toLocaleTimeString(o);break;case"toString":a=e.toString();break;case"toISOStringShort":a=e.toISOString().slice(0,10)}return a},timeZones:()=>{const e=[],t=Intl.supportedValuesOf("timeZone");for(const o of t)e.push(o);return e}};dphelper?.setDescription({name:"date",active:!0,subCommand:[{name:"toIso",version:"0.0.2",example:"dphelper.date.toIso(value, 'en')",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:!0,description:"Converts a date value to ISO format.",env:"both",subCommand:[]},{name:"toMMDDYYYY",version:"0.0.2",example:"dphelper.date.toMMDDYYYY(value)",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:!0,description:"Converts a date value to MMDDYYYY format.",env:"both",subCommand:[]},{name:"toYYYYMMDD",version:"0.0.2",example:"dphelper.date.toYYYYMMDD(value)",author:"Dario Passariello",creationDate:"20230101",lastMod:"20260220",type:"function",active:!0,description:"Converts a date value to YYYYMMDD format.",env:"both",subCommand:[]},{name:"toHuman",version:"0.0.2",example:"dphelper.date.toHuman(value)",author:"Dario Passariello",creationDate:"20230101",lastMod:"20260220",type:"function",active:!0,description:"Converts a date value to a human-readable format.",env:"both",subCommand:[]},{name:"convert",version:"0.0.2",example:"dphelper.date.convert(value, format)",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:!0,description:"Converts a date value to a specified format.",env:"both",subCommand:[]},{name:"iso2Epoch",version:"0.0.2",example:"dphelper.date.iso2Epoch(value)",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:!0,description:"Converts an ISO date value to epoch time.",env:"both",subCommand:[]},{name:"localIsoTime",version:"0.0.2",example:"dphelper.date.localIsoTime(value)",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:!0,description:"Gets the local ISO time for a given date value.",env:"both",subCommand:[]},{name:"utc",version:"0.0.2",example:"dphelper.date.utc()",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:!0,description:"Gets the current UTC time.",env:"both",subCommand:[]},{name:"parse",version:"0.0.2",example:"dphelper.date.parse(value, '/')",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:!0,description:"Parses a date value with a specified separator.",env:"both",subCommand:[]},{name:"year",version:"0.0.2",example:"dphelper.date.year()",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:!0,description:"Gets the current year.",env:"both",subCommand:[]},{name:"addDays",version:"0.0.2",example:"dphelper.date.addDays(date, days)",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:!0,description:"Adds a specified number of days to a date.",env:"both",subCommand:[]},{name:"dateTimeToString",version:"0.0.2",example:"dphelper.date.dateTimeToString(dateObject)",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:!0,description:"Converts a date object to a string.",env:"both",subCommand:[]},{name:"isoToHuman",version:"0.0.2",example:"dphelper.date.isoToHuman(value, '@')",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:!0,description:"Converts an ISO date value to a human-readable format with a specified symbol.",env:"both",subCommand:[]},{name:"fullDate",version:"0.0.2",example:"dphelper.date.fullDate()",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:!0,description:"Gets the full date and time in the format DD-MM-YYYY HH:MM:SS.",env:"both",subCommand:[]},{name:"epoch",version:"0.0.2",example:"dphelper.date.epoch()",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:!0,description:"Gets the current epoch time.",env:"both",subCommand:[]},{name:"diffInDays",version:"0.0.2",example:"dphelper.date.diffInDays(d1, d2)",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:!0,description:"Calculates the difference in days between two dates.",env:"both",subCommand:[]},{name:"diffInWeeks",version:"0.0.2",example:"dphelper.date.diffInWeeks(d1, d2)",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:!0,description:"Calculates the difference in weeks between two dates.",env:"both",subCommand:[]},{name:"diffInMonths",version:"0.0.2",example:"dphelper.date.diffInMonths(d1, d2)",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:!0,description:"Calculates the difference in months between two dates.",env:"both",subCommand:[]},{name:"diffInYears",version:"0.0.2",example:"dphelper.date.diffInYears(d1, d2)",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:!0,description:"Calculates the difference in years between two dates.",env:"both",subCommand:[]},{name:"dateToYMD",version:"0.0.2",example:"dphelper.date.dateToYMD(date)",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:!0,description:"Converts a date to the format YYYY-MM-DD.",env:"both",subCommand:[]},{name:"collection",version:"0.0.2",example:"dphelper.date.collection()",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:!0,description:"Gets various date representations based on the type and locale.",env:"both",subCommand:[]},{name:"timeZones",version:"0.0.2",example:"dphelper.date.timeZones()",author:"Dario Passariello",creationDate:"20240901",lastMod:"20260220",type:"function",active:!0,description:"Returns an array of all supported timezones.",env:"both",subCommand:[]}]},k);var A={select:(e="body")=>{try{if("undefined"==typeof document)return;const t="string"==typeof e?document.querySelector(e):e;if(!t||"function"!=typeof t.addEventListener)return;const o=e=>{const t=e.target,o=t.tagName.toLowerCase();if(!["input","button","select","textarea"].includes(o)&&!t.classList.contains("selectable"))return document.querySelectorAll("*").forEach(e=>e.blur()),e.preventDefault(),!1;document.querySelectorAll("img, a, input, button").forEach(e=>{e.addEventListener("dragstart",e=>(e.preventDefault(),!1))})};t.addEventListener("mousedown",o),console.debug("%cSelection Disabled: %ctrue","color:orange","")}catch(e){console.debug("dphelper.disable.select:",e)}},spellCheck:(e=5e3)=>{setInterval(()=>{const e=document.querySelectorAll("input[type=text], textarea, code");for(const t of e)t.getAttribute("spellcheck")||t.setAttribute("spellcheck","false")},e)},rightClick:(e="body")=>{try{if("undefined"==typeof document)return;const t="string"==typeof e?document.querySelector(e):e;t&&"function"==typeof t.addEventListener&&t.addEventListener("contextmenu",e=>e.preventDefault())}catch(e){console.debug("dphelper.disable.rightClick:",e)}},copy:(e="body")=>{try{if("undefined"==typeof document)return;const t="string"==typeof e?document.querySelector(e):e;t&&"function"==typeof t.addEventListener&&t.addEventListener("copy",e=>e.preventDefault())}catch(e){console.debug("dphelper.disable.copy:",e)}},paste:(e="body")=>{try{if("undefined"==typeof document)return;const t="string"==typeof e?document.querySelector(e):e;t&&"function"==typeof t.addEventListener&&t.addEventListener("paste",e=>e.preventDefault())}catch(e){console.debug("dphelper.disable.paste:",e)}},cut:(e="body")=>{try{if("undefined"==typeof document)return;const t="string"==typeof e?document.querySelector(e):e;t&&"function"==typeof t.addEventListener&&t.addEventListener("cut",e=>e.preventDefault())}catch(e){console.debug("dphelper.disable.cut:",e)}},drag:(e="body")=>{try{if("undefined"==typeof document)return;const t="string"==typeof e?document.querySelector(e):e;t&&"function"==typeof t.addEventListener&&t.addEventListener("dragstart",e=>e.preventDefault())}catch(e){console.debug("dphelper.disable.drag:",e)}}};dphelper?.setDescription?.({name:"disable",active:!0,subCommand:[{name:"select",version:"0.0.2",example:"dphelper.disable.select([el = 'body'])",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:!0,description:"Disable text selection on the specified element.",env:"client",subCommand:[]},{name:"spellCheck",version:"0.0.2",example:"dphelper.disable.spellCheck([tmr = 5000])",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:!0,description:"Disable spell check on the specified element after a delay.",env:"client",subCommand:[]},{name:"rightClick",version:"0.0.2",example:"dphelper.disable.rightClick([el = 'body'])",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:!0,description:"Disable right-click context menu on the specified element.",env:"client",subCommand:[]},{name:"copy",version:"0.0.2",example:"dphelper.disable.copy([el = 'body'])",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:!0,description:"Disable copy functionality on the specified element.",env:"client",subCommand:[]},{name:"paste",version:"0.0.2",example:"dphelper.disable.paste([el = 'body'])",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:!0,description:"Disable paste functionality on the specified element.",env:"client",subCommand:[]},{name:"cut",version:"0.0.2",example:"dphelper.disable.cut([el = 'body'])",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:!0,description:"Disable cut functionality on the specified element.",env:"client",subCommand:[]},{name:"drag",version:"0.0.2",example:"dphelper.disable.drag([el = 'body'])",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:!0,description:"Disable drag functionality on the specified element.",env:"client",subCommand:[]}]},A);var T={},E={set:(e,t={})=>dispatchEvent(new CustomEvent(String(e),t)),listen:(e,t)=>{T[e]&&T[e].length>0&&dphelper.dispatch.remove(e);const o=e=>t?setTimeout(()=>t(e),0):null;window.addEventListener(e,o),T[e]||(T[e]=[]),T[e].push(o)},remove:e=>{const t=T[e];t&&(t.forEach(t=>window.removeEventListener(e,t)),delete T[e])}};dphelper?.setDescription({name:"dispatch",active:!0,subCommand:[{name:"set",version:"0.0.2",example:"dphelper.dispatch.set([name, value])",author:"Dario Passariello",creationDate:"20231231",lastMod:"20240612",type:"function",active:!0,description:"Dispatches a custom event with the specified name and value.",env:"client",subCommand:[]},{name:"listen",version:"0.0.2",example:"dphelper.dispatch.listen([eventNames, callback=null], flag = true)",author:"Dario Passariello",creationDate:"20231231",lastMod:"20240612",type:"function",active:!0,description:"Listens for the specified event names and executes the callback when the event is triggered.",env:"client",subCommand:[]},{name:"remove",version:"0.0.2",example:"dphelper.dispatch.remove([eventNames, callback=null], flag = true)",author:"Dario Passariello",creationDate:"20231231",lastMod:"20240612",type:"function",active:!0,description:"Removes the event listener for the specified event names.",env:"client",subCommand:[]}]},E);var N={fitScale:(e,t=1,o=!1)=>addEventListener("resize",a=>dphelper.element.scaleBasedOnWindow(e,t,o)),scaleBasedOnWindow:(e,t,o)=>{if(!e)return;const a="string"==typeof e?document.querySelector(e):e;if(!a)return;const n=a.offsetWidth||1,r=a.offsetHeight||1,i=o?t/Math.max(n/window.innerWidth,r/window.innerHeight):t/Math.min(n/window.innerWidth,r/window.innerHeight);a.style.transform=`scale(${i})`}};dphelper?.setDescription({name:"element",active:!0,subCommand:[{name:"fitScale",version:"0.0.2",example:"dphelper.element.fitScale([el = 'root', scale = 1, fit = false])",author:"Dario Passariello",creationDate:"20230527",lastMod:"20230527",type:"function",active:!0,description:"Scales an element based on the window size.",env:"client",subCommand:[]}]},N);var L={list:e=>window.getEventListeners(e),multi:(e,t,o)=>{const a=t.split(" ");for(const t of a)e.addEventListener(t,o,!1)},copy:e=>{const t=document.querySelector(e);t&&t.addEventListener("click",async e=>{if(navigator.clipboard)try{const t=e.target;t&&(await navigator.clipboard.writeText(t.textContent||""),alert("Copied"))}catch(e){console.error("Can't copy the value",e)}})},onDrag:e=>{const t=`.popup_overflow_${e}`,o=document.querySelector(t);if(!o)return;const a=o=>{const a=document.querySelector(t),n=a?.offsetHeight||0,r=a?.offsetWidth||0,i=Math.max(o.pageY,0)-n/2,s=Math.max(o.pageX,0)-r/2;localStorage.setItem(e,JSON.stringify([i,s]))};o.addEventListener("mousedown",()=>{window.addEventListener("mousemove",a)}),window.addEventListener("mouseup",()=>{window.removeEventListener("mousemove",a)})},keys:e=>({key:e.key,ctrl:e.ctrlKey,alt:e.altKey,shift:e.shiftKey})};dphelper?.setDescription({name:"event",active:!0,subCommand:[{name:"list",version:"0.0.2",example:"dphelper.event.list([element])",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:!0,description:"Show attached events.",env:"client",subCommand:[]},{name:"multi",version:"0.0.2",example:"dphelper.event.multi([element, eventNames, listener])",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:!0,description:"Attach multiple event listeners to an element.",env:"client",subCommand:[]},{name:"copy",version:"0.0.2",example:"dphelper.event.copy([element])",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:!0,description:"Copy text content of an element to the clipboard.",env:"client",subCommand:[]},{name:"onDrag",version:"0.0.2",example:"dphelper.event.onDrag([element])",author:"Dario Passariello",creationDate:"20230527",lastMod:"20230527",type:"function",active:!0,description:"Handle dragging functionality for elements.",env:"client",subCommand:[]},{name:"keys",version:"0.0.2",example:"dphelper.event.keys(e)",author:"Dario Passariello",creationDate:"20230527",lastMod:"20230527",type:"function",active:!0,description:"Return key event properties.",env:"client",subCommand:[]}]},L);var j=async(e,t={},o=3,a=1e3)=>{try{const a=await globalThis.fetch(e,t);if(!a.ok&&o>0)throw new Error(a.statusText);return a}catch(n){if(0===o)throw n;return console.warn(`[dphelper] Fetch failed, retrying in ${a}ms... (${o} retries left)`),await new Promise(e=>setTimeout(e,a)),j(e,t,o-1,2*a)}},q=(e,t)=>j(e,t);q.get=(e,t)=>j(e,{...t,method:"GET"}),q.post=(e,t,o={})=>{const a="object"==typeof t&&null!==t;return j(e,{...o,method:"POST",headers:{...a?{"Content-Type":"application/json"}:{},...o.headers||{}},body:a?JSON.stringify(t):t})},dphelper?.setDescription({name:"fetch",active:!0,subCommand:[{name:"get",version:"0.0.1",example:"dphelper.fetch.get('https://api.example.com')",author:"Dario Passariello",creationDate:"20260221",lastMod:"20260221",type:"function",active:!0,description:"Perform a GET request with automatic retries and exponential backoff.",env:"both",subCommand:[]},{name:"post",version:"0.0.1",example:"dphelper.fetch.post('/api', { data: 123 })",author:"Dario Passariello",creationDate:"20260221",lastMod:"20260221",type:"function",active:!0,description:"Perform a POST request with JSON support.",env:"both",subCommand:[]}]},q);var $={serialize:e=>{const t="string"==typeof e?document.querySelector(e):e;if(!t)return{};const o={};if(!/[a-zA-Z][a-zA-Z0-9-_.]/.test(t.name))return;const a=(e,t)=>{let o=e[0];"]"===o.slice(-1)&&(o=o.slice(0,-1));const n={};return 1===e.length?n[o]=(e=>(""===e&&(e=null),"null"===e&&(e=null),"undefined"===e&&(e=void 0),"false"===e&&(e=Boolean(!1)),"true"===e&&(e=Boolean(!0)),"off"===e&&(e=Boolean(!1)),"on"===e&&(e=Boolean(!0)),"[]"===e&&(e=Array),"{}"===e&&(e=Object),0!==["null","undefined","false","true","on","off"].filter(t=>t.includes(e)).length||Number.isNaN(e)||(e=Number(e)),e))(t):(e.shift(),n[o]=a(e,t)),n},n=t.serializeArray();for(const e of n){const t=e.value,n=e.name.split("["),r=a(n,t);Object.assign(o,r)}return o},confirmType:(e,t)=>{if("number"===e){return/^\d+$/.test(t.toString())}if("email"===e){return/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/.test(t.toString().toLowerCase())}return!0},required:e=>null==e?"Required":void 0,minLength:(e,t=1)=>!e||e.length<t?"Must Enter a Value":void 0,maxLength:(e,t=10)=>e.length>t?"Exceeds Max Length":void 0,maxPhoneNumber:(e,t=10)=>e.toString().length>t?"Exceeds Max Length":void 0,isNumeric:e=>!Number.isNaN(e),isEmail:e=>/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/.test(e.toString().toLowerCase()),pattern:e=>{const t=e.target;if(!t.type||!t.value)return;let o;switch(t.type){case"text":case"password":o=/^[a-zA-Z0-9.\- !$@]+$/;break;case"email":o=/^([a-zA-Z0-9._%-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,6})*$/;break;case"number":o=/^[0-9\-+]*$/;break;case"tel":o=/^[0-9\s()\-+]*$/;break;default:return}t.value.match(o)||(t.value=t.value.slice(0,-1),e.preventDefault())},noSpecialChars:e=>{const t=e.target,o=t.value.trim();o.length>2&&(t.value=o.replace(/[^\w\s]/gi,""))},table:(e,t,o)=>{const a=e[0]||7,n=e[1]||24,r=e=>String(e).replace(/[&<>"']/g,e=>({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"}[e]||e));let i=`<form id='${r(t)}'>`;i+="<div class='table'>",i+="<div class='title'>";for(let e=1;e<=a;e++)i+=`<span>${e}</span>`;i+="</div>";for(let e=1;e<=n;e++){i+=`<div class='row'><span>${e}</span>`;for(let t=1;t<=a;t++)i+=`<input name='data[${t}][${e}]' tabindex='${t.toString().padStart(2,"0")}${e.toString().padStart(2,"0")}' type='number' onclick="this.select()" value='${Math.floor(100*Math.random())}' title='${r(t)} to ${r(e)}' />`;i+="</div>"}i+="</div>",i+="</form>",o&&(o.innerHTML=i)},sanitize:e=>{if(e)return e.replace(/[^\w ]/g,"").replace(/[&/\\#, +()$~%.'":*?<>{}]/g,"")}};dphelper?.setDescription({name:"form",active:!0,subCommand:[{name:"serialize",version:"0.0.2",example:"dphelper.form.serialize([form])",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:!0,description:"Serialize form data into an object.",env:"client",subCommand:[]},{name:"confirmType",version:"0.0.2",example:"dphelper.form.confirmType([type, value])",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:!0,description:"Confirm the type of a value.",env:"client",subCommand:[]},{name:"required",version:"0.0.2",example:"dphelper.form.required([value])",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:!0,description:"Check if a value is required.",env:"client",subCommand:[]},{name:"minLength",version:"0.0.2",example:"dphelper.form.minLength([value, num = 1])",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:!0,description:"Check if a value meets the minimum length.",env:"client",subCommand:[]},{name:"maxLength",version:"0.0.2",example:"dphelper.form.maxLength([value, num = 10])",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:!0,description:"Check if a value exceeds the maximum length.",env:"client",subCommand:[]},{name:"maxPhoneNumber",version:"0.0.2",example:"dphelper.form.maxPhoneNumber([value, num = 10])",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:!0,description:"Check if a phone number exceeds the maximum length.",env:"client",subCommand:[]},{name:"isNumeric",version:"0.0.2",example:"dphelper.form.isNumeric([value])",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:!0,description:"Check if a value is numeric.",env:"client",subCommand:[]},{name:"isEmail",version:"0.0.2",example:"dphelper.form.isEmail([value])",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:!0,description:"Validate an email format.",env:"client",subCommand:[]},{name:"pattern",version:"0.0.2",example:"dphelper.form.pattern(event)",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:!0,description:"Pattern validation using onChange on inputs when you provide a pattern.",env:"client",subCommand:[]},{name:"noSpecialChars",version:"0.0.2",example:"dphelper.form.noSpecialChars(event)",author:"Dario Passariello",creationDate:"20230527",lastMod:"20230527",type:"function",active:!0,description:"Avoid special characters in an input.",env:"client",subCommand:[]},{name:"table",version:"0.0.2",example:"dphelper.form.table(size = [7, 24], id, elem)",author:"Dario Passariello",creationDate:"20240101",lastMod:"20240101",type:"function",active:!0,description:"Generate a table (default 7x24).",env:"client",subCommand:[]},{name:"sanitize",version:"0.0.2",example:"dphelper.form.sanitize(input)",author:"Dario Passariello",creationDate:"20240318",lastMod:"20240318",type:"function",active:!0,description:"Sanitize input value to avoid injection.",env:"client",subCommand:[]}]},$);var I={currency:(e,t="en-US",o="USD")=>new Intl.NumberFormat(t,{style:"currency",currency:o}).format(e),phoneNumber:(e,t="US")=>{const o=`${e}`.replace(/\D/g,"");let a;return"US"===t&&(a=o.match(/^(\d{3})(\d{3})(\d{4})$/),a)?`(${a[1]}) ${a[2]}-${a[3]}`:e}};dphelper?.setDescription({name:"format",active:!0,subCommand:[{name:"currency",version:"0.0.2",example:"dphelper.format.currency(value, locale, currency)",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:!0,description:"Format a number as currency.",env:"both",subCommand:[]},{name:"phoneNumber",version:"0.0.2",example:"dphelper.format.phoneNumber(value, countryCode)",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:!0,description:"Format a string as a phone number.",env:"both",subCommand:[]}]},I);var O=new Map,R="en";O.set("en",{hello:"Hello {name}!",goodbye:"Goodbye!",welcome:"Welcome to our app!",loading:"Loading...",error:"An error occurred",success:"Success!",confirm:"Are you sure?",cancel:"Cancel",save:"Save",delete:"Delete",edit:"Edit",close:"Close"});var z={setLocale:e=>{R=e,"auto"===e&&"undefined"!=typeof navigator&&(R=navigator.language.split("-")[0]||"en")},getLocale:()=>R,addTranslations:(e,t)=>{const o=O.get(e)||{};O.set(e,{...o,...t})},t:(e,t={})=>{let o=(O.get(R)||O.get("en")||{})[e]||e;return Object.entries(t).forEach(([e,t])=>{o=o.replace(new RegExp(`\\{${e}\\}`,"g"),String(t))}),o},pluralize:(e,t,o)=>{const a=o||R;if(0===e&&t.zero)return t.zero;if(1===e)return t.one||t.other||"";if(2===e&&t.two)return t.two;if("pl"===a&&e%10>=2&&e%10<=4&&(e%100<10||e%100>=20))return t.few||t.other||"";if("ru"===a||"uk"===a){if(e%10==1&&e%100!=11)return t.one||t.other||"";if(e%10>=2&&e%10<=4&&(e%100<10||e%100>=20))return t.few||t.other||""}return t.other||String(e)},number:(e,t,o)=>{const a=t||R;return new Intl.NumberFormat(a,o).format(e)},date:(e,t,o)=>{const a=t||R,n="number"==typeof e?new Date(e):e;return new Intl.DateTimeFormat(a,o).format(n)},relativeTime:(e,t)=>{const o=t||R,a=Date.now()-("number"==typeof e?e:e.getTime()),n=new Intl.RelativeTimeFormat(o,{numeric:"auto"}),r=Math.floor(a/1e3),i=Math.floor(r/60),s=Math.floor(i/60),l=Math.floor(s/24),c=Math.floor(l/7),d=Math.floor(l/30),p=Math.floor(l/365);return Math.abs(r)<60?n.format(-r,"second"):Math.abs(i)<60?n.format(-i,"minute"):Math.abs(s)<24?n.format(-s,"hour"):Math.abs(l)<7?n.format(-l,"day"):Math.abs(c)<4?n.format(-c,"week"):Math.abs(d)<12?n.format(-d,"month"):n.format(-p,"year")},list:(e,t,o)=>{const a=t||R;return new Intl.ListFormat(a,o).format(e)},getSupportedLocales:()=>Array.from(O.keys())};dphelper?.setDescription({name:"i18n",active:!0,subCommand:[{name:"setLocale",version:"0.0.1",example:"dphelper.i18n.setLocale('it')",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:!0,description:"Set the current locale",env:"both",subCommand:[]},{name:"t",version:"0.0.1",example:"dphelper.i18n.t('hello', { name: 'World' })",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:!0,description:"Translate a key with optional interpolation",env:"both",subCommand:[]},{name:"addTranslations",version:"0.0.1",example:"dphelper.i18n.addTranslations('it', { hello: 'Ciao {name}!' })",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:!0,description:"Add translation strings for a locale",env:"both",subCommand:[]},{name:"getLocale",version:"0.0.1",example:"dphelper.i18n.getLocale()",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:!0,description:"Get the current locale",env:"both",subCommand:[]},{name:"pluralize",version:"0.0.1",example:"dphelper.i18n.pluralize(5, { one: 'item', other: 'items' })",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:!0,description:"Get pluralized string based on count",env:"both",subCommand:[]},{name:"number",version:"0.0.1",example:"dphelper.i18n.number(1234.56, 'de-DE', { style: 'currency', currency: 'EUR' })",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:!0,description:"Format a number according to locale",env:"both",subCommand:[]},{name:"date",version:"0.0.1",example:"dphelper.i18n.date(new Date(), 'en-US', { dateStyle: 'long' })",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:!0,description:"Format a date according to locale",env:"both",subCommand:[]},{name:"relativeTime",version:"0.0.1",example:"dphelper.i18n.relativeTime(Date.now() - 3600000)",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:!0,description:"Get relative time string (e.g., '2 hours ago')",env:"both",subCommand:[]},{name:"list",version:"0.0.1",example:"dphelper.i18n.list(['a', 'b', 'c'], 'en')",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:!0,description:"Format a list according to locale",env:"both",subCommand:[]},{name:"getSupportedLocales",version:"0.0.1",example:"dphelper.i18n.getSupportedLocales()",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:!0,description:"Get list of supported locales",env:"both",subCommand:[]}]},z);var U=new Map,F=(e,t=1,o={})=>new Promise((a,n)=>{if(U.has(e))return void a(U.get(e));const r=indexedDB.open(e,t);r.onerror=()=>n(new Error(`Failed to open database: ${e}`)),r.onsuccess=()=>{const t=r.result;U.set(e,t),a(t)},r.onupgradeneeded=e=>{const t=e.target.result;Array.from(t.objectStoreNames).forEach(e=>{o[e]||t.deleteObjectStore(e)}),Object.entries(o).forEach(([e,o])=>{const{keyPath:a,autoIncrement:n,indexes:r}=(e=>{const[t,o]=e.split(":").map(e=>e.trim()),a=t||"store";if(!o)return{name:a,keyPath:"id",autoIncrement:!0,indexes:[]};const n=o.split(",").map(e=>e.trim()),r=n.find(e=>e.includes("++")||e.includes("*"));return{name:a,keyPath:r?r.replace("++","").replace("*",""):"id",autoIncrement:!!n.find(e=>e.includes("++")),indexes:n.filter(e=>!e.includes("++")&&!e.includes("*")).map(e=>({name:e,keyPath:e,unique:e.endsWith("!")}))}})(o);if(!t.objectStoreNames.contains(e)){const o=t.createObjectStore(e,{keyPath:a,autoIncrement:n});r.forEach(e=>{o.createIndex(e.name,e.keyPath,{unique:e.unique})})}})}}),H={open:F,put:async(e,t,o)=>{const a=await F(e);return new Promise((e,n)=>{const r=a.transaction(t,"readwrite").objectStore(t).put(o);r.onsuccess=()=>e(r.result),r.onerror=()=>n(new Error("Failed to put record"))})},get:async(e,t,o)=>{const a=await F(e);return new Promise((e,n)=>{const r=a.transaction(t,"readonly").objectStore(t).get(o);r.onsuccess=()=>e(r.result),r.onerror=()=>n(new Error(`Failed to get key: ${o}`))})},getAll:async(e,t)=>{const o=await F(e);return new Promise((e,a)=>{const n=o.transaction(t,"readonly").objectStore(t).getAll();n.onsuccess=()=>e(n.result||[]),n.onerror=()=>a(new Error("Failed to get all records"))})},delete:async(e,t,o)=>{const a=await F(e);return new Promise((e,n)=>{const r=a.transaction(t,"readwrite").objectStore(t).delete(o);r.onsuccess=()=>e(),r.onerror=()=>n(new Error(`Failed to delete key: ${o}`))})},clear:async(e,t)=>{const o=await F(e);return new Promise((e,a)=>{const n=o.transaction(t,"readwrite").objectStore(t).clear();n.onsuccess=()=>e(),n.onerror=()=>a(new Error("Failed to clear store"))})},count:async(e,t)=>{const o=await F(e);return new Promise((e,a)=>{const n=o.transaction(t,"readonly").objectStore(t).count();n.onsuccess=()=>e(n.result),n.onerror=()=>a(new Error("Failed to count records"))})},query:async(e,t,o,a,n)=>{const r=await F(e);return new Promise((e,i)=>{const s=r.transaction(t,"readonly").objectStore(t).index(o),l=[],c=s.openCursor(n?.range,n?.direction||"next");c.onsuccess=t=>{const r=t.target.result;r&&(!n?.limit||l.length<n.limit)?(void 0!==a&&r.value[o]!==a||l.push(r.value),r.continue()):e(l)},c.onerror=()=>i(new Error("Failed to query records"))})},bulkPut:async(e,t,o)=>{const a=await F(e);return new Promise((e,n)=>{const r=a.transaction(t,"readwrite"),i=r.objectStore(t),s=[];o.forEach(e=>{const t=i.put(e);t.onsuccess=()=>s.push(t.result)}),r.oncomplete=()=>e(s),r.onerror=()=>n(new Error("Failed to bulk put records"))})},close:e=>{const t=U.get(e);t&&(t.close(),U.delete(e))}};dphelper?.setDescription({name:"idb",active:!0,subCommand:[{name:"open",version:"0.0.1",example:"dphelper.idb.open('mydb', 1, { users: 'id++,name,email' })",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:!0,description:"Open or create an IndexedDB database",env:"client",subCommand:[]},{name:"put",version:"0.0.1",example:"dphelper.idb.put('mydb', 'users', { name: 'John', email: 'john@example.com' })",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:!0,description:"Insert or update a record in an object store",env:"client",subCommand:[]},{name:"get",version:"0.0.1",example:"dphelper.idb.get('mydb', 'users', 1)",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:!0,description:"Get a record by key from an object store",env:"client",subCommand:[]},{name:"getAll",version:"0.0.1",example:"dphelper.idb.getAll('mydb', 'users')",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:!0,description:"Get all records from an object store",env:"client",subCommand:[]},{name:"delete",version:"0.0.1",example:"dphelper.idb.delete('mydb', 'users', 1)",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:!0,description:"Delete a record by key from an object store",env:"client",subCommand:[]},{name:"clear",version:"0.0.1",example:"dphelper.idb.clear('mydb', 'users')",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:!0,description:"Clear all records from an object store",env:"client",subCommand:[]},{name:"count",version:"0.0.1",example:"dphelper.idb.count('mydb', 'users')",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:!0,description:"Count records in an object store",env:"client",subCommand:[]},{name:"query",version:"0.0.1",example:"dphelper.idb.query('mydb', 'users', 'name', 'John')",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:!0,description:"Query records by index with optional range",env:"client",subCommand:[]},{name:"bulkPut",version:"0.0.1",example:"dphelper.idb.bulkPut('mydb', 'users', [{name: 'A'}, {name: 'B'}])",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:!0,description:"Insert or update multiple records at once",env:"client",subCommand:[]},{name:"close",version:"0.0.1",example:"dphelper.idb.close('mydb')",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:!0,description:"Close a database connection",env:"client",subCommand:[]}]},H);var _=(e,t)=>{const o=document.createElement("canvas");return o.width=e,o.height=t,o},W=e=>new Promise((t,o)=>{const a=new Image;a.onload=()=>t(a),a.onerror=o,a.src=e}),B=(e,t)=>{const o=[];void 0!==t.brightness&&o.push(`brightness(${t.brightness})`),void 0!==t.contrast&&o.push(`contrast(${t.contrast})`),void 0!==t.saturate&&o.push(`saturate(${t.saturate})`),void 0!==t.hueRotate&&o.push(`hue-rotate(${t.hueRotate}deg)`),void 0!==t.invert&&o.push(`invert(${t.invert})`),void 0!==t.sepia&&o.push(`sepia(${t.sepia})`),void 0!==t.blur&&o.push(`blur(${t.blur}px)`),void 0!==t.grayscale&&o.push(`grayscale(${t.grayscale})`);const a=_(e.width,e.height),n=a.getContext("2d");return n.filter=o.join(" "),n.drawImage(e,0,0),a.toDataURL("image/png")},J={resize:(e,t,o,a="auto")=>{const n=_(t,o),r=n.getContext("2d");return r.imageSmoothingEnabled="pixelated"!==a,r.imageSmoothingQuality="high",r.drawImage(e,0,0,t,o),n.toDataURL("image/png")},crop:(e,t)=>{const o=_(t.width,t.height);return o.getContext("2d").drawImage(e,t.x,t.y,t.width,t.height,0,0,t.width,t.height),o.toDataURL("image/png")},toDataURL:(e,t="image/png",o=.92)=>{const a=_(e.width,e.height),n=a.getContext("2d");return HTMLImageElement,n.drawImage(e,0,0),a.toDataURL(t,o)},fromDataURL:e=>W(e),filter:B,rotate:(e,t)=>{const o=t*Math.PI/180,a=Math.abs(Math.sin(o)),n=Math.abs(Math.cos(o)),r=e.width*n+e.height*a,i=e.width*a+e.height*n,s=_(r,i),l=s.getContext("2d");return l.translate(r/2,i/2),l.rotate(o),l.drawImage(e,-e.width/2,-e.height/2),s.toDataURL("image/png")},flip:(e,t)=>{const o=_(e.width,e.height),a=o.getContext("2d");return"horizontal"===t?(a.translate(e.width,0),a.scale(-1,1)):(a.translate(0,e.height),a.scale(1,-1)),a.drawImage(e,0,0),o.toDataURL("image/png")},grayscale:e=>B(e,{grayscale:1}),blur:(e,t)=>B(e,{blur:t}),getDimensions:e=>({width:e.width,height:e.height}),load:W,composite:(e,t,o="source-over",a=0,n=0)=>{const r=Math.max(e.width,t.width+a),i=Math.max(e.height,t.height+n),s=_(r,i),l=s.getContext("2d");return l.drawImage(e,0,0),l.globalCompositeOperation=o,l.drawImage(t,a,n),s.toDataURL("image/png")}};dphelper?.setDescription({name:"image",active:!0,subCommand:[{name:"resize",version:"0.0.1",example:"dphelper.image.resize(img, 100, 100)",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:!0,description:"Resize an image to specified dimensions",env:"client",subCommand:[]},{name:"crop",version:"0.0.1",example:"dphelper.image.crop(img, { x: 0, y: 0, width: 100, height: 100 })",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:!0,description:"Crop an image to specified region",env:"client",subCommand:[]},{name:"toDataURL",version:"0.0.1",example:"dphelper.image.toDataURL(img, 'image/webp', 0.8)",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:!0,description:"Convert image to data URL with optional format and quality",env:"client",subCommand:[]},{name:"fromDataURL",version:"0.0.1",example:"dphelper.image.fromDataURL(dataUrl)",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:!0,description:"Create an Image element from a data URL",env:"client",subCommand:[]},{name:"filter",version:"0.0.1",example:"dphelper.image.filter(img, { brightness: 1.2, contrast: 1.1 })",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:!0,description:"Apply CSS filters to an image",env:"client",subCommand:[]},{name:"rotate",version:"0.0.1",example:"dphelper.image.rotate(img, 90)",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:!0,description:"Rotate an image by degrees",env:"client",subCommand:[]},{name:"flip",version:"0.0.1",example:"dphelper.image.flip(img, 'horizontal')",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:!0,description:"Flip an image horizontally or vertically",env:"client",subCommand:[]},{name:"grayscale",version:"0.0.1",example:"dphelper.image.grayscale(img)",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:!0,description:"Convert image to grayscale",env:"client",subCommand:[]},{name:"blur",version:"0.0.1",example:"dphelper.image.blur(img, 5)",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:!0,description:"Apply blur effect to an image",env:"client",subCommand:[]},{name:"getDimensions",version:"0.0.1",example:"dphelper.image.getDimensions(img)",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:!0,description:"Get image dimensions",env:"client",subCommand:[]},{name:"load",version:"0.0.1",example:"dphelper.image.load('image.jpg')",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:!0,description:"Load an image from URL",env:"client",subCommand:[]},{name:"composite",version:"0.0.1",example:"dphelper.image.composite(img1, img2, 'multiply')",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:!0,description:"Composite two images together",env:"client",subCommand:[]}]},J);var G={counter:(e,t,o)=>e?t&&o?e.items&&Array.isArray(e.items)?e.items.filter(e=>e[t]===o).length:Object.keys(e).length:0:null,toCsv:e=>{const t=e,o=(e,t)=>null===t?"":t,a=Object.keys(t[0]),n=t.map(e=>a.map(t=>JSON.stringify(e[t],o)).join(","));return n.unshift(a.join(",")),n.join("\r\n")},saveCsvAs:(e,t)=>{const o=new Blob([e],{type:"text/csv;charset=utf-8;"}),a=document.createElement("a"),n=`${t}_${dphelper.date.dateTimeToString(new Date(Date.now()))}.csv`,r=URL.createObjectURL(o);a.setAttribute("href",r),a.setAttribute("download",n),a.style.visibility="hidden",document.body.appendChild(a),a.click(),document.body.removeChild(a)},is:e=>{try{JSON.parse(e)}catch(e){return console.warn(e),!1}return!0},parse:e=>{try{return JSON.parse(e)}catch(e){return console.warn(e),"Json not parsable"}},sanitize:e=>{if(!e)return"{}";return"{"+e.trim().replace(/^\{/,"").replace(/\}$/,"").split(/,(?=(?:[^"]*"[^"]*")*[^"]*$)/).map(e=>{const[t,...o]=e.split(":"),a=dphelper.json.sanitizeJsonValue(t?.trim()??"");if(!t)return"";let n=o.join(":");return n?(n=n.trim(),n="null"===n?'""':"true"===n||"false"===n||/^\d+$/.test(n)?`"${n}"`:dphelper.json.sanitizeJsonValue(n)):n='""',`${a}:${n}`}).filter(e=>""!==e).join(",")+"}"},sanitizeJsonValue:e=>e?`"${e.replace(/^"(.*)"$/,"$1").replace(/\\/g,"").replace(/\//g,"/").replace(/\n/g,"\\n").replace(/\f/g,"\\f").replace(/\r/g,"\\r").replace(/"/g,'\\"').replace(/\t/g," ").trim()}"`:'""'};dphelper?.setDescription({name:"json",active:!0,subCommand:[{name:"counter",version:"0.0.2",example:"dphelper.json.counter()",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:!0,description:"Count occurrences of a key-value pair in a JSON object.",env:"both",subCommand:[]},{name:"toCsv",version:"0.0.2",example:"dphelper.json.toCsv()",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:!0,description:"Convert JSON data to CSV format.",env:"both",subCommand:[]},{name:"saveCsvAs",version:"0.0.2",example:"dphelper.json.saveCsvAs()",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:!0,description:"Save CSV data as a file.",env:"both",subCommand:[]},{name:"is",version:"0.0.2",example:"dphelper.json.is()",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:!0,description:"Check if a string is valid JSON.",env:"both",subCommand:[]},{name:"parse",version:"0.0.2",example:"dphelper.json.parse()",author:"Dario Passariello",creationDate:"20241107",lastMod:"20241107",type:"function",active:!0,description:"Parse a JSON string.",env:"both",subCommand:[]},{name:"sanitize",version:"0.0.2",example:"dphelper.json.sanitize()",author:"Dario Passariello",creationDate:"20241107",lastMod:"20241107",type:"function",active:!0,description:"Sanitize a JSON string.",env:"both",subCommand:[]},{name:"sanitizeJsonValue",version:"0.0.2",example:"dphelper.json.sanitizeJsonValue()",author:"Dario Passariello",creationDate:"20241107",lastMod:"20241107",type:"function",active:!0,description:"Sanitize individual JSON values.",env:"both",subCommand:[]}]},G);var Y={all:(e,t="")=>{if(e)if(t&&!window.cacheName&&(window.cacheName=[]),"object"!=typeof e||e.keys){if("function"==typeof e&&e.keys)for(const o of e.keys())t&&window.cacheName.push(o),e(o)}else for(const o in e)t&&window.cacheName.push(o)},file:()=>null,fileToElement:async(e,t)=>{try{const o=await dphelper.load.file(t),a=document.querySelector(e);a?a.innerHTML=dphelper.sanitize.html(o):console.error(`Element not found: ${e}`)}catch(e){console.error("Error loading file to element:",e)}},script:(e,t="html")=>{const o=document.querySelector(t);if(o)for(const t of e){const e=document.createElement("script");e.src=t,e.async=!0,e.defer=!0,o.appendChild(e)}else console.error(`Element not found: ${t}`)},toJson:(e,t="")=>{const o={};if(e){if(t&&(o[t]=[]),"object"!=typeof e||e.keys){if("function"==typeof e&&e.keys)for(const a of e.keys())t&&o[t]&&o[t].push(a),e(a)}else for(const a in e)t&&o[t]&&o[t].push(a);t&&o[t]&&Object.defineProperty(window,t,{value:dphelper.array.pathToJson(o[t]),writable:!1,enumerable:!1,configurable:!1})}}};dphelper?.setDescription?.({name:"load",active:!0,subCommand:[{name:"all",version:"0.0.3",example:"dphelper.load.all(import.meta.glob('./Scripts/*.ts', { eager: true }))",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260228",type:"function",active:!0,description:"Load all files from a glob object (Vite/esbuild) or require context. If you add a 'cacheName', the list is stored in cache.",env:"client",subCommand:[]},{name:"file",version:"0.0.2",example:"dphelper.load.file(filePath)",author:"Dario Passariello",creationDate:"20240101",lastMod:"20240101",type:"function",active:!0,description:"Load a specific file.",env:"client",subCommand:[]},{name:"fileToElement",version:"0.0.2",example:"dphelper.load.fileToElement(filePath, elementSelector)",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:!0,description:"Load a file and insert its content into an element.",env:"client",subCommand:[]},{name:"script",version:"0.0.2",example:"dphelper.load.script(scripts, elementSelector)",author:"Dario Passariello",creationDate:"20240525",lastMod:"20240525",type:"function",active:!0,description:"Append script tags to an element.",env:"client",subCommand:[]},{name:"toJson",version:"0.0.3",example:"dphelper.load.toJson(import.meta.glob('./router/*.ts', { eager: true }), 'router')",author:"Dario Passariello",creationDate:"20250101",lastMod:"20260228",type:"function",active:!0,description:"Create JSON from folder recursion using glob object.",env:"client",subCommand:[]}]},Y);var V={log:[]},Z={list:()=>V.log,reg:e=>{V.log.push({type:"reg",message:e}),V.log.length>1e3&&V.log.shift()},debug:e=>{V.log.push({type:"debug",message:e}),V.log.length>1e3&&V.log.shift()},error:e=>{V.log.push({type:"error",message:e}),V.log.length>1e3&&V.log.shift()}};Object.defineProperty(V,"log",{writable:!1,enumerable:!1,configurable:!1}),dphelper?.setDescription({name:"logging",active:!0,subCommand:[{name:"list",version:"0.0.2",example:"dphelper.log.list()",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:!0,description:"List all log entries.",env:"both",subCommand:[]},{name:"reg",version:"0.0.2",example:"dphelper.log.reg('message')",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:!0,description:"Log a regular message.",env:"both",subCommand:[]},{name:"debug",version:"0.0.2",example:"dphelper.log.debug('message')",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:!0,description:"Log a debug message.",env:"both",subCommand:[]},{name:"error",version:"0.0.2",example:"dphelper.log.error('message')",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:!0,description:"Log an error message.",env:"both",subCommand:[]}]},Z);var K={rnd:()=>Math.floor(1e5+Math.random()*dphelper.math.tmr()),tmr:()=>Math.round(dphelper.date.epoch()/1e3),isOdd:e=>Number(e)%2!=0,percent:(e,t)=>{if(0===t)throw new Error("Total cannot be zero");return Number(e)/Number(t)*100},isPrime:e=>{if(Number(e)<=1)return!1;for(let t=2;t<=Math.sqrt(Number(e));t++)if(Number(e)%t===0)return!1;return!0}};dphelper?.setDescription({name:"math",active:!0,subCommand:[{name:"rnd",version:"0.0.2",example:"dphelper.math.rnd()",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:!0,description:"Generate a random number.",env:"both",subCommand:[]},{name:"tmr",version:"0.0.2",example:"dphelper.math.tmr()",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:!0,description:"Measure the time taken by a function.",env:"both",subCommand:[]},{name:"isOdd",version:"0.0.2",example:"dphelper.math.isOdd(a)",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:!0,description:"Check if a number is odd.",env:"both",subCommand:[]},{name:"percent",version:"0.0.2",example:"dphelper.math.percent([n, tot])",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:!0,description:"Calculate the percentage of a number relative to a total. Example: total: 100, number: 25 -> 25%",env:"both",subCommand:[]},{name:"isPrime",version:"0.0.2",example:"dphelper.math.isPrime(a)",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:!0,description:"Check if a number is prime.",env:"both",subCommand:[]}]},K);var X={lock:e=>{if(!e)return;const t=window,o=e.split(".");if(o.length<2)return;const a=o[0],n=o[1];if(!a||!n)return;const r=t[a];r&&Object.defineProperty(r,n,{writable:!1,configurable:!1})},unlock:e=>{if(!e)return;const t=window,o=e.split(".");if(o.length<2)return;const a=o[0],n=o[1];if(!a||!n)return;const r=t[a];if(r)try{Object.defineProperty(r,n,{writable:!0,configurable:!0})}catch(e){}}};dphelper?.setDescription({name:"memory",active:!0,subCommand:[{name:"lock",version:"0.0.2",example:"dphelper.memory.lock('state[key]')",author:"Dario Passariello",creationDate:"20230101",lastMod:"20230111",type:"function",active:!0,description:"Lock a state",env:"client",subCommand:[]},{name:"unlock",version:"0.0.2",example:"dphelper.memory.unlock('state[key]')",author:"Dario Passariello",creationDate:"20230101",lastMod:"20230111",type:"function",active:!0,description:"Unlock a state",env:"client",subCommand:[]}]},X);var Q={load:async e=>{const t=document.body;let o=e.startsWith("/")?e.split("/")[1]||"home":e;if(o&&""!==o||(o="home"),!document.querySelector(".loader")){const e=document.createElement("div");e.className="loader",e.innerHTML="<i></i>",e.style.opacity="0",e.style.transition="opacity 1000ms",t.appendChild(e),setTimeout(()=>e.style.opacity="1",10)}try{const e=await fetch(`${o}/`);if(!e.ok)throw new Error("Page not found");const a=await e.text(),n=a.match(/<body[^>]*>([\s\S]*)<\/body>/i),r=n?n[1]:a,i=e=>{const t=document.createElement("div");return t.textContent=e,t.innerHTML},s=dphelper?.sanitize?.html?dphelper.sanitize.html(r||""):i(r||"");t.innerHTML=s,window.scrollTo({top:0,behavior:"smooth"}),document.title=o.charAt(0).toUpperCase()+o.slice(1);const l=dphelper.path.rail();l&&l.length>0&&(t.className=t.className.replace(/path-\w+/g,"").trim(),t.classList.add(`path-${l[l.length-1]}`)),globalThis.dphelper.navigation.ajax_running&&dphelper.navigation.ajax()}catch(t){console.error("Navigation error:",t);const o=window.location.origin;if(e.startsWith("/")&&!e.startsWith("//")&&!e.match(/^[a-zA-Z]:/)){new URL(e,o).href.startsWith(o)&&(window.location.href=e)}}},_bind:e=>{document.querySelectorAll(e).forEach(e=>{const t=e.getAttribute("href");if(!t||!t.startsWith("/")||t.includes("#"))return;const o=e.cloneNode(!0);e.parentNode?.replaceChild(o,e),o.addEventListener("mouseup",e=>{const a=o.getAttribute("data-href")||t;history.pushState({href:a},"",a),dphelper.navigation.load(a),o.removeAttribute("href"),e.stopPropagation()})})},ajax:()=>{globalThis.dphelper.navigation.ajax_running?dphelper.navigation._bind("a"):(globalThis.dphelper.navigation.ajax_running=!0,window.onpopstate=()=>dphelper.navigation.load(window.location.pathname),dphelper.navigation._bind("a"),globalThis.dp_hash_listener_set||(window.addEventListener("hashchange",()=>{const e=window.location.hash.substring(1);if(e){const t=document.getElementById(e);t?.scrollIntoView({behavior:"smooth"})}}),globalThis.dp_hash_listener_set=!0))}};dphelper?.setDescription({name:"navigation",active:!0,subCommand:[{name:"ajax",version:"0.0.2",example:"dphelper.navigation.ajax()",author:"Dario Passariello",creationDate:"20260223",lastMod:"20260223",type:"function",active:!0,description:"Vanilla AJAX Single Page Application (SPA) navigation engine.",env:"client",subCommand:[]},{name:"load",version:"0.0.1",example:"dphelper.navigation.load('/home')",author:"Dario Passariello",creationDate:"20260223",lastMod:"20260223",type:"function",active:!0,description:"Loads a page via AJAX and injects it into the body.",env:"client",subCommand:[]}]},Q);var ee={smartFetch:async(e,t={},o=3,a=1e3)=>{try{const a=await globalThis.fetch(e,t);if(!a.ok&&o>0)throw new Error(`HTTP ${a.status}: ${a.statusText}`);return a}catch(n){if(0===o)throw n;return console.warn(`[dphelper.net] Fetch failed, retrying in ${a}ms... (${o} retries left)`,n),await new Promise(e=>setTimeout(e,a)),ee.smartFetch(e,t,o-1,2*a)}}};dphelper?.setDescription({name:"net",active:!0,subCommand:[{name:"smartFetch",version:"0.0.1",example:"dphelper.net.smartFetch(url, options)",author:"Dario Passariello",creationDate:"20260220",lastMod:"20260220",type:"function",active:!0,description:"Fetch with automatic retry and exponential backoff",env:"both",subCommand:[]}]},ee);var te={replaceNullObjects:e=>{const t={...e};for(const o of Object.keys(e))null===t[o]&&(t[o]="")},serialize:e=>{if("function"==typeof e)return e.toString();if("object"==typeof e){const t={};for(const[o,a]of Object.entries(e))t[o]=dphelper.obj.serialize(a);return t}return e},deSerialize:e=>{if("object"==typeof e){const t={};for(const[o,a]of Object.entries(e))t[o]=dphelper.obj.deSerialize(a);return t}return e},sort:e=>Object.keys(e).sort().reduce((t,o)=>(t[o]=e[o],t),{}),toXML:e=>{const t=(e,o="")=>{let a="";for(const n in e)if(Object.hasOwn(e,n)){const r=e[n];a+="object"==typeof r&&null!==r?`${o}<${n}>\n${t(r,`${o} `)}${o}</${n}>\n`:`${o}<${n}>${r}</${n}>\n`}return a};return t(e)},updateByKey:(e,t,o)=>(Object.hasOwn(e,t)&&(e[t]=o),e),parse:e=>{try{return JSON.parse(e)}catch(t){return console.error(t),e}},isObject:e=>"object"==typeof e&&null!==e,diff:(e,t)=>{const o={};for(const a in e)Object.hasOwn(e,a)&&e[a]!==t[a]&&(o[a]={obj1:e[a],obj2:t[a]});for(const a in t)Object.hasOwn(t,a)&&e[a]!==t[a]&&(o[a]={obj1:e[a],obj2:t[a]});return o},path:(e,t,o=".")=>t.concat(e).join(o),setProps:(e,t)=>{Reflect.ownKeys(e).forEach(o=>{const a=Object.getOwnPropertyDescriptor(e,o);a&&(a.enumerable=t?.enumerable??!0,a.configurable=t?.configurable??!0,a.writable=t?.writable??!0,Object.defineProperty(e,o,a)),"object"==typeof e[o]&&null!==e[o]&&dphelper.obj.setProps(e[o],t)})}};dphelper?.setDescription({name:"obj",active:!0,subCommand:[{name:"replaceNullObjects",version:"0.0.2",example:"dphelper.obj.replaceNullObjects([obj])",description:"Replace null values in an object with empty objects.",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:!0,env:"both",subCommand:[]},{name:"serialize",version:"0.0.2",example:"dphelper.obj.serialize([obj])",description:"Serialize an object to a JSON string.",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:!0,env:"both",subCommand:[]},{name:"deSerialize",version:"0.0.2",example:"dphelper.obj.deSerialize([obj])",description:"Deserialize a JSON string to an object.",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:!0,env:"both",subCommand:[]},{name:"toXML",version:"0.0.2",example:"dphelper.obj.toXML([obj])",description:"Convert an object to an XML string.",author:"Dario Passariello",creationDate:"20240315",lastMod:"20240315",type:"function",active:!0,env:"both",subCommand:[]},{name:"updateByKey",version:"0.0.2",example:"dphelper.obj.updateByKey([obj, key, newValue])",description:"Update an object's property by key.",author:"Dario Passariello",creationDate:"20240929",lastMod:"20240929",type:"function",active:!0,env:"both",subCommand:[]},{name:"parse",version:"0.0.2",example:"dphelper.obj.parse(val)",description:"Check if value is an object or another type. Return object after parse or a different type. Used instead of JSON.parse to avoid crash.",author:"Dario Passariello",creationDate:"20241027",lastMod:"20240927",type:"function",active:!0,env:"both",subCommand:[]},{name:"diff",version:"0.0.2",example:"dphelper.obj.diff([obj1, obj2])",description:"Show the differences between two objects.",author:"Dario Passariello",creationDate:"20250101",lastMod:"20250101",type:"function",active:!0,env:"both",subCommand:[]},{name:"setProps",version:"0.0.2",example:"dphelper.obj.setProps( [object], {options} )",author:"Dario Passariello",creationDate:"20251224",lastMod:"20251224",type:"function",active:!0,description:"Set properties of an object.",env:"both",subCommand:[]}]},te);var oe={rail:()=>(location.href.split("?")[0]||"").replace(location.protocol,"").replace(location.host,"").replace(location.hash,"").split("/").filter(e=>e),hash:()=>{const e=location.hash.replace("#","").split("/");return e.length?e.filter(e=>e):["empty"]},query:()=>{const e=location.search.substring(1);return JSON.parse(`{"${decodeURI(e).replace(/"/g,'\\"').replace(/&/g,'","').replace(/=/g,'":"')}"}`)}};dphelper?.setDescription({name:"path",active:!0,subCommand:[{name:"rail",version:"0.0.2",example:"dphelper.path.rail()",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:!0,description:"Extract the path segments from the current URL.",env:"both",subCommand:[]},{name:"hash",version:"0.0.2",example:"dphelper.path.hash([hashUrl])",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:!0,description:"Extract the hash from a URL.",env:"both",subCommand:[]},{name:"query",version:"0.0.2",example:"dphelper.path.query([queryString])",author:"Dario Passariello",creationDate:"20210101",lastMod:"20250513",type:"function",active:!0,description:"Extract the query parameters from a URL.",env:"both",subCommand:[]}]},oe);var ae={check:e=>null!=e&&(e instanceof Promise||"[object Promise]"===Object.prototype.toString.call(e)||"object"==typeof e&&"function"==typeof e.then)};dphelper?.setDescription({name:"promise",active:!0,subCommand:[{name:"check",version:"0.0.2",example:"dphelper.promise.check(promise)",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:!0,description:"Check if a value is a Promise.",env:"both",subCommand:[]}]},ae);dphelper?.setDescription({name:"sanitize",active:!0,subCommand:[{name:"html",version:"0.0.2",example:"dphelper.sanitize.html([html])",author:"Dario Passariello",creationDate:"20241204",lastMod:"20241204",type:"function",active:!0,description:"Sanitize HTML by escaping special characters.",env:"both",subCommand:[]}]},{html:e=>"string"!=typeof e?"":e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;").replace(/\//g,"&#x2F;")});var ne="dphelper_popup_positions",re=(e,t,o,a)=>`${e}x${t}@${o},${a}`,ie=()=>{const e=[];return e.push({id:"primary",width:screen.width,height:screen.height,left:0,top:0,isPrimary:!0}),void 0!==window.screenLeft&&void 0!==window.screenTop&&(window.screenLeft>0||window.screenTop>0)&&e.push({id:`secondary_${Date.now()}`,width:window.innerWidth,height:window.innerHeight,left:window.screenLeft,top:window.screenTop,isPrimary:!1}),e},se=(e,t)=>{const o=ie();for(const a of o)if(e>=a.left&&e<a.left+a.width&&t>=a.top&&t<a.top+a.height)return a;if(!o.length)return{id:"default",width:screen.width,height:screen.height,left:0,top:0,isPrimary:!0};let a=o[0],n=1/0;for(const r of o){const o=r.left+r.width/2,i=r.top+r.height/2,s=Math.sqrt(Math.pow(o-e,2)+Math.pow(i-t,2));s<n&&(n=s,a=r)}return a},le=()=>{try{const e=localStorage.getItem(ne);if(e)return JSON.parse(e)}catch(e){console.warn("[dphelper] Failed to parse popup storage:",e)}return{monitors:[],popups:{}}},ce=(e,t)=>{if("undefined"==typeof window)return;const o=t||window,a=o.screenX||o.screenLeft||0,n=o.screenY||o.screenTop||0,r=o.outerWidth||800,i=o.outerHeight||600,s=ie(),l=se(a,n),{relX:c,relY:d}=((e,t,o)=>({relX:e-o.left,relY:t-o.top}))(a,n,l),p=re(l.width,l.height,l.left,l.top),u=le();u.monitors=s,u.popups[e]={id:e,monitorId:l.id,left:c,top:d,width:r,height:i,monitorFingerprint:p},localStorage.setItem(ne,JSON.stringify(u))},de=e=>{if("undefined"==typeof window)return null;const t=le().popups[e];if(!t)return null;const o=ie(),a=o.find(e=>re(e.width,e.height,e.left,e.top)===t.monitorFingerprint);let n;a?n=a:(console.warn(`[dphelper] Monitor changed, restoring popup "${e}" on closest available monitor`),n=se(t.left+(o[0]?.left||0),t.top+(o[0]?.top||0)));const{left:r,top:i}=(s=t.left,l=t.top,{left:(c=n).left+s,top:c.top+l});var s,l,c;return{left:r,top:i,width:t.width,height:t.height}},pe=e=>{const t=le();delete t.popups[e],localStorage.setItem(ne,JSON.stringify(t))},ue=()=>le().popups,me=()=>{localStorage.removeItem(ne)},he=()=>se(window.screenX||0,window.screenY||0),ve={fullScreen:e=>{const t=document.querySelector(e);t.requestFullscreen?t.requestFullscreen():t.mozRequestFullScreen?t.mozRequestFullScreen():t.webkitRequestFullscreen?t.webkitRequestFullscreen():t.msRequestFullscreen&&t.msRequestFullscreen()},toggle:e=>{const t=document,o=t.querySelector(e);o?t.fullscreenElement||t.mozFullScreenElement||t.webkitFullscreenElement?t.exitFullscreen?t.exitFullscreen():t.mozCancelFullScreen?t.mozCancelFullScreen():t.webkitExitFullscreen?t.webkitExitFullscreen():t.msExitFullscreen&&t.msExitFullscreen():o.requestFullscreen?o.requestFullscreen():o.mozRequestFullScreen?o.mozRequestFullScreen():o.webkitRequestFullscreen?o.webkitRequestFullscreen():o.msRequestFullscreen&&o.msRequestFullscreen():console.error(`Element not found: ${e}`)},info:()=>({width:screen.width,height:screen.height,availWidth:screen.availWidth,availHeight:screen.availHeight,colorDepth:screen.colorDepth,pixelDepth:screen.pixelDepth}),popup:{save:(e,t)=>{ce(e,t)},restore:e=>de(e),remove:e=>{pe(e)},list:()=>ue(),getCurrentMonitor:()=>he(),clear:()=>{me()}}};dphelper?.setDescription({name:"screen",active:!0,subCommand:[{name:"popup",version:"0.0.1",example:"dphelper.screen.popup.save('myPopup', window)",author:"Dario Passariello & Jo",creationDate:"20260221",lastMod:"20260221",type:"function",active:!0,description:"Manage popup windows positions across monitor changes.",env:"client",subCommand:[{name:"save",version:"0.0.1",example:"dphelper.screen.popup.save('myPopup', window)",author:"Dario Passariello & Jo",creationDate:"20260221",lastMod:"20260221",type:"function",active:!0,description:"Save popup position with monitor fingerprint",env:"client",subCommand:[]},{name:"restore",version:"0.0.1",example:"dphelper.screen.popup.restore('myPopup')",author:"Dario Passariello & Jo",creationDate:"20260221",lastMod:"20260221",type:"function",active:!0,description:"Restore popup position (auto-adjusts if monitor changed)",env:"client",subCommand:[]},{name:"remove",version:"0.0.1",example:"dphelper.screen.popup.remove('myPopup')",author:"Dario Passariello & Jo",creationDate:"20260221",lastMod:"20260221",type:"function",active:!0,description:"Remove saved popup position",env:"client",subCommand:[]},{name:"list",version:"0.0.1",example:"dphelper.screen.popup.list()",author:"Dario Passariello & Jo",creationDate:"20260221",lastMod:"20260221",type:"function",active:!0,description:"List all saved popup positions",env:"client",subCommand:[]},{name:"getCurrentMonitor",version:"0.0.1",example:"dphelper.screen.popup.getCurrentMonitor()",author:"Dario Passariello & Jo",creationDate:"20260221",lastMod:"20260221",type:"function",active:!0,description:"Get current monitor info",env:"client",subCommand:[]},{name:"clear",version:"0.0.1",example:"dphelper.screen.popup.clear()",author:"Dario Passariello & Jo",creationDate:"20260221",lastMod:"20260221",type:"function",active:!0,description:"Clear all saved popup positions",env:"client",subCommand:[]}]},{name:"fullScreen",version:"0.0.2",example:"dphelper.screen.fullScreen([element])",author:"Dario Passariello",creationDate:"20240101",lastMod:"20240101",type:"function",active:!0,description:"Enter full screen mode for a given element.",env:"client",subCommand:[]},{name:"toggle",version:"0.0.2",example:"dphelper.screen.toggle([element])",author:"Dario Passariello",creationDate:"20240101",lastMod:"20240101",type:"function",active:!0,description:"Toggle full screen mode for a given element.",env:"client",subCommand:[]}]},ve);var fe={custom:(e,t)=>{t.color_1=t?.color_1||"black",t.color_1_hover=t?.color_1_hover||"black",t.color_2=t?.color_2||"transparent",t.color_3=t?.color_3||"rgba(30,150,255,.5)",t.type=t?.type||"thin",t.behavior=t?.behavior||"smooth",t.width=t?.width||"16px",t.height=t?.height||"16px",t.rounded=t?.rounded||"10px",t.margin=t?.margin||0,t.border=t?.border||"5px",t.opacity=t?.opacity||1;const o=` ${e}::-webkit-scrollbar {\n scroll-behavior: ${t.behavior};\n width: ${t.width};\n height: ${t.height};\n }\n ${e}::-webkit-scrollbar-thumb {\n opacity: ${t.opacity} !important;\n -webkit-border-radius: ${t.rounded} !important;\n -webkit-box-shadow: none !important;\n box-shadow: none !important;\n border-radius: ${t.rounded} !important;\n background: ${t.color_1} !important;\n background-clip: content-box !important;\n border: ${t.border} solid transparent !important;\n min-height: 2px !important;\n min-width: 2px !important;\n }\n ${e}::-webkit-scrollbar-thumb:hover{\n background: ${t.color_1_hover} !important;\n }\n ${e}::-webkit-scrollbar-thumb:active{\n background: ${t.color_1} !important;\n background-clip: content-box !important;\n border: calc( ${t.border} - 1.5px ) solid transparent !important;\n }\n ${e}::-webkit-scrollbar-track {\n background: ${t.color_2};\n border-radius: ${t.rounded};\n }\n ${e}::-webkit-scrollbar-track:hover {\n /*background: rgba(128,128,128,.15) !important;*/\n }\n ${e}::-webkit-scrollbar-track:vertical:hover {\n /* border-left: 1px solid rgba(0,0,0,.1) !important; */\n }\n ${e}::-webkit-scrollbar-track:horizontal:hover {\n /* border-top: 1px solid rgba(0,0,0,.1) !important; */\n }\n ${e}::-webkit-scrollbar-corner {\n background:rgba(0,0,0,0)\n }\n /*\n ${e}::-webkit-scrollbar-thumb:window-inactive {\n background: ${t.color_3}\n }\n */\n select::-webkit-scrollbar-thumb {\n border: 4px solid hsl(0 0% 92% / 1) !important;\n }\n select::-webkit-scrollbar-track {\n background: hsl(0 0% 92% / 1) !important;\n }\n select::-webkit-scrollbar-track:vertical,\n select::-webkit-scrollbar-track:horizontal {\n border-top: none !important;\n border-left: none !important;\n }\n `,a=document.createElement("style");document.head.appendChild(a),a.innerHTML=o},indicator:e=>{const t=document.querySelector(e.el),o=document.querySelector(".scrollindicator");if(!o){const e=document.createElement("div");e.classList.add("scrollindicator"),document.querySelector("header")?.appendChild(e),e.style.cssText="\n height:5px;\n background:#65c45c;\n position:absolute;\n bottom:0;\n left:0;\n z-index:2\n "}if(e.el||!o)try{const e=document.querySelector(".scrollindicator");t.addEventListener("scroll",function(t){e.style.width="0%";const o=Number(this.scrollTop),a=Number(this.scrollHeight-this.clientHeight),n=Math.min(Math.max(o/a*100),100);e.style.width=`${n}%`,e.click()}),t.addEventListener("popstate",t=>{e.style.width=0})}catch(e){return void console.error(e)}else o.style.width="0%"},position:{set:e=>{const t="string"==typeof e?document.querySelector(e):e;if(!t)return;const o=[t.scrollTop,t.scrollLeft];null!=o[0]&&null!=o[1]&&localStorage.setItem(e,JSON.stringify(o))},get:e=>{if(localStorage.getItem(e))try{const t=localStorage.getItem(e),o="string"==typeof e?document.querySelector(e):e;o&&t&&(o.scrollTop=t[0],o.scrollLeft=t[1])}catch(e){console.error("Error getting scroll position:",e)}}},smooth:(e,t,o)=>{e===document&&(e=document.scrollingElement||document.documentElement||document.body.parentNode||document.body);let a=!1,n=e.scrollTop;const r=e===document.body&&document.documentElement?document.documentElement:e,i=o=>{o.preventDefault();const i=s(o);n+=-i*t,n=Math.max(0,Math.min(n,e.scrollHeight-r.clientHeight)),a||l()};e.addEventListener("mousewheel",i,{passive:!1}),e.addEventListener("DOMMouseScroll",i,{passive:!1});const s=e=>e.detail?e.wheelDelta?e.wheelDelta/e.detail/40*(e.detail>0?1:-1):-e.detail/3:e.wheelDelta/120,l=()=>{a=!0;const t=(n-e.scrollTop)/o;e.scrollTop+=t,Math.abs(t)>.5?c(l):a=!1},c=dphelper.window.animationframe()},scrollTo:(e,t,o=0)=>{const a=document.querySelector(e),n=document.querySelector(t);a&&n&&a.scrollTo({top:n.offsetTop-o,behavior:"smooth"})}};dphelper?.setDescription({name:"scrollbar",active:!0,subCommand:[{name:"custom",version:"0.0.2",example:"dphelper.scrollbar.custom(selector)",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:!0,description:"Apply custom styles to the scrollbar for the selected elements.",env:"client",subCommand:[]},{name:"indicator",version:"0.0.2",example:"dphelper.scrollbar.indicator(selector)",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:!0,description:"Add a scroll indicator to the selected elements.",env:"client",subCommand:[]},{name:"position.get",version:"0.0.2",example:"dphelper.scrollbar.position.get(selector)",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:!0,description:"Get the current scroll position of the selected elements.",env:"client",subCommand:[]},{name:"position.set",version:"0.0.2",example:"dphelper.scrollbar.position.set(selector, position)",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:!0,description:"Set the scroll position of the selected elements.",env:"client",subCommand:[]},{name:"smooth",version:"0.0.2",example:"dphelper.scrollbar.smooth(container, element, gap)",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:!0,description:"Smoothly scroll to a specific element within a container with an optional gap.",env:"client",subCommand:[]},{name:"scrollTo",version:"0.0.2",example:"dphelper.scrollbar.scrollTo(container, element, gap)",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:!0,description:"Scroll to a specific element within a container with an optional gap.",env:"client",subCommand:[]}]},fe);var be=new TextEncoder,ge=new TextDecoder,ye=async(e,t)=>{const o=be.encode(t),a=await crypto.subtle.importKey("raw",o,{name:"HMAC",hash:"SHA-256"},!1,["sign"]),n=await crypto.subtle.sign("HMAC",a,be.encode(e));return Array.from(new Uint8Array(n)).map(e=>e.toString(16).padStart(2,"0")).join("")},De=async(e,t,o)=>{const a=await crypto.subtle.importKey("raw",be.encode(e),"PBKDF2",!1,["deriveBits","deriveKey"]);return crypto.subtle.deriveKey({name:"PBKDF2",salt:t.buffer,iterations:o,hash:"SHA-256"},a,{name:"AES-GCM",length:256},!1,["encrypt","decrypt"])},we=async(e,t)=>{const o=crypto.getRandomValues(new Uint8Array(16)),a=crypto.getRandomValues(new Uint8Array(12)),n=await De(t,new Uint8Array(o.buffer),1e5),r=await crypto.subtle.encrypt({name:"AES-GCM",iv:new Uint8Array(a.buffer)},n,be.encode(e)),i=new Uint8Array(o.length+a.length+r.byteLength);return i.set(o,0),i.set(a,o.length),i.set(new Uint8Array(r),o.length+a.length),(e=>{const t=new Uint8Array(e);let o="";for(let e=0;e<t.byteLength;e++)o+=String.fromCharCode(t[e]);return btoa(o)})(i.buffer)},xe=async(e,t)=>{try{const o=new Uint8Array((e=>{const t=atob(e),o=new Uint8Array(t.length);for(let e=0;e<t.length;e++)o[e]=t.charCodeAt(e);return o.buffer})(e)),a=o.slice(0,16),n=o.slice(16,28),r=o.slice(28),i=await De(t,new Uint8Array(a.buffer),1e5),s=await crypto.subtle.decrypt({name:"AES-GCM",iv:new Uint8Array(n.buffer)},i,r);return ge.decode(s)}catch{return""}},Ce=-1,Me=["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","J","K","M","N","P","Q","R","S","T","V","W","X","Y","Z"],Se={uuid:{byVal:e=>{if(!e)return console.warn("You need to pass a value to obtain a fixed uuid"),"";const t=dphelper.security.SHA256_Hex(e);return[t.slice(0,8),t.slice(8,4),`4${t.slice(12,3)}`,`8${t.slice(15,3)}`,t.slice(18,12)].join("-")},v4:"10000000-1000-4000-8000-100000000000".replace(/[018]/g,e=>(+e^crypto.getRandomValues(new Uint8Array(1))[0]&15>>+e/4).toString(16)),v5:"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{const t=crypto.getRandomValues(new Uint8Array(1))[0];return("x"===e?t:3&t|8).toString(16)})},hashPass:async(e,t,o="SHA-256")=>{const a=crypto.getRandomValues(new Uint8Array(16)),n=Array.from(a).map(e=>e.toString(16).padStart(2,"0")).join(""),r=(new TextEncoder).encode(t.toLowerCase()+e.toLowerCase()+n),i=await crypto.subtle.digest(o,r.buffer);return n+Array.from(new Uint8Array(i)).map(e=>e.toString(16).padStart(2,"0")).join("")},crypt:async(e,t,o="AES")=>"AES"!==o?(console.warn("Only AES mode is supported in Web Crypto API"),""):we(e,t),deCrypt:async(e,t,o="AES")=>"AES"!==o?(console.warn("Only AES mode is supported in Web Crypto API"),""):xe(e,t),AES_KeyGen:async e=>{const t=e||crypto.randomUUID(),o=crypto.getRandomValues(new Uint8Array(16)),a=Array.from(o).map(e=>e.toString(16).padStart(2,"0")).join(""),n=await crypto.subtle.deriveBits({name:"PBKDF2",salt:o.buffer,iterations:6e5,hash:"SHA-256"},await crypto.subtle.importKey("raw",be.encode(t),"PBKDF2",!1,["deriveBits"]),512);return a+Array.from(new Uint8Array(n)).map(e=>e.toString(16).padStart(2,"0")).join("")},SHA256_Hex:async e=>(async e=>{const t=be.encode(e),o=await crypto.subtle.digest("SHA-256",t);return Array.from(new Uint8Array(o)).map(e=>e.toString(16).padStart(2,"0")).join("")})(e),ulid:()=>{const e=new Uint8Array(16),t=new DataView(e.buffer,0,6),o=new Uint8Array(e.buffer,6,10),a=new Array(26),n=Date.now();if(n===Ce)for(let e=9;e>=0;e--){if(void 0!==o[e]&&o[e]++<255)break}else Ce=n,t.setUint16(0,n/4294967296|0),t.setUint32(2,0|n),window.crypto.getRandomValues(o);return(e=>{a[0]=Me[e[0]>>5],a[1]=Me[31&e[0]];for(let t=0;t<3;t++)a[8*t+2]=Me[e[5*t+1]>>3],a[8*t+3]=Me[31&(e[5*t+1]<<2|e[5*t+2]>>6)],a[8*t+4]=Me[e[5*t+2]>>1&31],a[8*t+5]=Me[31&(e[5*t+2]<<4|e[5*t+3]>>4)],a[8*t+6]=Me[31&(e[5*t+3]<<1|e[5*t+4]>>7)],a[8*t+7]=Me[e[5*t+4]>>2&31],a[8*t+8]=Me[31&(e[5*t+4]<<3|e[5*t+5]>>5)],a[8*t+9]=Me[31&e[5*t+5]];return a.join("")})(e)},fingerprint:async()=>{const e=navigator,t=window.screen,o=document.createElement("canvas"),a=o.getContext("2d"),n="dphelper_fingerprint_v1";let r="";a&&(o.width=200,o.height=30,a.textBaseline="top",a.font="14px 'Arial'",a.textBaseline="alphabetic",a.fillStyle="#f60",a.fillRect(125,1,62,20),a.fillStyle="#069",a.fillText(n,2,15),a.fillStyle="rgba(102, 204, 0, 0.7)",a.fillText(n,4,17),r=o.toDataURL());const i=[e.userAgent,e.language,t.colorDepth,t.width+"x"+t.height,(new Date).getTimezoneOffset(),e.deviceMemory||"unknown",e.hardwareConcurrency||"unknown",r].join("|");return dphelper.security.SHA256_Hex(i)},saveEncrypted:async(e,t,o)=>{const a=await dphelper.security.crypt(t,o),n=await ye(a,o);localStorage.setItem(e,JSON.stringify({d:a,h:n,v:"2.0"}))},getEncrypted:async(e,t)=>{const o=localStorage.getItem(e);if(!o)return null;try{const a=JSON.parse(o);if(a&&a.h&&a.d){const o=await ye(a.d,t);return a.h!==o?(console.error(`[dphelper] Security Alert: Data tampering detected for key "${e}"`),null):dphelper.security.deCrypt(a.d,t)}return dphelper.security.deCrypt(o,t)}catch(a){try{return dphelper.security.deCrypt(o,t)}catch(t){return console.warn(`[dphelper] Persistence Error for key "${e}":`,t),null}}}};dphelper?.setDescription({name:"security",active:!0,subCommand:[{name:"uuid",version:"0.0.2",example:"dphelper.security.uuid",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:!0,description:"UUID related commands",subCommand:[{name:"byVal",version:"0.0.2",example:"dphelper.security.uuid.byVal('string')",author:"Dario Passariello",creationDate:"20250101",lastMod:"20250101",type:"function",active:!0,description:"Generate a UUID based on a given string",env:"both",subCommand:[]},{name:"v4",version:"0.0.2",example:"dphelper.security.uuid.v4",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"return",active:!0,description:"Generate a random UUID v4",env:"both",subCommand:[]},{name:"v5",version:"0.0.2",example:"dphelper.security.uuid.v5",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"return",active:!0,description:"Generate a random UUID v5",env:"both",subCommand:[]}]},{name:"hashPass",description:"Generate a crypto digest SHA-1 starting from user and password values (Please, think about security before using SHA-1)",example:"dphelper.security.hashPass(user, password)",version:"0.0.2",type:"function",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",active:!0,env:"both",subCommand:[]},{name:"crypt",description:"Encrypt your message using a secret_key in a default format AES",example:"dphelper.security.crypt(data, secret_key, [optional mode])",version:"0.0.2",type:"function",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",active:!0,env:"both",subCommand:[]},{name:"deCrypt",description:"Decrypt your message using a secret_key in a default format AES",example:"dphelper.security.deCrypt(data, secret_key, [optional mode])",version:"0.0.2",type:"function",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",active:!0,env:"both",subCommand:[]},{name:"AES_KeyGen",description:"Generate a key based on the AES algorithm",example:"dphelper.security.AES_KeyGen(secret_key)",version:"0.0.2",type:"function",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",active:!0,env:"both",subCommand:[]},{name:"SHA256_Hex",description:"Generate a SHA256 hash in hexadecimal format",example:"dphelper.security.SHA256_Hex(secret_key)",version:"0.0.2",type:"function",author:"Dario Passariello",creationDate:"20250101",lastMod:"20250101",active:!0,env:"both",subCommand:[]},{name:"ulid",description:"Generate ULID code",example:"dphelper.security.ulid()",version:"0.0.2",type:"function",author:"mix",creationDate:"20250212",lastMod:"20250212",active:!0,env:"both",subCommand:[]},{name:"fingerprint",description:"Generate a unique browser fingerprint",example:"dphelper.security.fingerprint()",version:"0.0.2",type:"function",author:"Dario Passariello",creationDate:"20260220",lastMod:"20260220",active:!0,env:"both",subCommand:[]},{name:"saveEncrypted",description:"Save encrypted data to localStorage",example:"dphelper.security.saveEncrypted('key', 'value', 'secret')",version:"0.0.2",type:"function",author:"Dario Passariello",creationDate:"20260220",lastMod:"20260220",active:!0,env:"both",subCommand:[]},{name:"getEncrypted",description:"Retrieve and decrypt data from localStorage",example:"dphelper.security.getEncrypted('key', 'secret')",version:"0.0.2",type:"function",author:"Dario Passariello",creationDate:"20260220",lastMod:"20260220",active:!0,env:"both",subCommand:[]}]},Se);var Pe={keys:(e,t)=>{const o=e.which?e.which:e.keyCode;t||(t={data:[{key:"83",ctrl:!0,active:!0,description:"CTRL+S",function:""},{key:"27",ctrl:!1,active:!0,description:"ESC",element:"",function:""},{key:"80",ctrl:!0,active:!0,description:"CTRL+P",element:"",function:"function(){ Print }"}]}),t.data&&t.data.map(t=>(e.ctrlKey||e.metaKey&&!0===t.ctrl)&&o===Number.parseInt(t.key)&&!0===t.active?(t.element&&t.element.click(),t.function?JSON.stringify(t.function):(e.preventDefault(),null)):null)}};dphelper?.setDescription({name:"shortcut",active:!0,subCommand:[{name:"keys",version:"0.0.2",example:"dphelper.shortcut.keys([e, trigger])",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:!0,description:"Handle keyboard shortcuts.",env:"client",subCommand:[]}]},Pe);var ke={ws:{}},Ae={info:()=>"Created by Dario Passariello",start:(e,t,o="general")=>{ke.ws={},dphelper.socket.connect(t,o),dphelper.socket.receive(e,o)},conn:(e,t,o)=>{if(e&&t)try{let a;try{a=new URL(t)}catch{if(t.startsWith("/")||t.startsWith("ws")||t.startsWith("wss"))return void console.error("Invalid WebSocket URL");a=new URL(t,window.location.origin)}if("ws:"===a.protocol)return void console.error("Insecure WebSocket protocol 'ws://' - must use 'wss://'");const n=new WebSocket(t);return n.binaryType="blob",n.onmessage=e=>{},[n,e,o]}catch(e){return void console.error(e)}else console.debug("please use connect!")},connect:(e,t)=>{e&&dphelper.socket.open(dphelper.security.uuid.v5,e,t)},open:(e,t,o)=>{if(e)try{const a=dphelper.socket.conn(e,t,o);if(!a)return;ke.ws[o]=a,-1===dphelper._list.sockets.indexOf(a[0])&&dphelper._list.sockets.push(a[0]),a[0].onopen=()=>dphelper.log.reg(`${e} connected`),a[0].onclose=e=>dphelper.log.debug(e.wasClean?"Disconnected":`Connection break: ${e.reason||e.code}`),a[0].onerror=e=>dphelper.log?.error(e)}catch(e){console.error(e)}},send:(e,t,o)=>{if(ke.ws[o]?.[1]&&e)try{const a=ke.ws[o];if(!a)return;const n=a[0],r=a[1],i=t?JSON.stringify({[t]:`(${r}:${e})`}):e;n.send(i)}catch(e){console.error(e)}},ping:e=>{if(ke.ws[e]?.[1])try{const t=ke.ws[e];t?.[0]?.send('{"debug":"__ping__"}')}catch(e){console.error(e)}},receive:(e,t)=>{if(ke.ws[t]?.[1])try{const o=ke.ws[t];o[0].onmessage=async t=>{try{if(e){const o="string"==typeof e?document.querySelector(e):e;if(o){const e="string"==typeof t.data?t.data:await t.data.text(),a=JSON.parse(e),n=String(Object.values(a)[0]);o.textContent=n}}}catch(e){}dphelper.log.reg(t.data)}}catch(e){console.error(e)}},keepAlive:e=>{try{const t=ke.ws[e];if(!t)return;let o;const a=t[0],n=(t=5e3)=>{o=setTimeout(()=>{dphelper.socket.ping(e)},t)},r=()=>clearTimeout(o);a.onopen=()=>setInterval(n,3e4),a.onmessage=e=>{try{return void("__ping__"===Object.values(JSON.parse(e.data))[0]&&r())}catch(e){console.error(e)}}}catch(e){console.error(e)}},check:()=>{dphelper._list.sockets=dphelper._list.sockets.filter(e=>e.readyState!==WebSocket.CLOSED)},list:()=>dphelper._list.sockets};dphelper?.setDescription({name:"socket",active:!0,subCommand:[{name:"info",version:"0.0.2",example:"dphelper.socket.info(...)",author:"Dario Passariello",creationDate:"2021-01-01",lastMod:"2021-01-01",type:"function",active:!0,description:"Retrieve socket information",env:"client",subCommand:[]},{name:"start",version:"0.0.2",example:"dphelper.socket.start(...)",author:"Dario Passariello",creationDate:"2021-01-01",lastMod:"2021-01-01",type:"function",active:!0,description:"Start a socket connection",env:"client",subCommand:[]},{name:"conn",version:"0.0.2",example:"dphelper.socket.conn(...)",author:"Dario Passariello",creationDate:"2021-01-01",lastMod:"2021-01-01",type:"function",active:!0,description:"Manage socket connections",env:"client",subCommand:[]},{name:"connect",version:"0.0.2",example:"dphelper.socket.connect(...)",author:"Dario Passariello",creationDate:"2021-01-01",lastMod:"2021-01-01",type:"function",active:!0,description:"Connect to a socket",env:"client",subCommand:[]},{name:"open",version:"0.0.2",example:"dphelper.socket.open(...)",author:"Dario Passariello",creationDate:"2021-01-01",lastMod:"2021-01-01",type:"function",active:!0,description:"Open a socket connection",env:"client",subCommand:[]},{name:"send",version:"0.0.2",example:"dphelper.socket.send(...)",author:"Dario Passariello",creationDate:"2021-01-01",lastMod:"2021-01-01",type:"function",active:!0,description:"Send data through a socket",env:"client",subCommand:[]},{name:"receive",version:"0.0.2",example:"dphelper.socket.receive(...)",author:"Dario Passariello",creationDate:"2021-01-01",lastMod:"2021-01-01",type:"function",active:!0,description:"Receive data from a socket",env:"client",subCommand:[]},{name:"keepAlive",version:"0.0.2",example:"dphelper.socket.keepAlive(...)",author:"Dario Passariello",creationDate:"2021-01-01",lastMod:"2021-01-01",type:"function",active:!0,description:"Keep the socket connection alive",env:"client",subCommand:[]},{name:"check",version:"0.0.2",example:"dphelper.socket.check()",author:"Dario Passariello",creationDate:"2023-05-27",lastMod:"2023-05-27",type:"function",active:!0,description:"Check how many websocket connections are open",env:"client",subCommand:[]},{name:"list",version:"0.0.2",example:"dphelper.socket.list()",author:"Dario Passariello",creationDate:"2023-05-27",lastMod:"2023-05-27",type:"function",active:!0,description:"List all websocket connections in real-time",env:"client",subCommand:[]}]},Ae),dphelper?.socket?.check();var Te={open:(e,t={})=>{const o={message:[],error:[],open:[]},a=new AbortController,n=(e,t)=>{o[e]?.forEach(e=>e(t))};return(async()=>{try{const o=await fetch(e,{...t,signal:a.signal,headers:{Accept:"text/event-stream",...t.headers||{}}});if(!o.ok)throw new Error(`SSE failed: ${o.statusText}`);n("open",{status:o.status});const r=o.body?.getReader(),i=new TextDecoder;if(!r)return;let s="";for(;;){const{done:e,value:t}=await r.read();if(e)break;s+=i.decode(t,{stream:!0});const o=s.split("\n");s=o.pop()||"";for(const e of o)if(e.startsWith("data:")){let t=e.replace("data:","").trim();try{(t.includes("[")||t.includes("{"))&&(t=JSON.parse(t))}catch(e){}n("message",t)}}}catch(e){"AbortError"!==e.name&&n("error",e)}})(),{on:(e,t)=>{o[e]&&o[e].push(t)},close:()=>a.abort()}}};dphelper?.setDescription({name:"sse",active:!0,subCommand:[{name:"open",version:"0.0.1",example:"dphelper.sse.open('/api/stream', { method: 'POST', body: ... })",author:"Dario Passariello",creationDate:"20260221",lastMod:"20260221",type:"function",active:!0,description:"Advanced Server-Sent Events client with POST and Custom Headers support.",env:"client",subCommand:[]}]},Te);var Ee={init:(e,t,o,a)=>{e.querySelector("svg")&&dphelper.svg.removeConnection(e),t=[dphelper.svg.setConnector(t[0],t[1]),t[1]],o=[dphelper.svg.setConnector(o[0],o[1]),o[1]];const n=e.getBoundingClientRect(),r="http://www.w3.org/2000/svg",i=10*e.offsetWidth,s=10*e.offsetHeight,l=document.createElementNS(r,"svg"),c=`conn_${Math.random().toString(36).substring(2,9)}`;l.setAttribute("xmlns",r),l.dataset.dphelper="svg-connection",l.setAttributeNS(null,"viewBox","0 0 "+i+" "+s),l.setAttributeNS(null,"width",String(i)),l.setAttributeNS(null,"height",String(s)),l.style.display="block";const d=document.createElementNS(r,"rect");let p=t[0].getBoundingClientRect();d.setAttributeNS(null,"x",String(p.left-n.left)),d.setAttributeNS(null,"y",String(p.top-n.top)),d.setAttributeNS(null,"width",String(p.width)),d.setAttributeNS(null,"height",String(p.height)),l.appendChild(d);const u=document.createElementNS(r,"rect");p=o[0].getBoundingClientRect(),u.setAttributeNS(null,"x",String(p.left-n.left)),u.setAttributeNS(null,"y",String(p.top-n.top)),u.setAttributeNS(null,"width",String(p.width)),u.setAttributeNS(null,"height",String(p.height)),l.appendChild(u);const m=document.createElementNS(r,"path");m.setAttributeNS(null,"id",c),m.setAttributeNS(null,"marker-end","url(#head)"),l.appendChild(m),e.appendChild(l),dphelper.svg.update(d,u,m),"function"==typeof a&&a(t,o)},check:()=>!(!document.createElementNS||!document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGRect),update:(e,t,o)=>{const a=Number.parseFloat(e.getAttribute("x")||"0"),n=Number.parseFloat(e.getAttribute("y")||"0"),r=Number.parseFloat(t.getAttribute("x")||"0"),i=Number.parseFloat(t.getAttribute("y")||"0"),s=Number.parseFloat(e.getAttribute("width")||"0")/2,l=Number.parseFloat(e.getAttribute("height")||"0")/2,c=Number.parseFloat(t.getAttribute("width")||"0")/2,d=Number.parseFloat(t.getAttribute("height")||"0")/2,p=a+s,u=n+l,m=r+c,h=i+d,v=m-p,f=h-u,b=dphelper.svg.getIntersection(v,f,p,u,s,l),g=dphelper.svg.getIntersection(-v,-f,m,h,c,d),y=g[0]-b[0],D=dphelper.svg.getCurve(b,g,y);o.setAttributeNS(null,"d","M"+p+","+u+D+m+","+h)},getCurve:(e,t,o)=>{const a=o/2;return" C"+(a+e[0])+","+e[1]+" "+(t[0]-a)+","+t[1]+" "},getIntersection:(e,t,o,a,n,r)=>Math.abs(t/e)<r/n?[o+(e>0?n:-n),a+t*n/Math.abs(e)]:[o+e*r/Math.abs(t),a+(t>0?r:-r)],setConnector:(e,t)=>{let o;const a=document.createElement("span");switch(e.style.position="relative",a.style.position="absolute",a.style.width="5px",a.style.height="5px",t){case"top":o={left:"50%",top:"2.5px",marginLeft:"2.5px"};break;case"right":o={top:"50%",right:"2.5px",marginTop:"-2.5px"};break;case"bottom":o={left:"50%",bottom:"-2.5px",marginLeft:"2.5px"};break;case"left":o={top:"50%",left:"-2.5px",marginTop:"-2.5px"};break;default:o={}}return Object.assign(a.style,o),e.appendChild(a),a},removeConnection:e=>{e.querySelectorAll("svg[data-dphelper='svg-connection']").forEach(e=>e.remove())},makeScrollable:(e,t,o,a,n,r)=>{const i=e.getBoundingClientRect(),s=[o,a],l=s.length,c=[n,r],d=[];for(let e=0;e<l;e++){const t=s[e],o=c[e];t&&o&&(d[e]=t.getBoundingClientRect(),o.setAttributeNS(null,"x",String(d[e].left-i.left)),o.setAttributeNS(null,"y",String(d[e].top-i.top)),o.setAttributeNS(null,"width",String(d[e].width)),o.setAttributeNS(null,"height",String(d[e].height)))}const p=e.querySelectorAll("rect"),u=p[0],m=p[1],h=document.getElementById("connection");u&&m&&h&&dphelper.svg.update(u,m,h)},makeDraggable:e=>{const t=e.target;function o(e){const o=t.getScreenCTM();return{x:(e.clientX-o.e)/o.a,y:(e.clientY-o.f)/o.d}}t.addEventListener("mousedown",function(e){e.target.classList.contains("draggable")&&(a=e.target,n=o(e),n.x-=Number.parseFloat(a.getAttributeNS(null,"x")||"0"),n.y-=Number.parseFloat(a.getAttributeNS(null,"y")||"0"));return}),t.addEventListener("mousemove",function(e){if(a&&n){const t=o(e);a.setAttributeNS(null,"x",String(t.x-n.x)),a.setAttributeNS(null,"y",String(t.y-n.y)),dphelper.svg.update(a,a,document.getElementById("connection"))}return}),t.addEventListener("mouseup",function(){return a=null,void(n=null)});let a=null,n=null},toggle:(e,t,o,a)=>{const n=e.target;if(n.checked&&o&&a)dphelper.cookie.set({name:`${n.id}`,value:1,time:365}),dphelper.svg.init(t,[o,"right"],[a,"left"],(e,o)=>{const a=document.getElementById("parts-left-body");a&&a.addEventListener("scroll",()=>{dphelper.svg.makeScrollable(t,a,e,o,document.querySelector("#parts svg rect"),document.querySelectorAll("#parts svg rect")[1])})});else{dphelper.svg.removeConnection(t);const e=document.getElementById("parts-left-body");e&&e.replaceWith(e.cloneNode(!0)),dphelper.cookie.set({name:`${n.id}`,value:0,time:365})}},convert:({children:e,active:t=!0,size:o=[1920,1080],fit:a=["100%","100%"],preserveAspectRatio:n="none",style:r=`width:${a[0]}; height:${a[1]}`,zoom:i=1})=>{if(!e)return"Please pass ID of element for SVG conversion";if(t){const t=document.querySelector(e),s=t.cloneNode(!0),l=`\n <svg\n viewBox="0 0 ${o[0]} ${o[1]}"\n preserveAspectRatio="${n}"\n xmlns="http://www.w3.org/2000/svg"\n style="${r}; zoom:${i}"\n >\n <foreignObject\n x="0"\n y="0"\n width="${a[0]}"\n height="${a[1]}"\n style="${r}; zoom:${i}"\n >\n </foreignObject>\n </svg >\n `;t.innerHTML=l;const c=t.querySelector("foreignObject");c&&c.appendChild(s)}}};dphelper?.setDescription({name:"svg",active:!0,subCommand:[{name:"init",version:"0.0.2",example:"dphelper.svg.init(...)",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:!0,description:"Initializes an SVG connection between two elements.",env:"client",subCommand:[]},{name:"check",version:"0.0.2",example:"dphelper.svg.check(...)",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:!0,description:"Checks if SVG support is available.",env:"client",subCommand:[]},{name:"update",version:"0.0.2",example:"dphelper.svg.update(...)",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:!0,description:"Updates the SVG connection between two elements.",env:"client",subCommand:[]},{name:"getCurve",version:"0.0.2",example:"dphelper.svg.getCurve(...)",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:!0,description:"Calculates the curve of the connection between two points.",env:"client",subCommand:[]},{name:"getIntersection",version:"0.0.2",example:"dphelper.svg.getIntersection(...) ",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:!0,description:"Calculates the intersection point between two elements.",env:"client",subCommand:[]},{name:"setConnector",version:"0.0.2",example:"dphelper.svg.setConnector(...)",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:!0,description:"Sets a connector on an element.",env:"client",subCommand:[]},{name:"removeConnection",version:"0.0.2",example:"dphelper.svg.removeConnection(...)",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:!0,description:"Removes an SVG connection from a container.",env:"client",subCommand:[]},{name:"makeScrollable",version:"0.0.2",example:"dphelper.svg.makeScrollable(...)",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:!0,description:"Makes an SVG container scrollable.",env:"client",subCommand:[]},{name:"makeDraggable",version:"0.0.2",example:"dphelper.svg.makeDraggable(...)",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:!0,description:"Makes an SVG element draggable.",env:"client",subCommand:[]},{name:"toggle",version:"0.0.2",example:"dphelper.svg.toggle(...)",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:!0,description:"Toggles an SVG connection on or off.",env:"client",subCommand:[]},{name:"convert",version:"0.0.2",example:"dphelper.svg.convert([Object])",author:"Dario Passariello",creationDate:"20190101",lastMod:"20240401",type:"function",active:!0,description:"Converts an element to SVG.",env:"client",subCommand:[]}]},Ee),dphelper?.svg?.check();var Ne={pulse:(e,t)=>{if("undefined"==typeof BroadcastChannel)return{emit:()=>{},stop:()=>{}};const o=new BroadcastChannel(`pulse_${e}`);return o.onmessage=e=>{if(e.origin===window.location.origin||!e.origin)try{const o=e.data;!o||"object"!=typeof o||o.__proto__||o.constructor||t(o)}catch(e){console.warn("[dphelper] Invalid message received in pulse:",e)}},{emit:e=>o.postMessage(e),stop:()=>o.close()}},tab:(e,t)=>{if("undefined"==typeof BroadcastChannel)return{post:()=>{},close:()=>{}};const o=new BroadcastChannel(e);return o.onmessage=e=>{if(e.origin===window.location.origin||!e.origin)try{const o=e.data;!o||"object"!=typeof o||o.__proto__||o.constructor||t(o)}catch(e){console.warn("[dphelper] Invalid message received in tab:",e)}},{post:e=>o.postMessage(e),close:()=>o.close()}},storageProxy:(e,t,o)=>{if("undefined"==typeof localStorage)return t;let a;const n=localStorage.getItem(e);if(n)if(o){const n=dphelper.security.getEncrypted(e,o);a=n?JSON.parse(n):t}else try{a=JSON.parse(n)}catch{a=t}else a=t;return new Proxy(a,{set(t,a,n){t[a]=n;const r=JSON.stringify(t);return o?dphelper.security.saveEncrypted(e,r,o):localStorage.setItem(e,r),!0}})}};dphelper?.setDescription({name:"sync",active:!0,subCommand:[{name:"tab",version:"0.0.2",example:"dphelper.sync.tab('my_channel', (data) => console.debug(data))",author:"Dario Passariello & Jo",creationDate:"20260220",lastMod:"20260220",type:"function",active:!0,description:"Synchronize data between tabs using BroadcastChannel",env:"client",subCommand:[]},{name:"storageProxy",version:"0.0.2",example:"const proxy = dphelper.sync.storageProxy('user_pref', {theme: 'dark'})",author:"Dario Passariello & Jo",creationDate:"20260220",lastMod:"20260220",type:"function",active:!0,description:"Create a Proxy object linked to localStorage for auto-sync",env:"client",subCommand:[]},{name:"pulse",version:"0.0.1",example:"dphelper.sync.pulse('chat', (msg) => ...)",author:"Dario Passariello",creationDate:"20260221",lastMod:"20260221",type:"function",active:!0,description:"Low-latency cross-tab event bus with automatic registration.",env:"client",subCommand:[]}]},Ne);dphelper?.setDescription({name:"system",active:!0,subCommand:[{name:"multiSplit",version:"0.0.2",example:"dphelper.system.multiSplit()",author:"Dario Passariello",creationDate:"20231121",lastMod:"20231121",type:"system",active:!0,description:"Run only one time when you load your App ... extend the .split with array as argument (example.split([',', ':', ';', '?', '/'])[0])",env:"both",subCommand:[]}]},{multiSplit:(e,t)=>{if(!e)return[];const o=t[0];if(!o)return[e];let a=e;for(let e=1;e<t.length;++e)a=a.split(t[e]).join(o);return a.split(o)}});var Le={name:"text",active:!0,subCommand:[{name:"trim",version:"0.0.2",example:"dphelper.text.trim(...)",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:!0,description:"Trims the specified characters from the start and end of a string.",env:"both",subCommand:[]},{name:"capitalize",version:"0.0.2",example:"dphelper.text.capitalize(...)",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:!0,description:"Capitalizes the first letter of each word in a string.",env:"both",subCommand:[]},{name:"lower",version:"0.0.2",example:"dphelper.text.lower(...)",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:!0,description:"Converts a string to lowercase.",env:"both",subCommand:[]},{name:"upper",version:"0.0.2",example:"dphelper.text.upper(...)",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:!0,description:"Converts a string to uppercase.",env:"both",subCommand:[]},{name:"nl2br",version:"0.0.2",example:"dphelper.text.nl2br(...)",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:!0,description:"Converts newlines in a string to HTML <br> tags.",env:"both",subCommand:[]},{name:"sanitize",version:"0.0.2",example:"dphelper.text.sanitize(...)",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:!0,description:"Sanitizes a string by removing HTML tags.",env:"both",subCommand:[]},{name:"camelCase",version:"0.0.2",example:"dphelper.text.camelCase(...)",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:!0,description:"Converts a string to camelCase.",subCommand:[{name:"toSpace",version:"0.0.2",example:"dphelper.text.camelCase.toSpace(...)",type:"function",active:!0,description:"Converts camelCase to space-separated words.",env:"both",subCommand:[],author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220"},{name:"toUnderscore",version:"0.0.2",example:"dphelper.text.camelCase.toUnderscore(...)",type:"function",active:!0,description:"Converts camelCase to underscore-separated words.",env:"both",subCommand:[],author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220"}]},{name:"fitContainer",version:"0.0.2",example:"dphelper.text.fitContainer([element])",type:"function",active:!0,description:"Adjusts the font size of an element to fit its container.",env:"both",subCommand:[],author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220"},{name:"keywords",version:"0.0.2",example:"dphelper.text.keywords([sentence])",type:"function",active:!0,description:"Extrapolate keywords from a sentence",env:"both",subCommand:[],author:"Dario Passariello",creationDate:"20250601",lastMod:"20250601"},{name:"replaceText",version:"0.0.2",example:"dphelper.text.replaceText([sentence, object])",type:"function",active:!0,description:'\n replace all occurrence from sentence using an object as list\n\n example:\n\n let text = replaceText(\n "Copyright 2022 (c) by dpHelper",\n {\n "(c)": \'&copy;\',\n "(r)": \'&reg;\'\n }\n )\n\n Copyright text (c) became an html symbol\n ',env:"both",subCommand:[],author:"Dario Passariello",creationDate:"20250612",lastMod:"20250612"}]},je={trim:(e,t,o,a)=>e.charAt(0)===t?e.substring(o,a):e,capitalize:e=>e.toLowerCase().replace(/\b\w/g,e=>e.toUpperCase()),lower:e=>e.toLowerCase(),upper:e=>e.toUpperCase(),nl2br:e=>e.replace(/(?:\r\n|\r|\n)/g,"<br>"),sanitize:e=>e.replace(/<(|\/|[^>\bi]|\/[^>bi]|[^/>][^>]+|\/[^>][^>]+)>/g,""),camelCase:{toSpace:e=>e.replace(/([A-Z])/g," $1").replace(/^./,e=>e.toUpperCase()),toUnderscore:e=>e.replace(/\.?([A-Z])/g,(e,t)=>`_${t.toLowerCase()}`).replace(/^_/,"")},fitContainer:e=>{e&&dphelper.addListenerMulti(window,"load resize",()=>function(e){const t=document.querySelectorAll(e),o=t.length;if(!(o<=0))for(let e=0;e<o;e++){const o=.05*t[e].offsetWidth;t[e].style.fontSize=`${o}px`}}(e))},keywords:e=>{const t=e.match(/\b[A-Z][a-z]+\b/g)?.filter(e=>e.length>3)||[];return[...new Set(t.map(e=>e.toLowerCase()))]},replaceText:(e,t)=>{let o=e;for(const e in t)Object.hasOwn(t,e)&&(o=o.replaceAll(e,t[e]||""));return o}};dphelper?.setDescription(Le,je);var qe={sleep:e=>new Promise(t=>setTimeout(t,e)),percentage:(e,t)=>{function o(e){const t=e.split(":");return 3600*Number.parseInt(t[0]||"",10)+60*Number.parseInt(t[1]||"",10)+Number.parseInt(t[2]||"",10)}return(100*o(e)/o(t)).toFixed(2)}};dphelper?.setDescription({name:"timer",active:!0,subCommand:[{name:"sleep",version:"0.0.2",example:"dphelper.timer.sleep([ms]) ",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:!0,description:"Pauses execution for a specified number of milliseconds.",env:"both",subCommand:[]},{name:"percentage",version:"0.0.2",example:"dphelper.timer.percentage([start], [end])",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:!0,description:"Calculates the percentage of time elapsed between two time strings.",env:"both",subCommand:[]}]},qe);var $e={byteSize:e=>{const t=1024;if(Math.abs(e)<t)return`${e}b`;const o=["Kb","Mb","Gb","Tb","Pb","Eb","Zb","Yb"];let a=-1,n=e;do{n/=t,++a}while(Math.abs(n)>=t&&a<o.length-1);return n.toFixed(1)+o[a]},zIndex:()=>Array.from(document.querySelectorAll("body *")).map(e=>Number.parseFloat(getComputedStyle(e).zIndex)).reduce((e,t)=>t>e?t:e,1),zeroToFalse:e=>0!==e&&e};dphelper?.setDescription({name:"tools",active:!0,subCommand:[{name:"byteSize",description:"Give you the total in 'Kb', 'Mb', 'Gb', 'Tb', 'Pb', 'Eb', 'Zb', 'Yb' starting from bytes",example:"dphelper.tools.byteSize(bytes)",version:"0.0.2",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:!0,env:"both",subCommand:[]},{name:"hashPass",description:"Hashes a password using a specified number and total.",example:"dphelper.tools.hashPass(number, total)",version:"0.0.2",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:!0,env:"both",subCommand:[]},{name:"zIndex",description:"Finds the highest z-index value in the document.",example:"dphelper.tools.zIndex()",version:"0.0.2",author:"Dario Passariello",creationDate:"20240807",lastMod:"20240807",type:"function",active:!0,env:"both",subCommand:[]},{name:"zeroToFalse",description:"Converts zero to false, otherwise returns the value.",example:"dphelper.tools.zeroToFalse(num)",version:"0.0.2",author:"Dario Passariello",creationDate:"20240924",lastMod:"20240924",type:"function",active:!0,env:"both",subCommand:[]}]},$e);var Ie={convertMatrixToScale:e=>{const t=e.split("(");if(t.length<2)return 0;const o=t[1].split(")")[0];if(!o)return 0;const a=o.split(","),n=Number.parseFloat(a[0]||"0"),r=Number.parseFloat(a[1]||"0");return Math.sqrt(n*n+r*r)}};dphelper?.setDescription({name:"translators",active:!0,subCommand:[{name:"convertMatrixToScale",version:"0.0.2",example:"dphelper.translators.convertMatrixToScale({value})",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:!0,description:"Converts a transformation matrix to a scale value.",env:"both",subCommand:[]}]},Ie);var Oe=new Map,Re={add:(e,t)=>{Oe.has(e)||Oe.set(e,new Set),Oe.get(e).add(t)},on:(e,t)=>{Re.add(e,t)},emit:(e,...t)=>{const o=Oe.get(e);o&&o.forEach(o=>{try{o(...t)}catch(t){console.error(`Error in trigger callback for event '${e}':`,t)}})},remove:e=>{Oe.delete(e)},off:(e,t)=>{const o=Oe.get(e);o&&o.delete(t)},clear:()=>{Oe.clear()},list:()=>Array.from(Oe.keys())};dphelper?.setDescription({name:"triggers",active:!0,subCommand:[{name:"add",version:"0.0.1",example:"dphelper.triggers.add('event', callback)",author:"Dario Passariello",creationDate:"20250220",lastMod:"20250220",type:"function",active:!0,description:"Add a trigger for custom events.",env:"client",subCommand:[]},{name:"on",version:"0.0.1",example:"dphelper.triggers.on('event', callback)",author:"Dario Passariello",creationDate:"20250220",lastMod:"20250220",type:"function",active:!0,description:"Listen for a trigger event.",env:"client",subCommand:[]},{name:"emit",version:"0.0.1",example:"dphelper.triggers.emit('event', data)",author:"Dario Passariello",creationDate:"20250220",lastMod:"20250220",type:"function",active:!0,description:"Emit a trigger event.",env:"client",subCommand:[]},{name:"remove",version:"0.0.1",example:"dphelper.triggers.remove('event')",author:"Dario Passariello",creationDate:"20250220",lastMod:"20250220",type:"function",active:!0,description:"Remove a trigger event.",env:"client",subCommand:[]}]},Re);var ze={of:e=>typeof e,instOfObj:e=>e instanceof Object,isNull:e=>t=>!e(t),isBool:e=>!e||null==e.length||"1"===e};dphelper?.setDescription({name:"type",active:!0,subCommand:[{name:"of",version:"0.0.2",example:"dphelper.type.of(...)",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:!0,description:"Returns the type of the given parameter.",env:"both",subCommand:[]},{name:"instOfObj",version:"0.0.2",example:"dphelper.type.instOfObj(...)",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:!0,description:"Checks if the given parameter is an instance of Object.",env:"both",subCommand:[]},{name:"isNaN",version:"0.0.2",example:"dphelper.type.isNaN(...)",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:!0,description:"Checks if the given parameter is NaN.",env:"both",subCommand:[]},{name:"isBool",version:"0.0.2",example:"dphelper.type.isBool(...)",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:!0,description:"Checks if the given parameter is a boolean.",env:"both",subCommand:[]}]},ze);var Ue={anchorContext:()=>{if("undefined"==typeof window||"undefined"==typeof localStorage)return;const e=`dp_anchor_${btoa(location.pathname).replace(/=/g,"")}`;window.addEventListener("beforeunload",()=>{const t={scroll:{x:window.scrollX,y:window.scrollY},inputs:Array.from(document.querySelectorAll("input, textarea, select")).filter(e=>"password"!==e.type&&!e.hasAttribute("data-private")&&"off"!==e.getAttribute("autocomplete")).map(e=>({id:e.id,name:e.name,value:e.value}))};localStorage.setItem(e,JSON.stringify(t))}),(()=>{const t=localStorage.getItem(e);if(t)try{const e=JSON.parse(t);window.scrollTo(e.scroll.x,e.scroll.y),e.inputs.forEach(e=>{const t=e.id?document.getElementById(e.id):document.querySelector(`[name="${e.name}"]`);t&&(t.value=e.value)})}catch(e){console.warn("dphelper: anchorContext restoration failed.")}})()},fps:(e=!0)=>{if("undefined"==typeof document)return;let t=document.getElementById("dphelper-fps-monitor");if(!e)return void t?.remove();t||(t=document.createElement("div"),t.id="dphelper-fps-monitor",Object.assign(t.style,{position:"fixed",top:"10px",right:"10px",padding:"8px 12px",background:"rgba(0,0,0,0.8)",color:"#0f0",fontFamily:"monospace",fontSize:"12px",zIndex:"99999",borderRadius:"4px",pointerEvents:"none",boxShadow:"0 2px 10px rgba(0,0,0,0.5)",border:"1px solid #333"}),document.body.appendChild(t));let o=0,a=performance.now();const n=()=>{if(!document.getElementById("dphelper-fps-monitor"))return;o++;const e=performance.now();if(e>=a+1e3){const n=Math.round(1e3*o/(e-a)),r=performance.memory?` | Mem: ${Math.round(performance.memory.usedJSHeapSize/1048576)}MB`:"";t.innerText=`FPS: ${n}${r}`,o=0,a=e}requestAnimationFrame(n)};requestAnimationFrame(n)},boxModel:(e=!0)=>{if("undefined"==typeof document)return;let t=document.getElementById("dphelper-boxmodel-style");e?t||(t=document.createElement("style"),t.id="dphelper-boxmodel-style",t.innerHTML="\n * { outline: 1px solid rgba(255, 0, 0, 0.3) !important; }\n * * { outline: 1px solid rgba(0, 255, 0, 0.3) !important; }\n * * * { outline: 1px solid rgba(0, 0, 255, 0.3) !important; }\n * * * * { outline: 1px solid rgba(255, 255, 0, 0.3) !important; }\n ",document.head.appendChild(t)):t?.remove()}};dphelper?.setDescription({name:"UI",active:!0,subCommand:[{name:"input",version:"0.0.2",example:"dphelper.UI.input(...)",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:!0,description:"Creates an input element with specified options.",env:"client",subCommand:[]},{name:"fps",version:"0.0.2",example:"dphelper.UI.fps(true)",author:"Dario Passariello & Jo",creationDate:"20260220",lastMod:"20260220",type:"function",active:!0,description:"Toggle a real-time FPS and Memory monitor overlay",env:"client",subCommand:[]},{name:"boxModel",version:"0.0.2",example:"dphelper.UI.boxModel(true)",author:"Dario Passariello & Jo",creationDate:"20260220",lastMod:"20260220",type:"function",active:!0,description:"Toggle visual box-model highlighter for all elements",env:"client",subCommand:[]},{name:"anchorContext",version:"0.0.1",example:"dphelper.UI.anchorContext()",author:"Dario Passariello",creationDate:"20260221",lastMod:"20260221",type:"function",active:!0,description:"Snapshot and auto-restore UI state (inputs, scroll) across reloads.",env:"client",subCommand:[]}]},Ue);var Fe=!1,He=!1,_e={enhancement:()=>{window.offScreenBuffering="auto",dphelper.window.animationframe()},animationframe:()=>window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||(e=>{window.setTimeout(e,1e3/120)}),center:({url:e,title:t,name:o,w:a,h:n})=>{const r=void 0!==screenLeft?screenLeft:screenX,i=void 0!==screenTop?screenTop:screenY,s=innerWidth||(document.documentElement.clientWidth?document.documentElement.clientWidth:screen.width),l=innerHeight||(document.documentElement.clientHeight?document.documentElement.clientHeight:screen.height),c=s/screen.availWidth,d=open(e,t,`\n scrollbars=yes,\n width=${a/c},\n height=${n/c},\n top=${(l-n)/2/c+i},\n left=${(s-a)/2/c+r}\n `);onfocus=()=>d?.focus()},onBeforeUnLoad:e=>{const t="You have made some changes which you might want to save.",o=e=>(e.preventDefault(),t),a=e?document.querySelector(e):null;a&&a.addEventListener("input",()=>{""!==a.value?(Fe=!0,addEventListener("beforeunload",o,{capture:!0})):(Fe=!1,removeEventListener("beforeunload",o,{capture:!0}))}),!1===He&&(document.body.addEventListener("click",e=>{const o=e.target;if(o&&"img"===o.tagName.toLowerCase()&&!0===Fe){if(!0===confirm(t))return void(Fe=!1);e.preventDefault()}}),He=!0),addEventListener("popstate",e=>{if(!0===Fe){return!0===confirm(t)?void(Fe=!1):(e.stopImmediatePropagation(),void e.preventDefault())}}),onbeforeunload=e=>{if(!0===Fe)return e.preventDefault(),e.returnValue=t}},purge:(e=document,t=1e4)=>{setTimeout(()=>{if(!e)return;let t=e.attributes;if(t){const o=t.length;for(let a=0;a<o;a+=1){const o=t[a].name;"function"==typeof e[o]&&(e[o]=null),void 0===e[o]&&(e[o]=null)}}if(t=e.childNodes,t){const o=t.length;for(let t=0;t<o;t+=1)dphelper.purge(e.childNodes[t])}},t)},stopZoomWheel:()=>{addEventListener("wheel",e=>{e.ctrlKey&&e.preventDefault()},{passive:!1}),addEventListener("keydown",e=>{const t=dphelper.event.keys(e);["+","-","="].includes(t.key)&&t.ctrl&&e.preventDefault()})},setZoom:(e="html",t=1)=>{t<0&&(t=1);const o=document.querySelector(e);return o&&(o.style.zoom=String(t)),`New zoom value: ${100*t}% (css: ${t})`},getZoom:(e="html")=>{const t=document.querySelector(e);return Number(t?.style.zoom||1)}};dphelper?.setDescription({name:"window",active:!0,subCommand:[{name:"enhancement",version:"0.0.2",example:"dphelper.window.enhancement()",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:!0,description:"Use only one time at end of application",env:"client",subCommand:[]},{name:"center",version:"0.0.2",example:"dphelper.window.center({ url, title, name, w, h })",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:!0,description:"Use to center popup to screen",env:"client",subCommand:[]},{name:"onBeforeUnLoad",version:"0.0.2",example:"dphelper.window.onBeforeUnLoad()",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:!0,description:"Message during leave the site",env:"client",subCommand:[]},{name:"purge",version:"0.0.2",example:"dphelper.window.purge()",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:!0,description:"Purge from memory",env:"client",subCommand:[]},{name:"stopZoomWheel",version:"0.0.2",example:"dphelper.window.stopZoomWheel(e)",author:"Dario Passariello",creationDate:"20230527",lastMod:"20230527",type:"function",active:!0,description:"Stop Zoom Generated by Mouse Wheel",env:"client",subCommand:[]},{name:"setZoom",version:"0.0.2",example:"dphelper.window.setZoom([el,1])",author:"Dario Passariello",creationDate:"20240727",lastMod:"20220727",type:"function",active:!0,description:"Set the zoom level of an element",env:"client",subCommand:[]},{name:"getZoom",version:"0.0.2",example:"dphelper.window.getZoom([el])",author:"Dario Passariello",creationDate:"20240727",lastMod:"20220727",type:"function",active:!0,description:"Get the zoom level of an element",env:"client",subCommand:[]}]},_e);var We=(e,t={})=>{const o=new Worker(e);return t.onmessage&&(o.onmessage=t.onmessage),t.onerror&&(o.onerror=t.onerror),o},Be=(e,t,o)=>{o?e.postMessage(t,o):e.postMessage(t)},Je={create:We,createInline:(e,t={})=>{const o=new Blob([e],{type:"application/javascript"}),a=URL.createObjectURL(o),n=We(a,t);return n.onmessage=e=>{t.onmessage?.(e)},n},post:Be,terminate:e=>{e.terminate()},pool:(e,t=4)=>{const o=[],a=new Set;for(let a=0;a<t;a++)o.push(We(e));return{workers:o,busy:a,queue:[],size:t}},poolExec:async(e,t)=>new Promise((o,a)=>{const n=new Array(t.length);let r=0;const i=()=>{for(;e.queue.length>0&&e.busy.size<e.size;){const{task:t}=e.queue.shift();s(t.index,t.data)}},s=(a,s)=>{const l=e.workers.find(t=>!e.busy.has(t));if(!l)return;e.busy.add(l);const c=s=>{l.removeEventListener("message",c),e.busy.delete(l),n[a]=s.data,r++,r===t.length?o(n):i()};l.addEventListener("message",c),Be(l,{index:a,data:s})};t.forEach((t,o)=>{e.queue.push({task:{index:o,data:t}})}),i()}),importScripts:(e,t)=>{const o=t.map(e=>`importScripts('${e}');`).join("\n"),a=new Blob([o],{type:"application/javascript"}),n=URL.createObjectURL(a);Be(e,{type:"import",url:n})},shared:(e,t={})=>{const o=new SharedWorker(e,t.name?{name:t.name}:void 0);return t.onmessage&&(o.port.onmessage=t.onmessage),o}};dphelper?.setDescription({name:"worker",active:!0,subCommand:[{name:"create",version:"0.0.1",example:"dphelper.worker.create('worker.js', { onmessage: (e) => console.log(e.data) })",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:!0,description:"Create a new Web Worker from a script URL or inline code",env:"client",subCommand:[]},{name:"createInline",version:"0.0.1",example:"dphelper.worker.createInline('self.onmessage = e => postMessage(e.data * 2)')",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:!0,description:"Create a Web Worker from inline JavaScript code",env:"client",subCommand:[]},{name:"post",version:"0.0.1",example:"dphelper.worker.post(worker, { type: 'compute', data: 42 })",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:!0,description:"Send a message to a worker",env:"client",subCommand:[]},{name:"terminate",version:"0.0.1",example:"dphelper.worker.terminate(worker)",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:!0,description:"Terminate a Web Worker",env:"client",subCommand:[]},{name:"pool",version:"0.0.1",example:"dphelper.worker.pool('worker.js', 4)",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:!0,description:"Create a pool of workers for parallel processing",env:"client",subCommand:[]},{name:"poolExec",version:"0.0.1",example:"dphelper.worker.poolExec(pool, tasks)",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:!0,description:"Execute tasks across a worker pool",env:"client",subCommand:[]},{name:"importScripts",version:"0.0.1",example:"dphelper.worker.importScripts(worker, ['lib1.js', 'lib2.js'])",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:!0,description:"Import external scripts into a worker",env:"client",subCommand:[]},{name:"shared",version:"0.0.1",example:"dphelper.worker.shared('my-shared-buffer')",author:"Dario Passariello",creationDate:"20260313",lastMod:"20260313",type:"function",active:!0,description:"Create a SharedWorker for cross-tab communication",env:"client",subCommand:[]}]},Je);var Ge=setInterval(()=>{dphelper._list||(dphelper._list={sockets:[],scripts:[]});const e=dphelper?.socket?.list(),t=[];e&&(e.map(e=>(t.push(e.url),!1)),dphelper._list.sockets=t,t.length>0&&clearInterval(Ge))},1e3);Object.preventExtensions(dphelper),Object.seal(dphelper);