wulf.js 1.9.2 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (81) hide show
  1. package/README.md +124 -78
  2. package/changelog.md +105 -0
  3. package/dist/focus-trap.esm.js +245 -126
  4. package/dist/focus-trap.esm.js.map +3 -3
  5. package/dist/focus-trap.global.js +247 -128
  6. package/dist/focus-trap.global.js.map +3 -3
  7. package/dist/focus-trap.global.min.js +4 -4
  8. package/dist/focus-trap.global.min.js.map +4 -4
  9. package/dist/index.esm.js +2434 -905
  10. package/dist/index.esm.js.map +4 -4
  11. package/dist/index.global.js +2436 -907
  12. package/dist/index.global.js.map +4 -4
  13. package/dist/index.global.min.js +4 -4
  14. package/dist/index.global.min.js.map +4 -4
  15. package/dist/mask.css +1 -1
  16. package/dist/mask.css.map +2 -2
  17. package/dist/mask.esm.js +746 -346
  18. package/dist/mask.esm.js.map +3 -3
  19. package/dist/mask.global.js +748 -348
  20. package/dist/mask.global.js.map +3 -3
  21. package/dist/mask.global.min.js +4 -4
  22. package/dist/mask.global.min.js.map +4 -4
  23. package/dist/mask.layered.css +1 -0
  24. package/dist/mask.layered.css.map +7 -0
  25. package/dist/masonry.css +1 -1
  26. package/dist/masonry.css.map +2 -2
  27. package/dist/masonry.esm.js +341 -114
  28. package/dist/masonry.esm.js.map +3 -3
  29. package/dist/masonry.global.js +343 -116
  30. package/dist/masonry.global.js.map +3 -3
  31. package/dist/masonry.global.min.js +4 -4
  32. package/dist/masonry.global.min.js.map +4 -4
  33. package/dist/masonry.layered.css +1 -0
  34. package/dist/masonry.layered.css.map +7 -0
  35. package/dist/scroll.css +1 -1
  36. package/dist/scroll.css.map +2 -2
  37. package/dist/scroll.esm.js +524 -153
  38. package/dist/scroll.esm.js.map +3 -3
  39. package/dist/scroll.global.js +526 -155
  40. package/dist/scroll.global.js.map +3 -3
  41. package/dist/scroll.global.min.js +4 -4
  42. package/dist/scroll.global.min.js.map +4 -4
  43. package/dist/scroll.layered.css +1 -0
  44. package/dist/scroll.layered.css.map +7 -0
  45. package/dist/shortcut.esm.js +209 -46
  46. package/dist/shortcut.esm.js.map +3 -3
  47. package/dist/shortcut.global.js +211 -48
  48. package/dist/shortcut.global.js.map +3 -3
  49. package/dist/shortcut.global.min.js +2 -2
  50. package/dist/shortcut.global.min.js.map +4 -4
  51. package/dist/toast.css +1 -1
  52. package/dist/toast.css.map +2 -2
  53. package/dist/toast.esm.js +590 -160
  54. package/dist/toast.esm.js.map +3 -3
  55. package/dist/toast.global.js +592 -162
  56. package/dist/toast.global.js.map +3 -3
  57. package/dist/toast.global.min.js +4 -4
  58. package/dist/toast.global.min.js.map +4 -4
  59. package/dist/toast.layered.css +1 -0
  60. package/dist/toast.layered.css.map +7 -0
  61. package/dist/types/common/dom.d.ts +38 -0
  62. package/dist/types/focus-trap/FocusTrap.d.ts +15 -5
  63. package/dist/types/focus-trap/types.d.ts +2 -2
  64. package/dist/types/index.d.ts +10 -0
  65. package/dist/types/mask/AmountEngine.d.ts +1 -0
  66. package/dist/types/mask/BaseInputMask.d.ts +24 -0
  67. package/dist/types/mask/InputAmountMask.d.ts +3 -0
  68. package/dist/types/mask/InputEmailMask.d.ts +16 -1
  69. package/dist/types/mask/InputMask.d.ts +1 -0
  70. package/dist/types/mask/MaskEngine.d.ts +4 -0
  71. package/dist/types/masonry/Masonry.d.ts +10 -3
  72. package/dist/types/scroll/ScrollBlock.d.ts +31 -3
  73. package/dist/types/scroll/types.d.ts +13 -1
  74. package/dist/types/shortcut/ShortcutFormatter.d.ts +6 -0
  75. package/dist/types/shortcut/ShortcutManager.d.ts +5 -0
  76. package/dist/types/toast/Toast.d.ts +4 -0
  77. package/dist/types/toast/ToastInstance.d.ts +22 -10
  78. package/dist/types/toast/ToastManager.d.ts +37 -4
  79. package/dist/types/toast/i18n/types.d.ts +2 -0
  80. package/dist/types/toast/types.d.ts +14 -2
  81. package/package.json +20 -5
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
- "sources": ["../src/mask/index.ts", "../src/common/AuditableComponent.ts", "../src/mask/BaseInputMask.ts", "../src/mask/MaskEngine.ts", "../src/mask/MaskHistory.ts", "../src/mask/MaskKeyboard.ts", "../src/mask/InputMask.ts", "../src/mask/AmountEngine.ts", "../src/mask/InputAmountMask.ts", "../src/mask/EmailEngine.ts", "../src/mask/InputEmailMask.ts"],
4
- "sourcesContent": ["import { BaseInputMask } from './BaseInputMask';\nimport { InputMask } from './InputMask';\nimport { MaskEngine } from './MaskEngine';\nimport { MaskHistory } from './MaskHistory';\nimport { MaskKeyboard } from './MaskKeyboard';\nimport { AmountEngine } from './AmountEngine';\nimport { InputAmountMask } from './InputAmountMask';\nimport { EmailEngine } from './EmailEngine';\nimport { InputEmailMask } from './InputEmailMask';\n\nexport * from './types';\nexport * from './BaseInputMask';\nexport * from './AmountEngine';\nexport * from './InputAmountMask';\nexport * from './EmailEngine';\nexport * from './InputEmailMask';\n\nexport {\n BaseInputMask,\n InputMask,\n MaskEngine,\n MaskHistory,\n MaskKeyboard,\n AmountEngine,\n InputAmountMask,\n EmailEngine,\n InputEmailMask\n};\n\nexport const Mask = {\n BaseInputMask,\n InputMask,\n MaskEngine,\n MaskHistory,\n MaskKeyboard,\n AmountEngine,\n InputAmountMask,\n EmailEngine,\n InputEmailMask\n};\n\n// D\u00E9claration pour inclusion directe en balise <script>\nif (typeof window !== 'undefined') {\n const win = window as unknown as Record<string, unknown>;\n const wulfNamespace = ((win.Wulf as Record<string, unknown>) || {}) as Record<string, unknown>;\n win.Wulf = wulfNamespace;\n \n // Namespace sp\u00E9cifique et exclusif \u00E0 la librairie Mask : Wulf.Mask\n wulfNamespace.Mask = Mask;\n}\n\nexport default InputMask;\n", "export interface AuditableOptions {\n /**\n * Ex\u00E9cute un audit d'accessibilit\u00E9 WAI-ARIA \u00E0 l'initialisation (console.warn si contraintes manquantes).\n * @default true\n */\n audit?: boolean;\n}\n\nexport interface IAuditable {\n /**\n * V\u00E9rifie la conformit\u00E9 d'accessibilit\u00E9 WAI-ARIA du composant et retourne la liste des contraintes manquantes.\n */\n audit(): string[];\n}\n\n/**\n * Classe abstraite de base imposant et factorisant le m\u00E9canisme d'audit d'accessibilit\u00E9 WAI-ARIA\n * sur l'ensemble des composants de la suite Wulf.\n */\nexport abstract class AuditableComponent implements IAuditable {\n /**\n * Analyse l'\u00E9tat DOM / options du composant et retourne la liste des contraintes d'accessibilit\u00E9 manquantes.\n */\n public abstract audit(): string[];\n\n /**\n * Identifiant du composant affich\u00E9 dans l'en-t\u00EAte du warning console (ex: \"Wulf.FocusTrap\", \"Wulf.Scroll\").\n */\n protected abstract getAuditPrefix(): string;\n\n /**\n * S\u00E9lecteur ou description de l'\u00E9l\u00E9ment DOM audit\u00E9 (ex: \"#my-modal\", \"<input>\").\n */\n protected abstract getAuditTargetLabel(): string;\n\n /**\n * Indication affich\u00E9e en pied de warning pour expliquer comment d\u00E9sactiver l'audit.\n */\n protected getAuditDisableHint(): string {\n return 'Passez { audit: false } dans les options pour d\u00E9sactiver cet avertissement';\n }\n\n /**\n * Ex\u00E9cute l'audit d'accessibilit\u00E9 et \u00E9met un avertissement standardis\u00E9 dans la console\n * si l'audit est activ\u00E9 et que des contraintes manquent.\n */\n protected runAuditWarning(enabled: boolean = true): string[] {\n if (!enabled) return [];\n\n const warnings = this.audit();\n if (warnings.length > 0 && typeof console !== 'undefined' && typeof console.warn === 'function') {\n console.warn(\n `[${this.getAuditPrefix()}] Audit d'accessibilit\u00E9 \u2014 ${warnings.length} contrainte(s) manquante(s) sur ${this.getAuditTargetLabel()} :\\n` +\n warnings.map((w) => ` - ${w}`).join('\\n') +\n `\\n(${this.getAuditDisableHint()})`\n );\n }\n return warnings;\n }\n\n /**\n * V\u00E9rifie si un attribut de r\u00E9f\u00E9rence d'IDs ARIA (ex: aria-labelledby, aria-describedby)\n * pointe vers des \u00E9l\u00E9ments r\u00E9ellement pr\u00E9sents dans le document.\n */\n protected checkAriaIdReferences(\n element: HTMLElement,\n attrName: 'aria-labelledby' | 'aria-describedby',\n warnings: string[]\n ): boolean {\n const rawValue = element.getAttribute(attrName)?.trim();\n if (!rawValue) return false;\n\n const doc = element.ownerDocument || document;\n const ids = rawValue.split(/\\s+/).filter(Boolean);\n const isValid = ids.length > 0 && ids.every((id) => Boolean(doc.getElementById(id)));\n\n if (!isValid) {\n warnings.push(\n `Attribut ${attrName}=\"${rawValue}\" invalide : l'\u00E9l\u00E9ment cible est introuvable dans le DOM.`\n );\n }\n\n return isValid;\n }\n}\n\n", "import { BaseMaskOptions, IInputMask } from './types';\nimport { AuditableComponent } from '../common/AuditableComponent';\n\n/**\n * Structure de r\u00E9sultat lors de la normalisation des param\u00E8tres du constructeur.\n */\nexport interface ResolvedMaskTarget<TOptions extends BaseMaskOptions> {\n wrapper: HTMLElement | null;\n input: HTMLInputElement;\n options: TOptions;\n}\n\n/**\n * D\u00E9termine et extrait avec pr\u00E9cision le wrapper, l'input et les options\n * qu'on appelle sous forme (wrapper, input, options) ou (input, options).\n */\nexport function resolveMaskConstructorArgs<TOptions extends BaseMaskOptions>(\n targetOrWrapper: HTMLElement | HTMLInputElement | null | undefined,\n inputOrOptions?: HTMLInputElement | TOptions,\n maybeOptions?: TOptions\n): ResolvedMaskTarget<TOptions> {\n const isSecondArgInput = Boolean(\n inputOrOptions &&\n typeof inputOrOptions === 'object' &&\n 'tagName' in inputOrOptions &&\n (inputOrOptions as HTMLElement).tagName === 'INPUT'\n );\n\n if (isSecondArgInput) {\n return {\n wrapper: (targetOrWrapper as HTMLElement) || null,\n input: inputOrOptions as HTMLInputElement,\n options: (maybeOptions || {}) as TOptions\n };\n }\n\n return {\n wrapper: null,\n input: targetOrWrapper as HTMLInputElement,\n options: ((inputOrOptions && typeof inputOrOptions === 'object' && !('tagName' in inputOrOptions))\n ? inputOrOptions\n : {}) as TOptions\n };\n}\n\n/**\n * Classe abstraite de base pour tous les contr\u00F4leurs InputMask.\n * Mutualise la manipulation DOM, la gestion du pseudo-\u00E9l\u00E9ment ghosting,\n * la synchronisation g\u00E9om\u00E9trique typographique, l'interception de .value\n * et les m\u00E9thodes de cycle de vie (enable/disable, destroy).\n */\nexport abstract class BaseInputMask<TOptions extends BaseMaskOptions = BaseMaskOptions>\n extends AuditableComponent\n implements IInputMask<TOptions> {\n public wrapper: HTMLElement;\n public input: HTMLInputElement;\n public options: TOptions;\n public ghost: HTMLElement | null = null;\n\n protected isWrapperCreated: boolean = false;\n protected isDestroyed: boolean = false;\n protected isFocused: boolean = false;\n protected isDispatchingNativeInput: boolean = false;\n protected lastTrackedValue: string = '';\n protected nativeValueDescriptor: PropertyDescriptor | null = null;\n protected onCutHandler: () => void = () => { };\n protected onFormResetHandler?: () => void;\n protected mutationObserver: MutationObserver | null = null;\n protected focusSelectTimerId: number | null = null;\n\n constructor(input: HTMLInputElement, options?: TOptions);\n constructor(wrapper: HTMLElement | null, input: HTMLInputElement, options?: TOptions);\n constructor(\n targetOrWrapper: HTMLElement | HTMLInputElement | null | undefined,\n inputOrOptions?: HTMLInputElement | TOptions,\n maybeOptions?: TOptions\n );\n constructor(\n targetOrWrapper: HTMLElement | HTMLInputElement | null | undefined,\n inputOrOptions?: HTMLInputElement | TOptions,\n maybeOptions?: TOptions\n ) {\n super();\n const { wrapper: providedWrapper, input, options } = resolveMaskConstructorArgs(targetOrWrapper, inputOrOptions, maybeOptions);\n\n if (!input || typeof input !== 'object' || input.nodeType !== 1 || input.tagName !== 'INPUT') {\n throw new Error(`[${new.target.name || 'InputMask'}] input (HTMLInputElement) est requis.`);\n }\n\n this.input = input;\n\n const dataCreateWrapper = this.input.getAttribute('data-mask-create-wrapper') === 'true';\n const shouldCreateWrapper = Boolean(options.createWrapper ?? dataCreateWrapper);\n\n let effectiveWrapper = providedWrapper;\n\n if (!effectiveWrapper && shouldCreateWrapper) {\n const span = document.createElement('span');\n span.className = 'wulf-mask-wrapper';\n span.style.display = 'inline-grid';\n span.style.gridTemplateColumns = '1fr';\n span.style.gridTemplateRows = '1fr';\n span.style.verticalAlign = 'middle';\n span.style.boxSizing = 'border-box';\n span.style.position = 'relative';\n\n if (this.input.parentNode) {\n this.input.parentNode.insertBefore(span, this.input);\n }\n span.appendChild(this.input);\n\n this.input.style.gridArea = '1 / 1 / 2 / 2';\n this.input.style.boxSizing = 'border-box';\n\n effectiveWrapper = span;\n this.isWrapperCreated = true;\n }\n\n if (!effectiveWrapper) {\n throw new Error(`[${new.target.name || 'InputMask'}] wrapper (HTMLElement) et input (HTMLInputElement) sont requis, ou activez l'option createWrapper: true.`);\n }\n\n this.wrapper = effectiveWrapper;\n\n // Protection globale contre les types d'input incompatibles avec la s\u00E9lection\n this.normalizeInputType();\n\n const dataFocusOnly = this.getAttr('data-mask-focus-only') === 'true';\n const dataDisabled = this.hasAttr('data-disabled');\n const dataSelectAll = this.getAttr('data-mask-select-on-focus') === 'true';\n const dataCopyRaw = this.getAttr('data-mask-copy-raw') === 'true';\n const dataAlign = (this.getAttr('data-mask-align') || this.getAttr('data-align')) as 'left' | 'right' | 'center' | null;\n const dataAudit = this.getAttr('data-mask-audit');\n\n const { disabled: optDisabled, align: optAlign, ...otherOptions } = options;\n const resolvedDisabled = optDisabled !== undefined ? optDisabled : (dataDisabled ? true : false);\n const resolvedAudit = options.audit ?? (dataAudit !== null ? dataAudit !== 'false' : true);\n\n const isPassword = this.input.type === 'password';\n this.options = {\n ...otherOptions,\n createWrapper: shouldCreateWrapper,\n showMaskOnFocus: options.showMaskOnFocus ?? dataFocusOnly ?? false,\n selectAllOnFocus: options.selectAllOnFocus ?? dataSelectAll ?? false,\n copyRaw: isPassword ? false : (options.copyRaw ?? dataCopyRaw ?? false),\n disabled: resolvedDisabled,\n align: optAlign ?? (dataAlign || undefined),\n emitNativeInput: options.emitNativeInput ?? true,\n audit: resolvedAudit\n } as TOptions;\n\n if (this.options.showMaskOnFocus) {\n this.wrapper.classList.add('mask-focus-only');\n }\n if (this.options.disabled) {\n this.wrapper.setAttribute('data-disabled', 'true');\n }\n if (this.options.align) {\n this.setAlign(this.options.align);\n }\n\n this.createGhost();\n this.hookValueProperty();\n this.bindBaseEvents();\n this.initMutationObserver();\n }\n\n /**\n * R\u00E9cup\u00E8re un attribut depuis le wrapper ou l'input natif.\n */\n protected getAttr(name: string): string | null {\n return this.input.getAttribute(name) || this.wrapper.getAttribute(name);\n }\n\n /**\n * V\u00E9rifie la pr\u00E9sence d'un attribut sur le wrapper ou l'input natif.\n */\n protected hasAttr(name: string): boolean {\n return this.wrapper.hasAttribute(name) || this.input.hasAttribute(name);\n }\n\n /**\n * Indique si un placeholder natif non vide est configur\u00E9 sur l'input.\n */\n public hasNativePlaceholder(): boolean {\n return Boolean(this.input.placeholder && this.input.placeholder.trim().length > 0);\n }\n\n /**\n * D\u00E9termine si le masque fant\u00F4me doit s'effacer pour laisser place au placeholder natif\n * lorsque le champ est vide et n'a pas le focus.\n */\n public shouldHideGhostForPlaceholder(isInputEmpty: boolean): boolean {\n return !this.isFocused && isInputEmpty && this.hasNativePlaceholder();\n }\n\n /**\n * Attache les \u00E9couteurs de base pour focus/blur, copie brute et s\u00E9lection.\n */\n protected bindBaseEvents(): void {\n this.input.addEventListener('copy', this.onBaseCopy);\n this.input.addEventListener('focus', this.onBaseFocus);\n this.input.addEventListener('blur', this.onBaseBlur);\n }\n\n protected onBaseCopy = (e: ClipboardEvent): void => {\n if (!this.options.copyRaw || this.options.disabled || this.input.type === 'password') return;\n const start = this.input.selectionStart ?? 0;\n const end = this.input.selectionEnd ?? start;\n let textToCopy = '';\n if (start !== end) {\n textToCopy = this.extractRawSnippet(this.input.value.slice(start, end));\n } else {\n textToCopy = this.getRawValue();\n }\n if (textToCopy && e.clipboardData) {\n e.preventDefault();\n e.clipboardData.setData('text/plain', textToCopy);\n }\n };\n\n /**\n * Extrait la valeur brute d'un extrait de cha\u00EEne s\u00E9lectionn\u00E9.\n */\n protected extractRawSnippet(snippet: string): string {\n return snippet;\n }\n\n protected onBaseFocus = (): void => {\n this.isFocused = true;\n if (this.options.selectAllOnFocus && this.input.value.length > 0) {\n if (this.focusSelectTimerId !== null) {\n clearTimeout(this.focusSelectTimerId);\n }\n this.focusSelectTimerId = window.setTimeout(() => {\n this.focusSelectTimerId = null;\n if (!this.isDestroyed && document.activeElement === this.input) {\n this.input.select();\n }\n }, 0);\n }\n };\n\n protected onBaseBlur = (): void => {\n this.isFocused = false;\n };\n\n /**\n * Initialise l'observation des modifications dynamiques des attributs data-* et placeholder.\n */\n protected initMutationObserver(): void {\n if (typeof MutationObserver === 'undefined') return;\n\n this.mutationObserver = new MutationObserver((mutations) => {\n for (const m of mutations) {\n if (m.type === 'attributes' && m.attributeName) {\n this.handleAttributeMutation(m.attributeName);\n }\n }\n });\n\n const config: MutationObserverInit = {\n attributes: true,\n attributeFilter: [\n 'data-mask',\n 'data-mask-placeholder',\n 'data-mask-focus-only',\n 'data-mask-strict',\n 'data-mask-select-on-focus',\n 'data-mask-copy-raw',\n 'data-mask-pad-decimals',\n 'data-mask-auto-lowercase',\n 'data-mask-cycle-suggestions',\n 'data-mask-default-tld',\n 'data-mask-tlds',\n 'data-disabled',\n 'data-mask-align',\n 'data-align',\n 'placeholder'\n ]\n };\n\n this.mutationObserver.observe(this.wrapper, config);\n if (this.input !== (this.wrapper as any)) {\n this.mutationObserver.observe(this.input, config);\n }\n }\n\n /**\n * Modifie dynamiquement l'alignement du champ et du masque fant\u00F4me.\n */\n public setAlign(align: 'left' | 'right' | 'center' | null): void {\n const targetAlign = align || undefined;\n const currentAttr = this.wrapper.getAttribute('data-align');\n\n // Garde anti-boucle : si d\u00E9j\u00E0 align\u00E9 et attribut synchronis\u00E9, sortir imm\u00E9diatement\n if (this.options.align === targetAlign && currentAttr === (align || null)) {\n return;\n }\n\n this.options.align = targetAlign;\n this.wrapper.classList.remove('align-left', 'align-right', 'align-center');\n if (align) {\n this.wrapper.classList.add(`align-${align}`);\n if (this.wrapper.getAttribute('data-align') !== align) {\n this.wrapper.setAttribute('data-align', align);\n }\n } else {\n if (this.wrapper.hasAttribute('data-align')) {\n this.wrapper.removeAttribute('data-align');\n }\n }\n this.syncGhostStyles();\n }\n\n /**\n * Crochet appel\u00E9 lorsqu'un attribut pertinent a \u00E9t\u00E9 modifi\u00E9 dynamiquement \u00E0 la vol\u00E9e.\n */\n protected handleAttributeMutation(attrName: string): void {\n if (attrName === 'data-disabled') {\n const isDisabled = this.hasAttr('data-disabled');\n if (isDisabled !== Boolean(this.options.disabled)) {\n this.setDisabled(isDisabled);\n }\n } else if (attrName === 'data-mask-focus-only') {\n const focusOnly = this.getAttr('data-mask-focus-only') === 'true';\n if (focusOnly !== Boolean(this.options.showMaskOnFocus)) {\n this.setShowMaskOnFocus(focusOnly);\n }\n } else if (attrName === 'data-mask-select-on-focus') {\n this.options.selectAllOnFocus = this.getAttr('data-mask-select-on-focus') === 'true';\n } else if (attrName === 'data-mask-copy-raw') {\n this.options.copyRaw = this.getAttr('data-mask-copy-raw') === 'true';\n } else if (attrName === 'data-mask-align' || attrName === 'data-align') {\n const align = (this.getAttr('data-mask-align') || this.getAttr('data-align')) as 'left' | 'right' | 'center' | null;\n if (align !== (this.options.align ?? null)) {\n this.setAlign(align);\n }\n }\n }\n\n /**\n * Corrige les types d'input natifs incompatibles avec setSelectionRange (ex: number, email, date).\n */\n protected normalizeInputType(): void {\n const incompatibleTypes = ['number', 'email', 'date', 'datetime-local', 'month', 'week', 'time', 'color', 'file', 'range'];\n if (this.input.type && incompatibleTypes.includes(this.input.type.toLowerCase())) {\n const origType = this.input.type.toLowerCase();\n this.input.type = 'text';\n if (origType === 'number') {\n this.input.inputMode = 'numeric';\n }\n }\n }\n\n /**\n * Cr\u00E9e l'\u00E9l\u00E9ment d'arri\u00E8re-plan fant\u00F4me garantissant un rendu sans superposition\n * ni alt\u00E9ration de couleur, compatible avec les polices proportionnelles et monospaces.\n */\n protected createGhost(): void {\n const existing = this.wrapper.querySelector('.mask-ghost');\n if (existing) {\n existing.remove();\n }\n\n this.ghost = document.createElement('div');\n this.ghost.className = 'mask-ghost';\n this.ghost.setAttribute('aria-hidden', 'true');\n this.ghost.style.display = 'flex';\n this.ghost.style.alignItems = 'center';\n this.wrapper.appendChild(this.ghost);\n this.wrapper.classList.add('has-ghost');\n this.syncGhostStyles();\n }\n\n /**\n * Clone fid\u00E8lement la g\u00E9om\u00E9trie typographique et les espacements de l'input natif\n * sur le conteneur fant\u00F4me pour garantir un alignement sub-pixel absolu quel que soit\n * le style impos\u00E9 par le framework parent (police, taille, padding, letter-spacing).\n */\n public syncGhostStyles(): void {\n if (!this.ghost || typeof window === 'undefined') return;\n const style = window.getComputedStyle(this.input);\n if (!style) return;\n\n this.ghost.style.fontFamily = style.fontFamily;\n this.ghost.style.fontSize = style.fontSize;\n this.ghost.style.fontWeight = style.fontWeight;\n this.ghost.style.fontStyle = style.fontStyle;\n this.ghost.style.letterSpacing = style.letterSpacing;\n this.ghost.style.lineHeight = style.lineHeight;\n this.ghost.style.paddingTop = style.paddingTop;\n this.ghost.style.paddingBottom = style.paddingBottom;\n this.ghost.style.paddingLeft = style.paddingLeft;\n this.ghost.style.paddingRight = style.paddingRight;\n this.ghost.style.borderTopWidth = style.borderTopWidth;\n this.ghost.style.borderBottomWidth = style.borderBottomWidth;\n this.ghost.style.borderLeftWidth = style.borderLeftWidth;\n this.ghost.style.borderRightWidth = style.borderRightWidth;\n this.ghost.style.borderTopStyle = style.borderTopStyle === 'none' ? 'none' : 'solid';\n this.ghost.style.borderBottomStyle = style.borderBottomStyle === 'none' ? 'none' : 'solid';\n this.ghost.style.borderLeftStyle = style.borderLeftStyle === 'none' ? 'none' : 'solid';\n this.ghost.style.borderRightStyle = style.borderRightStyle === 'none' ? 'none' : 'solid';\n this.ghost.style.borderColor = 'transparent';\n this.ghost.style.boxSizing = style.boxSizing;\n this.ghost.style.textAlign = style.textAlign;\n this.ghost.style.direction = style.direction;\n\n const isRtl = style.direction === 'rtl' || this.input.getAttribute('dir') === 'rtl' || this.wrapper.getAttribute('dir') === 'rtl';\n\n if (style.textAlign === 'right' || style.textAlign === 'end' || (isRtl && style.textAlign !== 'left' && style.textAlign !== 'center')) {\n this.ghost.style.justifyContent = 'flex-end';\n } else if (style.textAlign === 'center') {\n this.ghost.style.justifyContent = 'center';\n } else {\n this.ghost.style.justifyContent = 'flex-start';\n }\n }\n\n /**\n * Affecte directement la valeur native sans boucler sur le setter surcharg\u00E9.\n */\n protected setNativeValue(val: string): void {\n if (this.nativeValueDescriptor && this.nativeValueDescriptor.set) {\n this.nativeValueDescriptor.set.call(this.input, val);\n } else {\n this.input.value = val;\n }\n }\n\n /**\n * \u00C9met l'\u00E9v\u00E9nement 'input' natif W3C avec bulles pour synchroniser\n * les observateurs standards et les frameworks (React, Vue, Svelte, Angular).\n * Synchronise \u00E9galement le tracker de valeur interne de React (_valueTracker).\n */\n protected dispatchNativeInput(): void {\n if (this.isDestroyed || typeof window === 'undefined') return;\n if (this.options.emitNativeInput === false) return;\n\n this.isDispatchingNativeInput = true;\n try {\n // Synchronisation du tracker de valeur React (React 16+)\n const tracker = (this.input as any)._valueTracker;\n if (tracker && typeof tracker.setValue === 'function') {\n tracker.setValue(this.lastTrackedValue);\n }\n this.lastTrackedValue = this.input.value;\n\n // \u00C9mission de l'\u00E9v\u00E9nement standard W3C (support\u00E9 universellement en ES2020+)\n this.input.dispatchEvent(new Event('input', { bubbles: true, cancelable: false }));\n } finally {\n this.isDispatchingNativeInput = false;\n }\n }\n\n /**\n * Synchronise le d\u00E9filement horizontal du ghost avec celui du champ d'entr\u00E9e natif.\n */\n protected onScroll = (): void => {\n if (this.ghost) {\n this.ghost.scrollLeft = this.input.scrollLeft;\n }\n };\n\n /**\n * Intercepte les modifications directes de la propri\u00E9t\u00E9 input.value (ex: input.value = '').\n */\n protected hookValueProperty(): void {\n try {\n const proto = HTMLInputElement.prototype;\n const desc = Object.getOwnPropertyDescriptor(proto, 'value');\n if (!desc || !desc.set || !desc.get) return;\n this.nativeValueDescriptor = desc;\n\n const self = this;\n Object.defineProperty(this.input, 'value', {\n get() {\n return desc.get!.call(this);\n },\n set(newVal: any) {\n const strVal = String(newVal ?? '');\n desc.set!.call(this, strVal);\n if (self.isDestroyed) return;\n self.onNativeValueSet(strVal);\n },\n configurable: true\n });\n } catch {\n // Ignorer si l'environnement bloque l'override\n }\n }\n\n /**\n * Supprime l'interception de input.value et restaure le comportement natif.\n */\n protected unhookValueProperty(): void {\n try {\n delete (this.input as any).value;\n } catch {\n // Ignorer\n }\n }\n\n /**\n * Active ou d\u00E9sactive l'affichage du masque uniquement au focus.\n */\n public setShowMaskOnFocus(enable: boolean): void {\n this.options.showMaskOnFocus = enable;\n this.wrapper.classList.toggle('mask-focus-only', enable);\n }\n\n /**\n * Active ou d\u00E9sactive le masquage de saisie (getter / setter fluide).\n */\n public disabled(disabledVal?: boolean): boolean | void {\n if (disabledVal === undefined) {\n return Boolean(this.options.disabled);\n }\n this.setDisabled(disabledVal);\n }\n\n /**\n * Active ou d\u00E9sactive le masquage / l'assistance de saisie.\n */\n public setDisabled(disabled: boolean): void {\n this.options.disabled = Boolean(disabled);\n\n if (this.options.disabled) {\n this.wrapper.setAttribute('data-disabled', 'true');\n } else {\n this.wrapper.removeAttribute('data-disabled');\n }\n\n this.onDisabledChange(this.options.disabled);\n }\n\n /**\n /**\n * Retourne l'\u00E9l\u00E9ment conteneur (wrapper).\n */\n public getWrapper(): HTMLElement {\n return this.wrapper;\n }\n\n /**\n * Retourne l'\u00E9l\u00E9ment input natif sous-jacent.\n */\n public getInput(): HTMLInputElement {\n return this.input;\n }\n\n /**\n * Retourne l'\u00E9l\u00E9ment fant\u00F4me (ghost) affichant le masque en arri\u00E8re-plan.\n */\n public getGhost(): HTMLElement | null {\n return this.ghost;\n }\n\n /**\n * Retourne l'ensemble des \u00E9l\u00E9ments DOM associ\u00E9s au masque (wrapper, input, ghost).\n */\n public getElements(): { wrapper: HTMLElement; input: HTMLInputElement; ghost: HTMLElement | null } {\n return {\n wrapper: this.wrapper,\n input: this.input,\n ghost: this.ghost\n };\n }\n\n /**\n * Retourne la valeur actuelle affich\u00E9e dans l'input (format\u00E9e).\n */\n public getValue(): string {\n return this.input.value;\n }\n\n /**\n * Retourne la valeur brute sans s\u00E9parateurs.\n * Par d\u00E9faut retourne la valeur de l'input si non surcharg\u00E9e.\n */\n public getRawValue(): string {\n return this.input.value;\n }\n\n /**\n * V\u00E9rifie la conformit\u00E9 d'accessibilit\u00E9 WAI-ARIA du champ de saisie (\u00E9tiquetage, format attendu)\n * et retourne la liste des contraintes manquantes.\n */\n public override audit(): string[] {\n const warnings: string[] = [];\n const doc = this.input.ownerDocument || document;\n\n // 1. V\u00E9rification de l'\u00E9tiquetage accessible (WCAG 1.3.1 / 4.1.2)\n const ariaLabel = this.input.getAttribute('aria-label')?.trim();\n const hasValidLabelledby = this.checkAriaIdReferences(this.input, 'aria-labelledby', warnings);\n\n const hasWrappingLabel = Boolean(this.input.closest('label'));\n const hasNativeLabels = Boolean(this.input.labels && this.input.labels.length > 0);\n let hasExplicitLabelFor = false;\n if (this.input.id && typeof CSS !== 'undefined' && typeof CSS.escape === 'function') {\n hasExplicitLabelFor = Boolean(doc.querySelector(`label[for=\"${CSS.escape(this.input.id)}\"]`));\n } else if (this.input.id) {\n hasExplicitLabelFor = Boolean(doc.querySelector(`label[for=\"${this.input.id}\"]`));\n }\n\n if (!ariaLabel && !hasValidLabelledby && !hasWrappingLabel && !hasNativeLabels && !hasExplicitLabelFor) {\n warnings.push(\n '\u00C9tiquetage accessible manquant : associez un <label for=\"id\"> (ou d\u00E9finissez aria-label / aria-labelledby) sur l\\'input (WCAG 4.1.2).'\n );\n }\n\n // 2. V\u00E9rification de aria-describedby si renseign\u00E9\n this.checkAriaIdReferences(this.input, 'aria-describedby', warnings);\n\n // 3. R\u00E8gles sp\u00E9cifiques aux sous-classes (ex: format attendu sur InputMask)\n const extraWarnings = this.getSpecificAuditWarnings();\n warnings.push(...extraWarnings);\n\n return warnings;\n }\n\n protected override getAuditPrefix(): string {\n return `Wulf.Mask.${this.constructor.name || 'InputMask'}`;\n }\n\n protected override getAuditTargetLabel(): string {\n return this.input.id\n ? `#${this.input.id}`\n : (this.input.name ? `input[name=\"${this.input.name}\"]` : '<input>');\n }\n\n protected override getAuditDisableHint(): string {\n return 'Passez { audit: false } ou data-mask-audit=\"false\" pour d\u00E9sactiver cet avertissement';\n }\n\n /**\n * Crochet permettant aux classes filles d'ajouter des v\u00E9rifications d'audit sp\u00E9cifiques.\n */\n protected getSpecificAuditWarnings(): string[] {\n return [];\n }\n\n /**\n * Affecte une nouvelle valeur manuellement (format\u00E9e ou brute).\n */\n public abstract setValue(val: string | number): void;\n\n /**\n * Crochet appel\u00E9 lorsque input.value est modifi\u00E9e programmatiquement.\n */\n protected abstract onNativeValueSet(value: string): void;\n\n /**\n * Crochet appel\u00E9 lors du changement d'\u00E9tat via setDisabled().\n */\n protected abstract onDisabledChange(disabled: boolean): void;\n\n /**\n * Supprime les \u00E9l\u00E9ments fant\u00F4mes, restaure les propri\u00E9t\u00E9s et nettoie les attributs.\n */\n public destroy(): void {\n if (this.isDestroyed) return;\n this.isDestroyed = true;\n\n if (this.focusSelectTimerId !== null) {\n clearTimeout(this.focusSelectTimerId);\n this.focusSelectTimerId = null;\n }\n\n if (this.mutationObserver) {\n this.mutationObserver.disconnect();\n this.mutationObserver = null;\n }\n\n this.input.removeEventListener('copy', this.onBaseCopy);\n this.input.removeEventListener('focus', this.onBaseFocus);\n this.input.removeEventListener('blur', this.onBaseBlur);\n\n this.unhookValueProperty();\n\n if (this.ghost) {\n this.ghost.remove();\n this.ghost = null;\n }\n\n if (this.isWrapperCreated && this.wrapper) {\n this.input.style.gridArea = '';\n this.input.style.boxSizing = '';\n if (this.wrapper.parentNode) {\n this.wrapper.parentNode.insertBefore(this.input, this.wrapper);\n }\n this.wrapper.remove();\n } else if (this.wrapper) {\n this.wrapper.removeAttribute('data-mask');\n this.wrapper.removeAttribute('data-disabled');\n this.wrapper.classList.remove('is-complete', 'is-focused', 'mask-focus-only', 'has-selection', 'has-ghost');\n }\n }\n}\n", "import { TokenDef, MaskSlot, MaskOptions } from './types';\n\nexport const DEFAULT_TOKENS: Record<string, TokenDef> = {\n '9': { pattern: /[0-9]/ },\n 'a': { pattern: /[a-zA-Z]/ },\n 'A': { pattern: /[a-zA-Z]/, transform: (c) => c.toUpperCase() },\n '*': { pattern: /[a-zA-Z0-9]/ },\n '#': { pattern: /[a-zA-Z0-9]/, transform: (c) => c.toUpperCase() }\n};\n\n/**\n * Moteur algorithmique de masquage.\n * D\u00E9coupl\u00E9 \u00E0 100% du DOM pour garantir testabilit\u00E9 et maintenabilit\u00E9.\n */\nexport class MaskEngine {\n private pattern: string;\n private patterns: string[] = [];\n private subEngines: MaskEngine[] = [];\n private activeEngine: MaskEngine | null = null;\n private placeholderChar: string;\n private tokens: Record<string, TokenDef>;\n private slots: MaskSlot[] = [];\n private fullMaskTemplate: string = '';\n private prefixSlotsCount: number = 0;\n private prefixString: string = '';\n private strict: boolean = true;\n private autoLowercase: boolean = false;\n\n constructor(pattern: string | string[], options: Partial<MaskOptions> = {}) {\n const opts = options || {};\n this.placeholderChar = opts.placeholderChar || '_';\n this.tokens = { ...DEFAULT_TOKENS, ...(opts.tokens || {}) };\n this.strict = opts.strict !== false;\n this.autoLowercase = opts.autoLowercase ?? false;\n this.pattern = '';\n this.compile(pattern);\n }\n\n /**\n * Formate une valeur selon un gabarit de masque donn\u00E9.\n * Fonction statique utilitaire permettant un formatage direct sans instanciation manuelle.\n *\n * @param value Valeur \u00E0 formater (brute ou partiellement format\u00E9e)\n * @param pattern Masque \u00E0 appliquer (ex: \"99 99 99 99 99\" ou tableau de masques)\n * @param options Options facultatives (placeholderChar, tokens, strict, autoLowercase)\n * @returns La valeur format\u00E9e selon le masque\n */\n public static format(value: string, pattern: string | string[], options: Partial<MaskOptions> = {}): string {\n if (!pattern || (Array.isArray(pattern) && pattern.length === 0)) return value ?? '';\n const engine = new MaskEngine(pattern, options || {});\n return engine.format(value ?? '');\n }\n\n /**\n * Analyse le ou les gabarits statiques et compile la liste des slots.\n */\n public compile(newPattern?: string | string[]): MaskSlot[] {\n if (newPattern !== undefined) {\n if (Array.isArray(newPattern)) {\n this.patterns = [...newPattern];\n this.pattern = this.patterns[0] || '';\n } else {\n this.patterns = [];\n this.pattern = newPattern;\n }\n }\n\n if (this.patterns.length > 0) {\n // Compilation de la brigade de sous-moteurs unitaires\n this.subEngines = this.patterns.map(p => new MaskEngine(p, {\n placeholderChar: this.placeholderChar,\n tokens: this.tokens,\n strict: this.strict,\n autoLowercase: this.autoLowercase\n }));\n this.activeEngine = this.subEngines[0];\n this.slots = this.activeEngine.slots;\n this.fullMaskTemplate = this.activeEngine.fullMaskTemplate;\n this.prefixSlotsCount = this.activeEngine.prefixSlotsCount;\n this.prefixString = this.activeEngine.prefixString;\n return this.slots;\n }\n\n this.subEngines = [];\n this.activeEngine = null;\n this.slots = [];\n let templateBuilder = '';\n let isPrefixMode = true;\n\n for (let i = 0; i < this.pattern.length; i++) {\n let char = this.pattern[i];\n let isEscaped = false;\n\n // Gestion de l'\u00E9chappement : \\9, \\a, \\*, \\#, \\\\\n if (char === '\\\\' && i + 1 < this.pattern.length) {\n isEscaped = true;\n i++;\n char = this.pattern[i];\n }\n\n const token = !isEscaped ? this.tokens[char] : undefined;\n\n if (token) {\n // Premier emplacement \u00E9ditable rencontr\u00E9 : fin du pr\u00E9fixe statique\n isPrefixMode = false;\n this.slots.push({\n char,\n isStatic: false,\n isPrefix: false,\n token,\n placeholder: this.placeholderChar\n });\n templateBuilder += this.placeholderChar;\n } else {\n // S\u00E9parateur fixe (espace, tiret, slash, pr\u00E9fixe, ou caract\u00E8re \u00E9chapp\u00E9)\n this.slots.push({\n char,\n isStatic: true,\n isPrefix: isPrefixMode,\n placeholder: char\n });\n templateBuilder += char;\n }\n }\n\n this.fullMaskTemplate = templateBuilder;\n\n // Calcul de la taille et de la cha\u00EEne exacte du pr\u00E9fixe statique initial\n this.prefixSlotsCount = 0;\n this.prefixString = '';\n for (const slot of this.slots) {\n if (slot.isPrefix) {\n this.prefixSlotsCount++;\n this.prefixString += slot.char;\n } else {\n break;\n }\n }\n\n return this.slots;\n }\n\n /**\n * S\u00E9lectionne dynamiquement le meilleur sous-moteur en fonction de la valeur pass\u00E9e.\n */\n private selectEngine(input: string): MaskEngine {\n if (this.subEngines.length <= 1) {\n return this;\n }\n\n const trimmed = String(input ?? '');\n\n // 1. Priorit\u00E9 aux motifs ayant un pr\u00E9fixe statique correspondant au d\u00E9but de l'entr\u00E9e\n const withMatchingPrefix = this.subEngines.filter(e => {\n const p = e.getPrefix();\n return p.length > 0 && trimmed.toLowerCase().startsWith(p.trim().toLowerCase());\n });\n\n const candidates = withMatchingPrefix.length > 0 ? withMatchingPrefix : this.subEngines;\n\n // 2. Extraire la valeur brute avec le candidat ayant la plus grande capacit\u00E9 pour ne pas tronquer l'entr\u00E9e\n const maxCandidate = [...candidates].sort((a, b) => b.getEditableCount() - a.getEditableCount())[0];\n const raw = maxCandidate ? maxCandidate.extractRaw(trimmed) : trimmed;\n const rawLen = raw.length;\n\n // 3. Trouver le premier motif capable d'accueillir tous les caract\u00E8res saisis\n for (const eng of candidates) {\n if (eng.getEditableCount() >= rawLen) {\n this.activeEngine = eng;\n return eng;\n }\n }\n\n // Si \u00E7a d\u00E9passe la capacit\u00E9 de tous les candidats, prendre le plus grand\n this.activeEngine = candidates[candidates.length - 1];\n return this.activeEngine;\n }\n\n /**\n * Retourne la cha\u00EEne du pr\u00E9fixe statique initial (ex: \"+33 \").\n */\n public getPrefix(): string {\n return this.activeEngine ? this.activeEngine.getPrefix() : this.prefixString;\n }\n\n /**\n * Retourne la longueur en caract\u00E8res du pr\u00E9fixe statique initial.\n */\n public getPrefixLength(): number {\n return this.activeEngine ? this.activeEngine.getPrefixLength() : this.prefixSlotsCount;\n }\n\n /**\n * Retourne le gabarit complet du masque avec ses placeholders (ex: \"FR76 ____ ____\").\n */\n public getFullMaskTemplate(): string {\n return this.activeEngine ? this.activeEngine.getFullMaskTemplate() : this.fullMaskTemplate;\n }\n\n /**\n * Nombre total de positions \u00E9ditables dans le masque.\n */\n public getEditableCount(): number {\n if (this.subEngines.length > 0) {\n return Math.max(...this.subEngines.map(e => e.getEditableCount()));\n }\n return this.activeEngine ? this.activeEngine.getEditableCount() : this.slots.filter(s => !s.isStatic).length;\n }\n\n /**\n * Indique si tous les emplacements \u00E9ditables du masque acceptent exclusivement des chiffres num\u00E9riques.\n */\n public isNumericOnly(): boolean {\n if (this.subEngines.length > 0) {\n return this.subEngines.every(e => e.isNumericOnly());\n }\n const targetSlots = this.activeEngine ? (this.activeEngine as any).slots : this.slots;\n const editable = (targetSlots as MaskSlot[]).filter(s => !s.isStatic);\n if (editable.length === 0) return false;\n return editable.every(s => s.char === '9' || (s.token && s.token.pattern.test('0') && !s.token.pattern.test('a') && !s.token.pattern.test('Z')));\n }\n\n /**\n * D\u00E9finit si le masque bloque strictement les entr\u00E9es non conformes.\n */\n public setStrict(strict: boolean): void {\n this.strict = strict;\n }\n\n /**\n * Indique si le masque est en mode strict.\n */\n public isStrict(): boolean {\n return this.strict;\n }\n\n /**\n * Filtre et extrait uniquement les caract\u00E8res \u00E9ditables valides d'une cha\u00EEne.\n * G\u00E8re intelligemment la pr\u00E9sence ou l'absence des s\u00E9parateurs statiques et du pr\u00E9fixe.\n */\n public extractRaw(input: string): string {\n if (this.subEngines.length > 0) {\n const engine = this.selectEngine(input);\n if (engine !== this) {\n return engine.extractRaw(input);\n }\n }\n\n const str = String(input ?? '');\n if (!str) return '';\n let raw = '';\n let inputIdx = 0;\n let slotIdx = 0;\n\n // 1. Traitement du pr\u00E9fixe statique initial s'il existe\n if (this.prefixSlotsCount > 0) {\n // Ignorer les espaces blancs de t\u00EAte \u00E9ventuels avant de tester le pr\u00E9fixe\n while (inputIdx < str.length && (str[inputIdx] === ' ' || str[inputIdx] === '\\t')) {\n inputIdx++;\n }\n let pIdx = 0;\n // On v\u00E9rifie si l'entr\u00E9e commence par les caract\u00E8res du pr\u00E9fixe\n while (inputIdx < str.length && pIdx < this.prefixSlotsCount) {\n const pChar = this.slots[pIdx].char;\n const inChar = str[inputIdx];\n if (inChar.toUpperCase() === pChar.toUpperCase()) {\n inputIdx++;\n pIdx++;\n } else if (pChar === ' ' && inChar !== ' ') {\n // Espace facultatif dans le pr\u00E9fixe saisi\n pIdx++;\n } else {\n break;\n }\n }\n\n // Si l'entr\u00E9e ne commen\u00E7ait pas par le pr\u00E9fixe (ex: saisie directe du premier chiffre)\n // OU si l'entr\u00E9e a match\u00E9 le pr\u00E9fixe : dans les deux cas, on positionne slotIdx\n // directement au premier slot \u00E9ditable !\n slotIdx = this.prefixSlotsCount;\n }\n\n // 2. Traitement des slots \u00E9ditables et s\u00E9parateurs internes\n while (inputIdx < str.length && slotIdx < this.slots.length) {\n const slot = this.slots[slotIdx];\n const char = str[inputIdx];\n\n if (slot.isStatic) {\n if (char.toUpperCase() === slot.char.toUpperCase()) {\n inputIdx++;\n slotIdx++;\n } else {\n // Le caract\u00E8re saisi n'est pas le s\u00E9parateur attendu : c'est une donn\u00E9e pour le slot suivant ou le slot courant !\n // On avance uniquement le slot statique du masque pour tenter de consommer le caract\u00E8re dans le slot \u00E9ditable suivant\n slotIdx++;\n }\n } else {\n if (slot.token && slot.token.pattern.test(char)) {\n let transformed = slot.token.transform ? slot.token.transform(char) : char;\n if (this.autoLowercase && !slot.token.transform) {\n transformed = transformed.toLowerCase();\n }\n raw += transformed;\n inputIdx++;\n slotIdx++;\n } else if (!this.strict) {\n raw += this.autoLowercase ? char.toLowerCase() : char;\n inputIdx++;\n slotIdx++;\n } else {\n inputIdx++;\n }\n }\n }\n\n // En mode non-strict, conserver tout caract\u00E8re suppl\u00E9mentaire au-del\u00E0 du masque\n if (!this.strict && inputIdx < str.length) {\n const remaining = str.slice(inputIdx);\n raw += this.autoLowercase ? remaining.toLowerCase() : remaining;\n }\n\n return raw;\n }\n\n /**\n * Formate une cha\u00EEne brute en appliquant le gabarit avec ses s\u00E9parateurs statiques.\n * Si aucune donn\u00E9e \u00E9ditable n'est pr\u00E9sente, retourne le pr\u00E9fixe statique fixe s'il existe.\n */\n public format(rawValue: string): string {\n if (this.subEngines.length > 0) {\n const engine = this.selectEngine(rawValue);\n if (engine !== this) {\n return engine.format(rawValue);\n }\n }\n\n const rawStr = String(rawValue ?? '');\n if (!this.slots.length) return rawStr;\n\n const cleanRaw = this.extractRaw(rawStr);\n // Si la valeur est vide, on retourne le pr\u00E9fixe statique fixe s'il existe, sinon cha\u00EEne vide\n if (cleanRaw.length === 0) {\n return this.prefixString;\n }\n\n let formatted = '';\n let rawIdx = 0;\n\n for (let i = 0; i < this.slots.length; i++) {\n const slot = this.slots[i];\n\n if (slot.isStatic) {\n const hasRemainingRaw = rawIdx < cleanRaw.length;\n const isPrefix = rawIdx === 0 && Boolean(slot.isPrefix);\n const isCompletedSegmentTrailingSep = rawIdx > 0 && rawIdx === cleanRaw.length;\n\n if (hasRemainingRaw || isPrefix || isCompletedSegmentTrailingSep) {\n formatted += slot.char;\n } else {\n break;\n }\n } else {\n if (rawIdx < cleanRaw.length) {\n const char = cleanRaw[rawIdx];\n let transformed = slot.token?.transform ? slot.token.transform(char) : char;\n if (this.autoLowercase && !slot.token?.transform) {\n transformed = transformed.toLowerCase();\n }\n formatted += transformed;\n rawIdx++;\n } else {\n break;\n }\n }\n }\n\n // En mode non-strict, ajouter les caract\u00E8res qui d\u00E9passent la capacit\u00E9 des slots\n if (!this.strict && rawIdx < cleanRaw.length) {\n const extra = cleanRaw.substring(rawIdx);\n formatted += this.autoLowercase ? extra.toLowerCase() : extra;\n }\n\n return formatted;\n }\n\n /**\n * Calcule le gabarit restant align\u00E9 au texte format\u00E9 (supporte les polices proportionnelles non-monospace).\n */\n public getRemainingMask(formatted: string): string {\n if (this.activeEngine && this.activeEngine !== this) {\n return this.activeEngine.getRemainingMask(formatted);\n }\n if (!this.fullMaskTemplate) return '';\n if (formatted.length >= this.fullMaskTemplate.length) {\n return formatted;\n }\n return formatted + this.fullMaskTemplate.substring(formatted.length);\n }\n\n /**\n * Mappe la position du curseur en pr\u00E9servant le nombre exact de caract\u00E8res \u00E9ditables\n * saisis avant le curseur, et en garantissant que le curseur ne recule jamais dans le pr\u00E9fixe statique.\n */\n public mapCursorPosition(inputValue: string, inputCursor: number, formatted: string): number {\n if (this.activeEngine && this.activeEngine !== this) {\n return this.activeEngine.mapCursorPosition(inputValue, inputCursor, formatted);\n }\n\n const minPos = this.prefixSlotsCount;\n const safeInput = String(inputValue ?? '');\n const safeFormatted = String(formatted ?? '');\n if (inputCursor <= 0 || !safeFormatted) return minPos;\n\n // Nombre de caract\u00E8res \u00E9ditables saisis avant le curseur dans l'entr\u00E9e courante\n const rawBeforeCursor = this.extractRaw(safeInput.slice(0, inputCursor));\n const targetRawCount = rawBeforeCursor.length;\n\n if (targetRawCount === 0) {\n return Math.max(minPos, Math.min(this.getNextEditablePosition(0), safeFormatted.length));\n }\n\n // Trouver l'index dans 'formatted' qui correspond \u00E0 targetRawCount caract\u00E8res \u00E9ditables\n let currentRawCount = 0;\n let targetPos = safeFormatted.length;\n\n for (let i = 0; i < safeFormatted.length && i < this.slots.length; i++) {\n const slot = this.slots[i];\n if (!slot.isStatic) {\n currentRawCount++;\n if (currentRawCount === targetRawCount) {\n targetPos = i + 1;\n break;\n }\n }\n }\n\n // Si la position cible est suivie d'un s\u00E9parateur statique d\u00E9j\u00E0 pr\u00E9sent dans formatted,\n // on avance le curseur apr\u00E8s le s\u00E9parateur pour fluidifier la frappe suivante\n while (targetPos < safeFormatted.length && this.slots[targetPos] && this.slots[targetPos].isStatic) {\n targetPos++;\n }\n\n return Math.max(minPos, Math.min(targetPos, safeFormatted.length));\n }\n\n /**\n * V\u00E9rifie si le slot \u00E0 l'index donn\u00E9 est un s\u00E9parateur statique.\n */\n public isSeparatorAt(displayIdx: number): boolean {\n if (this.activeEngine && this.activeEngine !== this) {\n return this.activeEngine.isSeparatorAt(displayIdx);\n }\n if (displayIdx >= 0 && displayIdx < this.slots.length) {\n return this.slots[displayIdx].isStatic;\n }\n return false;\n }\n\n /**\n * Trouve le prochain emplacement \u00E9ditable apr\u00E8s un index donn\u00E9.\n */\n public getNextEditablePosition(fromIdx: number): number {\n if (this.activeEngine && this.activeEngine !== this) {\n return this.activeEngine.getNextEditablePosition(fromIdx);\n }\n const start = Math.max(0, fromIdx);\n for (let i = start; i < this.slots.length; i++) {\n if (!this.slots[i].isStatic) {\n return i;\n }\n }\n return this.slots.length;\n }\n\n /**\n * Retourne le slot \u00E0 l'index donn\u00E9.\n */\n public getSlotAt(displayIdx: number): MaskSlot | undefined {\n if (this.activeEngine && this.activeEngine !== this) {\n return this.activeEngine.getSlotAt(displayIdx);\n }\n return this.slots[displayIdx];\n }\n\n /**\n * Retourne les slots complets.\n */\n public getSlots(): MaskSlot[] {\n if (this.activeEngine && this.activeEngine !== this) {\n return this.activeEngine.getSlots();\n }\n return this.slots;\n }\n}\n", "export interface HistoryState {\n raw: string;\n cursor: number;\n}\n\n/**\n * Gestionnaire d'historique Undo / Redo isol\u00E9 pour InputMask.\n * Maintient une pile d'\u00E9tats purs (donn\u00E9es brutes + position curseur)\n * d\u00E9coupl\u00E9e de toute logique DOM.\n */\nexport class MaskHistory {\n private stack: HistoryState[] = [];\n private index: number = -1;\n private maxDepth: number;\n\n constructor(maxDepth: number = 50) {\n this.maxDepth = maxDepth;\n }\n\n /**\n * Enregistre un nouvel \u00E9tat si la valeur brute a chang\u00E9.\n * Si la valeur brute est identique, met simplement \u00E0 jour la position du curseur de l'\u00E9tat courant.\n */\n public push(raw: string, cursor: number): void {\n const current = this.getCurrent();\n if (current && current.raw === raw) {\n current.cursor = cursor;\n return;\n }\n\n // Tronquer les branches futures si de nouvelles frappes surviennent apr\u00E8s un Undo\n this.stack = this.stack.slice(0, this.index + 1);\n this.stack.push({ raw, cursor });\n\n if (this.stack.length > this.maxDepth) {\n this.stack.shift();\n }\n\n this.index = this.stack.length - 1;\n }\n\n /**\n * Met \u00E0 jour la position du curseur de l'\u00E9tat courant sans modifier la pile.\n */\n public updateCurrentCursor(cursor: number): void {\n const current = this.getCurrent();\n if (current) {\n current.cursor = cursor;\n }\n }\n\n /**\n * Recule d'un cran dans l'historique et retourne l'\u00E9tat restaur\u00E9.\n */\n public undo(): HistoryState | null {\n if (this.canUndo()) {\n this.index--;\n return this.stack[this.index];\n }\n return null;\n }\n\n /**\n * Avance d'un cran dans l'historique et retourne l'\u00E9tat restaur\u00E9.\n */\n public redo(): HistoryState | null {\n if (this.canRedo()) {\n this.index++;\n return this.stack[this.index];\n }\n return null;\n }\n\n /**\n * Indique si une annulation est possible.\n */\n public canUndo(): boolean {\n return this.index > 0;\n }\n\n /**\n * Indique si un r\u00E9tablissement est possible.\n */\n public canRedo(): boolean {\n return this.index >= 0 && this.index < this.stack.length - 1;\n }\n\n /**\n * Retourne l'\u00E9tat courant.\n */\n public getCurrent(): HistoryState | null {\n return this.index >= 0 && this.index < this.stack.length ? this.stack[this.index] : null;\n }\n\n /**\n * R\u00E9initialise enti\u00E8rement l'historique.\n */\n public clear(): void {\n this.stack = [];\n this.index = -1;\n }\n}\n", "import { MaskEngine } from './MaskEngine';\nimport { MaskHistory } from './MaskHistory';\n\nexport interface MaskKeyboardDelegate {\n getInput(): HTMLInputElement;\n getEngine(): MaskEngine;\n getHistory(): MaskHistory;\n applyMask(rawOrPartial: string, cursorPosition: number, forceExactCursor?: boolean): void;\n undo(): void;\n redo(): void;\n enforceMinCursor(): void;\n}\n\n/**\n * Gestionnaire modulaire des raccourcis et comportements clavier pour InputMask.\n * Isole toute la logique de suppression unitaire, suppression par mot/bloc,\n * raccourcis Undo/Redo, touches statiques et navigation restreinte.\n */\nexport class MaskKeyboard {\n private delegate: MaskKeyboardDelegate;\n\n constructor(delegate: MaskKeyboardDelegate) {\n this.delegate = delegate;\n }\n\n /**\n * Analyse et traite l'\u00E9v\u00E9nement keydown de l'input.\n */\n public handleKeyDown(e: KeyboardEvent): void {\n const input = this.delegate.getInput();\n const engine = this.delegate.getEngine();\n const history = this.delegate.getHistory();\n const minPos = engine.getPrefixLength();\n\n const cursor = input.selectionStart ?? 0;\n const selectionEnd = input.selectionEnd ?? cursor;\n\n // 1. Annulation / R\u00E9tablissement (Undo: Ctrl+Z / Redo: Ctrl+Y ou Ctrl+Shift+Z, Cmd sur Mac)\n if ((e.ctrlKey || e.metaKey) && (e.key === 'z' || e.key === 'Z') && !e.shiftKey) {\n e.preventDefault();\n this.delegate.undo();\n return;\n }\n if (((e.ctrlKey || e.metaKey) && (e.key === 'y' || e.key === 'Y')) ||\n ((e.ctrlKey || e.metaKey) && e.shiftKey && (e.key === 'z' || e.key === 'Z'))) {\n e.preventDefault();\n this.delegate.redo();\n return;\n }\n\n // 2. Synchronisation de la position exacte du curseur dans l'historique avant toute action\n history.updateCurrentCursor(cursor);\n\n // 3. Traitement intelligent si l'utilisateur saisit le caract\u00E8re de s\u00E9paration du masque (ex: '/' ou '.' ou espace ' ')\n // UNIQUEMENT si aucune s\u00E9lection \u00E9tendue n'est active (une s\u00E9lection doit \u00EAtre remplac\u00E9e par le caract\u00E8re tap\u00E9)\n const isPrintableChar = e.key.length === 1 && !e.ctrlKey && !e.metaKey && !e.altKey;\n const hasSelection = selectionEnd > cursor;\n\n if (isPrintableChar && !hasSelection) {\n const slots = engine.getSlots();\n\n // 3.1 V\u00E9rifier si le caract\u00E8re sous le curseur OU juste avant le curseur est d\u00E9j\u00E0 ce s\u00E9parateur\n const isAlreadyOnSep = (cursor < slots.length && slots[cursor].isStatic && slots[cursor].char === e.key);\n const isJustAfterSep = (cursor > 0 && cursor - 1 < slots.length && slots[cursor - 1].isStatic && slots[cursor - 1].char === e.key);\n\n if (isAlreadyOnSep || isJustAfterSep) {\n e.preventDefault();\n const baseIdx = isAlreadyOnSep ? cursor : cursor - 1;\n const nextEditable = engine.getNextEditablePosition(baseIdx + 1);\n this.delegate.applyMask(input.value, nextEditable, true);\n return;\n }\n\n // 3.2 V\u00E9rifier si la touche tap\u00E9e correspond au prochain s\u00E9parateur statique \u00E0 venir dans le masque\n let nextSepIdx = -1;\n for (let i = cursor; i < slots.length; i++) {\n if (slots[i].isStatic) {\n if (slots[i].char === e.key) {\n nextSepIdx = i;\n }\n break;\n }\n }\n\n if (nextSepIdx !== -1) {\n e.preventDefault();\n\n // R\u00E9cup\u00E9rer le segment \u00E9ditable en cours de saisie avant ce s\u00E9parateur\n let segStart = nextSepIdx - 1;\n while (segStart >= minPos && !slots[segStart].isStatic) {\n segStart--;\n }\n segStart++; // Premier slot \u00E9ditable du bloc\n\n const segLength = nextSepIdx - segStart;\n const currentSegVal = input.value.slice(segStart, cursor);\n\n // Si le segment attend plus de caract\u00E8res num\u00E9riques que ce qui a \u00E9t\u00E9 saisi (ex: '5' suivi de '/' pour une date '99', '10' pour une IP '999')\n const isNumericSegment = slots.slice(segStart, nextSepIdx).every(s => !s.token || s.token.pattern.test('0'));\n if (isNumericSegment && segLength > currentSegVal.length && currentSegVal.length > 0) {\n const missingCount = segLength - currentSegVal.length;\n const paddedSeg = '0'.repeat(missingCount) + currentSegVal;\n const remainingTail = input.value.slice(nextSepIdx);\n const padded = input.value.slice(0, segStart) + paddedSeg + remainingTail;\n const nextEditable = engine.getNextEditablePosition(nextSepIdx + 1);\n this.delegate.applyMask(padded, nextEditable, true);\n return;\n }\n\n // Pour tout autre s\u00E9parateur ou si le segment est d\u00E9j\u00E0 plein : formater et sauter apr\u00E8s le s\u00E9parateur\n const nextEditable = engine.getNextEditablePosition(nextSepIdx + 1);\n this.delegate.applyMask(input.value, nextEditable, true);\n return;\n }\n }\n\n // 4. Protection du mode strict : interdire d'\u00E9craser / tronquer les donn\u00E9es existantes lorsque la capacit\u00E9 est atteinte\n if (isPrintableChar && engine.isStrict()) {\n const totalSlots = engine.getEditableCount();\n if (totalSlots > 0) {\n const currentRaw = engine.extractRaw(input.value);\n\n let availableCapacity = totalSlots - currentRaw.length;\n if (selectionEnd > cursor) {\n const selectedRaw = engine.extractRaw(input.value.slice(cursor, selectionEnd));\n availableCapacity = totalSlots - (currentRaw.length - selectedRaw.length);\n }\n\n if (availableCapacity <= 0) {\n e.preventDefault();\n return;\n }\n }\n }\n\n // 4. Gestion d'une s\u00E9lection \u00E9tendue (ex: Ctrl+A ou s\u00E9lection souris suivi de Suppr ou Backspace)\n if (selectionEnd > cursor) {\n if (e.key === 'Backspace' || e.key === 'Delete') {\n e.preventDefault();\n const val = input.value;\n const updated = val.slice(0, cursor) + val.slice(selectionEnd);\n this.delegate.applyMask(updated, Math.max(minPos, cursor));\n return;\n }\n return;\n }\n\n // 4. Verrouillage du pr\u00E9fixe statique fixe (ArrowLeft, Home, Ctrl+Home, Ctrl+ArrowLeft) hors s\u00E9lection Shift\n if (e.key === 'ArrowLeft' && !e.shiftKey && cursor <= minPos) {\n e.preventDefault();\n input.setSelectionRange(minPos, minPos);\n return;\n }\n if (e.key === 'Home' && !e.shiftKey) {\n e.preventDefault();\n input.setSelectionRange(minPos, minPos);\n return;\n }\n\n // 5. Interdire d'effacer dans le pr\u00E9fixe statique\n if (e.key === 'Backspace' && cursor <= minPos) {\n e.preventDefault();\n input.setSelectionRange(minPos, minPos);\n return;\n }\n if (e.key === 'Delete' && cursor < minPos) {\n e.preventDefault();\n input.setSelectionRange(minPos, minPos);\n return;\n }\n\n // 7. Suppression de mot / bloc vers la gauche : Ctrl+Backspace, Alt+Backspace, Cmd+Backspace\n const isWordDeleteBack = e.key === 'Backspace' && (e.ctrlKey || e.altKey || e.metaKey);\n if (isWordDeleteBack) {\n e.preventDefault();\n if (cursor <= minPos) {\n input.setSelectionRange(minPos, minPos);\n return;\n }\n\n let i = cursor - 1;\n // Sauter d'abord les s\u00E9parateurs statiques imm\u00E9diats \u00E0 gauche\n while (i >= minPos && engine.isSeparatorAt(i)) {\n i--;\n }\n // Puis sauter tous les caract\u00E8res \u00E9ditables du mot / bloc\n while (i >= minPos && !engine.isSeparatorAt(i)) {\n i--;\n }\n\n const startPos = Math.max(minPos, i + 1);\n const val = input.value;\n const updated = val.slice(0, startPos) + val.slice(cursor);\n this.delegate.applyMask(updated, startPos);\n return;\n }\n\n // 8. Suppression de mot / bloc vers la droite : Ctrl+Delete, Alt+Delete\n const isWordDeleteForward = e.key === 'Delete' && (e.ctrlKey || e.altKey || e.metaKey);\n if (isWordDeleteForward) {\n e.preventDefault();\n const val = input.value;\n if (cursor >= val.length) {\n return;\n }\n\n let i = cursor;\n // Sauter d'abord les \u00E9ventuels s\u00E9parateurs statiques sous le curseur\n while (i < val.length && engine.isSeparatorAt(i)) {\n i++;\n }\n // Puis sauter tous les caract\u00E8res \u00E9ditables du mot / bloc\n while (i < val.length && !engine.isSeparatorAt(i)) {\n i++;\n }\n // Nettoyer les s\u00E9parateurs suivants pour \u00E9viter un double espace tra\u00EEnant\n while (i < val.length && engine.isSeparatorAt(i)) {\n i++;\n }\n\n const endPos = i;\n const updated = val.slice(0, cursor) + val.slice(endPos);\n this.delegate.applyMask(updated, cursor);\n return;\n }\n\n // 9. Touche Backspace unitaire devant un s\u00E9parateur statique interne\n if (e.key === 'Backspace' && cursor > minPos) {\n if (engine.isSeparatorAt(cursor - 1)) {\n e.preventDefault();\n let targetPos = cursor - 1;\n while (targetPos > minPos && engine.isSeparatorAt(targetPos - 1)) {\n targetPos--;\n }\n if (targetPos > minPos) {\n const val = input.value;\n const updated = val.slice(0, targetPos - 1) + val.slice(cursor);\n this.delegate.applyMask(updated, targetPos - 1);\n } else {\n this.delegate.applyMask('', minPos);\n }\n }\n return;\n }\n\n // 10. Touche Delete unitaire sur un s\u00E9parateur statique interne\n if (e.key === 'Delete' && cursor < input.value.length) {\n if (engine.isSeparatorAt(cursor)) {\n e.preventDefault();\n let targetPos = cursor;\n while (targetPos < input.value.length && engine.isSeparatorAt(targetPos)) {\n targetPos++;\n }\n if (targetPos < input.value.length) {\n const val = input.value;\n const updated = val.slice(0, targetPos) + val.slice(targetPos + 1);\n this.delegate.applyMask(updated, cursor);\n }\n }\n return;\n }\n }\n\n /**\n * Analyse et traite l'\u00E9v\u00E9nement keyup de l'input.\n */\n public handleKeyUp(e: KeyboardEvent): void {\n const input = this.delegate.getInput();\n const history = this.delegate.getHistory();\n\n if ((e.key === 'ArrowLeft' || e.key === 'ArrowRight' || e.key === 'Home') && !e.shiftKey) {\n this.delegate.enforceMinCursor();\n }\n history.updateCurrentCursor(input.selectionStart ?? 0);\n }\n}\n", "import { MaskOptions, MaskEventDetail, SetMaskOptions, IInputMask } from './types';\nimport { MaskEngine } from './MaskEngine';\nimport { MaskHistory } from './MaskHistory';\nimport { MaskKeyboard } from './MaskKeyboard';\nimport { BaseInputMask, resolveMaskConstructorArgs } from './BaseInputMask';\n\n/**\n * Contr\u00F4leur principal InputMask.\n * G\u00E8re le cycle de vie DOM, la synchronisation du pseudo-\u00E9l\u00E9ment ::after\n * via l'attribut data-mask et la navigation du curseur.\n */\nexport class InputMask extends BaseInputMask<MaskOptions> implements IInputMask<MaskOptions> {\n public engine: MaskEngine;\n public history: MaskHistory;\n public keyboard: MaskKeyboard;\n\n private isComposing: boolean = false;\n private isUndoingRedoing: boolean = false;\n private isMouseDown: boolean = false;\n private isApplyingMask: boolean = false;\n\n private lastValue: string = '';\n private lastInternalRemainingMask: string = '';\n private isNotifying: boolean = false;\n private hasPendingNotification: boolean = false;\n private onChangeNativeHandler: () => void = () => {};\n private wasInputModeInferred: boolean = false;\n private cutTimerId: number | null = null;\n private pasteTimerId: number | null = null;\n private resetTimerId: number | null = null;\n\n constructor(input: HTMLInputElement, options?: MaskOptions);\n constructor(wrapper: HTMLElement | null, input: HTMLInputElement, options?: MaskOptions);\n constructor(\n targetOrWrapper: HTMLElement | HTMLInputElement | null | undefined,\n inputOrOptions?: HTMLInputElement | MaskOptions,\n options?: MaskOptions\n );\n constructor(\n targetOrWrapper: HTMLElement | HTMLInputElement | null | undefined,\n inputOrOptions?: HTMLInputElement | MaskOptions,\n options?: MaskOptions\n ) {\n const args = resolveMaskConstructorArgs<MaskOptions>(targetOrWrapper, inputOrOptions, options);\n const wrap = args.wrapper;\n const inp = args.input;\n const opts = args.options;\n\n const attrMask = wrap?.getAttribute('data-mask') || inp?.getAttribute('data-mask');\n let pattern: string | string[] = opts.mask || attrMask || '';\n // Support multi-motifs s\u00E9par\u00E9s par pipe dans data-mask (ex: \"99 99 99 99|99 99 99 99 99\")\n if (typeof pattern === 'string' && pattern.includes('|')) {\n pattern = pattern.split('|').map(s => s.trim());\n }\n\n const placeholderChar = opts.placeholderChar || wrap?.getAttribute('data-mask-placeholder') || inp?.getAttribute('data-mask-placeholder') || '_';\n const dataDisabled = wrap?.hasAttribute('data-disabled') || inp?.hasAttribute('data-disabled');\n const dataStrict = wrap?.getAttribute('data-mask-strict') || inp?.getAttribute('data-mask-strict');\n const dataAutoLower = wrap?.getAttribute('data-mask-auto-lowercase') === 'true' || inp?.getAttribute('data-mask-auto-lowercase') === 'true';\n const dataInfer = wrap?.getAttribute('data-mask-infer-inputmode') ?? inp?.getAttribute('data-mask-infer-inputmode');\n const inferInputMode = opts.inferInputMode ?? (dataInfer !== null ? dataInfer !== 'false' : true);\n\n const { disabled: optsDisabled, ...otherOpts } = opts;\n const resolvedDisabled = optsDisabled !== undefined ? optsDisabled : (dataDisabled ? true : (!pattern || (Array.isArray(pattern) && pattern.length === 0)));\n\n const resolvedOptions: MaskOptions = {\n ...otherOpts,\n mask: pattern,\n placeholderChar,\n strict: opts.strict ?? (dataStrict !== null ? dataStrict !== 'false' : true),\n autoLowercase: opts.autoLowercase ?? dataAutoLower ?? false,\n disabled: resolvedDisabled,\n resetHistoryOnMaskChange: opts.resetHistoryOnMaskChange ?? false,\n inferInputMode,\n onInput: opts.onInput || (opts as any).oninput,\n onChange: opts.onChange || (opts as any).onchange,\n onComplete: opts.onComplete || (opts as any).oncomplete\n };\n\n super(wrap, inp, resolvedOptions);\n\n this.history = new MaskHistory();\n\n // Initialisation du moteur algorithmique\n this.engine = new MaskEngine(this.options.mask || '', {\n placeholderChar: this.options.placeholderChar,\n tokens: this.options.tokens,\n strict: this.options.strict,\n autoLowercase: this.options.autoLowercase\n });\n\n // Inf\u00E9rence automatique accessible de inputmode=\"numeric\" si masque exclusivement compos\u00E9 de chiffres\n this.syncInferredInputMode();\n\n // Initialisation du gestionnaire clavier d\u00E9di\u00E9\n this.keyboard = new MaskKeyboard({\n getInput: () => this.input,\n getEngine: () => this.engine,\n getHistory: () => this.history,\n applyMask: (raw, cursor, forceExactCursor) => this.applyMask(raw, cursor, forceExactCursor),\n undo: () => this.undo(),\n redo: () => this.redo(),\n enforceMinCursor: () => this.enforceMinCursor()\n });\n\n this.bindEvents();\n this.lastValue = this.input.value;\n this.syncInitialValue();\n\n this.runAuditWarning(this.options.audit);\n }\n\n protected override getSpecificAuditWarnings(): string[] {\n const warnings: string[] = [];\n const hasDescribedby = Boolean(this.input.getAttribute('aria-describedby')?.trim());\n const hasPlaceholder = Boolean(this.input.getAttribute('placeholder')?.trim());\n const hasAriaPlaceholder = Boolean(this.input.getAttribute('aria-placeholder')?.trim());\n if (!hasDescribedby && !hasPlaceholder && !hasAriaPlaceholder && !this.options.disabled) {\n warnings.push(\n 'Indication du format attendu manquante : d\u00E9finissez aria-describedby, placeholder ou aria-placeholder pour informer les technologies d\\'assistance (WCAG 3.3.2).'\n );\n }\n return warnings;\n }\n\n protected override extractRawSnippet(snippet: string): string {\n return this.engine.extractRaw(snippet);\n }\n\n /**\n * Formate statiquement une valeur selon un masque donn\u00E9 sans n\u00E9cessiter d'\u00E9l\u00E9ment DOM.\n *\n * @param value Valeur \u00E0 formater (ex: \"0123456789\")\n * @param mask Gabarit de masque (ex: \"99 99 99 99 99\")\n * @param options Options facultatives du masque (tokens, placeholderChar, strict, etc.)\n * @returns Valeur format\u00E9e (ex: \"01 23 45 67 89\")\n */\n public static format(value: string, mask: string, options: Partial<MaskOptions> = {}): string {\n return MaskEngine.format(value, mask, options);\n }\n\n protected onNativeValueSet(strVal: string): void {\n if (this.options.disabled) {\n this.checkValueChange();\n } else {\n this.applyMask(strVal, strVal.length);\n }\n }\n\n protected onDisabledChange(disabled: boolean): void {\n if (disabled) {\n this.wrapper.removeAttribute('data-mask');\n this.wrapper.classList.remove('is-complete', 'has-selection');\n if (this.ghost) this.ghost.textContent = '';\n this.checkValueChange();\n } else {\n this.applyMask(this.input.value, this.input.selectionStart ?? this.input.value.length);\n }\n }\n\n /**\n * Associe les \u00E9couteurs d'\u00E9v\u00E9nements n\u00E9cessaires.\n */\n private bindEvents(): void {\n this.handleInput = this.handleInput.bind(this);\n this.onKeyDown = this.onKeyDown.bind(this);\n this.onPaste = this.onPaste.bind(this);\n this.onFocus = this.onFocus.bind(this);\n this.onBlur = this.onBlur.bind(this);\n this.onClick = this.onClick.bind(this);\n this.onKeyUp = this.onKeyUp.bind(this);\n this.onSelect = this.onSelect.bind(this);\n this.onMouseDown = this.onMouseDown.bind(this);\n this.onMouseUp = this.onMouseUp.bind(this);\n this.onCompositionStart = this.onCompositionStart.bind(this);\n this.onCompositionEnd = this.onCompositionEnd.bind(this);\n this.onScroll = this.onScroll.bind(this);\n this.onBeforeInput = this.onBeforeInput.bind(this);\n\n this.onCutHandler = () => {\n if (this.cutTimerId !== null) clearTimeout(this.cutTimerId);\n this.cutTimerId = window.setTimeout(() => {\n this.cutTimerId = null;\n if (this.isDestroyed) return;\n if (this.options.disabled) {\n this.checkValueChange();\n } else {\n const cur = this.input.selectionStart ?? this.input.value.length;\n this.applyMask(this.input.value, cur);\n }\n }, 0);\n };\n\n this.onChangeNativeHandler = () => {\n if (this.isDestroyed) return;\n this.checkValueChange();\n };\n\n this.input.addEventListener('beforeinput', this.onBeforeInput as EventListener);\n this.input.addEventListener('input', this.handleInput);\n this.input.addEventListener('keydown', this.onKeyDown);\n this.input.addEventListener('paste', this.onPaste);\n this.input.addEventListener('focus', this.onFocus);\n this.input.addEventListener('blur', this.onBlur);\n this.input.addEventListener('click', this.onClick);\n this.input.addEventListener('keyup', this.onKeyUp);\n this.input.addEventListener('select', this.onSelect);\n this.input.addEventListener('mousedown', this.onMouseDown);\n window.addEventListener('mouseup', this.onMouseUp);\n this.input.addEventListener('compositionstart', this.onCompositionStart);\n this.input.addEventListener('compositionend', this.onCompositionEnd);\n this.input.addEventListener('scroll', this.onScroll);\n this.input.addEventListener('cut', this.onCutHandler);\n this.input.addEventListener('change', this.onChangeNativeHandler);\n\n if (this.input.form) {\n this.onFormResetHandler = () => {\n if (this.resetTimerId !== null) clearTimeout(this.resetTimerId);\n this.resetTimerId = window.setTimeout(() => {\n this.resetTimerId = null;\n if (this.isDestroyed) return;\n if (this.options.disabled) {\n this.checkValueChange();\n } else {\n this.syncInitialValue();\n }\n }, 0);\n };\n this.input.form.addEventListener('reset', this.onFormResetHandler);\n }\n }\n\n /**\n * Synchronise dynamiquement l'attribut inputmode=\"numeric\" selon le motif actif\n * sans jamais \u00E9craser un inputmode d\u00E9fini explicitement par l'h\u00F4te.\n */\n private syncInferredInputMode(): void {\n if (!this.options.inferInputMode) return;\n const isNum = !this.options.disabled && this.engine.isNumericOnly();\n if (isNum) {\n if (!this.input.hasAttribute('inputmode')) {\n this.input.inputMode = 'numeric';\n this.wasInputModeInferred = true;\n }\n } else if (this.wasInputModeInferred && this.input.getAttribute('inputmode') === 'numeric') {\n this.input.removeAttribute('inputmode');\n this.wasInputModeInferred = false;\n }\n }\n\n /**\n * Supprime tous les \u00E9couteurs et nettoie les attributs associ\u00E9s.\n */\n public destroy(): void {\n if (this.isDestroyed) return;\n if (this.cutTimerId !== null) {\n clearTimeout(this.cutTimerId);\n this.cutTimerId = null;\n }\n if (this.pasteTimerId !== null) {\n clearTimeout(this.pasteTimerId);\n this.pasteTimerId = null;\n }\n if (this.resetTimerId !== null) {\n clearTimeout(this.resetTimerId);\n this.resetTimerId = null;\n }\n this.input.removeEventListener('beforeinput', this.onBeforeInput as EventListener);\n this.input.removeEventListener('input', this.handleInput);\n this.input.removeEventListener('keydown', this.onKeyDown);\n this.input.removeEventListener('paste', this.onPaste);\n this.input.removeEventListener('focus', this.onFocus);\n this.input.removeEventListener('blur', this.onBlur);\n this.input.removeEventListener('click', this.onClick);\n this.input.removeEventListener('keyup', this.onKeyUp);\n this.input.removeEventListener('select', this.onSelect);\n this.input.removeEventListener('mousedown', this.onMouseDown);\n window.removeEventListener('mouseup', this.onMouseUp);\n this.input.removeEventListener('compositionstart', this.onCompositionStart);\n this.input.removeEventListener('compositionend', this.onCompositionEnd);\n this.input.removeEventListener('scroll', this.onScroll);\n this.input.removeEventListener('cut', this.onCutHandler);\n this.input.removeEventListener('change', this.onChangeNativeHandler);\n\n if (this.input.form && this.onFormResetHandler) {\n this.input.form.removeEventListener('reset', this.onFormResetHandler);\n }\n\n if (this.wasInputModeInferred && this.input.getAttribute('inputmode') === 'numeric') {\n this.input.removeAttribute('inputmode');\n }\n\n this.history.clear();\n super.destroy();\n }\n\n /**\n * D\u00E9finit si le masque bloque strictement les entr\u00E9es non conformes.\n */\n public setStrict(strict: boolean): void {\n this.options.strict = strict;\n this.engine.setStrict(strict);\n if (!this.options.disabled) {\n this.applyMask(this.input.value, this.input.selectionStart ?? this.input.value.length);\n }\n }\n\n /**\n * Indique si le masque est en mode strict.\n */\n public isStrict(): boolean {\n return this.engine.isStrict();\n }\n\n /**\n * Modifie dynamiquement le masque actif.\n * Permet de d\u00E9sactiver le masque avec null/vide, ou de sp\u00E9cifier un mode strict/souple.\n */\n public setMask(newPattern: string | string[] | null, options?: SetMaskOptions | boolean): void {\n const newStrict = typeof options === 'boolean'\n ? options\n : (options && typeof options === 'object' && options.strict !== undefined)\n ? options.strict\n : this.options.strict;\n\n const shouldResetHistory = (options && typeof options === 'object' && options.resetHistory !== undefined)\n ? options.resetHistory\n : Boolean(this.options.resetHistoryOnMaskChange);\n\n const isTargetingEmpty = !newPattern || (Array.isArray(newPattern) && newPattern.length === 0);\n if (isTargetingEmpty && this.options.disabled && (!this.options.mask || this.options.mask === '')) {\n return;\n }\n\n if (!newPattern || (Array.isArray(newPattern) && newPattern.length === 0)) {\n this.options.mask = '';\n this.options.strict = newStrict;\n this.engine.setStrict(newStrict ?? true);\n this.engine.compile('');\n if (shouldResetHistory) {\n this.history.clear();\n }\n this.setDisabled(true);\n this.syncInferredInputMode();\n return;\n }\n\n this.options.mask = newPattern;\n this.options.strict = newStrict;\n this.engine.setStrict(newStrict ?? true);\n this.engine.compile(newPattern);\n if (shouldResetHistory) {\n this.history.clear();\n }\n this.setDisabled(false);\n this.syncInferredInputMode();\n }\n\n protected override handleAttributeMutation(attrName: string): void {\n super.handleAttributeMutation(attrName);\n if (attrName === 'data-mask') {\n const rawAttr = this.getAttr('data-mask');\n if (rawAttr === this.lastInternalRemainingMask) {\n return;\n }\n const currentMaskStr = Array.isArray(this.options.mask)\n ? this.options.mask.join('|')\n : (this.options.mask || '');\n if (rawAttr === currentMaskStr) {\n return;\n }\n if (rawAttr) {\n const maskVal = rawAttr.includes('|') ? rawAttr.split('|').map(s => s.trim()) : rawAttr;\n this.setMask(maskVal);\n } else {\n this.setMask(null);\n }\n } else if (attrName === 'data-mask-strict') {\n const strictVal = this.getAttr('data-mask-strict');\n this.setStrict(strictVal !== 'false');\n } else if (attrName === 'data-mask-auto-lowercase') {\n this.options.autoLowercase = this.getAttr('data-mask-auto-lowercase') === 'true';\n this.engine.compile(this.options.mask || '');\n this.applyMask(this.input.value, this.input.selectionStart ?? this.input.value.length);\n } else if (attrName === 'placeholder') {\n this.updateGhost(this.input.value);\n }\n }\n\n /**\n * Affecte une nouvelle valeur manuellement (format\u00E9e ou brute).\n */\n public override setValue(val: string | number): void {\n const safeVal = val !== null && val !== undefined ? String(val) : '';\n if (this.options.disabled) {\n this.input.value = safeVal;\n this.checkValueChange();\n return;\n }\n this.applyMask(safeVal, safeVal.length);\n }\n\n /**\n * Retourne la valeur brute sans s\u00E9parateurs.\n */\n public override getRawValue(): string {\n return this.engine.extractRaw(this.input.value);\n }\n\n /**\n * Indique si tous les emplacements \u00E9ditables sont renseign\u00E9s.\n */\n public isComplete(): boolean {\n if (this.options.disabled) return true;\n const raw = this.getRawValue();\n return raw.length >= this.engine.getEditableCount();\n }\n\n /**\n * Callback d'\u00E9coute directe ou getter/setter pour onInput.\n */\n public get onInput(): ((value: string, detail: MaskEventDetail) => void) | undefined {\n return this.options.onInput;\n }\n\n public set onInput(callback: ((value: string, detail: MaskEventDetail) => void) | undefined) {\n this.options.onInput = callback;\n }\n\n /**\n * Annule la derni\u00E8re modification (Undo).\n */\n public undo(): void {\n if (this.options.disabled) return;\n const state = this.history.undo();\n if (state) {\n this.isUndoingRedoing = true;\n this.applyMask(state.raw, state.cursor);\n this.isUndoingRedoing = false;\n }\n }\n\n /**\n * R\u00E9tablit la modification annul\u00E9e (Redo).\n */\n public redo(): void {\n if (this.options.disabled) return;\n const state = this.history.redo();\n if (state) {\n this.isUndoingRedoing = true;\n this.applyMask(state.raw, state.cursor);\n this.isUndoingRedoing = false;\n }\n }\n\n // ==========================================================================\n // Gestionnaires d'\u00E9v\u00E9nements DOM\n // ==========================================================================\n\n private checkSelection(): void {\n if (this.options.disabled) return;\n const start = this.input.selectionStart ?? 0;\n const end = this.input.selectionEnd ?? start;\n const hasSelection = start !== end;\n this.wrapper.classList.toggle('has-selection', hasSelection);\n }\n\n private onBeforeInput(e: InputEvent): void {\n if (this.options.disabled) return;\n if (this.isComposing) return;\n if (!this.engine.isStrict()) return;\n if (e.inputType === 'insertFromPaste') return;\n\n // Si l'\u00E9v\u00E9nement est une insertion (saisie clavier, glisser-d\u00E9poser, composition)\n if (e.inputType && e.inputType.startsWith('insert')) {\n const totalSlots = this.engine.getEditableCount();\n if (totalSlots > 0) {\n const currentRaw = this.getRawValue();\n const start = this.input.selectionStart ?? 0;\n const end = this.input.selectionEnd ?? start;\n\n let availableCapacity = Math.max(0, totalSlots - currentRaw.length);\n if (end > start) {\n const selectedRaw = this.engine.extractRaw(this.input.value.slice(start, end));\n availableCapacity = Math.max(0, totalSlots - (currentRaw.length - selectedRaw.length));\n }\n\n if (availableCapacity <= 0) {\n e.preventDefault();\n }\n }\n }\n }\n\n private handleInput(e: Event): void {\n if (this.isDispatchingNativeInput) return;\n if (this.isComposing) return;\n\n // D\u00E9tection imm\u00E9diate du changement de valeur d\u00E8s la frappe pour permettre \u00E0 onInput de r\u00E9agir\n const hasOnInput = Boolean(this.options.onInput || (this.options as any).oninput);\n if (hasOnInput && this.input.value !== this.lastValue) {\n this.checkValueChange();\n }\n\n if (this.options.disabled) {\n this.checkValueChange();\n return;\n }\n\n // Garde-fou strict : emp\u00EAcher tout d\u00E9passement de capacit\u00E9 au-del\u00E0 des slots disponibles\n const prevState = this.history.getCurrent();\n const totalSlots = this.engine.getEditableCount();\n if (totalSlots > 0 && this.engine.isStrict() && prevState && prevState.raw.length >= totalSlots) {\n const newRaw = this.engine.extractRaw(this.input.value);\n // Ne bloquer que si la nouvelle valeur brute d\u00E9passe la capacit\u00E9 permise du masque\n if (newRaw.length > totalSlots) {\n this.applyMask(prevState.raw, prevState.cursor);\n return;\n }\n }\n\n const oldCursor = this.input.selectionStart ?? this.input.value.length;\n this.applyMask(this.input.value, oldCursor);\n this.checkSelection();\n }\n\n private onKeyDown(e: KeyboardEvent): void {\n if (this.options.disabled) return;\n this.keyboard.handleKeyDown(e);\n }\n\n private onMouseDown(): void {\n this.isMouseDown = true;\n }\n\n private onMouseUp(): void {\n this.isMouseDown = false;\n this.checkSelection();\n }\n\n private onPaste(e: ClipboardEvent): void {\n if (this.options.disabled) {\n if (this.pasteTimerId !== null) clearTimeout(this.pasteTimerId);\n this.pasteTimerId = window.setTimeout(() => {\n this.pasteTimerId = null;\n if (!this.isDestroyed) this.checkValueChange();\n }, 0);\n return;\n }\n e.preventDefault();\n this.history.updateCurrentCursor(this.input.selectionStart ?? 0);\n const rawPasted = e.clipboardData?.getData('text') || '';\n const pastedText = rawPasted.trim();\n if (!pastedText) return;\n\n const minPos = this.engine.getPrefixLength();\n const selStart = this.input.selectionStart ?? 0;\n const selEnd = this.input.selectionEnd ?? selStart;\n const currentVal = this.input.value;\n\n const totalSlots = this.engine.getEditableCount();\n const currentRaw = this.getRawValue();\n\n // 1. D\u00E9tection de collage d'une valeur compl\u00E8te :\n // Si le texte coll\u00E9 commence par le pr\u00E9fixe fixe (ex: \"+33\" ou \"FR76\"),\n // ou par les caract\u00E8res d\u00E9j\u00E0 pr\u00E9sents au d\u00E9but du champ (ex: \"FR76\" dans un masque \"AA99\")\n const prefix = this.engine.getPrefix();\n const cleanPrefix = prefix.replace(/[\\s.-]+/g, '').toUpperCase();\n const cleanPasted = pastedText.replace(/[\\s.-]+/g, '').toUpperCase();\n\n const startsWithStaticPrefix = cleanPrefix.length > 0 && cleanPasted.startsWith(cleanPrefix);\n\n const prefixInField = currentVal.slice(0, Math.max(minPos, selStart)).replace(/[\\s.-]+/g, '').toUpperCase();\n const startsWithFieldStart = prefixInField.length >= 2 && cleanPasted.startsWith(prefixInField);\n\n let effectiveStart = Math.max(minPos, selStart);\n let effectiveEnd = Math.max(minPos, selEnd);\n\n if (startsWithStaticPrefix || startsWithFieldStart) {\n // Le texte coll\u00E9 contient d\u00E9j\u00E0 le d\u00E9but complet du champ : on remplace la totalit\u00E9 du champ\n effectiveStart = 0;\n effectiveEnd = currentVal.length;\n }\n\n let availableCapacity = Math.max(0, totalSlots - currentRaw.length);\n if (effectiveStart !== effectiveEnd) {\n const selectedRaw = this.engine.extractRaw(currentVal.slice(effectiveStart, effectiveEnd));\n availableCapacity = Math.max(0, totalSlots - (currentRaw.length - selectedRaw.length));\n }\n\n // En mode strict : si aucune capacit\u00E9 n'est disponible et aucun remplacement, ignorer\n if (this.engine.isStrict() && availableCapacity <= 0) {\n return;\n }\n\n let combined: string;\n let newCursorPos: number;\n\n if (effectiveStart === 0 && effectiveEnd === currentVal.length) {\n // Remplacement global complet\n combined = pastedText;\n newCursorPos = pastedText.length;\n } else {\n // Insertion ou remplacement partiel\n combined = currentVal.slice(0, effectiveStart) + pastedText + currentVal.slice(effectiveEnd);\n newCursorPos = effectiveStart + pastedText.length;\n }\n\n this.applyMask(combined, newCursorPos);\n this.checkSelection();\n }\n\n private onFocus(): void {\n this.syncGhostStyles();\n this.wrapper.classList.add('is-focused');\n // Si le focus est provoqu\u00E9 par un clic souris (mousedown en cours), on laisse\n // le geste de s\u00E9lection / positionnement de la souris se terminer librement.\n if (!this.options.disabled && !this.isMouseDown) {\n this.enforceMinCursor();\n }\n this.updateGhost(this.input.value);\n this.checkSelection();\n }\n\n private onBlur(): void {\n this.wrapper.classList.remove('is-focused', 'has-selection');\n if (this.input.type === 'password') {\n this.history.clear();\n }\n this.updateGhost(this.input.value);\n }\n\n private onClick(): void {\n if (!this.options.disabled) {\n this.enforceMinCursor();\n }\n this.history.updateCurrentCursor(this.input.selectionStart ?? 0);\n this.checkSelection();\n }\n\n private onKeyUp(e: KeyboardEvent): void {\n if (!this.options.disabled) {\n this.keyboard.handleKeyUp(e);\n }\n this.checkSelection();\n }\n\n private onSelect(): void {\n this.history.updateCurrentCursor(this.input.selectionStart ?? 0);\n this.checkSelection();\n }\n\n private onCompositionStart(): void {\n this.isComposing = true;\n }\n\n private onCompositionEnd(): void {\n this.isComposing = false;\n if (this.options.disabled) return;\n const oldCursor = this.input.selectionStart ?? this.input.value.length;\n this.applyMask(this.input.value, oldCursor);\n this.checkSelection();\n }\n\n /**\n * Emp\u00EAche strictement le curseur de se positionner avant la fin du pr\u00E9fixe statique\n * lorsqu'il n'y a PAS de s\u00E9lection active.\n * Si une s\u00E9lection est active (ex: pour copier avec Ctrl+C ou \u00E9craser avec Ctrl+A),\n * elle est pr\u00E9serv\u00E9e sans restriction.\n */\n private enforceMinCursor(): void {\n const minPos = this.engine.getPrefixLength();\n if (minPos <= 0) return;\n\n const start = this.input.selectionStart ?? 0;\n const end = this.input.selectionEnd ?? start;\n\n // Si une s\u00E9lection de texte est active (start !== end), on ne restreint JAMAIS :\n // l'utilisateur peut librement s\u00E9lectionner l'int\u00E9gralit\u00E9 du champ (incluant le pr\u00E9fixe \"+33\") pour copier.\n if (start !== end) {\n return;\n }\n\n // Curseur simple sans s\u00E9lection : repositionner apr\u00E8s le pr\u00E9fixe statique\n if (start < minPos) {\n this.input.setSelectionRange(minPos, minPos);\n }\n }\n\n // ==========================================================================\n // Pipeline de calcul et de synchronisation\n // ==========================================================================\n\n private updateGhost(formatted: string): void {\n if (!this.ghost) return;\n\n if (this.options.disabled) {\n this.ghost.textContent = '';\n return;\n }\n\n const isCleanEmpty = !formatted || formatted === this.engine.getPrefix();\n if (this.shouldHideGhostForPlaceholder(isCleanEmpty)) {\n this.ghost.textContent = '';\n return;\n }\n\n const fullTemplate = this.engine.getFullMaskTemplate();\n const rest = fullTemplate.length > formatted.length\n ? fullTemplate.substring(formatted.length)\n : '';\n\n this.ghost.textContent = '';\n const spanTyped = document.createElement('span');\n spanTyped.className = 'mask-ghost-typed';\n spanTyped.textContent = formatted;\n\n const spanRemaining = document.createElement('span');\n spanRemaining.className = 'mask-ghost-remaining';\n spanRemaining.textContent = rest;\n\n this.ghost.appendChild(spanTyped);\n this.ghost.appendChild(spanRemaining);\n this.ghost.scrollLeft = this.input.scrollLeft;\n }\n\n private applyMask(rawOrPartial: string, cursorPosition: number, forceExactCursor: boolean = false): void {\n if (this.options.disabled || this.isApplyingMask) return;\n this.isApplyingMask = true;\n\n let formatted = '';\n let isCompleted = false;\n\n try {\n formatted = this.engine.format(rawOrPartial);\n const remainingMask = this.engine.getRemainingMask(formatted);\n\n // 1. Mise \u00E0 jour de la valeur de l'input natif\n this.input.value = formatted;\n\n // 2. Mise \u00E0 jour de l'attribut data-mask lu par ::after en CSS (r\u00E9trocompatibilit\u00E9)\n this.lastInternalRemainingMask = remainingMask;\n this.wrapper.setAttribute('data-mask', remainingMask);\n\n // 3. Mise \u00E0 jour du conteneur fant\u00F4me (ghost)\n this.updateGhost(formatted);\n\n // 4. Calcul et restauration exacte de la position du curseur\n const minPos = this.engine.getPrefixLength();\n let safeCursor: number;\n if (forceExactCursor || this.isUndoingRedoing) {\n // Position exacte forc\u00E9e sans recalcul algorithmique\n safeCursor = Math.max(minPos, Math.min(cursorPosition, formatted.length));\n } else {\n const calculatedCursor = this.engine.mapCursorPosition(rawOrPartial, cursorPosition, formatted);\n safeCursor = Math.max(minPos, calculatedCursor);\n }\n this.input.setSelectionRange(safeCursor, safeCursor);\n\n // 5. Mise \u00E0 jour de la classe de compl\u00E9tude\n isCompleted = this.isComplete();\n this.wrapper.classList.toggle('is-complete', isCompleted);\n\n // 6. Enregistrement dans l'historique Undo/Redo si l'\u00E9tat change (d\u00E9sactiv\u00E9 sur champ password pour s\u00E9curit\u00E9 PII)\n if (!this.isUndoingRedoing && this.input.type !== 'password') {\n this.history.push(this.getRawValue(), safeCursor);\n }\n } finally {\n this.isApplyingMask = false;\n }\n\n // 7. Notification des callbacks HORS du verrou isApplyingMask pour autoriser setMask() dynamique dans onInput / onChange\n this.checkValueChange();\n }\n\n private syncInitialValue(): void {\n if (this.options.disabled) {\n this.wrapper.removeAttribute('data-mask');\n if (this.ghost) this.ghost.textContent = '';\n this.lastValue = this.input.value;\n this.checkValueChange();\n return;\n }\n\n this.syncGhostStyles();\n const initialVal = this.input.value || '';\n if (initialVal) {\n this.applyMask(initialVal, initialVal.length);\n } else {\n const minPos = this.engine.getPrefixLength();\n if (minPos > 0) {\n // Pr\u00E9fixe statique fixe : initialiser le champ avec le pr\u00E9fixe\n this.applyMask('', minPos);\n } else {\n // Masque sans pr\u00E9fixe statique\n if (this.input.type !== 'password') {\n this.history.push('', 0);\n }\n const fullTemplate = this.engine.getFullMaskTemplate();\n this.lastInternalRemainingMask = fullTemplate;\n this.wrapper.setAttribute('data-mask', fullTemplate);\n this.updateGhost('');\n this.checkValueChange();\n }\n }\n }\n\n /**\n * V\u00E9rifie si la valeur a chang\u00E9 et notifie les observateurs (onInput, onChange, onComplete).\n * G\u00E8re de mani\u00E8re s\u00FBre la r\u00E9entrance pour permettre d'appeler setMask() directement dans le callback.\n */\n public checkValueChange(forceNotify: boolean = false): void {\n const currentVal = this.input.value;\n if (currentVal === this.lastValue && !forceNotify && !this.hasPendingNotification) {\n return;\n }\n\n if (this.isNotifying) {\n this.hasPendingNotification = true;\n return;\n }\n\n this.isNotifying = true;\n try {\n while (this.input.value !== this.lastValue || this.hasPendingNotification || forceNotify) {\n this.hasPendingNotification = false;\n forceNotify = false;\n const valToNotify = this.input.value;\n this.lastValue = valToNotify;\n\n const raw = this.options.disabled ? valToNotify : this.getRawValue();\n const totalSlots = this.options.disabled ? 0 : this.engine.getEditableCount();\n const isComplete = this.isComplete();\n const detail: MaskEventDetail = {\n value: valToNotify,\n rawValue: raw,\n isComplete,\n totalSlots,\n filledSlots: this.options.disabled ? valToNotify.length : raw.length\n };\n\n const onInputCb = this.options.onInput || (this.options as any).oninput;\n if (onInputCb) {\n onInputCb(valToNotify, detail);\n }\n this.input.dispatchEvent(new CustomEvent('mask:input', { bubbles: true, detail }));\n this.dispatchNativeInput();\n\n const onChangeCb = this.options.onChange || (this.options as any).onchange;\n if (onChangeCb) {\n onChangeCb(detail);\n }\n this.input.dispatchEvent(new CustomEvent('mask:change', { bubbles: true, detail }));\n\n const onCompleteCb = this.options.onComplete || (this.options as any).oncomplete;\n if (isComplete) {\n if (onCompleteCb) {\n onCompleteCb(detail);\n }\n this.input.dispatchEvent(new CustomEvent('mask:complete', { bubbles: true, detail }));\n }\n }\n } finally {\n this.isNotifying = false;\n }\n }\n}\n", "/**\n * Options pour le moteur AmountEngine.\n */\nexport interface AmountEngineOptions {\n /** Devise ou symbole mon\u00E9taire (ex: '\u20AC', '$', 'USD') */\n currency?: string;\n /** Unit\u00E9 mon\u00E9taire ou financi\u00E8re additionnelle/alternative (ex: 'kEUR', 'k/EUR', 'm/EUR', 'M\u20AC') */\n unit?: string;\n /** Position de la devise ('prefix' ou 'suffix', d\u00E9faut: 'suffix' si '\u20AC', 'prefix' si '$'/'\u00A3') */\n currencyPosition?: 'prefix' | 'suffix';\n /** Nombre maximum de d\u00E9cimales (d\u00E9faut: 2, 0 pour montant entier) */\n decimals?: number;\n /** S\u00E9parateur de d\u00E9cimales (d\u00E9faut: ',') */\n decimalSeparator?: string;\n /** S\u00E9parateur de milliers (d\u00E9faut: ' ' espace ins\u00E9cable) */\n thousandSeparator?: string;\n /** Autorise les montants n\u00E9gatifs (d\u00E9faut: false) */\n allowNegative?: boolean;\n /** Valeur minimale autoris\u00E9e */\n min?: number;\n /** Valeur maximale autoris\u00E9e */\n max?: number;\n}\n\nexport interface AmountFormatResult {\n /** Valeur format\u00E9e affich\u00E9e (ex: \"1 234,56 \u20AC\") */\n formatted: string;\n /** Nombre flottant extrait (ou null si vide) */\n rawNumber: number | null;\n /** Cha\u00EEne num\u00E9rique pure (ex: \"1234.56\" ou \"-1234.56\") */\n rawValue: string;\n /** Position du curseur recalcul\u00E9e */\n cursor: number;\n /** Indique si le montant respecte les bornes min et max */\n isValid: boolean;\n}\n\n/**\n * R\u00E9sultat de l'analyse lexicale d'une saisie mon\u00E9taire.\n */\nexport interface AmountParseResult {\n /** Indique si le montant est n\u00E9gatif */\n isNegative: boolean;\n /** Partie enti\u00E8re normalis\u00E9e */\n integerPart: string;\n /** Partie d\u00E9cimale extraite (ou null si non renseign\u00E9e) */\n decimalPart: string | null;\n /** Indique si un s\u00E9parateur d\u00E9cimal a \u00E9t\u00E9 saisi */\n hasDecimal: boolean;\n}\n\n/**\n * Moteur algorithmique pur pour le formatage mon\u00E9taire et num\u00E9rique.\n * D\u00E9coupl\u00E9 \u00E0 100% du DOM pour une fiabilit\u00E9 et testabilit\u00E9 optimales.\n */\nexport class AmountEngine {\n public options: Required<AmountEngineOptions>;\n\n constructor(options: AmountEngineOptions = {}) {\n let currency = options.currency ?? '';\n if (!currency && options.unit) {\n currency = options.unit;\n }\n const defaultPosition: 'prefix' | 'suffix' = (currency === '$' || currency === '\u00A3' || currency === '\u00A5') ? 'prefix' : 'suffix';\n\n this.options = {\n currency,\n unit: options.unit ?? currency,\n currencyPosition: options.currencyPosition ?? defaultPosition,\n decimals: options.decimals !== undefined ? Math.max(0, options.decimals) : 2,\n decimalSeparator: options.decimalSeparator ?? ',',\n thousandSeparator: options.thousandSeparator ?? '\\u00A0', // Espace ins\u00E9cable\n allowNegative: options.allowNegative ?? false,\n min: options.min ?? -Infinity,\n max: options.max ?? Infinity\n };\n }\n\n /**\n * Analyse et nettoie une saisie utilisateur pour extraire ses composantes num\u00E9riques.\n */\n public parse(input: string): AmountParseResult {\n let str = input.trim();\n let isNegative = false;\n\n if (this.options.allowNegative && str.includes('-')) {\n isNegative = true;\n }\n\n // Retirer la devise\n if (this.options.currency) {\n str = str.replace(new RegExp(this.escapeRegExp(this.options.currency), 'g'), '');\n }\n\n // Retirer d'abord le s\u00E9parateur de milliers pour \u00E9viter les conflits (ex: '1.250,50' avec thousandSeparator='.')\n if (this.options.thousandSeparator) {\n str = str.replace(new RegExp(this.escapeRegExp(this.options.thousandSeparator), 'g'), '');\n }\n // Nettoyer \u00E9galement les espaces ordinaires et ins\u00E9cables r\u00E9siduels\n str = str.replace(/[\\s\\u00A0]/g, '');\n\n const decSep = this.options.decimalSeparator;\n // D\u00E9tecter le s\u00E9parateur d\u00E9cimal (priorit\u00E9 au s\u00E9parateur configur\u00E9, fallback sur virgule ou point)\n let firstDecIndex = str.indexOf(decSep);\n if (firstDecIndex === -1) {\n // Si le s\u00E9parateur n'a pas \u00E9t\u00E9 trouv\u00E9, chercher le fallback point/virgule\n firstDecIndex = str.search(/[,.]/);\n }\n\n let integerRaw = '';\n let decimalRaw: string | null = null;\n let hasDecimal = false;\n\n if (firstDecIndex !== -1) {\n integerRaw = str.substring(0, firstDecIndex).replace(/\\D/g, '');\n if (this.options.decimals > 0) {\n hasDecimal = true;\n decimalRaw = str.substring(firstDecIndex + 1).replace(/\\D/g, '').slice(0, this.options.decimals);\n }\n } else {\n integerRaw = str.replace(/\\D/g, '');\n }\n\n // Supprimer les z\u00E9ros non significatifs en t\u00EAte (sauf si \"0\")\n if (integerRaw.length > 1) {\n integerRaw = integerRaw.replace(/^0+/, '') || '0';\n }\n\n return { isNegative, integerPart: integerRaw, decimalPart: decimalRaw, hasDecimal };\n }\n\n /**\n * Formate une valeur brute ou une saisie courante en pr\u00E9servant la fluidit\u00E9 du curseur.\n *\n * @param input Texte brut ou partiellement format\u00E9\n * @param rawCursor Position actuelle du curseur dans l'input natif\n */\n public format(input: string, rawCursor: number = input.length, padDecimals: boolean = false): AmountFormatResult {\n if (!input || input.trim() === '' || input === this.options.currency.trim()) {\n return {\n formatted: '',\n rawNumber: null,\n rawValue: '',\n cursor: 0,\n isValid: true\n };\n }\n\n // D\u00E9compte des chiffres significatifs avant le curseur pour le recalage sub-pixel\n const prefixBeforeCursor = input.substring(0, rawCursor);\n const digitsBeforeCursor = (prefixBeforeCursor.replace(/\\D/g, '')).length;\n const hadDecimalBeforeCursor = this.options.decimals > 0 && /[,.]/.test(prefixBeforeCursor);\n\n const { isNegative, integerPart, decimalPart, hasDecimal } = this.parse(input);\n\n let effectiveDecimal = decimalPart;\n let effectiveHasDecimal = hasDecimal;\n if (padDecimals && this.options.decimals > 0 && (integerPart || decimalPart !== null)) {\n effectiveHasDecimal = true;\n if (effectiveDecimal === null) {\n effectiveDecimal = '0'.repeat(this.options.decimals);\n } else if (effectiveDecimal.length < this.options.decimals) {\n effectiveDecimal = effectiveDecimal + '0'.repeat(this.options.decimals - effectiveDecimal.length);\n }\n }\n\n // Cas transitoire d'une saisie n\u00E9gative en cours (l'utilisateur tape \"-\" seul)\n if (isNegative && !integerPart && !effectiveDecimal && !effectiveHasDecimal && this.options.allowNegative) {\n let formatted = '-';\n let cursor = 1;\n if (this.options.currency) {\n if (this.options.currencyPosition === 'prefix') {\n formatted = `${this.options.currency} -`;\n cursor = formatted.length;\n } else {\n formatted = `- ${this.options.currency}`;\n cursor = 1;\n }\n }\n return {\n formatted,\n rawNumber: null,\n rawValue: '-',\n cursor,\n isValid: true\n };\n }\n\n if (!integerPart && !effectiveDecimal && !effectiveHasDecimal) {\n return {\n formatted: '',\n rawNumber: null,\n rawValue: '',\n cursor: 0,\n isValid: true\n };\n }\n\n // Formatage avec s\u00E9parateurs de milliers\n const formattedInteger = (integerPart || '0').replace(/\\B(?=(\\d{3})+(?!\\d))/g, this.options.thousandSeparator);\n\n let numberCore = formattedInteger;\n if (effectiveHasDecimal && this.options.decimals > 0) {\n numberCore += this.options.decimalSeparator + (effectiveDecimal ?? '');\n }\n\n if (isNegative && numberCore !== '0') {\n numberCore = '-' + numberCore;\n }\n\n // Assemblage final avec la devise\n let formatted = numberCore;\n if (this.options.currency) {\n if (this.options.currencyPosition === 'prefix') {\n formatted = `${this.options.currency} ${numberCore}`;\n } else {\n formatted = `${numberCore} ${this.options.currency}`;\n }\n }\n\n // Calcul du rawNumber\n const numStr = (isNegative ? '-' : '') + (integerPart || '0') + (decimalPart ? '.' + decimalPart : '');\n let num = parseFloat(numStr);\n if (isNaN(num)) num = 0;\n\n const isValid = num >= this.options.min && num <= this.options.max;\n\n // Repositionnement pr\u00E9cis du curseur dans le texte format\u00E9\n let newCursor = 0;\n if (this.options.currency && this.options.currencyPosition === 'prefix') {\n newCursor = this.options.currency.length + 1; // Sauter le pr\u00E9fixe\n }\n\n let seenDigits = 0;\n let seenDecimal = false;\n let lastValidDigitPosition = newCursor;\n\n for (let i = newCursor; i < formatted.length; i++) {\n const ch = formatted[i];\n if (ch === this.options.currency.trim()[0] && this.options.currencyPosition === 'suffix') {\n // Ne pas d\u00E9passer le d\u00E9but du suffixe devise\n break;\n }\n if (/\\d/.test(ch)) {\n seenDigits++;\n lastValidDigitPosition = i + 1;\n } else if (ch === this.options.decimalSeparator) {\n seenDecimal = true;\n lastValidDigitPosition = i + 1;\n }\n\n if (hadDecimalBeforeCursor) {\n if (seenDecimal && seenDigits >= digitsBeforeCursor) {\n newCursor = i + 1;\n break;\n }\n } else {\n if (seenDigits >= digitsBeforeCursor) {\n newCursor = i + 1;\n break;\n }\n }\n }\n\n // Si l'utilisateur a tap\u00E9 des chiffres au-del\u00E0 de la limite d\u00E9cimale ou si la boucle\n // a rencontr\u00E9 le suffixe avant d'atteindre digitsBeforeCursor, NE PAS renvoyer le curseur \u00E0 0 !\n // Le positionner sur le dernier chiffre/s\u00E9parateur valide.\n if (digitsBeforeCursor > 0 && seenDigits < digitsBeforeCursor && lastValidDigitPosition > newCursor) {\n newCursor = lastValidDigitPosition;\n }\n\n // Ajustement de s\u00E9curit\u00E9 sur les limites du champ\n const minCursor = (this.options.currency && this.options.currencyPosition === 'prefix')\n ? this.options.currency.length + 1\n : 0;\n\n const maxCursor = (this.options.currency && this.options.currencyPosition === 'suffix')\n ? Math.max(0, formatted.length - this.options.currency.length - 1)\n : formatted.length;\n\n newCursor = Math.max(minCursor, Math.min(newCursor, Math.max(minCursor, maxCursor)));\n\n return {\n formatted,\n rawNumber: num,\n rawValue: numStr,\n cursor: newCursor,\n isValid\n };\n }\n\n /**\n * Formate statiquement un nombre ou une cha\u00EEne num\u00E9rique.\n */\n public static format(value: number | string, options: AmountEngineOptions = {}): string {\n const engine = new AmountEngine(options);\n const str = typeof value === 'number' ? value.toString() : value;\n return engine.format(str).formatted;\n }\n\n private escapeRegExp(string: string): string {\n return string.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&');\n }\n}\n", "import { AmountEngine, AmountEngineOptions, AmountFormatResult } from './AmountEngine';\nimport { MaskHistory } from './MaskHistory';\nimport { BaseInputMask, resolveMaskConstructorArgs } from './BaseInputMask';\nimport { BaseMaskOptions, IInputMask } from './types';\n\nexport interface AmountMaskDetail {\n /** Valeur format\u00E9e affich\u00E9e (ex: \"1 250,50 \u20AC\") */\n value: string;\n /** Nombre extrait sous forme de float (ex: 1250.5) ou null si vide */\n number: number | null;\n /** Cha\u00EEne num\u00E9rique pure (ex: \"1250.50\") */\n rawValue: string;\n /** Indique si le montant est dans les bornes autoris\u00E9es min/max */\n isValid: boolean;\n}\n\nexport interface AmountMaskOptions extends AmountEngineOptions, BaseMaskOptions {\n /** Alignement textuel du champ mon\u00E9taire (d\u00E9faut: 'right' pour \u00E9liminer la gigue visuelle des chiffres) */\n align?: 'left' | 'right' | 'center';\n /** Compl\u00E8te automatiquement les d\u00E9cimales au blur avec des z\u00E9ros si non saisies (ex: \"12 \u20AC\" -> \"12,00 \u20AC\") (d\u00E9faut: false) */\n padDecimalsOnBlur?: boolean;\n /** Callback d\u00E9clench\u00E9 \u00E0 chaque saisie ou modification */\n onInput?: (detail: AmountMaskDetail) => void;\n /** Callback d\u00E9clench\u00E9 lors du commit (change) */\n onChange?: (detail: AmountMaskDetail) => void;\n}\n\n/**\n * Contr\u00F4leur DOM InputAmountMask.\n * Extension autonome d\u00E9di\u00E9e aux montants, devises et quantit\u00E9s \u00E9lastiques.\n * Respecte \u00E0 100% l'axiome du confort absolu de frappe de l'utilisateur.\n */\nexport class InputAmountMask extends BaseInputMask<AmountMaskOptions> implements IInputMask<AmountMaskOptions> {\n public engine: AmountEngine;\n public history: MaskHistory;\n\n private isUndoingRedoing: boolean = false;\n private isApplying: boolean = false;\n private isComposing: boolean = false;\n private lastValue: string = '';\n private cutTimerId: number | null = null;\n private resetTimerId: number | null = null;\n\n constructor(input: HTMLInputElement, options?: AmountMaskOptions);\n constructor(wrapper: HTMLElement | null, input: HTMLInputElement, options?: AmountMaskOptions);\n constructor(\n targetOrWrapper: HTMLElement | HTMLInputElement | null | undefined,\n inputOrOptions?: HTMLInputElement | AmountMaskOptions,\n options?: AmountMaskOptions\n );\n constructor(\n targetOrWrapper: HTMLElement | HTMLInputElement | null | undefined,\n inputOrOptions?: HTMLInputElement | AmountMaskOptions,\n options?: AmountMaskOptions\n ) {\n const args = resolveMaskConstructorArgs<AmountMaskOptions>(targetOrWrapper, inputOrOptions, options);\n const wrap = args.wrapper;\n const inp = args.input;\n const opts = args.options;\n\n const dataPad = wrap?.getAttribute('data-mask-pad-decimals') === 'true' || inp?.getAttribute('data-mask-pad-decimals') === 'true';\n const dataAlign = inp?.getAttribute('data-mask-align') || inp?.getAttribute('data-align') || wrap?.getAttribute('data-mask-align') || wrap?.getAttribute('data-align');\n const resolvedOptions: AmountMaskOptions = {\n align: opts.align ?? (dataAlign as 'left' | 'right' | 'center') ?? 'right',\n padDecimalsOnBlur: opts.padDecimalsOnBlur ?? dataPad ?? false,\n ...opts\n };\n\n super(wrap, inp, resolvedOptions);\n\n // Clavier mobile adapt\u00E9 pour la saisie d\u00E9cimale fluide\n this.input.inputMode = 'decimal';\n\n this.history = new MaskHistory();\n this.engine = new AmountEngine(this.options);\n\n this.bindEvents();\n\n // Initialiser la valeur de d\u00E9part\n if (this.input.value) {\n if (!this.options.disabled) {\n this.applyAmount(this.input.value, this.input.value.length);\n }\n } else {\n this.updateGhost({\n formatted: '',\n rawNumber: null,\n rawValue: '',\n cursor: 0,\n isValid: true\n });\n }\n\n this.runAuditWarning(this.options.audit);\n }\n\n protected override extractRawSnippet(snippet: string): string {\n const p = this.engine.parse(snippet);\n if (!p.integerPart && !p.decimalPart) return '';\n return (p.isNegative ? '-' : '') + (p.integerPart || '0') + (p.decimalPart ? '.' + p.decimalPart : '');\n }\n\n /**\n * Formate statiquement une valeur sans n\u00E9cessiter d'\u00E9l\u00E9ment DOM.\n */\n public static format(value: number | string, options: AmountEngineOptions = {}): string {\n return AmountEngine.format(value, options);\n }\n\n protected onNativeValueSet(strVal: string): void {\n if (this.options.disabled || this.isComposing) {\n this.lastValue = strVal;\n return;\n }\n this.applyAmount(strVal, strVal.length);\n }\n\n protected onDisabledChange(disabled: boolean): void {\n if (!disabled) {\n this.applyAmount(this.input.value, this.input.selectionStart ?? this.input.value.length);\n }\n }\n\n private bindEvents(): void {\n this.handleInput = this.handleInput.bind(this);\n this.handleKeyDown = this.handleKeyDown.bind(this);\n this.handleBlur = this.handleBlur.bind(this);\n this.handleFocus = this.handleFocus.bind(this);\n this.handleClick = this.handleClick.bind(this);\n this.onCompositionStart = this.onCompositionStart.bind(this);\n this.onCompositionEnd = this.onCompositionEnd.bind(this);\n\n this.onCutHandler = () => {\n if (this.cutTimerId !== null) {\n clearTimeout(this.cutTimerId);\n }\n this.cutTimerId = window.setTimeout(() => {\n this.cutTimerId = null;\n if (this.isDestroyed || this.options.disabled) return;\n const cur = this.input.selectionStart ?? this.input.value.length;\n this.applyAmount(this.input.value, cur);\n }, 0);\n };\n\n this.input.addEventListener('input', this.handleInput);\n this.input.addEventListener('keydown', this.handleKeyDown);\n this.input.addEventListener('blur', this.handleBlur);\n this.input.addEventListener('focus', this.handleFocus);\n this.input.addEventListener('click', this.handleClick);\n this.input.addEventListener('scroll', this.onScroll);\n this.input.addEventListener('cut', this.onCutHandler);\n this.input.addEventListener('compositionstart', this.onCompositionStart);\n this.input.addEventListener('compositionend', this.onCompositionEnd);\n\n if (this.input.form) {\n this.onFormResetHandler = () => {\n if (this.resetTimerId !== null) {\n clearTimeout(this.resetTimerId);\n }\n this.resetTimerId = window.setTimeout(() => {\n this.resetTimerId = null;\n if (this.isDestroyed) return;\n if (this.options.disabled) return;\n this.applyAmount(this.input.value, this.input.value.length);\n }, 0);\n };\n this.input.form.addEventListener('reset', this.onFormResetHandler);\n }\n }\n\n private onCompositionStart(): void {\n this.isComposing = true;\n }\n\n private onCompositionEnd(): void {\n this.isComposing = false;\n if (this.options.disabled) return;\n const cur = this.input.selectionStart ?? this.input.value.length;\n this.applyAmount(this.input.value, cur);\n }\n\n private applyAmount(val: string, cursor: number): void {\n if (this.isApplying || this.options.disabled) return;\n this.isApplying = true;\n\n try {\n const result: AmountFormatResult = this.engine.format(val, cursor);\n this.setNativeValue(result.formatted);\n this.input.setSelectionRange(result.cursor, result.cursor);\n\n if (!this.isUndoingRedoing && this.input.type !== 'password') {\n this.history.push(result.rawValue, result.cursor);\n }\n\n this.updateGhost(result);\n\n if (this.lastValue !== result.formatted) {\n this.lastValue = result.formatted;\n this.notifyChange(result);\n }\n } finally {\n this.isApplying = false;\n }\n }\n\n private updateGhost(result: AmountFormatResult): void {\n if (!this.ghost) return;\n\n if (!result.formatted) {\n if (this.shouldHideGhostForPlaceholder(true)) {\n this.ghost.textContent = '';\n return;\n }\n // Afficher un indice ou symbole en filigrane si vide\n const hint = this.options.currency\n ? (this.options.currencyPosition === 'prefix' ? `${this.options.currency} 0` : `0 ${this.options.currency}`)\n : '0,00';\n this.ghost.textContent = '';\n const span = document.createElement('span');\n span.className = 'mask-ghost-remaining';\n span.textContent = hint;\n this.ghost.appendChild(span);\n return;\n }\n\n this.ghost.textContent = '';\n this.ghost.scrollLeft = this.input.scrollLeft;\n }\n\n private handleInput(): void {\n if (this.isDispatchingNativeInput) return;\n if (this.options.disabled || this.isComposing) return;\n const rawVal = this.input.value;\n const cur = this.input.selectionStart ?? rawVal.length;\n this.applyAmount(rawVal, cur);\n }\n\n private handleKeyDown(e: KeyboardEvent): void {\n if (this.options.disabled) return;\n\n // Gestion Undo / Redo (Ctrl+Z / Ctrl+Y)\n if ((e.ctrlKey || e.metaKey) && (e.key === 'z' || e.key === 'Z')) {\n e.preventDefault();\n if (e.shiftKey) this.redo();\n else this.undo();\n return;\n }\n if ((e.ctrlKey || e.metaKey) && (e.key === 'y' || e.key === 'Y')) {\n e.preventDefault();\n this.redo();\n return;\n }\n\n // Gestion ergonomique de la touche Backspace\n if (e.key === 'Backspace') {\n const start = this.input.selectionStart ?? 0;\n const end = this.input.selectionEnd ?? 0;\n\n if (start === end && start > 0) {\n const val = this.input.value;\n const charToDelete = val[start - 1];\n\n // Si l'utilisateur est sur le s\u00E9parateur de milliers ou un espace,\n // effacer directement le chiffre qui le pr\u00E9c\u00E8de sans le bloquer\n if (charToDelete === this.engine.options.thousandSeparator || charToDelete === ' ') {\n e.preventDefault();\n const targetIndex = Math.max(0, start - 2);\n const newVal = val.slice(0, targetIndex) + val.slice(start);\n this.applyAmount(newVal, targetIndex);\n return;\n }\n\n // Si on tente d'effacer le pr\u00E9fixe devise, emp\u00EAcher\n if (this.options.currency && this.options.currencyPosition === 'prefix' && start <= this.options.currency.length + 1) {\n e.preventDefault();\n return;\n }\n }\n }\n\n // Gestion ergonomique de la touche Delete (Suppr)\n if (e.key === 'Delete') {\n const start = this.input.selectionStart ?? 0;\n const end = this.input.selectionEnd ?? 0;\n\n if (start === end && start < this.input.value.length) {\n const val = this.input.value;\n const charAhead = val[start];\n\n // Si le caract\u00E8re devant le curseur est un s\u00E9parateur de milliers ou un espace,\n // effacer le chiffre suivant directement pour \u00E9viter l'effet \"touche bloqu\u00E9e\"\n if (charAhead === this.engine.options.thousandSeparator || charAhead === ' ') {\n e.preventDefault();\n const newVal = val.slice(0, start) + val.slice(start + 2);\n this.applyAmount(newVal, start);\n return;\n }\n\n // Si le curseur est au d\u00E9but du suffixe devise, emp\u00EAcher\n if (this.options.currency && this.options.currencyPosition === 'suffix') {\n const suffixStart = val.length - this.options.currency.length - 1;\n if (start >= suffixStart) {\n e.preventDefault();\n return;\n }\n }\n }\n }\n\n // Protection curseur au clic ou touches de direction\n setTimeout(() => this.enforceCursorBounds(), 0);\n }\n\n private enforceCursorBounds(): void {\n if (!this.input.value || this.options.disabled) return;\n const start = this.input.selectionStart ?? 0;\n const end = this.input.selectionEnd ?? 0;\n if (start !== end) return; // Laisser les s\u00E9lections libres\n\n const val = this.input.value;\n const currency = this.options.currency;\n\n if (currency) {\n if (this.options.currencyPosition === 'prefix') {\n const minPos = currency.length + 1;\n if (start < minPos) {\n this.input.setSelectionRange(minPos, minPos);\n }\n } else if (this.options.currencyPosition === 'suffix') {\n const maxPos = Math.max(0, val.length - currency.length - 1);\n if (start > maxPos) {\n this.input.setSelectionRange(maxPos, maxPos);\n }\n }\n }\n }\n\n private handleClick(): void {\n this.enforceCursorBounds();\n }\n\n private handleFocus(): void {\n this.wrapper.classList.add('is-focused');\n this.syncGhostStyles();\n this.enforceCursorBounds();\n this.updateGhost(this.engine.format(this.input.value));\n }\n\n private handleBlur(): void {\n this.wrapper.classList.remove('is-focused');\n if (this.input.type === 'password') {\n this.history.clear();\n }\n\n if (this.options.padDecimalsOnBlur && !this.options.disabled && this.input.value.trim().length > 0) {\n const paddedResult = this.engine.format(this.input.value, this.input.value.length, true);\n if (paddedResult.formatted !== this.input.value) {\n this.setNativeValue(paddedResult.formatted);\n this.lastValue = paddedResult.formatted;\n }\n }\n\n this.updateGhost(this.engine.format(this.input.value));\n\n const detail = this.getDetail();\n if (this.options.onChange) {\n this.options.onChange(detail);\n }\n this.input.dispatchEvent(new CustomEvent('mask:change', { bubbles: true, detail }));\n }\n\n protected override handleAttributeMutation(attrName: string): void {\n super.handleAttributeMutation(attrName);\n if (attrName === 'data-mask-pad-decimals') {\n this.options.padDecimalsOnBlur = this.getAttr('data-mask-pad-decimals') === 'true';\n } else if (attrName === 'placeholder') {\n this.updateGhost(this.engine.format(this.input.value));\n }\n }\n\n private notifyChange(result: AmountFormatResult): void {\n const detail: AmountMaskDetail = {\n value: result.formatted,\n number: result.rawNumber,\n rawValue: result.rawValue,\n isValid: result.isValid\n };\n\n if (this.options.onInput) {\n this.options.onInput(detail);\n }\n\n this.input.dispatchEvent(new CustomEvent('mask:input', { bubbles: true, detail }));\n this.dispatchNativeInput();\n }\n\n public undo(): void {\n const state = this.history.undo();\n if (state) {\n this.isUndoingRedoing = true;\n try {\n this.applyAmount(state.raw, state.cursor);\n } finally {\n this.isUndoingRedoing = false;\n }\n }\n }\n\n public redo(): void {\n const state = this.history.redo();\n if (state) {\n this.isUndoingRedoing = true;\n try {\n this.applyAmount(state.raw, state.cursor);\n } finally {\n this.isUndoingRedoing = false;\n }\n }\n }\n\n public getDetail(): AmountMaskDetail {\n const parsed = this.engine.format(this.input.value);\n return {\n value: parsed.formatted,\n number: parsed.rawNumber,\n rawValue: parsed.rawValue,\n isValid: parsed.isValid\n };\n }\n\n public getNumber(): number | null {\n return this.getDetail().number;\n }\n\n public override getRawValue(): string {\n return this.getDetail().rawValue;\n }\n\n public isValid(): boolean {\n return this.getDetail().isValid;\n }\n\n public override setValue(val: number | string): void {\n const str = val !== null && val !== undefined ? String(val) : '';\n if (this.options.disabled) {\n this.setNativeValue(str);\n this.lastValue = str;\n } else {\n this.applyAmount(str, str.length);\n }\n }\n\n public override destroy(): void {\n if (this.isDestroyed) return;\n\n if (this.cutTimerId !== null) {\n clearTimeout(this.cutTimerId);\n this.cutTimerId = null;\n }\n if (this.resetTimerId !== null) {\n clearTimeout(this.resetTimerId);\n this.resetTimerId = null;\n }\n\n this.input.removeEventListener('input', this.handleInput);\n this.input.removeEventListener('keydown', this.handleKeyDown);\n this.input.removeEventListener('blur', this.handleBlur);\n this.input.removeEventListener('focus', this.handleFocus);\n this.input.removeEventListener('click', this.handleClick);\n this.input.removeEventListener('scroll', this.onScroll);\n this.input.removeEventListener('cut', this.onCutHandler);\n this.input.removeEventListener('compositionstart', this.onCompositionStart);\n this.input.removeEventListener('compositionend', this.onCompositionEnd);\n\n if (this.input.form && this.onFormResetHandler) {\n this.input.form.removeEventListener('reset', this.onFormResetHandler);\n }\n\n this.history.clear();\n super.destroy();\n }\n}\n", "export interface EmailEngineOptions {\n /** Liste de noms de domaines propos\u00E9s par ordre de priorit\u00E9 */\n domains?: string[];\n /** Sugg\u00E8re le premier domaine par d\u00E9faut d\u00E8s la saisie du caract\u00E8re '@' (d\u00E9faut: true) */\n suggestOnAt?: boolean;\n /** Domaine par d\u00E9faut sugg\u00E9r\u00E9 avant m\u00EAme la saisie du '@' (ex: 'gmail.com', ou true pour le 1er domaine). D\u00E9faut: null */\n defaultDomain?: string | boolean | null;\n /** Liste des extensions de domaine (TLD) connues propos\u00E9es par ordre de priorit\u00E9 lorsqu'un domaine personnalis\u00E9 est saisi */\n tlds?: string[];\n /** Extension (TLD) ou gabarit par d\u00E9faut sugg\u00E9r\u00E9 pour un domaine inconnu (ex: 'fr', 'com', '__', ou true pour le 1er TLD, ou null/false pour d\u00E9sactiver). D\u00E9faut: '__' */\n defaultTld?: string | boolean | null;\n}\n\nexport interface EmailSuggestionResult {\n /** Texte complet comprenant la saisie et la compl\u00E9tion sugg\u00E9r\u00E9e */\n full: string;\n /** Partie restante sugg\u00E9r\u00E9e affich\u00E9e dans le conteneur fant\u00F4me */\n remaining: string;\n /** Nom de domaine complet correspondant (ou null si aucune correspondance) */\n matchedDomain: string | null;\n /** Indique si le texte fant\u00F4me est uniquement un indice visuel de structure (ex: '.__') non compl\u00E9table via Tab/Entr\u00E9e */\n isHintOnly?: boolean;\n}\n\n/**\n * Moteur algorithmique pur pour la pr\u00E9diction et l'assistance de saisie d'emails.\n * D\u00E9coupl\u00E9 du DOM, respecte \u00E0 100% la libert\u00E9 de saisie sans contrainte bloquante.\n */\nexport class EmailEngine {\n public domains: string[];\n public tlds: string[];\n public suggestOnAt: boolean;\n public defaultDomain: string | null = null;\n public defaultTld: string | null = '__';\n\n public static readonly DEFAULT_DOMAINS = [\n 'gmail.com',\n 'outlook.com',\n 'orange.fr',\n 'free.fr',\n 'sfr.fr',\n 'yahoo.com',\n 'hotmail.com',\n 'icloud.com',\n 'laposte.net',\n 'proton.me'\n ];\n\n public static readonly DEFAULT_TLDS = [\n 'com',\n 'fr',\n 'net',\n 'org',\n 'eu',\n 'io',\n 'co',\n 'info',\n 'biz',\n 'me',\n 'tv',\n 'fi',\n 'be',\n 'ch',\n 'ca',\n 'uk',\n 'de',\n 'es',\n 'it'\n ];\n\n constructor(options: EmailEngineOptions = {}) {\n this.domains = options.domains && options.domains.length > 0\n ? options.domains\n : EmailEngine.DEFAULT_DOMAINS;\n this.tlds = options.tlds && options.tlds.length > 0\n ? options.tlds.map(t => t.trim().replace(/^\\./, '')).filter(Boolean)\n : [...EmailEngine.DEFAULT_TLDS];\n this.suggestOnAt = options.suggestOnAt ?? true;\n this.setDefaultDomain(options.defaultDomain ?? null);\n this.setDefaultTld(options.defaultTld !== undefined ? options.defaultTld : '__');\n }\n\n /**\n * D\u00E9finit ou modifie le domaine sugg\u00E9r\u00E9 par d\u00E9faut.\n */\n public setDefaultDomain(domain: string | boolean | null): void {\n if (domain === true) {\n this.defaultDomain = this.domains.length > 0 ? this.domains[0] : null;\n } else if (typeof domain === 'string' && domain.trim().length > 0) {\n this.defaultDomain = domain.trim().replace(/^@/, '');\n } else {\n this.defaultDomain = null;\n }\n }\n\n /**\n * D\u00E9finit ou modifie l'extension (TLD) ou gabarit sugg\u00E9r\u00E9 par d\u00E9faut sur un domaine inconnu.\n */\n public setDefaultTld(tld: string | boolean | null): void {\n if (tld === true) {\n this.defaultTld = this.tlds.length > 0 ? this.tlds[0] : null;\n } else if (typeof tld === 'string' && tld.trim().length > 0) {\n this.defaultTld = tld.trim().replace(/^\\./, '');\n } else {\n this.defaultTld = null;\n }\n }\n\n /**\n * D\u00E9finit ou modifie la liste des extensions (TLD) propos\u00E9es par ordre de priorit\u00E9.\n */\n public setTlds(tlds: string[] | null): void {\n this.tlds = tlds && tlds.length > 0\n ? tlds.map(t => t.trim().replace(/^\\./, '')).filter(Boolean)\n : [...EmailEngine.DEFAULT_TLDS];\n }\n\n /**\n * Retourne l'ensemble des extensions (TLD) correspondant au fragment saisi apr\u00E8s le dernier point,\n * dans l'ordre exact fourni par l'utilisateur.\n */\n public getMatchingTlds(tldInput: string): string[] {\n const query = (tldInput ?? '').toLowerCase();\n if (query.length === 0) {\n return [...this.tlds];\n }\n return this.tlds.filter(t => t.toLowerCase().startsWith(query) && t.toLowerCase() !== query);\n }\n\n /**\n * Retourne l'ensemble des domaines correspondant \u00E0 la saisie courante.\n */\n public getMatchingDomains(input: string): string[] {\n const val = input ?? '';\n if (!val.includes('@')) {\n return this.defaultDomain ? [this.defaultDomain] : [];\n }\n\n const atIndex = val.indexOf('@');\n if (val.indexOf('@', atIndex + 1) !== -1) {\n return [];\n }\n\n const domainPart = val.substring(atIndex + 1);\n if (domainPart.length === 0) {\n return this.suggestOnAt ? [...this.domains] : [];\n }\n\n const query = domainPart.toLowerCase();\n return this.domains.filter(d => d.toLowerCase().startsWith(query) && d.toLowerCase() !== query);\n }\n\n /**\n * Analyse la saisie courante et calcule la suggestion de domaine ou d'extension (TLD) adapt\u00E9e.\n *\n * @param input Saisie utilisateur\n * @param matchIndex Index de la suggestion \u00E0 s\u00E9lectionner si plusieurs domaines/TLD correspondent (permet le cyclage)\n */\n public getSuggestion(input: string, matchIndex: number = 0): EmailSuggestionResult {\n const val = input ?? '';\n\n if (!val.includes('@')) {\n if (this.defaultDomain) {\n return {\n full: val ? `${val}@${this.defaultDomain}` : `@${this.defaultDomain}`,\n remaining: `@${this.defaultDomain}`,\n matchedDomain: this.defaultDomain,\n isHintOnly: false\n };\n }\n return { full: val, remaining: '', matchedDomain: null, isHintOnly: false };\n }\n\n const atIndex = val.indexOf('@');\n const localPart = val.substring(0, atIndex);\n const domainPart = val.substring(atIndex + 1);\n\n // Si plusieurs '@', pas de suggestion pour ne pas perturber la correction\n if (val.indexOf('@', atIndex + 1) !== -1) {\n return { full: val, remaining: '', matchedDomain: null, isHintOnly: false };\n }\n\n const matches = this.getMatchingDomains(input);\n if (matches.length > 0) {\n const safeIndex = ((matchIndex % matches.length) + matches.length) % matches.length;\n const matched = matches[safeIndex];\n\n const query = domainPart.toLowerCase();\n const remaining = matched.substring(query.length);\n\n return {\n full: `${localPart}@${matched}`,\n remaining,\n matchedDomain: matched,\n isHintOnly: false\n };\n }\n\n // Si aucun domaine complet ne correspond (ou qu'il a d\u00E9j\u00E0 \u00E9t\u00E9 enti\u00E8rement tap\u00E9)\n if (domainPart.length === 0 || domainPart.startsWith('.')) {\n return { full: input, remaining: '', matchedDomain: null, isHintOnly: false };\n }\n\n const lowerDomain = domainPart.toLowerCase();\n // Si le domaine saisi correspond exactement \u00E0 un domaine connu complet (ex: 'gmail.com'), aucune suggestion suppl\u00E9mentaire\n if (this.domains.some(d => d.toLowerCase() === lowerDomain)) {\n return { full: input, remaining: '', matchedDomain: domainPart, isHintOnly: false };\n }\n\n const lastDotIndex = domainPart.lastIndexOf('.');\n\n // Cas 1 : Le nom de domaine personnalis\u00E9 ne contient pas encore de point (ex: 'maxime.porte@poul')\n if (lastDotIndex === -1) {\n if (!this.defaultTld) {\n return { full: input, remaining: '', matchedDomain: null, isHintOnly: false };\n }\n const isHint = this.defaultTld.includes('_');\n const remaining = `.${this.defaultTld}`;\n const fullDomain = `${domainPart}.${this.defaultTld}`;\n return {\n full: isHint ? input : `${localPart}@${fullDomain}`,\n remaining,\n matchedDomain: isHint ? null : fullDomain,\n isHintOnly: isHint\n };\n }\n\n // Cas 2 : Un point a \u00E9t\u00E9 saisi dans le domaine personnalis\u00E9 (ex: 'maxime.porte@poul.' ou 'maxime.porte@poul.f')\n const hostPart = domainPart.substring(0, lastDotIndex);\n const tldPart = domainPart.substring(lastDotIndex + 1);\n\n if (!hostPart || hostPart.endsWith('.')) {\n return { full: input, remaining: '', matchedDomain: null, isHintOnly: false };\n }\n\n // Sous-cas 2a : Juste apr\u00E8s le point ('maxime.porte@poul.')\n if (tldPart.length === 0) {\n if (this.defaultTld && !this.defaultTld.includes('_')) {\n const fullDomain = `${hostPart}.${this.defaultTld}`;\n return {\n full: `${localPart}@${fullDomain}`,\n remaining: this.defaultTld,\n matchedDomain: fullDomain,\n isHintOnly: false\n };\n }\n if (this.defaultTld && this.defaultTld.includes('_')) {\n return {\n full: input,\n remaining: this.defaultTld,\n matchedDomain: null,\n isHintOnly: true\n };\n }\n return { full: input, remaining: '', matchedDomain: null, isHintOnly: false };\n }\n\n // Sous-cas 2b : Des lettres d'extension sont saisies apr\u00E8s le point ('maxime.porte@poul.f')\n const lowerTld = tldPart.toLowerCase();\n // Si l'extension tap\u00E9e correspond d\u00E9j\u00E0 exactement \u00E0 un TLD connu ET qu'aucun autre TLD plus long ne commence pareil,\n // ou si on cherche les TLD commen\u00E7ant par tldPart dans l'ordre d\u00E9fini par l'utilisateur :\n const matchingTlds = this.getMatchingTlds(tldPart);\n if (matchingTlds.length > 0) {\n // Si l'utilisateur a d\u00E9j\u00E0 tap\u00E9 un TLD valide complet (ex: '.co') mais qu'il existe '.com', on propose 'm'\n const safeTldIndex = ((matchIndex % matchingTlds.length) + matchingTlds.length) % matchingTlds.length;\n const matchedTld = matchingTlds[safeTldIndex];\n const remaining = matchedTld.substring(lowerTld.length);\n const fullDomain = `${hostPart}.${matchedTld}`;\n\n return {\n full: `${localPart}@${fullDomain}`,\n remaining,\n matchedDomain: fullDomain,\n isHintOnly: false\n };\n }\n\n // Sous-cas 2c : Aucun TLD connu ne correspond, mais l'extension fait moins de 2 caract\u00E8res (ex: '@poul.x')\n // Si defaultTld est un gabarit (ex: '__'), on affiche le caract\u00E8re '_' restant en indice visuel\n if (this.defaultTld && this.defaultTld.includes('_') && tldPart.length < this.defaultTld.length) {\n const remaining = this.defaultTld.substring(tldPart.length);\n if (remaining.includes('_')) {\n return {\n full: input,\n remaining,\n matchedDomain: null,\n isHintOnly: true\n };\n }\n }\n\n return { full: input, remaining: '', matchedDomain: null, isHintOnly: false };\n }\n }\n", "import { EmailEngine, EmailEngineOptions, EmailSuggestionResult } from './EmailEngine';\nimport { BaseInputMask, resolveMaskConstructorArgs } from './BaseInputMask';\nimport { BaseMaskOptions, IInputMask } from './types';\n\nexport interface EmailMaskDetail {\n /** Valeur actuelle dans l'input */\n value: string;\n /** Suggestion compl\u00E8te disponible (ou cha\u00EEne vide si aucune) */\n suggestedValue: string;\n /** Domaine compl\u00E9t\u00E9 (ou null si aucun) */\n domain: string | null;\n}\n\nexport interface EmailMaskOptions extends EmailEngineOptions, BaseMaskOptions {\n /** Permet la validation/acceptation de la suggestion par la touche Tab (d\u00E9faut: true) */\n completeOnTab?: boolean;\n /** Permet la validation/acceptation de la suggestion par la fl\u00E8che droite en bout de champ (d\u00E9faut: true) */\n completeOnArrowRight?: boolean;\n /** Permet la validation/acceptation de la suggestion par la touche Entr\u00E9e (d\u00E9faut: true) */\n completeOnEnter?: boolean;\n /** Permet de cycler dans les suggestions de domaines avec les fl\u00E8ches Haut/Bas (d\u00E9faut: false) */\n cycleSuggestions?: boolean;\n /** Force la conversion en minuscules de l'adresse email tap\u00E9e (d\u00E9faut: false) */\n autoLowercase?: boolean;\n /** Applique l'attribut standard ARIA aria-autocomplete=\"inline\" sur l'input natif pour les technologies d'assistance (d\u00E9faut: true) */\n setAriaAutocomplete?: boolean;\n /** Callback d\u00E9clench\u00E9 \u00E0 chaque modification */\n onInput?: (detail: EmailMaskDetail) => void;\n /** Callback d\u00E9clench\u00E9 lors de la validation ou du blur */\n onChange?: (detail: EmailMaskDetail) => void;\n}\n\n/**\n * Contr\u00F4leur DOM InputEmailMask.\n * Extension d'assistance pr\u00E9dictive par ghosting sans jamais contraindre ni bloquer la frappe.\n * Le confort et la fluidit\u00E9 de l'utilisateur sont pr\u00E9serv\u00E9s \u00E0 100%.\n */\nexport class InputEmailMask extends BaseInputMask<EmailMaskOptions> implements IInputMask<EmailMaskOptions> {\n public engine: EmailEngine;\n private currentSuggestion: EmailSuggestionResult = { full: '', remaining: '', matchedDomain: null };\n private currentSuggestionIndex: number = 0;\n private wasAriaAutocompleteSet: boolean = false;\n private cutTimerId: number | null = null;\n private resetTimerId: number | null = null;\n\n constructor(input: HTMLInputElement, options?: EmailMaskOptions);\n constructor(wrapper: HTMLElement | null, input: HTMLInputElement, options?: EmailMaskOptions);\n constructor(\n targetOrWrapper: HTMLElement | HTMLInputElement | null | undefined,\n inputOrOptions?: HTMLInputElement | EmailMaskOptions,\n options?: EmailMaskOptions\n );\n constructor(\n targetOrWrapper: HTMLElement | HTMLInputElement | null | undefined,\n inputOrOptions?: HTMLInputElement | EmailMaskOptions,\n options?: EmailMaskOptions\n ) {\n const args = resolveMaskConstructorArgs<EmailMaskOptions>(targetOrWrapper, inputOrOptions, options);\n const wrap = args.wrapper;\n const inp = args.input;\n const opts = args.options;\n\n const dataCycle = wrap?.getAttribute('data-mask-cycle-suggestions') === 'true' || inp?.getAttribute('data-mask-cycle-suggestions') === 'true';\n const dataAutoLower = wrap?.getAttribute('data-mask-auto-lowercase') === 'true' || inp?.getAttribute('data-mask-auto-lowercase') === 'true';\n const dataAriaAuto = wrap?.getAttribute('data-mask-aria-autocomplete') ?? inp?.getAttribute('data-mask-aria-autocomplete');\n const setAriaAutocomplete = opts.setAriaAutocomplete ?? (dataAriaAuto !== null ? dataAriaAuto !== 'false' : true);\n\n const dataTlds = wrap?.getAttribute('data-mask-tlds') ?? inp?.getAttribute('data-mask-tlds');\n const parsedTlds = opts.tlds ?? (dataTlds ? dataTlds.split(',').map(s => s.trim()).filter(Boolean) : undefined);\n\n const dataDefaultTld = wrap?.getAttribute('data-mask-default-tld') ?? inp?.getAttribute('data-mask-default-tld');\n const resolvedDefaultTld = opts.defaultTld !== undefined\n ? opts.defaultTld\n : (dataDefaultTld !== null ? (dataDefaultTld === 'false' || dataDefaultTld === 'none' ? null : (dataDefaultTld === 'true' ? true : dataDefaultTld)) : undefined);\n\n const resolvedOptions: EmailMaskOptions = {\n completeOnTab: true,\n completeOnArrowRight: true,\n completeOnEnter: true,\n cycleSuggestions: opts.cycleSuggestions ?? dataCycle ?? false,\n autoLowercase: opts.autoLowercase ?? dataAutoLower ?? false,\n setAriaAutocomplete,\n ...opts,\n ...(parsedTlds !== undefined ? { tlds: parsedTlds } : {}),\n ...(resolvedDefaultTld !== undefined ? { defaultTld: resolvedDefaultTld } : {})\n };\n\n super(wrap, inp, resolvedOptions);\n\n this.input.inputMode = 'email';\n\n // Accessibilit\u00E9 WAI-ARIA : annonce d'autocompl\u00E9tion en ligne pour technologies d'assistance\n if (this.options.setAriaAutocomplete && !this.input.hasAttribute('aria-autocomplete')) {\n this.input.setAttribute('aria-autocomplete', 'inline');\n this.wasAriaAutocompleteSet = true;\n }\n\n this.engine = new EmailEngine(this.options);\n\n this.bindEvents();\n\n if (!this.options.disabled) {\n this.updateSuggestion();\n }\n\n this.runAuditWarning(this.options.audit);\n }\n\n protected onNativeValueSet(_strVal: string): void {\n if (this.options.disabled) return;\n this.updateSuggestion();\n }\n\n protected onDisabledChange(disabled: boolean): void {\n if (disabled) {\n if (this.ghost) this.ghost.textContent = '';\n } else {\n this.updateSuggestion();\n }\n }\n\n private bindEvents(): void {\n this.handleInput = this.handleInput.bind(this);\n this.handleKeyDown = this.handleKeyDown.bind(this);\n this.handleBlur = this.handleBlur.bind(this);\n this.handleFocus = this.handleFocus.bind(this);\n\n this.onCutHandler = () => {\n if (this.cutTimerId !== null) {\n clearTimeout(this.cutTimerId);\n }\n this.cutTimerId = window.setTimeout(() => {\n this.cutTimerId = null;\n if (this.isDestroyed || this.options.disabled) return;\n this.updateSuggestion();\n }, 0);\n };\n\n this.input.addEventListener('input', this.handleInput);\n this.input.addEventListener('keydown', this.handleKeyDown);\n this.input.addEventListener('blur', this.handleBlur);\n this.input.addEventListener('focus', this.handleFocus);\n this.input.addEventListener('scroll', this.onScroll);\n this.input.addEventListener('cut', this.onCutHandler);\n\n if (this.input.form) {\n this.onFormResetHandler = () => {\n if (this.resetTimerId !== null) {\n clearTimeout(this.resetTimerId);\n }\n this.resetTimerId = window.setTimeout(() => {\n this.resetTimerId = null;\n if (this.isDestroyed || this.options.disabled) return;\n this.updateSuggestion();\n }, 0);\n };\n this.input.form.addEventListener('reset', this.onFormResetHandler);\n }\n }\n\n public updateSuggestion(): void {\n if (this.options.disabled) {\n if (this.ghost) this.ghost.textContent = '';\n return;\n }\n\n const val = this.input.value;\n this.currentSuggestion = this.engine.getSuggestion(val, this.currentSuggestionIndex);\n\n if (!this.ghost) return;\n\n // R\u00E8gle de priorit\u00E9 universelle : si le champ est vide et qu'un placeholder natif est d\u00E9fini,\n // hors focus, le placeholder natif l'emporte et le fant\u00F4me s'efface.\n if (this.shouldHideGhostForPlaceholder(val.length === 0)) {\n this.ghost.textContent = '';\n } else if (this.currentSuggestion.remaining) {\n this.ghost.textContent = '';\n const spanTyped = document.createElement('span');\n spanTyped.className = 'mask-ghost-typed';\n spanTyped.textContent = val;\n\n const spanRemaining = document.createElement('span');\n spanRemaining.className = 'mask-ghost-remaining';\n spanRemaining.textContent = this.currentSuggestion.remaining;\n\n this.ghost.appendChild(spanTyped);\n this.ghost.appendChild(spanRemaining);\n } else {\n this.ghost.textContent = '';\n }\n\n this.ghost.scrollLeft = this.input.scrollLeft;\n\n const detail = this.getDetail();\n if (this.options.onInput) {\n this.options.onInput(detail);\n }\n this.input.dispatchEvent(new CustomEvent('mask:input', { bubbles: true, detail }));\n this.dispatchNativeInput();\n }\n\n private handleInput(): void {\n if (this.isDispatchingNativeInput) return;\n if (this.options.disabled) return;\n\n if (this.options.autoLowercase) {\n const start = this.input.selectionStart ?? 0;\n const end = this.input.selectionEnd ?? start;\n const lower = this.input.value.toLowerCase();\n if (lower !== this.input.value) {\n this.setNativeValue(lower);\n this.input.setSelectionRange(start, end);\n }\n }\n\n this.currentSuggestionIndex = 0;\n this.updateSuggestion();\n }\n\n private handleKeyDown(e: KeyboardEvent): void {\n if (this.options.disabled) return;\n\n const hasSuggestion = Boolean(this.currentSuggestion.remaining) && !this.currentSuggestion.isHintOnly;\n const cursor = this.input.selectionStart ?? 0;\n const isAtEnd = cursor === this.input.value.length;\n const isNotEmpty = this.input.value.length > 0;\n\n // Cyclage des suggestions avec Fl\u00E8che Bas / Fl\u00E8che Haut\n if (this.options.cycleSuggestions && hasSuggestion && isNotEmpty && isAtEnd) {\n if (e.key === 'ArrowDown') {\n e.preventDefault();\n this.currentSuggestionIndex++;\n this.updateSuggestion();\n return;\n }\n if (e.key === 'ArrowUp') {\n e.preventDefault();\n this.currentSuggestionIndex--;\n this.updateSuggestion();\n return;\n }\n }\n\n // Validation par Tab (uniquement si au moins un caract\u00E8re a \u00E9t\u00E9 saisi et que ce n'est pas un simple gabarit visuel '.__')\n if (e.key === 'Tab' && hasSuggestion && isNotEmpty && this.options.completeOnTab) {\n e.preventDefault();\n this.acceptSuggestion();\n return;\n }\n\n // Validation par Entr\u00E9e (uniquement si au moins un caract\u00E8re a \u00E9t\u00E9 saisi et que ce n'est pas un simple gabarit visuel '.__')\n if (e.key === 'Enter' && hasSuggestion && isNotEmpty && this.options.completeOnEnter) {\n e.preventDefault();\n this.acceptSuggestion();\n return;\n }\n\n // Validation par Fl\u00E8che Droite en toute fin de cha\u00EEne (uniquement si au moins un caract\u00E8re a \u00E9t\u00E9 saisi)\n if (e.key === 'ArrowRight' && hasSuggestion && isNotEmpty && isAtEnd && this.options.completeOnArrowRight) {\n e.preventDefault();\n this.acceptSuggestion();\n return;\n }\n }\n\n /**\n * Valide et applique la suggestion courante dans le champ natif.\n */\n public acceptSuggestion(): boolean {\n if (!this.currentSuggestion.remaining || this.currentSuggestion.isHintOnly || this.options.disabled || this.input.value.length === 0) return false;\n\n const completed = this.currentSuggestion.full;\n this.setNativeValue(completed);\n this.input.setSelectionRange(completed.length, completed.length);\n this.currentSuggestionIndex = 0;\n this.updateSuggestion();\n\n const detail = this.getDetail();\n if (this.options.onChange) {\n this.options.onChange(detail);\n }\n this.input.dispatchEvent(new CustomEvent('mask:change', { bubbles: true, detail }));\n this.input.dispatchEvent(new CustomEvent('mask:complete', { bubbles: true, detail }));\n return true;\n }\n\n /**\n * Modifie dynamiquement le domaine sugg\u00E9r\u00E9 par d\u00E9faut.\n */\n public setDefaultDomain(domain: string | boolean | null): void {\n this.engine.setDefaultDomain(domain);\n this.updateSuggestion();\n }\n\n /**\n * Modifie dynamiquement l'extension (TLD) ou gabarit sugg\u00E9r\u00E9 par d\u00E9faut sur un domaine inconnu.\n */\n public setDefaultTld(tld: string | boolean | null): void {\n this.engine.setDefaultTld(tld);\n this.updateSuggestion();\n }\n\n /**\n * Modifie dynamiquement la liste des extensions (TLD) connues.\n */\n public setTlds(tlds: string[] | null): void {\n this.engine.setTlds(tlds);\n this.currentSuggestionIndex = 0;\n this.updateSuggestion();\n }\n\n private handleFocus(): void {\n this.wrapper.classList.add('is-focused');\n this.syncGhostStyles();\n this.updateSuggestion();\n }\n\n private handleBlur(): void {\n this.wrapper.classList.remove('is-focused');\n this.updateSuggestion();\n const detail = this.getDetail();\n if (this.options.onChange) {\n this.options.onChange(detail);\n }\n this.input.dispatchEvent(new CustomEvent('mask:change', { bubbles: true, detail }));\n }\n\n protected override handleAttributeMutation(attrName: string): void {\n super.handleAttributeMutation(attrName);\n if (attrName === 'data-mask-cycle-suggestions') {\n this.options.cycleSuggestions = this.getAttr('data-mask-cycle-suggestions') === 'true';\n } else if (attrName === 'data-mask-auto-lowercase') {\n this.options.autoLowercase = this.getAttr('data-mask-auto-lowercase') === 'true';\n } else if (attrName === 'data-mask-default-tld') {\n const val = this.getAttr('data-mask-default-tld');\n this.setDefaultTld(val === null || val === 'false' || val === 'none' ? null : (val === 'true' ? true : val));\n } else if (attrName === 'data-mask-tlds') {\n const val = this.getAttr('data-mask-tlds');\n this.setTlds(val ? val.split(',').map(s => s.trim()).filter(Boolean) : null);\n } else if (attrName === 'placeholder') {\n this.updateSuggestion();\n }\n }\n\n public getDetail(): EmailMaskDetail {\n return {\n value: this.input.value,\n suggestedValue: this.currentSuggestion.isHintOnly ? '' : this.currentSuggestion.full,\n domain: this.currentSuggestion.matchedDomain\n };\n }\n\n public override setValue(val: string | number): void {\n const str = val !== null && val !== undefined ? String(val) : '';\n this.setNativeValue(str);\n this.updateSuggestion();\n }\n\n public override destroy(): void {\n if (this.isDestroyed) return;\n\n if (this.cutTimerId !== null) {\n clearTimeout(this.cutTimerId);\n this.cutTimerId = null;\n }\n if (this.resetTimerId !== null) {\n clearTimeout(this.resetTimerId);\n this.resetTimerId = null;\n }\n\n this.input.removeEventListener('input', this.handleInput);\n this.input.removeEventListener('keydown', this.handleKeyDown);\n this.input.removeEventListener('blur', this.handleBlur);\n this.input.removeEventListener('focus', this.handleFocus);\n this.input.removeEventListener('scroll', this.onScroll);\n this.input.removeEventListener('cut', this.onCutHandler);\n\n if (this.input.form && this.onFormResetHandler) {\n this.input.form.removeEventListener('reset', this.onFormResetHandler);\n }\n\n if (this.wasAriaAutocompleteSet && this.input.getAttribute('aria-autocomplete') === 'inline') {\n this.input.removeAttribute('aria-autocomplete');\n }\n\n super.destroy();\n }\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACmBO,MAAe,qBAAf,MAAwD;AAAA;AAAA;AAAA;AAAA,IAmBn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,oBAAoB;AAC9C,aAAK,MAAM,KAAK,oBAAoB,SAAS,KAAK,kBAAkB;AAAA,MACtE;AAEA,UAAI,KAAK,0BAA0B,KAAK,MAAM,aAAa,mBAAmB,MAAM,UAAU;AAC5F,aAAK,MAAM,gBAAgB,mBAAmB;AAAA,MAChD;AAEA,YAAM,QAAQ;AAAA,IAChB;AAAA,EACF;;;AVtWO,MAAM,OAAO;AAAA,IAClB;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AAGA,MAAI,OAAO,WAAW,aAAa;AACjC,UAAM,MAAM;AACZ,UAAM,gBAAkB,IAAI,QAAoC,CAAC;AACjE,QAAI,OAAO;AAGX,kBAAc,OAAO;AAAA,EACvB;AAEA,MAAO,gBAAQ;",
3
+ "sources": ["../src/mask/index.ts", "../src/common/dom.ts", "../src/common/AuditableComponent.ts", "../src/mask/BaseInputMask.ts", "../src/mask/MaskEngine.ts", "../src/mask/MaskHistory.ts", "../src/mask/MaskKeyboard.ts", "../src/mask/InputMask.ts", "../src/mask/AmountEngine.ts", "../src/mask/InputAmountMask.ts", "../src/mask/EmailEngine.ts", "../src/mask/InputEmailMask.ts"],
4
+ "sourcesContent": ["import { getSafeWulfNamespace } from '../common/dom';\nimport { BaseInputMask } from './BaseInputMask';\nimport { InputMask } from './InputMask';\nimport { MaskEngine } from './MaskEngine';\nimport { MaskHistory } from './MaskHistory';\nimport { MaskKeyboard } from './MaskKeyboard';\nimport { AmountEngine } from './AmountEngine';\nimport { InputAmountMask } from './InputAmountMask';\nimport { EmailEngine } from './EmailEngine';\nimport { InputEmailMask } from './InputEmailMask';\n\nexport * from './types';\nexport * from './BaseInputMask';\nexport * from './AmountEngine';\nexport * from './InputAmountMask';\nexport * from './EmailEngine';\nexport * from './InputEmailMask';\n\nexport {\n BaseInputMask,\n InputMask,\n MaskEngine,\n MaskHistory,\n MaskKeyboard,\n AmountEngine,\n InputAmountMask,\n EmailEngine,\n InputEmailMask\n};\n\nexport const Mask = {\n BaseInputMask,\n InputMask,\n MaskEngine,\n MaskHistory,\n MaskKeyboard,\n AmountEngine,\n InputAmountMask,\n EmailEngine,\n InputEmailMask\n};\n\n// D\u00E9claration pour inclusion directe en balise <script>\nconst wulfNamespace = getSafeWulfNamespace();\nif (wulfNamespace) {\n // Namespace sp\u00E9cifique et exclusif \u00E0 la librairie Mask : Wulf.Mask\n wulfNamespace.Mask = Mask;\n}\n\nexport default InputMask;\n", "/**\n * Utilitaires DOM & animations l\u00E9gers partag\u00E9s entre les modules Wulf (z\u00E9ro d\u00E9pendance).\n */\n\n/**\n * Retourne de mani\u00E8re s\u00FBre le namespace global window.Wulf en bloquant tout DOM Clobbering.\n */\nexport function getSafeWulfNamespace(): Record<string, unknown> | null {\n if (typeof window === 'undefined') return null;\n const win = window as unknown as Record<string, unknown>;\n const existing = win.Wulf;\n if (\n !existing ||\n typeof existing !== 'object' ||\n (typeof Node !== 'undefined' && existing instanceof Node) ||\n (typeof HTMLCollection !== 'undefined' && existing instanceof HTMLCollection)\n ) {\n const fresh: Record<string, unknown> = {};\n win.Wulf = fresh;\n return fresh;\n }\n return existing as Record<string, unknown>;\n}\n\n/**\n * \u00C9chappe une cha\u00EEne pour son utilisation s\u00FBre dans un s\u00E9lecteur CSS.\n */\nexport function safeCssEscape(value: string): string {\n if (typeof CSS !== 'undefined' && typeof CSS.escape === 'function') {\n return CSS.escape(value);\n }\n return String(value).replace(/[\"\\\\\\u0000-\\u001F\\u007F]/g, '\\\\$&');\n}\n\n/**\n * Retourne l'\u00E9l\u00E9ment ayant r\u00E9ellement le focus, en descendant \u00E0 travers les Shadow Roots ouverts.\n */\nexport function getDeepActiveElement(root?: Document | ShadowRoot | null): HTMLElement | null {\n if (typeof document === 'undefined') return null;\n let active: Element | null = (root ?? document).activeElement;\n while (active && active.shadowRoot && active.shadowRoot.activeElement) {\n active = active.shadowRoot.activeElement;\n }\n return active && typeof (active as HTMLElement).focus === 'function' ? (active as HTMLElement) : null;\n}\n\n/**\n * D\u00E9place un n\u0153ud DOM via moveBefore() si disponible et compatible (m\u00EAme racine connect\u00E9e)\n * afin de pr\u00E9server focus, \u00E9tat d'iframe et animations CSS, avec repli insertBefore().\n */\nexport function safeMove(parent: Element, node: Node, referenceNode: Node | null = null): void {\n const moveBefore = (parent as Element & { moveBefore?: (n: Node, ref: Node | null) => void }).moveBefore;\n if (\n typeof moveBefore === 'function' &&\n node.isConnected &&\n parent.isConnected &&\n typeof parent.getRootNode === 'function' &&\n typeof node.getRootNode === 'function' &&\n parent.getRootNode() === node.getRootNode()\n ) {\n try {\n moveBefore.call(parent, node, referenceNode);\n return;\n } catch {\n // Repli transparent vers insertBefore si l'op\u00E9ration atomique \u00E9choue\n }\n }\n parent.insertBefore(node, referenceNode);\n}\n\n/**\n * D\u00E9tecte une composition IME en cours, en cantonnant le repli Safari WebKit 165004 (keyCode 229)\n * \u00E0 la touche Enter pour ne pas bloquer les claviers virtuels mobiles Android.\n */\nexport function isImeComposing(event: KeyboardEvent): boolean {\n return Boolean(\n event.isComposing ||\n event.key === 'Process' ||\n (event.key === 'Enter' && event.keyCode === 229)\n );\n}\n\n/**\n * Convertit une dur\u00E9e CSS (nombre en ms ou cha\u00EEne \".3s\" / \"300ms\" / \"0.3s, 150ms\") en millisecondes born\u00E9es.\n */\nexport function parseCssDurationMs(\n duration: number | string | undefined,\n fallbackMs: number = 300,\n maxMs: number = 60000\n): number {\n const safeFallback = Number.isFinite(fallbackMs) && fallbackMs >= 0 ? Math.min(fallbackMs, maxMs) : 300;\n if (typeof duration === 'number') {\n return Number.isFinite(duration) && duration >= 0 ? Math.min(duration, maxMs) : safeFallback;\n }\n if (typeof duration === 'string') {\n const parts = duration.split(',');\n let maxParsed = -1;\n for (const part of parts) {\n const match = /^\\+?(\\d+(?:\\.\\d+)?|\\.\\d+)(ms|s)?$/i.exec(part.trim());\n if (match) {\n const raw = parseFloat(match[1]);\n if (Number.isFinite(raw) && raw >= 0) {\n const ms = match[2]?.toLowerCase() === 's' ? raw * 1000 : raw;\n if (ms > maxParsed) {\n maxParsed = ms;\n }\n }\n }\n }\n if (maxParsed >= 0) {\n return Math.min(maxParsed, maxMs);\n }\n }\n return safeFallback;\n}\n\n/**\n * Indique si l'utilisateur pr\u00E9f\u00E8re les animations r\u00E9duites.\n */\nexport function prefersReducedMotion(): boolean {\n return (\n typeof window !== 'undefined' &&\n typeof window.matchMedia === 'function' &&\n window.matchMedia('(prefers-reduced-motion: reduce)').matches\n );\n}\n\n/**\n * Attend la fin des animations/transitions CSS finies en cours sur un \u00E9l\u00E9ment via getAnimations(),\n * avec r\u00E9solution imm\u00E9diate sous prefers-reduced-motion et filet de s\u00E9curit\u00E9 timeout/signal.\n */\nexport function waitForAnimations(\n element: Element,\n fallbackMs: number,\n signal?: AbortSignal\n): Promise<void> {\n const safeFallback = Number.isFinite(fallbackMs) ? Math.min(fallbackMs, 60000) : 300;\n if (signal?.aborted || safeFallback <= 0 || prefersReducedMotion()) {\n return Promise.resolve();\n }\n\n const animations = typeof element.getAnimations === 'function'\n ? element.getAnimations().filter((a) => {\n if (a.playState !== 'running') return false;\n const timing = a.effect?.getComputedTiming?.();\n return timing ? Number.isFinite(timing.endTime as number) : true;\n })\n : [];\n if (animations.length === 0) {\n return Promise.resolve();\n }\n\n return new Promise<void>((resolve) => {\n let settled = false;\n let timerId: ReturnType<typeof setTimeout> | null = null;\n\n const finish = () => {\n if (settled) return;\n settled = true;\n if (timerId !== null) {\n clearTimeout(timerId);\n timerId = null;\n }\n signal?.removeEventListener('abort', finish);\n resolve();\n };\n\n signal?.addEventListener('abort', finish, { once: true });\n timerId = setTimeout(finish, safeFallback);\n Promise.allSettled(animations.map((a) => a.finished)).then(finish);\n });\n}\n", "export interface AuditableOptions {\n /**\n * Ex\u00E9cute un audit d'accessibilit\u00E9 WAI-ARIA \u00E0 l'initialisation (console.warn si contraintes manquantes).\n * @default true\n */\n audit?: boolean;\n}\n\nexport interface IAuditable {\n /**\n * V\u00E9rifie la conformit\u00E9 d'accessibilit\u00E9 WAI-ARIA du composant et retourne la liste des contraintes manquantes.\n */\n audit(): string[];\n}\n\n/**\n * Classe abstraite de base imposant et factorisant le m\u00E9canisme d'audit d'accessibilit\u00E9 WAI-ARIA\n * sur l'ensemble des composants de la suite Wulf.\n */\nexport abstract class AuditableComponent implements IAuditable {\n /**\n * Analyse l'\u00E9tat DOM / options du composant et retourne la liste des contraintes d'accessibilit\u00E9 manquantes.\n */\n public abstract audit(): string[];\n\n /**\n * Identifiant du composant affich\u00E9 dans l'en-t\u00EAte du warning console (ex: \"Wulf.FocusTrap\", \"Wulf.Scroll\").\n */\n protected abstract getAuditPrefix(): string;\n\n /**\n * S\u00E9lecteur ou description de l'\u00E9l\u00E9ment DOM audit\u00E9 (ex: \"#my-modal\", \"<input>\").\n */\n protected abstract getAuditTargetLabel(): string;\n\n /**\n * Indication affich\u00E9e en pied de warning pour expliquer comment d\u00E9sactiver l'audit.\n */\n protected getAuditDisableHint(): string {\n return 'Passez { audit: false } dans les options pour d\u00E9sactiver cet avertissement';\n }\n\n /**\n * Ex\u00E9cute l'audit d'accessibilit\u00E9 et \u00E9met un avertissement standardis\u00E9 dans la console\n * si l'audit est activ\u00E9 et que des contraintes manquent.\n */\n protected runAuditWarning(enabled: boolean = true): string[] {\n if (!enabled) return [];\n\n const warnings = this.audit();\n if (warnings.length > 0 && typeof console !== 'undefined' && typeof console.warn === 'function') {\n console.warn(\n `[${this.getAuditPrefix()}] Audit d'accessibilit\u00E9 \u2014 ${warnings.length} contrainte(s) manquante(s) sur ${this.getAuditTargetLabel()} :\\n` +\n warnings.map((w) => ` - ${w}`).join('\\n') +\n `\\n(${this.getAuditDisableHint()})`\n );\n }\n return warnings;\n }\n\n /**\n * V\u00E9rifie si un attribut de r\u00E9f\u00E9rence d'IDs ARIA (ex: aria-labelledby, aria-describedby)\n * pointe vers des \u00E9l\u00E9ments r\u00E9ellement pr\u00E9sents dans le document.\n */\n protected checkAriaIdReferences(\n element: HTMLElement,\n attrName: 'aria-labelledby' | 'aria-describedby',\n warnings: string[]\n ): boolean {\n const rawValue = element.getAttribute(attrName)?.trim();\n if (!rawValue) return false;\n\n const doc = element.ownerDocument || document;\n const root = typeof element.getRootNode === 'function' ? element.getRootNode() : doc;\n const ids = rawValue.split(/\\s+/).filter(Boolean);\n const isValid =\n ids.length > 0 &&\n ids.every((id) =>\n Boolean(typeof ShadowRoot !== 'undefined' && root instanceof ShadowRoot ? root.getElementById(id) : doc.getElementById(id))\n );\n\n if (!isValid) {\n warnings.push(\n `Attribut ${attrName}=\"${rawValue}\" invalide : l'\u00E9l\u00E9ment cible est introuvable dans le DOM.`\n );\n }\n\n return isValid;\n }\n}\n\n", "import { BaseMaskOptions, IInputMask } from './types';\nimport { AuditableComponent } from '../common/AuditableComponent';\nimport { safeMove, safeCssEscape } from '../common/dom';\n\nconst VALID_ALIGNS: ReadonlySet<'left' | 'right' | 'center'> = new Set(['left', 'right', 'center']);\n\n/**\n * Structure de r\u00E9sultat lors de la normalisation des param\u00E8tres du constructeur.\n */\nexport interface ResolvedMaskTarget<TOptions extends BaseMaskOptions> {\n wrapper: HTMLElement | null;\n input: HTMLInputElement;\n options: TOptions;\n}\n\n/**\n * D\u00E9termine et extrait avec pr\u00E9cision le wrapper, l'input et les options\n * qu'on appelle sous forme (wrapper, input, options) ou (input, options).\n */\nexport function resolveMaskConstructorArgs<TOptions extends BaseMaskOptions>(\n targetOrWrapper: HTMLElement | HTMLInputElement | null | undefined,\n inputOrOptions?: HTMLInputElement | TOptions,\n maybeOptions?: TOptions\n): ResolvedMaskTarget<TOptions> {\n const isSecondArgInput = Boolean(\n inputOrOptions &&\n typeof inputOrOptions === 'object' &&\n 'tagName' in inputOrOptions &&\n (inputOrOptions as HTMLElement).tagName === 'INPUT'\n );\n\n if (isSecondArgInput) {\n return {\n wrapper: (targetOrWrapper as HTMLElement) || null,\n input: inputOrOptions as HTMLInputElement,\n options: (maybeOptions || {}) as TOptions\n };\n }\n\n return {\n wrapper: null,\n input: targetOrWrapper as HTMLInputElement,\n options: ((inputOrOptions && typeof inputOrOptions === 'object' && !('tagName' in inputOrOptions))\n ? inputOrOptions\n : {}) as TOptions\n };\n}\n\n/**\n * Classe abstraite de base pour tous les contr\u00F4leurs InputMask.\n * Mutualise la manipulation DOM, la gestion du pseudo-\u00E9l\u00E9ment ghosting,\n * la synchronisation g\u00E9om\u00E9trique typographique, l'interception de .value\n * et les m\u00E9thodes de cycle de vie (enable/disable, destroy).\n */\nexport abstract class BaseInputMask<TOptions extends BaseMaskOptions = BaseMaskOptions>\n extends AuditableComponent\n implements IInputMask<TOptions> {\n public wrapper: HTMLElement;\n public input: HTMLInputElement;\n public options: TOptions;\n public ghost: HTMLElement | null = null;\n\n protected isWrapperCreated: boolean = false;\n protected wasWrapperFallbackStyled: boolean = false;\n protected wasAlignSet: boolean = false;\n protected hadInitialDataAlign: boolean = false;\n protected isDestroyed: boolean = false;\n protected isFocused: boolean = false;\n protected isDispatchingNativeInput: boolean = false;\n protected lastTrackedValue: string = '';\n protected nativeValueDescriptor: PropertyDescriptor | null = null;\n protected onCutHandler: () => void = () => { };\n protected onFormResetHandler?: () => void;\n protected mutationObserver: MutationObserver | null = null;\n protected focusSelectTimerId: number | null = null;\n protected abortController: AbortController = new AbortController();\n\n constructor(input: HTMLInputElement, options?: TOptions);\n constructor(wrapper: HTMLElement | null, input: HTMLInputElement, options?: TOptions);\n constructor(\n targetOrWrapper: HTMLElement | HTMLInputElement | null | undefined,\n inputOrOptions?: HTMLInputElement | TOptions,\n maybeOptions?: TOptions\n );\n constructor(\n targetOrWrapper: HTMLElement | HTMLInputElement | null | undefined,\n inputOrOptions?: HTMLInputElement | TOptions,\n maybeOptions?: TOptions\n ) {\n super();\n const { wrapper: providedWrapper, input, options } = resolveMaskConstructorArgs(targetOrWrapper, inputOrOptions, maybeOptions);\n\n if (!input || typeof input !== 'object' || input.nodeType !== 1 || input.tagName !== 'INPUT') {\n throw new Error(`[${new.target.name || 'InputMask'}] input (HTMLInputElement) est requis.`);\n }\n\n this.input = input;\n\n const dataCreateWrapper = this.input.getAttribute('data-mask-create-wrapper') === 'true';\n const shouldCreateWrapper = Boolean(options.createWrapper ?? dataCreateWrapper);\n\n let effectiveWrapper = providedWrapper;\n\n if (!effectiveWrapper && shouldCreateWrapper) {\n const doc = this.input.ownerDocument || document;\n const span = doc.createElement('span');\n span.className = 'wulf-mask-wrapper';\n\n if (this.input.parentNode) {\n this.input.parentNode.insertBefore(span, this.input);\n }\n safeMove(span, this.input, null);\n\n const view = doc.defaultView || (typeof window !== 'undefined' ? window : null);\n const needsFallbackStyles = !span.isConnected || !view || view.getComputedStyle(span).display !== 'inline-grid';\n if (needsFallbackStyles) {\n span.style.display = 'inline-grid';\n span.style.gridTemplateColumns = '1fr';\n span.style.gridTemplateRows = '1fr';\n span.style.verticalAlign = 'middle';\n span.style.boxSizing = 'border-box';\n span.style.position = 'relative';\n\n this.input.style.gridArea = '1 / 1 / 2 / 2';\n this.input.style.boxSizing = 'border-box';\n this.wasWrapperFallbackStyled = true;\n }\n\n effectiveWrapper = span;\n this.isWrapperCreated = true;\n }\n\n if (!effectiveWrapper) {\n throw new Error(`[${new.target.name || 'InputMask'}] wrapper (HTMLElement) et input (HTMLInputElement) sont requis, ou activez l'option createWrapper: true.`);\n }\n\n this.wrapper = effectiveWrapper;\n\n // Protection globale contre les types d'input incompatibles avec la s\u00E9lection\n this.normalizeInputType();\n\n const dataFocusOnly = this.getAttr('data-mask-focus-only') === 'true';\n const dataDisabled = this.hasAttr('data-disabled');\n const dataSelectAll = this.getAttr('data-mask-select-on-focus') === 'true';\n const dataCopyRaw = this.getAttr('data-mask-copy-raw') === 'true';\n const rawDataAlign = this.getAttr('data-mask-align') || this.getAttr('data-align');\n const dataAlign = rawDataAlign && VALID_ALIGNS.has(rawDataAlign as 'left' | 'right' | 'center')\n ? (rawDataAlign as 'left' | 'right' | 'center')\n : null;\n this.hadInitialDataAlign = this.wrapper.hasAttribute('data-align');\n const dataAudit = this.getAttr('data-mask-audit');\n\n const { disabled: optDisabled, align: optAlign, ...otherOptions } = options;\n const validOptAlign = optAlign && VALID_ALIGNS.has(optAlign) ? optAlign : undefined;\n const resolvedDisabled = optDisabled !== undefined ? optDisabled : (dataDisabled ? true : false);\n const resolvedAudit = options.audit ?? (dataAudit !== null ? dataAudit !== 'false' : true);\n\n const isPassword = this.isPasswordInput();\n this.options = {\n ...otherOptions,\n createWrapper: shouldCreateWrapper,\n showMaskOnFocus: options.showMaskOnFocus ?? dataFocusOnly ?? false,\n selectAllOnFocus: options.selectAllOnFocus ?? dataSelectAll ?? false,\n copyRaw: isPassword ? false : (options.copyRaw ?? dataCopyRaw ?? false),\n disabled: resolvedDisabled,\n align: validOptAlign ?? (dataAlign || undefined),\n emitNativeInput: options.emitNativeInput ?? true,\n audit: resolvedAudit\n } as TOptions;\n\n if (this.options.showMaskOnFocus) {\n this.wrapper.classList.add('mask-focus-only');\n }\n if (this.options.disabled) {\n this.wrapper.setAttribute('data-disabled', 'true');\n }\n if (this.options.align) {\n this.setAlign(this.options.align);\n }\n\n this.createGhost();\n this.hookValueProperty();\n this.bindBaseEvents();\n this.initMutationObserver();\n }\n\n /**\n * R\u00E9cup\u00E8re un attribut depuis le wrapper ou l'input natif.\n */\n protected getAttr(name: string): string | null {\n return this.input.getAttribute(name) || this.wrapper.getAttribute(name);\n }\n\n /**\n * V\u00E9rifie la pr\u00E9sence d'un attribut sur le wrapper ou l'input natif.\n */\n protected hasAttr(name: string): boolean {\n return this.wrapper.hasAttribute(name) || this.input.hasAttribute(name);\n }\n\n /**\n * Indique si un placeholder natif non vide est configur\u00E9 sur l'input.\n */\n public hasNativePlaceholder(): boolean {\n return Boolean(this.input.placeholder && this.input.placeholder.trim().length > 0);\n }\n\n /**\n * D\u00E9termine si le masque fant\u00F4me doit s'effacer pour laisser place au placeholder natif\n * lorsque le champ est vide et n'a pas le focus.\n */\n public shouldHideGhostForPlaceholder(isInputEmpty: boolean): boolean {\n return !this.isFocused && isInputEmpty && this.hasNativePlaceholder();\n }\n\n /**\n * Attache les \u00E9couteurs de base pour focus/blur, copie brute et s\u00E9lection.\n */\n protected bindBaseEvents(): void {\n const { signal } = this.abortController;\n this.input.addEventListener('copy', this.onBaseCopy, { signal });\n this.input.addEventListener('focus', this.onBaseFocus, { signal });\n this.input.addEventListener('blur', this.onBaseBlur, { signal });\n }\n\n protected onBaseCopy = (e: ClipboardEvent): void => {\n if (!this.options.copyRaw || this.options.disabled || this.input.type === 'password') return;\n const start = this.input.selectionStart ?? 0;\n const end = this.input.selectionEnd ?? start;\n let textToCopy = '';\n if (start !== end) {\n textToCopy = this.extractRawSnippet(this.input.value.slice(start, end));\n } else {\n textToCopy = this.getRawValue();\n }\n if (textToCopy && e.clipboardData) {\n e.preventDefault();\n e.clipboardData.setData('text/plain', textToCopy);\n }\n };\n\n /**\n * Extrait la valeur brute d'un extrait de cha\u00EEne s\u00E9lectionn\u00E9.\n */\n protected extractRawSnippet(snippet: string): string {\n return snippet;\n }\n\n protected onBaseFocus = (): void => {\n this.isFocused = true;\n if (this.options.selectAllOnFocus && this.input.value.length > 0) {\n if (this.focusSelectTimerId !== null) {\n clearTimeout(this.focusSelectTimerId);\n }\n this.focusSelectTimerId = window.setTimeout(() => {\n this.focusSelectTimerId = null;\n if (!this.isDestroyed && document.activeElement === this.input) {\n this.input.select();\n }\n }, 0);\n }\n };\n\n protected onBaseBlur = (): void => {\n this.isFocused = false;\n if (this.isPasswordInput()) {\n this.lastTrackedValue = '';\n this.clearGhost();\n this.wrapper.removeAttribute('data-mask');\n }\n };\n\n /**\n * Initialise l'observation des modifications dynamiques des attributs data-* et placeholder.\n */\n protected initMutationObserver(): void {\n if (typeof MutationObserver === 'undefined') return;\n\n this.mutationObserver = new MutationObserver((mutations) => {\n for (const m of mutations) {\n if (m.type === 'attributes' && m.attributeName) {\n this.handleAttributeMutation(m.attributeName);\n }\n }\n });\n\n const config: MutationObserverInit = {\n attributes: true,\n attributeFilter: [\n 'data-mask',\n 'data-mask-placeholder',\n 'data-mask-focus-only',\n 'data-mask-strict',\n 'data-mask-select-on-focus',\n 'data-mask-copy-raw',\n 'data-mask-pad-decimals',\n 'data-mask-auto-lowercase',\n 'data-mask-cycle-suggestions',\n 'data-mask-default-tld',\n 'data-mask-tlds',\n 'data-disabled',\n 'data-mask-align',\n 'data-align',\n 'placeholder',\n 'type'\n ]\n };\n\n this.mutationObserver.observe(this.wrapper, config);\n if (this.input !== (this.wrapper as any)) {\n this.mutationObserver.observe(this.input, config);\n }\n }\n\n /**\n * Indique si le champ natif sous-jacent est de type mot de passe.\n */\n protected isPasswordInput(): boolean {\n return (this.input.type || '').toLowerCase() === 'password';\n }\n\n /**\n * Calcule une empreinte non r\u00E9versible pour d\u00E9tecter les changements sans conserver de secret en RAM.\n */\n protected computePasswordDigest(val: string): string {\n let hash = 0x811c9dc5;\n for (let i = 0; i < val.length; i++) {\n hash ^= val.charCodeAt(i);\n hash = Math.imul(hash, 0x01000193);\n }\n return `__pwd:${(hash >>> 0).toString(36)}:${val.length}`;\n }\n\n /**\n * Modifie dynamiquement l'alignement du champ et du masque fant\u00F4me.\n */\n public setAlign(align: 'left' | 'right' | 'center' | null): void {\n const normalized = align && VALID_ALIGNS.has(align) ? align : null;\n const targetAlign = normalized || undefined;\n const currentAttr = this.wrapper.getAttribute('data-align');\n const hasExpectedClass = normalized\n ? this.wrapper.classList.contains(`align-${normalized}`)\n : !this.wrapper.classList.contains('align-left') &&\n !this.wrapper.classList.contains('align-right') &&\n !this.wrapper.classList.contains('align-center');\n\n // Garde anti-boucle : si d\u00E9j\u00E0 align\u00E9, classe pr\u00E9sente et attribut synchronis\u00E9, sortir imm\u00E9diatement\n if (this.options.align === targetAlign && currentAttr === normalized && hasExpectedClass) {\n return;\n }\n\n this.options.align = targetAlign;\n this.wrapper.classList.remove('align-left', 'align-right', 'align-center');\n if (normalized) {\n this.wrapper.classList.add(`align-${normalized}`);\n this.wasAlignSet = true;\n if (this.wrapper.getAttribute('data-align') !== normalized) {\n this.wrapper.setAttribute('data-align', normalized);\n }\n } else {\n if (this.wrapper.hasAttribute('data-align')) {\n this.wrapper.removeAttribute('data-align');\n }\n }\n this.syncGhostStyles();\n }\n\n /**\n * Crochet appel\u00E9 lorsqu'un attribut pertinent a \u00E9t\u00E9 modifi\u00E9 dynamiquement \u00E0 la vol\u00E9e.\n */\n protected handleAttributeMutation(attrName: string): void {\n if (attrName === 'data-disabled') {\n const isDisabled = this.hasAttr('data-disabled');\n if (isDisabled !== Boolean(this.options.disabled)) {\n this.setDisabled(isDisabled);\n }\n } else if (attrName === 'data-mask-focus-only') {\n const focusOnly = this.getAttr('data-mask-focus-only') === 'true';\n if (focusOnly !== Boolean(this.options.showMaskOnFocus)) {\n this.setShowMaskOnFocus(focusOnly);\n }\n } else if (attrName === 'data-mask-select-on-focus') {\n this.options.selectAllOnFocus = this.getAttr('data-mask-select-on-focus') === 'true';\n } else if (attrName === 'data-mask-copy-raw') {\n this.options.copyRaw = this.isPasswordInput() ? false : (this.getAttr('data-mask-copy-raw') === 'true');\n } else if (attrName === 'type') {\n if (this.isPasswordInput()) {\n this.options.copyRaw = false;\n this.lastTrackedValue = '';\n this.clearGhost();\n this.wrapper.removeAttribute('data-mask');\n this.onPasswordModeDetected();\n }\n } else if (attrName === 'data-mask-align' || attrName === 'data-align') {\n const rawAlign = this.getAttr('data-mask-align') || this.getAttr('data-align');\n const align = rawAlign && VALID_ALIGNS.has(rawAlign as 'left' | 'right' | 'center')\n ? (rawAlign as 'left' | 'right' | 'center')\n : null;\n if (align !== (this.options.align ?? null)) {\n this.setAlign(align);\n }\n }\n }\n\n /**\n * Corrige les types d'input natifs incompatibles avec setSelectionRange (ex: number, email, date).\n */\n protected normalizeInputType(): void {\n const incompatibleTypes = ['number', 'email', 'date', 'datetime-local', 'month', 'week', 'time', 'color', 'file', 'range'];\n if (this.input.type && incompatibleTypes.includes(this.input.type.toLowerCase())) {\n const origType = this.input.type.toLowerCase();\n this.input.type = 'text';\n if (origType === 'number') {\n this.input.inputMode = 'numeric';\n }\n }\n }\n\n /**\n * Cr\u00E9e l'\u00E9l\u00E9ment d'arri\u00E8re-plan fant\u00F4me garantissant un rendu sans superposition\n * ni alt\u00E9ration de couleur, compatible avec les polices proportionnelles et monospaces.\n */\n protected createGhost(): void {\n const existing = this.wrapper.querySelector('.mask-ghost');\n if (existing) {\n existing.remove();\n }\n\n const doc = this.input.ownerDocument || document;\n this.ghost = doc.createElement('div');\n this.ghost.className = 'mask-ghost';\n this.ghost.setAttribute('aria-hidden', 'true');\n this.ghost.style.display = 'flex';\n this.ghost.style.alignItems = 'center';\n this.wrapper.appendChild(this.ghost);\n this.wrapper.classList.add('has-ghost');\n const view = doc.defaultView || (typeof window !== 'undefined' ? window : null);\n if (!this.wrapper.isConnected || !view || view.getComputedStyle(this.ghost).pointerEvents !== 'none') {\n this.ghost.style.gridArea = '1 / 1 / 2 / 2';\n this.ghost.style.pointerEvents = 'none';\n }\n this.syncGhostStyles();\n }\n\n /**\n * Met \u00E0 jour atomiquement le contenu du conteneur fant\u00F4me et synchronise .has-visible-ghost.\n */\n protected setGhostContent(...nodes: Array<Node | string>): void {\n if (!this.ghost) return;\n if (typeof this.ghost.replaceChildren === 'function') {\n this.ghost.replaceChildren(...nodes);\n } else {\n this.ghost.textContent = '';\n for (const n of nodes) {\n this.ghost.appendChild(typeof n === 'string' ? document.createTextNode(n) : n);\n }\n }\n this.wrapper.classList.toggle('has-visible-ghost', nodes.length > 0);\n }\n\n /**\n * Vide atomiquement le conteneur fant\u00F4me et r\u00E9tablit l'affichage du placeholder natif.\n */\n protected clearGhost(): void {\n this.setGhostContent();\n }\n\n /**\n * Clone fid\u00E8lement la g\u00E9om\u00E9trie typographique et les espacements de l'input natif\n * sur le conteneur fant\u00F4me pour garantir un alignement sub-pixel absolu quel que soit\n * le style impos\u00E9 par le framework parent (police, taille, padding, letter-spacing).\n */\n public syncGhostStyles(): void {\n if (!this.ghost || typeof window === 'undefined') return;\n const style = window.getComputedStyle(this.input);\n if (!style) return;\n\n this.ghost.style.fontFamily = style.fontFamily;\n this.ghost.style.fontSize = style.fontSize;\n this.ghost.style.fontWeight = style.fontWeight;\n this.ghost.style.fontStyle = style.fontStyle;\n this.ghost.style.letterSpacing = style.letterSpacing;\n this.ghost.style.lineHeight = style.lineHeight;\n this.ghost.style.paddingTop = style.paddingTop;\n this.ghost.style.paddingBottom = style.paddingBottom;\n this.ghost.style.paddingLeft = style.paddingLeft;\n this.ghost.style.paddingRight = style.paddingRight;\n this.ghost.style.borderTopWidth = style.borderTopWidth;\n this.ghost.style.borderBottomWidth = style.borderBottomWidth;\n this.ghost.style.borderLeftWidth = style.borderLeftWidth;\n this.ghost.style.borderRightWidth = style.borderRightWidth;\n this.ghost.style.borderTopStyle = style.borderTopStyle === 'none' ? 'none' : 'solid';\n this.ghost.style.borderBottomStyle = style.borderBottomStyle === 'none' ? 'none' : 'solid';\n this.ghost.style.borderLeftStyle = style.borderLeftStyle === 'none' ? 'none' : 'solid';\n this.ghost.style.borderRightStyle = style.borderRightStyle === 'none' ? 'none' : 'solid';\n this.ghost.style.borderColor = 'transparent';\n this.ghost.style.boxSizing = style.boxSizing;\n this.ghost.style.textAlign = style.textAlign;\n this.ghost.style.direction = style.direction;\n\n const isRtl = style.direction === 'rtl' || this.input.getAttribute('dir') === 'rtl' || this.wrapper.getAttribute('dir') === 'rtl';\n const textAlign = style.textAlign;\n\n if (textAlign === 'right') {\n this.ghost.style.justifyContent = 'right';\n } else if (textAlign === 'left') {\n this.ghost.style.justifyContent = 'left';\n } else if (textAlign === 'center') {\n this.ghost.style.justifyContent = 'center';\n } else if (textAlign === 'end') {\n this.ghost.style.justifyContent = isRtl ? 'left' : 'right';\n } else {\n this.ghost.style.justifyContent = isRtl ? 'right' : 'left';\n }\n }\n\n /**\n * Affecte directement la valeur native sans boucler sur le setter surcharg\u00E9.\n */\n protected setNativeValue(val: string): void {\n if (this.nativeValueDescriptor && this.nativeValueDescriptor.set) {\n this.nativeValueDescriptor.set.call(this.input, val);\n } else {\n this.input.value = val;\n }\n }\n\n /**\n * \u00C9met l'\u00E9v\u00E9nement 'input' natif W3C avec bulles pour synchroniser\n * les observateurs standards et les frameworks (React, Vue, Svelte, Angular).\n * Synchronise \u00E9galement le tracker de valeur interne de React (_valueTracker).\n */\n protected dispatchNativeInput(): void {\n if (this.isDestroyed || typeof window === 'undefined') return;\n if (this.options.emitNativeInput === false) return;\n\n this.isDispatchingNativeInput = true;\n try {\n const tracker = (this.input as any)._valueTracker;\n if (!this.isPasswordInput() && tracker && typeof tracker.setValue === 'function') {\n tracker.setValue(this.lastTrackedValue);\n }\n this.lastTrackedValue = this.isPasswordInput() ? '' : this.input.value;\n\n // \u00C9mission de l'\u00E9v\u00E9nement standard W3C (support\u00E9 universellement en ES2020+)\n this.input.dispatchEvent(new Event('input', { bubbles: true, cancelable: false }));\n } finally {\n this.isDispatchingNativeInput = false;\n }\n }\n\n /**\n * Synchronise le d\u00E9filement horizontal du ghost avec celui du champ d'entr\u00E9e natif.\n */\n protected onScroll = (): void => {\n if (this.ghost) {\n this.ghost.scrollLeft = this.input.scrollLeft;\n }\n };\n\n /**\n * Intercepte les modifications directes de la propri\u00E9t\u00E9 input.value (ex: input.value = '').\n */\n protected hookValueProperty(): void {\n try {\n const proto = HTMLInputElement.prototype;\n const desc = Object.getOwnPropertyDescriptor(proto, 'value');\n if (!desc || !desc.set || !desc.get) return;\n this.nativeValueDescriptor = desc;\n\n const self = this;\n Object.defineProperty(this.input, 'value', {\n get() {\n return desc.get!.call(this);\n },\n set(newVal: any) {\n const strVal = String(newVal ?? '');\n desc.set!.call(this, strVal);\n if (self.isDestroyed) return;\n self.onNativeValueSet(strVal);\n },\n configurable: true\n });\n } catch {\n // Ignorer si l'environnement bloque l'override\n }\n }\n\n /**\n * Supprime l'interception de input.value et restaure le comportement natif.\n */\n protected unhookValueProperty(): void {\n try {\n delete (this.input as any).value;\n } catch {\n // Ignorer\n }\n }\n\n /**\n * Active ou d\u00E9sactive l'affichage du masque uniquement au focus.\n */\n public setShowMaskOnFocus(enable: boolean): void {\n this.options.showMaskOnFocus = enable;\n this.wrapper.classList.toggle('mask-focus-only', enable);\n }\n\n /**\n * Active ou d\u00E9sactive le masquage de saisie (getter / setter fluide).\n */\n public disabled(disabledVal?: boolean): boolean | void {\n if (disabledVal === undefined) {\n return Boolean(this.options.disabled);\n }\n this.setDisabled(disabledVal);\n }\n\n /**\n * Active ou d\u00E9sactive le masquage / l'assistance de saisie.\n */\n public setDisabled(disabled: boolean): void {\n this.options.disabled = Boolean(disabled);\n\n if (this.options.disabled) {\n this.wrapper.setAttribute('data-disabled', 'true');\n } else {\n this.wrapper.removeAttribute('data-disabled');\n }\n\n this.onDisabledChange(this.options.disabled);\n }\n\n /**\n /**\n * Retourne l'\u00E9l\u00E9ment conteneur (wrapper).\n */\n public getWrapper(): HTMLElement {\n return this.wrapper;\n }\n\n /**\n * Retourne l'\u00E9l\u00E9ment input natif sous-jacent.\n */\n public getInput(): HTMLInputElement {\n return this.input;\n }\n\n /**\n * Retourne l'\u00E9l\u00E9ment fant\u00F4me (ghost) affichant le masque en arri\u00E8re-plan.\n */\n public getGhost(): HTMLElement | null {\n return this.ghost;\n }\n\n /**\n * Retourne l'ensemble des \u00E9l\u00E9ments DOM associ\u00E9s au masque (wrapper, input, ghost).\n */\n public getElements(): { wrapper: HTMLElement; input: HTMLInputElement; ghost: HTMLElement | null } {\n return {\n wrapper: this.wrapper,\n input: this.input,\n ghost: this.ghost\n };\n }\n\n /**\n * Retourne la valeur actuelle affich\u00E9e dans l'input (format\u00E9e).\n */\n public getValue(): string {\n return this.input.value;\n }\n\n /**\n * Retourne la valeur brute sans s\u00E9parateurs.\n * Par d\u00E9faut retourne la valeur de l'input si non surcharg\u00E9e.\n */\n public getRawValue(): string {\n return this.input.value;\n }\n\n /**\n * V\u00E9rifie la conformit\u00E9 d'accessibilit\u00E9 WAI-ARIA du champ de saisie (\u00E9tiquetage, format attendu)\n * et retourne la liste des contraintes manquantes.\n */\n public override audit(): string[] {\n const warnings: string[] = [];\n const doc = this.input.ownerDocument || document;\n const root = typeof this.input.getRootNode === 'function' ? this.input.getRootNode() : doc;\n const labelRoot: Document | ShadowRoot =\n typeof ShadowRoot !== 'undefined' && root instanceof ShadowRoot ? root : doc;\n\n // 1. V\u00E9rification de l'\u00E9tiquetage accessible (WCAG 1.3.1 / 4.1.2)\n const ariaLabel = this.input.getAttribute('aria-label')?.trim();\n const hasValidLabelledby = this.checkAriaIdReferences(this.input, 'aria-labelledby', warnings);\n\n const hasWrappingLabel = Boolean(this.input.closest('label'));\n const hasNativeLabels = Boolean(this.input.labels && this.input.labels.length > 0);\n let hasExplicitLabelFor = false;\n if (this.input.id) {\n try {\n hasExplicitLabelFor = Boolean(labelRoot.querySelector(`label[for=\"${safeCssEscape(this.input.id)}\"]`));\n } catch {\n hasExplicitLabelFor = false;\n }\n }\n\n if (!ariaLabel && !hasValidLabelledby && !hasWrappingLabel && !hasNativeLabels && !hasExplicitLabelFor) {\n warnings.push(\n '\u00C9tiquetage accessible manquant : associez un <label for=\"id\"> (ou d\u00E9finissez aria-label / aria-labelledby) sur l\\'input (WCAG 4.1.2).'\n );\n }\n\n // 2. V\u00E9rification de aria-describedby si renseign\u00E9\n this.checkAriaIdReferences(this.input, 'aria-describedby', warnings);\n\n // 3. R\u00E8gles sp\u00E9cifiques aux sous-classes (ex: format attendu sur InputMask)\n const extraWarnings = this.getSpecificAuditWarnings();\n warnings.push(...extraWarnings);\n\n return warnings;\n }\n\n protected override getAuditPrefix(): string {\n return `Wulf.Mask.${this.constructor.name || 'InputMask'}`;\n }\n\n protected override getAuditTargetLabel(): string {\n return this.input.id\n ? `#${this.input.id}`\n : (this.input.name ? `input[name=\"${this.input.name}\"]` : '<input>');\n }\n\n protected override getAuditDisableHint(): string {\n return 'Passez { audit: false } ou data-mask-audit=\"false\" pour d\u00E9sactiver cet avertissement';\n }\n\n /**\n * Crochet permettant aux classes filles d'ajouter des v\u00E9rifications d'audit sp\u00E9cifiques.\n */\n protected getSpecificAuditWarnings(): string[] {\n return [];\n }\n\n /**\n * Crochet appel\u00E9 lorsque l'input bascule dynamiquement en type=\"password\" (ex: toggle afficher/masquer).\n */\n protected onPasswordModeDetected(): void {}\n\n /**\n * Affecte une nouvelle valeur manuellement (format\u00E9e ou brute).\n */\n public abstract setValue(val: string | number): void;\n\n /**\n * Crochet appel\u00E9 lorsque input.value est modifi\u00E9e programmatiquement.\n */\n protected abstract onNativeValueSet(value: string): void;\n\n /**\n * Crochet appel\u00E9 lors du changement d'\u00E9tat via setDisabled().\n */\n protected abstract onDisabledChange(disabled: boolean): void;\n\n /**\n * Supprime les \u00E9l\u00E9ments fant\u00F4mes, restaure les propri\u00E9t\u00E9s et nettoie les attributs.\n */\n public destroy(): void {\n if (this.isDestroyed) return;\n this.isDestroyed = true;\n\n if (this.focusSelectTimerId !== null) {\n clearTimeout(this.focusSelectTimerId);\n this.focusSelectTimerId = null;\n }\n\n if (this.mutationObserver) {\n this.mutationObserver.disconnect();\n this.mutationObserver = null;\n }\n\n this.abortController.abort();\n\n this.lastTrackedValue = '';\n this.unhookValueProperty();\n\n if (this.ghost) {\n this.ghost.remove();\n this.ghost = null;\n }\n\n if (this.isWrapperCreated && this.wrapper) {\n if (this.wasWrapperFallbackStyled) {\n this.input.style.gridArea = '';\n this.input.style.boxSizing = '';\n }\n if (this.wrapper.parentElement) {\n safeMove(this.wrapper.parentElement, this.input, this.wrapper);\n } else if (this.wrapper.parentNode) {\n this.wrapper.parentNode.insertBefore(this.input, this.wrapper);\n }\n this.wrapper.remove();\n } else if (this.wrapper) {\n this.wrapper.removeAttribute('data-mask');\n this.wrapper.removeAttribute('data-disabled');\n if (this.wasAlignSet && !this.hadInitialDataAlign) {\n this.wrapper.removeAttribute('data-align');\n }\n if (this.wasAlignSet) {\n this.wrapper.classList.remove('align-left', 'align-right', 'align-center');\n }\n this.wrapper.classList.remove(\n 'is-complete',\n 'is-focused',\n 'mask-focus-only',\n 'has-selection',\n 'has-ghost',\n 'has-visible-ghost'\n );\n }\n }\n}\n", "import { TokenDef, MaskSlot, MaskOptions } from './types';\n\nexport const DEFAULT_TOKENS: Record<string, TokenDef> = {\n '9': { pattern: /[0-9]/ },\n 'a': { pattern: /[a-zA-Z]/ },\n 'A': { pattern: /[a-zA-Z]/, transform: (c) => c.toUpperCase() },\n '*': { pattern: /[a-zA-Z0-9]/ },\n '#': { pattern: /[a-zA-Z0-9]/, transform: (c) => c.toUpperCase() }\n};\n\n/**\n * Moteur algorithmique de masquage.\n * D\u00E9coupl\u00E9 \u00E0 100% du DOM pour garantir testabilit\u00E9 et maintenabilit\u00E9.\n */\nexport class MaskEngine {\n private pattern: string;\n private patterns: string[] = [];\n private subEngines: MaskEngine[] = [];\n private activeEngine: MaskEngine | null = null;\n private placeholderChar: string;\n private tokens: Record<string, TokenDef>;\n private slots: MaskSlot[] = [];\n private fullMaskTemplate: string = '';\n private prefixSlotsCount: number = 0;\n private prefixString: string = '';\n private strict: boolean = true;\n private autoLowercase: boolean = false;\n\n constructor(pattern: string | string[], options: Partial<MaskOptions> = {}) {\n const opts = options || {};\n const rawPlaceholder = String(opts.placeholderChar || '_');\n this.placeholderChar = Array.from(rawPlaceholder)[0] || '_';\n\n const tokenMap: Record<string, TokenDef> = Object.create(null);\n for (const [k, v] of Object.entries(DEFAULT_TOKENS)) {\n tokenMap[k] = v;\n }\n if (opts.tokens && typeof opts.tokens === 'object') {\n for (const [k, v] of Object.entries(opts.tokens)) {\n if (k !== '__proto__' && k !== 'constructor' && k !== 'prototype' && v) {\n tokenMap[k] = v;\n }\n }\n }\n this.tokens = tokenMap;\n\n this.strict = opts.strict !== false;\n this.autoLowercase = opts.autoLowercase ?? false;\n this.pattern = '';\n this.compile(pattern);\n }\n\n /**\n * Formate une valeur selon un gabarit de masque donn\u00E9.\n * Fonction statique utilitaire permettant un formatage direct sans instanciation manuelle.\n *\n * @param value Valeur \u00E0 formater (brute ou partiellement format\u00E9e)\n * @param pattern Masque \u00E0 appliquer (ex: \"99 99 99 99 99\" ou tableau de masques)\n * @param options Options facultatives (placeholderChar, tokens, strict, autoLowercase)\n * @returns La valeur format\u00E9e selon le masque\n */\n public static format(value: string, pattern: string | string[], options: Partial<MaskOptions> = {}): string {\n if (!pattern || (Array.isArray(pattern) && pattern.length === 0)) return value ?? '';\n const engine = new MaskEngine(pattern, options || {});\n return engine.format(value ?? '');\n }\n\n /**\n * Analyse le ou les gabarits statiques et compile la liste des slots.\n */\n public compile(newPattern?: string | string[]): MaskSlot[] {\n if (newPattern !== undefined) {\n if (Array.isArray(newPattern)) {\n this.patterns = newPattern.slice(0, 32).map(p => String(p ?? '').slice(0, 512));\n this.pattern = this.patterns[0] || '';\n } else {\n this.patterns = [];\n this.pattern = String(newPattern ?? '').slice(0, 512);\n }\n }\n\n if (this.patterns.length > 0) {\n // Compilation de la brigade de sous-moteurs unitaires\n this.subEngines = this.patterns.map(p => new MaskEngine(p, {\n placeholderChar: this.placeholderChar,\n tokens: this.tokens,\n strict: this.strict,\n autoLowercase: this.autoLowercase\n }));\n this.activeEngine = this.subEngines[0];\n this.slots = this.activeEngine.slots;\n this.fullMaskTemplate = this.activeEngine.fullMaskTemplate;\n this.prefixSlotsCount = this.activeEngine.prefixSlotsCount;\n this.prefixString = this.activeEngine.prefixString;\n return this.slots;\n }\n\n this.subEngines = [];\n this.activeEngine = null;\n this.slots = [];\n let templateBuilder = '';\n let isPrefixMode = true;\n\n for (let i = 0; i < this.pattern.length; i++) {\n let char = this.pattern[i];\n let isEscaped = false;\n\n // Gestion de l'\u00E9chappement : \\9, \\a, \\*, \\#, \\\\\n if (char === '\\\\' && i + 1 < this.pattern.length) {\n isEscaped = true;\n i++;\n char = this.pattern[i];\n }\n\n const token = !isEscaped && Object.hasOwn(this.tokens, char) ? this.tokens[char] : undefined;\n\n if (token) {\n // Premier emplacement \u00E9ditable rencontr\u00E9 : fin du pr\u00E9fixe statique\n isPrefixMode = false;\n this.slots.push({\n char,\n isStatic: false,\n isPrefix: false,\n token,\n placeholder: this.placeholderChar\n });\n templateBuilder += this.placeholderChar;\n } else {\n // S\u00E9parateur fixe (espace, tiret, slash, pr\u00E9fixe, ou caract\u00E8re \u00E9chapp\u00E9)\n this.slots.push({\n char,\n isStatic: true,\n isPrefix: isPrefixMode,\n placeholder: char\n });\n templateBuilder += char;\n }\n }\n\n this.fullMaskTemplate = templateBuilder;\n\n // Calcul de la taille et de la cha\u00EEne exacte du pr\u00E9fixe statique initial\n this.prefixSlotsCount = 0;\n this.prefixString = '';\n for (const slot of this.slots) {\n if (slot.isPrefix) {\n this.prefixSlotsCount++;\n this.prefixString += slot.char;\n } else {\n break;\n }\n }\n\n return this.slots;\n }\n\n /**\n * S\u00E9lectionne dynamiquement le meilleur sous-moteur en fonction de la valeur pass\u00E9e.\n */\n private selectEngine(input: string): MaskEngine {\n if (this.subEngines.length <= 1) {\n return this;\n }\n\n const trimmed = String(input ?? '');\n\n // 1. Priorit\u00E9 aux motifs ayant un pr\u00E9fixe statique correspondant au d\u00E9but de l'entr\u00E9e\n const withMatchingPrefix = this.subEngines.filter(e => {\n const p = e.getPrefix();\n return p.length > 0 && trimmed.toLowerCase().startsWith(p.trim().toLowerCase());\n });\n\n const candidates = withMatchingPrefix.length > 0 ? withMatchingPrefix : this.subEngines;\n\n // 2. Extraire la valeur brute avec le candidat ayant la plus grande capacit\u00E9 pour ne pas tronquer l'entr\u00E9e\n const maxCandidate = candidates.toSorted((a, b) => b.getEditableCount() - a.getEditableCount())[0];\n const raw = maxCandidate ? maxCandidate.extractRaw(trimmed) : trimmed;\n const rawLen = raw.length;\n\n // 3. Trouver le premier motif capable d'accueillir tous les caract\u00E8res saisis\n for (const eng of candidates) {\n if (eng.getEditableCount() >= rawLen) {\n this.activeEngine = eng;\n return eng;\n }\n }\n\n // Si \u00E7a d\u00E9passe la capacit\u00E9 de tous les candidats, prendre le plus grand\n this.activeEngine = candidates[candidates.length - 1];\n return this.activeEngine;\n }\n\n /**\n * Retourne la cha\u00EEne du pr\u00E9fixe statique initial (ex: \"+33 \").\n */\n public getPrefix(): string {\n return this.activeEngine ? this.activeEngine.getPrefix() : this.prefixString;\n }\n\n /**\n * Retourne la longueur en caract\u00E8res du pr\u00E9fixe statique initial.\n */\n public getPrefixLength(): number {\n return this.activeEngine ? this.activeEngine.getPrefixLength() : this.prefixSlotsCount;\n }\n\n /**\n * Retourne le gabarit complet du masque avec ses placeholders (ex: \"FR76 ____ ____\").\n */\n public getFullMaskTemplate(): string {\n return this.activeEngine ? this.activeEngine.getFullMaskTemplate() : this.fullMaskTemplate;\n }\n\n /**\n * Nombre total de positions \u00E9ditables dans le masque.\n */\n public getEditableCount(): number {\n if (this.subEngines.length > 0) {\n return Math.max(...this.subEngines.map(e => e.getEditableCount()));\n }\n return this.activeEngine ? this.activeEngine.getEditableCount() : this.slots.filter(s => !s.isStatic).length;\n }\n\n /**\n * Indique si tous les emplacements \u00E9ditables du masque acceptent exclusivement des chiffres num\u00E9riques.\n */\n public isNumericOnly(): boolean {\n if (this.subEngines.length > 0) {\n return this.subEngines.every(e => e.isNumericOnly());\n }\n const targetSlots = this.activeEngine ? (this.activeEngine as any).slots : this.slots;\n const editable = (targetSlots as MaskSlot[]).filter(s => !s.isStatic);\n if (editable.length === 0) return false;\n return editable.every(s => s.char === '9' || (s.token && s.token.pattern.test('0') && !s.token.pattern.test('a') && !s.token.pattern.test('Z')));\n }\n\n /**\n * D\u00E9finit si le masque bloque strictement les entr\u00E9es non conformes.\n */\n public setStrict(strict: boolean): void {\n this.strict = strict;\n for (const sub of this.subEngines) {\n sub.setStrict(strict);\n }\n }\n\n /**\n * Active ou d\u00E9sactive dynamiquement la mise en minuscules automatique.\n */\n public setAutoLowercase(autoLowercase: boolean): void {\n this.autoLowercase = autoLowercase;\n for (const sub of this.subEngines) {\n sub.setAutoLowercase(autoLowercase);\n }\n }\n\n /**\n * Indique si le masque est en mode strict.\n */\n public isStrict(): boolean {\n return this.strict;\n }\n\n /**\n * Filtre et extrait uniquement les caract\u00E8res \u00E9ditables valides d'une cha\u00EEne.\n * G\u00E8re intelligemment la pr\u00E9sence ou l'absence des s\u00E9parateurs statiques et du pr\u00E9fixe.\n */\n public extractRaw(input: string): string {\n if (this.subEngines.length > 0) {\n const engine = this.selectEngine(input);\n if (engine !== this) {\n return engine.extractRaw(input);\n }\n }\n\n const maxInputLen = Math.max(4096, this.slots.length * 4);\n const str = String(input ?? '').slice(0, maxInputLen);\n if (!str) return '';\n let raw = '';\n let inputIdx = 0;\n let slotIdx = 0;\n\n // 1. Traitement du pr\u00E9fixe statique initial s'il existe\n if (this.prefixSlotsCount > 0) {\n // Ignorer les espaces blancs de t\u00EAte \u00E9ventuels avant de tester le pr\u00E9fixe\n while (inputIdx < str.length && (str[inputIdx] === ' ' || str[inputIdx] === '\\t')) {\n inputIdx++;\n }\n let pIdx = 0;\n // On v\u00E9rifie si l'entr\u00E9e commence par les caract\u00E8res du pr\u00E9fixe\n while (inputIdx < str.length && pIdx < this.prefixSlotsCount) {\n const pChar = this.slots[pIdx].char;\n const inChar = str[inputIdx];\n if (inChar.toUpperCase() === pChar.toUpperCase()) {\n inputIdx++;\n pIdx++;\n } else if (pChar === ' ' && inChar !== ' ') {\n // Espace facultatif dans le pr\u00E9fixe saisi\n pIdx++;\n } else {\n break;\n }\n }\n\n // Si l'entr\u00E9e ne commen\u00E7ait pas par le pr\u00E9fixe (ex: saisie directe du premier chiffre)\n // OU si l'entr\u00E9e a match\u00E9 le pr\u00E9fixe : dans les deux cas, on positionne slotIdx\n // directement au premier slot \u00E9ditable !\n slotIdx = this.prefixSlotsCount;\n }\n\n // 2. Traitement des slots \u00E9ditables et s\u00E9parateurs internes\n while (inputIdx < str.length && slotIdx < this.slots.length) {\n const slot = this.slots[slotIdx];\n const char = str[inputIdx];\n\n if (slot.isStatic) {\n if (char.toUpperCase() === slot.char.toUpperCase()) {\n inputIdx++;\n slotIdx++;\n } else {\n // Le caract\u00E8re saisi n'est pas le s\u00E9parateur attendu : c'est une donn\u00E9e pour le slot suivant ou le slot courant !\n // On avance uniquement le slot statique du masque pour tenter de consommer le caract\u00E8re dans le slot \u00E9ditable suivant\n slotIdx++;\n }\n } else {\n if (slot.token && slot.token.pattern.test(char)) {\n let transformed = slot.token.transform ? slot.token.transform(char) : char;\n if (this.autoLowercase && !slot.token.transform) {\n transformed = transformed.toLowerCase();\n }\n raw += transformed;\n inputIdx++;\n slotIdx++;\n } else if (!this.strict) {\n raw += this.autoLowercase ? char.toLowerCase() : char;\n inputIdx++;\n slotIdx++;\n } else {\n inputIdx++;\n }\n }\n }\n\n // En mode non-strict, conserver tout caract\u00E8re suppl\u00E9mentaire au-del\u00E0 du masque\n if (!this.strict && inputIdx < str.length) {\n const remaining = str.slice(inputIdx);\n raw += this.autoLowercase ? remaining.toLowerCase() : remaining;\n }\n\n return raw;\n }\n\n /**\n * Formate une cha\u00EEne brute en appliquant le gabarit avec ses s\u00E9parateurs statiques.\n * Si aucune donn\u00E9e \u00E9ditable n'est pr\u00E9sente, retourne le pr\u00E9fixe statique fixe s'il existe.\n */\n public format(rawValue: string): string {\n if (this.subEngines.length > 0) {\n const engine = this.selectEngine(rawValue);\n if (engine !== this) {\n return engine.format(rawValue);\n }\n }\n\n const maxInputLen = Math.max(4096, this.slots.length * 4);\n const rawStr = String(rawValue ?? '').slice(0, maxInputLen);\n if (!this.slots.length) return rawStr;\n\n const cleanRaw = this.extractRaw(rawStr);\n // Si la valeur est vide, on retourne le pr\u00E9fixe statique fixe s'il existe, sinon cha\u00EEne vide\n if (cleanRaw.length === 0) {\n return this.prefixString;\n }\n\n let formatted = '';\n let rawIdx = 0;\n\n for (let i = 0; i < this.slots.length; i++) {\n const slot = this.slots[i];\n\n if (slot.isStatic) {\n const hasRemainingRaw = rawIdx < cleanRaw.length;\n const isPrefix = rawIdx === 0 && Boolean(slot.isPrefix);\n const isCompletedSegmentTrailingSep = rawIdx > 0 && rawIdx === cleanRaw.length;\n\n if (hasRemainingRaw || isPrefix || isCompletedSegmentTrailingSep) {\n formatted += slot.char;\n } else {\n break;\n }\n } else {\n if (rawIdx < cleanRaw.length) {\n const char = cleanRaw[rawIdx];\n let transformed = slot.token?.transform ? slot.token.transform(char) : char;\n if (this.autoLowercase && !slot.token?.transform) {\n transformed = transformed.toLowerCase();\n }\n formatted += transformed;\n rawIdx++;\n } else {\n break;\n }\n }\n }\n\n // En mode non-strict, ajouter les caract\u00E8res qui d\u00E9passent la capacit\u00E9 des slots\n if (!this.strict && rawIdx < cleanRaw.length) {\n const extra = cleanRaw.substring(rawIdx);\n formatted += this.autoLowercase ? extra.toLowerCase() : extra;\n }\n\n return formatted;\n }\n\n /**\n * Calcule le gabarit restant align\u00E9 au texte format\u00E9 (supporte les polices proportionnelles non-monospace).\n */\n public getRemainingMask(formatted: string): string {\n if (this.activeEngine && this.activeEngine !== this) {\n return this.activeEngine.getRemainingMask(formatted);\n }\n if (!this.fullMaskTemplate) return '';\n if (formatted.length >= this.fullMaskTemplate.length) {\n return formatted;\n }\n return formatted + this.fullMaskTemplate.substring(formatted.length);\n }\n\n /**\n * Mappe la position du curseur en pr\u00E9servant le nombre exact de caract\u00E8res \u00E9ditables\n * saisis avant le curseur, et en garantissant que le curseur ne recule jamais dans le pr\u00E9fixe statique.\n */\n public mapCursorPosition(inputValue: string, inputCursor: number, formatted: string): number {\n if (this.activeEngine && this.activeEngine !== this) {\n return this.activeEngine.mapCursorPosition(inputValue, inputCursor, formatted);\n }\n\n const minPos = this.prefixSlotsCount;\n const safeInput = String(inputValue ?? '');\n const safeFormatted = String(formatted ?? '');\n if (inputCursor <= 0 || !safeFormatted) return minPos;\n\n // Nombre de caract\u00E8res \u00E9ditables saisis avant le curseur dans l'entr\u00E9e courante\n const rawBeforeCursor = this.extractRaw(safeInput.slice(0, inputCursor));\n const targetRawCount = rawBeforeCursor.length;\n\n if (targetRawCount === 0) {\n return Math.max(minPos, Math.min(this.getNextEditablePosition(0), safeFormatted.length));\n }\n\n // Trouver l'index dans 'formatted' qui correspond \u00E0 targetRawCount caract\u00E8res \u00E9ditables\n let currentRawCount = 0;\n let targetPos = safeFormatted.length;\n\n for (let i = 0; i < safeFormatted.length && i < this.slots.length; i++) {\n const slot = this.slots[i];\n if (!slot.isStatic) {\n currentRawCount++;\n if (currentRawCount === targetRawCount) {\n targetPos = i + 1;\n break;\n }\n }\n }\n\n // Si la position cible est suivie d'un s\u00E9parateur statique d\u00E9j\u00E0 pr\u00E9sent dans formatted,\n // on avance le curseur apr\u00E8s le s\u00E9parateur pour fluidifier la frappe suivante\n while (targetPos < safeFormatted.length && this.slots[targetPos] && this.slots[targetPos].isStatic) {\n targetPos++;\n }\n\n return Math.max(minPos, Math.min(targetPos, safeFormatted.length));\n }\n\n /**\n * V\u00E9rifie si le slot \u00E0 l'index donn\u00E9 est un s\u00E9parateur statique.\n */\n public isSeparatorAt(displayIdx: number): boolean {\n if (this.activeEngine && this.activeEngine !== this) {\n return this.activeEngine.isSeparatorAt(displayIdx);\n }\n if (displayIdx >= 0 && displayIdx < this.slots.length) {\n return this.slots[displayIdx].isStatic;\n }\n return false;\n }\n\n /**\n * Trouve le prochain emplacement \u00E9ditable apr\u00E8s un index donn\u00E9.\n */\n public getNextEditablePosition(fromIdx: number): number {\n if (this.activeEngine && this.activeEngine !== this) {\n return this.activeEngine.getNextEditablePosition(fromIdx);\n }\n const start = Math.max(0, fromIdx);\n for (let i = start; i < this.slots.length; i++) {\n if (!this.slots[i].isStatic) {\n return i;\n }\n }\n return this.slots.length;\n }\n\n /**\n * Retourne le slot \u00E0 l'index donn\u00E9.\n */\n public getSlotAt(displayIdx: number): MaskSlot | undefined {\n if (this.activeEngine && this.activeEngine !== this) {\n return this.activeEngine.getSlotAt(displayIdx);\n }\n return this.slots[displayIdx];\n }\n\n /**\n * Retourne les slots complets.\n */\n public getSlots(): MaskSlot[] {\n if (this.activeEngine && this.activeEngine !== this) {\n return this.activeEngine.getSlots();\n }\n return this.slots;\n }\n}\n", "export interface HistoryState {\n raw: string;\n cursor: number;\n}\n\n/**\n * Gestionnaire d'historique Undo / Redo isol\u00E9 pour InputMask.\n * Maintient une pile d'\u00E9tats purs (donn\u00E9es brutes + position curseur)\n * d\u00E9coupl\u00E9e de toute logique DOM.\n */\nexport class MaskHistory {\n private stack: HistoryState[] = [];\n private index: number = -1;\n private maxDepth: number;\n\n constructor(maxDepth: number = 50) {\n this.maxDepth = maxDepth;\n }\n\n /**\n * Enregistre un nouvel \u00E9tat si la valeur brute a chang\u00E9.\n * Si la valeur brute est identique, met simplement \u00E0 jour la position du curseur de l'\u00E9tat courant.\n */\n public push(raw: string, cursor: number): void {\n const current = this.getCurrent();\n if (current && current.raw === raw) {\n current.cursor = cursor;\n return;\n }\n\n // Tronquer les branches futures si de nouvelles frappes surviennent apr\u00E8s un Undo\n this.stack = this.stack.slice(0, this.index + 1);\n this.stack.push({ raw, cursor });\n\n if (this.stack.length > this.maxDepth) {\n this.stack.shift();\n }\n\n this.index = this.stack.length - 1;\n }\n\n /**\n * Met \u00E0 jour la position du curseur de l'\u00E9tat courant sans modifier la pile.\n */\n public updateCurrentCursor(cursor: number): void {\n const current = this.getCurrent();\n if (current) {\n current.cursor = cursor;\n }\n }\n\n /**\n * Recule d'un cran dans l'historique et retourne l'\u00E9tat restaur\u00E9.\n */\n public undo(): HistoryState | null {\n if (this.canUndo()) {\n this.index--;\n return this.stack[this.index];\n }\n return null;\n }\n\n /**\n * Avance d'un cran dans l'historique et retourne l'\u00E9tat restaur\u00E9.\n */\n public redo(): HistoryState | null {\n if (this.canRedo()) {\n this.index++;\n return this.stack[this.index];\n }\n return null;\n }\n\n /**\n * Indique si une annulation est possible.\n */\n public canUndo(): boolean {\n return this.index > 0;\n }\n\n /**\n * Indique si un r\u00E9tablissement est possible.\n */\n public canRedo(): boolean {\n return this.index >= 0 && this.index < this.stack.length - 1;\n }\n\n /**\n * Retourne l'\u00E9tat courant.\n */\n public getCurrent(): HistoryState | null {\n return this.index >= 0 && this.index < this.stack.length ? this.stack[this.index] : null;\n }\n\n /**\n * R\u00E9initialise enti\u00E8rement l'historique.\n */\n public clear(): void {\n this.stack = [];\n this.index = -1;\n }\n}\n", "import { MaskEngine } from './MaskEngine';\nimport { MaskHistory } from './MaskHistory';\nimport { isImeComposing } from '../common/dom';\n\nexport interface MaskKeyboardDelegate {\n getInput(): HTMLInputElement;\n getEngine(): MaskEngine;\n getHistory(): MaskHistory;\n applyMask(rawOrPartial: string, cursorPosition: number, forceExactCursor?: boolean): void;\n undo(): void;\n redo(): void;\n enforceMinCursor(): void;\n}\n\n/**\n * Gestionnaire modulaire des raccourcis et comportements clavier pour InputMask.\n * Isole toute la logique de suppression unitaire, suppression par mot/bloc,\n * raccourcis Undo/Redo, touches statiques et navigation restreinte.\n */\nexport class MaskKeyboard {\n private delegate: MaskKeyboardDelegate;\n\n constructor(delegate: MaskKeyboardDelegate) {\n this.delegate = delegate;\n }\n\n /**\n * Analyse et traite l'\u00E9v\u00E9nement keydown de l'input.\n */\n public handleKeyDown(e: KeyboardEvent): void {\n if (isImeComposing(e)) return;\n const input = this.delegate.getInput();\n const engine = this.delegate.getEngine();\n const history = this.delegate.getHistory();\n const minPos = engine.getPrefixLength();\n\n const cursor = input.selectionStart ?? 0;\n const selectionEnd = input.selectionEnd ?? cursor;\n\n // 1. Annulation / R\u00E9tablissement (Undo: Ctrl+Z / Redo: Ctrl+Y ou Ctrl+Shift+Z, Cmd sur Mac)\n if ((e.ctrlKey || e.metaKey) && (e.key === 'z' || e.key === 'Z') && !e.shiftKey) {\n e.preventDefault();\n this.delegate.undo();\n return;\n }\n if (((e.ctrlKey || e.metaKey) && (e.key === 'y' || e.key === 'Y')) ||\n ((e.ctrlKey || e.metaKey) && e.shiftKey && (e.key === 'z' || e.key === 'Z'))) {\n e.preventDefault();\n this.delegate.redo();\n return;\n }\n\n // 2. Synchronisation de la position exacte du curseur dans l'historique avant toute action\n history.updateCurrentCursor(cursor);\n\n // 3. Traitement intelligent si l'utilisateur saisit le caract\u00E8re de s\u00E9paration du masque (ex: '/' ou '.' ou espace ' ')\n // UNIQUEMENT si aucune s\u00E9lection \u00E9tendue n'est active (une s\u00E9lection doit \u00EAtre remplac\u00E9e par le caract\u00E8re tap\u00E9)\n const isPrintableChar = e.key.length === 1 && !e.ctrlKey && !e.metaKey && !e.altKey;\n const hasSelection = selectionEnd > cursor;\n\n if (isPrintableChar && !hasSelection) {\n const slots = engine.getSlots();\n\n // 3.1 V\u00E9rifier si le caract\u00E8re sous le curseur OU juste avant le curseur est d\u00E9j\u00E0 ce s\u00E9parateur\n const isAlreadyOnSep = (cursor < slots.length && slots[cursor].isStatic && slots[cursor].char === e.key);\n const isJustAfterSep = (cursor > 0 && cursor - 1 < slots.length && slots[cursor - 1].isStatic && slots[cursor - 1].char === e.key);\n\n if (isAlreadyOnSep || isJustAfterSep) {\n e.preventDefault();\n const baseIdx = isAlreadyOnSep ? cursor : cursor - 1;\n const nextEditable = engine.getNextEditablePosition(baseIdx + 1);\n this.delegate.applyMask(input.value, nextEditable, true);\n return;\n }\n\n // 3.2 V\u00E9rifier si la touche tap\u00E9e correspond au prochain s\u00E9parateur statique \u00E0 venir dans le masque\n let nextSepIdx = -1;\n for (let i = cursor; i < slots.length; i++) {\n if (slots[i].isStatic) {\n if (slots[i].char === e.key) {\n nextSepIdx = i;\n }\n break;\n }\n }\n\n if (nextSepIdx !== -1) {\n e.preventDefault();\n\n // R\u00E9cup\u00E9rer le segment \u00E9ditable en cours de saisie avant ce s\u00E9parateur\n let segStart = nextSepIdx - 1;\n while (segStart >= minPos && !slots[segStart].isStatic) {\n segStart--;\n }\n segStart++; // Premier slot \u00E9ditable du bloc\n\n const segLength = nextSepIdx - segStart;\n const currentSegVal = input.value.slice(segStart, cursor);\n\n // Si le segment attend plus de caract\u00E8res num\u00E9riques que ce qui a \u00E9t\u00E9 saisi (ex: '5' suivi de '/' pour une date '99', '10' pour une IP '999')\n const isNumericSegment = slots.slice(segStart, nextSepIdx).every(s => !s.token || s.token.pattern.test('0'));\n if (isNumericSegment && segLength > currentSegVal.length && currentSegVal.length > 0) {\n const missingCount = segLength - currentSegVal.length;\n const paddedSeg = '0'.repeat(missingCount) + currentSegVal;\n const remainingTail = input.value.slice(nextSepIdx);\n const padded = input.value.slice(0, segStart) + paddedSeg + remainingTail;\n const nextEditable = engine.getNextEditablePosition(nextSepIdx + 1);\n this.delegate.applyMask(padded, nextEditable, true);\n return;\n }\n\n // Pour tout autre s\u00E9parateur ou si le segment est d\u00E9j\u00E0 plein : formater et sauter apr\u00E8s le s\u00E9parateur\n const nextEditable = engine.getNextEditablePosition(nextSepIdx + 1);\n this.delegate.applyMask(input.value, nextEditable, true);\n return;\n }\n }\n\n // 4. Protection du mode strict : interdire d'\u00E9craser / tronquer les donn\u00E9es existantes lorsque la capacit\u00E9 est atteinte\n if (isPrintableChar && engine.isStrict()) {\n const totalSlots = engine.getEditableCount();\n if (totalSlots > 0) {\n const currentRaw = engine.extractRaw(input.value);\n\n let availableCapacity = totalSlots - currentRaw.length;\n if (selectionEnd > cursor) {\n const selectedRaw = engine.extractRaw(input.value.slice(cursor, selectionEnd));\n availableCapacity = totalSlots - (currentRaw.length - selectedRaw.length);\n }\n\n if (availableCapacity <= 0) {\n e.preventDefault();\n return;\n }\n }\n }\n\n // 4. Gestion d'une s\u00E9lection \u00E9tendue (ex: Ctrl+A ou s\u00E9lection souris suivi de Suppr ou Backspace)\n if (selectionEnd > cursor) {\n if (e.key === 'Backspace' || e.key === 'Delete') {\n e.preventDefault();\n const val = input.value;\n const updated = val.slice(0, cursor) + val.slice(selectionEnd);\n this.delegate.applyMask(updated, Math.max(minPos, cursor));\n return;\n }\n return;\n }\n\n // 4. Verrouillage du pr\u00E9fixe statique fixe (ArrowLeft, Home, Ctrl+Home, Ctrl+ArrowLeft) hors s\u00E9lection Shift\n if (e.key === 'ArrowLeft' && !e.shiftKey && cursor <= minPos) {\n e.preventDefault();\n input.setSelectionRange(minPos, minPos);\n return;\n }\n if (e.key === 'Home' && minPos > 0 && !e.shiftKey && !e.ctrlKey && !e.metaKey && !e.altKey) {\n e.preventDefault();\n input.setSelectionRange(minPos, minPos);\n return;\n }\n\n // 5. Interdire d'effacer dans le pr\u00E9fixe statique\n if (e.key === 'Backspace' && cursor <= minPos) {\n e.preventDefault();\n input.setSelectionRange(minPos, minPos);\n return;\n }\n if (e.key === 'Delete' && cursor < minPos) {\n e.preventDefault();\n input.setSelectionRange(minPos, minPos);\n return;\n }\n\n // 7. Suppression de mot / bloc vers la gauche : Ctrl+Backspace, Alt+Backspace, Cmd+Backspace\n const isWordDeleteBack = e.key === 'Backspace' && (e.ctrlKey || e.altKey || e.metaKey);\n if (isWordDeleteBack) {\n e.preventDefault();\n if (cursor <= minPos) {\n input.setSelectionRange(minPos, minPos);\n return;\n }\n\n let i = cursor - 1;\n // Sauter d'abord les s\u00E9parateurs statiques imm\u00E9diats \u00E0 gauche\n while (i >= minPos && engine.isSeparatorAt(i)) {\n i--;\n }\n // Puis sauter tous les caract\u00E8res \u00E9ditables du mot / bloc\n while (i >= minPos && !engine.isSeparatorAt(i)) {\n i--;\n }\n\n const startPos = Math.max(minPos, i + 1);\n const val = input.value;\n const updated = val.slice(0, startPos) + val.slice(cursor);\n this.delegate.applyMask(updated, startPos);\n return;\n }\n\n // 8. Suppression de mot / bloc vers la droite : Ctrl+Delete, Alt+Delete\n const isWordDeleteForward = e.key === 'Delete' && (e.ctrlKey || e.altKey || e.metaKey);\n if (isWordDeleteForward) {\n e.preventDefault();\n const val = input.value;\n if (cursor >= val.length) {\n return;\n }\n\n let i = cursor;\n // Sauter d'abord les \u00E9ventuels s\u00E9parateurs statiques sous le curseur\n while (i < val.length && engine.isSeparatorAt(i)) {\n i++;\n }\n // Puis sauter tous les caract\u00E8res \u00E9ditables du mot / bloc\n while (i < val.length && !engine.isSeparatorAt(i)) {\n i++;\n }\n // Nettoyer les s\u00E9parateurs suivants pour \u00E9viter un double espace tra\u00EEnant\n while (i < val.length && engine.isSeparatorAt(i)) {\n i++;\n }\n\n const endPos = i;\n const updated = val.slice(0, cursor) + val.slice(endPos);\n this.delegate.applyMask(updated, cursor);\n return;\n }\n\n // 9. Touche Backspace unitaire devant un s\u00E9parateur statique interne\n if (e.key === 'Backspace' && cursor > minPos) {\n if (engine.isSeparatorAt(cursor - 1)) {\n e.preventDefault();\n let targetPos = cursor - 1;\n while (targetPos > minPos && engine.isSeparatorAt(targetPos - 1)) {\n targetPos--;\n }\n if (targetPos > minPos) {\n const val = input.value;\n const updated = val.slice(0, targetPos - 1) + val.slice(cursor);\n this.delegate.applyMask(updated, targetPos - 1);\n } else {\n this.delegate.applyMask('', minPos);\n }\n }\n return;\n }\n\n // 10. Touche Delete unitaire sur un s\u00E9parateur statique interne\n if (e.key === 'Delete' && cursor < input.value.length) {\n if (engine.isSeparatorAt(cursor)) {\n e.preventDefault();\n let targetPos = cursor;\n while (targetPos < input.value.length && engine.isSeparatorAt(targetPos)) {\n targetPos++;\n }\n if (targetPos < input.value.length) {\n const val = input.value;\n const updated = val.slice(0, targetPos) + val.slice(targetPos + 1);\n this.delegate.applyMask(updated, cursor);\n }\n }\n return;\n }\n }\n\n /**\n * Analyse et traite l'\u00E9v\u00E9nement keyup de l'input.\n */\n public handleKeyUp(e: KeyboardEvent): void {\n const input = this.delegate.getInput();\n const history = this.delegate.getHistory();\n\n if ((e.key === 'ArrowLeft' || e.key === 'ArrowRight' || e.key === 'Home') && !e.shiftKey) {\n this.delegate.enforceMinCursor();\n }\n history.updateCurrentCursor(input.selectionStart ?? 0);\n }\n}\n", "import { MaskOptions, MaskEventDetail, SetMaskOptions, IInputMask } from './types';\nimport { MaskEngine } from './MaskEngine';\nimport { MaskHistory } from './MaskHistory';\nimport { MaskKeyboard } from './MaskKeyboard';\nimport { BaseInputMask, resolveMaskConstructorArgs } from './BaseInputMask';\n\n/**\n * Contr\u00F4leur principal InputMask.\n * G\u00E8re le cycle de vie DOM, la synchronisation du pseudo-\u00E9l\u00E9ment ::after\n * via l'attribut data-mask et la navigation du curseur.\n */\nexport class InputMask extends BaseInputMask<MaskOptions> implements IInputMask<MaskOptions> {\n public engine: MaskEngine;\n public history: MaskHistory;\n public keyboard: MaskKeyboard;\n\n private isComposing: boolean = false;\n private isUndoingRedoing: boolean = false;\n private isMouseDown: boolean = false;\n private isApplyingMask: boolean = false;\n\n private lastValue: string = '';\n private lastInternalRemainingMask: string = '';\n private isNotifying: boolean = false;\n private hasPendingNotification: boolean = false;\n private onChangeNativeHandler: () => void = () => {};\n private wasInputModeInferred: boolean = false;\n private cutTimerId: number | null = null;\n private pasteTimerId: number | null = null;\n private resetTimerId: number | null = null;\n\n constructor(input: HTMLInputElement, options?: MaskOptions);\n constructor(wrapper: HTMLElement | null, input: HTMLInputElement, options?: MaskOptions);\n constructor(\n targetOrWrapper: HTMLElement | HTMLInputElement | null | undefined,\n inputOrOptions?: HTMLInputElement | MaskOptions,\n options?: MaskOptions\n );\n constructor(\n targetOrWrapper: HTMLElement | HTMLInputElement | null | undefined,\n inputOrOptions?: HTMLInputElement | MaskOptions,\n options?: MaskOptions\n ) {\n const args = resolveMaskConstructorArgs<MaskOptions>(targetOrWrapper, inputOrOptions, options);\n const wrap = args.wrapper;\n const inp = args.input;\n const opts = args.options;\n\n const attrMask = wrap?.getAttribute('data-mask') || inp?.getAttribute('data-mask');\n let pattern: string | string[] = opts.mask || attrMask || '';\n // Support multi-motifs s\u00E9par\u00E9s par pipe dans data-mask (ex: \"99 99 99 99|99 99 99 99 99\")\n if (typeof pattern === 'string' && pattern.includes('|')) {\n pattern = pattern.split('|').map(s => s.trim());\n }\n\n const placeholderChar = opts.placeholderChar || wrap?.getAttribute('data-mask-placeholder') || inp?.getAttribute('data-mask-placeholder') || '_';\n const dataDisabled = wrap?.hasAttribute('data-disabled') || inp?.hasAttribute('data-disabled');\n const dataStrict = wrap?.getAttribute('data-mask-strict') || inp?.getAttribute('data-mask-strict');\n const dataAutoLower = wrap?.getAttribute('data-mask-auto-lowercase') === 'true' || inp?.getAttribute('data-mask-auto-lowercase') === 'true';\n const dataInfer = wrap?.getAttribute('data-mask-infer-inputmode') ?? inp?.getAttribute('data-mask-infer-inputmode');\n const inferInputMode = opts.inferInputMode ?? (dataInfer !== null ? dataInfer !== 'false' : true);\n\n const { disabled: optsDisabled, ...otherOpts } = opts;\n const resolvedDisabled = optsDisabled !== undefined ? optsDisabled : (dataDisabled ? true : (!pattern || (Array.isArray(pattern) && pattern.length === 0)));\n\n const resolvedOptions: MaskOptions = {\n ...otherOpts,\n mask: pattern,\n placeholderChar,\n strict: opts.strict ?? (dataStrict !== null ? dataStrict !== 'false' : true),\n autoLowercase: opts.autoLowercase ?? dataAutoLower ?? false,\n disabled: resolvedDisabled,\n resetHistoryOnMaskChange: opts.resetHistoryOnMaskChange ?? false,\n inferInputMode,\n onInput: opts.onInput || (opts as any).oninput,\n onChange: opts.onChange || (opts as any).onchange,\n onComplete: opts.onComplete || (opts as any).oncomplete\n };\n\n super(wrap, inp, resolvedOptions);\n\n this.history = new MaskHistory();\n\n // Initialisation du moteur algorithmique\n this.engine = new MaskEngine(this.options.mask || '', {\n placeholderChar: this.options.placeholderChar,\n tokens: this.options.tokens,\n strict: this.options.strict,\n autoLowercase: this.options.autoLowercase\n });\n\n // Inf\u00E9rence automatique accessible de inputmode=\"numeric\" si masque exclusivement compos\u00E9 de chiffres\n this.syncInferredInputMode();\n\n // Initialisation du gestionnaire clavier d\u00E9di\u00E9\n this.keyboard = new MaskKeyboard({\n getInput: () => this.input,\n getEngine: () => this.engine,\n getHistory: () => this.history,\n applyMask: (raw, cursor, forceExactCursor) => this.applyMask(raw, cursor, forceExactCursor),\n undo: () => this.undo(),\n redo: () => this.redo(),\n enforceMinCursor: () => this.enforceMinCursor()\n });\n\n this.bindEvents();\n this.lastValue = this.isPasswordInput() ? this.computePasswordDigest(this.input.value) : this.input.value;\n this.syncInitialValue();\n\n this.runAuditWarning(this.options.audit);\n }\n\n protected override getSpecificAuditWarnings(): string[] {\n const warnings: string[] = [];\n const describedbyWarnings: string[] = [];\n const hasValidDescribedby = this.checkAriaIdReferences(this.input, 'aria-describedby', describedbyWarnings);\n const hasPlaceholder = Boolean(this.input.getAttribute('placeholder')?.trim());\n const hasAriaPlaceholder = Boolean(this.input.getAttribute('aria-placeholder')?.trim());\n if (!hasValidDescribedby && !hasPlaceholder && !hasAriaPlaceholder && !this.options.disabled) {\n warnings.push(\n 'Indication du format attendu manquante : d\u00E9finissez aria-describedby, placeholder ou aria-placeholder pour informer les technologies d\\'assistance (WCAG 3.3.2).'\n );\n }\n return warnings;\n }\n\n protected override extractRawSnippet(snippet: string): string {\n return this.engine.extractRaw(snippet);\n }\n\n protected override onPasswordModeDetected(): void {\n this.history.clear();\n this.lastValue = '';\n this.lastInternalRemainingMask = '';\n this.lastTrackedValue = '';\n this.clearGhost();\n this.wrapper.removeAttribute('data-mask');\n }\n\n /**\n * Formate statiquement une valeur selon un masque donn\u00E9 sans n\u00E9cessiter d'\u00E9l\u00E9ment DOM.\n *\n * @param value Valeur \u00E0 formater (ex: \"0123456789\")\n * @param mask Gabarit de masque (ex: \"99 99 99 99 99\")\n * @param options Options facultatives du masque (tokens, placeholderChar, strict, etc.)\n * @returns Valeur format\u00E9e (ex: \"01 23 45 67 89\")\n */\n public static format(value: string, mask: string, options: Partial<MaskOptions> = {}): string {\n return MaskEngine.format(value, mask, options);\n }\n\n protected onNativeValueSet(strVal: string): void {\n if (this.options.disabled) {\n this.checkValueChange();\n } else {\n this.applyMask(strVal, strVal.length);\n }\n }\n\n protected onDisabledChange(disabled: boolean): void {\n if (disabled) {\n this.wrapper.removeAttribute('data-mask');\n this.wrapper.classList.remove('is-complete', 'has-selection');\n this.clearGhost();\n this.checkValueChange();\n } else {\n this.applyMask(this.input.value, this.input.selectionStart ?? this.input.value.length);\n }\n this.syncInferredInputMode();\n }\n\n /**\n * Associe les \u00E9couteurs d'\u00E9v\u00E9nements n\u00E9cessaires.\n */\n private bindEvents(): void {\n this.handleInput = this.handleInput.bind(this);\n this.onKeyDown = this.onKeyDown.bind(this);\n this.onPaste = this.onPaste.bind(this);\n this.onFocus = this.onFocus.bind(this);\n this.onBlur = this.onBlur.bind(this);\n this.onClick = this.onClick.bind(this);\n this.onKeyUp = this.onKeyUp.bind(this);\n this.onSelect = this.onSelect.bind(this);\n this.onMouseDown = this.onMouseDown.bind(this);\n this.onMouseUp = this.onMouseUp.bind(this);\n this.onCompositionStart = this.onCompositionStart.bind(this);\n this.onCompositionEnd = this.onCompositionEnd.bind(this);\n this.onScroll = this.onScroll.bind(this);\n this.onBeforeInput = this.onBeforeInput.bind(this);\n\n this.onCutHandler = () => {\n if (this.cutTimerId !== null) clearTimeout(this.cutTimerId);\n this.cutTimerId = window.setTimeout(() => {\n this.cutTimerId = null;\n if (this.isDestroyed) return;\n if (this.options.disabled) {\n this.checkValueChange();\n } else {\n const cur = this.input.selectionStart ?? this.input.value.length;\n this.applyMask(this.input.value, cur);\n }\n }, 0);\n };\n\n this.onChangeNativeHandler = () => {\n if (this.isDestroyed) return;\n this.checkValueChange();\n };\n\n const { signal } = this.abortController;\n this.input.addEventListener('beforeinput', this.onBeforeInput as EventListener, { signal });\n this.input.addEventListener('input', this.handleInput, { signal });\n this.input.addEventListener('keydown', this.onKeyDown, { signal });\n this.input.addEventListener('paste', this.onPaste, { signal });\n this.input.addEventListener('focus', this.onFocus, { signal });\n this.input.addEventListener('blur', this.onBlur, { signal });\n this.input.addEventListener('click', this.onClick, { signal });\n this.input.addEventListener('keyup', this.onKeyUp, { signal });\n this.input.addEventListener('select', this.onSelect, { signal });\n this.input.addEventListener('mousedown', this.onMouseDown, { signal });\n window.addEventListener('mouseup', this.onMouseUp, { signal });\n this.input.addEventListener('compositionstart', this.onCompositionStart, { signal });\n this.input.addEventListener('compositionend', this.onCompositionEnd, { signal });\n this.input.addEventListener('scroll', this.onScroll, { passive: true, signal });\n this.input.addEventListener('cut', this.onCutHandler, { signal });\n this.input.addEventListener('change', this.onChangeNativeHandler, { signal });\n\n if (this.input.form) {\n this.onFormResetHandler = () => {\n if (this.resetTimerId !== null) clearTimeout(this.resetTimerId);\n this.resetTimerId = window.setTimeout(() => {\n this.resetTimerId = null;\n if (this.isDestroyed) return;\n if (this.options.disabled) {\n this.checkValueChange();\n } else {\n this.syncInitialValue();\n }\n }, 0);\n };\n this.input.form.addEventListener('reset', this.onFormResetHandler, { signal });\n }\n }\n\n /**\n * Synchronise dynamiquement l'attribut inputmode=\"numeric\" selon le motif actif\n * sans jamais \u00E9craser un inputmode d\u00E9fini explicitement par l'h\u00F4te.\n */\n private syncInferredInputMode(): void {\n if (!this.options.inferInputMode) return;\n const isNum = !this.options.disabled && this.engine.isNumericOnly();\n if (isNum) {\n if (!this.input.hasAttribute('inputmode')) {\n this.input.inputMode = 'numeric';\n this.wasInputModeInferred = true;\n }\n } else if (this.wasInputModeInferred && this.input.getAttribute('inputmode') === 'numeric') {\n this.input.removeAttribute('inputmode');\n this.wasInputModeInferred = false;\n }\n }\n\n /**\n * Supprime tous les \u00E9couteurs et nettoie les attributs associ\u00E9s.\n */\n public override destroy(): void {\n if (this.isDestroyed) return;\n if (this.cutTimerId !== null) {\n clearTimeout(this.cutTimerId);\n this.cutTimerId = null;\n }\n if (this.pasteTimerId !== null) {\n clearTimeout(this.pasteTimerId);\n this.pasteTimerId = null;\n }\n if (this.resetTimerId !== null) {\n clearTimeout(this.resetTimerId);\n this.resetTimerId = null;\n }\n\n if (this.wasInputModeInferred && this.input.getAttribute('inputmode') === 'numeric') {\n this.input.removeAttribute('inputmode');\n }\n\n this.history.clear();\n this.lastValue = '';\n this.lastInternalRemainingMask = '';\n super.destroy();\n }\n\n /**\n * D\u00E9finit si le masque bloque strictement les entr\u00E9es non conformes.\n */\n public setStrict(strict: boolean): void {\n this.options.strict = strict;\n this.engine.setStrict(strict);\n if (!this.options.disabled) {\n this.applyMask(this.input.value, this.input.selectionStart ?? this.input.value.length);\n }\n }\n\n /**\n * Indique si le masque est en mode strict.\n */\n public isStrict(): boolean {\n return this.engine.isStrict();\n }\n\n /**\n * Modifie dynamiquement le masque actif.\n * Permet de d\u00E9sactiver le masque avec null/vide, ou de sp\u00E9cifier un mode strict/souple.\n */\n public setMask(newPattern: string | string[] | null, options?: SetMaskOptions | boolean): void {\n const newStrict = typeof options === 'boolean'\n ? options\n : (options && typeof options === 'object' && options.strict !== undefined)\n ? options.strict\n : this.options.strict;\n\n const shouldResetHistory = (options && typeof options === 'object' && options.resetHistory !== undefined)\n ? options.resetHistory\n : Boolean(this.options.resetHistoryOnMaskChange);\n\n const isTargetingEmpty = !newPattern || (Array.isArray(newPattern) && newPattern.length === 0);\n if (isTargetingEmpty && this.options.disabled && (!this.options.mask || this.options.mask === '')) {\n return;\n }\n\n if (!newPattern || (Array.isArray(newPattern) && newPattern.length === 0)) {\n this.options.mask = '';\n this.options.strict = newStrict;\n this.engine.setStrict(newStrict ?? true);\n this.engine.compile('');\n if (shouldResetHistory) {\n this.history.clear();\n }\n this.setDisabled(true);\n this.syncInferredInputMode();\n return;\n }\n\n this.options.mask = newPattern;\n this.options.strict = newStrict;\n this.engine.setStrict(newStrict ?? true);\n this.engine.compile(newPattern);\n if (shouldResetHistory) {\n this.history.clear();\n }\n this.setDisabled(false);\n this.syncInferredInputMode();\n }\n\n protected override handleAttributeMutation(attrName: string): void {\n super.handleAttributeMutation(attrName);\n if (attrName === 'data-mask') {\n const rawAttr = this.getAttr('data-mask');\n if (rawAttr === this.lastInternalRemainingMask) {\n return;\n }\n const currentMaskStr = Array.isArray(this.options.mask)\n ? this.options.mask.join('|')\n : (this.options.mask || '');\n if (rawAttr === currentMaskStr) {\n return;\n }\n if (rawAttr) {\n const maskVal = rawAttr.includes('|') ? rawAttr.split('|').map(s => s.trim()) : rawAttr;\n this.setMask(maskVal);\n } else {\n this.setMask(null);\n }\n } else if (attrName === 'data-mask-strict') {\n const strictVal = this.getAttr('data-mask-strict');\n this.setStrict(strictVal !== 'false');\n } else if (attrName === 'data-mask-auto-lowercase') {\n this.options.autoLowercase = this.getAttr('data-mask-auto-lowercase') === 'true';\n this.engine.setAutoLowercase(this.options.autoLowercase);\n this.engine.compile(this.options.mask || '');\n this.applyMask(this.input.value, this.input.selectionStart ?? this.input.value.length);\n } else if (attrName === 'placeholder') {\n this.updateGhost(this.input.value);\n }\n }\n\n /**\n * Affecte une nouvelle valeur manuellement (format\u00E9e ou brute).\n */\n public override setValue(val: string | number): void {\n const safeVal = val !== null && val !== undefined ? String(val) : '';\n if (this.options.disabled) {\n this.input.value = safeVal;\n this.checkValueChange();\n return;\n }\n this.applyMask(safeVal, safeVal.length);\n }\n\n /**\n * Retourne la valeur brute sans s\u00E9parateurs.\n */\n public override getRawValue(): string {\n return this.engine.extractRaw(this.input.value);\n }\n\n /**\n * Indique si tous les emplacements \u00E9ditables sont renseign\u00E9s.\n */\n public isComplete(): boolean {\n if (this.options.disabled) return true;\n const raw = this.getRawValue();\n return raw.length >= this.engine.getEditableCount();\n }\n\n /**\n * Callback d'\u00E9coute directe ou getter/setter pour onInput.\n */\n public get onInput(): ((value: string, detail: MaskEventDetail) => void) | undefined {\n return this.options.onInput;\n }\n\n public set onInput(callback: ((value: string, detail: MaskEventDetail) => void) | undefined) {\n this.options.onInput = callback;\n }\n\n /**\n * Annule la derni\u00E8re modification (Undo).\n */\n public undo(): void {\n if (this.options.disabled) return;\n const state = this.history.undo();\n if (state) {\n this.isUndoingRedoing = true;\n this.applyMask(state.raw, state.cursor);\n this.isUndoingRedoing = false;\n }\n }\n\n /**\n * R\u00E9tablit la modification annul\u00E9e (Redo).\n */\n public redo(): void {\n if (this.options.disabled) return;\n const state = this.history.redo();\n if (state) {\n this.isUndoingRedoing = true;\n this.applyMask(state.raw, state.cursor);\n this.isUndoingRedoing = false;\n }\n }\n\n // ==========================================================================\n // Gestionnaires d'\u00E9v\u00E9nements DOM\n // ==========================================================================\n\n private checkSelection(): void {\n if (this.options.disabled) return;\n const start = this.input.selectionStart ?? 0;\n const end = this.input.selectionEnd ?? start;\n const hasSelection = start !== end;\n this.wrapper.classList.toggle('has-selection', hasSelection);\n }\n\n private onBeforeInput(e: InputEvent): void {\n if (this.options.disabled) return;\n if (this.isComposing) return;\n if (!this.engine.isStrict()) return;\n if (e.inputType === 'insertFromPaste' || e.inputType === 'insertReplacementText') return;\n\n // Si l'\u00E9v\u00E9nement est une insertion (saisie clavier, glisser-d\u00E9poser, composition)\n if (e.inputType && e.inputType.startsWith('insert')) {\n const totalSlots = this.engine.getEditableCount();\n if (totalSlots > 0) {\n const currentRaw = this.getRawValue();\n const start = this.input.selectionStart ?? 0;\n const end = this.input.selectionEnd ?? start;\n\n let availableCapacity = Math.max(0, totalSlots - currentRaw.length);\n if (end > start) {\n const selectedRaw = this.engine.extractRaw(this.input.value.slice(start, end));\n availableCapacity = Math.max(0, totalSlots - (currentRaw.length - selectedRaw.length));\n }\n\n if (availableCapacity <= 0) {\n e.preventDefault();\n }\n }\n }\n }\n\n private handleInput(e: Event): void {\n if (this.isDispatchingNativeInput) return;\n if (this.isComposing) return;\n\n // D\u00E9tection imm\u00E9diate du changement de valeur d\u00E8s la frappe pour permettre \u00E0 onInput de r\u00E9agir\n const hasOnInput = Boolean(this.options.onInput || (this.options as any).oninput);\n const currentComparison = this.isPasswordInput() ? this.computePasswordDigest(this.input.value) : this.input.value;\n if (hasOnInput && currentComparison !== this.lastValue) {\n this.checkValueChange();\n }\n\n if (this.options.disabled) {\n this.checkValueChange();\n return;\n }\n\n // Garde-fou strict : emp\u00EAcher tout d\u00E9passement de capacit\u00E9 au-del\u00E0 des slots disponibles\n const prevState = this.history.getCurrent();\n const totalSlots = this.engine.getEditableCount();\n if (totalSlots > 0 && this.engine.isStrict() && prevState && prevState.raw.length >= totalSlots) {\n const newRaw = this.engine.extractRaw(this.input.value);\n // Ne bloquer que si la nouvelle valeur brute d\u00E9passe la capacit\u00E9 permise du masque\n if (newRaw.length > totalSlots) {\n this.applyMask(prevState.raw, prevState.cursor);\n return;\n }\n }\n\n const oldCursor = this.input.selectionStart ?? this.input.value.length;\n this.applyMask(this.input.value, oldCursor);\n this.checkSelection();\n }\n\n private onKeyDown(e: KeyboardEvent): void {\n if (this.options.disabled) return;\n this.keyboard.handleKeyDown(e);\n }\n\n private onMouseDown(): void {\n this.isMouseDown = true;\n }\n\n private onMouseUp(): void {\n this.isMouseDown = false;\n this.checkSelection();\n }\n\n private onPaste(e: ClipboardEvent): void {\n if (this.options.disabled) {\n if (this.pasteTimerId !== null) clearTimeout(this.pasteTimerId);\n this.pasteTimerId = window.setTimeout(() => {\n this.pasteTimerId = null;\n if (!this.isDestroyed) this.checkValueChange();\n }, 0);\n return;\n }\n e.preventDefault();\n this.history.updateCurrentCursor(this.input.selectionStart ?? 0);\n const rawPasted = (e.clipboardData?.getData('text') || '').slice(0, 4096);\n const pastedText = rawPasted.trim();\n if (!pastedText) return;\n\n const minPos = this.engine.getPrefixLength();\n const selStart = this.input.selectionStart ?? 0;\n const selEnd = this.input.selectionEnd ?? selStart;\n const currentVal = this.input.value;\n\n const totalSlots = this.engine.getEditableCount();\n const currentRaw = this.getRawValue();\n\n // 1. D\u00E9tection de collage d'une valeur compl\u00E8te :\n // Si le texte coll\u00E9 commence par le pr\u00E9fixe fixe (ex: \"+33\" ou \"FR76\"),\n // ou par les caract\u00E8res d\u00E9j\u00E0 pr\u00E9sents au d\u00E9but du champ (ex: \"FR76\" dans un masque \"AA99\")\n const prefix = this.engine.getPrefix();\n const cleanPrefix = prefix.replace(/[\\s.-]+/g, '').toUpperCase();\n const cleanPasted = pastedText.replace(/[\\s.-]+/g, '').toUpperCase();\n\n const startsWithStaticPrefix = cleanPrefix.length > 0 && cleanPasted.startsWith(cleanPrefix);\n\n const prefixInField = currentVal.slice(0, Math.max(minPos, selStart)).replace(/[\\s.-]+/g, '').toUpperCase();\n const startsWithFieldStart = prefixInField.length >= 2 && cleanPasted.startsWith(prefixInField);\n\n let effectiveStart = Math.max(minPos, selStart);\n let effectiveEnd = Math.max(minPos, selEnd);\n\n if (startsWithStaticPrefix || startsWithFieldStart) {\n // Le texte coll\u00E9 contient d\u00E9j\u00E0 le d\u00E9but complet du champ : on remplace la totalit\u00E9 du champ\n effectiveStart = 0;\n effectiveEnd = currentVal.length;\n }\n\n let availableCapacity = Math.max(0, totalSlots - currentRaw.length);\n if (effectiveStart !== effectiveEnd) {\n const selectedRaw = this.engine.extractRaw(currentVal.slice(effectiveStart, effectiveEnd));\n availableCapacity = Math.max(0, totalSlots - (currentRaw.length - selectedRaw.length));\n }\n\n // En mode strict : si aucune capacit\u00E9 n'est disponible et aucun remplacement, ignorer\n if (this.engine.isStrict() && availableCapacity <= 0) {\n return;\n }\n\n let combined: string;\n let newCursorPos: number;\n\n if (effectiveStart === 0 && effectiveEnd === currentVal.length) {\n // Remplacement global complet\n combined = pastedText;\n newCursorPos = pastedText.length;\n } else {\n // Insertion ou remplacement partiel\n combined = currentVal.slice(0, effectiveStart) + pastedText + currentVal.slice(effectiveEnd);\n newCursorPos = effectiveStart + pastedText.length;\n }\n\n this.applyMask(combined, newCursorPos);\n this.checkSelection();\n }\n\n private onFocus(): void {\n this.syncGhostStyles();\n this.wrapper.classList.add('is-focused');\n // Si le focus est provoqu\u00E9 par un clic souris (mousedown en cours), on laisse\n // le geste de s\u00E9lection / positionnement de la souris se terminer librement.\n if (!this.options.disabled && !this.isMouseDown) {\n this.enforceMinCursor();\n }\n this.updateGhost(this.input.value);\n this.checkSelection();\n }\n\n private onBlur(): void {\n this.wrapper.classList.remove('is-focused', 'has-selection');\n if (this.isPasswordInput()) {\n this.history.clear();\n this.lastValue = '';\n this.lastInternalRemainingMask = '';\n this.lastTrackedValue = '';\n this.clearGhost();\n this.wrapper.removeAttribute('data-mask');\n return;\n }\n this.updateGhost(this.input.value);\n }\n\n private onClick(): void {\n if (!this.options.disabled) {\n this.enforceMinCursor();\n }\n this.history.updateCurrentCursor(this.input.selectionStart ?? 0);\n this.checkSelection();\n }\n\n private onKeyUp(e: KeyboardEvent): void {\n if (!this.options.disabled) {\n this.keyboard.handleKeyUp(e);\n }\n this.checkSelection();\n }\n\n private onSelect(): void {\n this.history.updateCurrentCursor(this.input.selectionStart ?? 0);\n this.checkSelection();\n }\n\n private onCompositionStart(): void {\n this.isComposing = true;\n }\n\n private onCompositionEnd(): void {\n this.isComposing = false;\n if (this.options.disabled) return;\n const oldCursor = this.input.selectionStart ?? this.input.value.length;\n this.applyMask(this.input.value, oldCursor);\n this.checkSelection();\n }\n\n /**\n * Emp\u00EAche strictement le curseur de se positionner avant la fin du pr\u00E9fixe statique\n * lorsqu'il n'y a PAS de s\u00E9lection active.\n * Si une s\u00E9lection est active (ex: pour copier avec Ctrl+C ou \u00E9craser avec Ctrl+A),\n * elle est pr\u00E9serv\u00E9e sans restriction.\n */\n private enforceMinCursor(): void {\n const minPos = this.engine.getPrefixLength();\n if (minPos <= 0) return;\n\n const start = this.input.selectionStart ?? 0;\n const end = this.input.selectionEnd ?? start;\n\n // Si une s\u00E9lection de texte est active (start !== end), on ne restreint JAMAIS :\n // l'utilisateur peut librement s\u00E9lectionner l'int\u00E9gralit\u00E9 du champ (incluant le pr\u00E9fixe \"+33\") pour copier.\n if (start !== end) {\n return;\n }\n\n // Curseur simple sans s\u00E9lection : repositionner apr\u00E8s le pr\u00E9fixe statique\n if (start < minPos) {\n this.input.setSelectionRange(minPos, minPos);\n }\n }\n\n // ==========================================================================\n // Pipeline de calcul et de synchronisation\n // ==========================================================================\n\n private updateGhost(formatted: string): void {\n if (!this.ghost) return;\n\n if (this.options.disabled || this.isPasswordInput()) {\n this.clearGhost();\n return;\n }\n\n const isCleanEmpty = !formatted || formatted === this.engine.getPrefix();\n if (this.shouldHideGhostForPlaceholder(isCleanEmpty)) {\n this.clearGhost();\n return;\n }\n\n const fullTemplate = this.engine.getFullMaskTemplate();\n const rest = fullTemplate.length > formatted.length\n ? fullTemplate.substring(formatted.length)\n : '';\n\n const doc = this.input.ownerDocument || document;\n const spanTyped = doc.createElement('span');\n spanTyped.className = 'mask-ghost-typed';\n spanTyped.textContent = formatted;\n\n const spanRemaining = doc.createElement('span');\n spanRemaining.className = 'mask-ghost-remaining';\n spanRemaining.textContent = rest;\n\n this.setGhostContent(spanTyped, spanRemaining);\n this.ghost.scrollLeft = this.input.scrollLeft;\n }\n\n private applyMask(rawOrPartial: string, cursorPosition: number, forceExactCursor: boolean = false): void {\n if (this.options.disabled || this.isApplyingMask) return;\n this.isApplyingMask = true;\n\n let formatted = '';\n let isCompleted = false;\n\n try {\n formatted = this.engine.format(rawOrPartial);\n const remainingMask = this.engine.getRemainingMask(formatted);\n const isPwd = this.isPasswordInput();\n\n // 1. Mise \u00E0 jour de la valeur de l'input natif\n this.input.value = formatted;\n\n // 2. Mise \u00E0 jour de data-mask et du ghost (INTERDIT sur type=\"password\" pour z\u00E9ro fuite DOM)\n if (isPwd) {\n this.lastInternalRemainingMask = '';\n this.wrapper.removeAttribute('data-mask');\n this.clearGhost();\n } else {\n this.lastInternalRemainingMask = remainingMask;\n this.wrapper.setAttribute('data-mask', remainingMask);\n this.updateGhost(formatted);\n }\n\n // 4. Calcul et restauration exacte de la position du curseur\n const minPos = this.engine.getPrefixLength();\n let safeCursor: number;\n if (forceExactCursor || this.isUndoingRedoing) {\n // Position exacte forc\u00E9e sans recalcul algorithmique\n safeCursor = Math.max(minPos, Math.min(cursorPosition, formatted.length));\n } else {\n const calculatedCursor = this.engine.mapCursorPosition(rawOrPartial, cursorPosition, formatted);\n safeCursor = Math.max(minPos, calculatedCursor);\n }\n this.input.setSelectionRange(safeCursor, safeCursor);\n\n // 5. Mise \u00E0 jour de la classe de compl\u00E9tude\n isCompleted = this.isComplete();\n this.wrapper.classList.toggle('is-complete', isCompleted);\n\n // 6. Enregistrement dans l'historique Undo/Redo si l'\u00E9tat change (d\u00E9sactiv\u00E9 et purg\u00E9 sur champ password pour s\u00E9curit\u00E9 PII)\n if (isPwd) {\n this.options.copyRaw = false;\n this.history.clear();\n } else if (!this.isUndoingRedoing) {\n this.history.push(this.getRawValue(), safeCursor);\n }\n } finally {\n this.isApplyingMask = false;\n }\n\n // 7. Notification des callbacks HORS du verrou isApplyingMask pour autoriser setMask() dynamique dans onInput / onChange\n this.checkValueChange();\n }\n\n private syncInitialValue(): void {\n const isPwd = this.isPasswordInput();\n if (this.options.disabled) {\n this.wrapper.removeAttribute('data-mask');\n this.clearGhost();\n this.lastValue = isPwd ? this.computePasswordDigest(this.input.value) : this.input.value;\n this.checkValueChange();\n return;\n }\n\n this.syncGhostStyles();\n const initialVal = this.input.value || '';\n if (initialVal) {\n this.applyMask(initialVal, initialVal.length);\n } else {\n const minPos = this.engine.getPrefixLength();\n if (minPos > 0) {\n // Pr\u00E9fixe statique fixe : initialiser le champ avec le pr\u00E9fixe\n this.applyMask('', minPos);\n } else {\n // Masque sans pr\u00E9fixe statique\n if (!isPwd) {\n this.history.push('', 0);\n const fullTemplate = this.engine.getFullMaskTemplate();\n this.lastInternalRemainingMask = fullTemplate;\n this.wrapper.setAttribute('data-mask', fullTemplate);\n this.updateGhost('');\n } else {\n this.lastInternalRemainingMask = '';\n this.wrapper.removeAttribute('data-mask');\n this.clearGhost();\n }\n this.checkValueChange();\n }\n }\n }\n\n /**\n * V\u00E9rifie si la valeur a chang\u00E9 et notifie les observateurs (onInput, onChange, onComplete).\n * G\u00E8re de mani\u00E8re s\u00FBre la r\u00E9entrance pour permettre d'appeler setMask() directement dans le callback.\n */\n public checkValueChange(forceNotify: boolean = false): void {\n const isPwd = this.isPasswordInput();\n const currentVal = this.input.value;\n const currentComparison = isPwd ? this.computePasswordDigest(currentVal) : currentVal;\n if (currentComparison === this.lastValue && !forceNotify && !this.hasPendingNotification) {\n return;\n }\n\n if (this.isNotifying) {\n this.hasPendingNotification = true;\n return;\n }\n\n this.isNotifying = true;\n try {\n let iterations = 0;\n const MAX_NOTIFICATION_ITERATIONS = 10;\n while (\n (((isPwd ? this.computePasswordDigest(this.input.value) : this.input.value) !== this.lastValue) ||\n this.hasPendingNotification ||\n forceNotify) &&\n iterations < MAX_NOTIFICATION_ITERATIONS\n ) {\n iterations++;\n this.hasPendingNotification = false;\n forceNotify = false;\n const valToNotify = this.input.value;\n this.lastValue = isPwd ? this.computePasswordDigest(valToNotify) : valToNotify;\n\n const raw = this.options.disabled ? valToNotify : this.getRawValue();\n const totalSlots = this.options.disabled ? 0 : this.engine.getEditableCount();\n const isComplete = this.isComplete();\n const detail: MaskEventDetail = {\n value: valToNotify,\n rawValue: raw,\n isComplete,\n totalSlots,\n filledSlots: this.options.disabled ? valToNotify.length : raw.length\n };\n\n const onInputCb = this.options.onInput || (this.options as any).oninput;\n if (onInputCb) {\n onInputCb(valToNotify, detail);\n }\n this.input.dispatchEvent(new CustomEvent('mask:input', { bubbles: true, detail }));\n this.dispatchNativeInput();\n\n const onChangeCb = this.options.onChange || (this.options as any).onchange;\n if (onChangeCb) {\n onChangeCb(detail);\n }\n this.input.dispatchEvent(new CustomEvent('mask:change', { bubbles: true, detail }));\n\n const onCompleteCb = this.options.onComplete || (this.options as any).oncomplete;\n if (isComplete) {\n if (onCompleteCb) {\n onCompleteCb(detail);\n }\n this.input.dispatchEvent(new CustomEvent('mask:complete', { bubbles: true, detail }));\n }\n }\n } finally {\n this.isNotifying = false;\n }\n }\n}\n", "/**\n * Options pour le moteur AmountEngine.\n */\nexport interface AmountEngineOptions {\n /** Devise ou symbole mon\u00E9taire (ex: '\u20AC', '$', 'USD') */\n currency?: string;\n /** Unit\u00E9 mon\u00E9taire ou financi\u00E8re additionnelle/alternative (ex: 'kEUR', 'k/EUR', 'm/EUR', 'M\u20AC') */\n unit?: string;\n /** Position de la devise ('prefix' ou 'suffix', d\u00E9faut: 'suffix' si '\u20AC', 'prefix' si '$'/'\u00A3') */\n currencyPosition?: 'prefix' | 'suffix';\n /** Nombre maximum de d\u00E9cimales (d\u00E9faut: 2, 0 pour montant entier) */\n decimals?: number;\n /** S\u00E9parateur de d\u00E9cimales (d\u00E9faut: ',') */\n decimalSeparator?: string;\n /** S\u00E9parateur de milliers (d\u00E9faut: ' ' espace ins\u00E9cable) */\n thousandSeparator?: string;\n /** Autorise les montants n\u00E9gatifs (d\u00E9faut: false) */\n allowNegative?: boolean;\n /** Valeur minimale autoris\u00E9e */\n min?: number;\n /** Valeur maximale autoris\u00E9e */\n max?: number;\n}\n\nexport interface AmountFormatResult {\n /** Valeur format\u00E9e affich\u00E9e (ex: \"1 234,56 \u20AC\") */\n formatted: string;\n /** Nombre flottant extrait (ou null si vide) */\n rawNumber: number | null;\n /** Cha\u00EEne num\u00E9rique pure (ex: \"1234.56\" ou \"-1234.56\") */\n rawValue: string;\n /** Position du curseur recalcul\u00E9e */\n cursor: number;\n /** Indique si le montant respecte les bornes min et max */\n isValid: boolean;\n}\n\n/**\n * R\u00E9sultat de l'analyse lexicale d'une saisie mon\u00E9taire.\n */\nexport interface AmountParseResult {\n /** Indique si le montant est n\u00E9gatif */\n isNegative: boolean;\n /** Partie enti\u00E8re normalis\u00E9e */\n integerPart: string;\n /** Partie d\u00E9cimale extraite (ou null si non renseign\u00E9e) */\n decimalPart: string | null;\n /** Indique si un s\u00E9parateur d\u00E9cimal a \u00E9t\u00E9 saisi */\n hasDecimal: boolean;\n}\n\n/**\n * Moteur algorithmique pur pour le formatage mon\u00E9taire et num\u00E9rique.\n * D\u00E9coupl\u00E9 \u00E0 100% du DOM pour une fiabilit\u00E9 et testabilit\u00E9 optimales.\n */\nexport class AmountEngine {\n public options: Required<AmountEngineOptions>;\n\n constructor(options: AmountEngineOptions = {}) {\n let currency = options.currency ?? '';\n if (!currency && options.unit) {\n currency = options.unit;\n }\n const defaultPosition: 'prefix' | 'suffix' = (currency === '$' || currency === '\u00A3' || currency === '\u00A5') ? 'prefix' : 'suffix';\n const rawDecimals = options.decimals !== undefined ? Number(options.decimals) : 2;\n const safeDecimals = Number.isFinite(rawDecimals)\n ? Math.min(20, Math.max(0, Math.floor(rawDecimals)))\n : 2;\n\n this.options = {\n currency: String(currency).slice(0, 32),\n unit: String(options.unit ?? currency).slice(0, 32),\n currencyPosition: options.currencyPosition ?? defaultPosition,\n decimals: safeDecimals,\n decimalSeparator: String(options.decimalSeparator ?? ',').slice(0, 4) || ',',\n thousandSeparator: String(options.thousandSeparator ?? '\\u00A0').slice(0, 4), // Espace ins\u00E9cable\n allowNegative: options.allowNegative ?? false,\n min: options.min ?? -Infinity,\n max: options.max ?? Infinity\n };\n }\n\n /**\n * Analyse et nettoie une saisie utilisateur pour extraire ses composantes num\u00E9riques.\n */\n public parse(input: string): AmountParseResult {\n let str = String(input ?? '').slice(0, 512).trim();\n let isNegative = false;\n\n if (this.options.allowNegative && str.includes('-')) {\n isNegative = true;\n }\n\n // Retirer la devise\n if (this.options.currency) {\n str = str.replace(new RegExp(this.escapeRegExp(this.options.currency), 'g'), '');\n }\n\n // Retirer d'abord le s\u00E9parateur de milliers pour \u00E9viter les conflits (ex: '1.250,50' avec thousandSeparator='.')\n if (this.options.thousandSeparator) {\n str = str.replace(new RegExp(this.escapeRegExp(this.options.thousandSeparator), 'g'), '');\n }\n // Nettoyer \u00E9galement les espaces ordinaires et ins\u00E9cables r\u00E9siduels\n str = str.replace(/[\\s\\u00A0]/g, '');\n\n const decSep = this.options.decimalSeparator;\n // D\u00E9tecter le s\u00E9parateur d\u00E9cimal (priorit\u00E9 au s\u00E9parateur configur\u00E9, fallback sur virgule ou point)\n let firstDecIndex = str.indexOf(decSep);\n if (firstDecIndex === -1) {\n // Si le s\u00E9parateur n'a pas \u00E9t\u00E9 trouv\u00E9, chercher le fallback point/virgule\n firstDecIndex = str.search(/[,.]/);\n }\n\n let integerRaw = '';\n let decimalRaw: string | null = null;\n let hasDecimal = false;\n\n if (firstDecIndex !== -1) {\n integerRaw = str.substring(0, firstDecIndex).replace(/\\D/g, '');\n if (this.options.decimals > 0) {\n hasDecimal = true;\n decimalRaw = str.substring(firstDecIndex + 1).replace(/\\D/g, '').slice(0, this.options.decimals);\n }\n } else {\n integerRaw = str.replace(/\\D/g, '');\n }\n\n // Supprimer les z\u00E9ros non significatifs en t\u00EAte (sauf si \"0\")\n if (integerRaw.length > 1) {\n integerRaw = integerRaw.replace(/^0+/, '') || '0';\n }\n\n return { isNegative, integerPart: integerRaw, decimalPart: decimalRaw, hasDecimal };\n }\n\n /**\n * Formate une valeur brute ou une saisie courante en pr\u00E9servant la fluidit\u00E9 du curseur.\n *\n * @param input Texte brut ou partiellement format\u00E9\n * @param rawCursor Position actuelle du curseur dans l'input natif\n */\n public format(input: string, rawCursor: number = input.length, padDecimals: boolean = false): AmountFormatResult {\n const safeInput = String(input ?? '').slice(0, 512);\n const safeRawCursor = Math.max(0, Math.min(rawCursor, safeInput.length));\n if (!safeInput || safeInput.trim() === '' || safeInput === this.options.currency.trim()) {\n return {\n formatted: '',\n rawNumber: null,\n rawValue: '',\n cursor: 0,\n isValid: true\n };\n }\n\n // D\u00E9compte des chiffres significatifs avant le curseur pour le recalage sub-pixel\n const prefixBeforeCursor = safeInput.substring(0, safeRawCursor);\n const digitsBeforeCursor = (prefixBeforeCursor.replace(/\\D/g, '')).length;\n const hadDecimalBeforeCursor = this.options.decimals > 0 && /[,.]/.test(prefixBeforeCursor);\n\n const { isNegative, integerPart, decimalPart, hasDecimal } = this.parse(safeInput);\n\n let effectiveDecimal = decimalPart;\n let effectiveHasDecimal = hasDecimal;\n if (padDecimals && this.options.decimals > 0 && (integerPart || decimalPart !== null)) {\n effectiveHasDecimal = true;\n if (effectiveDecimal === null) {\n effectiveDecimal = '0'.repeat(this.options.decimals);\n } else if (effectiveDecimal.length < this.options.decimals) {\n effectiveDecimal = effectiveDecimal + '0'.repeat(this.options.decimals - effectiveDecimal.length);\n }\n }\n\n // Cas transitoire d'une saisie n\u00E9gative en cours (l'utilisateur tape \"-\" seul)\n if (isNegative && !integerPart && !effectiveDecimal && !effectiveHasDecimal && this.options.allowNegative) {\n let formatted = '-';\n let cursor = 1;\n if (this.options.currency) {\n if (this.options.currencyPosition === 'prefix') {\n formatted = `${this.options.currency} -`;\n cursor = formatted.length;\n } else {\n formatted = `- ${this.options.currency}`;\n cursor = 1;\n }\n }\n return {\n formatted,\n rawNumber: null,\n rawValue: '-',\n cursor,\n isValid: true\n };\n }\n\n if (!integerPart && !effectiveDecimal && !effectiveHasDecimal) {\n return {\n formatted: '',\n rawNumber: null,\n rawValue: '',\n cursor: 0,\n isValid: true\n };\n }\n\n // Formatage lin\u00E9aire O(N) avec s\u00E9parateurs de milliers (sans risque de ReDoS quadratique)\n const formattedInteger = this.formatThousands(integerPart || '0');\n\n let numberCore = formattedInteger;\n if (effectiveHasDecimal && this.options.decimals > 0) {\n numberCore += this.options.decimalSeparator + (effectiveDecimal ?? '');\n }\n\n if (isNegative && numberCore !== '0') {\n numberCore = '-' + numberCore;\n }\n\n // Assemblage final avec la devise\n let formatted = numberCore;\n if (this.options.currency) {\n if (this.options.currencyPosition === 'prefix') {\n formatted = `${this.options.currency} ${numberCore}`;\n } else {\n formatted = `${numberCore} ${this.options.currency}`;\n }\n }\n\n // Calcul du rawNumber\n const numStr = (isNegative ? '-' : '') + (integerPart || '0') + (decimalPart ? '.' + decimalPart : '');\n let num = parseFloat(numStr);\n if (isNaN(num)) num = 0;\n\n const isValid = num >= this.options.min && num <= this.options.max;\n\n // Repositionnement pr\u00E9cis du curseur dans le texte format\u00E9\n let newCursor = 0;\n if (this.options.currency && this.options.currencyPosition === 'prefix') {\n newCursor = this.options.currency.length + 1; // Sauter le pr\u00E9fixe\n }\n\n let seenDigits = 0;\n let seenDecimal = false;\n let lastValidDigitPosition = newCursor;\n\n for (let i = newCursor; i < formatted.length; i++) {\n const ch = formatted[i];\n if (ch === this.options.currency.trim()[0] && this.options.currencyPosition === 'suffix') {\n // Ne pas d\u00E9passer le d\u00E9but du suffixe devise\n break;\n }\n if (/\\d/.test(ch)) {\n seenDigits++;\n lastValidDigitPosition = i + 1;\n } else if (ch === this.options.decimalSeparator) {\n seenDecimal = true;\n lastValidDigitPosition = i + 1;\n }\n\n if (hadDecimalBeforeCursor) {\n if (seenDecimal && seenDigits >= digitsBeforeCursor) {\n newCursor = i + 1;\n break;\n }\n } else {\n if (seenDigits >= digitsBeforeCursor) {\n newCursor = i + 1;\n break;\n }\n }\n }\n\n // Si l'utilisateur a tap\u00E9 des chiffres au-del\u00E0 de la limite d\u00E9cimale ou si la boucle\n // a rencontr\u00E9 le suffixe avant d'atteindre digitsBeforeCursor, NE PAS renvoyer le curseur \u00E0 0 !\n // Le positionner sur le dernier chiffre/s\u00E9parateur valide.\n if (digitsBeforeCursor > 0 && seenDigits < digitsBeforeCursor && lastValidDigitPosition > newCursor) {\n newCursor = lastValidDigitPosition;\n }\n\n // Ajustement de s\u00E9curit\u00E9 sur les limites du champ\n const minCursor = (this.options.currency && this.options.currencyPosition === 'prefix')\n ? this.options.currency.length + 1\n : 0;\n\n const maxCursor = (this.options.currency && this.options.currencyPosition === 'suffix')\n ? Math.max(0, formatted.length - this.options.currency.length - 1)\n : formatted.length;\n\n newCursor = Math.max(minCursor, Math.min(newCursor, Math.max(minCursor, maxCursor)));\n\n return {\n formatted,\n rawNumber: num,\n rawValue: numStr,\n cursor: newCursor,\n isValid\n };\n }\n\n /**\n * Formate statiquement un nombre ou une cha\u00EEne num\u00E9rique.\n */\n public static format(value: number | string, options: AmountEngineOptions = {}): string {\n const engine = new AmountEngine(options);\n const str = typeof value === 'number' ? value.toString() : value;\n return engine.format(str).formatted;\n }\n\n private formatThousands(digits: string): string {\n const sep = this.options.thousandSeparator;\n if (!sep || digits.length <= 3) return digits;\n const parts: string[] = [];\n let i = digits.length;\n while (i > 0) {\n const start = Math.max(0, i - 3);\n parts.push(digits.slice(start, i));\n i = start;\n }\n return parts.reverse().join(sep);\n }\n\n private escapeRegExp(string: string): string {\n return string.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&');\n }\n}\n", "import { AmountEngine, AmountEngineOptions, AmountFormatResult } from './AmountEngine';\nimport { MaskHistory } from './MaskHistory';\nimport { BaseInputMask, resolveMaskConstructorArgs } from './BaseInputMask';\nimport { BaseMaskOptions, IInputMask } from './types';\nimport { isImeComposing } from '../common/dom';\n\nexport interface AmountMaskDetail {\n /** Valeur format\u00E9e affich\u00E9e (ex: \"1 250,50 \u20AC\") */\n value: string;\n /** Nombre extrait sous forme de float (ex: 1250.5) ou null si vide */\n number: number | null;\n /** Cha\u00EEne num\u00E9rique pure (ex: \"1250.50\") */\n rawValue: string;\n /** Indique si le montant est dans les bornes autoris\u00E9es min/max */\n isValid: boolean;\n}\n\nexport interface AmountMaskOptions extends AmountEngineOptions, BaseMaskOptions {\n /** Alignement textuel du champ mon\u00E9taire (d\u00E9faut: 'right' pour \u00E9liminer la gigue visuelle des chiffres) */\n align?: 'left' | 'right' | 'center';\n /** Compl\u00E8te automatiquement les d\u00E9cimales au blur avec des z\u00E9ros si non saisies (ex: \"12 \u20AC\" -> \"12,00 \u20AC\") (d\u00E9faut: false) */\n padDecimalsOnBlur?: boolean;\n /** Callback d\u00E9clench\u00E9 \u00E0 chaque saisie ou modification */\n onInput?: (detail: AmountMaskDetail) => void;\n /** Callback d\u00E9clench\u00E9 lors du commit (change) */\n onChange?: (detail: AmountMaskDetail) => void;\n}\n\n/**\n * Contr\u00F4leur DOM InputAmountMask.\n * Extension autonome d\u00E9di\u00E9e aux montants, devises et quantit\u00E9s \u00E9lastiques.\n * Respecte \u00E0 100% l'axiome du confort absolu de frappe de l'utilisateur.\n */\nexport class InputAmountMask extends BaseInputMask<AmountMaskOptions> implements IInputMask<AmountMaskOptions> {\n public engine: AmountEngine;\n public history: MaskHistory;\n\n private isUndoingRedoing: boolean = false;\n private isApplying: boolean = false;\n private isComposing: boolean = false;\n private lastValue: string = '';\n private wasInputModeInferred: boolean = false;\n private cutTimerId: number | null = null;\n private resetTimerId: number | null = null;\n private cursorTimerId: number | null = null;\n\n constructor(input: HTMLInputElement, options?: AmountMaskOptions);\n constructor(wrapper: HTMLElement | null, input: HTMLInputElement, options?: AmountMaskOptions);\n constructor(\n targetOrWrapper: HTMLElement | HTMLInputElement | null | undefined,\n inputOrOptions?: HTMLInputElement | AmountMaskOptions,\n options?: AmountMaskOptions\n );\n constructor(\n targetOrWrapper: HTMLElement | HTMLInputElement | null | undefined,\n inputOrOptions?: HTMLInputElement | AmountMaskOptions,\n options?: AmountMaskOptions\n ) {\n const args = resolveMaskConstructorArgs<AmountMaskOptions>(targetOrWrapper, inputOrOptions, options);\n const wrap = args.wrapper;\n const inp = args.input;\n const opts = args.options;\n\n const dataPad = wrap?.getAttribute('data-mask-pad-decimals') === 'true' || inp?.getAttribute('data-mask-pad-decimals') === 'true';\n const dataAlign = inp?.getAttribute('data-mask-align') || inp?.getAttribute('data-align') || wrap?.getAttribute('data-mask-align') || wrap?.getAttribute('data-align');\n const resolvedOptions: AmountMaskOptions = {\n align: opts.align ?? (dataAlign as 'left' | 'right' | 'center') ?? 'right',\n padDecimalsOnBlur: opts.padDecimalsOnBlur ?? dataPad ?? false,\n ...opts\n };\n\n super(wrap, inp, resolvedOptions);\n\n // Clavier mobile adapt\u00E9 pour la saisie d\u00E9cimale fluide (r\u00E9versible si non d\u00E9fini par l'h\u00F4te)\n if (!this.input.hasAttribute('inputmode')) {\n this.input.inputMode = 'decimal';\n this.wasInputModeInferred = true;\n }\n\n this.history = new MaskHistory();\n this.engine = new AmountEngine(this.options);\n\n this.bindEvents();\n\n // Initialiser la valeur de d\u00E9part\n if (this.input.value) {\n if (!this.options.disabled) {\n this.applyAmount(this.input.value, this.input.value.length);\n }\n } else {\n this.updateGhost({\n formatted: '',\n rawNumber: null,\n rawValue: '',\n cursor: 0,\n isValid: true\n });\n }\n\n this.runAuditWarning(this.options.audit);\n }\n\n protected override extractRawSnippet(snippet: string): string {\n const p = this.engine.parse(snippet);\n if (!p.integerPart && !p.decimalPart) return '';\n return (p.isNegative ? '-' : '') + (p.integerPart || '0') + (p.decimalPart ? '.' + p.decimalPart : '');\n }\n\n protected override onPasswordModeDetected(): void {\n this.history.clear();\n this.lastValue = '';\n this.lastTrackedValue = '';\n this.clearGhost();\n }\n\n /**\n * Formate statiquement une valeur sans n\u00E9cessiter d'\u00E9l\u00E9ment DOM.\n */\n public static format(value: number | string, options: AmountEngineOptions = {}): string {\n return AmountEngine.format(value, options);\n }\n\n protected onNativeValueSet(strVal: string): void {\n if (this.options.disabled || this.isComposing) {\n this.lastValue = strVal;\n return;\n }\n this.applyAmount(strVal, strVal.length);\n }\n\n protected onDisabledChange(disabled: boolean): void {\n if (disabled) {\n this.clearGhost();\n } else {\n this.applyAmount(this.input.value, this.input.selectionStart ?? this.input.value.length);\n }\n }\n\n private bindEvents(): void {\n this.handleInput = this.handleInput.bind(this);\n this.handleKeyDown = this.handleKeyDown.bind(this);\n this.handleBlur = this.handleBlur.bind(this);\n this.handleFocus = this.handleFocus.bind(this);\n this.handleClick = this.handleClick.bind(this);\n this.onCompositionStart = this.onCompositionStart.bind(this);\n this.onCompositionEnd = this.onCompositionEnd.bind(this);\n\n this.onCutHandler = () => {\n if (this.cutTimerId !== null) {\n clearTimeout(this.cutTimerId);\n }\n this.cutTimerId = window.setTimeout(() => {\n this.cutTimerId = null;\n if (this.isDestroyed || this.options.disabled) return;\n const cur = this.input.selectionStart ?? this.input.value.length;\n this.applyAmount(this.input.value, cur);\n }, 0);\n };\n\n const { signal } = this.abortController;\n this.input.addEventListener('input', this.handleInput, { signal });\n this.input.addEventListener('keydown', this.handleKeyDown, { signal });\n this.input.addEventListener('blur', this.handleBlur, { signal });\n this.input.addEventListener('focus', this.handleFocus, { signal });\n this.input.addEventListener('click', this.handleClick, { signal });\n this.input.addEventListener('scroll', this.onScroll, { passive: true, signal });\n this.input.addEventListener('cut', this.onCutHandler, { signal });\n this.input.addEventListener('compositionstart', this.onCompositionStart, { signal });\n this.input.addEventListener('compositionend', this.onCompositionEnd, { signal });\n\n if (this.input.form) {\n this.onFormResetHandler = () => {\n if (this.resetTimerId !== null) {\n clearTimeout(this.resetTimerId);\n }\n this.resetTimerId = window.setTimeout(() => {\n this.resetTimerId = null;\n if (this.isDestroyed) return;\n if (this.options.disabled) return;\n this.applyAmount(this.input.value, this.input.value.length);\n }, 0);\n };\n this.input.form.addEventListener('reset', this.onFormResetHandler, { signal });\n }\n }\n\n private onCompositionStart(): void {\n this.isComposing = true;\n }\n\n private onCompositionEnd(): void {\n this.isComposing = false;\n if (this.options.disabled) return;\n const cur = this.input.selectionStart ?? this.input.value.length;\n this.applyAmount(this.input.value, cur);\n }\n\n private applyAmount(val: string, cursor: number): void {\n if (this.isApplying || this.options.disabled) return;\n this.isApplying = true;\n\n try {\n const result: AmountFormatResult = this.engine.format(val, cursor);\n this.setNativeValue(result.formatted);\n this.input.setSelectionRange(result.cursor, result.cursor);\n\n const isPwd = this.isPasswordInput();\n if (isPwd) {\n this.options.copyRaw = false;\n this.history.clear();\n this.clearGhost();\n } else {\n if (!this.isUndoingRedoing) {\n this.history.push(result.rawValue, result.cursor);\n }\n this.updateGhost(result);\n }\n\n const nextComparison = isPwd ? this.computePasswordDigest(result.formatted) : result.formatted;\n if (this.lastValue !== nextComparison) {\n this.lastValue = nextComparison;\n this.notifyChange(result);\n }\n } finally {\n this.isApplying = false;\n }\n }\n\n private updateGhost(result: AmountFormatResult): void {\n if (!this.ghost) return;\n\n if (!result.formatted) {\n if (this.shouldHideGhostForPlaceholder(true)) {\n this.clearGhost();\n return;\n }\n // Afficher un indice ou symbole en filigrane si vide\n const hint = this.options.currency\n ? (this.options.currencyPosition === 'prefix' ? `${this.options.currency} 0` : `0 ${this.options.currency}`)\n : '0,00';\n const doc = this.input.ownerDocument || document;\n const span = doc.createElement('span');\n span.className = 'mask-ghost-remaining';\n span.textContent = hint;\n this.setGhostContent(span);\n return;\n }\n\n this.clearGhost();\n this.ghost.scrollLeft = this.input.scrollLeft;\n }\n\n private handleInput(): void {\n if (this.isDispatchingNativeInput) return;\n if (this.options.disabled || this.isComposing) return;\n const rawVal = this.input.value;\n const cur = this.input.selectionStart ?? rawVal.length;\n this.applyAmount(rawVal, cur);\n }\n\n private handleKeyDown(e: KeyboardEvent): void {\n if (this.options.disabled || isImeComposing(e)) return;\n\n // Gestion Undo / Redo (Ctrl+Z / Ctrl+Y)\n if ((e.ctrlKey || e.metaKey) && (e.key === 'z' || e.key === 'Z')) {\n e.preventDefault();\n if (e.shiftKey) this.redo();\n else this.undo();\n return;\n }\n if ((e.ctrlKey || e.metaKey) && (e.key === 'y' || e.key === 'Y')) {\n e.preventDefault();\n this.redo();\n return;\n }\n\n // Gestion ergonomique de la touche Backspace\n if (e.key === 'Backspace') {\n const start = this.input.selectionStart ?? 0;\n const end = this.input.selectionEnd ?? 0;\n\n if (start === end && start > 0) {\n const val = this.input.value;\n const charToDelete = val[start - 1];\n\n // Si l'utilisateur est sur le s\u00E9parateur de milliers ou un espace,\n // effacer directement le chiffre qui le pr\u00E9c\u00E8de sans le bloquer\n if (charToDelete === this.engine.options.thousandSeparator || charToDelete === ' ') {\n e.preventDefault();\n const targetIndex = Math.max(0, start - 2);\n const newVal = val.slice(0, targetIndex) + val.slice(start);\n this.applyAmount(newVal, targetIndex);\n return;\n }\n\n // Si on tente d'effacer le pr\u00E9fixe devise, emp\u00EAcher\n if (this.options.currency && this.options.currencyPosition === 'prefix' && start <= this.options.currency.length + 1) {\n e.preventDefault();\n return;\n }\n }\n }\n\n // Gestion ergonomique de la touche Delete (Suppr)\n if (e.key === 'Delete') {\n const start = this.input.selectionStart ?? 0;\n const end = this.input.selectionEnd ?? 0;\n\n if (start === end && start < this.input.value.length) {\n const val = this.input.value;\n const charAhead = val[start];\n\n // Si le caract\u00E8re devant le curseur est un s\u00E9parateur de milliers ou un espace,\n // effacer le chiffre suivant directement pour \u00E9viter l'effet \"touche bloqu\u00E9e\"\n if (charAhead === this.engine.options.thousandSeparator || charAhead === ' ') {\n e.preventDefault();\n const newVal = val.slice(0, start) + val.slice(start + 2);\n this.applyAmount(newVal, start);\n return;\n }\n\n // Si le curseur est au d\u00E9but du suffixe devise, emp\u00EAcher\n if (this.options.currency && this.options.currencyPosition === 'suffix') {\n const suffixStart = val.length - this.options.currency.length - 1;\n if (start >= suffixStart) {\n e.preventDefault();\n return;\n }\n }\n }\n }\n\n // Protection curseur uniquement sur touches de direction (jamais sur Tab)\n if (e.key === 'ArrowLeft' || e.key === 'ArrowRight' || e.key === 'Home' || e.key === 'End') {\n if (this.cursorTimerId !== null) {\n clearTimeout(this.cursorTimerId);\n }\n this.cursorTimerId = window.setTimeout(() => {\n this.cursorTimerId = null;\n this.enforceCursorBounds();\n }, 0);\n }\n }\n\n private enforceCursorBounds(): void {\n if (this.isDestroyed || !this.isFocused || document.activeElement !== this.input || !this.input.value || this.options.disabled) return;\n const start = this.input.selectionStart ?? 0;\n const end = this.input.selectionEnd ?? 0;\n if (start !== end) return; // Laisser les s\u00E9lections libres\n\n const val = this.input.value;\n const currency = this.options.currency;\n\n if (currency) {\n if (this.options.currencyPosition === 'prefix') {\n const minPos = currency.length + 1;\n if (start < minPos) {\n this.input.setSelectionRange(minPos, minPos);\n }\n } else if (this.options.currencyPosition === 'suffix') {\n const maxPos = Math.max(0, val.length - currency.length - 1);\n if (start > maxPos) {\n this.input.setSelectionRange(maxPos, maxPos);\n }\n }\n }\n }\n\n private handleClick(): void {\n this.enforceCursorBounds();\n }\n\n private handleFocus(): void {\n this.wrapper.classList.add('is-focused');\n this.syncGhostStyles();\n this.enforceCursorBounds();\n this.updateGhost(this.engine.format(this.input.value));\n }\n\n private handleBlur(): void {\n this.wrapper.classList.remove('is-focused');\n if (this.isPasswordInput()) {\n this.history.clear();\n this.lastValue = '';\n this.lastTrackedValue = '';\n this.clearGhost();\n return;\n }\n\n if (this.options.padDecimalsOnBlur && !this.options.disabled && this.input.value.trim().length > 0) {\n const paddedResult = this.engine.format(this.input.value, this.input.value.length, true);\n if (paddedResult.formatted !== this.input.value) {\n this.setNativeValue(paddedResult.formatted);\n this.lastValue = paddedResult.formatted;\n }\n }\n\n this.updateGhost(this.engine.format(this.input.value));\n\n const detail = this.getDetail();\n if (this.options.onChange) {\n this.options.onChange(detail);\n }\n this.input.dispatchEvent(new CustomEvent('mask:change', { bubbles: true, detail }));\n }\n\n protected override handleAttributeMutation(attrName: string): void {\n super.handleAttributeMutation(attrName);\n if (attrName === 'data-mask-pad-decimals') {\n this.options.padDecimalsOnBlur = this.getAttr('data-mask-pad-decimals') === 'true';\n } else if (attrName === 'placeholder') {\n this.updateGhost(this.engine.format(this.input.value));\n }\n }\n\n private notifyChange(result: AmountFormatResult): void {\n const detail: AmountMaskDetail = {\n value: result.formatted,\n number: result.rawNumber,\n rawValue: result.rawValue,\n isValid: result.isValid\n };\n\n if (this.options.onInput) {\n this.options.onInput(detail);\n }\n\n this.input.dispatchEvent(new CustomEvent('mask:input', { bubbles: true, detail }));\n this.dispatchNativeInput();\n }\n\n public undo(): void {\n const state = this.history.undo();\n if (state) {\n this.isUndoingRedoing = true;\n try {\n this.applyAmount(state.raw, state.cursor);\n } finally {\n this.isUndoingRedoing = false;\n }\n }\n }\n\n public redo(): void {\n const state = this.history.redo();\n if (state) {\n this.isUndoingRedoing = true;\n try {\n this.applyAmount(state.raw, state.cursor);\n } finally {\n this.isUndoingRedoing = false;\n }\n }\n }\n\n public getDetail(): AmountMaskDetail {\n const parsed = this.engine.format(this.input.value);\n return {\n value: parsed.formatted,\n number: parsed.rawNumber,\n rawValue: parsed.rawValue,\n isValid: parsed.isValid\n };\n }\n\n public getNumber(): number | null {\n return this.getDetail().number;\n }\n\n public override getRawValue(): string {\n return this.getDetail().rawValue;\n }\n\n public isValid(): boolean {\n return this.getDetail().isValid;\n }\n\n public override setValue(val: number | string): void {\n const str = val !== null && val !== undefined ? String(val) : '';\n if (this.options.disabled) {\n this.setNativeValue(str);\n this.lastValue = str;\n } else {\n this.applyAmount(str, str.length);\n }\n }\n\n public override destroy(): void {\n if (this.isDestroyed) return;\n\n if (this.cutTimerId !== null) {\n clearTimeout(this.cutTimerId);\n this.cutTimerId = null;\n }\n if (this.resetTimerId !== null) {\n clearTimeout(this.resetTimerId);\n this.resetTimerId = null;\n }\n if (this.cursorTimerId !== null) {\n clearTimeout(this.cursorTimerId);\n this.cursorTimerId = null;\n }\n if (this.wasInputModeInferred && this.input.getAttribute('inputmode') === 'decimal') {\n this.input.removeAttribute('inputmode');\n }\n\n this.lastValue = '';\n this.history.clear();\n super.destroy();\n }\n}\n", "export interface EmailEngineOptions {\n /** Liste de noms de domaines propos\u00E9s par ordre de priorit\u00E9 */\n domains?: string[];\n /** Sugg\u00E8re le premier domaine par d\u00E9faut d\u00E8s la saisie du caract\u00E8re '@' (d\u00E9faut: true) */\n suggestOnAt?: boolean;\n /** Domaine par d\u00E9faut sugg\u00E9r\u00E9 avant m\u00EAme la saisie du '@' (ex: 'gmail.com', ou true pour le 1er domaine). D\u00E9faut: null */\n defaultDomain?: string | boolean | null;\n /** Liste des extensions de domaine (TLD) connues propos\u00E9es par ordre de priorit\u00E9 lorsqu'un domaine personnalis\u00E9 est saisi */\n tlds?: string[];\n /** Extension (TLD) ou gabarit par d\u00E9faut sugg\u00E9r\u00E9 pour un domaine inconnu (ex: 'fr', 'com', '__', ou true pour le 1er TLD, ou null/false pour d\u00E9sactiver). D\u00E9faut: '__' */\n defaultTld?: string | boolean | null;\n}\n\nexport interface EmailSuggestionResult {\n /** Texte complet comprenant la saisie et la compl\u00E9tion sugg\u00E9r\u00E9e */\n full: string;\n /** Partie restante sugg\u00E9r\u00E9e affich\u00E9e dans le conteneur fant\u00F4me */\n remaining: string;\n /** Nom de domaine complet correspondant (ou null si aucune correspondance) */\n matchedDomain: string | null;\n /** Indique si le texte fant\u00F4me est uniquement un indice visuel de structure (ex: '.__') non compl\u00E9table via Tab/Entr\u00E9e */\n isHintOnly?: boolean;\n}\n\n/**\n * Moteur algorithmique pur pour la pr\u00E9diction et l'assistance de saisie d'emails.\n * D\u00E9coupl\u00E9 du DOM, respecte \u00E0 100% la libert\u00E9 de saisie sans contrainte bloquante.\n */\nexport class EmailEngine {\n public domains: string[];\n public tlds: string[];\n public suggestOnAt: boolean;\n public defaultDomain: string | null = null;\n public defaultTld: string | null = '__';\n\n public static readonly DEFAULT_DOMAINS = [\n 'gmail.com',\n 'outlook.com',\n 'orange.fr',\n 'free.fr',\n 'sfr.fr',\n 'yahoo.com',\n 'hotmail.com',\n 'icloud.com',\n 'laposte.net',\n 'proton.me'\n ];\n\n public static readonly DEFAULT_TLDS = [\n 'com',\n 'fr',\n 'net',\n 'org',\n 'eu',\n 'io',\n 'co',\n 'info',\n 'biz',\n 'me',\n 'tv',\n 'fi',\n 'be',\n 'ch',\n 'ca',\n 'uk',\n 'de',\n 'es',\n 'it'\n ];\n\n constructor(options: EmailEngineOptions = {}) {\n this.domains = options.domains && options.domains.length > 0\n ? options.domains\n : EmailEngine.DEFAULT_DOMAINS;\n this.tlds = options.tlds && options.tlds.length > 0\n ? options.tlds.slice(0, 200).map(t => String(t).trim().replace(/^\\./, '').slice(0, 32)).filter(Boolean)\n : [...EmailEngine.DEFAULT_TLDS];\n this.suggestOnAt = options.suggestOnAt ?? true;\n this.setDefaultDomain(options.defaultDomain ?? null);\n this.setDefaultTld(options.defaultTld !== undefined ? options.defaultTld : '__');\n }\n\n /**\n * D\u00E9finit ou modifie le domaine sugg\u00E9r\u00E9 par d\u00E9faut.\n */\n public setDefaultDomain(domain: string | boolean | null): void {\n if (domain === true) {\n this.defaultDomain = this.domains.length > 0 ? this.domains[0] : null;\n } else if (typeof domain === 'string' && domain.trim().length > 0) {\n this.defaultDomain = domain.trim().replace(/^@/, '');\n } else {\n this.defaultDomain = null;\n }\n }\n\n /**\n * D\u00E9finit ou modifie l'extension (TLD) ou gabarit sugg\u00E9r\u00E9 par d\u00E9faut sur un domaine inconnu.\n */\n public setDefaultTld(tld: string | boolean | null): void {\n if (tld === true) {\n this.defaultTld = this.tlds.length > 0 ? this.tlds[0] : null;\n } else if (typeof tld === 'string' && tld.trim().length > 0) {\n this.defaultTld = tld.trim().replace(/^\\./, '');\n } else {\n this.defaultTld = null;\n }\n }\n\n /**\n * D\u00E9finit ou modifie la liste des extensions (TLD) propos\u00E9es par ordre de priorit\u00E9.\n */\n public setTlds(tlds: string[] | null): void {\n this.tlds = tlds && tlds.length > 0\n ? tlds.slice(0, 200).map(t => String(t).trim().replace(/^\\./, '').slice(0, 32)).filter(Boolean)\n : [...EmailEngine.DEFAULT_TLDS];\n }\n\n /**\n * Retourne l'ensemble des extensions (TLD) correspondant au fragment saisi apr\u00E8s le dernier point,\n * dans l'ordre exact fourni par l'utilisateur.\n */\n public getMatchingTlds(tldInput: string): string[] {\n const query = (tldInput ?? '').toLowerCase();\n if (query.length === 0) {\n return [...this.tlds];\n }\n return this.tlds.filter(t => t.toLowerCase().startsWith(query) && t.toLowerCase() !== query);\n }\n\n /**\n * Retourne l'ensemble des domaines correspondant \u00E0 la saisie courante.\n */\n public getMatchingDomains(input: string): string[] {\n const val = String(input ?? '').slice(0, 512);\n if (!val.includes('@')) {\n return this.defaultDomain ? [this.defaultDomain] : [];\n }\n\n const atIndex = val.indexOf('@');\n if (val.indexOf('@', atIndex + 1) !== -1) {\n return [];\n }\n\n const domainPart = val.substring(atIndex + 1);\n if (domainPart.length === 0) {\n return this.suggestOnAt ? [...this.domains] : [];\n }\n\n const query = domainPart.toLowerCase();\n return this.domains.filter(d => d.toLowerCase().startsWith(query) && d.toLowerCase() !== query);\n }\n\n /**\n * Analyse la saisie courante et calcule la suggestion de domaine ou d'extension (TLD) adapt\u00E9e.\n *\n * @param input Saisie utilisateur\n * @param matchIndex Index de la suggestion \u00E0 s\u00E9lectionner si plusieurs domaines/TLD correspondent (permet le cyclage)\n */\n public getSuggestion(input: string, matchIndex: number = 0): EmailSuggestionResult {\n const val = String(input ?? '').slice(0, 512);\n\n if (!val.includes('@')) {\n if (this.defaultDomain) {\n return {\n full: val ? `${val}@${this.defaultDomain}` : `@${this.defaultDomain}`,\n remaining: `@${this.defaultDomain}`,\n matchedDomain: this.defaultDomain,\n isHintOnly: false\n };\n }\n return { full: val, remaining: '', matchedDomain: null, isHintOnly: false };\n }\n\n const atIndex = val.indexOf('@');\n const localPart = val.substring(0, atIndex);\n const domainPart = val.substring(atIndex + 1);\n\n // Si plusieurs '@', pas de suggestion pour ne pas perturber la correction\n if (val.indexOf('@', atIndex + 1) !== -1) {\n return { full: val, remaining: '', matchedDomain: null, isHintOnly: false };\n }\n\n const matches = this.getMatchingDomains(input);\n if (matches.length > 0) {\n const safeIndex = ((matchIndex % matches.length) + matches.length) % matches.length;\n const matched = matches[safeIndex];\n\n const query = domainPart.toLowerCase();\n const remaining = matched.substring(query.length);\n\n return {\n full: `${localPart}@${matched}`,\n remaining,\n matchedDomain: matched,\n isHintOnly: false\n };\n }\n\n // Si aucun domaine complet ne correspond (ou qu'il a d\u00E9j\u00E0 \u00E9t\u00E9 enti\u00E8rement tap\u00E9)\n if (domainPart.length === 0 || domainPart.startsWith('.')) {\n return { full: val, remaining: '', matchedDomain: null, isHintOnly: false };\n }\n\n const lowerDomain = domainPart.toLowerCase();\n // Si le domaine saisi correspond exactement \u00E0 un domaine connu complet (ex: 'gmail.com'), aucune suggestion suppl\u00E9mentaire\n if (this.domains.some(d => d.toLowerCase() === lowerDomain)) {\n return { full: val, remaining: '', matchedDomain: domainPart, isHintOnly: false };\n }\n\n const lastDotIndex = domainPart.lastIndexOf('.');\n\n // Cas 1 : Le nom de domaine personnalis\u00E9 ne contient pas encore de point (ex: 'maxime.porte@poul')\n if (lastDotIndex === -1) {\n if (!this.defaultTld) {\n return { full: val, remaining: '', matchedDomain: null, isHintOnly: false };\n }\n const isHint = this.defaultTld.includes('_');\n const remaining = `.${this.defaultTld}`;\n const fullDomain = `${domainPart}.${this.defaultTld}`;\n return {\n full: isHint ? val : `${localPart}@${fullDomain}`,\n remaining,\n matchedDomain: isHint ? null : fullDomain,\n isHintOnly: isHint\n };\n }\n\n // Cas 2 : Un point a \u00E9t\u00E9 saisi dans le domaine personnalis\u00E9 (ex: 'maxime.porte@poul.' ou 'maxime.porte@poul.f')\n const hostPart = domainPart.substring(0, lastDotIndex);\n const tldPart = domainPart.substring(lastDotIndex + 1);\n\n if (!hostPart || hostPart.endsWith('.')) {\n return { full: val, remaining: '', matchedDomain: null, isHintOnly: false };\n }\n\n // Sous-cas 2a : Juste apr\u00E8s le point ('maxime.porte@poul.')\n if (tldPart.length === 0) {\n if (this.defaultTld && !this.defaultTld.includes('_')) {\n const fullDomain = `${hostPart}.${this.defaultTld}`;\n return {\n full: `${localPart}@${fullDomain}`,\n remaining: this.defaultTld,\n matchedDomain: fullDomain,\n isHintOnly: false\n };\n }\n if (this.defaultTld && this.defaultTld.includes('_')) {\n return {\n full: val,\n remaining: this.defaultTld,\n matchedDomain: null,\n isHintOnly: true\n };\n }\n return { full: val, remaining: '', matchedDomain: null, isHintOnly: false };\n }\n\n // Sous-cas 2b : Des lettres d'extension sont saisies apr\u00E8s le point ('maxime.porte@poul.f')\n const lowerTld = tldPart.toLowerCase();\n // Si l'extension saisie correspond d\u00E9j\u00E0 exactement \u00E0 un TLD connu (ex: '.co', '.fr'), ne pas \u00E9craser en '.com'\n if (this.tlds.some(t => t.toLowerCase() === lowerTld)) {\n return { full: val, remaining: '', matchedDomain: domainPart, isHintOnly: false };\n }\n\n const matchingTlds = this.getMatchingTlds(tldPart);\n if (matchingTlds.length > 0) {\n const safeTldIndex = ((matchIndex % matchingTlds.length) + matchingTlds.length) % matchingTlds.length;\n const matchedTld = matchingTlds[safeTldIndex];\n const remaining = matchedTld.substring(lowerTld.length);\n const fullDomain = `${hostPart}.${matchedTld}`;\n\n return {\n full: `${localPart}@${fullDomain}`,\n remaining,\n matchedDomain: fullDomain,\n isHintOnly: false\n };\n }\n\n // Sous-cas 2c : Aucun TLD connu ne correspond, mais l'extension fait moins de 2 caract\u00E8res (ex: '@poul.x')\n // Si defaultTld est un gabarit (ex: '__'), on affiche le caract\u00E8re '_' restant en indice visuel\n if (this.defaultTld && this.defaultTld.includes('_') && tldPart.length < this.defaultTld.length) {\n const remaining = this.defaultTld.substring(tldPart.length);\n if (remaining.includes('_')) {\n return {\n full: val,\n remaining,\n matchedDomain: null,\n isHintOnly: true\n };\n }\n }\n\n return { full: val, remaining: '', matchedDomain: null, isHintOnly: false };\n }\n }\n", "import { EmailEngine, EmailEngineOptions, EmailSuggestionResult } from './EmailEngine';\nimport { BaseInputMask, resolveMaskConstructorArgs } from './BaseInputMask';\nimport { BaseMaskOptions, IInputMask } from './types';\nimport { isImeComposing } from '../common/dom';\n\nexport interface EmailMaskDetail {\n /** Valeur actuelle dans l'input */\n value: string;\n /** Suggestion compl\u00E8te disponible (ou cha\u00EEne vide si aucune) */\n suggestedValue: string;\n /** Domaine compl\u00E9t\u00E9 (ou null si aucun) */\n domain: string | null;\n}\n\nexport interface EmailMaskOptions extends EmailEngineOptions, BaseMaskOptions {\n /** Permet la validation/acceptation de la suggestion par la touche Tab (d\u00E9faut: true) */\n completeOnTab?: boolean;\n /** Permet la validation/acceptation de la suggestion par la fl\u00E8che droite en bout de champ (d\u00E9faut: true) */\n completeOnArrowRight?: boolean;\n /** Permet la validation/acceptation de la suggestion par la touche Entr\u00E9e (d\u00E9faut: true) */\n completeOnEnter?: boolean;\n /** Permet de cycler dans les suggestions de domaines avec les fl\u00E8ches Haut/Bas (d\u00E9faut: false) */\n cycleSuggestions?: boolean;\n /** Force la conversion en minuscules de l'adresse email tap\u00E9e (d\u00E9faut: false) */\n autoLowercase?: boolean;\n /** Applique l'attribut standard ARIA aria-autocomplete=\"inline\" sur l'input natif pour les technologies d'assistance (d\u00E9faut: true) */\n setAriaAutocomplete?: boolean;\n /** Callback d\u00E9clench\u00E9 \u00E0 chaque modification */\n onInput?: (detail: EmailMaskDetail) => void;\n /** Callback d\u00E9clench\u00E9 lors de la validation ou du blur */\n onChange?: (detail: EmailMaskDetail) => void;\n}\n\n/**\n * Contr\u00F4leur DOM InputEmailMask.\n * Extension d'assistance pr\u00E9dictive par ghosting sans jamais contraindre ni bloquer la frappe.\n * Le confort et la fluidit\u00E9 de l'utilisateur sont pr\u00E9serv\u00E9s \u00E0 100%.\n */\nexport class InputEmailMask extends BaseInputMask<EmailMaskOptions> implements IInputMask<EmailMaskOptions> {\n public engine: EmailEngine;\n private currentSuggestion: EmailSuggestionResult = { full: '', remaining: '', matchedDomain: null };\n private currentSuggestionIndex: number = 0;\n private wasAriaAutocompleteSet: boolean = false;\n private wasAutocorrectSet: boolean = false;\n private wasAutocapitalizeSet: boolean = false;\n private wasSpellcheckSet: boolean = false;\n private wasInputModeInferred: boolean = false;\n private isComposing: boolean = false;\n private lastNotifiedValue: string = '';\n private srStatusEl: HTMLElement | null = null;\n private srAnnounceTimerId: number | null = null;\n private lastAnnouncedSuggestion: string = '';\n private cutTimerId: number | null = null;\n private resetTimerId: number | null = null;\n\n constructor(input: HTMLInputElement, options?: EmailMaskOptions);\n constructor(wrapper: HTMLElement | null, input: HTMLInputElement, options?: EmailMaskOptions);\n constructor(\n targetOrWrapper: HTMLElement | HTMLInputElement | null | undefined,\n inputOrOptions?: HTMLInputElement | EmailMaskOptions,\n options?: EmailMaskOptions\n );\n constructor(\n targetOrWrapper: HTMLElement | HTMLInputElement | null | undefined,\n inputOrOptions?: HTMLInputElement | EmailMaskOptions,\n options?: EmailMaskOptions\n ) {\n const args = resolveMaskConstructorArgs<EmailMaskOptions>(targetOrWrapper, inputOrOptions, options);\n const wrap = args.wrapper;\n const inp = args.input;\n const opts = args.options;\n\n const dataCycle = wrap?.getAttribute('data-mask-cycle-suggestions') === 'true' || inp?.getAttribute('data-mask-cycle-suggestions') === 'true';\n const dataAutoLower = wrap?.getAttribute('data-mask-auto-lowercase') === 'true' || inp?.getAttribute('data-mask-auto-lowercase') === 'true';\n const dataAriaAuto = wrap?.getAttribute('data-mask-aria-autocomplete') ?? inp?.getAttribute('data-mask-aria-autocomplete');\n const setAriaAutocomplete = opts.setAriaAutocomplete ?? (dataAriaAuto !== null ? dataAriaAuto !== 'false' : true);\n\n const dataTlds = wrap?.getAttribute('data-mask-tlds') ?? inp?.getAttribute('data-mask-tlds');\n const parsedTlds = opts.tlds ?? (dataTlds ? dataTlds.split(',').map(s => s.trim()).filter(Boolean) : undefined);\n\n const dataDefaultTld = wrap?.getAttribute('data-mask-default-tld') ?? inp?.getAttribute('data-mask-default-tld');\n const resolvedDefaultTld = opts.defaultTld !== undefined\n ? opts.defaultTld\n : (dataDefaultTld !== null ? (dataDefaultTld === 'false' || dataDefaultTld === 'none' ? null : (dataDefaultTld === 'true' ? true : dataDefaultTld)) : undefined);\n\n const resolvedOptions: EmailMaskOptions = {\n completeOnTab: true,\n completeOnArrowRight: true,\n completeOnEnter: true,\n cycleSuggestions: opts.cycleSuggestions ?? dataCycle ?? false,\n autoLowercase: opts.autoLowercase ?? dataAutoLower ?? false,\n setAriaAutocomplete,\n ...opts,\n ...(parsedTlds !== undefined ? { tlds: parsedTlds } : {}),\n ...(resolvedDefaultTld !== undefined ? { defaultTld: resolvedDefaultTld } : {})\n };\n\n super(wrap, inp, resolvedOptions);\n\n if (!this.input.hasAttribute('inputmode')) {\n this.input.inputMode = 'email';\n this.wasInputModeInferred = true;\n }\n\n // D\u00E9sactiver correction/majuscule auto et spellcheck sur identifiants email (r\u00E9versible au destroy)\n if (!this.input.hasAttribute('autocorrect')) {\n this.input.setAttribute('autocorrect', 'off');\n this.wasAutocorrectSet = true;\n }\n if (!this.input.hasAttribute('autocapitalize')) {\n this.input.setAttribute('autocapitalize', 'none');\n this.wasAutocapitalizeSet = true;\n }\n if (!this.input.hasAttribute('spellcheck')) {\n this.input.setAttribute('spellcheck', 'false');\n this.wasSpellcheckSet = true;\n }\n\n // Accessibilit\u00E9 WAI-ARIA : annonce d'autocompl\u00E9tion en ligne pour technologies d'assistance\n if (this.options.setAriaAutocomplete && !this.input.hasAttribute('aria-autocomplete')) {\n this.input.setAttribute('aria-autocomplete', 'inline');\n this.wasAriaAutocompleteSet = true;\n }\n\n this.engine = new EmailEngine(this.options);\n this.lastNotifiedValue = this.isPasswordInput() ? '' : this.input.value;\n\n this.bindEvents();\n\n if (!this.options.disabled && !this.isPasswordInput()) {\n this.updateSuggestion();\n }\n\n this.runAuditWarning(this.options.audit);\n }\n\n protected override onPasswordModeDetected(): void {\n if (this.srAnnounceTimerId !== null) {\n clearTimeout(this.srAnnounceTimerId);\n this.srAnnounceTimerId = null;\n }\n this.lastNotifiedValue = '';\n this.lastTrackedValue = '';\n this.lastAnnouncedSuggestion = '';\n this.currentSuggestion = { full: '', remaining: '', matchedDomain: null };\n if (this.srStatusEl) {\n this.srStatusEl.textContent = '';\n }\n this.clearGhost();\n }\n\n protected onNativeValueSet(_strVal: string): void {\n if (this.options.disabled || this.isComposing || this.isPasswordInput()) return;\n this.updateSuggestion();\n }\n\n protected onDisabledChange(disabled: boolean): void {\n if (disabled || this.isPasswordInput()) {\n this.clearGhost();\n } else {\n this.updateSuggestion();\n }\n }\n\n private bindEvents(): void {\n this.handleInput = this.handleInput.bind(this);\n this.handleKeyDown = this.handleKeyDown.bind(this);\n this.handleBlur = this.handleBlur.bind(this);\n this.handleFocus = this.handleFocus.bind(this);\n\n this.onCutHandler = () => {\n if (this.cutTimerId !== null) {\n clearTimeout(this.cutTimerId);\n }\n this.cutTimerId = window.setTimeout(() => {\n this.cutTimerId = null;\n if (this.isDestroyed || this.options.disabled || this.isPasswordInput()) return;\n this.updateSuggestion();\n }, 0);\n };\n\n const { signal } = this.abortController;\n this.input.addEventListener('input', this.handleInput as EventListener, { signal });\n this.input.addEventListener('keydown', this.handleKeyDown, { signal });\n this.input.addEventListener('blur', this.handleBlur, { signal });\n this.input.addEventListener('focus', this.handleFocus, { signal });\n this.input.addEventListener('scroll', this.onScroll, { passive: true, signal });\n this.input.addEventListener('cut', this.onCutHandler, { signal });\n this.input.addEventListener('compositionstart', () => {\n this.isComposing = true;\n }, { signal });\n this.input.addEventListener('compositionend', () => {\n this.isComposing = false;\n if (!this.isDestroyed && !this.options.disabled && !this.isPasswordInput()) {\n this.handleInput();\n }\n }, { signal });\n\n if (this.input.form) {\n this.onFormResetHandler = () => {\n if (this.resetTimerId !== null) {\n clearTimeout(this.resetTimerId);\n }\n this.resetTimerId = window.setTimeout(() => {\n this.resetTimerId = null;\n if (this.isDestroyed || this.options.disabled || this.isPasswordInput()) return;\n this.updateSuggestion();\n }, 0);\n };\n this.input.form.addEventListener('reset', this.onFormResetHandler, { signal });\n }\n }\n\n private ensureSrStatusEl(): HTMLElement | null {\n if (this.srStatusEl && this.wrapper.contains(this.srStatusEl)) {\n return this.srStatusEl;\n }\n const doc = this.input.ownerDocument || (typeof document !== 'undefined' ? document : null);\n if (!doc) return null;\n const status = doc.createElement('span');\n status.className = 'wulf-mask-sr-status';\n status.setAttribute('aria-live', 'polite');\n status.setAttribute('aria-atomic', 'true');\n this.wrapper.appendChild(status);\n this.srStatusEl = status;\n return status;\n }\n\n private scheduleSuggestionAnnouncement(immediate: boolean = false): void {\n if (this.srAnnounceTimerId !== null) {\n clearTimeout(this.srAnnounceTimerId);\n this.srAnnounceTimerId = null;\n }\n if (!this.options.setAriaAutocomplete || !this.isFocused || this.isDestroyed || this.isPasswordInput()) {\n return;\n }\n const suggestion = this.currentSuggestion;\n if (!suggestion.remaining || suggestion.isHintOnly) {\n this.lastAnnouncedSuggestion = '';\n if (this.srStatusEl) {\n this.srStatusEl.textContent = '';\n }\n return;\n }\n const textToAnnounce = suggestion.full;\n if (textToAnnounce === this.lastAnnouncedSuggestion && !immediate) {\n return;\n }\n\n const run = () => {\n this.srAnnounceTimerId = null;\n if (this.isDestroyed || !this.isFocused || this.isPasswordInput()) return;\n this.lastAnnouncedSuggestion = textToAnnounce;\n const doc = this.input.ownerDocument || (typeof document !== 'undefined' ? document : null);\n const docWithAriaNotify = doc as (Document & {\n ariaNotify?: (message: string, options?: { priority?: 'normal' | 'high' }) => void;\n }) | null;\n if (docWithAriaNotify && typeof docWithAriaNotify.ariaNotify === 'function') {\n try {\n docWithAriaNotify.ariaNotify(textToAnnounce, { priority: 'normal' });\n return;\n } catch {\n // Repli vers live region DOM\n }\n }\n const statusEl = this.ensureSrStatusEl();\n if (statusEl) {\n statusEl.textContent = statusEl.textContent === textToAnnounce ? `${textToAnnounce}\\u00A0` : textToAnnounce;\n }\n };\n\n if (immediate) {\n run();\n } else {\n this.srAnnounceTimerId = window.setTimeout(run, 250);\n }\n }\n\n public updateSuggestion(announceOptions?: { announce?: boolean; immediate?: boolean }): void {\n if (this.options.disabled || this.isPasswordInput()) {\n this.currentSuggestion = { full: '', remaining: '', matchedDomain: null };\n this.clearGhost();\n return;\n }\n\n const val = this.input.value;\n this.currentSuggestion = this.engine.getSuggestion(val, this.currentSuggestionIndex);\n\n if (!this.ghost) return;\n\n // R\u00E8gle de priorit\u00E9 universelle : si le champ est vide et qu'un placeholder natif est d\u00E9fini,\n // hors focus, le placeholder natif l'emporte et le fant\u00F4me s'efface.\n if (this.shouldHideGhostForPlaceholder(val.length === 0)) {\n this.clearGhost();\n } else if (this.currentSuggestion.remaining) {\n const doc = this.input.ownerDocument || document;\n const spanTyped = doc.createElement('span');\n spanTyped.className = 'mask-ghost-typed';\n spanTyped.textContent = val;\n\n const spanRemaining = doc.createElement('span');\n spanRemaining.className = 'mask-ghost-remaining';\n spanRemaining.textContent = this.currentSuggestion.remaining;\n\n this.setGhostContent(spanTyped, spanRemaining);\n } else {\n this.clearGhost();\n }\n\n this.ghost.scrollLeft = this.input.scrollLeft;\n\n if (announceOptions?.announce) {\n this.scheduleSuggestionAnnouncement(Boolean(announceOptions.immediate));\n }\n\n const detail = this.getDetail();\n if (this.options.onInput) {\n this.options.onInput(detail);\n }\n this.input.dispatchEvent(new CustomEvent('mask:input', { bubbles: true, detail }));\n if (val !== this.lastNotifiedValue) {\n this.lastNotifiedValue = val;\n this.dispatchNativeInput();\n }\n }\n\n private handleInput(e?: Event): void {\n if (this.isDispatchingNativeInput) return;\n if (this.options.disabled || this.isPasswordInput()) return;\n if (this.isComposing || (e && 'isComposing' in e && (e as InputEvent).isComposing)) return;\n\n if (this.options.autoLowercase) {\n const start = this.input.selectionStart ?? 0;\n const end = this.input.selectionEnd ?? start;\n const lower = this.input.value.toLowerCase();\n if (lower !== this.input.value) {\n this.setNativeValue(lower);\n this.input.setSelectionRange(start, end);\n }\n }\n\n this.currentSuggestionIndex = 0;\n this.updateSuggestion({ announce: true, immediate: false });\n }\n\n private handleKeyDown(e: KeyboardEvent): void {\n if (this.options.disabled || this.isPasswordInput() || isImeComposing(e)) return;\n if (e.shiftKey || e.ctrlKey || e.altKey || e.metaKey) return;\n\n const hasSuggestion = Boolean(this.currentSuggestion.remaining) && !this.currentSuggestion.isHintOnly;\n const cursor = this.input.selectionStart ?? 0;\n const isAtEnd = cursor === this.input.value.length;\n const isNotEmpty = this.input.value.length > 0;\n\n // Cyclage des suggestions avec Fl\u00E8che Bas / Fl\u00E8che Haut\n if (this.options.cycleSuggestions && hasSuggestion && isNotEmpty && isAtEnd) {\n if (e.key === 'ArrowDown') {\n e.preventDefault();\n this.currentSuggestionIndex++;\n this.updateSuggestion({ announce: true, immediate: true });\n return;\n }\n if (e.key === 'ArrowUp') {\n e.preventDefault();\n this.currentSuggestionIndex--;\n this.updateSuggestion({ announce: true, immediate: true });\n return;\n }\n }\n\n // Validation par Tab sans modificateur (uniquement si non-vide et hors gabarit indicatif)\n if (e.key === 'Tab' && hasSuggestion && isNotEmpty && this.options.completeOnTab) {\n e.preventDefault();\n this.acceptSuggestion();\n return;\n }\n\n // Validation par Entr\u00E9e sans modificateur\n if (e.key === 'Enter' && hasSuggestion && isNotEmpty && this.options.completeOnEnter) {\n e.preventDefault();\n this.acceptSuggestion();\n return;\n }\n\n // Validation par Fl\u00E8che Droite en toute fin de cha\u00EEne\n if (e.key === 'ArrowRight' && hasSuggestion && isNotEmpty && isAtEnd && this.options.completeOnArrowRight) {\n e.preventDefault();\n this.acceptSuggestion();\n return;\n }\n }\n\n /**\n * Valide et applique la suggestion courante dans le champ natif.\n */\n public acceptSuggestion(): boolean {\n if (!this.currentSuggestion.remaining || this.currentSuggestion.isHintOnly || this.options.disabled || this.input.value.length === 0) return false;\n\n const completed = this.currentSuggestion.full;\n this.setNativeValue(completed);\n this.input.setSelectionRange(completed.length, completed.length);\n this.currentSuggestionIndex = 0;\n this.updateSuggestion();\n\n const detail = this.getDetail();\n if (this.options.onChange) {\n this.options.onChange(detail);\n }\n this.input.dispatchEvent(new CustomEvent('mask:change', { bubbles: true, detail }));\n this.input.dispatchEvent(new CustomEvent('mask:complete', { bubbles: true, detail }));\n return true;\n }\n\n /**\n * Modifie dynamiquement le domaine sugg\u00E9r\u00E9 par d\u00E9faut.\n */\n public setDefaultDomain(domain: string | boolean | null): void {\n this.engine.setDefaultDomain(domain);\n this.updateSuggestion();\n }\n\n /**\n * Modifie dynamiquement l'extension (TLD) ou gabarit sugg\u00E9r\u00E9 par d\u00E9faut sur un domaine inconnu.\n */\n public setDefaultTld(tld: string | boolean | null): void {\n this.engine.setDefaultTld(tld);\n this.updateSuggestion();\n }\n\n /**\n * Modifie dynamiquement la liste des extensions (TLD) connues.\n */\n public setTlds(tlds: string[] | null): void {\n this.engine.setTlds(tlds);\n this.currentSuggestionIndex = 0;\n this.updateSuggestion();\n }\n\n private handleFocus(): void {\n this.wrapper.classList.add('is-focused');\n this.syncGhostStyles();\n this.updateSuggestion();\n }\n\n private handleBlur(): void {\n this.wrapper.classList.remove('is-focused');\n if (this.srAnnounceTimerId !== null) {\n clearTimeout(this.srAnnounceTimerId);\n this.srAnnounceTimerId = null;\n }\n this.lastAnnouncedSuggestion = '';\n if (this.srStatusEl) {\n this.srStatusEl.textContent = '';\n }\n if (this.isPasswordInput()) {\n this.lastNotifiedValue = '';\n this.lastTrackedValue = '';\n this.clearGhost();\n return;\n }\n this.updateSuggestion();\n const detail = this.getDetail();\n if (this.options.onChange) {\n this.options.onChange(detail);\n }\n this.input.dispatchEvent(new CustomEvent('mask:change', { bubbles: true, detail }));\n }\n\n protected override handleAttributeMutation(attrName: string): void {\n super.handleAttributeMutation(attrName);\n if (attrName === 'data-mask-cycle-suggestions') {\n this.options.cycleSuggestions = this.getAttr('data-mask-cycle-suggestions') === 'true';\n } else if (attrName === 'data-mask-auto-lowercase') {\n this.options.autoLowercase = this.getAttr('data-mask-auto-lowercase') === 'true';\n } else if (attrName === 'data-mask-default-tld') {\n const val = this.getAttr('data-mask-default-tld');\n this.setDefaultTld(val === null || val === 'false' || val === 'none' ? null : (val === 'true' ? true : val));\n } else if (attrName === 'data-mask-tlds') {\n const val = this.getAttr('data-mask-tlds');\n this.setTlds(val ? val.split(',').map(s => s.trim()).filter(Boolean) : null);\n } else if (attrName === 'placeholder') {\n this.updateSuggestion();\n }\n }\n\n public getDetail(): EmailMaskDetail {\n return {\n value: this.input.value,\n suggestedValue: this.currentSuggestion.isHintOnly ? '' : this.currentSuggestion.full,\n domain: this.currentSuggestion.matchedDomain\n };\n }\n\n public override setValue(val: string | number): void {\n const str = val !== null && val !== undefined ? String(val) : '';\n this.setNativeValue(str);\n this.updateSuggestion();\n }\n\n public override destroy(): void {\n if (this.isDestroyed) return;\n\n if (this.cutTimerId !== null) {\n clearTimeout(this.cutTimerId);\n this.cutTimerId = null;\n }\n if (this.resetTimerId !== null) {\n clearTimeout(this.resetTimerId);\n this.resetTimerId = null;\n }\n if (this.srAnnounceTimerId !== null) {\n clearTimeout(this.srAnnounceTimerId);\n this.srAnnounceTimerId = null;\n }\n if (this.srStatusEl) {\n this.srStatusEl.remove();\n this.srStatusEl = null;\n }\n this.lastNotifiedValue = '';\n this.lastAnnouncedSuggestion = '';\n\n if (this.wasInputModeInferred && this.input.getAttribute('inputmode') === 'email') {\n this.input.removeAttribute('inputmode');\n }\n\n if (this.wasAriaAutocompleteSet && this.input.getAttribute('aria-autocomplete') === 'inline') {\n this.input.removeAttribute('aria-autocomplete');\n }\n if (this.wasAutocorrectSet && this.input.getAttribute('autocorrect') === 'off') {\n this.input.removeAttribute('autocorrect');\n }\n if (this.wasAutocapitalizeSet && this.input.getAttribute('autocapitalize') === 'none') {\n this.input.removeAttribute('autocapitalize');\n }\n if (this.wasSpellcheckSet && this.input.getAttribute('spellcheck') === 'false') {\n this.input.removeAttribute('spellcheck');\n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