wulf.js 2.1.0 → 2.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (150) hide show
  1. package/README.md +217 -11
  2. package/changelog.md +60 -0
  3. package/dist/anchor.esm.js +9 -0
  4. package/dist/anchor.esm.js.map +7 -0
  5. package/dist/anchor.global.js +695 -0
  6. package/dist/anchor.global.js.map +7 -0
  7. package/dist/anchor.global.min.js +6 -0
  8. package/dist/anchor.global.min.js.map +7 -0
  9. package/dist/autosize.css +1 -0
  10. package/dist/autosize.css.map +7 -0
  11. package/dist/autosize.esm.js +10 -0
  12. package/dist/autosize.esm.js.map +7 -0
  13. package/dist/autosize.global.js +657 -0
  14. package/dist/autosize.global.js.map +7 -0
  15. package/dist/autosize.global.min.js +6 -0
  16. package/dist/autosize.global.min.js.map +7 -0
  17. package/dist/autosize.layered.css +1 -0
  18. package/dist/autosize.layered.css.map +7 -0
  19. package/dist/chunks/chunk-22AIMRD5.js +119 -0
  20. package/dist/chunks/chunk-22AIMRD5.js.map +7 -0
  21. package/dist/chunks/chunk-5N2IRGDM.js +766 -0
  22. package/dist/chunks/chunk-5N2IRGDM.js.map +7 -0
  23. package/dist/chunks/chunk-72FVCNNZ.js +863 -0
  24. package/dist/chunks/chunk-72FVCNNZ.js.map +7 -0
  25. package/dist/chunks/chunk-AXZYYW7H.js +865 -0
  26. package/dist/chunks/chunk-AXZYYW7H.js.map +7 -0
  27. package/dist/chunks/chunk-CM3SBIVQ.js +1116 -0
  28. package/dist/chunks/chunk-CM3SBIVQ.js.map +7 -0
  29. package/dist/chunks/chunk-H4GRLGQ3.js +578 -0
  30. package/dist/chunks/chunk-H4GRLGQ3.js.map +7 -0
  31. package/dist/chunks/chunk-ITRU2RFV.js +1195 -0
  32. package/dist/chunks/chunk-ITRU2RFV.js.map +7 -0
  33. package/dist/chunks/chunk-NLUQZEL4.js +1029 -0
  34. package/dist/chunks/chunk-NLUQZEL4.js.map +7 -0
  35. package/dist/chunks/chunk-QV46A7FV.js +197 -0
  36. package/dist/chunks/chunk-QV46A7FV.js.map +7 -0
  37. package/dist/chunks/chunk-SXLUXN6W.js +612 -0
  38. package/dist/chunks/chunk-SXLUXN6W.js.map +7 -0
  39. package/dist/chunks/chunk-T2H4EJCW.js +621 -0
  40. package/dist/chunks/chunk-T2H4EJCW.js.map +7 -0
  41. package/dist/chunks/chunk-TILLYEF2.js +6044 -0
  42. package/dist/chunks/chunk-TILLYEF2.js.map +7 -0
  43. package/dist/chunks/chunk-VJO22BAT.js +72 -0
  44. package/dist/chunks/chunk-VJO22BAT.js.map +7 -0
  45. package/dist/chunks/chunk-ZGUU6DMM.js +77 -0
  46. package/dist/chunks/chunk-ZGUU6DMM.js.map +7 -0
  47. package/dist/focus-trap.esm.js +6 -536
  48. package/dist/focus-trap.esm.js.map +3 -3
  49. package/dist/focus-trap.global.js +260 -87
  50. package/dist/focus-trap.global.js.map +3 -3
  51. package/dist/focus-trap.global.min.js +4 -4
  52. package/dist/focus-trap.global.min.js.map +4 -4
  53. package/dist/index.esm.js +79 -10069
  54. package/dist/index.esm.js.map +4 -4
  55. package/dist/index.global.js +4192 -355
  56. package/dist/index.global.js.map +4 -4
  57. package/dist/index.global.min.js +6 -3
  58. package/dist/index.global.min.js.map +4 -4
  59. package/dist/mask.esm.js +16 -6094
  60. package/dist/mask.esm.js.map +4 -4
  61. package/dist/mask.global.js +44 -55
  62. package/dist/mask.global.js.map +3 -3
  63. package/dist/mask.global.min.js +3 -3
  64. package/dist/mask.global.min.js.map +4 -4
  65. package/dist/masonry.esm.js +15 -1067
  66. package/dist/masonry.esm.js.map +4 -4
  67. package/dist/masonry.global.js +229 -148
  68. package/dist/masonry.global.js.map +3 -3
  69. package/dist/masonry.global.min.js +4 -4
  70. package/dist/masonry.global.min.js.map +4 -4
  71. package/dist/scroll.css +1 -1
  72. package/dist/scroll.css.map +2 -2
  73. package/dist/scroll.esm.js +14 -1175
  74. package/dist/scroll.esm.js.map +3 -3
  75. package/dist/scroll.global.js +171 -88
  76. package/dist/scroll.global.js.map +3 -3
  77. package/dist/scroll.global.min.js +3 -3
  78. package/dist/scroll.global.min.js.map +4 -4
  79. package/dist/scroll.layered.css +1 -1
  80. package/dist/scroll.layered.css.map +2 -2
  81. package/dist/shortcut.esm.js +6 -741
  82. package/dist/shortcut.esm.js.map +4 -4
  83. package/dist/shortcut.global.js +225 -58
  84. package/dist/shortcut.global.js.map +3 -3
  85. package/dist/shortcut.global.min.js +8 -2
  86. package/dist/shortcut.global.min.js.map +4 -4
  87. package/dist/size-report.json +319 -0
  88. package/dist/sortable.css +1 -0
  89. package/dist/sortable.css.map +7 -0
  90. package/dist/sortable.esm.js +22 -0
  91. package/dist/sortable.esm.js.map +7 -0
  92. package/dist/sortable.global.js +1477 -0
  93. package/dist/sortable.global.js.map +7 -0
  94. package/dist/sortable.global.min.js +6 -0
  95. package/dist/sortable.global.min.js.map +7 -0
  96. package/dist/sortable.layered.css +1 -0
  97. package/dist/sortable.layered.css.map +7 -0
  98. package/dist/sri-manifest.json +64 -0
  99. package/dist/toast.css +1 -1
  100. package/dist/toast.css.map +2 -2
  101. package/dist/toast.esm.js +19 -1129
  102. package/dist/toast.esm.js.map +3 -3
  103. package/dist/toast.global.js +386 -104
  104. package/dist/toast.global.js.map +3 -3
  105. package/dist/toast.global.min.js +4 -4
  106. package/dist/toast.global.min.js.map +4 -4
  107. package/dist/toast.layered.css +1 -1
  108. package/dist/toast.layered.css.map +2 -2
  109. package/dist/types/anchor/Anchor.d.ts +41 -0
  110. package/dist/types/anchor/index.d.ts +3 -0
  111. package/dist/types/anchor/types.d.ts +115 -0
  112. package/dist/types/autosize/Autosize.d.ts +71 -0
  113. package/dist/types/autosize/index.d.ts +3 -0
  114. package/dist/types/autosize/types.d.ts +66 -0
  115. package/dist/types/common/AuditableComponent.d.ts +1 -1
  116. package/dist/types/common/dom.d.ts +5 -0
  117. package/dist/types/common/registry.d.ts +40 -0
  118. package/dist/types/focus-trap/FocusTrap.d.ts +8 -3
  119. package/dist/types/index.d.ts +13 -1
  120. package/dist/types/mask/paste.d.ts +2 -5
  121. package/dist/types/masonry/Masonry.d.ts +2 -0
  122. package/dist/types/scroll/ScrollBlock.d.ts +2 -0
  123. package/dist/types/scroll/types.d.ts +6 -0
  124. package/dist/types/shortcut/ShortcutManager.d.ts +16 -3
  125. package/dist/types/shortcut/types.d.ts +5 -0
  126. package/dist/types/sortable/Sortable.d.ts +75 -0
  127. package/dist/types/sortable/i18n/en.d.ts +2 -0
  128. package/dist/types/sortable/i18n/fr.d.ts +2 -0
  129. package/dist/types/sortable/i18n/index.d.ts +9 -0
  130. package/dist/types/sortable/i18n/types.d.ts +15 -0
  131. package/dist/types/sortable/index.d.ts +4 -0
  132. package/dist/types/sortable/types.d.ts +112 -0
  133. package/dist/types/toast/Toast.d.ts +6 -1
  134. package/dist/types/toast/ToastInstance.d.ts +7 -0
  135. package/dist/types/toast/ToastManager.d.ts +4 -2
  136. package/dist/types/toast/types.d.ts +27 -1
  137. package/dist/types/undo/UndoManager.d.ts +112 -0
  138. package/dist/types/undo/i18n/en.d.ts +2 -0
  139. package/dist/types/undo/i18n/fr.d.ts +2 -0
  140. package/dist/types/undo/i18n/index.d.ts +9 -0
  141. package/dist/types/undo/i18n/types.d.ts +6 -0
  142. package/dist/types/undo/index.d.ts +5 -0
  143. package/dist/types/undo/types.d.ts +106 -0
  144. package/dist/undo.esm.js +23 -0
  145. package/dist/undo.esm.js.map +7 -0
  146. package/dist/undo.global.js +1029 -0
  147. package/dist/undo.global.js.map +7 -0
  148. package/dist/undo.global.min.js +6 -0
  149. package/dist/undo.global.min.js.map +7 -0
  150. package/package.json +54 -5
@@ -1,6 +1,9 @@
1
- "use strict";var __WulfIIFE=(()=>{var xt=Object.defineProperty;var ne=Object.getOwnPropertyDescriptor;var re=Object.getOwnPropertyNames;var oe=Object.prototype.hasOwnProperty;var ot=(p,t)=>{for(var e in t)xt(p,e,{get:t[e],enumerable:!0})},ae=(p,t,e,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of re(t))!oe.call(p,s)&&s!==e&&xt(p,s,{get:()=>t[s],enumerable:!(i=ne(t,s))||i.enumerable});return p};var le=p=>ae(xt({},"__esModule",{value:!0}),p);var Ie={};ot(Ie,{AmountEngine:()=>X,AuditableComponent:()=>B,BaseInputMask:()=>H,DATE_UTC_PRESETS:()=>gt,DateUTCEngine:()=>Z,EmailEngine:()=>nt,FocusTrap:()=>Wt,InputAmountMask:()=>pt,InputDateUTCMask:()=>bt,InputEmailMask:()=>ft,InputMask:()=>ht,LayoutEngine:()=>$,LocalizedComponent:()=>R,Mask:()=>Pt,MaskEngine:()=>q,MaskHistory:()=>V,MaskKeyboard:()=>st,Masonry:()=>Vt,Scroll:()=>Ht,ScrollBlock:()=>rt,Shortcut:()=>Yt,ShortcutFormatter:()=>O,ShortcutManager:()=>K,Toast:()=>zt,ToastInstance:()=>ct,ToastManager:()=>Q,WulfFocusTrap:()=>it,WulfMasonry:()=>J,WulfShortcut:()=>K,WulfToast:()=>tt,createI18nManager:()=>G,default:()=>Lt,getDeepActiveElement:()=>Y,getSafeWulfNamespace:()=>F,isImeComposing:()=>N,parseCssDurationMs:()=>Dt,prefersReducedMotion:()=>dt,safeCssEscape:()=>at,safeMove:()=>lt,sanitizePastedText:()=>U,stripBidiAndInvisibles:()=>ut,waitForAnimations:()=>St});var Pt={};ot(Pt,{AmountEngine:()=>X,BaseInputMask:()=>H,DATE_UTC_PRESETS:()=>gt,DateUTCEngine:()=>Z,EmailEngine:()=>nt,InputAmountMask:()=>pt,InputDateUTCMask:()=>bt,InputEmailMask:()=>ft,InputMask:()=>ht,Mask:()=>jt,MaskEngine:()=>q,MaskHistory:()=>V,MaskKeyboard:()=>st,default:()=>Lt,sanitizePastedText:()=>U,stripBidiAndInvisibles:()=>ut});function F(){if(typeof window>"u")return null;let p=window,t=p.Wulf;if(!t||typeof t!="object"||typeof Node<"u"&&t instanceof Node||typeof HTMLCollection<"u"&&t instanceof HTMLCollection){let e={};return p.Wulf=e,e}return t}function at(p){return typeof CSS<"u"&&typeof CSS.escape=="function"?CSS.escape(p):String(p).replace(/["\\\u0000-\u001F\u007F]/g,"\\$&")}function Y(p){if(typeof document>"u")return null;let t=(p??document).activeElement;for(;t&&t.shadowRoot&&t.shadowRoot.activeElement;)t=t.shadowRoot.activeElement;return t&&typeof t.focus=="function"?t:null}function lt(p,t,e=null){let i=p.moveBefore;if(typeof i=="function"&&t.isConnected&&p.isConnected&&typeof p.getRootNode=="function"&&typeof t.getRootNode=="function"&&p.getRootNode()===t.getRootNode())try{i.call(p,t,e);return}catch{}p.insertBefore(t,e)}function N(p){return!!(p.isComposing||p.key==="Process"||p.key==="Enter"&&p.keyCode===229)}function Dt(p,t=300,e=6e4){let i=Number.isFinite(t)&&t>=0?Math.min(t,e):300;if(typeof p=="number")return Number.isFinite(p)&&p>=0?Math.min(p,e):i;if(typeof p=="string"){let s=p.split(","),n=-1;for(let r of s){let o=/^\+?(\d+(?:\.\d+)?|\.\d+)(ms|s)?$/i.exec(r.trim());if(o){let a=parseFloat(o[1]);if(Number.isFinite(a)&&a>=0){let l=o[2]?.toLowerCase()==="s"?a*1e3:a;l>n&&(n=l)}}}if(n>=0)return Math.min(n,e)}return i}function dt(){return typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia("(prefers-reduced-motion: reduce)").matches}function St(p,t,e){let i=Number.isFinite(t)?Math.min(t,6e4):300;if(e?.aborted||i<=0||dt())return Promise.resolve();let s=typeof p.getAnimations=="function"?p.getAnimations().filter(n=>{if(n.playState!=="running")return!1;let r=n.effect?.getComputedTiming?.();return r?Number.isFinite(r.endTime):!0}):[];return s.length===0?Promise.resolve():new Promise(n=>{let r=!1,o=null,a=()=>{r||(r=!0,o!==null&&(clearTimeout(o),o=null),e?.removeEventListener("abort",a),n())};e?.addEventListener("abort",a,{once:!0}),o=setTimeout(a,i),Promise.allSettled(s.map(l=>l.finished)).then(a)})}var B=class{getAuditDisableHint(){return"Passez { audit: false } dans les options pour d\xE9sactiver cet avertissement"}runAuditWarning(t=!0){if(!t)return[];let e=this.audit();return e.length>0&&typeof console<"u"&&typeof console.warn=="function"&&console.warn(`[${this.getAuditPrefix()}] Audit d'accessibilit\xE9 \u2014 ${e.length} contrainte(s) manquante(s) sur ${this.getAuditTargetLabel()} :
1
+ "use strict";var __WulfIIFE=(()=>{var Gt=Object.defineProperty;var Je=Object.getOwnPropertyDescriptor;var Qe=Object.getOwnPropertyNames;var ti=Object.prototype.hasOwnProperty;var $=(u,t)=>{for(var e in t)Gt(u,e,{get:t[e],enumerable:!0})},ei=(u,t,e,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of Qe(t))!ti.call(u,s)&&s!==e&&Gt(u,s,{get:()=>t[s],enumerable:!(i=Je(t,s))||i.enumerable});return u};var ii=u=>ei(Gt({},"__esModule",{value:!0}),u);var Vi={};$(Vi,{AmountEngine:()=>Q,Anchor:()=>ge,AuditableComponent:()=>z,Autosize:()=>Ae,BaseInputMask:()=>V,DATE_UTC_PRESETS:()=>St,DateUTCEngine:()=>tt,EmailEngine:()=>at,FocusTrap:()=>de,InputAmountMask:()=>yt,InputDateUTCMask:()=>At,InputEmailMask:()=>wt,InputMask:()=>dt,LayoutEngine:()=>X,LocalizedComponent:()=>R,Mask:()=>Xt,MaskEngine:()=>J,MaskHistory:()=>Y,MaskKeyboard:()=>ot,Masonry:()=>ee,Scroll:()=>Jt,ScrollBlock:()=>lt,Shortcut:()=>pe,ShortcutFormatter:()=>W,ShortcutManager:()=>ut,Sortable:()=>Te,Toast:()=>ue,ToastInstance:()=>ft,ToastManager:()=>it,Undo:()=>xe,UndoManager:()=>nt,WulfAnchor:()=>It,WulfAutosize:()=>vt,WulfFocusTrap:()=>Et,WulfMasonry:()=>pt,WulfShortcut:()=>ut,WulfSortable:()=>gt,WulfToast:()=>mt,WulfUndo:()=>nt,createI18nManager:()=>B,default:()=>_t,getDeepActiveElement:()=>H,getSafeWulfNamespace:()=>si,isImeComposing:()=>N,parseCssDurationMs:()=>Ft,prefersReducedMotion:()=>rt,safeCssEscape:()=>j,safeMove:()=>_,sanitizePastedText:()=>G,stripBidiAndInvisibles:()=>O,waitForAnimations:()=>Dt});var Xt={};$(Xt,{AmountEngine:()=>Q,BaseInputMask:()=>V,DATE_UTC_PRESETS:()=>St,DateUTCEngine:()=>tt,EmailEngine:()=>at,InputAmountMask:()=>yt,InputDateUTCMask:()=>At,InputEmailMask:()=>wt,InputMask:()=>dt,Mask:()=>di,MaskEngine:()=>J,MaskHistory:()=>Y,MaskKeyboard:()=>ot,default:()=>_t,sanitizePastedText:()=>G,stripBidiAndInvisibles:()=>O});var z=class{getAuditDisableHint(){return"Passez { audit: false } dans les options pour d\xE9sactiver cet avertissement"}runAuditWarning(t=!0){if(!t)return[];let e=this.audit();return e.length>0&&typeof console<"u"&&typeof console.warn=="function"&&console.warn(`[${this.getAuditPrefix()}] Audit d'accessibilit\xE9 \u2014 ${e.length} contrainte(s) manquante(s) sur ${this.getAuditTargetLabel()} :
2
2
  `+e.map(i=>` - ${i}`).join(`
3
3
  `)+`
4
- (${this.getAuditDisableHint()})`),e}checkAriaIdReferences(t,e,i,s=!1){let n=t.getAttribute(e)?.trim();if(!n)return!1;let r=t.ownerDocument||document,o=typeof t.getRootNode=="function"?t.getRootNode():r,a=n.split(/\s+/).filter(Boolean),l=a.map(h=>typeof ShadowRoot<"u"&&o instanceof ShadowRoot?o.getElementById(h):r.getElementById(h));return a.length>0&&l.every(h=>!!h)?s&&!l.some(c=>c?(c.textContent?.trim()||c.getAttribute("aria-label")?.trim()||"").length>0:!1)?(i.push(`Attribut ${e}="${n}" invalide : l'\xE9l\xE9ment cible ne contient aucun texte accessible.`),!1):!0:(i.push(`Attribut ${e}="${n}" invalide : l'\xE9l\xE9ment cible est introuvable dans le DOM.`),!1)}};function ut(p,t=4096){let e=Math.max(0,t);return String(p??"").slice(0,e).replace(/[\u200B-\u200F\u202A-\u202E\u2066-\u2069\uFEFF]/g,"")}function U(p,t=4096){return ut(p,t).replace(/[\u00A0\u202F\u2007]/g," ").replace(/[\u2013\u2014\u2212]/g,"-").trim()}var Mt=new Set(["left","right","center"]);function j(p,t,e){return t&&typeof t=="object"&&"tagName"in t&&t.tagName==="INPUT"?{wrapper:p||null,input:t,options:e||{}}:{wrapper:null,input:p,options:t&&typeof t=="object"&&!("tagName"in t)?t:{}}}var H=class extends B{wrapper;input;options;ghost=null;isWrapperCreated=!1;wasWrapperFallbackStyled=!1;wasAlignSet=!1;hadInitialDataAlign=!1;isDestroyed=!1;isFocused=!1;isDispatchingNativeInput=!1;lastTrackedValue="";nativeValueDescriptor=null;onCutHandler=()=>{};onFormResetHandler;mutationObserver=null;resizeObserver=null;focusSelectTimerId=null;abortController=new AbortController;constructor(t,e,i){super();let{wrapper:s,input:n,options:r}=j(t,e,i);if(!n||typeof n!="object"||n.nodeType!==1||n.tagName!=="INPUT")throw new Error(`[${new.target.name||"InputMask"}] input (HTMLInputElement) est requis.`);this.input=n;let o=this.input.getAttribute("data-mask-create-wrapper")==="true",a=!!(r.createWrapper??o),l=s;if(!l&&a){let C=this.input.ownerDocument||document,M=C.createElement("span");M.className="wulf-mask-wrapper wulf-mask-wrapper--auto",this.input.parentNode&&this.input.parentNode.insertBefore(M,this.input),lt(M,this.input,null);let W=C.defaultView||(typeof window<"u"?window:null);(!M.isConnected||!W||W.getComputedStyle(M).display!=="inline-grid")&&(M.style.display="inline-grid",M.style.gridTemplateColumns="1fr",M.style.gridTemplateRows="1fr",M.style.verticalAlign="middle",M.style.boxSizing="border-box",M.style.position="relative",this.input.style.gridArea="1 / 1 / 2 / 2",this.input.style.boxSizing="border-box",this.wasWrapperFallbackStyled=!0),l=M,this.isWrapperCreated=!0}if(!l)throw new Error(`[${new.target.name||"InputMask"}] wrapper (HTMLElement) et input (HTMLInputElement) sont requis, ou activez l'option createWrapper: true.`);this.wrapper=l,this.normalizeInputType();let u=this.getAttr("data-mask-focus-only")==="true",h=this.hasAttr("data-disabled"),c=this.getAttr("data-mask-select-on-focus")==="true",d=this.getAttr("data-mask-copy-raw")==="true",f=this.getAttr("data-mask-sensitive")==="true",g=this.getAttr("data-mask-align")||this.getAttr("data-align"),m=g&&Mt.has(g)?g:null;this.hadInitialDataAlign=this.wrapper.hasAttribute("data-align");let v=this.getAttr("data-mask-audit"),{disabled:y,align:b,sensitive:S,...A}=r,T=b&&Mt.has(b)?b:void 0,w=y!==void 0?y:!!h,E=r.audit??(v!==null?v!=="false":!0),I=!!(S??f),k=this.isPasswordInput()||I;this.options={...A,createWrapper:a,showMaskOnFocus:r.showMaskOnFocus??u??!1,selectAllOnFocus:r.selectAllOnFocus??c??!1,copyRaw:k?!1:r.copyRaw??d??!1,sensitive:I,disabled:w,align:T??(m||void 0),emitNativeInput:r.emitNativeInput??!0,audit:E},this.options.showMaskOnFocus&&this.wrapper.classList.add("mask-focus-only"),this.options.disabled&&this.wrapper.setAttribute("data-disabled","true"),this.options.align&&this.setAlign(this.options.align),this.createGhost(),this.hookValueProperty(),this.bindBaseEvents(),this.initMutationObserver()}getAttr(t){return this.input.getAttribute(t)||this.wrapper.getAttribute(t)}hasAttr(t){return this.wrapper.hasAttribute(t)||this.input.hasAttribute(t)}hasNativePlaceholder(){return!!(this.input.placeholder&&this.input.placeholder.trim().length>0)}shouldHideGhostForPlaceholder(t){return!this.isFocused&&t&&this.hasNativePlaceholder()}bindBaseEvents(){let{signal:t}=this.abortController;this.input.addEventListener("copy",this.onBaseCopy,{signal:t}),this.input.addEventListener("focus",this.onBaseFocus,{signal:t}),this.input.addEventListener("blur",this.onBaseBlur,{signal:t})}onBaseCopy=t=>{if(!this.options.copyRaw||this.options.disabled||this.isSensitiveField())return;let e=this.input.selectionStart??0,i=this.input.selectionEnd??e,s="";e!==i?s=this.extractRawSnippet(this.input.value.slice(e,i)):s=this.getRawValue(),s&&t.clipboardData&&(t.preventDefault(),t.clipboardData.setData("text/plain",s))};extractRawSnippet(t){return t}getClipboardPlainText(t){return t.clipboardData&&(t.clipboardData.getData("text")||t.clipboardData.getData("text/plain"))||""}preparePastedText(t,e=4096){let i=U(t,e);if(typeof this.options.transformPaste!="function")return i;try{let s=this.options.transformPaste(i);if(typeof s=="string")return U(s,e)}catch{}return i}onBaseFocus=()=>{this.isFocused=!0,this.options.selectAllOnFocus&&this.input.value.length>0&&(this.focusSelectTimerId!==null&&clearTimeout(this.focusSelectTimerId),this.focusSelectTimerId=window.setTimeout(()=>{this.focusSelectTimerId=null,!this.isDestroyed&&Y(this.input.ownerDocument)===this.input&&this.input.select()},0))};onBaseBlur=()=>{this.isFocused=!1,this.isSensitiveField()&&(this.lastTrackedValue="",this.clearGhost(),this.wrapper.removeAttribute("data-mask"))};initMutationObserver(){if(typeof MutationObserver>"u")return;this.mutationObserver=new MutationObserver(e=>{for(let i of e)i.type==="attributes"&&i.attributeName&&this.handleAttributeMutation(i.attributeName)});let t={attributes:!0,attributeFilter:["data-mask","data-mask-placeholder","data-mask-focus-only","data-mask-strict","data-mask-select-on-focus","data-mask-copy-raw","data-mask-sensitive","data-mask-pad-decimals","data-mask-auto-lowercase","data-mask-cycle-suggestions","data-mask-default-tld","data-mask-tlds","data-mask-format","data-mask-utc-indicator","data-disabled","data-mask-align","data-align","placeholder","type"]};this.mutationObserver.observe(this.wrapper,t),this.input!==this.wrapper&&this.mutationObserver.observe(this.input,t)}isPasswordInput(){return(this.input.type||"").toLowerCase()==="password"}isSensitiveField(){return this.isPasswordInput()||!!this.options.sensitive}computePasswordDigest(t){let e=2166136261;for(let i=0;i<t.length;i++)e^=t.charCodeAt(i),e=Math.imul(e,16777619);return`__pwd:${(e>>>0).toString(36)}:${t.length}`}setAlign(t){let e=t&&Mt.has(t)?t:null,i=e||void 0,s=this.wrapper.getAttribute("data-align"),n=e?this.wrapper.classList.contains(`align-${e}`):!this.wrapper.classList.contains("align-left")&&!this.wrapper.classList.contains("align-right")&&!this.wrapper.classList.contains("align-center");this.options.align===i&&s===e&&n||(this.options.align=i,this.wrapper.classList.remove("align-left","align-right","align-center"),e?(this.wrapper.classList.add(`align-${e}`),this.wasAlignSet=!0,this.wrapper.getAttribute("data-align")!==e&&this.wrapper.setAttribute("data-align",e)):this.wrapper.hasAttribute("data-align")&&this.wrapper.removeAttribute("data-align"),this.syncGhostStyles())}handleAttributeMutation(t){if(t==="data-disabled"){let e=this.hasAttr("data-disabled");e!==!!this.options.disabled&&this.setDisabled(e)}else if(t==="data-mask-focus-only"){let e=this.getAttr("data-mask-focus-only")==="true";e!==!!this.options.showMaskOnFocus&&this.setShowMaskOnFocus(e)}else if(t==="data-mask-select-on-focus")this.options.selectAllOnFocus=this.getAttr("data-mask-select-on-focus")==="true";else if(t==="data-mask-copy-raw")this.options.copyRaw=this.isSensitiveField()?!1:this.getAttr("data-mask-copy-raw")==="true";else if(t==="data-mask-sensitive"){let e=this.getAttr("data-mask-sensitive")==="true";this.options.sensitive=e,this.isSensitiveField()&&(this.options.copyRaw=!1,this.lastTrackedValue="",this.clearGhost(),this.wrapper.removeAttribute("data-mask"),this.onPasswordModeDetected())}else if(t==="type")this.isSensitiveField()&&(this.options.copyRaw=!1,this.lastTrackedValue="",this.clearGhost(),this.wrapper.removeAttribute("data-mask"),this.onPasswordModeDetected());else if(t==="data-mask-align"||t==="data-align"){let e=this.getAttr("data-mask-align")||this.getAttr("data-align"),i=e&&Mt.has(e)?e:null;i!==(this.options.align??null)&&this.setAlign(i)}}normalizeInputType(){let t=["number","email","date","datetime-local","month","week","time","color","file","range"];if(this.input.type&&t.includes(this.input.type.toLowerCase())){let e=this.input.type.toLowerCase();this.input.type="text",e==="number"&&(this.input.inputMode="numeric")}}createGhost(){let t=this.wrapper.querySelector(".mask-ghost");t&&t.remove();let e=this.input.ownerDocument||document;this.ghost=e.createElement("div"),this.ghost.className="mask-ghost",this.ghost.setAttribute("aria-hidden","true"),this.ghost.style.display="flex",this.ghost.style.alignItems="center",this.wrapper.appendChild(this.ghost),this.wrapper.classList.add("has-ghost");let i=e.defaultView||(typeof window<"u"?window:null);(!this.wrapper.isConnected||!i||i.getComputedStyle(this.ghost).pointerEvents!=="none")&&(this.ghost.style.gridArea="1 / 1 / 2 / 2",this.ghost.style.pointerEvents="none"),this.syncGhostStyles(),typeof ResizeObserver<"u"&&(this.resizeObserver?.disconnect(),this.resizeObserver=new ResizeObserver(()=>{this.isDestroyed||this.syncGhostStyles()}),this.resizeObserver.observe(this.input));let s=e;s.fonts?.ready&&typeof s.fonts.ready.then=="function"&&s.fonts.ready.then(()=>{this.isDestroyed||this.syncGhostStyles()}).catch(()=>{})}setGhostContent(...t){if(this.ghost){if(typeof this.ghost.replaceChildren=="function")this.ghost.replaceChildren(...t);else{this.ghost.textContent="";for(let e of t)this.ghost.appendChild(typeof e=="string"?document.createTextNode(e):e)}this.wrapper.classList.toggle("has-visible-ghost",t.length>0)}}clearGhost(){this.setGhostContent()}syncGhostStyles(){if(!this.ghost||typeof window>"u")return;let t=window.getComputedStyle(this.input);if(!t)return;this.ghost.style.fontFamily=t.fontFamily,this.ghost.style.fontSize=t.fontSize,this.ghost.style.fontWeight=t.fontWeight,this.ghost.style.fontStyle=t.fontStyle,this.ghost.style.letterSpacing=t.letterSpacing,this.ghost.style.wordSpacing=t.wordSpacing,this.ghost.style.textIndent=t.textIndent,this.ghost.style.fontKerning=t.fontKerning,this.ghost.style.fontVariantNumeric=t.fontVariantNumeric,this.ghost.style.lineHeight=t.lineHeight,this.ghost.style.paddingTop=t.paddingTop,this.ghost.style.paddingBottom=t.paddingBottom,this.ghost.style.paddingLeft=t.paddingLeft,this.ghost.style.paddingRight=t.paddingRight,this.ghost.style.borderTopWidth=t.borderTopWidth,this.ghost.style.borderBottomWidth=t.borderBottomWidth,this.ghost.style.borderLeftWidth=t.borderLeftWidth,this.ghost.style.borderRightWidth=t.borderRightWidth,this.ghost.style.borderTopStyle=t.borderTopStyle==="none"?"none":"solid",this.ghost.style.borderBottomStyle=t.borderBottomStyle==="none"?"none":"solid",this.ghost.style.borderLeftStyle=t.borderLeftStyle==="none"?"none":"solid",this.ghost.style.borderRightStyle=t.borderRightStyle==="none"?"none":"solid",this.ghost.style.borderColor="transparent",this.ghost.style.boxSizing=t.boxSizing,this.ghost.style.textAlign=t.textAlign,this.ghost.style.direction=t.direction;let e=t.direction==="rtl"||this.input.getAttribute("dir")==="rtl"||this.wrapper.getAttribute("dir")==="rtl",i=t.textAlign;i==="right"?this.ghost.style.justifyContent="right":i==="left"?this.ghost.style.justifyContent="left":i==="center"?this.ghost.style.justifyContent="center":i==="end"?this.ghost.style.justifyContent=e?"left":"right":this.ghost.style.justifyContent=e?"right":"left"}setNativeValue(t){this.nativeValueDescriptor&&this.nativeValueDescriptor.set?this.nativeValueDescriptor.set.call(this.input,t):this.input.value=t}dispatchNativeInput(){if(!(this.isDestroyed||typeof window>"u")&&this.options.emitNativeInput!==!1){this.isDispatchingNativeInput=!0;try{let t=this.isSensitiveField(),e=this.input._valueTracker;!t&&e&&typeof e.setValue=="function"&&e.setValue(this.lastTrackedValue),this.lastTrackedValue=t?"":this.input.value,this.input.dispatchEvent(new Event("input",{bubbles:!0,cancelable:!1}))}finally{this.isDispatchingNativeInput=!1}}}onScroll=()=>{this.ghost&&(this.ghost.scrollLeft=this.input.scrollLeft)};hookValueProperty(){try{let t=HTMLInputElement.prototype,e=Object.getOwnPropertyDescriptor(t,"value");if(!e||!e.set||!e.get)return;this.nativeValueDescriptor=e;let i=this;Object.defineProperty(this.input,"value",{get(){return e.get.call(this)},set(s){let n=String(s??"");e.set.call(this,n),!i.isDestroyed&&i.onNativeValueSet(n)},configurable:!0})}catch{}}unhookValueProperty(){try{delete this.input.value}catch{}}setShowMaskOnFocus(t){this.options.showMaskOnFocus=t,this.wrapper.classList.toggle("mask-focus-only",t)}disabled(t){if(t===void 0)return!!this.options.disabled;this.setDisabled(t)}setDisabled(t){this.options.disabled=!!t,this.options.disabled?this.wrapper.setAttribute("data-disabled","true"):this.wrapper.removeAttribute("data-disabled"),this.onDisabledChange(this.options.disabled)}getWrapper(){return this.wrapper}getInput(){return this.input}getGhost(){return this.ghost}getElements(){return{wrapper:this.wrapper,input:this.input,ghost:this.ghost}}getValue(){return this.input.value}getRawValue(){return this.input.value}hasAccessibleLabelText(t){if(!t)return!1;if(t.getAttribute("aria-label")?.trim())return!0;let i=s=>{if(s.nodeType===3)return s.textContent||"";if(s.nodeType===1){let n=s,r=n.tagName;if(r==="INPUT"||r==="SELECT"||r==="TEXTAREA"||r==="BUTTON"||n.getAttribute("aria-hidden")==="true")return"";let o="";for(let a=0;a<n.childNodes.length;a++)o+=i(n.childNodes[a]);return o}return""};return i(t).trim().length>0}audit(){let t=[],e=this.input.ownerDocument||document,i=typeof this.input.getRootNode=="function"?this.input.getRootNode():e,s=typeof ShadowRoot<"u"&&i instanceof ShadowRoot?i:e,n=this.input.getAttribute("aria-label")?.trim(),r=this.checkAriaIdReferences(this.input,"aria-labelledby",t,!0),o=this.input.closest("label"),a=this.hasAccessibleLabelText(o),l=!!(this.input.labels&&Array.from(this.input.labels).some(d=>this.hasAccessibleLabelText(d))),u=!1;if(this.input.id)try{let d=s.querySelector(`label[for="${at(this.input.id)}"]`);u=this.hasAccessibleLabelText(d)}catch{u=!1}!n&&!r&&!a&&!l&&!u&&t.push(`\xC9tiquetage accessible manquant : associez un <label for="id"> non vide (ou d\xE9finissez aria-label / aria-labelledby) sur l'input (WCAG 4.1.2).`),this.checkAriaIdReferences(this.input,"aria-describedby",t,!0),this.input.hasAttribute("aria-errormessage")&&this.checkAriaIdReferences(this.input,"aria-errormessage",t,!0);let h=this.input.getAttribute("tabindex");if(h!==null){let d=Number.parseInt(h,10);Number.isFinite(d)&&d>0&&t.push(`Attribut tabindex="${h}" positif d\xE9tect\xE9 : \xE9vitez les tabindex > 0 qui perturbent l'ordre de tabulation naturel (WCAG 2.4.3).`)}let c=this.getSpecificAuditWarnings();return t.push(...c),t}getAuditPrefix(){return`Wulf.Mask.${this.constructor.name||"InputMask"}`}getAuditTargetLabel(){return this.input.id?`#${this.input.id}`:this.input.name?`input[name="${this.input.name}"]`:"<input>"}getAuditDisableHint(){return'Passez { audit: false } ou data-mask-audit="false" pour d\xE9sactiver cet avertissement'}getSpecificAuditWarnings(){return[]}onPasswordModeDetected(){}destroy(){this.isDestroyed||(this.isDestroyed=!0,this.focusSelectTimerId!==null&&(clearTimeout(this.focusSelectTimerId),this.focusSelectTimerId=null),this.mutationObserver&&(this.mutationObserver.disconnect(),this.mutationObserver=null),this.resizeObserver&&(this.resizeObserver.disconnect(),this.resizeObserver=null),this.abortController.abort(),this.lastTrackedValue="",this.unhookValueProperty(),this.ghost&&(this.ghost.remove(),this.ghost=null),this.isWrapperCreated&&this.wrapper?(this.wasWrapperFallbackStyled&&(this.input.style.gridArea="",this.input.style.boxSizing=""),this.wrapper.parentElement?lt(this.wrapper.parentElement,this.input,this.wrapper):this.wrapper.parentNode&&this.wrapper.parentNode.insertBefore(this.input,this.wrapper),this.wrapper.remove()):this.wrapper&&(this.wrapper.removeAttribute("data-mask"),this.wrapper.removeAttribute("data-disabled"),this.wasAlignSet&&!this.hadInitialDataAlign&&this.wrapper.removeAttribute("data-align"),this.wasAlignSet&&this.wrapper.classList.remove("align-left","align-right","align-center"),this.wrapper.classList.remove("is-complete","is-focused","mask-focus-only","has-selection","has-ghost","has-visible-ghost")))}};var Gt=new Set(["/","-",".",":"]),he={9:{pattern:/[0-9]/},a:{pattern:/[a-zA-Z]/},A:{pattern:/[a-zA-Z]/,transform:p=>p.toUpperCase()},"*":{pattern:/[a-zA-Z0-9]/},"#":{pattern:/[a-zA-Z0-9]/,transform:p=>p.toUpperCase()}},q=class p{pattern;patterns=[];patternResolver=null;lastResolvedKey="";subEngines=[];activeEngine=null;placeholderChar;tokens;slots=[];fullMaskTemplate="";prefixSlotsCount=0;prefixString="";strict=!0;autoLowercase=!1;constructor(t,e={}){let i=e||{},s=String(i.placeholderChar||"_");this.placeholderChar=Array.from(s)[0]||"_";let n=Object.create(null);for(let[r,o]of Object.entries(he))n[r]=o;if(i.tokens&&typeof i.tokens=="object")for(let[r,o]of Object.entries(i.tokens))r!=="__proto__"&&r!=="constructor"&&r!=="prototype"&&o&&(n[r]=o);this.tokens=n,this.strict=i.strict!==!1,this.autoLowercase=i.autoLowercase??!1,this.pattern="",this.compile(t)}static format(t,e,i={}){return!e||Array.isArray(e)&&e.length===0?t??"":new p(e,i||{}).format(t??"")}isDynamicPattern(){return this.patternResolver!==null}resolveForValue(t){if(!this.patternResolver)return!1;let e;try{e=this.patternResolver(String(t??"").slice(0,4096))}catch{return!1}let i,s;if(Array.isArray(e))i=e.slice(0,32).map(n=>String(n??"").slice(0,512)),s="A:"+i.join("\0");else if(typeof e=="string")i=e.slice(0,512),s="S:"+i;else return!1;return s===this.lastResolvedKey?!1:(this.lastResolvedKey=s,this.compileStatic(i),!0)}compile(t){return typeof t=="function"?(this.patternResolver=t,this.lastResolvedKey="",this.resolveForValue(""),this.slots):t!==void 0?(this.patternResolver=null,this.lastResolvedKey="",this.compileStatic(t)):this.patternResolver?(this.lastResolvedKey="",this.resolveForValue(""),this.slots):this.compileStatic(this.patterns.length>0?this.patterns:this.pattern)}compileStatic(t){if(Array.isArray(t)?(this.patterns=t.slice(0,32).map(s=>String(s??"").slice(0,512)),this.pattern=this.patterns[0]||""):(this.patterns=[],this.pattern=String(t??"").slice(0,512)),this.patterns.length>0)return this.subEngines=this.patterns.map(s=>new p(s,{placeholderChar:this.placeholderChar,tokens:this.tokens,strict:this.strict,autoLowercase:this.autoLowercase})),this.activeEngine=this.subEngines[0],this.slots=this.activeEngine.slots,this.fullMaskTemplate=this.activeEngine.fullMaskTemplate,this.prefixSlotsCount=this.activeEngine.prefixSlotsCount,this.prefixString=this.activeEngine.prefixString,this.slots;this.subEngines=[],this.activeEngine=null,this.slots=[];let e="",i=!0;for(let s=0;s<this.pattern.length;s++){let n=this.pattern[s],r=!1;n==="\\"&&s+1<this.pattern.length&&(r=!0,s++,n=this.pattern[s]);let o=!r&&Object.hasOwn(this.tokens,n)?this.tokens[n]:void 0;if(o){i=!1;let a=o.placeholder?Array.from(String(o.placeholder))[0]||this.placeholderChar:this.placeholderChar;this.slots.push({char:n,isStatic:!1,isPrefix:!1,token:o,placeholder:a}),e+=a}else this.slots.push({char:n,isStatic:!0,isPrefix:i,placeholder:n}),e+=n}this.fullMaskTemplate=e,this.prefixSlotsCount=0,this.prefixString="";for(let s of this.slots)if(s.isPrefix)this.prefixSlotsCount++,this.prefixString+=s.char;else break;return this.slots}selectEngine(t){if(this.subEngines.length<=1)return this;let e=String(t??""),i=this.subEngines.filter(a=>{let l=a.getPrefix();return l.length>0&&e.toLowerCase().startsWith(l.trim().toLowerCase())}),s=i.length>0?i:this.subEngines,n=s.toSorted((a,l)=>l.getEditableCount()-a.getEditableCount())[0],o=(n?n.extractRaw(e):e).length;for(let a of s)if(a.getEditableCount()>=o)return this.activeEngine=a,a;return this.activeEngine=s[s.length-1],this.activeEngine}getPrefix(){return this.activeEngine?this.activeEngine.getPrefix():this.prefixString}getPrefixLength(){return this.activeEngine?this.activeEngine.getPrefixLength():this.prefixSlotsCount}getFullMaskTemplate(){return this.activeEngine?this.activeEngine.getFullMaskTemplate():this.fullMaskTemplate}getActiveEditableCount(){return this.subEngines.length>0?(this.activeEngine??this.subEngines[0]).getActiveEditableCount():this.activeEngine?this.activeEngine.getActiveEditableCount():this.slots.filter(t=>!t.isStatic).length}getMaxEditableCount(){return this.subEngines.length>0?Math.max(...this.subEngines.map(t=>t.getMaxEditableCount())):this.getActiveEditableCount()}getEditableCount(){return this.getMaxEditableCount()}isNumericOnly(){if(this.subEngines.length>0)return this.subEngines.every(i=>i.isNumericOnly());let e=(this.activeEngine?this.activeEngine.slots:this.slots).filter(i=>!i.isStatic);return e.length===0?!1:e.every(i=>i.char==="9"||i.token&&i.token.pattern.test("0")&&!i.token.pattern.test("a")&&!i.token.pattern.test("Z"))}setStrict(t){this.strict=t;for(let e of this.subEngines)e.setStrict(t)}setAutoLowercase(t){this.autoLowercase=t;for(let e of this.subEngines)e.setAutoLowercase(t)}isStrict(){return this.strict}normalizePastedValue(t){let e=String(t??"");if(!e)return e;if(this.resolveForValue(e),this.subEngines.length>0){let i=e.toLowerCase(),s=this.subEngines.filter(o=>{let a=o.getPrefix();return a.length>0&&i.startsWith(a.trim().toLowerCase())}),n=s.length>0?s:this.subEngines,r=null;for(let o of n){let a=o.tryNormalizeSegments(e);if(a.matched){if(a.exactSegmentCount)return a.normalized;r===null&&(r=a.normalized)}}return r!==null?r:e}return this.tryNormalizeSegments(e).normalized}tryNormalizeSegments(t){let e={matched:!1,normalized:t,exactSegmentCount:!1};if(!this.strict||this.slots.length===0||!t)return e;let i=t;if(this.prefixSlotsCount>0){let y=0;for(;y<t.length&&(t[y]===" "||t[y]===" ");)y++;let b=0;for(;y<t.length&&b<this.prefixSlotsCount;){let S=this.slots[b].char,A=t[y];if(A.toUpperCase()===S.toUpperCase())y++,b++;else if(S===" "&&A!==" ")b++;else break}b===this.prefixSlotsCount&&(i=t.slice(y))}if(!i)return e;let s=[],n=[],r=[],o="",a=!1;for(let y=this.prefixSlotsCount;y<this.slots.length;y++){let b=this.slots[y];b.isStatic?r.length>0?(s.push(r),r=[],o=b.char):o+=b.char:(o.length>0&&(n.push(o),o=""),r.push(b))}if(r.length>0?s.push(r):o.length>0&&(a=!0),a||s.length<2||n.length!==s.length-1)return e;let l=[];for(let y of n){let b=y.trim();if(b.length!==1||!Gt.has(b))return e;l.push(b)}let u=[],h=[],c=0;for(let y=0;y<i.length;y++){let b=i[y];Gt.has(b)&&(u.push(i.slice(c,y).trim()),h.push(b),c=y+1)}if(u.push(i.slice(c).trim()),h.length===0||h.length>l.length||u.length!==h.length+1||u.length>s.length||u.some(y=>y.length===0))return e;let d=h.every((y,b)=>y===l[b]),f=h.every(y=>y===h[0]);if(!d&&!f)return e;let g=u.length===s.length,m=[];for(let y=0;y<u.length;y++){let b=u[y],S=s[y];if(b.length>S.length)return e;if(S.every(T=>!!(T.token&&T.token.pattern.test("0")&&!T.token.pattern.test("a")&&!T.token.pattern.test("Z")))){let T=y<u.length-1,w=y===u.length-1&&g&&s.length<=3&&S.length===2,E=b.length<S.length&&(T||w),I=E?S.length-b.length:0;for(let k=0;k<b.length;k++){let C=b[k];if(C<"0"||C>"9"||!S[I+k].token.pattern.test(C))return e}m.push(E?"0".repeat(S.length-b.length)+b:b)}else{if(b.length!==S.length)return e;for(let T=0;T<b.length;T++)if(!S[T].token||!S[T].token.pattern.test(b[T]))return e;m.push(b)}}let v=this.prefixSlotsCount>0?this.prefixString:"";for(let y=0;y<m.length;y++)y>0&&(v+=n[y-1]),v+=m[y];return{matched:!0,normalized:v,exactSegmentCount:g}}extractRawForCurrentPattern(t){return this.extractRawInternal(t)}extractRaw(t){return this.resolveForValue(t),this.extractRawInternal(t)}extractRawInternal(t){if(this.subEngines.length>0){let o=this.selectEngine(t);if(o!==this)return o.extractRawInternal(t)}let e=Math.max(4096,this.slots.length*4),i=String(t??"").slice(0,e);if(!i)return"";let s="",n=0,r=0;if(this.prefixSlotsCount>0){for(;n<i.length&&(i[n]===" "||i[n]===" ");)n++;let o=0;for(;n<i.length&&o<this.prefixSlotsCount;){let a=this.slots[o].char,l=i[n];if(l.toUpperCase()===a.toUpperCase())n++,o++;else if(a===" "&&l!==" ")o++;else break}r=this.prefixSlotsCount}for(;n<i.length&&r<this.slots.length;){let o=this.slots[r],a=i[n];if(o.isStatic)a.toUpperCase()===o.char.toUpperCase()&&n++,r++;else if(o.token&&o.token.pattern.test(a)){let l=o.token.transform?o.token.transform(a):a;this.autoLowercase&&!o.token.transform&&(l=l.toLowerCase()),s+=l,n++,r++}else this.strict?n++:(s+=this.autoLowercase?a.toLowerCase():a,n++,r++)}if(!this.strict&&n<i.length){let o=i.slice(n);s+=this.autoLowercase?o.toLowerCase():o}return s}format(t){if(this.resolveForValue(t),this.subEngines.length>0){let o=this.selectEngine(t);if(o!==this)return o.format(t)}let e=Math.max(4096,this.slots.length*4),i=String(t??"").slice(0,e);if(!this.slots.length)return i;let s=this.extractRawInternal(i);if(s.length===0)return this.prefixString;let n="",r=0;for(let o=0;o<this.slots.length;o++){let a=this.slots[o];if(a.isStatic){let l=r<s.length,u=r===0&&!!a.isPrefix,h=r>0&&r===s.length;if(l||u||h)n+=a.char;else break}else if(r<s.length){let l=s[r],u=a.token?.transform?a.token.transform(l):l;this.autoLowercase&&!a.token?.transform&&(u=u.toLowerCase()),n+=u,r++}else break}if(!this.strict&&r<s.length){let o=s.substring(r);n+=this.autoLowercase?o.toLowerCase():o}return n}getRemainingMask(t){return this.activeEngine&&this.activeEngine!==this?this.activeEngine.getRemainingMask(t):this.fullMaskTemplate?t.length>=this.fullMaskTemplate.length?t:t+this.fullMaskTemplate.substring(t.length):""}mapCursorPosition(t,e,i){if(this.activeEngine&&this.activeEngine!==this)return this.activeEngine.mapCursorPosition(t,e,i);let s=this.prefixSlotsCount,n=String(t??""),r=String(i??"");if(e<=0||!r)return s;let a=this.extractRawInternal(n.slice(0,e)).length;if(a===0)return Math.max(s,Math.min(this.getNextEditablePosition(0),r.length));let l=0,u=r.length;for(let h=0;h<r.length&&h<this.slots.length;h++)if(!this.slots[h].isStatic&&(l++,l===a)){u=h+1;break}for(;u<r.length&&this.slots[u]&&this.slots[u].isStatic;)u++;return Math.max(s,Math.min(u,r.length))}isSeparatorAt(t){return this.activeEngine&&this.activeEngine!==this?this.activeEngine.isSeparatorAt(t):t>=0&&t<this.slots.length?this.slots[t].isStatic:!1}getNextEditablePosition(t){if(this.activeEngine&&this.activeEngine!==this)return this.activeEngine.getNextEditablePosition(t);let e=Math.max(0,t);for(let i=e;i<this.slots.length;i++)if(!this.slots[i].isStatic)return i;return this.slots.length}getSlotAt(t){return this.activeEngine&&this.activeEngine!==this?this.activeEngine.getSlotAt(t):this.slots[t]}getSlots(){return this.activeEngine&&this.activeEngine!==this?this.activeEngine.getSlots():this.slots}};var V=class{stack=[];index=-1;maxDepth;constructor(t=50){this.maxDepth=t}push(t,e){let i=this.getCurrent();if(i&&i.raw===t){i.cursor=e;return}this.stack=this.stack.slice(0,this.index+1),this.stack.push({raw:t,cursor:e}),this.stack.length>this.maxDepth&&this.stack.shift(),this.index=this.stack.length-1}updateCurrentCursor(t){let e=this.getCurrent();e&&(e.cursor=t)}undo(){return this.canUndo()?(this.index--,this.stack[this.index]):null}redo(){return this.canRedo()?(this.index++,this.stack[this.index]):null}canUndo(){return this.index>0}canRedo(){return this.index>=0&&this.index<this.stack.length-1}getCurrent(){return this.index>=0&&this.index<this.stack.length?this.stack[this.index]:null}clear(){this.stack=[],this.index=-1}};var st=class{delegate;constructor(t){this.delegate=t}handleKeyDown(t){if(N(t))return;let e=this.delegate.getInput(),i=this.delegate.getEngine(),s=this.delegate.getHistory(),n=i.getPrefixLength(),r=e.selectionStart??0,o=e.selectionEnd??r;if((t.ctrlKey||t.metaKey)&&(t.key==="z"||t.key==="Z")&&!t.shiftKey){t.preventDefault(),this.delegate.undo();return}if((t.ctrlKey||t.metaKey)&&(t.key==="y"||t.key==="Y")||(t.ctrlKey||t.metaKey)&&t.shiftKey&&(t.key==="z"||t.key==="Z")){t.preventDefault(),this.delegate.redo();return}s.updateCurrentCursor(r);let a=t.key.length===1&&!t.ctrlKey&&!t.metaKey&&!t.altKey,l=o>r;if(a&&!l){let c=i.getSlots(),d=r<c.length&&c[r].isStatic&&c[r].char===t.key,f=-1;if(r>0&&r-1<c.length)if(c[r-1].isStatic&&c[r-1].char===t.key)f=r-1;else{let v=r-1;for(;v>=n&&c[v].isStatic;){if(c[v].char===t.key){f=v;break}v--}}if(d||f!==-1){t.preventDefault();let v=d?r:f,y=i.getNextEditablePosition(v+1);this.delegate.applyMask(e.value,y,!0);return}let m=-1;for(let v=r;v<c.length;v++)if(c[v].isStatic){c[v].char===t.key&&(m=v);break}if(m!==-1){t.preventDefault();let v=m-1;for(;v>=n&&!c[v].isStatic;)v--;v++;let y=m-v,b=e.value.slice(v,r);if(c.slice(v,m).every(T=>!!(T.token&&T.token.pattern.test("0")&&!T.token.pattern.test("a")&&!T.token.pattern.test("Z")))&&y>b.length&&b.length>0){let T=y-b.length,w="0".repeat(T)+b,E=e.value.slice(m),I=e.value.slice(0,v)+w+E,k=i.getNextEditablePosition(m+1);this.delegate.applyMask(I,k,!0);return}let A=i.getNextEditablePosition(m+1);this.delegate.applyMask(e.value,A,!0);return}}if(a&&i.isStrict()){let c=i.isDynamicPattern(),d=i.extractRaw(e.value),f=o>r?i.extractRawForCurrentPattern(e.value.slice(r,o)):"";if(c){let m=e.value.slice(0,r)+t.key+e.value.slice(o);i.resolveForValue(m)}let g=i.getMaxEditableCount();if(g>0&&g-(d.length-f.length)<=0){c&&i.resolveForValue(e.value),t.preventDefault();return}c&&i.resolveForValue(e.value)}if(o>r){if(t.key==="Backspace"||t.key==="Delete"){t.preventDefault();let c=e.value,d=c.slice(0,r)+c.slice(o);this.delegate.applyMask(d,Math.max(n,r));return}return}if(t.key==="ArrowLeft"&&!t.shiftKey&&r<=n){t.preventDefault(),e.setSelectionRange(n,n);return}if(t.key==="Home"&&n>0&&!t.shiftKey&&!t.ctrlKey&&!t.metaKey&&!t.altKey){t.preventDefault(),e.setSelectionRange(n,n);return}if(t.key==="Backspace"&&r<=n){t.preventDefault(),e.setSelectionRange(n,n);return}if(t.key==="Delete"&&r<n){t.preventDefault(),e.setSelectionRange(n,n);return}if(t.key==="Backspace"&&(t.ctrlKey||t.altKey||t.metaKey)){if(t.preventDefault(),r<=n){e.setSelectionRange(n,n);return}let c=r-1;for(;c>=n&&i.isSeparatorAt(c);)c--;for(;c>=n&&!i.isSeparatorAt(c);)c--;let d=Math.max(n,c+1),f=e.value,g=f.slice(0,d)+f.slice(r);this.delegate.applyMask(g,d);return}if(t.key==="Delete"&&(t.ctrlKey||t.altKey||t.metaKey)){t.preventDefault();let c=e.value;if(r>=c.length)return;let d=r;for(;d<c.length&&i.isSeparatorAt(d);)d++;for(;d<c.length&&!i.isSeparatorAt(d);)d++;for(;d<c.length&&i.isSeparatorAt(d);)d++;let f=d,g=c.slice(0,r)+c.slice(f);this.delegate.applyMask(g,r);return}if(t.key==="Backspace"&&r>n){if(i.isSeparatorAt(r-1)){t.preventDefault();let c=r-1;for(;c>n&&i.isSeparatorAt(c-1);)c--;if(c>n){let d=e.value,f=d.slice(0,c-1)+d.slice(r);this.delegate.applyMask(f,c-1)}else this.delegate.applyMask("",n)}return}if(t.key==="Delete"&&r<e.value.length){if(i.isSeparatorAt(r)){t.preventDefault();let c=r;for(;c<e.value.length&&i.isSeparatorAt(c);)c++;if(c<e.value.length){let d=e.value,f=d.slice(0,c)+d.slice(c+1);this.delegate.applyMask(f,r)}}return}}handleKeyUp(t){let e=this.delegate.getInput(),i=this.delegate.getHistory();(t.key==="ArrowLeft"||t.key==="ArrowRight"||t.key==="Home")&&!t.shiftKey&&this.delegate.enforceMinCursor(),i.updateCurrentCursor(e.selectionStart??0)}};var ht=class extends H{engine;history;keyboard;isComposing=!1;isUndoingRedoing=!1;isMouseDown=!1;isApplyingMask=!1;lastValue="";lastInternalRemainingMask="";isNotifying=!1;hasPendingNotification=!1;onChangeNativeHandler=()=>{};wasInputModeInferred=!1;cutTimerId=null;pasteTimerId=null;resetTimerId=null;lastInputType="";constructor(t,e,i){let s=j(t,e,i),n=s.wrapper,r=s.input,o=s.options,a=n?.getAttribute("data-mask")||r?.getAttribute("data-mask"),l=o.mask||a||"";typeof l=="string"&&l.includes("|")&&(l=l.split("|").map(S=>S.trim()));let u=o.placeholderChar||n?.getAttribute("data-mask-placeholder")||r?.getAttribute("data-mask-placeholder")||"_",h=n?.hasAttribute("data-disabled")||r?.hasAttribute("data-disabled"),c=n?.getAttribute("data-mask-strict")||r?.getAttribute("data-mask-strict"),d=n?.getAttribute("data-mask-auto-lowercase")==="true"||r?.getAttribute("data-mask-auto-lowercase")==="true",f=n?.getAttribute("data-mask-infer-inputmode")??r?.getAttribute("data-mask-infer-inputmode"),g=o.inferInputMode??(f!==null?f!=="false":!0),{disabled:m,...v}=o,y=m!==void 0?m:h?!0:!l||Array.isArray(l)&&l.length===0,b={...v,mask:l,placeholderChar:u,strict:o.strict??(c!==null?c!=="false":!0),autoLowercase:o.autoLowercase??d??!1,disabled:y,resetHistoryOnMaskChange:o.resetHistoryOnMaskChange??!1,inferInputMode:g,onInput:o.onInput||o.oninput,onChange:o.onChange||o.onchange,onComplete:o.onComplete||o.oncomplete};super(n,r,b),this.history=new V,this.engine=new q(this.options.mask||"",{placeholderChar:this.options.placeholderChar,tokens:this.options.tokens,strict:this.options.strict,autoLowercase:this.options.autoLowercase}),this.syncInferredInputMode(),this.keyboard=new st({getInput:()=>this.input,getEngine:()=>this.engine,getHistory:()=>this.history,applyMask:(S,A,T)=>this.applyMask(S,A,T),undo:()=>this.undo(),redo:()=>this.redo(),enforceMinCursor:()=>this.enforceMinCursor()}),this.bindEvents(),this.lastValue=this.isSensitiveField()?this.computePasswordDigest(this.input.value):this.input.value,this.syncInitialValue(),this.runAuditWarning(this.options.audit)}getSpecificAuditWarnings(){let t=[],e=[],i=this.checkAriaIdReferences(this.input,"aria-describedby",e,!0),s=!!this.input.getAttribute("placeholder")?.trim(),n=!!this.input.getAttribute("aria-placeholder")?.trim();return!i&&!n&&!this.options.disabled&&(s?t.push("Indication du format attendu fragile : l'attribut placeholder seul dispara\xEEt \xE0 la saisie et est masqu\xE9 par le gabarit fant\xF4me ; utilisez aria-describedby ou aria-placeholder (WCAG 3.3.2)."):t.push("Indication du format attendu manquante : d\xE9finissez aria-describedby ou aria-placeholder pour informer les technologies d'assistance (WCAG 3.3.2).")),t}extractRawSnippet(t){return this.engine.extractRaw(t)}onPasswordModeDetected(){this.history.clear(),this.lastValue="",this.lastInternalRemainingMask="",this.lastTrackedValue="",this.clearGhost(),this.wrapper.removeAttribute("data-mask")}static format(t,e,i={}){return q.format(t,e,i)}onNativeValueSet(t){if(this.options.disabled)this.checkValueChange();else{let e=this.applyTransformInput(t,"programmatic","");this.applyMask(e,e.length)}}onDisabledChange(t){t?(this.wrapper.removeAttribute("data-mask"),this.wrapper.classList.remove("is-complete","has-selection"),this.clearGhost(),this.checkValueChange()):this.applyMask(this.input.value,this.input.selectionStart??this.input.value.length),this.syncInferredInputMode()}bindEvents(){this.handleInput=this.handleInput.bind(this),this.onKeyDown=this.onKeyDown.bind(this),this.onPaste=this.onPaste.bind(this),this.onFocus=this.onFocus.bind(this),this.onBlur=this.onBlur.bind(this),this.onClick=this.onClick.bind(this),this.onKeyUp=this.onKeyUp.bind(this),this.onSelect=this.onSelect.bind(this),this.onMouseDown=this.onMouseDown.bind(this),this.onMouseUp=this.onMouseUp.bind(this),this.onCompositionStart=this.onCompositionStart.bind(this),this.onCompositionEnd=this.onCompositionEnd.bind(this),this.onScroll=this.onScroll.bind(this),this.onBeforeInput=this.onBeforeInput.bind(this),this.onCutHandler=()=>{this.cutTimerId!==null&&clearTimeout(this.cutTimerId),this.cutTimerId=window.setTimeout(()=>{if(this.cutTimerId=null,!this.isDestroyed)if(this.options.disabled)this.checkValueChange();else{let e=this.input.selectionStart??this.input.value.length;this.applyMask(this.input.value,e)}},0)},this.onChangeNativeHandler=()=>{this.isDestroyed||this.checkValueChange()};let{signal:t}=this.abortController;this.input.addEventListener("beforeinput",this.onBeforeInput,{signal:t}),this.input.addEventListener("input",this.handleInput,{signal:t}),this.input.addEventListener("keydown",this.onKeyDown,{signal:t}),this.input.addEventListener("paste",this.onPaste,{signal:t}),this.input.addEventListener("focus",this.onFocus,{signal:t}),this.input.addEventListener("blur",this.onBlur,{signal:t}),this.input.addEventListener("click",this.onClick,{signal:t}),this.input.addEventListener("keyup",this.onKeyUp,{signal:t}),this.input.addEventListener("select",this.onSelect,{signal:t}),this.input.addEventListener("mousedown",this.onMouseDown,{signal:t}),window.addEventListener("mouseup",this.onMouseUp,{signal:t}),this.input.addEventListener("compositionstart",this.onCompositionStart,{signal:t}),this.input.addEventListener("compositionend",this.onCompositionEnd,{signal:t}),this.input.addEventListener("scroll",this.onScroll,{passive:!0,signal:t}),this.input.addEventListener("cut",this.onCutHandler,{signal:t}),this.input.addEventListener("change",this.onChangeNativeHandler,{signal:t}),this.input.form&&(this.onFormResetHandler=()=>{this.resetTimerId!==null&&clearTimeout(this.resetTimerId),this.resetTimerId=window.setTimeout(()=>{this.resetTimerId=null,!this.isDestroyed&&(this.options.disabled?this.checkValueChange():this.syncInitialValue())},0)},this.input.form.addEventListener("reset",this.onFormResetHandler,{signal:t}))}syncInferredInputMode(){if(!this.options.inferInputMode)return;!this.options.disabled&&this.engine.isNumericOnly()?this.input.hasAttribute("inputmode")||(this.input.inputMode="numeric",this.wasInputModeInferred=!0):this.wasInputModeInferred&&this.input.getAttribute("inputmode")==="numeric"&&(this.input.removeAttribute("inputmode"),this.wasInputModeInferred=!1)}destroy(){this.isDestroyed||(this.cutTimerId!==null&&(clearTimeout(this.cutTimerId),this.cutTimerId=null),this.pasteTimerId!==null&&(clearTimeout(this.pasteTimerId),this.pasteTimerId=null),this.resetTimerId!==null&&(clearTimeout(this.resetTimerId),this.resetTimerId=null),this.wasInputModeInferred&&this.input.getAttribute("inputmode")==="numeric"&&this.input.removeAttribute("inputmode"),this.history.clear(),this.lastValue="",this.lastInternalRemainingMask="",super.destroy())}setStrict(t){this.options.strict=t,this.engine.setStrict(t),this.options.disabled||this.applyMask(this.input.value,this.input.selectionStart??this.input.value.length)}isStrict(){return this.engine.isStrict()}setMask(t,e){let i=typeof e=="boolean"?e:e&&typeof e=="object"&&e.strict!==void 0?e.strict:this.options.strict,s=e&&typeof e=="object"&&e.resetHistory!==void 0?e.resetHistory:!!this.options.resetHistoryOnMaskChange;if(!((!t||Array.isArray(t)&&t.length===0)&&this.options.disabled&&(!this.options.mask||this.options.mask===""))){if(!t||Array.isArray(t)&&t.length===0){this.options.mask="",this.options.strict=i,this.engine.setStrict(i??!0),this.engine.compile(""),s&&this.history.clear(),this.setDisabled(!0),this.syncInferredInputMode();return}this.options.mask=t,this.options.strict=i,this.engine.setStrict(i??!0),this.engine.compile(t),s&&this.history.clear(),this.setDisabled(!1),this.syncInferredInputMode()}}handleAttributeMutation(t){if(super.handleAttributeMutation(t),t==="data-mask"){let e=this.getAttr("data-mask");if(e===null&&(this.isSensitiveField()||typeof this.options.mask=="function")||e===this.lastInternalRemainingMask)return;let i=typeof this.options.mask=="function"?"":Array.isArray(this.options.mask)?this.options.mask.join("|"):this.options.mask||"";if(e===i)return;if(e){let s=e.includes("|")?e.split("|").map(n=>n.trim()):e;this.setMask(s)}else this.setMask(null)}else if(t==="data-mask-strict"){let e=this.getAttr("data-mask-strict");this.setStrict(e!=="false")}else t==="data-mask-auto-lowercase"?(this.options.autoLowercase=this.getAttr("data-mask-auto-lowercase")==="true",this.engine.setAutoLowercase(this.options.autoLowercase),this.engine.compile(this.options.mask||""),this.applyMask(this.input.value,this.input.selectionStart??this.input.value.length)):t==="placeholder"&&this.updateGhost(this.input.value)}applyTransformInput(t,e,i){if(typeof this.options.transformInput!="function")return t;try{let s=this.options.transformInput(t,{source:e,inputType:i});if(typeof s=="string")return e==="paste"?U(s,4096):ut(s,4096)}catch{}return t}setValue(t){let e=t!=null?String(t):"";if(this.options.disabled){this.input.value=e,this.checkValueChange();return}let i=this.applyTransformInput(e,"programmatic","");this.applyMask(i,i.length)}getRawValue(){return this.engine.extractRaw(this.input.value)}isComplete(){if(this.options.disabled)return!0;let t=this.getRawValue(),e=this.engine.getActiveEditableCount();return e===0?!0:t.length>=e}get onInput(){return this.options.onInput}set onInput(t){this.options.onInput=t}undo(){if(this.options.disabled)return;let t=this.history.undo();t&&(this.isUndoingRedoing=!0,this.applyMask(t.raw,t.cursor),this.isUndoingRedoing=!1)}redo(){if(this.options.disabled)return;let t=this.history.redo();t&&(this.isUndoingRedoing=!0,this.applyMask(t.raw,t.cursor),this.isUndoingRedoing=!1)}checkSelection(){if(this.options.disabled)return;let t=this.input.selectionStart??0,e=this.input.selectionEnd??t,i=t!==e;this.wrapper.classList.toggle("has-selection",i)}onBeforeInput(t){if(this.lastInputType=t.inputType||"",!this.options.disabled&&!this.isComposing&&this.engine.isStrict()&&!(t.inputType==="insertFromPaste"||t.inputType==="insertReplacementText")&&t.inputType&&t.inputType.startsWith("insert")){let e=this.input.value,i=this.engine.isDynamicPattern(),s=this.engine.extractRaw(e),n=this.input.selectionStart??0,r=this.input.selectionEnd??n,o=r>n?this.engine.extractRawForCurrentPattern(e.slice(n,r)):"";if(i){let l=e.slice(0,n)+(t.data??"")+e.slice(r);this.engine.resolveForValue(l)}let a=this.engine.getMaxEditableCount();if(a>0&&Math.max(0,a-(s.length-o.length))<=0){i&&this.engine.resolveForValue(e),t.preventDefault();return}i&&this.engine.resolveForValue(e)}}handleInput(t){if(this.isDispatchingNativeInput||this.isComposing)return;let e=t?.inputType||this.lastInputType||"";this.lastInputType="";let i=!!(this.options.onInput||this.options.oninput),s=this.isSensitiveField()?this.computePasswordDigest(this.input.value):this.input.value;if(i&&s!==this.lastValue&&this.checkValueChange(),this.options.disabled){this.checkValueChange();return}let n=this.input.value,r=this.input.selectionStart??n.length,o=this.applyTransformInput(n,"input",e),a=o!==n?r>=n.length?o.length:Math.min(r,o.length):r,l=this.history.getCurrent(),u=this.engine.extractRaw(o),h=this.engine.getMaxEditableCount();if(h>0&&this.engine.isStrict()&&l&&l.raw.length>=h&&u.length>h){this.applyMask(l.raw,l.cursor);return}this.applyMask(o,a),this.checkSelection()}onKeyDown(t){this.options.disabled||this.keyboard.handleKeyDown(t)}onMouseDown(){this.isMouseDown=!0}onMouseUp(){this.isMouseDown=!1,this.checkSelection()}onPaste(t){if(this.options.disabled){this.pasteTimerId!==null&&clearTimeout(this.pasteTimerId),this.pasteTimerId=window.setTimeout(()=>{this.pasteTimerId=null,this.isDestroyed||this.checkValueChange()},0);return}t.preventDefault(),this.history.updateCurrentCursor(this.input.selectionStart??0);let e=this.preparePastedText(this.getClipboardPlainText(t),4096),i=this.applyTransformInput(e,"paste","insertFromPaste");if(!i)return;let s=this.engine.getPrefixLength(),n=this.input.selectionStart??0,r=this.input.selectionEnd??n,o=this.input.value,a=this.getRawValue(),l=this.engine.getMaxEditableCount(),u=this.engine.getPrefix(),h=u.replace(/[\s.-]+/g,"").toUpperCase(),c=i.replace(/[\s.-]+/g,"").toUpperCase(),d=h.length>0&&c.startsWith(h),f=o.slice(0,Math.max(s,n)).replace(/[\s.-]+/g,"").toUpperCase(),g=f.length>=2&&c.startsWith(f),m=Math.max(s,n),v=Math.max(s,r);(d||g)&&(m=0,v=o.length);let y=Math.max(0,l-a.length);if(m!==v){let E=this.engine.extractRawForCurrentPattern(o.slice(m,v));y=Math.max(0,l-(a.length-E.length))}let b=this.engine.normalizePastedValue(i),S=this.engine.getActiveEditableCount(),A=S>0&&a.length>=S;if(this.engine.isStrict()&&(y<=0||n===r&&A)){let E=this.engine.extractRaw(b).length,I=this.engine.getMaxEditableCount();if(n===r&&I>0&&E===I&&(y<=0||E>y))m=0,v=o.length;else if(y<=0){this.engine.resolveForValue(o);return}else this.engine.resolveForValue(o)}let T,w;m===0&&v===o.length?(T=b,w=b.length):a.length===0&&m===s&&v===o.length?s>0&&b.toUpperCase().startsWith(u.toUpperCase())?(T=b,w=b.length):(T=o.slice(0,m)+b,w=T.length):(T=o.slice(0,m)+i+o.slice(v),w=m+i.length),this.applyMask(T,w),this.checkSelection()}onFocus(){this.syncGhostStyles(),this.wrapper.classList.add("is-focused"),!this.options.disabled&&!this.isMouseDown&&this.enforceMinCursor(),this.updateGhost(this.input.value),this.checkSelection()}onBlur(){if(this.wrapper.classList.remove("is-focused","has-selection"),this.isSensitiveField()){this.history.clear(),this.lastValue="",this.lastInternalRemainingMask="",this.lastTrackedValue="",this.clearGhost(),this.wrapper.removeAttribute("data-mask");return}this.updateGhost(this.input.value)}onClick(){this.options.disabled||this.enforceMinCursor(),this.history.updateCurrentCursor(this.input.selectionStart??0),this.checkSelection()}onKeyUp(t){this.options.disabled||this.keyboard.handleKeyUp(t),this.checkSelection()}onSelect(){this.history.updateCurrentCursor(this.input.selectionStart??0),this.checkSelection()}onCompositionStart(){this.isComposing=!0}onCompositionEnd(){if(this.isComposing=!1,this.options.disabled)return;let t=this.input.selectionStart??this.input.value.length;this.applyMask(this.input.value,t),this.checkSelection()}enforceMinCursor(){let t=this.engine.getPrefixLength();if(t<=0)return;let e=this.input.selectionStart??0,i=this.input.selectionEnd??e;e===i&&e<t&&this.input.setSelectionRange(t,t)}updateGhost(t){if(!this.ghost)return;if(this.options.disabled||this.isSensitiveField()){this.clearGhost();return}let e=!t||t===this.engine.getPrefix();if(this.shouldHideGhostForPlaceholder(e)){this.clearGhost();return}let i=this.engine.getFullMaskTemplate(),s=i.length>t.length?i.substring(t.length):"",n=this.input.ownerDocument||document,r=n.createElement("span");r.className="mask-ghost-typed",r.textContent=t;let o=n.createElement("span");o.className="mask-ghost-remaining",o.textContent=s,this.setGhostContent(r,o),this.ghost.scrollLeft=this.input.scrollLeft}applyMask(t,e,i=!1){if(this.options.disabled||this.isApplyingMask)return;this.isApplyingMask=!0;let s="",n=!1;try{s=this.engine.format(t),this.engine.isDynamicPattern()&&this.syncInferredInputMode();let r=this.engine.getRemainingMask(s),o=this.isSensitiveField();this.setNativeValue(s),o?(this.lastInternalRemainingMask="",this.wrapper.removeAttribute("data-mask"),this.clearGhost()):(this.lastInternalRemainingMask=r,this.wrapper.setAttribute("data-mask",r),this.updateGhost(s));let a=this.engine.getPrefixLength(),l;if(i||this.isUndoingRedoing)l=Math.max(a,Math.min(e,s.length));else{let u=this.engine.mapCursorPosition(t,e,s);l=Math.max(a,u)}this.input.setSelectionRange(l,l),n=this.isComplete(),this.wrapper.classList.toggle("is-complete",n),o?(this.options.copyRaw=!1,this.history.clear()):this.isUndoingRedoing||this.history.push(this.getRawValue(),l)}finally{this.isApplyingMask=!1}this.checkValueChange()}syncInitialValue(){let t=this.isSensitiveField();if(this.options.disabled){this.wrapper.removeAttribute("data-mask"),this.clearGhost(),this.lastValue=t?this.computePasswordDigest(this.input.value):this.input.value,this.checkValueChange();return}this.syncGhostStyles();let e=this.input.value||"";if(e){let i=this.applyTransformInput(e,"programmatic","");this.applyMask(i,i.length)}else{let i=this.engine.getPrefixLength();if(i>0)this.applyMask("",i);else{if(t)this.lastInternalRemainingMask="",this.wrapper.removeAttribute("data-mask"),this.clearGhost();else{this.history.push("",0);let s=this.engine.getFullMaskTemplate();this.lastInternalRemainingMask=s,this.wrapper.setAttribute("data-mask",s),this.updateGhost("")}this.checkValueChange()}}}checkValueChange(t=!1){let e=this.isSensitiveField(),i=this.input.value;if(!((e?this.computePasswordDigest(i):i)===this.lastValue&&!t&&!this.hasPendingNotification)){if(this.isNotifying){this.hasPendingNotification=!0;return}this.isNotifying=!0;try{let n=0,r=10;for(;((this.isSensitiveField()?this.computePasswordDigest(this.input.value):this.input.value)!==this.lastValue||this.hasPendingNotification||t)&&n<r;){n++,this.hasPendingNotification=!1,t=!1;let o=this.isSensitiveField(),a=this.input.value;this.lastValue=o?this.computePasswordDigest(a):a;let l=this.options.disabled?a:this.getRawValue(),u=this.options.disabled?0:this.engine.getActiveEditableCount(),h=this.isComplete(),c={value:a,rawValue:l,isComplete:h,totalSlots:u,filledSlots:this.options.disabled?a.length:l.length},d=!o,f=this.options.onInput||this.options.oninput;f&&f(a,c),this.input.dispatchEvent(new CustomEvent("mask:input",{bubbles:d,detail:c})),this.dispatchNativeInput();let g=this.options.onChange||this.options.onchange;g&&g(c),this.input.dispatchEvent(new CustomEvent("mask:change",{bubbles:d,detail:c}));let m=this.options.onComplete||this.options.oncomplete;h&&(m&&m(c),this.input.dispatchEvent(new CustomEvent("mask:complete",{bubbles:d,detail:c})))}}finally{this.isNotifying=!1}}}};var X=class p{options;constructor(t={}){let e=t.currency??"";!e&&t.unit&&(e=t.unit);let i=e==="$"||e==="\xA3"||e==="\xA5"?"prefix":"suffix",s=t.decimals!==void 0?Number(t.decimals):2,n=Number.isFinite(s)?Math.min(20,Math.max(0,Math.floor(s))):2;this.options={currency:String(e).slice(0,32),unit:String(t.unit??e).slice(0,32),currencyPosition:t.currencyPosition??i,decimals:n,decimalSeparator:String(t.decimalSeparator??",").slice(0,4)||",",thousandSeparator:String(t.thousandSeparator??"\xA0").slice(0,4),allowNegative:t.allowNegative??!1,min:t.min??-1/0,max:t.max??1/0}}normalizePastedValue(t){let e=U(t,512);if(!e)return"";let i=0,s=0,n=-1,r=-1;for(let o=0;o<e.length;o++){let a=e[o];a===","?(i++,n=o):a==="."&&(s++,r=o)}if(i>0&&s>0){let o=n>r?",":".";if((o===","?i:s)!==1)return e;let l=o===","?".":",";return e.split(l).join("").replace(o,this.options.decimalSeparator)}return i>=2&&s===0?e.split(",").join(""):s>=2&&i===0?e.split(".").join(""):e}parse(t){let e=String(t??"").slice(0,512).trim(),i=!1;this.options.allowNegative&&e.includes("-")&&(i=!0),this.options.currency&&(e=e.replace(new RegExp(this.escapeRegExp(this.options.currency),"g"),"")),this.options.thousandSeparator&&(e=e.replace(new RegExp(this.escapeRegExp(this.options.thousandSeparator),"g"),"")),e=e.replace(/[\s\u00A0]/g,"");let s=this.options.decimalSeparator,n=e.indexOf(s);n===-1&&(n=e.search(/[,.]/));let r="",o=null,a=!1;return n!==-1?(r=e.substring(0,n).replace(/\D/g,""),this.options.decimals>0&&(a=!0,o=e.substring(n+1).replace(/\D/g,"").slice(0,this.options.decimals))):r=e.replace(/\D/g,""),r.length>1&&(r=r.replace(/^0+/,"")||"0"),{isNegative:i,integerPart:r,decimalPart:o,hasDecimal:a}}format(t,e=t.length,i=!1){let s=String(t??"").slice(0,512),n=Math.max(0,Math.min(e,s.length));if(!s||s.trim()===""||s===this.options.currency.trim())return{formatted:"",rawNumber:null,rawValue:"",cursor:0,isValid:!0};let r=s.substring(0,n),o=r.replace(/\D/g,"").length,a=this.options.decimals>0&&/[,.]/.test(r),{isNegative:l,integerPart:u,decimalPart:h,hasDecimal:c}=this.parse(s),d=h,f=c;if(i&&this.options.decimals>0&&(u||h!==null)&&(f=!0,d===null?d="0".repeat(this.options.decimals):d.length<this.options.decimals&&(d=d+"0".repeat(this.options.decimals-d.length))),l&&!u&&!d&&!f&&this.options.allowNegative){let C="-",M=1;return this.options.currency&&(this.options.currencyPosition==="prefix"?(C=`${this.options.currency} -`,M=C.length):(C=`- ${this.options.currency}`,M=1)),{formatted:C,rawNumber:null,rawValue:"-",cursor:M,isValid:!0}}if(!u&&!d&&!f)return{formatted:"",rawNumber:null,rawValue:"",cursor:0,isValid:!0};let m=this.formatThousands(u||"0");f&&this.options.decimals>0&&(m+=this.options.decimalSeparator+(d??"")),l&&m!=="0"&&(m="-"+m);let v=m;this.options.currency&&(this.options.currencyPosition==="prefix"?v=`${this.options.currency} ${m}`:v=`${m} ${this.options.currency}`);let y=(l?"-":"")+(u||"0")+(h?"."+h:""),b=parseFloat(y);isNaN(b)&&(b=0);let S=b>=this.options.min&&b<=this.options.max,A=0;this.options.currency&&this.options.currencyPosition==="prefix"&&(A=this.options.currency.length+1);let T=0,w=!1,E=A;for(let C=A;C<v.length;C++){let M=v[C];if(M===this.options.currency.trim()[0]&&this.options.currencyPosition==="suffix")break;if(/\d/.test(M)?(T++,E=C+1):M===this.options.decimalSeparator&&(w=!0,E=C+1),a){if(w&&T>=o){A=C+1;break}}else if(T>=o){A=C+1;break}}o>0&&T<o&&E>A&&(A=E);let I=this.options.currency&&this.options.currencyPosition==="prefix"?this.options.currency.length+1:0,k=this.options.currency&&this.options.currencyPosition==="suffix"?Math.max(0,v.length-this.options.currency.length-1):v.length;return A=Math.max(I,Math.min(A,Math.max(I,k))),{formatted:v,rawNumber:b,rawValue:y,cursor:A,isValid:S}}static format(t,e={}){let i=new p(e),s=typeof t=="number"?t.toString():t;return i.format(s).formatted}formatThousands(t){let e=this.options.thousandSeparator;if(!e||t.length<=3)return t;let i=[],s=t.length;for(;s>0;){let n=Math.max(0,s-3);i.push(t.slice(n,s)),s=n}return i.reverse().join(e)}escapeRegExp(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}};var ce=10,pt=class extends H{engine;history;isUndoingRedoing=!1;isApplying=!1;isComposing=!1;isNotifying=!1;hasPendingNotification=!1;lastValue="";wasInputModeInferred=!1;cutTimerId=null;resetTimerId=null;cursorTimerId=null;constructor(t,e,i){let s=j(t,e,i),n=s.wrapper,r=s.input,o=s.options,a=n?.getAttribute("data-mask-pad-decimals")==="true"||r?.getAttribute("data-mask-pad-decimals")==="true",l=r?.getAttribute("data-mask-align")||r?.getAttribute("data-align")||n?.getAttribute("data-mask-align")||n?.getAttribute("data-align"),u={align:o.align??l??"right",padDecimalsOnBlur:o.padDecimalsOnBlur??a??!1,...o};super(n,r,u),this.input.hasAttribute("inputmode")||(this.input.inputMode="decimal",this.wasInputModeInferred=!0),this.history=new V,this.engine=new X(this.options),this.bindEvents(),this.input.value?this.options.disabled||this.applyAmount(this.input.value,this.input.value.length):this.updateGhost({formatted:"",rawNumber:null,rawValue:"",cursor:0,isValid:!0}),this.runAuditWarning(this.options.audit)}extractRawSnippet(t){let e=this.engine.parse(t);return!e.integerPart&&!e.decimalPart?"":(e.isNegative?"-":"")+(e.integerPart||"0")+(e.decimalPart?"."+e.decimalPart:"")}onPasswordModeDetected(){this.history.clear(),this.lastValue="",this.lastTrackedValue="",this.clearGhost()}static format(t,e={}){return X.format(t,e)}onNativeValueSet(t){if(this.options.disabled||this.isComposing){this.lastValue=this.isSensitiveField()?this.computePasswordDigest(t):t;return}this.applyAmount(t,t.length)}onDisabledChange(t){t?this.clearGhost():this.applyAmount(this.input.value,this.input.selectionStart??this.input.value.length)}bindEvents(){this.handleInput=this.handleInput.bind(this),this.handleKeyDown=this.handleKeyDown.bind(this),this.handlePaste=this.handlePaste.bind(this),this.handleBlur=this.handleBlur.bind(this),this.handleFocus=this.handleFocus.bind(this),this.handleClick=this.handleClick.bind(this),this.onCompositionStart=this.onCompositionStart.bind(this),this.onCompositionEnd=this.onCompositionEnd.bind(this),this.onCutHandler=()=>{this.cutTimerId!==null&&clearTimeout(this.cutTimerId),this.cutTimerId=window.setTimeout(()=>{if(this.cutTimerId=null,this.isDestroyed||this.options.disabled)return;let e=this.input.selectionStart??this.input.value.length;this.applyAmount(this.input.value,e)},0)};let{signal:t}=this.abortController;this.input.addEventListener("input",this.handleInput,{signal:t}),this.input.addEventListener("keydown",this.handleKeyDown,{signal:t}),this.input.addEventListener("paste",this.handlePaste,{signal:t}),this.input.addEventListener("blur",this.handleBlur,{signal:t}),this.input.addEventListener("focus",this.handleFocus,{signal:t}),this.input.addEventListener("click",this.handleClick,{signal:t}),this.input.addEventListener("scroll",this.onScroll,{passive:!0,signal:t}),this.input.addEventListener("cut",this.onCutHandler,{signal:t}),this.input.addEventListener("compositionstart",this.onCompositionStart,{signal:t}),this.input.addEventListener("compositionend",this.onCompositionEnd,{signal:t}),this.input.form&&(this.onFormResetHandler=()=>{this.resetTimerId!==null&&clearTimeout(this.resetTimerId),this.resetTimerId=window.setTimeout(()=>{this.resetTimerId=null,!this.isDestroyed&&(this.options.disabled||this.applyAmount(this.input.value,this.input.value.length))},0)},this.input.form.addEventListener("reset",this.onFormResetHandler,{signal:t}))}onCompositionStart(){this.isComposing=!0}onCompositionEnd(){if(this.isComposing=!1,this.options.disabled)return;let t=this.input.selectionStart??this.input.value.length;this.applyAmount(this.input.value,t)}applyAmount(t,e){if(this.isApplying||this.options.disabled)return;this.isApplying=!0;let i=null;try{i=this.engine.format(t,e),this.setNativeValue(i.formatted),this.input.setSelectionRange(i.cursor,i.cursor),this.isSensitiveField()?(this.options.copyRaw=!1,this.history.clear(),this.clearGhost()):(this.isUndoingRedoing||this.history.push(i.rawValue,i.cursor),this.updateGhost(i))}finally{this.isApplying=!1}i&&this.checkValueChange(i)}updateGhost(t){if(this.ghost){if(this.options.disabled||this.isSensitiveField()){this.clearGhost();return}if(!t.formatted){if(this.shouldHideGhostForPlaceholder(!0)){this.clearGhost();return}let e=this.options.currency?this.options.currencyPosition==="prefix"?`${this.options.currency} 0`:`0 ${this.options.currency}`:"0,00",s=(this.input.ownerDocument||document).createElement("span");s.className="mask-ghost-remaining",s.textContent=e,this.setGhostContent(s);return}this.clearGhost(),this.ghost.scrollLeft=this.input.scrollLeft}}handleInput(){if(this.isDispatchingNativeInput||this.options.disabled||this.isComposing)return;let t=this.input.value,e=this.input.selectionStart??t.length;this.applyAmount(t,e)}handlePaste(t){if(this.options.disabled)return;t.preventDefault(),this.history.updateCurrentCursor(this.input.selectionStart??0);let e=this.preparePastedText(this.getClipboardPlainText(t),512);if(!e)return;let i=this.engine.normalizePastedValue(e),s=this.input.selectionStart??this.input.value.length,n=this.input.selectionEnd??s,r=this.input.value.slice(0,s)+i+this.input.value.slice(n);this.applyAmount(r,s+i.length)}handleKeyDown(t){if(!(this.options.disabled||N(t))){if((t.ctrlKey||t.metaKey)&&(t.key==="z"||t.key==="Z")){t.preventDefault(),t.shiftKey?this.redo():this.undo();return}if((t.ctrlKey||t.metaKey)&&(t.key==="y"||t.key==="Y")){t.preventDefault(),this.redo();return}if(t.key==="Backspace"){let e=this.input.selectionStart??0,i=this.input.selectionEnd??0;if(e===i&&e>0){let s=this.input.value,n=s[e-1];if(n===this.engine.options.thousandSeparator||n===" "){t.preventDefault();let r=Math.max(0,e-2),o=s.slice(0,r)+s.slice(e);this.applyAmount(o,r);return}if(this.options.currency&&this.options.currencyPosition==="prefix"&&e<=this.options.currency.length+1){t.preventDefault();return}}}if(t.key==="Delete"){let e=this.input.selectionStart??0,i=this.input.selectionEnd??0;if(e===i&&e<this.input.value.length){let s=this.input.value,n=s[e];if(n===this.engine.options.thousandSeparator||n===" "){t.preventDefault();let r=s.slice(0,e)+s.slice(e+2);this.applyAmount(r,e);return}if(this.options.currency&&this.options.currencyPosition==="suffix"){let r=s.length-this.options.currency.length-1;if(e>=r){t.preventDefault();return}}}}(t.key==="ArrowLeft"||t.key==="ArrowRight"||t.key==="Home"||t.key==="End")&&(this.cursorTimerId!==null&&clearTimeout(this.cursorTimerId),this.cursorTimerId=window.setTimeout(()=>{this.cursorTimerId=null,this.enforceCursorBounds()},0))}}enforceCursorBounds(){if(this.isDestroyed||!this.isFocused||Y(this.input.ownerDocument)!==this.input||!this.input.value||this.options.disabled)return;let t=this.input.selectionStart??0,e=this.input.selectionEnd??0;if(t!==e)return;let i=this.input.value,s=this.options.currency;if(s){if(this.options.currencyPosition==="prefix"){let n=s.length+1;t<n&&this.input.setSelectionRange(n,n)}else if(this.options.currencyPosition==="suffix"){let n=Math.max(0,i.length-s.length-1);t>n&&this.input.setSelectionRange(n,n)}}}handleClick(){this.enforceCursorBounds()}handleFocus(){this.wrapper.classList.add("is-focused"),this.syncGhostStyles(),this.enforceCursorBounds(),this.updateGhost(this.engine.format(this.input.value))}handleBlur(){if(this.wrapper.classList.remove("is-focused"),this.isSensitiveField()){this.history.clear(),this.lastValue="",this.lastTrackedValue="",this.clearGhost();return}if(this.options.padDecimalsOnBlur&&!this.options.disabled&&this.input.value.trim().length>0){let e=this.engine.format(this.input.value,this.input.value.length,!0);e.formatted!==this.input.value&&(this.setNativeValue(e.formatted),this.lastValue=e.formatted)}this.updateGhost(this.engine.format(this.input.value));let t=this.getDetail();this.options.onChange&&this.options.onChange(t),this.input.dispatchEvent(new CustomEvent("mask:change",{bubbles:!this.isSensitiveField(),detail:t}))}handleAttributeMutation(t){super.handleAttributeMutation(t),t==="data-mask-pad-decimals"?this.options.padDecimalsOnBlur=this.getAttr("data-mask-pad-decimals")==="true":t==="placeholder"&&this.updateGhost(this.engine.format(this.input.value))}checkValueChange(t){if(!((this.isSensitiveField()?this.computePasswordDigest(this.input.value):this.input.value)===this.lastValue&&!this.hasPendingNotification)){if(this.isNotifying){this.hasPendingNotification=!0;return}this.isNotifying=!0;try{let s=0,n=t;for(;((this.isSensitiveField()?this.computePasswordDigest(this.input.value):this.input.value)!==this.lastValue||this.hasPendingNotification)&&s<ce;){s++,this.hasPendingNotification=!1;let r=this.isSensitiveField(),o=this.input.value;this.lastValue=r?this.computePasswordDigest(o):o;let a=n??this.engine.format(o);n=void 0,this.notifyChange(a)}}finally{this.isNotifying=!1}}}notifyChange(t){let e={value:t.formatted,number:t.rawNumber,rawValue:t.rawValue,isValid:t.isValid};this.options.onInput&&this.options.onInput(e),this.input.dispatchEvent(new CustomEvent("mask:input",{bubbles:!this.isSensitiveField(),detail:e})),this.dispatchNativeInput()}undo(){let t=this.history.undo();if(t){this.isUndoingRedoing=!0;try{this.applyAmount(t.raw,t.cursor)}finally{this.isUndoingRedoing=!1}}}redo(){let t=this.history.redo();if(t){this.isUndoingRedoing=!0;try{this.applyAmount(t.raw,t.cursor)}finally{this.isUndoingRedoing=!1}}}getDetail(){let t=this.engine.format(this.input.value);return{value:t.formatted,number:t.rawNumber,rawValue:t.rawValue,isValid:t.isValid}}getNumber(){return this.getDetail().number}getRawValue(){return this.getDetail().rawValue}isValid(){return this.getDetail().isValid}getSpecificAuditWarnings(){let t=[],e=(this.options.currency||this.options.unit||"").trim();if(!e||this.options.disabled)return t;let i=[],s=this.checkAriaIdReferences(this.input,"aria-describedby",i,!0),n=!!this.input.getAttribute("aria-placeholder")?.trim();if(s||n)return t;let r=this.input.ownerDocument||document,o=typeof this.input.getRootNode=="function"?this.input.getRootNode():r,a=typeof ShadowRoot<"u"&&o instanceof ShadowRoot?o:r,l=this.input.getAttribute("aria-label")||"",u=this.input.getAttribute("aria-labelledby")?.trim();if(u)for(let g of u.split(/\s+/).filter(Boolean)){let m=typeof ShadowRoot<"u"&&o instanceof ShadowRoot?o.getElementById(g):r.getElementById(g);m?.textContent&&(l+=" "+m.textContent)}let h=this.input.closest("label");if(h?.textContent&&(l+=" "+h.textContent),this.input.id)try{let g=a.querySelector(`label[for="${at(this.input.id)}"]`);g?.textContent&&(l+=" "+g.textContent)}catch{}let c=l.toLowerCase(),d=e.toLowerCase();return c.includes(d)||d==="\u20AC"&&(c.includes("euro")||c.includes("eur"))||d==="$"&&(c.includes("dollar")||c.includes("usd"))||d==="\xA3"&&(c.includes("livre")||c.includes("pound")||c.includes("gbp"))||t.push(`Devise/unit\xE9 "${e}" non expos\xE9e aux technologies d'assistance quand le champ est vide (le fant\xF4me est aria-hidden="true") : mentionnez-la dans le <label>, aria-label ou aria-describedby (WCAG 3.3.2).`),t}setValue(t){let e=t!=null?String(t):"";this.options.disabled?(this.setNativeValue(e),this.lastValue=this.isSensitiveField()?this.computePasswordDigest(e):e):this.applyAmount(e,e.length)}destroy(){this.isDestroyed||(this.cutTimerId!==null&&(clearTimeout(this.cutTimerId),this.cutTimerId=null),this.resetTimerId!==null&&(clearTimeout(this.resetTimerId),this.resetTimerId=null),this.cursorTimerId!==null&&(clearTimeout(this.cursorTimerId),this.cursorTimerId=null),this.wasInputModeInferred&&this.input.getAttribute("inputmode")==="decimal"&&this.input.removeAttribute("inputmode"),this.lastValue="",this.history.clear(),super.destroy())}};var nt=class p{domains;tlds;suggestOnAt;defaultDomain=null;defaultTld="__";static DEFAULT_DOMAINS=["gmail.com","outlook.com","orange.fr","free.fr","sfr.fr","yahoo.com","hotmail.com","icloud.com","laposte.net","proton.me"];static DEFAULT_TLDS=["com","fr","net","org","eu","io","co","info","biz","me","tv","fi","be","ch","ca","uk","de","es","it"];constructor(t={}){let e=Array.isArray(t.domains)?t.domains.slice(0,500).map(i=>String(i??"").trim().slice(0,253)).filter(Boolean):[];this.domains=e.length>0?e:p.DEFAULT_DOMAINS,this.tlds=t.tlds&&t.tlds.length>0?t.tlds.slice(0,200).map(i=>String(i).trim().replace(/^\./,"").slice(0,32)).filter(Boolean):[...p.DEFAULT_TLDS],this.suggestOnAt=t.suggestOnAt??!0,this.setDefaultDomain(t.defaultDomain??null),this.setDefaultTld(t.defaultTld!==void 0?t.defaultTld:"__")}setDefaultDomain(t){t===!0?this.defaultDomain=this.domains.length>0?this.domains[0]:null:typeof t=="string"&&t.trim().length>0?this.defaultDomain=t.trim().replace(/^@/,"").slice(0,253)||null:this.defaultDomain=null}setDefaultTld(t){t===!0?this.defaultTld=this.tlds.length>0?this.tlds[0]:null:typeof t=="string"&&t.trim().length>0?this.defaultTld=t.trim().replace(/^\./,"").slice(0,32)||null:this.defaultTld=null}setTlds(t){this.tlds=t&&t.length>0?t.slice(0,200).map(e=>String(e).trim().replace(/^\./,"").slice(0,32)).filter(Boolean):[...p.DEFAULT_TLDS]}getMatchingTlds(t){let e=(t??"").toLowerCase();return e.length===0?[...this.tlds]:this.tlds.filter(i=>i.toLowerCase().startsWith(e)&&i.toLowerCase()!==e)}getMatchingDomains(t){let e=String(t??"").slice(0,512);if(!e.includes("@"))return this.defaultDomain?[this.defaultDomain]:[];let i=e.indexOf("@");if(e.indexOf("@",i+1)!==-1)return[];let s=e.substring(i+1);if(s.length===0)return this.suggestOnAt?[...this.domains]:[];let n=s.toLowerCase();return this.domains.filter(r=>r.toLowerCase().startsWith(n)&&r.toLowerCase()!==n)}getSuggestion(t,e=0){let i=String(t??"").slice(0,512);if(!i.includes("@"))return this.defaultDomain?{full:i?`${i}@${this.defaultDomain}`:`@${this.defaultDomain}`,remaining:`@${this.defaultDomain}`,matchedDomain:this.defaultDomain,isHintOnly:!1}:{full:i,remaining:"",matchedDomain:null,isHintOnly:!1};let s=i.indexOf("@"),n=i.substring(0,s),r=i.substring(s+1);if(i.indexOf("@",s+1)!==-1)return{full:i,remaining:"",matchedDomain:null,isHintOnly:!1};let o=this.getMatchingDomains(t);if(o.length>0){let f=(e%o.length+o.length)%o.length,g=o[f],m=r.toLowerCase(),v=g.substring(m.length);return{full:`${n}@${g}`,remaining:v,matchedDomain:g,isHintOnly:!1}}if(r.length===0||r.startsWith("."))return{full:i,remaining:"",matchedDomain:null,isHintOnly:!1};let a=r.toLowerCase();if(this.domains.some(f=>f.toLowerCase()===a))return{full:i,remaining:"",matchedDomain:r,isHintOnly:!1};let l=r.lastIndexOf(".");if(l===-1){if(!this.defaultTld)return{full:i,remaining:"",matchedDomain:null,isHintOnly:!1};let f=this.defaultTld.includes("_"),g=`.${this.defaultTld}`,m=`${r}.${this.defaultTld}`;return{full:f?i:`${n}@${m}`,remaining:g,matchedDomain:f?null:m,isHintOnly:f}}let u=r.substring(0,l),h=r.substring(l+1);if(!u||u.endsWith("."))return{full:i,remaining:"",matchedDomain:null,isHintOnly:!1};if(h.length===0){if(this.defaultTld&&!this.defaultTld.includes("_")){let f=`${u}.${this.defaultTld}`;return{full:`${n}@${f}`,remaining:this.defaultTld,matchedDomain:f,isHintOnly:!1}}return this.defaultTld&&this.defaultTld.includes("_")?{full:i,remaining:this.defaultTld,matchedDomain:null,isHintOnly:!0}:{full:i,remaining:"",matchedDomain:null,isHintOnly:!1}}let c=h.toLowerCase();if(this.tlds.some(f=>f.toLowerCase()===c))return{full:i,remaining:"",matchedDomain:r,isHintOnly:!1};let d=this.getMatchingTlds(h);if(d.length>0){let f=(e%d.length+d.length)%d.length,g=d[f],m=g.substring(c.length),v=`${u}.${g}`;return{full:`${n}@${v}`,remaining:m,matchedDomain:v,isHintOnly:!1}}if(this.defaultTld&&this.defaultTld.includes("_")&&h.length<this.defaultTld.length){let f=this.defaultTld.substring(h.length);if(f.includes("_"))return{full:i,remaining:f,matchedDomain:null,isHintOnly:!0}}return{full:i,remaining:"",matchedDomain:null,isHintOnly:!1}}};var de=10,ft=class extends H{engine;currentSuggestion={full:"",remaining:"",matchedDomain:null};currentSuggestionIndex=0;hadInitialAriaAutocomplete=!1;wasAriaAutocompleteSet=!1;isSuggestionDismissed=!1;isNotifying=!1;hasPendingNotification=!1;wasAutocorrectSet=!1;wasAutocapitalizeSet=!1;wasSpellcheckSet=!1;wasInputModeInferred=!1;isComposing=!1;lastNotifiedValue="";srStatusEl=null;srAnnounceTimerId=null;lastAnnouncedSuggestion="";cutTimerId=null;resetTimerId=null;constructor(t,e,i){let s=j(t,e,i),n=s.wrapper,r=s.input,o=s.options,a=n?.getAttribute("data-mask-cycle-suggestions")==="true"||r?.getAttribute("data-mask-cycle-suggestions")==="true",l=n?.getAttribute("data-mask-auto-lowercase")==="true"||r?.getAttribute("data-mask-auto-lowercase")==="true",u=n?.getAttribute("data-mask-aria-autocomplete")??r?.getAttribute("data-mask-aria-autocomplete"),h=o.setAriaAutocomplete??(u!==null?u!=="false":!0),c=n?.getAttribute("data-mask-tlds")??r?.getAttribute("data-mask-tlds"),d=o.tlds??(c?c.split(",").map(v=>v.trim()).filter(Boolean):void 0),f=n?.getAttribute("data-mask-default-tld")??r?.getAttribute("data-mask-default-tld"),g=o.defaultTld!==void 0?o.defaultTld:f!==null?f==="false"||f==="none"?null:f==="true"?!0:f:void 0,m={completeOnTab:!0,completeOnArrowRight:!0,completeOnEnter:!0,cycleSuggestions:o.cycleSuggestions??a??!1,autoLowercase:o.autoLowercase??l??!1,setAriaAutocomplete:h,...o,...d!==void 0?{tlds:d}:{},...g!==void 0?{defaultTld:g}:{}};super(n,r,m),this.input.hasAttribute("inputmode")||(this.input.inputMode="email",this.wasInputModeInferred=!0),this.input.hasAttribute("autocorrect")||(this.input.setAttribute("autocorrect","off"),this.wasAutocorrectSet=!0),this.input.hasAttribute("autocapitalize")||(this.input.setAttribute("autocapitalize","none"),this.wasAutocapitalizeSet=!0),this.input.hasAttribute("spellcheck")||(this.input.setAttribute("spellcheck","false"),this.wasSpellcheckSet=!0),this.hadInitialAriaAutocomplete=this.input.hasAttribute("aria-autocomplete"),this.syncAriaAutocomplete(),this.engine=new nt(this.options),this.lastNotifiedValue=this.isSensitiveField()?"":this.input.value,this.bindEvents(),!this.options.disabled&&!this.isSensitiveField()&&this.updateSuggestion(),this.runAuditWarning(this.options.audit)}syncAriaAutocomplete(){let t=!!(this.options.setAriaAutocomplete&&!this.options.disabled&&!this.isSensitiveField()&&!this.isDestroyed);this.hadInitialAriaAutocomplete||(t?this.input.hasAttribute("aria-autocomplete")||(this.input.setAttribute("aria-autocomplete","inline"),this.wasAriaAutocompleteSet=!0):this.wasAriaAutocompleteSet&&(this.input.getAttribute("aria-autocomplete")==="inline"&&this.input.removeAttribute("aria-autocomplete"),this.wasAriaAutocompleteSet=!1));let e=this.input.ownerDocument||(typeof document<"u"?document:null),i=!!(e&&typeof e.ariaNotify=="function");t&&!i?this.ensureSrStatusEl():!t&&this.srStatusEl&&(this.srStatusEl.remove(),this.srStatusEl=null)}onPasswordModeDetected(){this.srAnnounceTimerId!==null&&(clearTimeout(this.srAnnounceTimerId),this.srAnnounceTimerId=null),this.lastNotifiedValue="",this.lastTrackedValue="",this.lastAnnouncedSuggestion="",this.currentSuggestion={full:"",remaining:"",matchedDomain:null},this.syncAriaAutocomplete(),this.clearGhost()}onNativeValueSet(t){this.options.disabled||this.isComposing||this.isSensitiveField()||(this.isSuggestionDismissed=!1,this.updateSuggestion())}onDisabledChange(t){this.syncAriaAutocomplete(),t||this.isSensitiveField()?(this.currentSuggestion={full:"",remaining:"",matchedDomain:null},this.clearGhost()):(this.isSuggestionDismissed=!1,this.updateSuggestion())}bindEvents(){this.handleInput=this.handleInput.bind(this),this.handleKeyDown=this.handleKeyDown.bind(this),this.handlePaste=this.handlePaste.bind(this),this.handleBlur=this.handleBlur.bind(this),this.handleFocus=this.handleFocus.bind(this),this.onCutHandler=()=>{this.cutTimerId!==null&&clearTimeout(this.cutTimerId),this.cutTimerId=window.setTimeout(()=>{this.cutTimerId=null,!(this.isDestroyed||this.options.disabled||this.isSensitiveField())&&this.updateSuggestion()},0)};let{signal:t}=this.abortController;this.input.addEventListener("input",this.handleInput,{signal:t}),this.input.addEventListener("keydown",this.handleKeyDown,{signal:t}),this.input.addEventListener("paste",this.handlePaste,{signal:t}),this.input.addEventListener("blur",this.handleBlur,{signal:t}),this.input.addEventListener("focus",this.handleFocus,{signal:t}),this.input.addEventListener("scroll",this.onScroll,{passive:!0,signal:t}),this.input.addEventListener("cut",this.onCutHandler,{signal:t}),this.input.addEventListener("compositionstart",()=>{this.isComposing=!0},{signal:t}),this.input.addEventListener("compositionend",()=>{this.isComposing=!1,!this.isDestroyed&&!this.options.disabled&&!this.isSensitiveField()&&this.handleInput()},{signal:t}),this.input.form&&(this.onFormResetHandler=()=>{this.resetTimerId!==null&&clearTimeout(this.resetTimerId),this.resetTimerId=window.setTimeout(()=>{this.resetTimerId=null,!(this.isDestroyed||this.options.disabled||this.isSensitiveField())&&this.updateSuggestion()},0)},this.input.form.addEventListener("reset",this.onFormResetHandler,{signal:t}))}ensureSrStatusEl(){if(this.srStatusEl&&this.wrapper.contains(this.srStatusEl))return this.srStatusEl;let t=this.input.ownerDocument||(typeof document<"u"?document:null);if(!t)return null;let e=t.createElement("span");return e.className="wulf-mask-sr-status",e.setAttribute("aria-live","polite"),e.setAttribute("aria-atomic","true"),this.wrapper.appendChild(e),this.srStatusEl=e,e}scheduleSuggestionAnnouncement(t=!1){if(this.srAnnounceTimerId!==null&&(clearTimeout(this.srAnnounceTimerId),this.srAnnounceTimerId=null),!this.options.setAriaAutocomplete||!this.isFocused||this.isDestroyed||this.isSensitiveField())return;let e=this.currentSuggestion;if(!e.remaining||e.isHintOnly){this.lastAnnouncedSuggestion="",this.srStatusEl&&(this.srStatusEl.textContent="");return}let i=e.full;if(i===this.lastAnnouncedSuggestion&&!t)return;let s=()=>{if(this.srAnnounceTimerId=null,this.isDestroyed||!this.isFocused||this.isSensitiveField())return;this.lastAnnouncedSuggestion=i;let r=this.input.ownerDocument||(typeof document<"u"?document:null);if(r&&typeof r.ariaNotify=="function")try{r.ariaNotify(i,{priority:"normal"});return}catch{}let o=this.ensureSrStatusEl();o&&(o.textContent=o.textContent===i?`${i}\xA0`:i)};t?s():this.srAnnounceTimerId=window.setTimeout(s,250)}updateSuggestion(t){if(this.options.disabled||this.isSensitiveField()){this.currentSuggestion={full:"",remaining:"",matchedDomain:null},this.clearGhost();return}let e=this.input.value;if(this.currentSuggestion=this.isSuggestionDismissed?{full:e,remaining:"",matchedDomain:null}:this.engine.getSuggestion(e,this.currentSuggestionIndex),!!this.ghost){if(this.shouldHideGhostForPlaceholder(e.length===0))this.clearGhost();else if(this.currentSuggestion.remaining){let i=this.input.ownerDocument||document,s=i.createElement("span");s.className="mask-ghost-typed",s.textContent=e;let n=i.createElement("span");n.className="mask-ghost-remaining",n.textContent=this.currentSuggestion.remaining,this.setGhostContent(s,n)}else this.clearGhost();this.ghost.scrollLeft=this.input.scrollLeft,t?.announce&&this.scheduleSuggestionAnnouncement(!!t.immediate),this.notifyValueChange()}}notifyValueChange(){if(this.isNotifying){this.hasPendingNotification=!0;return}this.isNotifying=!0;try{let t=0;do{t++,this.hasPendingNotification=!1;let e=this.isSensitiveField(),i=!e,s=this.input.value,n=this.getDetail();this.options.onInput&&this.options.onInput(n),this.input.dispatchEvent(new CustomEvent("mask:input",{bubbles:i,detail:n})),s!==this.lastNotifiedValue&&(this.lastNotifiedValue=e?"":s,this.dispatchNativeInput())}while(this.hasPendingNotification&&t<de)}finally{this.isNotifying=!1}}handleInput(t){if(!this.isDispatchingNativeInput&&!(this.options.disabled||this.isSensitiveField())&&!(this.isComposing||t&&"isComposing"in t&&t.isComposing)){if(this.options.autoLowercase){let e=this.input.selectionStart??0,i=this.input.selectionEnd??e,s=this.input.value.toLowerCase();s!==this.input.value&&(this.setNativeValue(s),this.input.setSelectionRange(e,i))}this.isSuggestionDismissed=!1,this.currentSuggestionIndex=0,this.updateSuggestion({announce:!0,immediate:!1})}}handlePaste(t){if(this.options.disabled||this.isSensitiveField())return;let e=this.getClipboardPlainText(t),i=this.preparePastedText(e,512);if(i===e)return;t.preventDefault();let s=this.input.selectionStart??this.input.value.length,n=this.input.selectionEnd??s,r=this.input.value.slice(0,s),o=this.input.value.slice(n),a=r+i+o,l=this.options.autoLowercase?a.toLowerCase():a;if(typeof document<"u"&&Y(this.input.ownerDocument)===this.input&&typeof document.execCommand=="function")try{if(document.execCommand("insertText",!1,i)&&this.input.value===l)return}catch{}this.setNativeValue(a);let u=s+i.length;this.input.setSelectionRange(u,u),this.handleInput()}handleKeyDown(t){if(this.options.disabled||this.isSensitiveField()||N(t)||t.shiftKey||t.ctrlKey||t.altKey||t.metaKey)return;let e=!!this.currentSuggestion.remaining&&!this.currentSuggestion.isHintOnly,s=(this.input.selectionStart??0)===this.input.value.length,n=this.input.value.length>0;if(t.key==="Escape"&&e){t.preventDefault(),this.isSuggestionDismissed=!0,this.currentSuggestion={full:this.input.value,remaining:"",matchedDomain:null},this.srAnnounceTimerId!==null&&(clearTimeout(this.srAnnounceTimerId),this.srAnnounceTimerId=null),this.lastAnnouncedSuggestion="",this.srStatusEl&&(this.srStatusEl.textContent=""),this.clearGhost();return}if(this.options.cycleSuggestions&&e&&n&&s){if(t.key==="ArrowDown"){t.preventDefault(),this.currentSuggestionIndex++,this.updateSuggestion({announce:!0,immediate:!0});return}if(t.key==="ArrowUp"){t.preventDefault(),this.currentSuggestionIndex--,this.updateSuggestion({announce:!0,immediate:!0});return}}if(t.key==="Tab"&&e&&n&&this.options.completeOnTab){t.preventDefault(),this.acceptSuggestion();return}if(t.key==="Enter"&&e&&n&&this.options.completeOnEnter){t.preventDefault(),this.acceptSuggestion();return}if(t.key==="ArrowRight"&&e&&n&&s&&this.options.completeOnArrowRight){t.preventDefault(),this.acceptSuggestion();return}}acceptSuggestion(){if(!this.currentSuggestion.remaining||this.currentSuggestion.isHintOnly||this.options.disabled||this.isSensitiveField()||this.input.value.length===0)return!1;let t=this.currentSuggestion.full;this.setNativeValue(t),this.input.setSelectionRange(t.length,t.length),this.currentSuggestionIndex=0,this.updateSuggestion();let e=this.getDetail();this.options.onChange&&this.options.onChange(e);let i=!this.isSensitiveField();return this.input.dispatchEvent(new CustomEvent("mask:change",{bubbles:i,detail:e})),this.input.dispatchEvent(new CustomEvent("mask:complete",{bubbles:i,detail:e})),!0}setDefaultDomain(t){this.engine.setDefaultDomain(t),this.updateSuggestion()}setDefaultTld(t){this.engine.setDefaultTld(t),this.updateSuggestion()}setTlds(t){this.engine.setTlds(t),this.currentSuggestionIndex=0,this.updateSuggestion()}handleFocus(){this.wrapper.classList.add("is-focused"),this.isSuggestionDismissed=!1,this.syncGhostStyles(),this.updateSuggestion()}handleBlur(){if(this.wrapper.classList.remove("is-focused"),this.srAnnounceTimerId!==null&&(clearTimeout(this.srAnnounceTimerId),this.srAnnounceTimerId=null),this.lastAnnouncedSuggestion="",this.srStatusEl&&(this.srStatusEl.textContent=""),this.isSensitiveField()){this.lastNotifiedValue="",this.lastTrackedValue="",this.clearGhost();return}this.updateSuggestion();let t=this.getDetail();this.options.onChange&&this.options.onChange(t),this.input.dispatchEvent(new CustomEvent("mask:change",{bubbles:!this.isSensitiveField(),detail:t}))}handleAttributeMutation(t){if(super.handleAttributeMutation(t),t==="data-mask-cycle-suggestions")this.options.cycleSuggestions=this.getAttr("data-mask-cycle-suggestions")==="true";else if(t==="data-mask-auto-lowercase")this.options.autoLowercase=this.getAttr("data-mask-auto-lowercase")==="true";else if(t==="data-mask-default-tld"){let e=this.getAttr("data-mask-default-tld");this.setDefaultTld(e===null||e==="false"||e==="none"?null:e==="true"?!0:e)}else if(t==="data-mask-tlds"){let e=this.getAttr("data-mask-tlds");this.setTlds(e?e.split(",").map(i=>i.trim()).filter(Boolean):null)}else t==="placeholder"&&this.updateSuggestion()}getDetail(){return{value:this.input.value,suggestedValue:this.currentSuggestion.isHintOnly?"":this.currentSuggestion.full,domain:this.currentSuggestion.matchedDomain}}setValue(t){let e=t!=null?String(t):"";this.isSuggestionDismissed=!1,this.setNativeValue(e),this.updateSuggestion()}destroy(){this.isDestroyed||(this.cutTimerId!==null&&(clearTimeout(this.cutTimerId),this.cutTimerId=null),this.resetTimerId!==null&&(clearTimeout(this.resetTimerId),this.resetTimerId=null),this.srAnnounceTimerId!==null&&(clearTimeout(this.srAnnounceTimerId),this.srAnnounceTimerId=null),this.srStatusEl&&(this.srStatusEl.remove(),this.srStatusEl=null),this.lastNotifiedValue="",this.lastAnnouncedSuggestion="",this.wasInputModeInferred&&this.input.getAttribute("inputmode")==="email"&&this.input.removeAttribute("inputmode"),this.wasAriaAutocompleteSet&&this.input.getAttribute("aria-autocomplete")==="inline"&&this.input.removeAttribute("aria-autocomplete"),this.wasAutocorrectSet&&this.input.getAttribute("autocorrect")==="off"&&this.input.removeAttribute("autocorrect"),this.wasAutocapitalizeSet&&this.input.getAttribute("autocapitalize")==="none"&&this.input.removeAttribute("autocapitalize"),this.wasSpellcheckSet&&this.input.getAttribute("spellcheck")==="false"&&this.input.removeAttribute("spellcheck"),super.destroy())}};var gt={iso:{format:"YYYY-MM-DD HH:mm:ss"},"iso-t":{format:"YYYY-MM-DD\\THH:mm:ss"},fr:{format:"DD/MM/YYYY HH:mm",placeholderTokens:{DD:"jj",MM:"mm",YYYY:"aaaa",HH:"hh",mm:"mm"}},"fr-sec":{format:"DD/MM/YYYY HH:mm:ss",placeholderTokens:{DD:"jj",MM:"mm",YYYY:"aaaa",HH:"hh",mm:"mm",ss:"ss"}},us:{format:"MM/DD/YYYY HH:mm"},"us-12h":{format:"MM/DD/YYYY hh:mm A"},uk:{format:"DD/MM/YYYY HH:mm"},no:{format:"DD/MM-YYYY HH:mm"},cz:{format:"DD. MM. YYYY HH:mm"},de:{format:"DD.MM.YYYY HH:mm"},jp:{format:"YYYY/MM/DD HH:mm"}},Et={YYYY:"YYYY",MM:"MM",DD:"DD",HH:"HH",hh:"hh",mm:"mm",ss:"ss",A:"AM"},pe=[{token:"YYYY",length:4},{token:"MM",length:2},{token:"DD",length:2},{token:"HH",length:2},{token:"hh",length:2},{token:"mm",length:2},{token:"ss",length:2},{token:"A",length:2}],fe=128,mt=512,me=new Set(["/","-",".",":"," ","T","t"]),$t=new Set(["HH","hh","mm","ss","A"]);function x(p){return p>="0"&&p<="9"}function D(p){let t=0;for(let e=0;e<p.length;e++){let i=p.charCodeAt(e);if(i<48||i>57)return NaN;t=t*10+(i-48)}return p.length>0?t:NaN}function ge(p,t,e){let i=Array.from(p||e),s=Array.from(e);for(;i.length<t;)i.push(s[i.length]||s[s.length-1]||"_");return i.slice(0,t).join("")}var Z=class p{formatSpec="YYYY-MM-DD HH:mm";customPlaceholders={};slots=[];segments=[];fullTemplate="";prefixSlotsCount=0;prefixString="";editableCount=0;hasMeridiemFlag=!1;utcIndicator=" UTC";includeMilliseconds=!1;convertPastedOffset=!0;defaultTimeOnDateOnly=!1;minTs=null;maxTs=null;constructor(t={}){this.updateOptions(t)}static format(t,e={}){return new p(e).formatFromValue(t)}updateOptions(t={}){t.utcIndicator!==void 0&&(this.utcIndicator=t.utcIndicator===!1?!1:String(t.utcIndicator).slice(0,32)),t.includeMilliseconds!==void 0&&(this.includeMilliseconds=!!t.includeMilliseconds),t.convertPastedOffset!==void 0&&(this.convertPastedOffset=t.convertPastedOffset!==!1),t.defaultTimeOnDateOnly!==void 0&&(this.defaultTimeOnDateOnly=t.defaultTimeOnDateOnly),t.min!==void 0&&(this.minTs=this.normalizeBoundary(t.min)),t.max!==void 0&&(this.maxTs=this.normalizeBoundary(t.max)),t.placeholderTokens!==void 0&&(this.customPlaceholders=t.placeholderTokens||{}),(t.format!==void 0||this.slots.length===0)&&this.compile(t.format??this.formatSpec,t.placeholderTokens)}setFormat(t,e){e!==void 0&&(this.customPlaceholders=e),this.compile(t,this.customPlaceholders)}setUtcIndicator(t){this.utcIndicator=t===!1?!1:String(t).slice(0,32)}getUtcIndicator(){return this.utcIndicator}getFormat(){return this.formatSpec}getFullTemplate(){return this.fullTemplate}getGhostRemaining(t){let e=this.utcIndicator?this.utcIndicator:"";return t.length>=this.fullTemplate.length?e:this.fullTemplate.slice(t.length)+e}getPrefix(){return this.prefixString}getPrefixLength(){return this.prefixSlotsCount}getEditableCount(){return this.editableCount}hasMeridiem(){return this.hasMeridiemFlag}isNumericOnly(){return!this.hasMeridiemFlag}getSegments(){return this.segments}getSlots(){return this.slots}isSeparatorAt(t){return t>=0&&t<this.slots.length&&this.slots[t].isStatic}getNextEditablePosition(t){let e=Math.max(0,t);for(let i=e;i<this.slots.length;i++)if(!this.slots[i].isStatic)return i;return this.slots.length}compile(t,e){let i=String(t||"YYYY-MM-DD HH:mm").trim().slice(0,fe)||"YYYY-MM-DD HH:mm";this.formatSpec=i;let s=Object.hasOwn(gt,i)?gt[i]:null,n=s?s.format:i,r=Object.create(null);if(s?.placeholderTokens)for(let[h,c]of Object.entries(s.placeholderTokens))Object.hasOwn(Et,h)&&typeof c=="string"&&(r[h]=c);let o=e!==void 0?e:this.customPlaceholders;if(o&&typeof o=="object")for(let[h,c]of Object.entries(o))Object.hasOwn(Et,h)&&typeof c=="string"&&(r[h]=c);this.slots=[],this.segments=[],this.hasMeridiemFlag=!1;let a="",l=!0,u=0;for(;u<n.length;){let h=n[u];if(h==="\\"&&u+1<n.length){let d=n[u+1];this.slots.push({char:d,isStatic:!0,isPrefix:l,segmentIndex:-1,charIndexInSegment:-1,placeholder:d}),a+=d,u+=2;continue}let c=null;for(let d of pe)if(n.startsWith(d.token,u)){c=d;break}if(c){l=!1;let{token:d,length:f}=c;d==="A"&&(this.hasMeridiemFlag=!0);let g=r[d]??Et[d],m=ge(g,f,Et[d]),v=Array.from(m),y=this.segments.length,b=this.slots.length;for(let S=0;S<f;S++)this.slots.push({char:d==="A"?"A":"9",isStatic:!1,isPrefix:!1,segmentIndex:y,charIndexInSegment:S,tokenKind:d,placeholder:v[S]||"_"});this.segments.push({kind:d,start:b,end:b+f,length:f,placeholder:m,followingSeparator:""}),a+=m,u+=d.length}else this.slots.push({char:h,isStatic:!0,isPrefix:l,segmentIndex:-1,charIndexInSegment:-1,placeholder:h}),a+=h,u++}this.fullTemplate=a,this.editableCount=this.slots.filter(h=>!h.isStatic).length,this.prefixSlotsCount=0,this.prefixString="";for(let h of this.slots)if(h.isPrefix)this.prefixSlotsCount++,this.prefixString+=h.char;else break;for(let h=0;h<this.segments.length;h++){let c=this.segments[h],d="";for(let f=c.end;f<this.slots.length&&this.slots[f].isStatic;f++)d+=this.slots[f].char;c.followingSeparator=d}}extractRaw(t,e=!1){let i=String(t??"").slice(0,mt);if(!i||this.slots.length===0)return"";let s="",n=0,r=0;if(this.prefixSlotsCount>0){for(;n<i.length&&(i[n]===" "||i[n]===" ");)n++;let o=0;for(;n<i.length&&o<this.prefixSlotsCount;){let a=this.slots[o].char,l=i[n];if(l.toUpperCase()===a.toUpperCase())n++,o++;else if(a===" "&&l!==" ")o++;else break}r=this.prefixSlotsCount}for(;n<i.length&&r<this.slots.length;){let o=this.slots[r],a=i[n];if(o.isStatic){a.toUpperCase()===o.char.toUpperCase()&&n++,r++;continue}if(o.tokenKind==="A"){let l=a.toUpperCase();o.charIndexInSegment===0?l==="A"||l==="P"?(s+=l,n++,r++,(n<i.length?i[n].toUpperCase():"")==="M"?(s+="M",n++,r++):e&&(s+="M",r++)):n++:l==="M"?(s+="M",n++,r++):e?(s+="M",r++):n++;continue}x(a)?(s+=a,n++,r++):n++}return s}format(t,e=!1){if(this.slots.length===0)return String(t??"").slice(0,mt);let i=this.extractRaw(t,e);if(i.length===0)return this.prefixString;let s="",n=0;for(let r=0;r<this.slots.length;r++){let o=this.slots[r];if(o.isStatic){let a=n<i.length,l=n===0&&o.isPrefix,u=n>0&&n===i.length;if(a||l||u)s+=o.char;else break}else if(n<i.length)s+=i[n],n++;else break}return s}analyze(t,e=!1){let i=this.extractRaw(t,e),s=this.formatFromCleanRaw(i),n=this.editableCount,r=i.length,o=n>0&&r>=n,a=this.extractSegmentValues(i),l=a.parts,u=null,h=null,c=null,d=!1;if(o&&a.allSegmentsPresent){let f=this.resolveHour24(a);if(f!==null){let g={year:l.year,month:l.month,day:l.day,hour:f,minute:l.minute??0,second:l.second??0},m=this.buildStrictUTCDate(g);if(m){let v=m.getTime(),y=this.minTs===null||v>=this.minTs,b=this.maxTs===null||v<=this.maxTs;y&&b&&(u=m,c=v,h=this.formatDateToISO(m),d=!0)}}}return{formatted:s,rawValue:h||"",isoString:h,date:u,timestamp:c,parts:l,isComplete:o,isValid:d,totalSlots:n,filledSlots:r}}mapCursorPosition(t,e,i){let s=this.prefixSlotsCount,n=String(t??""),r=String(i??"");if(e<=0||!r)return s;let a=this.extractRaw(n.slice(0,e),!1).length;if(a===0)return Math.max(s,Math.min(this.getNextEditablePosition(0),r.length));let l=0,u=r.length;for(let h=0;h<r.length&&h<this.slots.length;h++)if(!this.slots[h].isStatic&&(l++,l===a)){u=h+1;break}for(;u<r.length&&this.slots[u]&&this.slots[u].isStatic;)u++;return Math.max(s,Math.min(u,r.length))}tryHandleSeparatorKey(t,e,i){let s={handled:!1,formatted:t,cursor:e};if(!i||i.length!==1)return s;if(e<this.slots.length&&this.slots[e].isStatic&&this.separatorMatchesKey(this.slots[e].char,i)){let a=this.getNextEditablePosition(e+1),l=this.format(t);return{handled:!0,formatted:l,cursor:Math.min(a,l.length)}}if(e>this.prefixSlotsCount&&e-1<this.slots.length&&this.slots[e-1].isStatic){let a=e-1;for(;a>=this.prefixSlotsCount&&this.slots[a].isStatic;){if(this.separatorMatchesKey(this.slots[a].char,i)){let l=this.getNextEditablePosition(a+1),u=this.format(t);return{handled:!0,formatted:u,cursor:Math.min(l,u.length)}}a--}}let n=-1;for(let a=0;a<this.segments.length;a++){let l=this.segments[a];if(e>=l.start&&e<=l.end){n=a;break}}if(n===-1)return s;let r=this.segments[n];if(!r.followingSeparator||!this.followingSeparatorMatchesKey(r.followingSeparator,i))return s;let o=t.slice(r.start,Math.min(e,r.end)).replace(/\D/g,"");if(r.kind!=="YYYY"&&r.kind!=="A"&&o.length>0&&o.length<r.length){let a="0".repeat(r.length-o.length)+o,l=t.slice(Math.min(t.length,r.end)),u=t.slice(0,r.start)+a+r.followingSeparator+l,h=this.format(u),c=this.getNextEditablePosition(r.end);return{handled:!0,formatted:h,cursor:Math.min(c,h.length)}}if(e===r.end){let a=this.format(t),l=this.getNextEditablePosition(r.end);return{handled:!0,formatted:a,cursor:Math.min(l,a.length)}}return s}formatFromValue(t){if(t==null)return this.prefixString;if(t instanceof Date)return Number.isNaN(t.getTime())?this.prefixString:this.formatPartsToTemplate(this.dateToUTCParts(t));if(typeof t=="number"){if(!Number.isFinite(t))return this.prefixString;let s=new Date(t);return Number.isNaN(s.getTime())?this.prefixString:this.formatPartsToTemplate(this.dateToUTCParts(s))}let e=String(t).slice(0,mt).trim();if(!e)return this.prefixString;let i=this.parsePasted(e);return i.matched?i.formatted:i.rejected?this.prefixString:this.format(e,!0)}formatFromNativeValue(t){let e=String(t??"").slice(0,mt);if(!e)return this.prefixString;let i=e.trim();if(i.length>=16){let s=this.parseISO8601Linear(i);if(s&&!s.dateOnly){let n=this.parsePasted(i);if(n.matched)return n.formatted}}return this.format(e,!1)}parsePasted(t){let e={matched:!1,formatted:"",cursor:0},i={matched:!1,rejected:!0,formatted:"",cursor:0},s=String(t??"").slice(0,mt).trim();if(!s||this.segments.length===0)return e;let n=s.length>=10&&x(s[0])&&x(s[1])&&x(s[2])&&x(s[3])&&s[4]==="-"&&x(s[5])&&x(s[6])&&s[7]==="-"&&x(s[8])&&x(s[9]),r=this.parseISO8601Linear(s);if(r){if(r.dateOnly)return this.formatDateOnlyMatch({year:r.year,month:r.month,day:r.day},i);if(r.offsetMinutes!==null&&r.offsetMinutes!==0&&!this.convertPastedOffset)return i;let o=this.buildStrictUTCDate({year:r.year,month:r.month,day:r.day,hour:r.hour,minute:r.minute,second:r.second});if(!o)return i;let a=o,l;if(r.offsetMinutes!==null&&r.offsetMinutes!==0){let h=o.getTime()-r.offsetMinutes*6e4;if(a=new Date(h),Number.isNaN(a.getTime()))return i;l={original:s,offsetMinutes:r.offsetMinutes,utcIso:this.formatDateToISO(a)}}let u=this.formatPartsToTemplate(this.dateToUTCParts(a));return{matched:!0,formatted:u,cursor:u.length,offsetConverted:l}}return n&&s.length>10&&(s[10]==="T"||s[10]==="t"||this.segments[0]?.kind!=="YYYY")?i:this.parseConfiguredFormatLinear(s)}formatLocal(t,e,i){if(!t||Number.isNaN(t.getTime()))return null;try{let s=i||{dateStyle:"short",timeStyle:"medium"};return new Intl.DateTimeFormat(e,s).format(t)}catch{return null}}normalizeBoundary(t){if(t==null)return null;if(t instanceof Date){let n=t.getTime();return Number.isNaN(n)?null:n}if(typeof t=="number")return Number.isFinite(t)?t:null;let e=String(t).slice(0,mt).trim();if(!e)return null;let i=this.parseISO8601Linear(e);if(i){let n=this.buildStrictUTCDate({year:i.year,month:i.month,day:i.day,hour:i.hour,minute:i.minute,second:i.second});if(!n)return null;let r=i.offsetMinutes?i.offsetMinutes*6e4:0;return n.getTime()-r}return this.analyze(e,!0).timestamp}separatorMatchesKey(t,e){return t===e||(t==="T"||t==="t")&&(e==="T"||e==="t"||e===" ")}followingSeparatorMatchesKey(t,e){let i=!1;for(let s=0;s<t.length;s++)if(t[s]!==" "){i=!0;break}for(let s=0;s<t.length;s++){let n=t[s];if(!(i&&n===" ")&&this.separatorMatchesKey(n,e))return!0}return!1}formatFromCleanRaw(t){if(this.slots.length===0)return"";if(t.length===0)return this.prefixString;let e="",i=0;for(let s=0;s<this.slots.length;s++){let n=this.slots[s];if(n.isStatic){let r=i<t.length,o=i===0&&n.isPrefix,a=i>0&&i===t.length;if(r||o||a)e+=n.char;else break}else if(i<t.length)e+=t[i],i++;else break}return e}extractSegmentValues(t){let e={},i,s,n=0,r=!0;for(let o of this.segments){if(n+o.length>t.length){r=!1;break}let a=t.slice(n,n+o.length);switch(n+=o.length,o.kind){case"YYYY":e.year=D(a);break;case"MM":e.month=D(a);break;case"DD":e.day=D(a);break;case"HH":e.hour=D(a);break;case"hh":i=D(a);break;case"mm":e.minute=D(a);break;case"ss":e.second=D(a);break;case"A":a==="AM"||a==="PM"?s=a:r=!1;break}}if((e.year===void 0||e.month===void 0||e.day===void 0)&&(r=!1),e.hour===void 0&&i===void 0&&(r=!1),r&&i!==void 0){let o=this.resolveHour24({parts:e,hour12:i,meridiem:s});o!==null&&(e.hour=o)}return{parts:e,hour12:i,meridiem:s,allSegmentsPresent:r}}resolveHour24(t){if(t.hour12!==void 0){let e=t.hour12;return e<1||e>12||!t.meridiem?null:t.meridiem==="AM"?e===12?0:e:e===12?12:e+12}return t.parts.hour!==void 0&&t.parts.hour>=0&&t.parts.hour<=23?t.parts.hour:null}buildStrictUTCDate(t){let{year:e,month:i,day:s,hour:n,minute:r,second:o}=t;if(!Number.isInteger(e)||e<1||e>9999||!Number.isInteger(i)||i<1||i>12||!Number.isInteger(s)||s<1||s>31||!Number.isInteger(n)||n<0||n>23||!Number.isInteger(r)||r<0||r>59||!Number.isInteger(o)||o<0||o>59)return null;let a=new Date(0);return a.setUTCFullYear(e,i-1,s),a.setUTCHours(n,r,o,0),a.getUTCFullYear()!==e||a.getUTCMonth()!==i-1||a.getUTCDate()!==s||a.getUTCHours()!==n||a.getUTCMinutes()!==r||a.getUTCSeconds()!==o?null:a}dateToUTCParts(t){return{year:t.getUTCFullYear(),month:t.getUTCMonth()+1,day:t.getUTCDate(),hour:t.getUTCHours(),minute:t.getUTCMinutes(),second:t.getUTCSeconds()}}formatDateToISO(t){let e=String(t.getUTCFullYear()).padStart(4,"0"),i=String(t.getUTCMonth()+1).padStart(2,"0"),s=String(t.getUTCDate()).padStart(2,"0"),n=String(t.getUTCHours()).padStart(2,"0"),r=String(t.getUTCMinutes()).padStart(2,"0"),o=String(t.getUTCSeconds()).padStart(2,"0");if(this.includeMilliseconds){let a=String(t.getUTCMilliseconds()).padStart(3,"0");return`${e}-${i}-${s}T${n}:${r}:${o}.${a}Z`}return`${e}-${i}-${s}T${n}:${r}:${o}Z`}formatPartsToTemplate(t){let e="";for(let i of this.segments)switch(i.kind){case"YYYY":e+=String(t.year).padStart(4,"0").slice(-4);break;case"MM":e+=String(t.month).padStart(2,"0");break;case"DD":e+=String(t.day).padStart(2,"0");break;case"HH":e+=String(t.hour).padStart(2,"0");break;case"hh":{let s=t.hour%12===0?12:t.hour%12;e+=String(s).padStart(2,"0");break}case"mm":e+=String(t.minute).padStart(2,"0");break;case"ss":e+=String(t.second).padStart(2,"0");break;case"A":e+=t.hour>=12?"PM":"AM";break}return this.formatFromCleanRaw(e)}formatDateOnlyMatch(t,e){if(!this.buildStrictUTCDate({year:t.year,month:t.month,day:t.day,hour:0,minute:0,second:0}))return e;if(typeof this.defaultTimeOnDateOnly=="string"&&this.defaultTimeOnDateOnly.trim()){let r=this.parseDefaultTime(this.defaultTimeOnDateOnly.trim());if(r){let o=this.formatPartsToTemplate({...t,hour:r.hour,minute:r.minute,second:r.second});return{matched:!0,formatted:o,cursor:o.length}}}let s="";for(let r of this.segments){if($t.has(r.kind))break;r.kind==="YYYY"?s+=String(t.year).padStart(4,"0"):r.kind==="MM"?s+=String(t.month).padStart(2,"0"):r.kind==="DD"&&(s+=String(t.day).padStart(2,"0"))}if(!s)return e;let n=this.formatFromCleanRaw(s);return{matched:!0,formatted:n,cursor:n.length}}parseDefaultTime(t){let e=t.split(":");if(e.length<2||e.length>3)return null;let i=D(e[0]),s=D(e[1]),n=e.length===3?D(e[2]):0;return Number.isNaN(i)||i<0||i>23||Number.isNaN(s)||s<0||s>59||Number.isNaN(n)||n<0||n>59?null:{hour:i,minute:s,second:n}}parseISO8601Linear(t){if(t.length<10)return null;for(let u of[0,1,2,3,5,6,8,9])if(!x(t[u]))return null;if(t[4]!=="-"||t[7]!=="-")return null;let e=D(t.slice(0,4)),i=D(t.slice(5,7)),s=D(t.slice(8,10));if(t.length===10)return{year:e,month:i,day:s,hour:0,minute:0,second:0,dateOnly:!0,offsetMinutes:null};let n=10;if(t[n]!=="T"&&t[n]!=="t"&&t[n]!==" "||(n++,n+5>t.length)||!x(t[n])||!x(t[n+1])||t[n+2]!==":"||!x(t[n+3])||!x(t[n+4]))return null;let r=D(t.slice(n,n+2)),o=D(t.slice(n+3,n+5));n+=5;let a=0;if(n<t.length&&t[n]===":"){if(n++,n+2>t.length||!x(t[n])||!x(t[n+1]))return null;a=D(t.slice(n,n+2)),n+=2}if(n<t.length&&t[n]==="."){n++;let u=n;for(;n<t.length&&x(t[n]);)n++;if(n===u)return null}let l=null;if(n<t.length){for(;n<t.length&&t[n]===" ";)n++;if(n<t.length){let u=t[n];if(u==="Z"||u==="z")l=0,n++;else if(u==="+"||u==="-"){let h=u==="-"?-1:1;if(n++,n+2>t.length||!x(t[n])||!x(t[n+1]))return null;let c=D(t.slice(n,n+2));n+=2;let d=0;if(n<t.length){if(t[n]===":"&&n++,n+2>t.length||!x(t[n])||!x(t[n+1]))return null;d=D(t.slice(n,n+2)),n+=2}if(c>14||d>59||c===14&&d!==0)return null;l=h*(c*60+d)}else if(t.slice(n).toUpperCase()==="UTC")l=0,n=t.length;else return null}}return n!==t.length?null:{year:e,month:i,day:s,hour:r,minute:o,second:a,dateOnly:!1,offsetMinutes:l}}parseConfiguredFormatLinear(t){let e={matched:!1,formatted:"",cursor:0},i=t;i.toUpperCase().endsWith(" UTC")?i=i.slice(0,-4).trim():i.length>2&&(i.endsWith("Z")||i.endsWith("z"))&&x(i[i.length-2])&&(i=i.slice(0,-1).trim()),this.prefixString&&i.toLowerCase().startsWith(this.prefixString.trim().toLowerCase())&&(i=i.slice(this.prefixString.trim().length).trim());let s=[],n=-1;for(let d=0;d<i.length;d++){let f=i[d];me.has(f)?n!==-1&&(s.push(i.slice(n,d)),n=-1):n===-1&&(n=d)}if(n!==-1&&s.push(i.slice(n)),s.length===0||s.length>this.segments.length)return e;let r=0;for(let d of this.segments){if($t.has(d.kind))break;r++}let o=[],a,l,u;for(let d=0;d<s.length;d++){let f=s[d],g=this.segments[d];if(g.kind==="A"){let m=f.toUpperCase();if(m==="AM"||m==="A")o.push("AM");else if(m==="PM"||m==="P")o.push("PM");else return e;continue}for(let m=0;m<f.length;m++)if(!x(f[m]))return e;if(g.kind==="YYYY"){if(f.length!==4)return e;a=D(f),o.push(f)}else{if(f.length<1||f.length>2)return e;let m=f.length===1?"0"+f:f,v=D(m);g.kind==="MM"&&(l=v),g.kind==="DD"&&(u=v),o.push(m)}}if(s.length===r&&a!==void 0&&l!==void 0&&u!==void 0)return this.formatDateOnlyMatch({year:a,month:l,day:u},e);let h=this.segments.length;if(s.length<h&&!(r>0&&s.length>=r+2&&this.segments[r+1]?.kind==="mm"))return e;let c=this.formatFromCleanRaw(o.join(""));return{matched:!0,formatted:c,cursor:c.length}}};var be=10,bt=class extends H{engine;history;isComposing=!1;isUndoingRedoing=!1;isMouseDown=!1;isApplying=!1;isNotifying=!1;hasPendingNotification=!1;lastValue="";lastValueLength=0;lastInputType="";inferredInputModeValue=null;wasAutocorrectSet=!1;wasAutocapitalizeSet=!1;wasSpellcheckSet=!1;cutTimerId=null;pasteTimerId=null;resetTimerId=null;constructor(t,e,i){let s=j(t,e,i),n=s.wrapper,r=s.input,o=s.options,a=n?.getAttribute("data-mask-format")||r?.getAttribute("data-mask-format")||void 0,l=n?.getAttribute("data-mask-utc-indicator")??r?.getAttribute("data-mask-utc-indicator"),u=n?.getAttribute("data-mask-infer-inputmode")??r?.getAttribute("data-mask-infer-inputmode"),h=o.utcIndicator!==void 0?o.utcIndicator:l!==null?l==="false"||l==="none"?!1:l:" UTC",c={...o,format:o.format??a??"YYYY-MM-DD HH:mm",utcIndicator:h,includeMilliseconds:o.includeMilliseconds??!1,convertPastedOffset:o.convertPastedOffset??!0,defaultTimeOnDateOnly:o.defaultTimeOnDateOnly??!1,inferInputMode:o.inferInputMode??(u!==null?u!=="false":!0),onInput:o.onInput||o.oninput,onChange:o.onChange||o.onchange,onComplete:o.onComplete||o.oncomplete};super(n,r,c),this.history=new V,this.engine=new Z(this.options),this.input.hasAttribute("autocorrect")||(this.input.setAttribute("autocorrect","off"),this.wasAutocorrectSet=!0),this.input.hasAttribute("autocapitalize")||(this.input.setAttribute("autocapitalize","none"),this.wasAutocapitalizeSet=!0),this.input.hasAttribute("spellcheck")||(this.input.setAttribute("spellcheck","false"),this.wasSpellcheckSet=!0),this.syncInferredInputMode(),this.bindEvents(),this.lastValue=this.isSensitiveField()?this.computePasswordDigest(this.input.value):this.input.value,this.syncInitialValue(),this.runAuditWarning(this.options.audit)}static format(t,e={}){return Z.format(t,e)}getSpecificAuditWarnings(){let t=[],e=[],i=this.checkAriaIdReferences(this.input,"aria-describedby",e,!0),s=!!this.input.getAttribute("placeholder")?.trim(),n=!!this.input.getAttribute("aria-placeholder")?.trim();return!i&&!n&&!this.options.disabled&&(s?t.push(`Indication du format UTC fragile : placeholder seul dispara\xEEt \xE0 la saisie et l'indicateur UTC fant\xF4me est aria-hidden="true" ; d\xE9finissez aria-describedby ou aria-placeholder (WCAG 3.3.2).`):t.push("Indication du format UTC attendu manquante : d\xE9finissez aria-describedby ou aria-placeholder pour informer les technologies d'assistance du format et du r\xE9f\xE9rentiel UTC (WCAG 3.3.2).")),t}extractRawSnippet(t){return t?t===this.input.value&&this.isValid()?this.getRawValue():this.engine.extractRaw(t,!1):""}onPasswordModeDetected(){this.history.clear(),this.lastValue="",this.lastValueLength=0,this.lastTrackedValue="",this.clearGhost()}onNativeValueSet(t){if(this.options.disabled)this.checkValueChange(!1);else{let e=this.engine.formatFromNativeValue(t);this.applyFormatted(e,e.length,!1)}}onDisabledChange(t){if(t)this.wrapper.classList.remove("is-complete","has-selection"),this.clearGhost(),this.checkValueChange(!1);else{let e=this.engine.formatFromValue(this.input.value);this.applyFormatted(e,this.input.selectionStart??e.length,!1)}this.syncInferredInputMode()}handleAttributeMutation(t){if(super.handleAttributeMutation(t),t==="data-mask-format"){let e=this.getAttr("data-mask-format");e&&e!==this.engine.getFormat()&&this.setFormat(e)}else if(t==="data-mask-utc-indicator"){let e=this.getAttr("data-mask-utc-indicator"),i=e===null||e==="false"||e==="none"?!1:e;this.setUtcIndicator(i)}else t==="placeholder"&&this.updateGhost(this.input.value)}bindEvents(){this.onBeforeInput=this.onBeforeInput.bind(this),this.handleInput=this.handleInput.bind(this),this.onKeyDown=this.onKeyDown.bind(this),this.onPaste=this.onPaste.bind(this),this.onFocus=this.onFocus.bind(this),this.onBlur=this.onBlur.bind(this),this.onClick=this.onClick.bind(this),this.onKeyUp=this.onKeyUp.bind(this),this.onSelect=this.onSelect.bind(this),this.onMouseDown=this.onMouseDown.bind(this),this.onMouseUp=this.onMouseUp.bind(this),this.onCompositionStart=this.onCompositionStart.bind(this),this.onCompositionEnd=this.onCompositionEnd.bind(this),this.onCutHandler=()=>{this.cutTimerId!==null&&clearTimeout(this.cutTimerId),this.cutTimerId=window.setTimeout(()=>{if(this.cutTimerId=null,!this.isDestroyed)if(this.options.disabled)this.checkValueChange(!1);else{let i=this.input.selectionStart??this.input.value.length;this.applyFormatted(this.input.value,i,!1)}},0)};let t=()=>{this.isDestroyed||this.checkValueChange(!0,!0)},{signal:e}=this.abortController;this.input.addEventListener("beforeinput",this.onBeforeInput,{signal:e}),this.input.addEventListener("input",this.handleInput,{signal:e}),this.input.addEventListener("keydown",this.onKeyDown,{signal:e}),this.input.addEventListener("paste",this.onPaste,{signal:e}),this.input.addEventListener("focus",this.onFocus,{signal:e}),this.input.addEventListener("blur",this.onBlur,{signal:e}),this.input.addEventListener("click",this.onClick,{signal:e}),this.input.addEventListener("keyup",this.onKeyUp,{signal:e}),this.input.addEventListener("select",this.onSelect,{signal:e}),this.input.addEventListener("mousedown",this.onMouseDown,{signal:e}),window.addEventListener("mouseup",this.onMouseUp,{signal:e}),this.input.addEventListener("compositionstart",this.onCompositionStart,{signal:e}),this.input.addEventListener("compositionend",this.onCompositionEnd,{signal:e}),this.input.addEventListener("scroll",this.onScroll,{passive:!0,signal:e}),this.input.addEventListener("cut",this.onCutHandler,{signal:e}),this.input.addEventListener("change",t,{signal:e}),this.input.form&&(this.onFormResetHandler=()=>{this.resetTimerId!==null&&clearTimeout(this.resetTimerId),this.resetTimerId=window.setTimeout(()=>{this.resetTimerId=null,!this.isDestroyed&&(this.options.disabled?this.checkValueChange(!1):this.syncInitialValue())},0)},this.input.form.addEventListener("reset",this.onFormResetHandler,{signal:e}))}syncInferredInputMode(){if(this.options.inferInputMode===!1)return;if(this.options.disabled){this.inferredInputModeValue&&this.input.getAttribute("inputmode")===this.inferredInputModeValue&&this.input.removeAttribute("inputmode"),this.inferredInputModeValue=null;return}let t=this.engine.isNumericOnly()?"numeric":"text",e=this.input.getAttribute("inputmode");(!e||this.inferredInputModeValue===e)&&(this.input.inputMode=t,this.inferredInputModeValue=t)}getDetail(){let t=this.engine.analyze(this.input.value,!1);return{...t,value:this.options.disabled?this.input.value:t.formatted}}getRawValue(){return this.options.disabled?this.input.value:this.getDetail().rawValue}getISOString(){return this.getDetail().isoString}getDate(){return this.getDetail().date}getTimestamp(){return this.getDetail().timestamp}getParts(){return this.getDetail().parts}getTemporalInstant(){let t=this.getTimestamp();if(t===null)return null;let e=globalThis.Temporal;if(e?.Instant&&typeof e.Instant.fromEpochMilliseconds=="function")try{return e.Instant.fromEpochMilliseconds(t)}catch{return null}return null}isComplete(){return this.options.disabled?!0:this.getDetail().isComplete}isValid(){return this.options.disabled?!0:this.getDetail().isValid}setValue(t){if(this.options.disabled){let i=t instanceof Date?Number.isNaN(t.getTime())?"":this.engine.formatDateToISO(t):t!=null?String(t):"";this.setNativeValue(i),this.checkValueChange(!1);return}let e=this.engine.formatFromValue(t);this.applyFormatted(e,e.length,!0)}setNow(){this.setValue(new Date)}formatLocal(t,e){return this.engine.formatLocal(this.getDate(),t,e)}setFormat(t,e){let i=this.getDate();if(this.options.format=t,e!==void 0&&(this.options.placeholderTokens=e),this.engine.setFormat(t,e),this.syncInferredInputMode(),this.options.disabled){this.clearGhost();return}if(i){let s=this.engine.formatFromValue(i);this.applyFormatted(s,s.length,!0)}else{let s=this.engine.format(this.input.value,!1);this.applyFormatted(s,Math.min(this.input.selectionStart??s.length,s.length),!1)}}setUtcIndicator(t){this.options.utcIndicator=t,this.engine.setUtcIndicator(t),this.updateGhost(this.input.value)}undo(){if(this.options.disabled)return;let t=this.history.undo();if(t){this.isUndoingRedoing=!0;try{this.applyFormatted(this.engine.format(t.raw,!1),t.cursor,!0)}finally{this.isUndoingRedoing=!1}}}redo(){if(this.options.disabled)return;let t=this.history.redo();if(t){this.isUndoingRedoing=!0;try{this.applyFormatted(this.engine.format(t.raw,!1),t.cursor,!0)}finally{this.isUndoingRedoing=!1}}}destroy(){this.isDestroyed||(this.cutTimerId!==null&&(clearTimeout(this.cutTimerId),this.cutTimerId=null),this.pasteTimerId!==null&&(clearTimeout(this.pasteTimerId),this.pasteTimerId=null),this.resetTimerId!==null&&(clearTimeout(this.resetTimerId),this.resetTimerId=null),this.inferredInputModeValue&&this.input.getAttribute("inputmode")===this.inferredInputModeValue&&this.input.removeAttribute("inputmode"),this.wasAutocorrectSet&&this.input.removeAttribute("autocorrect"),this.wasAutocapitalizeSet&&this.input.removeAttribute("autocapitalize"),this.wasSpellcheckSet&&this.input.removeAttribute("spellcheck"),this.history.clear(),this.lastValue="",this.lastValueLength=0,super.destroy())}checkSelection(){if(this.options.disabled)return;let t=this.input.selectionStart??0,e=this.input.selectionEnd??t;this.wrapper.classList.toggle("has-selection",t!==e)}onBeforeInput(t){if(this.lastInputType=t.inputType||"",!(this.options.disabled||this.isComposing)&&!(t.inputType==="insertFromPaste"||t.inputType==="insertReplacementText")&&t.inputType&&t.inputType.startsWith("insert")){let e=this.engine.getEditableCount();if(e>0){let i=this.engine.extractRaw(this.input.value,!1),s=this.input.selectionStart??0,n=this.input.selectionEnd??s,r=Math.max(0,e-i.length);if(n>s){let o=this.engine.extractRaw(this.input.value.slice(s,n),!1);r=Math.max(0,e-(i.length-o.length))}r<=0&&t.preventDefault()}}}handleInput(t){if(this.isDispatchingNativeInput||this.isComposing)return;if(this.options.disabled){this.checkValueChange(!1);return}let e=t?.inputType||this.lastInputType||"";this.lastInputType="";let i=this.input.value,s=this.input.selectionStart??i.length,n=this.history.getCurrent(),r=this.engine.getEditableCount(),o=e.startsWith("delete")||!this.isSensitiveField()&&i.length<this.lastValueLength,a=this.engine.extractRaw(i,!1);if(r>0&&n&&n.raw.length>=r&&a.length>r){let h=this.engine.format(n.raw,!1);this.applyFormatted(h,n.cursor,!0);return}let l=i,u=!o;if(o&&this.engine.hasMeridiem()){for(let h of this.engine.getSegments())if(h.kind==="A"&&i.length>=h.start+1&&i.length<h.end){l=i.slice(0,h.start)+i.slice(h.start+1),u=!1;break}}this.applyFormatted(l,s,!1,u),this.checkSelection()}onKeyDown(t){if(this.options.disabled||N(t))return;let e=this.input.selectionStart??0,i=this.input.selectionEnd??e,s=this.engine.getPrefixLength();if((t.ctrlKey||t.metaKey)&&(t.key==="z"||t.key==="Z")&&!t.shiftKey){t.preventDefault(),this.undo();return}if((t.ctrlKey||t.metaKey)&&(t.key==="y"||t.key==="Y")||(t.ctrlKey||t.metaKey)&&t.shiftKey&&(t.key==="z"||t.key==="Z")){t.preventDefault(),this.redo();return}this.history.updateCurrentCursor(e);let n=t.key.length===1&&!t.ctrlKey&&!t.metaKey&&!t.altKey,r=i>e;if(n&&!r){let o=this.engine.tryHandleSeparatorKey(this.input.value,e,t.key);if(o.handled){t.preventDefault(),this.applyFormatted(o.formatted,o.cursor,!0);return}if(this.engine.hasMeridiem()){for(let l of this.engine.getSegments())if(l.kind==="A"&&e>=l.start&&e<=l.end){let u=t.key.toUpperCase();if(u==="A"||u==="P"){t.preventDefault();let h=u==="A"?"AM":"PM",c=this.input.value,d=c.slice(0,l.start)+h+c.slice(Math.min(c.length,l.end));this.applyFormatted(d,l.end,!0);return}}}let a=this.engine.getEditableCount();if(a>0&&this.engine.extractRaw(this.input.value,!1).length>=a){t.preventDefault();return}}if(r){if(t.key==="Backspace"||t.key==="Delete"){t.preventDefault();let o=this.input.value,a=o.slice(0,e)+o.slice(i);this.applyFormatted(a,Math.max(s,e),!1);return}return}if(t.key==="ArrowLeft"&&!t.shiftKey&&e<=s){t.preventDefault(),this.input.setSelectionRange(s,s);return}if(t.key==="Home"&&s>0&&!t.shiftKey&&!t.ctrlKey&&!t.metaKey&&!t.altKey){t.preventDefault(),this.input.setSelectionRange(s,s);return}if(t.key==="Backspace"&&e<=s){t.preventDefault(),this.input.setSelectionRange(s,s);return}if(t.key==="Delete"&&e<s){t.preventDefault(),this.input.setSelectionRange(s,s);return}if(t.key==="Backspace"&&this.engine.hasMeridiem()){for(let o of this.engine.getSegments())if(o.kind==="A"&&e>o.start&&e<=o.end){t.preventDefault();let a=this.input.value,l=a.slice(0,o.start)+a.slice(Math.min(a.length,o.end));this.applyFormatted(l,o.start,!0);return}}if(t.key==="Backspace"&&(t.ctrlKey||t.altKey||t.metaKey)){if(t.preventDefault(),e<=s){this.input.setSelectionRange(s,s);return}let o=e-1;for(;o>=s&&this.engine.isSeparatorAt(o);)o--;for(;o>=s&&!this.engine.isSeparatorAt(o);)o--;let a=Math.max(s,o+1),l=this.input.value;this.applyFormatted(l.slice(0,a)+l.slice(e),a,!0);return}if(t.key==="Delete"&&(t.ctrlKey||t.altKey||t.metaKey)){t.preventDefault();let o=this.input.value;if(e>=o.length)return;let a=e;for(;a<o.length&&this.engine.isSeparatorAt(a);)a++;for(;a<o.length&&!this.engine.isSeparatorAt(a);)a++;for(;a<o.length&&this.engine.isSeparatorAt(a);)a++;this.applyFormatted(o.slice(0,e)+o.slice(a),e,!0);return}if(t.key==="Backspace"&&e>s&&this.engine.isSeparatorAt(e-1)){t.preventDefault();let o=e-1;for(;o>s&&this.engine.isSeparatorAt(o-1);)o--;if(o>s){let a=this.input.value;this.applyFormatted(a.slice(0,o-1)+a.slice(e),o-1,!1)}else this.applyFormatted("",s,!0);return}if(t.key==="Delete"&&e<this.input.value.length&&this.engine.isSeparatorAt(e)){t.preventDefault();let o=e;for(;o<this.input.value.length&&this.engine.isSeparatorAt(o);)o++;if(o<this.input.value.length){let a=this.input.value;this.applyFormatted(a.slice(0,o)+a.slice(o+1),e,!0)}}}onPaste(t){if(this.options.disabled){this.pasteTimerId!==null&&clearTimeout(this.pasteTimerId),this.pasteTimerId=window.setTimeout(()=>{this.pasteTimerId=null,this.isDestroyed||this.checkValueChange(!1)},0);return}t.preventDefault(),this.history.updateCurrentCursor(this.input.selectionStart??0);let e=this.preparePastedText(this.getClipboardPlainText(t),512);if(!e)return;let i=this.engine.getPrefixLength(),s=this.input.selectionStart??0,n=this.input.selectionEnd??s,r=this.input.value,o=this.engine.getEditableCount(),a=this.engine.extractRaw(r,!1);if(a.length===0||s<=i&&n>=r.length||s===n){let f=this.engine.parsePasted(e);if(f.matched){if(this.applyFormatted(f.formatted,f.cursor,!0),f.offsetConverted&&this.options.onOffsetConverted)try{this.options.onOffsetConverted(f.offsetConverted)}catch{}this.checkSelection();return}if(f.rejected)return}let u=Math.max(0,o-a.length);if(n>s){let f=this.engine.extractRaw(r.slice(s,n),!1);u=Math.max(0,o-(a.length-f.length))}if(u<=0)return;let h=Math.max(i,s),c=Math.max(i,n),d=r.slice(0,h)+e+r.slice(c);this.applyFormatted(d,h+e.length,!1,!0),this.checkSelection()}onFocus(){this.syncGhostStyles(),this.wrapper.classList.add("is-focused"),!this.options.disabled&&!this.isMouseDown&&this.enforceMinCursor(),this.updateGhost(this.input.value),this.checkSelection()}onBlur(){if(this.wrapper.classList.remove("is-focused","has-selection"),this.isSensitiveField()){this.onPasswordModeDetected();return}this.updateGhost(this.input.value),this.checkValueChange(!1,!0)}onClick(){this.options.disabled||this.enforceMinCursor(),this.history.updateCurrentCursor(this.input.selectionStart??0),this.checkSelection()}onKeyUp(t){this.options.disabled||((t.key==="ArrowLeft"||t.key==="ArrowRight"||t.key==="Home")&&!t.shiftKey&&this.enforceMinCursor(),this.history.updateCurrentCursor(this.input.selectionStart??0)),this.checkSelection()}onSelect(){this.history.updateCurrentCursor(this.input.selectionStart??0),this.checkSelection()}onMouseDown(){this.isMouseDown=!0}onMouseUp(){this.isMouseDown=!1,this.checkSelection()}onCompositionStart(){this.isComposing=!0}onCompositionEnd(){if(this.isComposing=!1,this.options.disabled)return;let t=this.input.selectionStart??this.input.value.length;this.applyFormatted(this.input.value,t,!1,!0),this.checkSelection()}enforceMinCursor(){let t=this.engine.getPrefixLength();if(t<=0)return;let e=this.input.selectionStart??0,i=this.input.selectionEnd??e;e===i&&e<t&&this.input.setSelectionRange(t,t)}updateGhost(t){if(!this.ghost)return;if(this.options.disabled||this.isSensitiveField()){this.clearGhost();return}let e=!t||t===this.engine.getPrefix();if(this.shouldHideGhostForPlaceholder(e)){this.clearGhost();return}let i=this.engine.getGhostRemaining(t),s=this.input.ownerDocument||document,n=s.createElement("span");n.className="mask-ghost-typed",n.textContent=t;let r=s.createElement("span");r.className="mask-ghost-remaining",r.textContent=i,this.setGhostContent(n,r),this.ghost.scrollLeft=this.input.scrollLeft}applyFormatted(t,e,i=!1,s=!1){if(!(this.options.disabled||this.isApplying)){this.isApplying=!0;try{let n=this.engine.format(t,s),r=this.isSensitiveField();this.setNativeValue(n),r?this.clearGhost():this.updateGhost(n);let o=this.engine.getPrefixLength(),a;i||this.isUndoingRedoing?a=Math.max(o,Math.min(e,n.length)):a=Math.max(o,this.engine.mapCursorPosition(t,e,n)),this.input.setSelectionRange(a,a);let l=this.engine.analyze(n,!1);this.wrapper.classList.toggle("is-complete",l.isComplete),r?(this.options.copyRaw=!1,this.lastValueLength=0,this.history.clear()):(this.lastValueLength=n.length,this.isUndoingRedoing||this.history.push(this.engine.extractRaw(n,!1),a))}finally{this.isApplying=!1}this.checkValueChange(!1)}}syncInitialValue(){let t=this.isSensitiveField();if(this.options.disabled){this.clearGhost(),this.lastValue=t?this.computePasswordDigest(this.input.value):this.input.value,this.lastValueLength=t?0:this.input.value.length,this.checkValueChange(!1);return}this.syncGhostStyles();let e=this.input.value||"";if(e){let i=this.engine.formatFromValue(e);this.applyFormatted(i,i.length,!0)}else{let i=this.engine.getPrefixLength();i>0?this.applyFormatted("",i,!0):(t?this.clearGhost():(this.history.push("",0),this.updateGhost("")),this.checkValueChange(!1))}}checkValueChange(t=!1,e=!1){let i=this.isSensitiveField(),s=this.input.value;if((i?this.computePasswordDigest(s):s)===this.lastValue&&!t&&!this.hasPendingNotification){if(e){let r=!i,o=this.getDetail(),a=this.options.onChange||this.options.onchange;a&&a(o),this.input.dispatchEvent(new CustomEvent("mask:change",{bubbles:r,detail:o}))}return}if(this.isNotifying){this.hasPendingNotification=!0;return}this.isNotifying=!0;try{let r=0;for(;((this.isSensitiveField()?this.computePasswordDigest(this.input.value):this.input.value)!==this.lastValue||this.hasPendingNotification||t)&&r<be;){r++,this.hasPendingNotification=!1,t=!1;let o=this.isSensitiveField(),a=!o,l=this.input.value;this.lastValue=o?this.computePasswordDigest(l):l,this.lastValueLength=o?0:l.length;let u=this.getDetail(),h=this.options.onInput||this.options.oninput;if(h&&h(u),this.input.dispatchEvent(new CustomEvent("mask:input",{bubbles:a,detail:u})),this.dispatchNativeInput(),e){let c=this.options.onChange||this.options.onchange;c&&c(u),this.input.dispatchEvent(new CustomEvent("mask:change",{bubbles:a,detail:u}))}if(u.isComplete){let c=this.options.onComplete||this.options.oncomplete;c&&c(u),this.input.dispatchEvent(new CustomEvent("mask:complete",{bubbles:a,detail:u}))}}}finally{this.isNotifying=!1}}};var jt={BaseInputMask:H,InputMask:ht,MaskEngine:q,MaskHistory:V,MaskKeyboard:st,AmountEngine:X,InputAmountMask:pt,EmailEngine:nt,InputEmailMask:ft,DateUTCEngine:Z,DATE_UTC_PRESETS:gt,InputDateUTCMask:bt,sanitizePastedText:U,stripBidiAndInvisibles:ut},_t=F();_t&&(_t.Mask=jt);var Lt=ht;var Ht={};ot(Ht,{LocalizedComponent:()=>R,Scroll:()=>Zt,ScrollBlock:()=>rt,createI18nManager:()=>G,default:()=>Te,scrollEn:()=>Ot,scrollFr:()=>Rt,scrollI18n:()=>vt});var R=class extends B{static _i18n;static setLocale(t){this._i18n&&this._i18n.setLocale(t)}static getLocale(){return this._i18n?this._i18n.getLocale():""}static registerLocale(t,e){this._i18n&&this._i18n.registerLocale(t,e)}static setI18n(t){this._i18n&&this._i18n.setI18n(t)}static getI18n(){return this._i18n?this._i18n.getAll():{}}static resetI18n(){this._i18n&&this._i18n.reset()}static t(t,e){return this._i18n?this._i18n.t(t,e):String(t)}i18nOverrides;constructor(t){super(),this.i18nOverrides=t}t(t){let e=this.constructor;return e._i18n?e._i18n.t(t,this.i18nOverrides):String(t)}};var ve=new Set(["__proto__","constructor","prototype"]);function wt(p){return!!p&&!ve.has(p)}function It(p){let t=String(p??"").trim().toLowerCase().replace(/_/g,"-");return wt(t)?t:""}function ye(p){let t=p.indexOf("-"),e=t>0?p.slice(0,t):null;return e&&wt(e)?e:null}function z(p,t){if(!t||typeof t!="object")return p;for(let e of Object.keys(t))wt(String(e))&&Object.hasOwn(t,e)&&t[e]!==void 0&&(p[e]=t[e]);return p}function G(p,t){let e=It(p)||"fr",i=Object.create(null);for(let[a,l]of Object.entries(t)){let u=It(a);u&&(i[u]=z(Object.create(null),l))}let s=e,n=Object.create(null);for(let[a,l]of Object.entries(i))n[a]=z(Object.create(null),l);let r=Object.create(null);function o(){let a=[];if(wt(s)){let u=n[s];u&&a.push(u)}let l=ye(s);return l&&n[l]&&a.push(n[l]),a}return{setLocale(a){if(a&&typeof a=="string"&&a.trim()){let l=It(a);l&&(s=l)}},getLocale(){return s},registerLocale(a,l){if(!a||typeof a!="string"||!a.trim()||!l)return;let u=It(a);if(!u)return;let h=z(Object.create(null),n[u]);n[u]=z(h,l)},setI18n(a){if(!a||typeof a!="object")return;let l=z(Object.create(null),r);r=z(l,a)},t(a,l){if(!wt(String(a)))return"";if(l&&typeof l=="object"&&Object.hasOwn(l,a)&&l[a]!==void 0)return String(l[a]);if(r[a]!==void 0)return String(r[a]);for(let h of o())if(h[a]!==void 0)return String(h[a]);let u=n[e]||i[e];return u&&u[a]!==void 0?String(u[a]):String(a)},getAll(a){let l={},u=n[e]||i[e];z(l,u);let h=o().reverse();for(let c of h)z(l,c);return z(l,r),z(l,a),l},reset(){s=e,r=Object.create(null),n=Object.create(null);for(let[a,l]of Object.entries(i))n[a]=z(Object.create(null),l)}}}var Rt={viewport:"Zone de contenu d\xE9filable",verticalThumb:"D\xE9filement vertical",horizontalThumb:"D\xE9filement horizontal"};var Ot={viewport:"Scrollable content area",verticalThumb:"Vertical scroll",horizontalThumb:"Horizontal scroll"};var vt=G("fr",{fr:Rt,en:Ot});var qt=0,rt=class extends R{static _i18n=vt;static i18n=vt;root;viewport;options;createdViewport=!1;isDestroyed=!1;wasIdGenerated=!1;wasRoleInferred=!1;wasAriaLabelInferred=!1;hasExplicitAriaLabel=!1;hasRootAriaLabel=!1;propagatedRootLabel=null;lastInferredAriaLabel="";trackY;thumbY;trackX;thumbX;resizeObserver;hideTimer;scrollEndFallbackTimer;rafId=null;resizeRafId=null;abortController=new AbortController;dragAbortController;activeScrollToController;supportsScrollEnd=typeof window<"u"&&"onscrollend"in window;cachedMaxTop=0;cachedMaxLeft=0;cachedTrackHeight=0;cachedThumbHeight=0;cachedTrackWidth=0;cachedThumbWidth=0;isDragging=!1;dragAxis;dragPointerId;dragStartPos=0;dragStartScroll=0;atBottom=!1;atTop=!0;atRight=!1;atLeft=!0;boundOnScroll;boundOnScrollEnd;boundOnMouseEnter;boundOnMouseLeave;boundOnFocusIn;boundOnFocusOut;boundPointerMove;boundPointerUp;constructor(t,e){super(e?.i18n);let i=null;if(typeof t=="string")try{i=document.querySelector(t)}catch{i=null}else i=t;if(!i||!(i instanceof HTMLElement))throw new Error(`[ScrollBlock] \xC9l\xE9ment introuvable : "${t}".`);this.root=i,this.hasExplicitAriaLabel=!!(e?.ariaLabel||e?.i18n?.viewport);let s=e?.autoHideDelay,n=typeof s=="number"&&Number.isFinite(s)&&s>=0?s:1e3,r=e?.minThumbSize,o=typeof r=="number"&&Number.isFinite(r)&&r>0?r:24,a=e?.edgeThreshold,l=typeof a=="number"&&Number.isFinite(a)&&a>=0?a:10;this.options={axis:e?.axis||"y",mode:e?.mode||"custom",autoHide:e?.autoHide??!0,autoHideDelay:n,alwaysVisible:e?.alwaysVisible??!1,ariaLabel:e?.ariaLabel||this.t("viewport"),i18n:e?.i18n||{},minThumbSize:o,edgeThreshold:l,onScroll:e?.onScroll||(()=>{}),onScrollEnd:e?.onScrollEnd||(()=>{}),onTotalScroll:e?.onTotalScroll||(()=>{}),onTotalScrollBack:e?.onTotalScrollBack||(()=>{}),audit:e?.audit??!0},this.boundOnScroll=this.handleScroll.bind(this),this.boundOnScrollEnd=this.handleScrollEnd.bind(this),this.boundOnMouseEnter=this.handleMouseEnter.bind(this),this.boundOnMouseLeave=this.handleMouseLeave.bind(this),this.boundOnFocusIn=this.handleFocusIn.bind(this),this.boundOnFocusOut=this.handleFocusOut.bind(this),this.boundPointerMove=this.handlePointerMove.bind(this),this.boundPointerUp=this.handlePointerUp.bind(this),this.viewport=this.setupViewport(),this.setupAccessibility(),this.setupScrollbars(),this.setupEventListeners(),this.setupObserver(),this.update(),this.runAuditWarning(this.options.audit)}setupViewport(){this.root.classList.add("wulf-scrollblock"),this.options.mode==="native"&&this.root.classList.add("wulf-scrollblock--native"),this.options.alwaysVisible&&this.root.classList.add("is-always-visible"),this.options.axis==="both"&&this.root.classList.add("has-both-axes");let t=this.root.querySelector(":scope > .wulf-scrollblock-viewport");if(t)return t;let e=Array.from(this.root.childNodes),i=document.createElement("div");i.className="wulf-scrollblock-viewport",this.root.appendChild(i);for(let s of e)lt(i,s,null);return this.createdViewport=!0,i}setupAccessibility(){this.viewport.id||(qt+=1,this.viewport.id=`wulf-scrollblock-vp-${qt}`,this.wasIdGenerated=!0),this.viewport.hasAttribute("role")||(this.viewport.setAttribute("role","region"),this.wasRoleInferred=!0);let t=this.root.getAttribute("aria-labelledby")?.trim(),e=this.root.getAttribute("aria-label")?.trim();if(t?(this.hasRootAriaLabel=!0,!this.hasExplicitAriaLabel&&!this.viewport.hasAttribute("aria-labelledby")&&!this.viewport.hasAttribute("aria-label")&&(this.viewport.setAttribute("aria-labelledby",t),this.propagatedRootLabel="aria-labelledby")):e&&(this.hasRootAriaLabel=!0,!this.hasExplicitAriaLabel&&!this.viewport.hasAttribute("aria-label")&&!this.viewport.hasAttribute("aria-labelledby")&&(this.viewport.setAttribute("aria-label",e),this.propagatedRootLabel="aria-label")),this.hasExplicitAriaLabel&&!this.viewport.hasAttribute("aria-label"))this.viewport.setAttribute("aria-label",this.options.ariaLabel),this.lastInferredAriaLabel=this.options.ariaLabel,this.wasAriaLabelInferred=!0;else if(!this.viewport.hasAttribute("aria-label")&&!this.viewport.hasAttribute("aria-labelledby")){let i=this.t("viewport");this.viewport.setAttribute("aria-label",i),this.lastInferredAriaLabel=i,this.wasAriaLabelInferred=!0}}syncAccessibilityLabels(){if(this.wasAriaLabelInferred&&!this.hasExplicitAriaLabel&&this.viewport.getAttribute("aria-label")===this.lastInferredAriaLabel){let e=this.t("viewport");this.viewport.setAttribute("aria-label",e),this.lastInferredAriaLabel=e,this.options.ariaLabel=e}this.thumbY&&this.thumbY.setAttribute("aria-label",this.t("verticalThumb")),this.thumbX&&this.thumbX.setAttribute("aria-label",this.t("horizontalThumb"))}setupScrollbars(){this.options.mode!=="native"&&((this.options.axis==="y"||this.options.axis==="both")&&(this.trackY=document.createElement("div"),this.trackY.className="wulf-scrollblock-track wulf-scrollblock-vertical",this.thumbY=document.createElement("div"),this.thumbY.className="wulf-scrollblock-thumb",this.thumbY.setAttribute("role","scrollbar"),this.thumbY.setAttribute("aria-orientation","vertical"),this.thumbY.setAttribute("aria-controls",this.viewport.id),this.thumbY.setAttribute("aria-valuenow","0"),this.thumbY.setAttribute("aria-valuemin","0"),this.thumbY.setAttribute("aria-valuemax","100"),this.thumbY.setAttribute("aria-label",this.t("verticalThumb")),this.trackY.appendChild(this.thumbY),this.root.appendChild(this.trackY),this.attachTrackListeners(this.trackY,this.thumbY,"y")),(this.options.axis==="x"||this.options.axis==="both")&&(this.trackX=document.createElement("div"),this.trackX.className="wulf-scrollblock-track wulf-scrollblock-horizontal",this.thumbX=document.createElement("div"),this.thumbX.className="wulf-scrollblock-thumb",this.thumbX.setAttribute("role","scrollbar"),this.thumbX.setAttribute("aria-orientation","horizontal"),this.thumbX.setAttribute("aria-controls",this.viewport.id),this.thumbX.setAttribute("aria-valuenow","0"),this.thumbX.setAttribute("aria-valuemin","0"),this.thumbX.setAttribute("aria-valuemax","100"),this.thumbX.setAttribute("aria-label",this.t("horizontalThumb")),this.trackX.appendChild(this.thumbX),this.root.appendChild(this.trackX),this.attachTrackListeners(this.trackX,this.thumbX,"x")))}isRtl(){return typeof window<"u"&&window.getComputedStyle(this.viewport).direction==="rtl"}attachTrackListeners(t,e,i){let{signal:s}=this.abortController;e.addEventListener("pointerdown",n=>{if(n.button!==0)return;n.preventDefault(),n.stopPropagation(),this.dragAbortController?.abort(),this.dragAbortController=new AbortController;let r=this.dragAbortController.signal;this.isDragging=!0,this.dragAxis=i,this.dragPointerId=n.pointerId,this.dragStartPos=i==="y"?n.clientY:n.clientX,this.dragStartScroll=i==="y"?this.viewport.scrollTop:this.viewport.scrollLeft;try{e.setPointerCapture(n.pointerId)}catch{}e.classList.add("is-active"),this.root.classList.add("is-dragging"),window.addEventListener("pointermove",this.boundPointerMove,{signal:r}),window.addEventListener("pointerup",this.boundPointerUp,{signal:r}),window.addEventListener("pointercancel",this.boundPointerUp,{signal:r}),e.addEventListener("lostpointercapture",this.boundPointerUp,{signal:r})},{signal:s}),e.addEventListener("keydown",n=>{if(n.ctrlKey||n.altKey||n.metaKey)return;let r=40,o=i==="y"?Math.max(r,Math.round(this.viewport.clientHeight*.9)):Math.max(r,Math.round(this.viewport.clientWidth*.9)),a=i==="y"?this.cachedMaxTop:this.cachedMaxLeft;if(a<=0)return;let l=i==="x"&&this.isRtl(),u=i==="y"?this.viewport.scrollTop:this.viewport.scrollLeft,h=null;if(i==="y")switch(n.key){case"ArrowDown":h=u+r;break;case"ArrowUp":h=u-r;break;case"PageDown":h=u+o;break;case"PageUp":h=u-o;break;case" ":h=u+(n.shiftKey?-o:o);break;case"Home":h=0;break;case"End":h=a;break}else switch(n.key){case"ArrowRight":h=u+r;break;case"ArrowLeft":h=u-r;break;case"PageDown":h=u+(l?-o:o);break;case"PageUp":h=u+(l?o:-o);break;case" ":h=u+(n.shiftKey?l?o:-o:l?-o:o);break;case"Home":h=0;break;case"End":h=l?-a:a;break}h!==null&&(n.preventDefault(),n.stopPropagation(),this.scrollTo(i==="y"?{top:h}:{left:h},{smooth:!1}),this.syncThumbs())},{signal:s}),t.addEventListener("pointerdown",n=>{if(n.button!==0||n.target===e)return;n.preventDefault();let r=i==="x"&&this.isRtl(),o=t.getBoundingClientRect(),a=i==="y"?n.clientY-o.top:r?o.right-n.clientX:n.clientX-o.left,l=i==="y"?o.height:o.width;if(l<=0)return;let u=i==="y"?this.cachedMaxTop:this.cachedMaxLeft,h=Math.max(0,Math.min(1,a/l)),c=r?-(h*u):h*u;this.scrollTo(i==="y"?{top:c}:{left:c},{smooth:!0})},{signal:s})}setupEventListeners(){let{signal:t}=this.abortController;this.viewport.addEventListener("scroll",this.boundOnScroll,{passive:!0,signal:t}),this.supportsScrollEnd&&this.viewport.addEventListener("scrollend",this.boundOnScrollEnd,{passive:!0,signal:t}),this.options.mode!=="native"&&this.options.autoHide&&!this.options.alwaysVisible&&(this.root.addEventListener("mouseenter",this.boundOnMouseEnter,{signal:t}),this.root.addEventListener("mouseleave",this.boundOnMouseLeave,{signal:t}),this.root.addEventListener("focusin",this.boundOnFocusIn,{signal:t}),this.root.addEventListener("focusout",this.boundOnFocusOut,{signal:t}))}setupObserver(){typeof ResizeObserver<"u"&&(this.resizeObserver=new ResizeObserver(()=>{this.isDestroyed||this.resizeRafId!==null||(this.resizeRafId=window.requestAnimationFrame(()=>{this.resizeRafId=null,this.isDestroyed||this.update()}))}),this.resizeObserver.observe(this.root),this.resizeObserver.observe(this.viewport),this.viewport.firstElementChild&&this.resizeObserver.observe(this.viewport.firstElementChild))}handlePointerMove(t){if(!this.isDragging||!this.dragAxis||this.dragPointerId!==void 0&&t.pointerId!==this.dragPointerId)return;let e=this.dragAxis==="y",i=(e?t.clientY:t.clientX)-this.dragStartPos,s=e?this.cachedTrackHeight:this.cachedTrackWidth,n=e?this.cachedThumbHeight:this.cachedThumbWidth,r=e?this.cachedMaxTop:this.cachedMaxLeft,o=s-n;if(o<=0||r<=0)return;let a=r/o,l=this.dragStartScroll+i*a;e?this.viewport.scrollTop=Math.max(0,Math.min(r,l)):this.isRtl()?this.viewport.scrollLeft=Math.max(-r,Math.min(0,l)):this.viewport.scrollLeft=Math.max(0,Math.min(r,l))}handlePointerUp(t){if(this.isDragging&&!(t&&t.type!=="lostpointercapture"&&this.dragPointerId!==void 0&&t.pointerId!==this.dragPointerId)){if(this.dragPointerId!==void 0){let e=this.dragAxis==="y"?this.thumbY:this.thumbX;try{e&&e.hasPointerCapture(this.dragPointerId)&&e.releasePointerCapture(this.dragPointerId)}catch{}}this.dragAbortController?.abort(),this.dragAbortController=void 0,this.isDragging=!1,this.dragAxis=void 0,this.dragPointerId=void 0,this.thumbY?.classList.remove("is-active"),this.thumbX?.classList.remove("is-active"),this.root.classList.remove("is-dragging"),this.scheduleAutoHide()}}getScrollInfo(){let{scrollTop:t,scrollLeft:e}=this.viewport,i=this.cachedMaxTop,s=this.cachedMaxLeft,r=this.isRtl()?Math.max(0,-e):Math.max(0,e),o=i>0?Math.max(0,Math.min(1,t/i)):0,a=s>0?Math.max(0,Math.min(1,r/s)):0;return{top:t,left:e,maxTop:i,maxLeft:s,progressY:Math.round(o*100),progressX:Math.round(a*100)}}handleScroll(){this.scheduleSyncThumbs();let t=this.getScrollInfo(),{top:e,left:i,maxTop:s,maxLeft:n}=t;this.options.onScroll(t);let r=this.options.edgeThreshold;if(s>0){let o=e>=s-r,a=e<=r;o&&!this.atBottom&&this.options.onTotalScroll("bottom"),a&&!this.atTop&&this.options.onTotalScrollBack("top"),this.atBottom=o,this.atTop=a}if(n>0){let o=this.isRtl(),a=o?i>=-r:i>=n-r,l=o?i<=-n+r:i<=r;a&&!this.atRight&&this.options.onTotalScroll("right"),l&&!this.atLeft&&this.options.onTotalScrollBack("left"),this.atRight=a,this.atLeft=l}this.options.mode!=="native"&&this.options.autoHide&&!this.options.alwaysVisible&&(this.clearAutoHideTimer(),this.root.classList.add("is-scrolling"),this.supportsScrollEnd||this.scheduleAutoHide()),this.supportsScrollEnd||(this.scrollEndFallbackTimer!==void 0&&window.clearTimeout(this.scrollEndFallbackTimer),this.scrollEndFallbackTimer=window.setTimeout(()=>{this.scrollEndFallbackTimer=void 0,this.handleScrollEnd()},150))}handleScrollEnd(){this.options.onScrollEnd(this.getScrollInfo()),this.options.mode!=="native"&&this.options.autoHide&&!this.options.alwaysVisible&&this.scheduleAutoHide()}scheduleSyncThumbs(){this.options.mode==="native"||this.isDestroyed||this.rafId===null&&(this.rafId=window.requestAnimationFrame(()=>{this.rafId=null,this.isDestroyed||this.syncThumbs()}))}syncThumbs(){if(this.options.mode==="native"||this.isDestroyed)return;let{scrollTop:t,scrollLeft:e}=this.viewport;if(this.thumbY&&this.trackY){let i=this.cachedMaxTop,s=this.cachedTrackHeight-this.cachedThumbHeight;if(i>0&&s>0){let n=Math.max(0,Math.min(1,t/i)),r=Math.max(0,Math.min(s,n*s));this.thumbY.style.setProperty("--scrollblock-thumb-y",`${r}px`),this.thumbY.setAttribute("aria-valuenow",String(Math.round(n*100)))}}if(this.thumbX&&this.trackX){let i=this.cachedMaxLeft,s=this.cachedTrackWidth-this.cachedThumbWidth;if(i>0&&s>0){let n=this.isRtl(),r=n?Math.max(0,-e):Math.max(0,e),o=Math.max(0,Math.min(1,r/i)),a=Math.max(0,Math.min(s,o*s)),l=n?-a:a;this.thumbX.style.setProperty("--scrollblock-thumb-x",`${l}px`),this.thumbX.setAttribute("aria-valuenow",String(Math.round(o*100)))}}}handleMouseEnter(){this.root.classList.add("is-visible"),this.clearAutoHideTimer()}handleMouseLeave(){this.scheduleAutoHide()}handleFocusIn(){this.root.classList.add("is-visible"),this.clearAutoHideTimer()}handleFocusOut(){this.scheduleAutoHide()}clearAutoHideTimer(){this.hideTimer&&(window.clearTimeout(this.hideTimer),this.hideTimer=void 0)}scheduleAutoHide(){this.options.alwaysVisible||!this.options.autoHide||this.isDragging||(this.clearAutoHideTimer(),this.hideTimer=window.setTimeout(()=>{this.root.classList.remove("is-scrolling"),this.root.classList.remove("is-visible")},this.options.autoHideDelay))}update(){if(this.isDestroyed)return;this.syncAccessibilityLabels();let{scrollHeight:t,clientHeight:e,scrollWidth:i,clientWidth:s}=this.viewport,n=this.trackY?this.trackY.clientHeight:0,r=this.trackX?this.trackX.clientWidth:0,o=this.thumbY&&typeof window<"u"&&parseFloat(window.getComputedStyle(this.thumbY).minBlockSize)||0,a=this.thumbX&&typeof window<"u"&&parseFloat(window.getComputedStyle(this.thumbX).minInlineSize)||0;this.cachedMaxTop=Math.max(0,t-e),this.cachedMaxLeft=Math.max(0,i-s),this.cachedTrackHeight=n,this.cachedTrackWidth=r;let l=t>e,u=i>s,h=this.cachedThumbHeight;if(this.trackY&&this.thumbY&&l&&t>0){let d=Math.max(this.options.minThumbSize,o);h=Math.max(d,n*(e/t)),this.cachedThumbHeight=h}let c=this.cachedThumbWidth;if(this.trackX&&this.thumbX&&u&&i>0){let d=Math.max(this.options.minThumbSize,a);c=Math.max(d,r*(s/i)),this.cachedThumbWidth=c}this.root.classList.toggle("has-scroll-y",l),this.root.classList.toggle("has-scroll-x",u),l||u?this.viewport.setAttribute("tabindex","0"):this.viewport.removeAttribute("tabindex"),this.trackY&&this.thumbY&&(this.trackY.hidden=!l,l?(this.thumbY.setAttribute("tabindex","0"),this.thumbY.style.height=`${h}px`):this.thumbY.removeAttribute("tabindex")),this.trackX&&this.thumbX&&(this.trackX.hidden=!u,u?(this.thumbX.setAttribute("tabindex","0"),this.thumbX.style.width=`${c}px`):this.thumbX.removeAttribute("tabindex")),this.syncThumbs()}scrollTo(t,e){if(this.isDestroyed)return Promise.resolve();let i=typeof t=="object"&&t!==null&&!(t instanceof HTMLElement)?t.smooth:void 0,n=(e?.smooth??i??!0)&&!dt()?"smooth":"auto",r=this.isRtl(),{scrollHeight:o,clientHeight:a,scrollWidth:l,clientWidth:u,scrollTop:h,scrollLeft:c}=this.viewport,d=Math.max(0,o-a),f=Math.max(0,l-u);this.cachedMaxTop=d,this.cachedMaxLeft=f;let g,m;if(typeof t=="number")g=t;else if(typeof t=="string")switch(t){case"top":g=0;break;case"bottom":g=d;break;case"left":m=r?-f:0;break;case"right":m=r?0:f;break;default:{if(/^-?\d+(\.\d+)?%$/.test(t.trim())){let k=Math.max(0,Math.min(100,parseFloat(t.trim())))/100;this.options.axis==="x"?m=r?-f*k:f*k:this.options.axis==="both"?(g=d*k,m=r?-f*k:f*k):g=d*k;break}let I=null;try{I=this.viewport.querySelector(t)}catch{I=null}if(I){let k=this.viewport.getBoundingClientRect(),C=I.getBoundingClientRect();g=C.top-k.top-this.viewport.clientTop+h,m=C.left-k.left-this.viewport.clientLeft+c}break}}else if(t instanceof HTMLElement){let I=this.viewport.getBoundingClientRect(),k=t.getBoundingClientRect();g=k.top-I.top-this.viewport.clientTop+h,m=k.left-I.left-this.viewport.clientLeft+c}else typeof t=="object"&&t!==null&&(g=t.top,m=t.left);let v=g!==void 0&&Number.isFinite(g)?Math.max(0,Math.min(d,g)):void 0,y=r?-f:0,b=r?0:f,S=m!==void 0&&Number.isFinite(m)?Math.max(y,Math.min(b,m)):void 0,A=v??h,T=S??c;if(Math.abs(A-h)<=1&&Math.abs(T-c)<=1)return Promise.resolve();this.activeScrollToController?.abort();let w=new AbortController;this.activeScrollToController=w;let E=this.viewport.scrollTo({top:v,left:S,behavior:n});return E instanceof Promise?E.then(()=>{this.activeScrollToController===w&&(this.activeScrollToController=void 0)}):n!=="smooth"?(this.activeScrollToController===w&&(this.activeScrollToController=void 0),Promise.resolve()):new Promise(I=>{let k=!1,C,M,W=()=>{k||(k=!0,C!==void 0&&window.clearTimeout(C),M!==void 0&&window.clearTimeout(M),this.activeScrollToController===w&&(this.activeScrollToController=void 0),w.abort(),I())};if(w.signal.addEventListener("abort",W,{once:!0}),this.abortController.signal.addEventListener("abort",W,{once:!0,signal:w.signal}),this.supportsScrollEnd)this.viewport.addEventListener("scrollend",W,{once:!0,signal:w.signal});else{let Tt=()=>{C!==void 0&&window.clearTimeout(C),C=window.setTimeout(W,150)};this.viewport.addEventListener("scroll",Tt,{passive:!0,signal:w.signal}),Tt()}M=window.setTimeout(W,2500)})}audit(){let t=[],e=this.checkAriaIdReferences(this.viewport,"aria-labelledby",t),i=this.checkAriaIdReferences(this.root,"aria-labelledby",t),s=e||i,n=this.root.getAttribute("aria-label")?.trim(),r=!this.wasAriaLabelInferred&&!!this.viewport.getAttribute("aria-label")?.trim();return!this.hasExplicitAriaLabel&&!this.hasRootAriaLabel&&!r&&!n&&!s&&t.push("Libell\xE9 contextuel manquant : d\xE9finissez l'option ariaLabel (ou un attribut aria-label / aria-labelledby sur le conteneur) pour d\xE9crire la zone d\xE9filable (WCAG 4.1.2)."),this.options.mode!=="native"&&this.options.minThumbSize<24&&t.push(`Taille minimale du curseur insuffisante (minThumbSize: ${this.options.minThumbSize}px) : utilisez au moins 24px pour respecter WCAG 2.5.8.`),t}getAuditPrefix(){return"Wulf.Scroll"}getAuditTargetLabel(){return this.root.id?`#${this.root.id}`:`<${this.root.tagName.toLowerCase()}.wulf-scrollblock>`}destroy(){if(!this.isDestroyed)if(this.isDestroyed=!0,this.clearAutoHideTimer(),this.scrollEndFallbackTimer!==void 0&&(window.clearTimeout(this.scrollEndFallbackTimer),this.scrollEndFallbackTimer=void 0),this.rafId!==null&&(window.cancelAnimationFrame(this.rafId),this.rafId=null),this.resizeRafId!==null&&(window.cancelAnimationFrame(this.resizeRafId),this.resizeRafId=null),this.activeScrollToController?.abort(),this.activeScrollToController=void 0,this.dragAbortController?.abort(),this.dragAbortController=void 0,this.abortController.abort(),this.resizeObserver&&this.resizeObserver.disconnect(),this.trackY?.remove(),this.trackX?.remove(),this.root.classList.remove("wulf-scrollblock","wulf-scrollblock--native","has-scroll-y","has-scroll-x","has-both-axes","is-visible","is-scrolling","is-dragging","is-always-visible"),this.createdViewport&&this.viewport.parentElement===this.root){for(;this.viewport.firstChild;)lt(this.root,this.viewport.firstChild,this.viewport);this.viewport.remove()}else this.viewport.removeAttribute("tabindex"),this.wasIdGenerated&&this.viewport.removeAttribute("id"),this.wasRoleInferred&&this.viewport.getAttribute("role")==="region"&&this.viewport.removeAttribute("role"),this.propagatedRootLabel&&this.viewport.removeAttribute(this.propagatedRootLabel),this.wasAriaLabelInferred&&this.viewport.getAttribute("aria-label")===this.lastInferredAriaLabel&&this.viewport.removeAttribute("aria-label")}};var Zt={ScrollBlock:rt,i18n:vt};var Te=rt,Xt=F();Xt&&(Xt.Scroll=Zt);var Vt={};ot(Vt,{LayoutEngine:()=>$,LocalizedComponent:()=>R,Masonry:()=>J,createI18nManager:()=>G,default:()=>Se,masonryEn:()=>Nt,masonryFr:()=>Ft,masonryI18n:()=>yt});var $=class{static parseGutter(t){if(typeof t=="number"){let e=Number.isFinite(t)?Math.max(0,t):0;return{x:e,y:e}}if(t&&typeof t=="object"){let e=Number(t.x),i=Number(t.y);return{x:Number.isFinite(e)?Math.max(0,e):0,y:Number.isFinite(i)?Math.max(0,i):0}}return{x:0,y:0}}static resolveColumnWidth(t,e,i){if(typeof i=="number"&&Number.isFinite(i)&&i>0)return i;if(typeof i=="string"){let n=i.trim();if(/^\d+(\.\d+)?(px|%)?$/i.test(n)){let r=parseFloat(n);if(Number.isFinite(r)&&r>0)if(n.endsWith("%")){let a=t.getBoundingClientRect().width*r/100;if(a>0)return a}else return r}else if(n){let r=null;try{r=t.querySelector(n)}catch{r=null}if(r){let a=r.getBoundingClientRect().width;if(Number.isFinite(a)&&a>0)return a}let o=parseFloat(n);if(Number.isFinite(o)&&o>0)return o}}if(i instanceof HTMLElement){let n=i.getBoundingClientRect().width;if(n>0)return n}if(e){let n=e.getBoundingClientRect().width;if(n>0)return n}let s=t.getBoundingClientRect().width;return s>0?s:200}static getItemSpan(t,e,i,s){let n=t.getAttribute("data-masonry-span")||t.dataset.masonrySpan;if(n){let r=parseInt(n,10);if(!isNaN(r)&&r>0)return Math.min(s,r)}for(let r of t.classList){let o=/^(?:span|col-span)-(\d+)$/.exec(r);if(o&&o[1]){let a=parseInt(o[1],10);if(!isNaN(a)&&a>0)return Math.min(s,a)}}return 1}static calculate(t,e,i){let n=t.getBoundingClientRect().width,{x:r,y:o}=this.parseGutter(i.gutter);if(n<=0||e.length===0)return{cols:1,colWidth:n,gutterX:r,gutterY:o,containerHeight:0,containerWidth:n,positions:[]};let a=e[0]||null,l=this.resolveColumnWidth(t,a,i.columnWidth),u=l+r,h=u>0?Math.floor((n+r)/u):1;!Number.isFinite(h)||h<1?h=1:h>1e3&&(h=1e3),!i.columnWidth&&h>1&&(l=(n-(h-1)*r)/h);let c=i.fitWidth?h*l+(h-1)*r:void 0,d=new Array(h).fill(0),f=[],g=e.map(b=>{let S=b.getBoundingClientRect().height;return S>0?S:50}),m=0;for(let b=0;b<e.length;b++){let S=e[b],A=g[b],T=this.getItemSpan(S,l,r,h),w=0,E=0;if(i.horizontalOrder){m+T>h&&(m=0),w=m;let P=0;for(let L=0;L<T;L++)d[w+L]>P&&(P=d[w+L]);E=P,m=(w+T)%h}else if(T===1){let P=d[0];w=0;for(let L=1;L<h;L++)d[L]<P&&(P=d[L],w=L);E=P}else{let P=1/0;w=0;for(let L=0;L<=h-T;L++){let kt=0;for(let At=0;At<T;At++)d[L+At]>kt&&(kt=d[L+At]);kt<P&&(P=kt,w=L)}E=P}let I=T*l+(T-1)*r,k=typeof window<"u"&&typeof window.getComputedStyle=="function"&&window.getComputedStyle(t).direction==="rtl",C=c!==void 0?c:n,M=w*(l+r),W=k?Math.max(0,C-M-I):M;f.push({element:S,x:W,y:E,width:I,height:A,column:w,span:T});let Tt=E+A+o;for(let P=0;P<T;P++)d[w+P]=Tt}let v=0;for(let b=0;b<h;b++)d[b]>v&&(v=d[b]);let y=Math.max(0,v>0?v-o:0);return{cols:h,colWidth:l,gutterX:r,gutterY:o,containerHeight:y,containerWidth:n,fittedWidth:c,positions:f}}};var Ft={gallery:"Galerie en grille asym\xE9trique"};var Nt={gallery:"Masonry grid gallery"};var yt=G("fr",{fr:Ft,en:Nt});var J=class extends R{static _i18n=yt;static i18n=yt;root;isNativeCSSGrid=!1;_items=[];options;resizeObserver=null;itemResizeObserver=null;observedItems=new Set;observedItemHeights=new WeakMap;removingItems=new WeakSet;layoutRafId=null;isDestroyed=!1;wasRoleInferred=!1;wasAriaLabelInferred=!1;hasExplicitAriaLabel=!1;lastInferredAriaLabel="";abortController=new AbortController;watchedImages=new WeakSet;originalContainerStyles;constructor(t,e={}){if(super(e.i18n),typeof t=="string"){let s=null;try{s=document.querySelector(t)}catch{s=null}if(!s)throw new Error(`[Wulf.Masonry] Conteneur introuvable pour le s\xE9lecteur : "${t}"`);this.root=s}else if(t instanceof HTMLElement)this.root=t;else throw new Error("[Wulf.Masonry] Cible invalide : fournissez un \xE9l\xE9ment HTMLElement ou un s\xE9lecteur valide.");this.originalContainerStyles={height:this.root.style.height,width:this.root.style.width},this.hasExplicitAriaLabel=!!(e.ariaLabel||e.i18n?.gallery),this.options={itemSelector:e.itemSelector||"> *",columnWidth:e.columnWidth??0,gutter:e.gutter??0,percentPosition:!!e.percentPosition,fitWidth:!!e.fitWidth,horizontalOrder:!!e.horizontalOrder,transitionDuration:e.transitionDuration!==void 0?e.transitionDuration:300,stagger:e.stagger||0,resize:e.resize!==!1,autoImages:e.autoImages!==!1,useNativeCSSGrid:e.useNativeCSSGrid!==!1,ariaRole:e.ariaRole||"region",ariaLabel:e.ariaLabel||this.t("gallery"),i18n:e.i18n||{},onLayout:e.onLayout||(()=>{}),onItemPlaced:e.onItemPlaced||(()=>{}),audit:e.audit??!0};let i=typeof CSS<"u"&&typeof CSS.supports=="function"&&(CSS.supports("display","grid-lanes")||CSS.supports("grid-template-rows","masonry"));this.options.useNativeCSSGrid&&i?(this.isNativeCSSGrid=!0,this.root.classList.add("wulf-masonry","wulf-masonry--native"),this.syncNativeGridVariables()):this.root.classList.add("wulf-masonry"),this.initAccessibility(),this.applyTransitionDuration(),this.reloadItems(),this.initObservers(),this.initImages(),this.layout(),this.runAuditWarning(this.options.audit)}get items(){return[...this._items]}initAccessibility(){this.options.ariaRole&&!this.root.hasAttribute("role")&&(this.root.setAttribute("role",this.options.ariaRole),this.wasRoleInferred=!0);let t=this.hasExplicitAriaLabel?this.options.ariaLabel:this.t("gallery");t&&!this.root.hasAttribute("aria-label")&&!this.root.hasAttribute("aria-labelledby")&&(this.root.setAttribute("aria-label",t),this.lastInferredAriaLabel=t,this.wasAriaLabelInferred=!0)}syncAccessibilityLabels(){if(this.wasAriaLabelInferred&&!this.hasExplicitAriaLabel&&this.root.getAttribute("aria-label")===this.lastInferredAriaLabel){let e=this.t("gallery");this.root.setAttribute("aria-label",e),this.lastInferredAriaLabel=e,this.options.ariaLabel=e}}applyTransitionDuration(){let t=this.options.transitionDuration,e="300ms";typeof t=="number"&&Number.isFinite(t)&&t>=0?e=`${t}ms`:typeof t=="string"&&/^\s*(?:\d+(?:\.\d+)?|\.\d+)(ms|s)\s*$/i.test(t)&&(e=t.trim()),this.root.style.setProperty("--wulf-masonry-duration",e)}reloadItems(){if(this.isDestroyed)return;let t=[];if(this.options.itemSelector==="> *")t=Array.from(this.root.children).filter(e=>e instanceof HTMLElement&&!e.hasAttribute("data-masonry-ignore")&&!this.removingItems.has(e));else try{let e=this.options.itemSelector.trim(),i=e.startsWith(">")?`:scope ${e}`:e;t=Array.from(this.root.querySelectorAll(i)).filter(s=>s.parentElement===this.root&&!s.hasAttribute("data-masonry-ignore")&&!this.removingItems.has(s))}catch{t=Array.from(this.root.children).filter(e=>e instanceof HTMLElement&&!e.hasAttribute("data-masonry-ignore")&&!this.removingItems.has(e))}if(this.itemResizeObserver){let e=new Set(t);for(let i of this.observedItems)e.has(i)||(this.itemResizeObserver.unobserve(i),this.observedItems.delete(i),this.observedItemHeights.delete(i))}this._items=t;for(let e of this._items)e.classList.add("wulf-masonry-item"),this.itemResizeObserver&&!this.observedItems.has(e)&&(this.itemResizeObserver.observe(e),this.observedItems.add(e))}initObservers(){if(!this.options.resize||typeof ResizeObserver>"u")return;let t=this.root.getBoundingClientRect().width;this.resizeObserver=new ResizeObserver(e=>{for(let i of e){let s=i.contentRect.width;Math.abs(s-t)>=1&&(t=s,this.scheduleLayout())}}),this.resizeObserver.observe(this.root),this.itemResizeObserver=new ResizeObserver(e=>{let i=!1;for(let s of e){let n=s.borderBoxSize?.[0]?.blockSize??s.contentRect.height,r=this.observedItemHeights.get(s.target);(r===void 0||Math.abs(n-r)>=1)&&(this.observedItemHeights.set(s.target,n),r!==void 0&&(i=!0))}i&&this.scheduleLayout()});for(let e of this._items)this.itemResizeObserver.observe(e),this.observedItems.add(e)}syncNativeGridVariables(){let{x:t,y:e}=$.parseGutter(this.options.gutter);if(this.root.style.setProperty("--wulf-masonry-gutter-x",`${t}px`),this.root.style.setProperty("--wulf-masonry-gutter-y",`${e}px`),typeof this.options.columnWidth=="number"&&Number.isFinite(this.options.columnWidth)&&this.options.columnWidth>0)this.root.style.setProperty("--wulf-masonry-col-min",`${this.options.columnWidth}px`);else if(this.options.columnWidth instanceof HTMLElement){let i=this.options.columnWidth.getBoundingClientRect().width;i>0&&this.root.style.setProperty("--wulf-masonry-col-min",`${i}px`)}else if(typeof this.options.columnWidth=="string"&&this.options.columnWidth.trim())try{let i=this.root.querySelector(this.options.columnWidth);if(i){let s=i.getBoundingClientRect().width;s>0&&this.root.style.setProperty("--wulf-masonry-col-min",`${s}px`)}}catch{}}initImages(){if(!this.options.autoImages)return;let t=Array.from(this.root.querySelectorAll("img"));for(let e of t)if(!e.complete&&!this.watchedImages.has(e)){this.watchedImages.add(e);let i=()=>{e.addEventListener("load",()=>{this.isDestroyed||this.scheduleLayout()},{once:!0,signal:this.abortController.signal})};typeof e.decode=="function"?e.decode().then(()=>{this.isDestroyed||this.scheduleLayout()}).catch(()=>{i()}):i()}}scheduleLayout(){this.isDestroyed||(this.layoutRafId!==null&&cancelAnimationFrame(this.layoutRafId),this.layoutRafId=requestAnimationFrame(()=>{this.layoutRafId=null,this.layout()}))}layout(){if(this.isDestroyed)return;if(this.syncAccessibilityLabels(),this.isNativeCSSGrid){this.syncNativeGridVariables();for(let o of this._items)o.classList.remove("wulf-masonry-item--hidden");this.options.onLayout([]);return}this.root.setAttribute("aria-busy","true"),this.options.fitWidth&&this.root.classList.contains("wulf-masonry--fit-width")&&(this.root.style.width="");let t=$.calculate(this.root,this._items,this.options);this.root.style.height=`${t.containerHeight}px`,this.options.fitWidth&&t.fittedWidth!==void 0?(this.root.style.width=`${t.fittedWidth}px`,this.root.classList.add("wulf-masonry--fit-width")):this.root.classList.remove("wulf-masonry--fit-width");let e=this.options.stagger,i=typeof e=="number"&&Number.isFinite(e)&&e>0;i?this.root.style.setProperty("--wulf-masonry-stagger",`${e}ms`):this.root.style.removeProperty("--wulf-masonry-stagger");let n=!(this._items.length!==this.root.children.length)&&typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("transition-delay","calc(sibling-index() * 1ms)"),r=this.options.percentPosition&&t.containerWidth>0;for(let o=0;o<t.positions.length;o++){let a=t.positions[o],l=a.element;if(r){let u=Number((a.width/t.containerWidth*100).toFixed(4));l.style.setProperty("--wulf-masonry-w",`${u}%`)}else l.style.setProperty("--wulf-masonry-w",`${a.width}px`);l.style.setProperty("--wulf-masonry-x",`${a.x}px`),l.style.setProperty("--wulf-masonry-y",`${a.y}px`),i&&!n?l.style.setProperty("--wulf-masonry-index",String(o)):l.style.removeProperty("--wulf-masonry-index"),l.classList.remove("wulf-masonry-item--hidden"),this.observedItemHeights.set(l,a.height),this.options.onItemPlaced(l,a)}this.root.setAttribute("aria-busy","false"),this.options.onLayout(t.positions)}append(t){if(this.isDestroyed)return;let e=Array.isArray(t)?t:[t];if(e.length===0)return;let i=document.createDocumentFragment();for(let s of e)this.isNativeCSSGrid?s.classList.add("wulf-masonry-item"):s.classList.add("wulf-masonry-item","wulf-masonry-item--hidden"),i.appendChild(s);this.root.appendChild(i),this.reloadItems(),this.initImages(),this.layout()}prepend(t){if(this.isDestroyed)return;let e=Array.isArray(t)?t:[t];if(e.length===0)return;let i=this.root.firstChild,s=document.createDocumentFragment();for(let n of e)this.isNativeCSSGrid?n.classList.add("wulf-masonry-item"):n.classList.add("wulf-masonry-item","wulf-masonry-item--hidden"),s.appendChild(n);this.root.insertBefore(s,i),this.reloadItems(),this.initImages(),this.layout()}remove(t){if(this.isDestroyed)return;let e=Array.isArray(t)?t:[t];if(e.length===0)return;let i=()=>{if(!this.isDestroyed){for(let n of e)this.removingItems.delete(n),n.parentElement===this.root&&(this.itemResizeObserver&&(this.itemResizeObserver.unobserve(n),this.observedItems.delete(n),this.observedItemHeights.delete(n)),this.root.removeChild(n));this.reloadItems(),this.layout()}};for(let n of e)this.removingItems.add(n),typeof document<"u"&&document.activeElement&&n.contains(document.activeElement)&&document.activeElement.blur?.(),n.setAttribute("inert",""),n.style.transitionDelay="0ms",n.classList.add("wulf-masonry-item--hidden");let s=Dt(this.options.transitionDuration,300);if(s<=0||this.isNativeCSSGrid){i();return}this.reloadItems(),this.layout(),Promise.all(e.map(n=>St(n,s,this.abortController.signal))).then(()=>{this.abortController.signal.aborted||i()})}audit(){let t=[],e=this.checkAriaIdReferences(this.root,"aria-labelledby",t),i=!this.wasAriaLabelInferred&&!!this.root.getAttribute("aria-label")?.trim();!this.hasExplicitAriaLabel&&!i&&!e&&t.push("Libell\xE9 contextuel manquant : d\xE9finissez l'option ariaLabel (ou un attribut aria-label / aria-labelledby sur le conteneur) pour qualifier la grille (WCAG 4.1.2).");let s=Array.from(this.root.querySelectorAll("img")).filter(n=>!n.hasAttribute("alt")&&n.getAttribute("aria-hidden")!=="true");return s.length>0&&t.push(`${s.length} image(s) <img> d\xE9pourvue(s) d'attribut alt : renseignez alt="description" (ou alt="" si d\xE9corative) (WCAG 1.1.1).`),t}getAuditPrefix(){return"Wulf.Masonry"}getAuditTargetLabel(){return this.root.id?`#${this.root.id}`:`<${this.root.tagName.toLowerCase()}.wulf-masonry>`}destroy(){if(!this.isDestroyed){this.isDestroyed=!0,this.abortController.abort(),this.layoutRafId!==null&&(cancelAnimationFrame(this.layoutRafId),this.layoutRafId=null),this.resizeObserver&&(this.resizeObserver.disconnect(),this.resizeObserver=null),this.itemResizeObserver&&(this.itemResizeObserver.disconnect(),this.itemResizeObserver=null),this.root.classList.remove("wulf-masonry","wulf-masonry--native","wulf-masonry--fit-width"),this.root.removeAttribute("aria-busy"),this.wasRoleInferred&&this.root.getAttribute("role")===this.options.ariaRole&&this.root.removeAttribute("role"),this.wasAriaLabelInferred&&this.root.getAttribute("aria-label")===this.lastInferredAriaLabel&&this.root.removeAttribute("aria-label"),this.root.style.removeProperty("--wulf-masonry-duration"),this.root.style.removeProperty("--wulf-masonry-stagger"),this.root.style.removeProperty("--wulf-masonry-col-min"),this.root.style.removeProperty("--wulf-masonry-gutter-x"),this.root.style.removeProperty("--wulf-masonry-gutter-y"),this.originalContainerStyles.height?this.root.style.height=this.originalContainerStyles.height:this.root.style.removeProperty("height"),this.originalContainerStyles.width?this.root.style.width=this.originalContainerStyles.width:this.root.style.removeProperty("width");for(let t of this._items)t.classList.remove("wulf-masonry-item","wulf-masonry-item--hidden"),t.style.removeProperty("--wulf-masonry-w"),t.style.removeProperty("--wulf-masonry-x"),t.style.removeProperty("--wulf-masonry-y"),t.style.removeProperty("--wulf-masonry-index");this._items=[]}}};var Se=J,Jt=F();Jt&&(Jt.Masonry=Object.assign(J,{Masonry:J,LayoutEngine:$,i18n:yt}));var zt={};ot(zt,{LocalizedComponent:()=>R,Toast:()=>tt,ToastInstance:()=>ct,ToastManager:()=>Q,createI18nManager:()=>G,default:()=>Me,toastEn:()=>Ut,toastFr:()=>Bt,toastI18n:()=>_});var Bt={closeButton:"Fermer la notification",notificationsRegion:"Notifications"};var Ut={closeButton:"Close notification",notificationsRegion:"Notifications"};var _=G("fr",{fr:Bt,en:Ut});var we=1,Qt=5e3;function Ct(p){if(!p||typeof p!="string"||p.length>128)return!1;let t=p.trim();return!t||/[\u0000-\u001F\u007F;{}<>\\]|(?:url|image-set|-webkit-image-set|image|src|expression|attr|env)\s*\(/i.test(t)?!1:typeof CSS<"u"&&typeof CSS.supports=="function"?CSS.supports("color",t)||CSS.supports("background-color",t):!0}function Ce(p){return p.slice(0,128).trim().split(/\s+/).filter(t=>/^[a-zA-Z0-9_-]+$/.test(t)&&!t.startsWith("wulf-toast")).slice(0,8).join(" ")}var ct=class extends B{id;options;element;_isClosed=!1;_isFinalized=!1;closePromise=null;timerId=null;remainingTime=0;hasDuration=!1;timerStartTime=0;isPausedByHover=!1;isPausedByFocus=!1;isPausedByVisibility=!1;isPendingFocusDismiss=!1;previousActiveElement=null;eventsAbortController=new AbortController;disposeAbortController=new AbortController;onDismissCallback;constructor(t,e){super(),this.id=`wulf-toast-${we++}`,this.options=Object.freeze({...t}),this.onDismissCallback=e,this.previousActiveElement=typeof document<"u"&&document.activeElement instanceof HTMLElement?document.activeElement:null;let i=t.duration===void 0?Qt:t.duration;typeof i=="number"&&Number.isFinite(i)&&i>0?(this.remainingTime=Math.min(i,2147483647),this.hasDuration=!0):(this.remainingTime=0,this.hasDuration=!1),this.element=this.createDOM(),this.bindEvents(),this.runAuditWarning(t.audit!==!1)}get isClosed(){return this._isClosed}getPreviousActiveElement(){return this.previousActiveElement}audit(){let t=[],e=!!(this.options.title&&this.options.title.trim().length>0),i=!!(this.options.message&&this.options.message.trim().length>0);!e&&!i&&t.push("Contenu textuel vide : d\xE9finissez au moins un title ou un message pour que le lecteur d'\xE9cran puisse annoncer la notification (WCAG 4.1.3).");let s=this.options.duration===void 0?Qt:this.options.duration;typeof s=="number"&&s>0&&s<5e3&&t.push(`Dur\xE9e d'affichage trop courte (duration: ${s}ms) : pr\xE9voyez au moins 5000ms ou duration: false pour laisser le temps de lecture aux utilisateurs (WCAG 2.2.1).`);let n=this.options.closable??!0;return(s===!1||typeof s=="number"&&s<=0)&&!n&&t.push("Notification persistante impossible \xE0 fermer au clavier : activez closable: true lorsque duration est d\xE9sactiv\xE9 (WCAG 2.1.1)."),t}getAuditPrefix(){return"Wulf.Toast"}getAuditTargetLabel(){return`#${this.id}`}createDOM(){let t=document.createElement("div");if(t.id=this.id,t.className="wulf-toast",t.setAttribute("data-toast-role",this.options.role==="alert"?"alert":"status"),this.options.backgroundColor&&Ct(this.options.backgroundColor)&&t.style.setProperty("--wulf-toast-bg",this.options.backgroundColor.trim()),this.options.titleColor&&Ct(this.options.titleColor)&&t.style.setProperty("--wulf-toast-title-color",this.options.titleColor.trim()),this.options.textColor&&Ct(this.options.textColor)&&t.style.setProperty("--wulf-toast-text-color",this.options.textColor.trim()),this.options.iconColor&&Ct(this.options.iconColor)&&t.style.setProperty("--wulf-toast-icon-color",this.options.iconColor.trim()),this.options.closeButtonColor&&Ct(this.options.closeButtonColor)&&t.style.setProperty("--wulf-toast-close-color",this.options.closeButtonColor.trim()),this.options.icon&&typeof this.options.icon=="string"&&this.options.icon.trim()!==""){let s=Ce(this.options.icon);if(s){let n=document.createElement("span");n.className=`wulf-toast-icon ${s}`,n.setAttribute("aria-hidden","true"),t.appendChild(n)}}let e=document.createElement("div");if(e.className="wulf-toast-content",this.options.title&&this.options.title.trim()!==""){let s=document.createElement("div");s.className="wulf-toast-title",this.appendTextWithLineBreaks(s,this.options.title),e.appendChild(s)}if(this.options.message&&this.options.message.trim()!==""){let s=document.createElement("div");s.className="wulf-toast-message",this.appendTextWithLineBreaks(s,this.options.message),e.appendChild(s)}if(t.appendChild(e),this.options.closable??!0){let s=document.createElement("button");s.type="button",s.className="wulf-toast-close",s.setAttribute("aria-label",_.t("closeButton",this.options.i18n));let n=document.createElement("span");n.className="wulf-toast-close-icon",n.setAttribute("aria-hidden","true"),n.textContent="\xD7",s.appendChild(n),s.addEventListener("click",r=>{r.stopPropagation(),this.close("close-button")},{signal:this.eventsAbortController.signal}),t.appendChild(s)}if(this.options.progressBar&&this.remainingTime>0){t.style.setProperty("--wulf-toast-duration",`${this.remainingTime}ms`);let s=document.createElement("div");s.className="wulf-toast-progress",s.setAttribute("aria-hidden","true"),t.appendChild(s)}return t}appendTextWithLineBreaks(t,e){String(e??"").slice(0,4096).split(/\r\n|\r|\n/).slice(0,100).forEach((n,r)=>{r>0&&t.appendChild(document.createElement("br")),t.appendChild(document.createTextNode(n))})}bindEvents(){let{signal:t}=this.eventsAbortController;this.element.addEventListener("click",e=>{this.options.onClick&&this.options.onClick(this,e),this.options.closeOnClick&&this.close("toast-click")},{signal:t}),this.element.addEventListener("mouseenter",()=>this.pauseTimer("hover"),{signal:t}),this.element.addEventListener("mouseleave",()=>this.resumeTimer("hover"),{signal:t}),this.element.addEventListener("focusin",()=>this.pauseTimer("focus"),{signal:t}),this.element.addEventListener("focusout",e=>{let i=e.relatedTarget;if(!(i&&this.element.contains(i))){if(this.isPendingFocusDismiss&&!this._isClosed){this.isPendingFocusDismiss=!1,this.close("timeout");return}this.resumeTimer("focus")}},{signal:t}),this.element.addEventListener("keydown",e=>{e.key==="Escape"&&(this.options.closable??!0)&&(e.stopPropagation(),this.close("close-button"))},{signal:t}),typeof document<"u"&&document.addEventListener("visibilitychange",()=>{document.visibilityState==="hidden"?this.pauseTimer("visibility"):this.resumeTimer("visibility")},{signal:t})}get isPaused(){return this.isPausedByHover||this.isPausedByFocus||this.isPausedByVisibility}startTimer(){if(!(this._isClosed||this.remainingTime<=0||this.isPaused)){if(typeof document<"u"&&document.visibilityState==="hidden"){this.isPausedByVisibility=!0,this.element.classList.add("is-paused");return}this.timerId!==null&&(window.clearTimeout(this.timerId),this.timerId=null),this.timerStartTime=performance.now(),this.timerId=window.setTimeout(()=>{if(this.timerId=null,typeof document<"u"&&this.element.contains(document.activeElement)){this.isPendingFocusDismiss=!0;return}this.close("timeout")},this.remainingTime)}}pauseTimer(t="interaction"){if(this._isClosed||!this.hasDuration||this.remainingTime<=0)return;let e=this.isPaused;if(t==="visibility"?this.isPausedByVisibility=!0:t==="focus"?this.isPausedByFocus=!0:this.isPausedByHover=!0,!e){if(this.timerId!==null){window.clearTimeout(this.timerId),this.timerId=null;let i=performance.now()-this.timerStartTime;this.remainingTime=Math.max(0,this.remainingTime-i)}this.element.classList.add("is-paused")}}resumeTimer(t="interaction"){if(!(this._isClosed||!this.hasDuration)&&(t==="visibility"?this.isPausedByVisibility=!1:t==="focus"?this.isPausedByFocus=!1:t==="hover"?(this.isPausedByHover=!1,typeof document<"u"&&this.element.contains(document.activeElement)&&(this.isPausedByFocus=!0)):(this.isPausedByHover=!1,this.isPausedByFocus=!1),!this.isPaused)){if(this.element.classList.remove("is-paused"),this.remainingTime<=0){this.close("timeout");return}this.startTimer()}}finalizeDismiss(t){this._isFinalized||(this._isFinalized=!0,this.eventsAbortController.abort(),this.onDismissCallback&&this.onDismissCallback(this,t),this.element.parentNode&&this.element.parentNode.removeChild(this.element),this.options.onClose&&this.options.onClose(this,t))}destroyImmediate(t="replace"){this._isClosed=!0,this.timerId!==null&&(window.clearTimeout(this.timerId),this.timerId=null),this.disposeAbortController.abort(),this.finalizeDismiss(t)}close(t="programmatic",e=!1){return this._isClosed?this.closePromise??Promise.resolve():(this._isClosed=!0,this.timerId!==null&&(window.clearTimeout(this.timerId),this.timerId=null),this.eventsAbortController.abort(),this.element.classList.add(e?"wulf-toast-hiding-fast":"wulf-toast-hiding"),dt()?(this.finalizeDismiss(t),this.closePromise=Promise.resolve(),this.closePromise):(this.closePromise=St(this.element,e?90:300,this.disposeAbortController.signal).then(()=>{this.disposeAbortController.signal.aborted||this.finalizeDismiss(t)}),this.closePromise))}};var ke=new Set(["top-left","top-center","top-right","bottom-left","bottom-center","bottom-right"]);function te(p){return p&&ke.has(p)?p:"top-right"}var Ae='button:not([disabled]), [href], [tabindex]:not([tabindex="-1"])',Q=class p{static instance=null;containers=new Map;activeToasts=new Map;announcerEl=null;politeRegion=null;assertiveRegion=null;announceTimers=[];politeAnnounceTimerId=null;assertiveAnnounceTimerId=null;politeClearTimerId=null;assertiveClearTimerId=null;lastPoliteText="";lastAssertiveText="";announcerToggle=!1;isPopoverOpen(t){try{if(t.matches(":popover-open"))return!0}catch{}return t.classList.contains(":popover-open")}replaceTokens=new Map;pendingReplacements=new Set;constructor(){}static getInstance(){return p.instance||(p.instance=new p),p.instance}add(t){let e=te(t.options.position),i=this.activeToasts.get(e);i||(i=[],this.activeToasts.set(e,i));let s=t.options.maxToasts,n=typeof s=="number"&&Number.isFinite(s)&&s>0?Math.min(50,Math.max(1,Math.floor(s))):5;if(t.options.replace&&i.length>0){let r=[...i],o=(this.replaceTokens.get(e)||0)+1;this.replaceTokens.set(e,o),this.pendingReplacements.add(e);let a=r.map(l=>l.close("replace",!0));Promise.all(a).then(()=>{if(this.pendingReplacements.delete(e),this.replaceTokens.get(e)!==o){t.destroyImmediate("replace");return}this.mountToast(t,e,n)});return}if(this.pendingReplacements.has(e)&&(this.replaceTokens.set(e,(this.replaceTokens.get(e)||0)+1),this.pendingReplacements.delete(e)),i.length>=n){let r=i.length-n+1,o=i.splice(0,r);for(let a of o)a.close("max-limit",!0)}this.mountToast(t,e,n)}mountToast(t,e,i=5){if(t.isClosed)return;let s=t.options.useTopLayer??!0,n=this.getOrCreateContainer(e,t,s),r=this.activeToasts.get(e);r||(r=[],this.activeToasts.set(e,r));let o=i+10;if(n.children.length>=o){let a=Array.from(n.children);for(let l of a){if(n.children.length<o)break;(l.classList.contains("wulf-toast-hiding")||l.classList.contains("wulf-toast-hiding-fast"))&&l.remove()}}if(s&&typeof n.showPopover=="function"&&n.getAttribute("popover")==="manual")try{let a=n;this.isPopoverOpen(n)||a.showPopover()}catch{n.removeAttribute("popover")}if(n.appendChild(t.element),r.push(t),this.announce(t),t.options.onOpen)try{t.options.onOpen(t)}catch(a){console.error("[Wulf.Toast] Erreur dans le callback onOpen:",a)}t.startTimer()}announce(t){let e=[t.options.title,t.options.message].filter(d=>typeof d=="string"&&d.trim().length>0).map(d=>d.trim());if(e.length===0)return;let i=e.join(". "),s=i.length>512?`${i.slice(0,509)}...`:i,n=t.options.role==="alert",r=document;if(typeof r.ariaNotify=="function")try{r.ariaNotify(s,{priority:n?"high":"normal"});return}catch{}let o=!this.announcerEl||!this.announcerEl.isConnected;this.ensureAnnouncer();let a=n?this.assertiveRegion:this.politeRegion;if(!a)return;n?(this.assertiveAnnounceTimerId!==null&&(window.clearTimeout(this.assertiveAnnounceTimerId),this.assertiveAnnounceTimerId=null),this.assertiveClearTimerId!==null&&(window.clearTimeout(this.assertiveClearTimerId),this.assertiveClearTimerId=null)):(this.politeAnnounceTimerId!==null&&(window.clearTimeout(this.politeAnnounceTimerId),this.politeAnnounceTimerId=null),this.politeClearTimerId!==null&&(window.clearTimeout(this.politeClearTimerId),this.politeClearTimerId=null)),a.textContent="";let l=n?this.lastAssertiveText:this.lastPoliteText,u=s;s===l?(this.announcerToggle=!this.announcerToggle,u=this.announcerToggle?`${s}\xA0`:s):this.announcerToggle=!1,n?this.lastAssertiveText=s:this.lastPoliteText=s;let h=o?120:50,c=window.setTimeout(()=>{let d=this.announceTimers.indexOf(c);if(d!==-1&&this.announceTimers.splice(d,1),n?this.assertiveAnnounceTimerId=null:this.politeAnnounceTimerId=null,a.isConnected){a.textContent=u;let f=window.setTimeout(()=>{let g=this.announceTimers.indexOf(f);g!==-1&&this.announceTimers.splice(g,1),a.isConnected&&a.textContent===u&&(a.textContent="")},4e3);this.announceTimers.push(f),n?this.assertiveClearTimerId=f:this.politeClearTimerId=f}},h);this.announceTimers.push(c),n?this.assertiveAnnounceTimerId=c:this.politeAnnounceTimerId=c}ensureAnnouncer(){if(this.announcerEl&&document.body.contains(this.announcerEl))return;let t=document.createElement("div");t.className="wulf-toast-announcer",t.setAttribute("data-wulf-toast-announcer","true");let e=document.createElement("div");e.setAttribute("role","status"),e.setAttribute("aria-live","polite"),e.setAttribute("aria-atomic","true");let i=document.createElement("div");i.setAttribute("role","alert"),i.setAttribute("aria-live","assertive"),i.setAttribute("aria-atomic","true"),t.appendChild(e),t.appendChild(i),document.body.appendChild(t),this.announcerEl=t,this.politeRegion=e,this.assertiveRegion=i}handleFocusHandoff(t,e){if(!t.element.contains(document.activeElement))return;for(let s=e.length-1;s>=0;s--){let n=e[s];if(n===t||n.isClosed||!n.element.isConnected)continue;let r=n.element.querySelector(Ae);if(r){r.focus({preventScroll:!0});return}}let i=t.getPreviousActiveElement();if(i&&i.isConnected&&typeof i.focus=="function"&&!i.disabled&&!i.closest("[inert]")&&i.getAttribute("aria-hidden")!=="true")try{i.focus()}catch{}}remove(t,e){let i=te(t.options.position),s=this.activeToasts.get(i);if(s){let n=s.indexOf(t);if(n!==-1&&s.splice(n,1),this.handleFocusHandoff(t,s),t.element.parentNode&&t.element.parentNode.removeChild(t.element),s.length===0&&!this.pendingReplacements.has(i)){let r=this.containers.get(i);r&&(!r.firstChild||r.children.length===0)&&(this.disposeContainer(r),this.containers.delete(i),this.activeToasts.delete(i))}}else t.element.parentNode&&t.element.parentNode.removeChild(t.element)}disposeContainer(t){try{let e=t;typeof e.hidePopover=="function"&&this.isPopoverOpen(t)&&e.hidePopover()}catch{}t.parentNode&&t.parentNode.removeChild(t)}clearAll(t){let e=[];if(t){this.replaceTokens.set(t,(this.replaceTokens.get(t)||0)+1),this.pendingReplacements.delete(t);let i=this.activeToasts.get(t);if(i&&i.length>0){let s=[...i];for(let n of s)e.push(n.close("programmatic"))}else{let s=this.containers.get(t);s&&(!s.firstChild||s.children.length===0)&&(this.disposeContainer(s),this.containers.delete(t),this.activeToasts.delete(t))}}else{for(let s of this.replaceTokens.keys())this.replaceTokens.set(s,(this.replaceTokens.get(s)||0)+1);this.pendingReplacements.clear();for(let s of this.announceTimers)window.clearTimeout(s);this.announceTimers=[],this.politeAnnounceTimerId=null,this.assertiveAnnounceTimerId=null,this.politeClearTimerId=null,this.assertiveClearTimerId=null;let i=new Set([...Array.from(this.containers.keys()),...Array.from(this.activeToasts.keys())]);for(let s of i)e.push(this.clearAll(s))}return Promise.all(e).then(()=>{if(!t)for(let[i,s]of Array.from(this.containers.entries()))(!s.firstChild||s.children.length===0)&&(this.disposeContainer(s),this.containers.delete(i),this.activeToasts.delete(i))})}destroy(){for(let t of this.announceTimers)window.clearTimeout(t);this.announceTimers=[];for(let t of Array.from(this.activeToasts.values()))for(let e of[...t])e.destroyImmediate("programmatic");for(let t of Array.from(this.containers.values()))this.disposeContainer(t);this.containers.clear(),this.activeToasts.clear(),this.replaceTokens.clear(),this.pendingReplacements.clear(),this.announcerEl&&(this.announcerEl.remove(),this.announcerEl=null,this.politeRegion=null,this.assertiveRegion=null),p.instance=null}getOrCreateContainer(t,e,i){let s=this.containers.get(t);return(!s||!document.body.contains(s))&&(s=document.createElement("div"),s.className=`wulf-toast-container wulf-toast-${t}`,s.setAttribute("role","region"),s.setAttribute("aria-label",_.t("notificationsRegion",e.options.i18n)),i&&typeof s.showPopover=="function"&&s.setAttribute("popover","manual"),document.body.appendChild(s),this.containers.set(t,s)),s}};var tt=class extends R{static _i18n=_;static i18n=_;audit(){return[]}getAuditPrefix(){return"Wulf.Toast"}getAuditTargetLabel(){return"Toast"}static show(t={}){let e=Q.getInstance(),i=new ct(t,(s,n)=>{e.remove(s,n)});return e.add(i),i}static clearAll(t){return Q.getInstance().clearAll(t)}static destroy(){Q.getInstance().destroy()}};var Me=tt,ee=F();ee&&(ee.Toast=Object.assign(tt,{Toast:tt,i18n:_}));var Wt={};ot(Wt,{FocusTrap:()=>it,default:()=>it});var Ee=["a[href]","area[href]",'input:not([disabled]):not([type="hidden"])',"select:not([disabled])","textarea:not([disabled])","button:not([disabled])","audio[controls]","video[controls]","details > summary:first-of-type","iframe","object","embed",'[contenteditable]:not([contenteditable="false"])','[tabindex]:not([tabindex="-1"])'].join(",");function Kt(p,t){if(!t||typeof t!="string")return null;try{return p.querySelector(t)}catch{return null}}var et=[],it=class extends B{element;options;active=!1;paused=!1;previousActiveElement=null;inertSiblings=[];addedContainerTabIndex=!1;lastOutsidePointerDownTime=0;abortController;handleKeyDownBound;handleClickOutsideBound;handleFocusInBound;constructor(t,e={}){super();let i=typeof t=="string"?Kt(document,t):t;if(!i||!(i instanceof HTMLElement))throw new Error(`[Wulf.FocusTrap] Conteneur introuvable ou invalide : "${t}"`);this.element=i;let s=e.allowOutsideClick??!1;this.options={initialFocus:e.initialFocus!==void 0?e.initialFocus:"[data-autofocus], [autofocus]",returnFocus:e.returnFocus??!0,fallbackReturnFocus:e.fallbackReturnFocus??"",escapeDeactivates:e.escapeDeactivates??!0,allowOutsideClick:s,setInert:e.setInert??!s,onActivate:e.onActivate??(()=>{}),onDeactivate:e.onDeactivate??(()=>{}),audit:e.audit??!0},this.handleKeyDownBound=this.handleKeyDown.bind(this),this.handleClickOutsideBound=this.handleClickOutside.bind(this),this.handleFocusInBound=this.handleFocusIn.bind(this),this.runAuditWarning(this.options.audit)}isNativeDialogElement(){return this.element.tagName.toLowerCase()==="dialog"}isNativeModalDialog(){if(!this.isNativeDialogElement())return!1;try{return this.element.matches(":modal")}catch{return!1}}isElementFocusableBase(t){if(!t||!t.isConnected||t.tabIndex<0||t.disabled)return!1;try{if(t.matches(":disabled"))return!1}catch{if(t.closest("fieldset[disabled]"))return!1}if(t.hasAttribute("inert")||t.closest("[inert]")||t.hidden||t.closest("[hidden]"))return!1;let e=t;if(typeof e.checkVisibility=="function"){if(!e.checkVisibility({checkOpacity:!1,checkVisibilityCSS:!0,visibilityProperty:!0}))return!1}else{if(t.style.display==="none"||t.style.visibility==="hidden")return!1;let i=window.getComputedStyle(t);if(i.display==="none"||i.visibility==="hidden"||t.offsetWidth===0&&t.offsetHeight===0&&i.position!=="fixed")return!1}return!0}isFocusable(t){if(!this.isElementFocusableBase(t))return!1;if(t instanceof HTMLInputElement&&t.type==="radio"&&t.name){let e=Array.from(this.element.querySelectorAll(`input[type="radio"][name="${at(t.name)}"]`)).filter(s=>s.form===t.form&&this.isElementFocusableBase(s));if(e.length===0)return!1;let i=e.find(s=>s.checked);return i?t===i:t===e[0]}return!0}getFocusableElements(){return Array.from(this.element.querySelectorAll(Ee)).filter(e=>this.isFocusable(e))}activate(){if(this.active)return this;let t=et[et.length-1];t&&t.pause(),this.active=!0,this.paused=!1,et.push(this);let e=Y(document);this.previousActiveElement=e instanceof HTMLElement?e:document.activeElement,this.options.setInert&&!this.isNativeModalDialog()&&this.applyInert(),this.abortController?.abort(),this.abortController=new AbortController;let{signal:i}=this.abortController;return document.addEventListener("keydown",this.handleKeyDownBound,{capture:!0,signal:i}),document.addEventListener("focusin",this.handleFocusInBound,{capture:!0,signal:i}),document.addEventListener("pointerdown",this.handleClickOutsideBound,{capture:!0,signal:i}),this.options.allowOutsideClick||(document.addEventListener("mousedown",this.handleClickOutsideBound,{capture:!0,signal:i}),document.addEventListener("touchstart",this.handleClickOutsideBound,{capture:!0,signal:i}),document.addEventListener("click",this.handleClickOutsideBound,{capture:!0,signal:i})),this.applyInitialFocus(),this.runAuditWarning(this.options.audit),this.options.onActivate(),this}deactivate(){if(!this.active)return this;this.active=!1,this.paused=!1;let t=et.indexOf(this);t!==-1&&et.splice(t,1),this.abortController?.abort(),this.abortController=void 0,this.removeInert(),this.addedContainerTabIndex&&(this.element.removeAttribute("tabindex"),this.addedContainerTabIndex=!1);let e=et[et.length-1];return e&&e.unpause(),this.options.returnFocus&&this.restoreFocus(),this.previousActiveElement=null,this.options.onDeactivate(),this}pause(){this.paused=!0,this.removeInert()}unpause(){this.active&&et[et.length-1]===this&&(this.paused=!1,this.options.setInert&&!this.isNativeModalDialog()&&this.applyInert())}isActive(){return this.active&&!this.paused}audit(){let t=[],e=this.element.getAttribute("role");this.isNativeDialogElement()?(e==="dialog"&&t.push('Attribut redondant : role="dialog" est d\xE9j\xE0 implicite sur une balise native <dialog>.'),this.element.hasAttribute("aria-modal")&&t.push('Attribut redondant : <dialog> ouvert via showModal() g\xE8re nativement la modalit\xE9 sans n\xE9cessiter aria-modal="true".'),this.element.hasAttribute("open")&&!this.isNativeModalDialog()&&t.push("Dialogue non modal d\xE9tect\xE9 : pr\xE9f\xE9rez dialog.showModal() plut\xF4t que l'attribut open pour obtenir la Top Layer et l'inertie natives.")):((!e||!["dialog","alertdialog","menu","listbox","tree","grid"].includes(e))&&t.push('R\xF4le s\xE9mantique manquant ou inadapt\xE9 : d\xE9finissez role="dialog" (ou "alertdialog", "menu", "listbox") sur le conteneur.'),(e==="dialog"||e==="alertdialog")&&this.element.getAttribute("aria-modal")!=="true"&&t.push('Isolation modale manquante : d\xE9finissez aria-modal="true" sur le conteneur de dialogue (WCAG 4.1.2).'));let n=this.element.getAttribute("aria-label")?.trim(),r=this.checkAriaIdReferences(this.element,"aria-labelledby",t);return!n&&!r&&t.push('Nom accessible manquant : d\xE9finissez aria-labelledby="id-titre" ou aria-label="..." sur le conteneur (WCAG 4.1.2).'),t}getAuditPrefix(){return"Wulf.FocusTrap"}getAuditTargetLabel(){return this.element.id?`#${this.element.id}`:`<${this.element.tagName.toLowerCase()}>`}destroy(){this.deactivate()}isEventInside(t,e){return!!(e&&this.element.contains(e)||typeof t.composedPath=="function"&&t.composedPath().includes(this.element))}isInsideToastContainer(t){return!t||!(t instanceof Element)?!1:!!t.closest(".wulf-toast-container")}ensureContainerTabIndex(){this.element.getAttribute("tabindex")===null&&(this.element.setAttribute("tabindex","-1"),this.addedContainerTabIndex=!0)}handleKeyDown(t){if(!this.isActive())return;if(this.element.isConnected===!1){this.deactivate();return}if(t.key==="Escape"&&this.options.escapeDeactivates){if(N(t))return;this.isNativeModalDialog()||(t.preventDefault(),t.stopPropagation()),this.deactivate();return}if(t.key!=="Tab")return;let e=this.getFocusableElements();if(e.length===0){t.preventDefault(),this.ensureContainerTabIndex(),this.element.focus();return}let i=e[0],s=e[e.length-1],n=Y(document),r=n instanceof HTMLElement?n:document.activeElement,o=r?this.element.contains(r)||this.isEventInside(t,r):!1;!t.shiftKey&&(r===s||!o)?(t.preventDefault(),i.focus()):t.shiftKey&&(r===i||r===this.element||!o)&&(t.preventDefault(),s.focus())}handleFocusIn(t){if(!this.isActive())return;if(this.element.isConnected===!1){this.deactivate();return}let e=t.target;if(e&&!this.isInsideToastContainer(e)&&!(this.options.allowOutsideClick&&performance.now()-this.lastOutsidePointerDownTime<150)&&!this.isEventInside(t,e)){let i=this.getFocusableElements();i.length>0?i[0].focus():(this.ensureContainerTabIndex(),this.element.focus())}}handleClickOutside(t){if(!this.isActive())return;if(this.element.isConnected===!1){this.deactivate();return}let e=t.target;if(e&&!this.isEventInside(t,e)){if(this.isInsideToastContainer(e))return;if(this.options.allowOutsideClick){this.lastOutsidePointerDownTime=performance.now();return}t.preventDefault(),t.stopPropagation()}}applyInert(){this.removeInert();let t=this.element,e=new Set(["SCRIPT","STYLE","TEMPLATE","LINK","META","NOSCRIPT"]);for(;t&&t!==document.body&&t.parentElement;){let i=t.parentElement;for(let s of Array.from(i.children))s instanceof HTMLElement&&s!==t&&!e.has(s.tagName)&&!s.hasAttribute("inert")&&!s.matches(".wulf-toast-container, .wulf-toast-announcer")&&(s.setAttribute("inert",""),this.inertSiblings.push(s));t=i}}removeInert(){this.inertSiblings.forEach(t=>t.removeAttribute("inert")),this.inertSiblings=[]}applyInitialFocus(){if(this.options.initialFocus===!1)return;let t=null;if(typeof this.options.initialFocus=="string"?t=Kt(this.element,this.options.initialFocus):this.options.initialFocus instanceof HTMLElement&&(t=this.options.initialFocus),t&&this.isFocusable(t)){t.focus();return}let e=this.getFocusableElements();e.length>0?e[0].focus():(this.ensureContainerTabIndex(),this.element.focus())}restoreFocus(){if(this.previousActiveElement&&this.previousActiveElement.isConnected&&this.isElementFocusableBase(this.previousActiveElement)){this.previousActiveElement.focus();return}if(this.options.fallbackReturnFocus){let t=typeof this.options.fallbackReturnFocus=="string"?Kt(document,this.options.fallbackReturnFocus):this.options.fallbackReturnFocus;t&&t.isConnected&&this.isElementFocusableBase(t)&&t.focus()}}};var ie=F();ie&&(ie.FocusTrap=Object.assign(it,{FocusTrap:it}));var Yt={};ot(Yt,{ShortcutFormatter:()=>O,ShortcutManager:()=>K,default:()=>K});var O=class p{static isApple(){if(typeof navigator>"u")return!1;let t=navigator.userAgentData;if(t&&typeof t.platform=="string"){let s=t.platform.toLowerCase();if(s.includes("mac")||s.includes("ios"))return!0}let e=(navigator.platform||"").toLowerCase();if(e.includes("mac")||e.includes("iphone")||e.includes("ipad")||e.includes("ipod"))return!0;let i=(navigator.userAgent||"").toLowerCase();return i.includes("macintosh")||i.includes("mac os x")||i.includes("ipad")||i.includes("iphone")}static normalizeKeyName(t){if(t===" ")return" ";let e=t.trim().toLowerCase();switch(e){case"esc":return"escape";case"return":return"enter";case"space":case"spacebar":return" ";case"plus":return"+";case"del":return"delete";case"ins":return"insert";case"up":return"arrowup";case"down":return"arrowdown";case"left":return"arrowleft";case"right":return"arrowright";default:return e}}static parseCombo(t,e=p.isApple()){if(typeof t!="string")return[];if(t===" ")return[{ctrl:!1,alt:!1,shift:!1,meta:!1,key:" "}];let i=t.slice(0,512).trim();if(!i)return[];let n=i.replace(/\b(ctrl|control|alt|option|opt|shift|maj|cmd|command|meta|win|super|mod|\$mod)\s*\+\s*/gi,"$1+").split(/\s+/).slice(0,10),r=[];for(let o of n){let a=[];if(o==="+")a.push("+");else{let f="";for(let g=0;g<o.length;g++){let m=o[g];m==="+"?f===""&&a.length>0?a.push("+"):f!==""&&(a.push(f),f=""):f+=m}f!==""&&a.push(f)}let l=!1,u=!1,h=!1,c=!1,d="";for(let f of a){let g=f.trim().toLowerCase();g==="ctrl"||g==="control"?l=!0:g==="alt"||g==="option"||g==="opt"?u=!0:g==="shift"||g==="maj"?h=!0:g==="cmd"||g==="command"||g==="meta"||g==="win"||g==="super"?c=!0:g==="mod"||g==="$mod"?e?c=!0:l=!0:d=p.normalizeKeyName(f)}r.push({ctrl:l,alt:u,shift:h,meta:c,key:d})}return r}static format(t,e=p.isApple()){let i=p.parseCombo(t,e);return i.length===0?t:i.map(n=>{let r=[];if(e){n.ctrl&&r.push("\u2303"),n.alt&&r.push("\u2325"),n.shift&&r.push("\u21E7"),n.meta&&r.push("\u2318");let o=p.formatKeyDisplay(n.key,!0);return r.push(o),r.join("")}else{n.ctrl&&r.push("Ctrl"),n.alt&&r.push("Alt"),n.shift&&r.push("Shift"),n.meta&&r.push("Win");let o=p.formatKeyDisplay(n.key,!1);return r.push(o),r.join("+")}}).join(" ")}static toAriaKeyShortcuts(t,e=p.isApple()){let i=p.parseCombo(t,e);if(i.length!==1)return"";let s=i[0],n=p.formatAriaKey(s.key);if(!n)return"";let r=[];return s.ctrl&&r.push("Control"),s.alt&&r.push("Alt"),s.shift&&r.push("Shift"),s.meta&&r.push("Meta"),r.push(n),r.join("+")}static formatAriaKey(t){if(!t)return"";switch(t.toLowerCase()){case"escape":return"Escape";case"enter":return"Enter";case" ":return"Space";case"tab":return"Tab";case"backspace":return"Backspace";case"delete":return"Delete";case"insert":return"Insert";case"home":return"Home";case"end":return"End";case"pageup":return"PageUp";case"pagedown":return"PageDown";case"arrowup":return"ArrowUp";case"arrowdown":return"ArrowDown";case"arrowleft":return"ArrowLeft";case"arrowright":return"ArrowRight";case"printscreen":return"PrintScreen";case"scrolllock":return"ScrollLock";case"numlock":return"NumLock";case"capslock":return"CapsLock";case"contextmenu":return"ContextMenu";case"+":return"Plus";default:return t.length===1?t.toUpperCase():t.charAt(0).toUpperCase()+t.slice(1)}}static formatKeyDisplay(t,e){if(!t)return"";switch(t.toLowerCase()){case"escape":return e?"\u238B":"Esc";case"enter":return e?"\u21A9":"Enter";case" ":return e?"\u2423":"Space";case"tab":return e?"\u21E5":"Tab";case"backspace":return e?"\u232B":"Backspace";case"delete":return e?"\u2326":"Suppr";case"arrowup":return"\u2191";case"arrowdown":return"\u2193";case"arrowleft":return"\u2190";case"arrowright":return"\u2192";default:return t.length===1?t.toUpperCase():t.charAt(0).toUpperCase()+t.slice(1)}}};var K=class p{options;shortcuts=new Map;scopeStack=[];sequenceBuffer=[];sequenceTimer=null;isListening=!0;boundListener=null;abortController=null;idCounter=0;constructor(t){let e=t?.sequenceTimeout,i=typeof e=="number"&&Number.isFinite(e)&&e>0?Math.min(e,1e4):800;this.options={defaultScope:t?.defaultScope||"global",sequenceTimeout:i,target:t?.target||(typeof window<"u"?window:{}),onError:t?.onError},this.scopeStack=[this.options.defaultScope],this.initListener()}static isEditable(t){if(!t||typeof t.tagName!="string")return!1;let e=t,i=e.tagName.toUpperCase();if(i==="INPUT"){let n=e.type?.toLowerCase()||"text";return!["button","checkbox","radio","submit","reset","range","color","file","image"].includes(n)}if(i==="TEXTAREA"||i==="SELECT"||e.isContentEditable||e.getAttribute("contenteditable")==="true"||e.getAttribute("contenteditable")==="plaintext-only"||e.getAttribute("contenteditable")==="")return!0;let s=e.getAttribute("role");return!!(s==="textbox"||s==="searchbox"||s==="combobox"||s==="spinbutton"||typeof e.closest=="function"&&e.closest('[contenteditable="true"], [contenteditable="plaintext-only"], [contenteditable=""], [role="textbox"], [role="searchbox"], [role="combobox"], [role="spinbutton"]'))}static isPasswordField(t){if(!t||typeof t.tagName!="string")return!1;let e=t;return e.tagName.toUpperCase()==="INPUT"&&(e.type||"").toLowerCase()==="password"}bind(t){let e=Array.isArray(t)?t:[t],i=[];for(let s of e){if(!s.combo||typeof s.handler!="function")continue;let n=`wulf_shortcut_${++this.idCounter}`,r=O.parseCombo(s.combo),o=r.length>1,a=O.format(s.combo),l={...s,id:n,scope:s.scope||"global",category:s.category||"G\xE9n\xE9ral",allowInEditable:s.allowInEditable??!1,preventDefault:s.preventDefault??!0,stopPropagation:s.stopPropagation??!0,priority:s.priority??0,formattedCombo:a,normalizedSteps:r,isSequence:o};this.shortcuts.set(n,l),i.push(n)}return()=>{for(let s of i)this.shortcuts.delete(s)}}unbind(t,e){if(typeof t!="string"||!t.trim())return;let i=O.format(t);for(let[s,n]of this.shortcuts.entries())(n.formattedCombo===i||n.combo.trim().toLowerCase()===t.trim().toLowerCase())&&(!e||n.scope===e)&&this.shortcuts.delete(s)}pushScope(t){if(t&&typeof t=="string"){if(this.scopeStack.length>=64)return;this.scopeStack.push(t),this.clearSequenceBuffer()}}popScope(t){if(this.scopeStack.length<=1)return this.scopeStack[0];if(t){if(this.getScope()===t){let i=this.scopeStack.pop();return this.clearSequenceBuffer(),i}return}let e=this.scopeStack.pop();return this.clearSequenceBuffer(),e}setScope(t){this.scopeStack=[t||this.options.defaultScope],this.clearSequenceBuffer()}getScope(){return this.scopeStack[this.scopeStack.length-1]||this.options.defaultScope}getScopeStack(){return[...this.scopeStack]}pause(){this.isListening=!1,this.clearSequenceBuffer()}resume(){this.isListening=!0}isActive(){return this.isListening}getRegistry(t){let e=[];for(let i of this.shortcuts.values())(!t||i.scope===t||i.scope==="*")&&e.push({...i});return e}attachAria(t,e){if(t&&typeof t.setAttribute=="function"){let i=O.toAriaKeyShortcuts(e);i?t.setAttribute("aria-keyshortcuts",i):typeof t.removeAttribute=="function"&&t.removeAttribute("aria-keyshortcuts")}}static format(t,e){return O.format(t,e)}destroy(){this.pause(),this.removeListener(),this.shortcuts.clear(),this.scopeStack=[],this.clearSequenceBuffer()}initListener(){if(typeof window>"u"||!this.options.target)return;this.abortController=new AbortController,this.boundListener=e=>this.handleKeyDown(e);let t=this.options.target;typeof t.addEventListener=="function"&&t.addEventListener("keydown",this.boundListener,{capture:!1,signal:this.abortController.signal})}removeListener(){if(this.abortController)this.abortController.abort(),this.abortController=null;else if(this.boundListener&&this.options.target){let t=this.options.target;typeof t.removeEventListener=="function"&&t.removeEventListener("keydown",this.boundListener,!1)}this.boundListener=null}handleKeyDown(t){if(!this.isListening||N(t))return;let e=(t.key||"").toLowerCase();if(["control","alt","shift","meta"].includes(e))return;let i=this.getScope(),s=typeof t.composedPath=="function"?t.composedPath():[],n=s.length>0?s[0]:t.target,r=p.isEditable(n)||p.isEditable(t.target),o=p.isPasswordField(n)||p.isPasswordField(t.target),a={ctrl:t.ctrlKey,alt:t.altKey,shift:t.shiftKey,meta:t.metaKey,key:O.normalizeKeyName(t.key||"")},l=t.timeStamp>0?t.timeStamp:typeof performance<"u"?performance.now():Date.now();if(this.sequenceBuffer.length>0){let f=this.sequenceBuffer[this.sequenceBuffer.length-1];l-f.timestamp>this.options.sequenceTimeout&&this.clearSequenceBuffer()}let u=this.getActiveShortcuts(i,r,o),h=[...this.sequenceBuffer.map(f=>f.step),a],c=this.findMatchingSequence(u,h);if(c){this.clearSequenceBuffer(),this.executeShortcut(c,t,i,!0);return}if(this.isPrefixOfAnySequence(u,h)){this.sequenceBuffer.push({step:a,timestamp:l}),this.resetSequenceTimer(),t.key.length===1&&!t.ctrlKey&&!t.altKey&&!t.metaKey&&!r&&t.preventDefault();return}this.clearSequenceBuffer();let d=this.findMatchingChord(u,a,t);d&&this.executeShortcut(d,t,i,!1)}getActiveShortcuts(t,e,i=!1){let s=[];for(let n of this.shortcuts.values())if(!(n.scope!==t&&n.scope!=="*")&&!(e&&!n.allowInEditable)){if(i){if(n.isSequence)continue;let r=n.normalizedSteps[0];if(r&&r.key.length===1){let o=!r.ctrl&&!r.alt&&!r.meta,a=r.ctrl&&r.alt&&!r.meta||r.alt&&!r.ctrl&&!r.meta;if(o||a)continue}}s.push(n)}return s.sort((n,r)=>(r.priority??0)-(n.priority??0))}stepMatches(t,e,i){if(t.ctrl!==e.ctrl||t.alt!==e.alt||t.meta!==e.meta)return!1;let s=typeof i?.key=="string"?i.key:"";if(!(t.key===e.key||s!==""&&t.key===s.toLowerCase()))return!1;if(t.shift===e.shift)return!0;if(!t.shift&&e.shift){let r=t.key.length===1&&!/^[a-z]$/i.test(t.key);if(s!==""&&s===t.key||r&&e.key===t.key)return!0}return!1}findMatchingChord(t,e,i){for(let s of t){if(s.isSequence||s.normalizedSteps.length!==1)continue;let n=s.normalizedSteps[0];if(this.stepMatches(n,e,i))return s}return null}findMatchingSequence(t,e){for(let i of t){if(!i.isSequence||i.normalizedSteps.length!==e.length)continue;let s=!0;for(let n=0;n<e.length;n++)if(!this.stepMatches(i.normalizedSteps[n],e[n])){s=!1;break}if(s)return i}return null}isPrefixOfAnySequence(t,e){for(let i of t){if(!i.isSequence||i.normalizedSteps.length<=e.length)continue;let s=!0;for(let n=0;n<e.length;n++)if(!this.stepMatches(i.normalizedSteps[n],e[n])){s=!1;break}if(s)return!0}return!1}executeShortcut(t,e,i,s){t.preventDefault&&e.preventDefault(),t.stopPropagation&&e.stopPropagation();let n={combo:t.combo,formattedCombo:t.formattedCombo,scope:i,target:e.target,isSequence:s};try{t.handler(e,n)}catch(r){this.options.onError?this.options.onError(r instanceof Error?r:new Error(String(r)),t.combo):console.error(`[Wulf.Shortcut] Erreur lors de l'ex\xE9cution du raccourci "${t.combo}":`,r)}}resetSequenceTimer(){this.sequenceTimer&&clearTimeout(this.sequenceTimer),this.sequenceTimer=setTimeout(()=>{this.clearSequenceBuffer()},this.options.sequenceTimeout)}clearSequenceBuffer(){this.sequenceBuffer=[],this.sequenceTimer&&(clearTimeout(this.sequenceTimer),this.sequenceTimer=null)}};var se=F();se&&(se.Shortcut=Object.assign(K,{ShortcutManager:K,ShortcutFormatter:O}));return le(Ie);})();
5
- if (typeof window !== "undefined") { var __w = window.Wulf; if (!__w || typeof __w !== "object" || (typeof Node !== "undefined" && __w instanceof Node) || (typeof HTMLCollection !== "undefined" && __w instanceof HTMLCollection)) { __w = {}; window.Wulf = __w; } if (typeof __WulfIIFE !== "undefined" && __WulfIIFE) { for (var k in __WulfIIFE) { if (Object.hasOwn(__WulfIIFE, k) && k !== "__proto__" && k !== "constructor" && k !== "prototype" && __w[k] === undefined) { try { Object.defineProperty(__w, k, { value: __WulfIIFE[k], writable: true, configurable: true, enumerable: true }); } catch (_) { try { __w[k] = __WulfIIFE[k]; } catch (__) {} } } } } }
4
+ (${this.getAuditDisableHint()})`),e}checkAriaIdReferences(t,e,i,s=!1){let n=t.getAttribute(e)?.trim();if(!n)return!1;let r=t.ownerDocument||document,o=typeof t.getRootNode=="function"?t.getRootNode():r,a=n.split(/\s+/).filter(Boolean),l=a.map(h=>typeof ShadowRoot<"u"&&o instanceof ShadowRoot?o.getElementById(h):r.getElementById(h));return a.length>0&&l.every(h=>!!h)?s&&!l.some(p=>p?(p.textContent?.trim()||p.getAttribute("aria-label")?.trim()||"").length>0:!1)?(i.push(`Attribut ${e}="${n}" invalide : l'\xE9l\xE9ment cible ne contient aucun texte accessible.`),!1):!0:(i.push(`Attribut ${e}="${n}" invalide : l'\xE9l\xE9ment cible est introuvable dans le DOM.`),!1)}};function si(){if(typeof window>"u")return null;let u=window,t=u.Wulf;if(!t||typeof t!="object"||typeof Node<"u"&&t instanceof Node||typeof HTMLCollection<"u"&&t instanceof HTMLCollection){let e={};return u.Wulf=e,e}return t}function j(u){return typeof CSS<"u"&&typeof CSS.escape=="function"?CSS.escape(u):String(u).replace(/["\\\u0000-\u001F\u007F]/g,"\\$&")}function O(u,t=4096){let e=Math.max(0,t);return String(u??"").slice(0,e).replace(/[\u061C\u200B-\u200F\u202A-\u202E\u2066-\u2069\uFEFF]/g,"")}function H(u){if(typeof document>"u")return null;let t=(u??document).activeElement;for(;t&&t.shadowRoot&&t.shadowRoot.activeElement;)t=t.shadowRoot.activeElement;return t&&typeof t.focus=="function"?t:null}function _(u,t,e=null){let i=u.moveBefore;if(typeof i=="function"&&t.isConnected&&u.isConnected&&typeof u.getRootNode=="function"&&typeof t.getRootNode=="function"&&u.getRootNode()===t.getRootNode())try{i.call(u,t,e);return}catch{}u.insertBefore(t,e)}function N(u){return!!(u.isComposing||u.key==="Process"||u.key==="Enter"&&u.keyCode===229)}function Ft(u,t=300,e=6e4){let i=Number.isFinite(t)&&t>=0?Math.min(t,e):300;if(typeof u=="number")return Number.isFinite(u)&&u>=0?Math.min(u,e):i;if(typeof u=="string"){let s=u.split(","),n=-1;for(let r of s){let o=/^\+?(\d+(?:\.\d+)?|\.\d+)(ms|s)?$/i.exec(r.trim());if(o){let a=parseFloat(o[1]);if(Number.isFinite(a)&&a>=0){let l=o[2]?.toLowerCase()==="s"?a*1e3:a;l>n&&(n=l)}}}if(n>=0)return Math.min(n,e)}return i}function rt(){return typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia("(prefers-reduced-motion: reduce)").matches}function Dt(u,t,e){let i=Number.isFinite(t)?Math.min(t,6e4):300;if(e?.aborted||i<=0||rt())return Promise.resolve();let s=typeof u.getAnimations=="function"?u.getAnimations().filter(n=>{if(n.playState!=="running")return!1;let r=n.effect?.getComputedTiming?.();return r?Number.isFinite(r.endTime):!0}):[];return s.length===0?Promise.resolve():new Promise(n=>{let r=!1,o=null,a=()=>{r||(r=!0,o!==null&&(clearTimeout(o),o=null),e?.removeEventListener("abort",a),n())};e?.addEventListener("abort",a,{once:!0}),o=setTimeout(a,i),Promise.allSettled(s.map(l=>l.finished)).then(a)})}var qt=4096;function G(u,t=qt){return O(u,t).replace(/[\u00A0\u202F\u2007]/g," ").replace(/[\u2013\u2014\u2212]/g,"-").trim()}var zt=new Set(["left","right","center"]);function Z(u,t,e){return t&&typeof t=="object"&&"tagName"in t&&t.tagName==="INPUT"?{wrapper:u||null,input:t,options:e||{}}:{wrapper:null,input:u,options:t&&typeof t=="object"&&!("tagName"in t)?t:{}}}var V=class extends z{wrapper;input;options;ghost=null;isWrapperCreated=!1;wasWrapperFallbackStyled=!1;wasAlignSet=!1;hadInitialDataAlign=!1;isDestroyed=!1;isFocused=!1;isDispatchingNativeInput=!1;lastTrackedValue="";nativeValueDescriptor=null;onCutHandler=()=>{};onFormResetHandler;mutationObserver=null;resizeObserver=null;focusSelectTimerId=null;abortController=new AbortController;constructor(t,e,i){super();let{wrapper:s,input:n,options:r}=Z(t,e,i);if(!n||typeof n!="object"||n.nodeType!==1||n.tagName!=="INPUT")throw new Error(`[${new.target.name||"InputMask"}] input (HTMLInputElement) est requis.`);this.input=n;let o=this.input.getAttribute("data-mask-create-wrapper")==="true",a=!!(r.createWrapper??o),l=s;if(!l&&a){let C=this.input.ownerDocument||(typeof document<"u"?document:null);if(!C)throw new Error("[InputMask] Document DOM introuvable pour createWrapper.");let k=C.createElement("span");k.className="wulf-mask-wrapper wulf-mask-wrapper--auto",this.input.parentNode&&this.input.parentNode.insertBefore(k,this.input),_(k,this.input,null);let K=C.defaultView||(typeof window<"u"?window:null);(!k.isConnected||!K||K.getComputedStyle(k).display!=="inline-grid")&&(k.style.display="inline-grid",k.style.gridTemplateColumns="1fr",k.style.gridTemplateRows="1fr",k.style.verticalAlign="middle",k.style.boxSizing="border-box",k.style.position="relative",this.input.style.gridArea="1 / 1 / 2 / 2",this.input.style.boxSizing="border-box",this.wasWrapperFallbackStyled=!0),l=k,this.isWrapperCreated=!0}if(!l)throw new Error(`[${new.target.name||"InputMask"}] wrapper (HTMLElement) et input (HTMLInputElement) sont requis, ou activez l'option createWrapper: true.`);this.wrapper=l,this.normalizeInputType();let c=this.getAttr("data-mask-focus-only")==="true",h=this.hasAttr("data-disabled"),p=this.getAttr("data-mask-select-on-focus")==="true",d=this.getAttr("data-mask-copy-raw")==="true",f=this.getAttr("data-mask-sensitive")==="true",m=this.getAttr("data-mask-align")||this.getAttr("data-align"),g=m&&zt.has(m)?m:null;this.hadInitialDataAlign=this.wrapper.hasAttribute("data-align");let y=this.getAttr("data-mask-audit"),{disabled:v,align:b,sensitive:w,...S}=r,T=b&&zt.has(b)?b:void 0,A=v!==void 0?v:!!h,x=r.audit??(y!==null?y!=="false":!0),I=!!(w??f),E=this.isPasswordInput()||I;this.options={...S,createWrapper:a,showMaskOnFocus:r.showMaskOnFocus??c??!1,selectAllOnFocus:r.selectAllOnFocus??p??!1,copyRaw:E?!1:r.copyRaw??d??!1,sensitive:I,disabled:A,align:T??(g||void 0),emitNativeInput:r.emitNativeInput??!0,audit:x},this.options.showMaskOnFocus&&this.wrapper.classList.add("mask-focus-only"),this.options.disabled&&this.wrapper.setAttribute("data-disabled","true"),this.options.align&&this.setAlign(this.options.align),this.createGhost(),this.hookValueProperty(),this.bindBaseEvents(),this.initMutationObserver()}getAttr(t){return this.input.getAttribute(t)||this.wrapper.getAttribute(t)}hasAttr(t){return this.wrapper.hasAttribute(t)||this.input.hasAttribute(t)}hasNativePlaceholder(){return!!(this.input.placeholder&&this.input.placeholder.trim().length>0)}shouldHideGhostForPlaceholder(t){return!this.isFocused&&t&&this.hasNativePlaceholder()}bindBaseEvents(){let{signal:t}=this.abortController;this.input.addEventListener("copy",this.onBaseCopy,{signal:t}),this.input.addEventListener("focus",this.onBaseFocus,{signal:t}),this.input.addEventListener("blur",this.onBaseBlur,{signal:t})}onBaseCopy=t=>{if(!this.options.copyRaw||this.options.disabled||this.isSensitiveField())return;let e=this.input.selectionStart??0,i=this.input.selectionEnd??e,s="";e!==i?s=this.extractRawSnippet(this.input.value.slice(e,i)):s=this.getRawValue(),s&&t.clipboardData&&(t.preventDefault(),t.clipboardData.setData("text/plain",s))};extractRawSnippet(t){return t}getClipboardPlainText(t){return t.clipboardData&&(t.clipboardData.getData("text")||t.clipboardData.getData("text/plain"))||""}preparePastedText(t,e=qt){let i=G(t,e);if(typeof this.options.transformPaste!="function")return i;try{let s=this.options.transformPaste(i);if(typeof s=="string")return G(s,e)}catch{}return i}onBaseFocus=()=>{this.isFocused=!0,this.options.selectAllOnFocus&&this.input.value.length>0&&typeof window<"u"&&(this.focusSelectTimerId!==null&&clearTimeout(this.focusSelectTimerId),this.focusSelectTimerId=window.setTimeout(()=>{this.focusSelectTimerId=null,!this.isDestroyed&&H(this.input.ownerDocument)===this.input&&this.input.select()},0))};onBaseBlur=()=>{this.isFocused=!1,this.isSensitiveField()&&(this.lastTrackedValue="",this.clearGhost(),this.wrapper.removeAttribute("data-mask"))};initMutationObserver(){if(typeof MutationObserver>"u")return;this.mutationObserver=new MutationObserver(e=>{for(let i of e)i.type==="attributes"&&i.attributeName&&this.handleAttributeMutation(i.attributeName)});let t={attributes:!0,attributeFilter:["data-mask","data-mask-placeholder","data-mask-focus-only","data-mask-strict","data-mask-select-on-focus","data-mask-copy-raw","data-mask-sensitive","data-mask-pad-decimals","data-mask-auto-lowercase","data-mask-cycle-suggestions","data-mask-default-tld","data-mask-tlds","data-mask-format","data-mask-utc-indicator","data-disabled","data-mask-align","data-align","placeholder","type"]};this.mutationObserver.observe(this.wrapper,t),this.input!==this.wrapper&&this.mutationObserver.observe(this.input,t)}isPasswordInput(){return(this.input.type||"").toLowerCase()==="password"}isSensitiveField(){return this.isPasswordInput()||!!this.options.sensitive}computePasswordDigest(t){let e=2166136261;for(let i=0;i<t.length;i++)e^=t.charCodeAt(i),e=Math.imul(e,16777619);return`__pwd:${(e>>>0).toString(36)}:${t.length}`}setAlign(t){let e=t&&zt.has(t)?t:null,i=e||void 0,s=this.wrapper.getAttribute("data-align"),n=e?this.wrapper.classList.contains(`align-${e}`):!this.wrapper.classList.contains("align-left")&&!this.wrapper.classList.contains("align-right")&&!this.wrapper.classList.contains("align-center");this.options.align===i&&s===e&&n||(this.options.align=i,this.wrapper.classList.remove("align-left","align-right","align-center"),e?(this.wrapper.classList.add(`align-${e}`),this.wasAlignSet=!0,this.wrapper.getAttribute("data-align")!==e&&this.wrapper.setAttribute("data-align",e)):this.wrapper.hasAttribute("data-align")&&this.wrapper.removeAttribute("data-align"),this.syncGhostStyles())}handleAttributeMutation(t){if(t==="data-disabled"){let e=this.hasAttr("data-disabled");e!==!!this.options.disabled&&this.setDisabled(e)}else if(t==="data-mask-focus-only"){let e=this.getAttr("data-mask-focus-only")==="true";e!==!!this.options.showMaskOnFocus&&this.setShowMaskOnFocus(e)}else if(t==="data-mask-select-on-focus")this.options.selectAllOnFocus=this.getAttr("data-mask-select-on-focus")==="true";else if(t==="data-mask-copy-raw")this.options.copyRaw=this.isSensitiveField()?!1:this.getAttr("data-mask-copy-raw")==="true";else if(t==="data-mask-sensitive"){let e=this.getAttr("data-mask-sensitive")==="true";this.options.sensitive=e,this.isSensitiveField()&&(this.options.copyRaw=!1,this.lastTrackedValue="",this.clearGhost(),this.wrapper.removeAttribute("data-mask"),this.onPasswordModeDetected())}else if(t==="type")this.isSensitiveField()&&(this.options.copyRaw=!1,this.lastTrackedValue="",this.clearGhost(),this.wrapper.removeAttribute("data-mask"),this.onPasswordModeDetected());else if(t==="data-mask-align"||t==="data-align"){let e=this.getAttr("data-mask-align")||this.getAttr("data-align"),i=e&&zt.has(e)?e:null;i!==(this.options.align??null)&&this.setAlign(i)}}normalizeInputType(){let t=["number","email","date","datetime-local","month","week","time","color","file","range"];if(this.input.type&&t.includes(this.input.type.toLowerCase())){let e=this.input.type.toLowerCase();this.input.type="text",e==="number"&&(this.input.inputMode="numeric")}}createGhost(){let t=this.wrapper.querySelector(".mask-ghost");t&&t.remove();let e=this.input.ownerDocument||document;this.ghost=e.createElement("div"),this.ghost.className="mask-ghost",this.ghost.setAttribute("aria-hidden","true"),this.ghost.style.display="flex",this.ghost.style.alignItems="center",this.wrapper.appendChild(this.ghost),this.wrapper.classList.add("has-ghost");let i=e.defaultView||(typeof window<"u"?window:null);(!this.wrapper.isConnected||!i||i.getComputedStyle(this.ghost).pointerEvents!=="none")&&(this.ghost.style.gridArea="1 / 1 / 2 / 2",this.ghost.style.pointerEvents="none"),this.syncGhostStyles(),typeof ResizeObserver<"u"&&(this.resizeObserver?.disconnect(),this.resizeObserver=new ResizeObserver(()=>{this.isDestroyed||this.syncGhostStyles()}),this.resizeObserver.observe(this.input));let s=e;s.fonts?.ready&&typeof s.fonts.ready.then=="function"&&s.fonts.ready.then(()=>{this.isDestroyed||this.syncGhostStyles()}).catch(()=>{})}setGhostContent(...t){if(this.ghost){if(typeof this.ghost.replaceChildren=="function")this.ghost.replaceChildren(...t);else{let e=this.ghost.ownerDocument||(typeof document<"u"?document:null);this.ghost.textContent="";for(let i of t)this.ghost.appendChild(typeof i=="string"?e?e.createTextNode(i):new Text(i):i)}this.wrapper.classList.toggle("has-visible-ghost",t.length>0)}}clearGhost(){this.setGhostContent()}syncGhostStyles(){if(!this.ghost||typeof window>"u")return;let t=window.getComputedStyle(this.input);if(!t)return;this.ghost.style.fontFamily=t.fontFamily,this.ghost.style.fontSize=t.fontSize,this.ghost.style.fontWeight=t.fontWeight,this.ghost.style.fontStyle=t.fontStyle,this.ghost.style.letterSpacing=t.letterSpacing,this.ghost.style.wordSpacing=t.wordSpacing,this.ghost.style.textIndent=t.textIndent,this.ghost.style.fontKerning=t.fontKerning,this.ghost.style.fontVariantNumeric=t.fontVariantNumeric,this.ghost.style.lineHeight=t.lineHeight,this.ghost.style.paddingTop=t.paddingTop,this.ghost.style.paddingBottom=t.paddingBottom,this.ghost.style.paddingLeft=t.paddingLeft,this.ghost.style.paddingRight=t.paddingRight,this.ghost.style.borderTopWidth=t.borderTopWidth,this.ghost.style.borderBottomWidth=t.borderBottomWidth,this.ghost.style.borderLeftWidth=t.borderLeftWidth,this.ghost.style.borderRightWidth=t.borderRightWidth,this.ghost.style.borderTopStyle=t.borderTopStyle==="none"?"none":"solid",this.ghost.style.borderBottomStyle=t.borderBottomStyle==="none"?"none":"solid",this.ghost.style.borderLeftStyle=t.borderLeftStyle==="none"?"none":"solid",this.ghost.style.borderRightStyle=t.borderRightStyle==="none"?"none":"solid",this.ghost.style.borderColor="transparent",this.ghost.style.boxSizing=t.boxSizing,this.ghost.style.textAlign=t.textAlign,this.ghost.style.direction=t.direction;let e=t.direction==="rtl"||this.input.getAttribute("dir")==="rtl"||this.wrapper.getAttribute("dir")==="rtl",i=t.textAlign;i==="right"?this.ghost.style.justifyContent="right":i==="left"?this.ghost.style.justifyContent="left":i==="center"?this.ghost.style.justifyContent="center":i==="end"?this.ghost.style.justifyContent=e?"left":"right":this.ghost.style.justifyContent=e?"right":"left"}setNativeValue(t){this.nativeValueDescriptor&&this.nativeValueDescriptor.set?this.nativeValueDescriptor.set.call(this.input,t):this.input.value=t}dispatchNativeInput(){if(!(this.isDestroyed||typeof window>"u")&&this.options.emitNativeInput!==!1){this.isDispatchingNativeInput=!0;try{let t=this.isSensitiveField(),e=this.input._valueTracker;!t&&e&&typeof e.setValue=="function"&&e.setValue(this.lastTrackedValue),this.lastTrackedValue=t?"":this.input.value,this.input.dispatchEvent(new Event("input",{bubbles:!0,cancelable:!1}))}finally{this.isDispatchingNativeInput=!1}}}onScroll=()=>{this.ghost&&(this.ghost.scrollLeft=this.input.scrollLeft)};hookValueProperty(){try{let t=HTMLInputElement.prototype,e=Object.getOwnPropertyDescriptor(t,"value");if(!e||!e.set||!e.get)return;this.nativeValueDescriptor=e;let i=this;Object.defineProperty(this.input,"value",{get(){return e.get.call(this)},set(s){let n=String(s??"");e.set.call(this,n),!i.isDestroyed&&i.onNativeValueSet(n)},configurable:!0})}catch{}}unhookValueProperty(){try{delete this.input.value}catch{}}setShowMaskOnFocus(t){this.options.showMaskOnFocus=t,this.wrapper.classList.toggle("mask-focus-only",t)}disabled(t){if(t===void 0)return!!this.options.disabled;this.setDisabled(t)}setDisabled(t){this.options.disabled=!!t,this.options.disabled?this.wrapper.setAttribute("data-disabled","true"):this.wrapper.removeAttribute("data-disabled"),this.onDisabledChange(this.options.disabled)}getWrapper(){return this.wrapper}getInput(){return this.input}getGhost(){return this.ghost}getElements(){return{wrapper:this.wrapper,input:this.input,ghost:this.ghost}}getValue(){return this.input.value}getRawValue(){return this.input.value}hasAccessibleLabelText(t){if(!t)return!1;if(t.getAttribute("aria-label")?.trim())return!0;let i=s=>{if(s.nodeType===3)return s.textContent||"";if(s.nodeType===1){let n=s,r=n.tagName;if(r==="INPUT"||r==="SELECT"||r==="TEXTAREA"||r==="BUTTON"||n.getAttribute("aria-hidden")==="true")return"";let o="";for(let a=0;a<n.childNodes.length;a++)o+=i(n.childNodes[a]);return o}return""};return i(t).trim().length>0}audit(){let t=[],e=this.input.ownerDocument||document,i=typeof this.input.getRootNode=="function"?this.input.getRootNode():e,s=typeof ShadowRoot<"u"&&i instanceof ShadowRoot?i:e,n=this.input.getAttribute("aria-label")?.trim(),r=this.checkAriaIdReferences(this.input,"aria-labelledby",t,!0),o=this.input.closest("label"),a=this.hasAccessibleLabelText(o),l=!!(this.input.labels&&Array.from(this.input.labels).some(d=>this.hasAccessibleLabelText(d))),c=!1;if(this.input.id)try{let d=s.querySelector(`label[for="${j(this.input.id)}"]`);c=this.hasAccessibleLabelText(d)}catch{c=!1}!n&&!r&&!a&&!l&&!c&&t.push(`\xC9tiquetage accessible manquant : associez un <label for="id"> non vide (ou d\xE9finissez aria-label / aria-labelledby) sur l'input (WCAG 4.1.2).`),this.checkAriaIdReferences(this.input,"aria-describedby",t,!0),this.input.hasAttribute("aria-errormessage")&&this.checkAriaIdReferences(this.input,"aria-errormessage",t,!0);let h=this.input.getAttribute("tabindex");if(h!==null){let d=Number.parseInt(h,10);Number.isFinite(d)&&d>0&&t.push(`Attribut tabindex="${h}" positif d\xE9tect\xE9 : \xE9vitez les tabindex > 0 qui perturbent l'ordre de tabulation naturel (WCAG 2.4.3).`)}let p=this.getSpecificAuditWarnings();return t.push(...p),t}getAuditPrefix(){return`Wulf.Mask.${this.constructor.name||"InputMask"}`}getAuditTargetLabel(){return this.input.id?`#${this.input.id}`:this.input.name?`input[name="${this.input.name}"]`:"<input>"}getAuditDisableHint(){return'Passez { audit: false } ou data-mask-audit="false" pour d\xE9sactiver cet avertissement'}getSpecificAuditWarnings(){return[]}onPasswordModeDetected(){}destroy(){this.isDestroyed||(this.isDestroyed=!0,this.focusSelectTimerId!==null&&(clearTimeout(this.focusSelectTimerId),this.focusSelectTimerId=null),this.mutationObserver&&(this.mutationObserver.disconnect(),this.mutationObserver=null),this.resizeObserver&&(this.resizeObserver.disconnect(),this.resizeObserver=null),this.abortController.abort(),this.lastTrackedValue="",this.unhookValueProperty(),this.ghost&&(this.ghost.remove(),this.ghost=null),this.isWrapperCreated&&this.wrapper?(this.wasWrapperFallbackStyled&&(this.input.style.gridArea="",this.input.style.boxSizing=""),this.wrapper.parentElement?_(this.wrapper.parentElement,this.input,this.wrapper):this.wrapper.parentNode&&this.wrapper.parentNode.insertBefore(this.input,this.wrapper),this.wrapper.remove()):this.wrapper&&(this.wrapper.removeAttribute("data-mask"),this.wrapper.removeAttribute("data-disabled"),this.wasAlignSet&&!this.hadInitialDataAlign&&this.wrapper.removeAttribute("data-align"),this.wasAlignSet&&this.wrapper.classList.remove("align-left","align-right","align-center"),this.wrapper.classList.remove("is-complete","is-focused","mask-focus-only","has-selection","has-ghost","has-visible-ghost")))}};var Ie=new Set(["/","-",".",":"]),ni={9:{pattern:/[0-9]/},a:{pattern:/[a-zA-Z]/},A:{pattern:/[a-zA-Z]/,transform:u=>u.toUpperCase()},"*":{pattern:/[a-zA-Z0-9]/},"#":{pattern:/[a-zA-Z0-9]/,transform:u=>u.toUpperCase()}},J=class u{pattern;patterns=[];patternResolver=null;lastResolvedKey="";subEngines=[];activeEngine=null;placeholderChar;tokens;slots=[];fullMaskTemplate="";prefixSlotsCount=0;prefixString="";strict=!0;autoLowercase=!1;constructor(t,e={}){let i=e||{},s=String(i.placeholderChar||"_");this.placeholderChar=Array.from(s)[0]||"_";let n=Object.create(null);for(let[r,o]of Object.entries(ni))n[r]=o;if(i.tokens&&typeof i.tokens=="object")for(let[r,o]of Object.entries(i.tokens))r!=="__proto__"&&r!=="constructor"&&r!=="prototype"&&o&&(n[r]=o);this.tokens=n,this.strict=i.strict!==!1,this.autoLowercase=i.autoLowercase??!1,this.pattern="",this.compile(t)}static format(t,e,i={}){return!e||Array.isArray(e)&&e.length===0?t??"":new u(e,i||{}).format(t??"")}isDynamicPattern(){return this.patternResolver!==null}resolveForValue(t){if(!this.patternResolver)return!1;let e;try{e=this.patternResolver(String(t??"").slice(0,4096))}catch{return!1}let i,s;if(Array.isArray(e))i=e.slice(0,32).map(n=>String(n??"").slice(0,512)),s="A:"+i.join("\0");else if(typeof e=="string")i=e.slice(0,512),s="S:"+i;else return!1;return s===this.lastResolvedKey?!1:(this.lastResolvedKey=s,this.compileStatic(i),!0)}compile(t){return typeof t=="function"?(this.patternResolver=t,this.lastResolvedKey="",this.resolveForValue(""),this.slots):t!==void 0?(this.patternResolver=null,this.lastResolvedKey="",this.compileStatic(t)):this.patternResolver?(this.lastResolvedKey="",this.resolveForValue(""),this.slots):this.compileStatic(this.patterns.length>0?this.patterns:this.pattern)}compileStatic(t){if(Array.isArray(t)?(this.patterns=t.slice(0,32).map(s=>String(s??"").slice(0,512)),this.pattern=this.patterns[0]||""):(this.patterns=[],this.pattern=String(t??"").slice(0,512)),this.patterns.length>0)return this.subEngines=this.patterns.map(s=>new u(s,{placeholderChar:this.placeholderChar,tokens:this.tokens,strict:this.strict,autoLowercase:this.autoLowercase})),this.activeEngine=this.subEngines[0],this.slots=this.activeEngine.slots,this.fullMaskTemplate=this.activeEngine.fullMaskTemplate,this.prefixSlotsCount=this.activeEngine.prefixSlotsCount,this.prefixString=this.activeEngine.prefixString,this.slots;this.subEngines=[],this.activeEngine=null,this.slots=[];let e="",i=!0;for(let s=0;s<this.pattern.length;s++){let n=this.pattern[s],r=!1;n==="\\"&&s+1<this.pattern.length&&(r=!0,s++,n=this.pattern[s]);let o=!r&&Object.hasOwn(this.tokens,n)?this.tokens[n]:void 0;if(o){i=!1;let a=o.placeholder?Array.from(String(o.placeholder))[0]||this.placeholderChar:this.placeholderChar;this.slots.push({char:n,isStatic:!1,isPrefix:!1,token:o,placeholder:a}),e+=a}else this.slots.push({char:n,isStatic:!0,isPrefix:i,placeholder:n}),e+=n}this.fullMaskTemplate=e,this.prefixSlotsCount=0,this.prefixString="";for(let s of this.slots)if(s.isPrefix)this.prefixSlotsCount++,this.prefixString+=s.char;else break;return this.slots}selectEngine(t){if(this.subEngines.length<=1)return this;let e=String(t??""),i=this.subEngines.filter(a=>{let l=a.getPrefix();return l.length>0&&e.toLowerCase().startsWith(l.trim().toLowerCase())}),s=i.length>0?i:this.subEngines,n=s.toSorted((a,l)=>l.getEditableCount()-a.getEditableCount())[0],o=(n?n.extractRaw(e):e).length;for(let a of s)if(a.getEditableCount()>=o)return this.activeEngine=a,a;return this.activeEngine=s[s.length-1],this.activeEngine}getPrefix(){return this.activeEngine?this.activeEngine.getPrefix():this.prefixString}getPrefixLength(){return this.activeEngine?this.activeEngine.getPrefixLength():this.prefixSlotsCount}getFullMaskTemplate(){return this.activeEngine?this.activeEngine.getFullMaskTemplate():this.fullMaskTemplate}getActiveEditableCount(){return this.subEngines.length>0?(this.activeEngine??this.subEngines[0]).getActiveEditableCount():this.activeEngine?this.activeEngine.getActiveEditableCount():this.slots.filter(t=>!t.isStatic).length}getMaxEditableCount(){return this.subEngines.length>0?Math.max(...this.subEngines.map(t=>t.getMaxEditableCount())):this.getActiveEditableCount()}getEditableCount(){return this.getMaxEditableCount()}isNumericOnly(){if(this.subEngines.length>0)return this.subEngines.every(i=>i.isNumericOnly());let e=(this.activeEngine?this.activeEngine.slots:this.slots).filter(i=>!i.isStatic);return e.length===0?!1:e.every(i=>i.char==="9"||i.token&&i.token.pattern.test("0")&&!i.token.pattern.test("a")&&!i.token.pattern.test("Z"))}setStrict(t){this.strict=t;for(let e of this.subEngines)e.setStrict(t)}setAutoLowercase(t){this.autoLowercase=t;for(let e of this.subEngines)e.setAutoLowercase(t)}isStrict(){return this.strict}normalizePastedValue(t){let e=String(t??"");if(!e)return e;if(this.resolveForValue(e),this.subEngines.length>0){let i=e.toLowerCase(),s=this.subEngines.filter(o=>{let a=o.getPrefix();return a.length>0&&i.startsWith(a.trim().toLowerCase())}),n=s.length>0?s:this.subEngines,r=null;for(let o of n){let a=o.tryNormalizeSegments(e);if(a.matched){if(a.exactSegmentCount)return a.normalized;r===null&&(r=a.normalized)}}return r!==null?r:e}return this.tryNormalizeSegments(e).normalized}tryNormalizeSegments(t){let e={matched:!1,normalized:t,exactSegmentCount:!1};if(!this.strict||this.slots.length===0||!t)return e;let i=t;if(this.prefixSlotsCount>0){let v=0;for(;v<t.length&&(t[v]===" "||t[v]===" ");)v++;let b=0;for(;v<t.length&&b<this.prefixSlotsCount;){let w=this.slots[b].char,S=t[v];if(S.toUpperCase()===w.toUpperCase())v++,b++;else if(w===" "&&S!==" ")b++;else break}b===this.prefixSlotsCount&&(i=t.slice(v))}if(!i)return e;let s=[],n=[],r=[],o="",a=!1;for(let v=this.prefixSlotsCount;v<this.slots.length;v++){let b=this.slots[v];b.isStatic?r.length>0?(s.push(r),r=[],o=b.char):o+=b.char:(o.length>0&&(n.push(o),o=""),r.push(b))}if(r.length>0?s.push(r):o.length>0&&(a=!0),a||s.length<2||n.length!==s.length-1)return e;let l=[];for(let v of n){let b=v.trim();if(b.length!==1||!Ie.has(b))return e;l.push(b)}let c=[],h=[],p=0;for(let v=0;v<i.length;v++){let b=i[v];Ie.has(b)&&(c.push(i.slice(p,v).trim()),h.push(b),p=v+1)}if(c.push(i.slice(p).trim()),h.length===0||h.length>l.length||c.length!==h.length+1||c.length>s.length||c.some(v=>v.length===0))return e;let d=h.every((v,b)=>v===l[b]),f=h.every(v=>v===h[0]);if(!d&&!f)return e;let m=c.length===s.length,g=[];for(let v=0;v<c.length;v++){let b=c[v],w=s[v];if(b.length>w.length)return e;if(w.every(T=>!!(T.token&&T.token.pattern.test("0")&&!T.token.pattern.test("a")&&!T.token.pattern.test("Z")))){let T=v<c.length-1,A=v===c.length-1&&m&&s.length<=3&&w.length===2,x=b.length<w.length&&(T||A),I=x?w.length-b.length:0;for(let E=0;E<b.length;E++){let C=b[E];if(C<"0"||C>"9"||!w[I+E].token.pattern.test(C))return e}g.push(x?"0".repeat(w.length-b.length)+b:b)}else{if(b.length!==w.length)return e;for(let T=0;T<b.length;T++)if(!w[T].token||!w[T].token.pattern.test(b[T]))return e;g.push(b)}}let y=this.prefixSlotsCount>0?this.prefixString:"";for(let v=0;v<g.length;v++)v>0&&(y+=n[v-1]),y+=g[v];return{matched:!0,normalized:y,exactSegmentCount:m}}extractRawForCurrentPattern(t){return this.extractRawInternal(t)}extractRaw(t){return this.resolveForValue(t),this.extractRawInternal(t)}extractRawInternal(t){if(this.subEngines.length>0){let o=this.selectEngine(t);if(o!==this)return o.extractRawInternal(t)}let e=Math.max(4096,this.slots.length*4),i=String(t??"").slice(0,e);if(!i)return"";let s="",n=0,r=0;if(this.prefixSlotsCount>0){for(;n<i.length&&(i[n]===" "||i[n]===" ");)n++;let o=0;for(;n<i.length&&o<this.prefixSlotsCount;){let a=this.slots[o].char,l=i[n];if(l.toUpperCase()===a.toUpperCase())n++,o++;else if(a===" "&&l!==" ")o++;else break}r=this.prefixSlotsCount}for(;n<i.length&&r<this.slots.length;){let o=this.slots[r],a=i[n];if(o.isStatic)a.toUpperCase()===o.char.toUpperCase()&&n++,r++;else if(o.token&&o.token.pattern.test(a)){let l=o.token.transform?o.token.transform(a):a;this.autoLowercase&&!o.token.transform&&(l=l.toLowerCase()),s+=l,n++,r++}else this.strict?n++:(s+=this.autoLowercase?a.toLowerCase():a,n++,r++)}if(!this.strict&&n<i.length){let o=i.slice(n);s+=this.autoLowercase?o.toLowerCase():o}return s}format(t){if(this.resolveForValue(t),this.subEngines.length>0){let o=this.selectEngine(t);if(o!==this)return o.format(t)}let e=Math.max(4096,this.slots.length*4),i=String(t??"").slice(0,e);if(!this.slots.length)return i;let s=this.extractRawInternal(i);if(s.length===0)return this.prefixString;let n="",r=0;for(let o=0;o<this.slots.length;o++){let a=this.slots[o];if(a.isStatic){let l=r<s.length,c=r===0&&!!a.isPrefix,h=r>0&&r===s.length;if(l||c||h)n+=a.char;else break}else if(r<s.length){let l=s[r],c=a.token?.transform?a.token.transform(l):l;this.autoLowercase&&!a.token?.transform&&(c=c.toLowerCase()),n+=c,r++}else break}if(!this.strict&&r<s.length){let o=s.substring(r);n+=this.autoLowercase?o.toLowerCase():o}return n}getRemainingMask(t){return this.activeEngine&&this.activeEngine!==this?this.activeEngine.getRemainingMask(t):this.fullMaskTemplate?t.length>=this.fullMaskTemplate.length?t:t+this.fullMaskTemplate.substring(t.length):""}mapCursorPosition(t,e,i){if(this.activeEngine&&this.activeEngine!==this)return this.activeEngine.mapCursorPosition(t,e,i);let s=this.prefixSlotsCount,n=String(t??""),r=String(i??"");if(e<=0||!r)return s;let a=this.extractRawInternal(n.slice(0,e)).length;if(a===0)return Math.max(s,Math.min(this.getNextEditablePosition(0),r.length));let l=0,c=r.length;for(let h=0;h<r.length&&h<this.slots.length;h++)if(!this.slots[h].isStatic&&(l++,l===a)){c=h+1;break}for(;c<r.length&&this.slots[c]&&this.slots[c].isStatic;)c++;return Math.max(s,Math.min(c,r.length))}isSeparatorAt(t){return this.activeEngine&&this.activeEngine!==this?this.activeEngine.isSeparatorAt(t):t>=0&&t<this.slots.length?this.slots[t].isStatic:!1}getNextEditablePosition(t){if(this.activeEngine&&this.activeEngine!==this)return this.activeEngine.getNextEditablePosition(t);let e=Math.max(0,t);for(let i=e;i<this.slots.length;i++)if(!this.slots[i].isStatic)return i;return this.slots.length}getSlotAt(t){return this.activeEngine&&this.activeEngine!==this?this.activeEngine.getSlotAt(t):this.slots[t]}getSlots(){return this.activeEngine&&this.activeEngine!==this?this.activeEngine.getSlots():this.slots}};var Y=class{stack=[];index=-1;maxDepth;constructor(t=50){this.maxDepth=t}push(t,e){let i=this.getCurrent();if(i&&i.raw===t){i.cursor=e;return}this.stack=this.stack.slice(0,this.index+1),this.stack.push({raw:t,cursor:e}),this.stack.length>this.maxDepth&&this.stack.shift(),this.index=this.stack.length-1}updateCurrentCursor(t){let e=this.getCurrent();e&&(e.cursor=t)}undo(){return this.canUndo()?(this.index--,this.stack[this.index]):null}redo(){return this.canRedo()?(this.index++,this.stack[this.index]):null}canUndo(){return this.index>0}canRedo(){return this.index>=0&&this.index<this.stack.length-1}getCurrent(){return this.index>=0&&this.index<this.stack.length?this.stack[this.index]:null}clear(){this.stack=[],this.index=-1}};var ot=class{delegate;constructor(t){this.delegate=t}handleKeyDown(t){if(N(t))return;let e=this.delegate.getInput(),i=this.delegate.getEngine(),s=this.delegate.getHistory(),n=i.getPrefixLength(),r=e.selectionStart??0,o=e.selectionEnd??r;if((t.ctrlKey||t.metaKey)&&(t.key==="z"||t.key==="Z")&&!t.shiftKey){t.preventDefault(),this.delegate.undo();return}if((t.ctrlKey||t.metaKey)&&(t.key==="y"||t.key==="Y")||(t.ctrlKey||t.metaKey)&&t.shiftKey&&(t.key==="z"||t.key==="Z")){t.preventDefault(),this.delegate.redo();return}s.updateCurrentCursor(r);let a=t.key.length===1&&!t.ctrlKey&&!t.metaKey&&!t.altKey,l=o>r;if(a&&!l){let p=i.getSlots(),d=r<p.length&&p[r].isStatic&&p[r].char===t.key,f=-1;if(r>0&&r-1<p.length)if(p[r-1].isStatic&&p[r-1].char===t.key)f=r-1;else{let y=r-1;for(;y>=n&&p[y].isStatic;){if(p[y].char===t.key){f=y;break}y--}}if(d||f!==-1){t.preventDefault();let y=d?r:f,v=i.getNextEditablePosition(y+1);this.delegate.applyMask(e.value,v,!0);return}let g=-1;for(let y=r;y<p.length;y++)if(p[y].isStatic){p[y].char===t.key&&(g=y);break}if(g!==-1){t.preventDefault();let y=g-1;for(;y>=n&&!p[y].isStatic;)y--;y++;let v=g-y,b=e.value.slice(y,r);if(p.slice(y,g).every(T=>!!(T.token&&T.token.pattern.test("0")&&!T.token.pattern.test("a")&&!T.token.pattern.test("Z")))&&v>b.length&&b.length>0){let T=v-b.length,A="0".repeat(T)+b,x=e.value.slice(g),I=e.value.slice(0,y)+A+x,E=i.getNextEditablePosition(g+1);this.delegate.applyMask(I,E,!0);return}let S=i.getNextEditablePosition(g+1);this.delegate.applyMask(e.value,S,!0);return}}if(a&&i.isStrict()){let p=i.isDynamicPattern(),d=i.extractRaw(e.value),f=o>r?i.extractRawForCurrentPattern(e.value.slice(r,o)):"";if(p){let g=e.value.slice(0,r)+t.key+e.value.slice(o);i.resolveForValue(g)}let m=i.getMaxEditableCount();if(m>0&&m-(d.length-f.length)<=0){p&&i.resolveForValue(e.value),t.preventDefault();return}p&&i.resolveForValue(e.value)}if(o>r){if(t.key==="Backspace"||t.key==="Delete"){t.preventDefault();let p=e.value,d=p.slice(0,r)+p.slice(o);this.delegate.applyMask(d,Math.max(n,r));return}return}if(t.key==="ArrowLeft"&&!t.shiftKey&&r<=n){t.preventDefault(),e.setSelectionRange(n,n);return}if(t.key==="Home"&&n>0&&!t.shiftKey&&!t.ctrlKey&&!t.metaKey&&!t.altKey){t.preventDefault(),e.setSelectionRange(n,n);return}if(t.key==="Backspace"&&r<=n){t.preventDefault(),e.setSelectionRange(n,n);return}if(t.key==="Delete"&&r<n){t.preventDefault(),e.setSelectionRange(n,n);return}if(t.key==="Backspace"&&(t.ctrlKey||t.altKey||t.metaKey)){if(t.preventDefault(),r<=n){e.setSelectionRange(n,n);return}let p=r-1;for(;p>=n&&i.isSeparatorAt(p);)p--;for(;p>=n&&!i.isSeparatorAt(p);)p--;let d=Math.max(n,p+1),f=e.value,m=f.slice(0,d)+f.slice(r);this.delegate.applyMask(m,d);return}if(t.key==="Delete"&&(t.ctrlKey||t.altKey||t.metaKey)){t.preventDefault();let p=e.value;if(r>=p.length)return;let d=r;for(;d<p.length&&i.isSeparatorAt(d);)d++;for(;d<p.length&&!i.isSeparatorAt(d);)d++;for(;d<p.length&&i.isSeparatorAt(d);)d++;let f=d,m=p.slice(0,r)+p.slice(f);this.delegate.applyMask(m,r);return}if(t.key==="Backspace"&&r>n){if(i.isSeparatorAt(r-1)){t.preventDefault();let p=r-1;for(;p>n&&i.isSeparatorAt(p-1);)p--;if(p>n){let d=e.value,f=d.slice(0,p-1)+d.slice(r);this.delegate.applyMask(f,p-1)}else this.delegate.applyMask("",n)}return}if(t.key==="Delete"&&r<e.value.length){if(i.isSeparatorAt(r)){t.preventDefault();let p=r;for(;p<e.value.length&&i.isSeparatorAt(p);)p++;if(p<e.value.length){let d=e.value,f=d.slice(0,p)+d.slice(p+1);this.delegate.applyMask(f,r)}}return}}handleKeyUp(t){let e=this.delegate.getInput(),i=this.delegate.getHistory();(t.key==="ArrowLeft"||t.key==="ArrowRight"||t.key==="Home")&&!t.shiftKey&&this.delegate.enforceMinCursor(),i.updateCurrentCursor(e.selectionStart??0)}};var dt=class extends V{engine;history;keyboard;isComposing=!1;isUndoingRedoing=!1;isMouseDown=!1;isApplyingMask=!1;lastValue="";lastInternalRemainingMask="";isNotifying=!1;hasPendingNotification=!1;onChangeNativeHandler=()=>{};wasInputModeInferred=!1;cutTimerId=null;pasteTimerId=null;resetTimerId=null;lastInputType="";constructor(t,e,i){let s=Z(t,e,i),n=s.wrapper,r=s.input,o=s.options,a=n?.getAttribute("data-mask")||r?.getAttribute("data-mask"),l=o.mask||a||"";typeof l=="string"&&l.includes("|")&&(l=l.split("|").map(w=>w.trim()));let c=o.placeholderChar||n?.getAttribute("data-mask-placeholder")||r?.getAttribute("data-mask-placeholder")||"_",h=n?.hasAttribute("data-disabled")||r?.hasAttribute("data-disabled"),p=n?.getAttribute("data-mask-strict")||r?.getAttribute("data-mask-strict"),d=n?.getAttribute("data-mask-auto-lowercase")==="true"||r?.getAttribute("data-mask-auto-lowercase")==="true",f=n?.getAttribute("data-mask-infer-inputmode")??r?.getAttribute("data-mask-infer-inputmode"),m=o.inferInputMode??(f!==null?f!=="false":!0),{disabled:g,...y}=o,v=g!==void 0?g:h?!0:!l||Array.isArray(l)&&l.length===0,b={...y,mask:l,placeholderChar:c,strict:o.strict??(p!==null?p!=="false":!0),autoLowercase:o.autoLowercase??d??!1,disabled:v,resetHistoryOnMaskChange:o.resetHistoryOnMaskChange??!1,inferInputMode:m,onInput:o.onInput||o.oninput,onChange:o.onChange||o.onchange,onComplete:o.onComplete||o.oncomplete};super(n,r,b),this.history=new Y,this.engine=new J(this.options.mask||"",{placeholderChar:this.options.placeholderChar,tokens:this.options.tokens,strict:this.options.strict,autoLowercase:this.options.autoLowercase}),this.syncInferredInputMode(),this.keyboard=new ot({getInput:()=>this.input,getEngine:()=>this.engine,getHistory:()=>this.history,applyMask:(w,S,T)=>this.applyMask(w,S,T),undo:()=>this.undo(),redo:()=>this.redo(),enforceMinCursor:()=>this.enforceMinCursor()}),this.bindEvents(),this.lastValue=this.isSensitiveField()?this.computePasswordDigest(this.input.value):this.input.value,this.syncInitialValue(),this.runAuditWarning(this.options.audit)}getSpecificAuditWarnings(){let t=[],e=[],i=this.checkAriaIdReferences(this.input,"aria-describedby",e,!0),s=!!this.input.getAttribute("placeholder")?.trim(),n=!!this.input.getAttribute("aria-placeholder")?.trim();return!i&&!n&&!this.options.disabled&&(s?t.push("Indication du format attendu fragile : l'attribut placeholder seul dispara\xEEt \xE0 la saisie et est masqu\xE9 par le gabarit fant\xF4me ; utilisez aria-describedby ou aria-placeholder (WCAG 3.3.2)."):t.push("Indication du format attendu manquante : d\xE9finissez aria-describedby ou aria-placeholder pour informer les technologies d'assistance (WCAG 3.3.2).")),t}extractRawSnippet(t){return this.engine.extractRaw(t)}onPasswordModeDetected(){this.history.clear(),this.lastValue="",this.lastInternalRemainingMask="",this.lastTrackedValue="",this.clearGhost(),this.wrapper.removeAttribute("data-mask")}static format(t,e,i={}){return J.format(t,e,i)}onNativeValueSet(t){if(this.options.disabled)this.checkValueChange();else{let e=this.applyTransformInput(t,"programmatic","");this.applyMask(e,e.length)}}onDisabledChange(t){t?(this.wrapper.removeAttribute("data-mask"),this.wrapper.classList.remove("is-complete","has-selection"),this.clearGhost(),this.checkValueChange()):this.applyMask(this.input.value,this.input.selectionStart??this.input.value.length),this.syncInferredInputMode()}bindEvents(){this.handleInput=this.handleInput.bind(this),this.onKeyDown=this.onKeyDown.bind(this),this.onPaste=this.onPaste.bind(this),this.onFocus=this.onFocus.bind(this),this.onBlur=this.onBlur.bind(this),this.onClick=this.onClick.bind(this),this.onKeyUp=this.onKeyUp.bind(this),this.onSelect=this.onSelect.bind(this),this.onMouseDown=this.onMouseDown.bind(this),this.onMouseUp=this.onMouseUp.bind(this),this.onCompositionStart=this.onCompositionStart.bind(this),this.onCompositionEnd=this.onCompositionEnd.bind(this),this.onScroll=this.onScroll.bind(this),this.onBeforeInput=this.onBeforeInput.bind(this),this.onCutHandler=()=>{this.cutTimerId!==null&&clearTimeout(this.cutTimerId),this.cutTimerId=window.setTimeout(()=>{if(this.cutTimerId=null,!this.isDestroyed)if(this.options.disabled)this.checkValueChange();else{let e=this.input.selectionStart??this.input.value.length;this.applyMask(this.input.value,e)}},0)},this.onChangeNativeHandler=()=>{this.isDestroyed||this.checkValueChange()};let{signal:t}=this.abortController;this.input.addEventListener("beforeinput",this.onBeforeInput,{signal:t}),this.input.addEventListener("input",this.handleInput,{signal:t}),this.input.addEventListener("keydown",this.onKeyDown,{signal:t}),this.input.addEventListener("paste",this.onPaste,{signal:t}),this.input.addEventListener("focus",this.onFocus,{signal:t}),this.input.addEventListener("blur",this.onBlur,{signal:t}),this.input.addEventListener("click",this.onClick,{signal:t}),this.input.addEventListener("keyup",this.onKeyUp,{signal:t}),this.input.addEventListener("select",this.onSelect,{signal:t}),this.input.addEventListener("mousedown",this.onMouseDown,{signal:t}),window.addEventListener("mouseup",this.onMouseUp,{signal:t}),this.input.addEventListener("compositionstart",this.onCompositionStart,{signal:t}),this.input.addEventListener("compositionend",this.onCompositionEnd,{signal:t}),this.input.addEventListener("scroll",this.onScroll,{passive:!0,signal:t}),this.input.addEventListener("cut",this.onCutHandler,{signal:t}),this.input.addEventListener("change",this.onChangeNativeHandler,{signal:t}),this.input.form&&(this.onFormResetHandler=()=>{this.resetTimerId!==null&&clearTimeout(this.resetTimerId),this.resetTimerId=window.setTimeout(()=>{this.resetTimerId=null,!this.isDestroyed&&(this.options.disabled?this.checkValueChange():this.syncInitialValue())},0)},this.input.form.addEventListener("reset",this.onFormResetHandler,{signal:t}))}syncInferredInputMode(){if(!this.options.inferInputMode)return;!this.options.disabled&&this.engine.isNumericOnly()?this.input.hasAttribute("inputmode")||(this.input.inputMode="numeric",this.wasInputModeInferred=!0):this.wasInputModeInferred&&this.input.getAttribute("inputmode")==="numeric"&&(this.input.removeAttribute("inputmode"),this.wasInputModeInferred=!1)}destroy(){this.isDestroyed||(this.cutTimerId!==null&&(clearTimeout(this.cutTimerId),this.cutTimerId=null),this.pasteTimerId!==null&&(clearTimeout(this.pasteTimerId),this.pasteTimerId=null),this.resetTimerId!==null&&(clearTimeout(this.resetTimerId),this.resetTimerId=null),this.wasInputModeInferred&&this.input.getAttribute("inputmode")==="numeric"&&this.input.removeAttribute("inputmode"),this.history.clear(),this.lastValue="",this.lastInternalRemainingMask="",super.destroy())}setStrict(t){this.options.strict=t,this.engine.setStrict(t),this.options.disabled||this.applyMask(this.input.value,this.input.selectionStart??this.input.value.length)}isStrict(){return this.engine.isStrict()}setMask(t,e){let i=typeof e=="boolean"?e:e&&typeof e=="object"&&e.strict!==void 0?e.strict:this.options.strict,s=e&&typeof e=="object"&&e.resetHistory!==void 0?e.resetHistory:!!this.options.resetHistoryOnMaskChange;if(!((!t||Array.isArray(t)&&t.length===0)&&this.options.disabled&&(!this.options.mask||this.options.mask===""))){if(!t||Array.isArray(t)&&t.length===0){this.options.mask="",this.options.strict=i,this.engine.setStrict(i??!0),this.engine.compile(""),s&&this.history.clear(),this.setDisabled(!0),this.syncInferredInputMode();return}this.options.mask=t,this.options.strict=i,this.engine.setStrict(i??!0),this.engine.compile(t),s&&this.history.clear(),this.setDisabled(!1),this.syncInferredInputMode()}}handleAttributeMutation(t){if(super.handleAttributeMutation(t),t==="data-mask"){let e=this.getAttr("data-mask");if(e===null&&(this.isSensitiveField()||typeof this.options.mask=="function")||e===this.lastInternalRemainingMask)return;let i=typeof this.options.mask=="function"?"":Array.isArray(this.options.mask)?this.options.mask.join("|"):this.options.mask||"";if(e===i)return;if(e){let s=e.includes("|")?e.split("|").map(n=>n.trim()):e;this.setMask(s)}else this.setMask(null)}else if(t==="data-mask-strict"){let e=this.getAttr("data-mask-strict");this.setStrict(e!=="false")}else t==="data-mask-auto-lowercase"?(this.options.autoLowercase=this.getAttr("data-mask-auto-lowercase")==="true",this.engine.setAutoLowercase(this.options.autoLowercase),this.engine.compile(this.options.mask||""),this.applyMask(this.input.value,this.input.selectionStart??this.input.value.length)):t==="placeholder"&&this.updateGhost(this.input.value)}applyTransformInput(t,e,i){if(typeof this.options.transformInput!="function")return t;try{let s=this.options.transformInput(t,{source:e,inputType:i});if(typeof s=="string")return e==="paste"?G(s,4096):O(s,4096)}catch{}return t}setValue(t){let e=t!=null?String(t):"";if(this.options.disabled){this.input.value=e,this.checkValueChange();return}let i=this.applyTransformInput(e,"programmatic","");this.applyMask(i,i.length)}getRawValue(){return this.engine.extractRaw(this.input.value)}isComplete(){if(this.options.disabled)return!0;let t=this.getRawValue(),e=this.engine.getActiveEditableCount();return e===0?!0:t.length>=e}get onInput(){return this.options.onInput}set onInput(t){this.options.onInput=t}undo(){if(this.options.disabled)return;let t=this.history.undo();t&&(this.isUndoingRedoing=!0,this.applyMask(t.raw,t.cursor),this.isUndoingRedoing=!1)}redo(){if(this.options.disabled)return;let t=this.history.redo();t&&(this.isUndoingRedoing=!0,this.applyMask(t.raw,t.cursor),this.isUndoingRedoing=!1)}checkSelection(){if(this.options.disabled)return;let t=this.input.selectionStart??0,e=this.input.selectionEnd??t,i=t!==e;this.wrapper.classList.toggle("has-selection",i)}onBeforeInput(t){if(this.lastInputType=t.inputType||"",!this.options.disabled&&!this.isComposing&&this.engine.isStrict()&&!(t.inputType==="insertFromPaste"||t.inputType==="insertReplacementText")&&t.inputType&&t.inputType.startsWith("insert")){let e=this.input.value,i=this.engine.isDynamicPattern(),s=this.engine.extractRaw(e),n=this.input.selectionStart??0,r=this.input.selectionEnd??n,o=r>n?this.engine.extractRawForCurrentPattern(e.slice(n,r)):"";if(i){let l=e.slice(0,n)+(t.data??"")+e.slice(r);this.engine.resolveForValue(l)}let a=this.engine.getMaxEditableCount();if(a>0&&Math.max(0,a-(s.length-o.length))<=0){i&&this.engine.resolveForValue(e),t.preventDefault();return}i&&this.engine.resolveForValue(e)}}handleInput(t){if(this.isDispatchingNativeInput||this.isComposing)return;let e=t?.inputType||this.lastInputType||"";this.lastInputType="";let i=!!(this.options.onInput||this.options.oninput),s=this.isSensitiveField()?this.computePasswordDigest(this.input.value):this.input.value;if(i&&s!==this.lastValue&&this.checkValueChange(),this.options.disabled){this.checkValueChange();return}let n=this.input.value,r=this.input.selectionStart??n.length,o=this.applyTransformInput(n,"input",e),a=o!==n?r>=n.length?o.length:Math.min(r,o.length):r,l=this.history.getCurrent(),c=this.engine.extractRaw(o),h=this.engine.getMaxEditableCount();if(h>0&&this.engine.isStrict()&&l&&l.raw.length>=h&&c.length>h){this.applyMask(l.raw,l.cursor);return}this.applyMask(o,a),this.checkSelection()}onKeyDown(t){this.options.disabled||this.keyboard.handleKeyDown(t)}onMouseDown(){this.isMouseDown=!0}onMouseUp(){this.isMouseDown=!1,this.checkSelection()}onPaste(t){if(this.options.disabled){this.pasteTimerId!==null&&clearTimeout(this.pasteTimerId),this.pasteTimerId=window.setTimeout(()=>{this.pasteTimerId=null,this.isDestroyed||this.checkValueChange()},0);return}t.preventDefault(),this.history.updateCurrentCursor(this.input.selectionStart??0);let e=this.preparePastedText(this.getClipboardPlainText(t),4096),i=this.applyTransformInput(e,"paste","insertFromPaste");if(!i)return;let s=this.engine.getPrefixLength(),n=this.input.selectionStart??0,r=this.input.selectionEnd??n,o=this.input.value,a=this.getRawValue(),l=this.engine.getMaxEditableCount(),c=this.engine.getPrefix(),h=c.replace(/[\s.-]+/g,"").toUpperCase(),p=i.replace(/[\s.-]+/g,"").toUpperCase(),d=h.length>0&&p.startsWith(h),f=o.slice(0,Math.max(s,n)).replace(/[\s.-]+/g,"").toUpperCase(),m=f.length>=2&&p.startsWith(f),g=Math.max(s,n),y=Math.max(s,r);(d||m)&&(g=0,y=o.length);let v=Math.max(0,l-a.length);if(g!==y){let x=this.engine.extractRawForCurrentPattern(o.slice(g,y));v=Math.max(0,l-(a.length-x.length))}let b=this.engine.normalizePastedValue(i),w=this.engine.getActiveEditableCount(),S=w>0&&a.length>=w;if(this.engine.isStrict()&&(v<=0||n===r&&S)){let x=this.engine.extractRaw(b).length,I=this.engine.getMaxEditableCount();if(n===r&&I>0&&x===I&&(v<=0||x>v))g=0,y=o.length;else if(v<=0){this.engine.resolveForValue(o);return}else this.engine.resolveForValue(o)}let T,A;g===0&&y===o.length?(T=b,A=b.length):a.length===0&&g===s&&y===o.length?s>0&&b.toUpperCase().startsWith(c.toUpperCase())?(T=b,A=b.length):(T=o.slice(0,g)+b,A=T.length):(T=o.slice(0,g)+i+o.slice(y),A=g+i.length),this.applyMask(T,A),this.checkSelection()}onFocus(){this.syncGhostStyles(),this.wrapper.classList.add("is-focused"),!this.options.disabled&&!this.isMouseDown&&this.enforceMinCursor(),this.updateGhost(this.input.value),this.checkSelection()}onBlur(){if(this.wrapper.classList.remove("is-focused","has-selection"),this.isSensitiveField()){this.history.clear(),this.lastValue="",this.lastInternalRemainingMask="",this.lastTrackedValue="",this.clearGhost(),this.wrapper.removeAttribute("data-mask");return}this.updateGhost(this.input.value)}onClick(){this.options.disabled||this.enforceMinCursor(),this.history.updateCurrentCursor(this.input.selectionStart??0),this.checkSelection()}onKeyUp(t){this.options.disabled||this.keyboard.handleKeyUp(t),this.checkSelection()}onSelect(){this.history.updateCurrentCursor(this.input.selectionStart??0),this.checkSelection()}onCompositionStart(){this.isComposing=!0}onCompositionEnd(){if(this.isComposing=!1,this.options.disabled)return;let t=this.input.selectionStart??this.input.value.length;this.applyMask(this.input.value,t),this.checkSelection()}enforceMinCursor(){let t=this.engine.getPrefixLength();if(t<=0)return;let e=this.input.selectionStart??0,i=this.input.selectionEnd??e;e===i&&e<t&&this.input.setSelectionRange(t,t)}updateGhost(t){if(!this.ghost)return;if(this.options.disabled||this.isSensitiveField()){this.clearGhost();return}let e=!t||t===this.engine.getPrefix();if(this.shouldHideGhostForPlaceholder(e)){this.clearGhost();return}let i=this.engine.getFullMaskTemplate(),s=i.length>t.length?i.substring(t.length):"",n=this.input.ownerDocument||document,r=n.createElement("span");r.className="mask-ghost-typed",r.textContent=t;let o=n.createElement("span");o.className="mask-ghost-remaining",o.textContent=s,this.setGhostContent(r,o),this.ghost.scrollLeft=this.input.scrollLeft}applyMask(t,e,i=!1){if(this.options.disabled||this.isApplyingMask)return;this.isApplyingMask=!0;let s="",n=!1;try{s=this.engine.format(t),this.engine.isDynamicPattern()&&this.syncInferredInputMode();let r=this.engine.getRemainingMask(s),o=this.isSensitiveField();this.setNativeValue(s),o?(this.lastInternalRemainingMask="",this.wrapper.removeAttribute("data-mask"),this.clearGhost()):(this.lastInternalRemainingMask=r,this.wrapper.setAttribute("data-mask",r),this.updateGhost(s));let a=this.engine.getPrefixLength(),l;if(i||this.isUndoingRedoing)l=Math.max(a,Math.min(e,s.length));else{let c=this.engine.mapCursorPosition(t,e,s);l=Math.max(a,c)}this.input.setSelectionRange(l,l),n=this.isComplete(),this.wrapper.classList.toggle("is-complete",n),o?(this.options.copyRaw=!1,this.history.clear()):this.isUndoingRedoing||this.history.push(this.getRawValue(),l)}finally{this.isApplyingMask=!1}this.checkValueChange()}syncInitialValue(){let t=this.isSensitiveField();if(this.options.disabled){this.wrapper.removeAttribute("data-mask"),this.clearGhost(),this.lastValue=t?this.computePasswordDigest(this.input.value):this.input.value,this.checkValueChange();return}this.syncGhostStyles();let e=this.input.value||"";if(e){let i=this.applyTransformInput(e,"programmatic","");this.applyMask(i,i.length)}else{let i=this.engine.getPrefixLength();if(i>0)this.applyMask("",i);else{if(t)this.lastInternalRemainingMask="",this.wrapper.removeAttribute("data-mask"),this.clearGhost();else{this.history.push("",0);let s=this.engine.getFullMaskTemplate();this.lastInternalRemainingMask=s,this.wrapper.setAttribute("data-mask",s),this.updateGhost("")}this.checkValueChange()}}}checkValueChange(t=!1){let e=this.isSensitiveField(),i=this.input.value;if(!((e?this.computePasswordDigest(i):i)===this.lastValue&&!t&&!this.hasPendingNotification)){if(this.isNotifying){this.hasPendingNotification=!0;return}this.isNotifying=!0;try{let n=0,r=10;for(;((this.isSensitiveField()?this.computePasswordDigest(this.input.value):this.input.value)!==this.lastValue||this.hasPendingNotification||t)&&n<r;){n++,this.hasPendingNotification=!1,t=!1;let o=this.isSensitiveField(),a=this.input.value;this.lastValue=o?this.computePasswordDigest(a):a;let l=this.options.disabled?a:this.getRawValue(),c=this.options.disabled?0:this.engine.getActiveEditableCount(),h=this.isComplete(),p={value:a,rawValue:l,isComplete:h,totalSlots:c,filledSlots:this.options.disabled?a.length:l.length},d=!o,f=this.options.onInput||this.options.oninput;f&&f(a,p),this.input.dispatchEvent(new CustomEvent("mask:input",{bubbles:d,detail:p})),this.dispatchNativeInput();let m=this.options.onChange||this.options.onchange;m&&m(p),this.input.dispatchEvent(new CustomEvent("mask:change",{bubbles:d,detail:p}));let g=this.options.onComplete||this.options.oncomplete;h&&(g&&g(p),this.input.dispatchEvent(new CustomEvent("mask:complete",{bubbles:d,detail:p})))}}finally{this.isNotifying=!1}}}};var Q=class u{options;constructor(t={}){let e=t.currency??"";!e&&t.unit&&(e=t.unit);let i=e==="$"||e==="\xA3"||e==="\xA5"?"prefix":"suffix",s=t.decimals!==void 0?Number(t.decimals):2,n=Number.isFinite(s)?Math.min(20,Math.max(0,Math.floor(s))):2;this.options={currency:String(e).slice(0,32),unit:String(t.unit??e).slice(0,32),currencyPosition:t.currencyPosition??i,decimals:n,decimalSeparator:String(t.decimalSeparator??",").slice(0,4)||",",thousandSeparator:String(t.thousandSeparator??"\xA0").slice(0,4),allowNegative:t.allowNegative??!1,min:t.min??-1/0,max:t.max??1/0}}normalizePastedValue(t){let e=G(t,512);if(!e)return"";let i=0,s=0,n=-1,r=-1;for(let o=0;o<e.length;o++){let a=e[o];a===","?(i++,n=o):a==="."&&(s++,r=o)}if(i>0&&s>0){let o=n>r?",":".";if((o===","?i:s)!==1)return e;let l=o===","?".":",";return e.split(l).join("").replace(o,this.options.decimalSeparator)}return i>=2&&s===0?e.split(",").join(""):s>=2&&i===0?e.split(".").join(""):e}parse(t){let e=String(t??"").slice(0,512).trim(),i=!1;this.options.allowNegative&&e.includes("-")&&(i=!0),this.options.currency&&(e=e.replace(new RegExp(this.escapeRegExp(this.options.currency),"g"),"")),this.options.thousandSeparator&&(e=e.replace(new RegExp(this.escapeRegExp(this.options.thousandSeparator),"g"),"")),e=e.replace(/[\s\u00A0]/g,"");let s=this.options.decimalSeparator,n=e.indexOf(s);n===-1&&(n=e.search(/[,.]/));let r="",o=null,a=!1;return n!==-1?(r=e.substring(0,n).replace(/\D/g,""),this.options.decimals>0&&(a=!0,o=e.substring(n+1).replace(/\D/g,"").slice(0,this.options.decimals))):r=e.replace(/\D/g,""),r.length>1&&(r=r.replace(/^0+/,"")||"0"),{isNegative:i,integerPart:r,decimalPart:o,hasDecimal:a}}format(t,e=t.length,i=!1){let s=String(t??"").slice(0,512),n=Math.max(0,Math.min(e,s.length));if(!s||s.trim()===""||s===this.options.currency.trim())return{formatted:"",rawNumber:null,rawValue:"",cursor:0,isValid:!0};let r=s.substring(0,n),o=r.replace(/\D/g,"").length,a=this.options.decimals>0&&/[,.]/.test(r),{isNegative:l,integerPart:c,decimalPart:h,hasDecimal:p}=this.parse(s),d=h,f=p;if(i&&this.options.decimals>0&&(c||h!==null)&&(f=!0,d===null?d="0".repeat(this.options.decimals):d.length<this.options.decimals&&(d=d+"0".repeat(this.options.decimals-d.length))),l&&!c&&!d&&!f&&this.options.allowNegative){let C="-",k=1;return this.options.currency&&(this.options.currencyPosition==="prefix"?(C=`${this.options.currency} -`,k=C.length):(C=`- ${this.options.currency}`,k=1)),{formatted:C,rawNumber:null,rawValue:"-",cursor:k,isValid:!0}}if(!c&&!d&&!f)return{formatted:"",rawNumber:null,rawValue:"",cursor:0,isValid:!0};let g=this.formatThousands(c||"0");f&&this.options.decimals>0&&(g+=this.options.decimalSeparator+(d??"")),l&&g!=="0"&&(g="-"+g);let y=g;this.options.currency&&(this.options.currencyPosition==="prefix"?y=`${this.options.currency} ${g}`:y=`${g} ${this.options.currency}`);let v=(l?"-":"")+(c||"0")+(h?"."+h:""),b=parseFloat(v);isNaN(b)&&(b=0);let w=b>=this.options.min&&b<=this.options.max,S=0;this.options.currency&&this.options.currencyPosition==="prefix"&&(S=this.options.currency.length+1);let T=0,A=!1,x=S;for(let C=S;C<y.length;C++){let k=y[C];if(k===this.options.currency.trim()[0]&&this.options.currencyPosition==="suffix")break;if(/\d/.test(k)?(T++,x=C+1):k===this.options.decimalSeparator&&(A=!0,x=C+1),a){if(A&&T>=o){S=C+1;break}}else if(T>=o){S=C+1;break}}o>0&&T<o&&x>S&&(S=x);let I=this.options.currency&&this.options.currencyPosition==="prefix"?this.options.currency.length+1:0,E=this.options.currency&&this.options.currencyPosition==="suffix"?Math.max(0,y.length-this.options.currency.length-1):y.length;return S=Math.max(I,Math.min(S,Math.max(I,E))),{formatted:y,rawNumber:b,rawValue:v,cursor:S,isValid:w}}static format(t,e={}){let i=new u(e),s=typeof t=="number"?t.toString():t;return i.format(s).formatted}formatThousands(t){let e=this.options.thousandSeparator;if(!e||t.length<=3)return t;let i=[],s=t.length;for(;s>0;){let n=Math.max(0,s-3);i.push(t.slice(n,s)),s=n}return i.reverse().join(e)}escapeRegExp(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}};var ri=10,yt=class extends V{engine;history;isUndoingRedoing=!1;isApplying=!1;isComposing=!1;isNotifying=!1;hasPendingNotification=!1;lastValue="";wasInputModeInferred=!1;cutTimerId=null;resetTimerId=null;cursorTimerId=null;constructor(t,e,i){let s=Z(t,e,i),n=s.wrapper,r=s.input,o=s.options,a=n?.getAttribute("data-mask-pad-decimals")==="true"||r?.getAttribute("data-mask-pad-decimals")==="true",l=r?.getAttribute("data-mask-align")||r?.getAttribute("data-align")||n?.getAttribute("data-mask-align")||n?.getAttribute("data-align"),c={align:o.align??l??"right",padDecimalsOnBlur:o.padDecimalsOnBlur??a??!1,...o};super(n,r,c),this.input.hasAttribute("inputmode")||(this.input.inputMode="decimal",this.wasInputModeInferred=!0),this.history=new Y,this.engine=new Q(this.options),this.bindEvents(),this.input.value?this.options.disabled||this.applyAmount(this.input.value,this.input.value.length):this.updateGhost({formatted:"",rawNumber:null,rawValue:"",cursor:0,isValid:!0}),this.runAuditWarning(this.options.audit)}extractRawSnippet(t){let e=this.engine.parse(t);return!e.integerPart&&!e.decimalPart?"":(e.isNegative?"-":"")+(e.integerPart||"0")+(e.decimalPart?"."+e.decimalPart:"")}onPasswordModeDetected(){this.history.clear(),this.lastValue="",this.lastTrackedValue="",this.clearGhost()}static format(t,e={}){return Q.format(t,e)}onNativeValueSet(t){if(this.options.disabled||this.isComposing){this.lastValue=this.isSensitiveField()?this.computePasswordDigest(t):t;return}this.applyAmount(t,t.length)}onDisabledChange(t){t?this.clearGhost():this.applyAmount(this.input.value,this.input.selectionStart??this.input.value.length)}bindEvents(){this.handleInput=this.handleInput.bind(this),this.handleKeyDown=this.handleKeyDown.bind(this),this.handlePaste=this.handlePaste.bind(this),this.handleBlur=this.handleBlur.bind(this),this.handleFocus=this.handleFocus.bind(this),this.handleClick=this.handleClick.bind(this),this.onCompositionStart=this.onCompositionStart.bind(this),this.onCompositionEnd=this.onCompositionEnd.bind(this),this.onCutHandler=()=>{this.cutTimerId!==null&&clearTimeout(this.cutTimerId),this.cutTimerId=window.setTimeout(()=>{if(this.cutTimerId=null,this.isDestroyed||this.options.disabled)return;let e=this.input.selectionStart??this.input.value.length;this.applyAmount(this.input.value,e)},0)};let{signal:t}=this.abortController;this.input.addEventListener("input",this.handleInput,{signal:t}),this.input.addEventListener("keydown",this.handleKeyDown,{signal:t}),this.input.addEventListener("paste",this.handlePaste,{signal:t}),this.input.addEventListener("blur",this.handleBlur,{signal:t}),this.input.addEventListener("focus",this.handleFocus,{signal:t}),this.input.addEventListener("click",this.handleClick,{signal:t}),this.input.addEventListener("scroll",this.onScroll,{passive:!0,signal:t}),this.input.addEventListener("cut",this.onCutHandler,{signal:t}),this.input.addEventListener("compositionstart",this.onCompositionStart,{signal:t}),this.input.addEventListener("compositionend",this.onCompositionEnd,{signal:t}),this.input.form&&(this.onFormResetHandler=()=>{this.resetTimerId!==null&&clearTimeout(this.resetTimerId),this.resetTimerId=window.setTimeout(()=>{this.resetTimerId=null,!this.isDestroyed&&(this.options.disabled||this.applyAmount(this.input.value,this.input.value.length))},0)},this.input.form.addEventListener("reset",this.onFormResetHandler,{signal:t}))}onCompositionStart(){this.isComposing=!0}onCompositionEnd(){if(this.isComposing=!1,this.options.disabled)return;let t=this.input.selectionStart??this.input.value.length;this.applyAmount(this.input.value,t)}applyAmount(t,e){if(this.isApplying||this.options.disabled)return;this.isApplying=!0;let i=null;try{i=this.engine.format(t,e),this.setNativeValue(i.formatted),this.input.setSelectionRange(i.cursor,i.cursor),this.isSensitiveField()?(this.options.copyRaw=!1,this.history.clear(),this.clearGhost()):(this.isUndoingRedoing||this.history.push(i.rawValue,i.cursor),this.updateGhost(i))}finally{this.isApplying=!1}i&&this.checkValueChange(i)}updateGhost(t){if(this.ghost){if(this.options.disabled||this.isSensitiveField()){this.clearGhost();return}if(!t.formatted){if(this.shouldHideGhostForPlaceholder(!0)){this.clearGhost();return}let e=this.options.currency?this.options.currencyPosition==="prefix"?`${this.options.currency} 0`:`0 ${this.options.currency}`:"0,00",s=(this.input.ownerDocument||document).createElement("span");s.className="mask-ghost-remaining",s.textContent=e,this.setGhostContent(s);return}this.clearGhost(),this.ghost.scrollLeft=this.input.scrollLeft}}handleInput(){if(this.isDispatchingNativeInput||this.options.disabled||this.isComposing)return;let t=this.input.value,e=this.input.selectionStart??t.length;this.applyAmount(t,e)}handlePaste(t){if(this.options.disabled)return;t.preventDefault(),this.history.updateCurrentCursor(this.input.selectionStart??0);let e=this.preparePastedText(this.getClipboardPlainText(t),512);if(!e)return;let i=this.engine.normalizePastedValue(e),s=this.input.selectionStart??this.input.value.length,n=this.input.selectionEnd??s,r=this.input.value.slice(0,s)+i+this.input.value.slice(n);this.applyAmount(r,s+i.length)}handleKeyDown(t){if(!(this.options.disabled||N(t))){if((t.ctrlKey||t.metaKey)&&(t.key==="z"||t.key==="Z")){t.preventDefault(),t.shiftKey?this.redo():this.undo();return}if((t.ctrlKey||t.metaKey)&&(t.key==="y"||t.key==="Y")){t.preventDefault(),this.redo();return}if(t.key==="Backspace"){let e=this.input.selectionStart??0,i=this.input.selectionEnd??0;if(e===i&&e>0){let s=this.input.value,n=s[e-1];if(n===this.engine.options.thousandSeparator||n===" "){t.preventDefault();let r=Math.max(0,e-2),o=s.slice(0,r)+s.slice(e);this.applyAmount(o,r);return}if(this.options.currency&&this.options.currencyPosition==="prefix"&&e<=this.options.currency.length+1){t.preventDefault();return}}}if(t.key==="Delete"){let e=this.input.selectionStart??0,i=this.input.selectionEnd??0;if(e===i&&e<this.input.value.length){let s=this.input.value,n=s[e];if(n===this.engine.options.thousandSeparator||n===" "){t.preventDefault();let r=s.slice(0,e)+s.slice(e+2);this.applyAmount(r,e);return}if(this.options.currency&&this.options.currencyPosition==="suffix"){let r=s.length-this.options.currency.length-1;if(e>=r){t.preventDefault();return}}}}(t.key==="ArrowLeft"||t.key==="ArrowRight"||t.key==="Home"||t.key==="End")&&(this.cursorTimerId!==null&&clearTimeout(this.cursorTimerId),this.cursorTimerId=window.setTimeout(()=>{this.cursorTimerId=null,this.enforceCursorBounds()},0))}}enforceCursorBounds(){if(this.isDestroyed||!this.isFocused||H(this.input.ownerDocument)!==this.input||!this.input.value||this.options.disabled)return;let t=this.input.selectionStart??0,e=this.input.selectionEnd??0;if(t!==e)return;let i=this.input.value,s=this.options.currency;if(s){if(this.options.currencyPosition==="prefix"){let n=s.length+1;t<n&&this.input.setSelectionRange(n,n)}else if(this.options.currencyPosition==="suffix"){let n=Math.max(0,i.length-s.length-1);t>n&&this.input.setSelectionRange(n,n)}}}handleClick(){this.enforceCursorBounds()}handleFocus(){this.wrapper.classList.add("is-focused"),this.syncGhostStyles(),this.enforceCursorBounds(),this.updateGhost(this.engine.format(this.input.value))}handleBlur(){if(this.wrapper.classList.remove("is-focused"),this.isSensitiveField()){this.history.clear(),this.lastValue="",this.lastTrackedValue="",this.clearGhost();return}if(this.options.padDecimalsOnBlur&&!this.options.disabled&&this.input.value.trim().length>0){let e=this.engine.format(this.input.value,this.input.value.length,!0);e.formatted!==this.input.value&&(this.setNativeValue(e.formatted),this.lastValue=e.formatted)}this.updateGhost(this.engine.format(this.input.value));let t=this.getDetail();this.options.onChange&&this.options.onChange(t),this.input.dispatchEvent(new CustomEvent("mask:change",{bubbles:!this.isSensitiveField(),detail:t}))}handleAttributeMutation(t){super.handleAttributeMutation(t),t==="data-mask-pad-decimals"?this.options.padDecimalsOnBlur=this.getAttr("data-mask-pad-decimals")==="true":t==="placeholder"&&this.updateGhost(this.engine.format(this.input.value))}checkValueChange(t){if(!((this.isSensitiveField()?this.computePasswordDigest(this.input.value):this.input.value)===this.lastValue&&!this.hasPendingNotification)){if(this.isNotifying){this.hasPendingNotification=!0;return}this.isNotifying=!0;try{let s=0,n=t;for(;((this.isSensitiveField()?this.computePasswordDigest(this.input.value):this.input.value)!==this.lastValue||this.hasPendingNotification)&&s<ri;){s++,this.hasPendingNotification=!1;let r=this.isSensitiveField(),o=this.input.value;this.lastValue=r?this.computePasswordDigest(o):o;let a=n??this.engine.format(o);n=void 0,this.notifyChange(a)}}finally{this.isNotifying=!1}}}notifyChange(t){let e={value:t.formatted,number:t.rawNumber,rawValue:t.rawValue,isValid:t.isValid};this.options.onInput&&this.options.onInput(e),this.input.dispatchEvent(new CustomEvent("mask:input",{bubbles:!this.isSensitiveField(),detail:e})),this.dispatchNativeInput()}undo(){let t=this.history.undo();if(t){this.isUndoingRedoing=!0;try{this.applyAmount(t.raw,t.cursor)}finally{this.isUndoingRedoing=!1}}}redo(){let t=this.history.redo();if(t){this.isUndoingRedoing=!0;try{this.applyAmount(t.raw,t.cursor)}finally{this.isUndoingRedoing=!1}}}getDetail(){let t=this.engine.format(this.input.value);return{value:t.formatted,number:t.rawNumber,rawValue:t.rawValue,isValid:t.isValid}}getNumber(){return this.getDetail().number}getRawValue(){return this.getDetail().rawValue}isValid(){return this.getDetail().isValid}getSpecificAuditWarnings(){let t=[],e=(this.options.currency||this.options.unit||"").trim();if(!e||this.options.disabled)return t;let i=[],s=this.checkAriaIdReferences(this.input,"aria-describedby",i,!0),n=!!this.input.getAttribute("aria-placeholder")?.trim();if(s||n)return t;let r=this.input.ownerDocument||document,o=typeof this.input.getRootNode=="function"?this.input.getRootNode():r,a=typeof ShadowRoot<"u"&&o instanceof ShadowRoot?o:r,l=this.input.getAttribute("aria-label")||"",c=this.input.getAttribute("aria-labelledby")?.trim();if(c)for(let m of c.split(/\s+/).filter(Boolean)){let g=typeof ShadowRoot<"u"&&o instanceof ShadowRoot?o.getElementById(m):r.getElementById(m);g?.textContent&&(l+=" "+g.textContent)}let h=this.input.closest("label");if(h?.textContent&&(l+=" "+h.textContent),this.input.id)try{let m=a.querySelector(`label[for="${j(this.input.id)}"]`);m?.textContent&&(l+=" "+m.textContent)}catch{}let p=l.toLowerCase(),d=e.toLowerCase();return p.includes(d)||d==="\u20AC"&&(p.includes("euro")||p.includes("eur"))||d==="$"&&(p.includes("dollar")||p.includes("usd"))||d==="\xA3"&&(p.includes("livre")||p.includes("pound")||p.includes("gbp"))||t.push(`Devise/unit\xE9 "${e}" non expos\xE9e aux technologies d'assistance quand le champ est vide (le fant\xF4me est aria-hidden="true") : mentionnez-la dans le <label>, aria-label ou aria-describedby (WCAG 3.3.2).`),t}setValue(t){let e=t!=null?String(t):"";this.options.disabled?(this.setNativeValue(e),this.lastValue=this.isSensitiveField()?this.computePasswordDigest(e):e):this.applyAmount(e,e.length)}destroy(){this.isDestroyed||(this.cutTimerId!==null&&(clearTimeout(this.cutTimerId),this.cutTimerId=null),this.resetTimerId!==null&&(clearTimeout(this.resetTimerId),this.resetTimerId=null),this.cursorTimerId!==null&&(clearTimeout(this.cursorTimerId),this.cursorTimerId=null),this.wasInputModeInferred&&this.input.getAttribute("inputmode")==="decimal"&&this.input.removeAttribute("inputmode"),this.lastValue="",this.history.clear(),super.destroy())}};var at=class u{domains;tlds;suggestOnAt;defaultDomain=null;defaultTld="__";static DEFAULT_DOMAINS=["gmail.com","outlook.com","orange.fr","free.fr","sfr.fr","yahoo.com","hotmail.com","icloud.com","laposte.net","proton.me"];static DEFAULT_TLDS=["com","fr","net","org","eu","io","co","info","biz","me","tv","fi","be","ch","ca","uk","de","es","it"];constructor(t={}){let e=Array.isArray(t.domains)?t.domains.slice(0,500).map(i=>String(i??"").trim().slice(0,253)).filter(Boolean):[];this.domains=e.length>0?e:u.DEFAULT_DOMAINS,this.tlds=t.tlds&&t.tlds.length>0?t.tlds.slice(0,200).map(i=>String(i).trim().replace(/^\./,"").slice(0,32)).filter(Boolean):[...u.DEFAULT_TLDS],this.suggestOnAt=t.suggestOnAt??!0,this.setDefaultDomain(t.defaultDomain??null),this.setDefaultTld(t.defaultTld!==void 0?t.defaultTld:"__")}setDefaultDomain(t){t===!0?this.defaultDomain=this.domains.length>0?this.domains[0]:null:typeof t=="string"&&t.trim().length>0?this.defaultDomain=t.trim().replace(/^@/,"").slice(0,253)||null:this.defaultDomain=null}setDefaultTld(t){t===!0?this.defaultTld=this.tlds.length>0?this.tlds[0]:null:typeof t=="string"&&t.trim().length>0?this.defaultTld=t.trim().replace(/^\./,"").slice(0,32)||null:this.defaultTld=null}setTlds(t){this.tlds=t&&t.length>0?t.slice(0,200).map(e=>String(e).trim().replace(/^\./,"").slice(0,32)).filter(Boolean):[...u.DEFAULT_TLDS]}getMatchingTlds(t){let e=(t??"").toLowerCase();return e.length===0?[...this.tlds]:this.tlds.filter(i=>i.toLowerCase().startsWith(e)&&i.toLowerCase()!==e)}getMatchingDomains(t){let e=String(t??"").slice(0,512);if(!e.includes("@"))return this.defaultDomain?[this.defaultDomain]:[];let i=e.indexOf("@");if(e.indexOf("@",i+1)!==-1)return[];let s=e.substring(i+1);if(s.length===0)return this.suggestOnAt?[...this.domains]:[];let n=s.toLowerCase();return this.domains.filter(r=>r.toLowerCase().startsWith(n)&&r.toLowerCase()!==n)}getSuggestion(t,e=0){let i=String(t??"").slice(0,512);if(!i.includes("@"))return this.defaultDomain?{full:i?`${i}@${this.defaultDomain}`:`@${this.defaultDomain}`,remaining:`@${this.defaultDomain}`,matchedDomain:this.defaultDomain,isHintOnly:!1}:{full:i,remaining:"",matchedDomain:null,isHintOnly:!1};let s=i.indexOf("@"),n=i.substring(0,s),r=i.substring(s+1);if(i.indexOf("@",s+1)!==-1)return{full:i,remaining:"",matchedDomain:null,isHintOnly:!1};let o=this.getMatchingDomains(t);if(o.length>0){let f=(e%o.length+o.length)%o.length,m=o[f],g=r.toLowerCase(),y=m.substring(g.length);return{full:`${n}@${m}`,remaining:y,matchedDomain:m,isHintOnly:!1}}if(r.length===0||r.startsWith("."))return{full:i,remaining:"",matchedDomain:null,isHintOnly:!1};let a=r.toLowerCase();if(this.domains.some(f=>f.toLowerCase()===a))return{full:i,remaining:"",matchedDomain:r,isHintOnly:!1};let l=r.lastIndexOf(".");if(l===-1){if(!this.defaultTld)return{full:i,remaining:"",matchedDomain:null,isHintOnly:!1};let f=this.defaultTld.includes("_"),m=`.${this.defaultTld}`,g=`${r}.${this.defaultTld}`;return{full:f?i:`${n}@${g}`,remaining:m,matchedDomain:f?null:g,isHintOnly:f}}let c=r.substring(0,l),h=r.substring(l+1);if(!c||c.endsWith("."))return{full:i,remaining:"",matchedDomain:null,isHintOnly:!1};if(h.length===0){if(this.defaultTld&&!this.defaultTld.includes("_")){let f=`${c}.${this.defaultTld}`;return{full:`${n}@${f}`,remaining:this.defaultTld,matchedDomain:f,isHintOnly:!1}}return this.defaultTld&&this.defaultTld.includes("_")?{full:i,remaining:this.defaultTld,matchedDomain:null,isHintOnly:!0}:{full:i,remaining:"",matchedDomain:null,isHintOnly:!1}}let p=h.toLowerCase();if(this.tlds.some(f=>f.toLowerCase()===p))return{full:i,remaining:"",matchedDomain:r,isHintOnly:!1};let d=this.getMatchingTlds(h);if(d.length>0){let f=(e%d.length+d.length)%d.length,m=d[f],g=m.substring(p.length),y=`${c}.${m}`;return{full:`${n}@${y}`,remaining:g,matchedDomain:y,isHintOnly:!1}}if(this.defaultTld&&this.defaultTld.includes("_")&&h.length<this.defaultTld.length){let f=this.defaultTld.substring(h.length);if(f.includes("_"))return{full:i,remaining:f,matchedDomain:null,isHintOnly:!0}}return{full:i,remaining:"",matchedDomain:null,isHintOnly:!1}}};var oi=10,wt=class extends V{engine;currentSuggestion={full:"",remaining:"",matchedDomain:null};currentSuggestionIndex=0;hadInitialAriaAutocomplete=!1;wasAriaAutocompleteSet=!1;isSuggestionDismissed=!1;isNotifying=!1;hasPendingNotification=!1;wasAutocorrectSet=!1;wasAutocapitalizeSet=!1;wasSpellcheckSet=!1;wasInputModeInferred=!1;isComposing=!1;lastNotifiedValue="";srStatusEl=null;srAnnounceTimerId=null;lastAnnouncedSuggestion="";cutTimerId=null;resetTimerId=null;constructor(t,e,i){let s=Z(t,e,i),n=s.wrapper,r=s.input,o=s.options,a=n?.getAttribute("data-mask-cycle-suggestions")==="true"||r?.getAttribute("data-mask-cycle-suggestions")==="true",l=n?.getAttribute("data-mask-auto-lowercase")==="true"||r?.getAttribute("data-mask-auto-lowercase")==="true",c=n?.getAttribute("data-mask-aria-autocomplete")??r?.getAttribute("data-mask-aria-autocomplete"),h=o.setAriaAutocomplete??(c!==null?c!=="false":!0),p=n?.getAttribute("data-mask-tlds")??r?.getAttribute("data-mask-tlds"),d=o.tlds??(p?p.split(",").map(y=>y.trim()).filter(Boolean):void 0),f=n?.getAttribute("data-mask-default-tld")??r?.getAttribute("data-mask-default-tld"),m=o.defaultTld!==void 0?o.defaultTld:f!==null?f==="false"||f==="none"?null:f==="true"?!0:f:void 0,g={completeOnTab:!0,completeOnArrowRight:!0,completeOnEnter:!0,cycleSuggestions:o.cycleSuggestions??a??!1,autoLowercase:o.autoLowercase??l??!1,setAriaAutocomplete:h,...o,...d!==void 0?{tlds:d}:{},...m!==void 0?{defaultTld:m}:{}};super(n,r,g),this.input.hasAttribute("inputmode")||(this.input.inputMode="email",this.wasInputModeInferred=!0),this.input.hasAttribute("autocorrect")||(this.input.setAttribute("autocorrect","off"),this.wasAutocorrectSet=!0),this.input.hasAttribute("autocapitalize")||(this.input.setAttribute("autocapitalize","none"),this.wasAutocapitalizeSet=!0),this.input.hasAttribute("spellcheck")||(this.input.setAttribute("spellcheck","false"),this.wasSpellcheckSet=!0),this.hadInitialAriaAutocomplete=this.input.hasAttribute("aria-autocomplete"),this.syncAriaAutocomplete(),this.engine=new at(this.options),this.lastNotifiedValue=this.isSensitiveField()?"":this.input.value,this.bindEvents(),!this.options.disabled&&!this.isSensitiveField()&&this.updateSuggestion(),this.runAuditWarning(this.options.audit)}syncAriaAutocomplete(){let t=!!(this.options.setAriaAutocomplete&&!this.options.disabled&&!this.isSensitiveField()&&!this.isDestroyed);this.hadInitialAriaAutocomplete||(t?this.input.hasAttribute("aria-autocomplete")||(this.input.setAttribute("aria-autocomplete","inline"),this.wasAriaAutocompleteSet=!0):this.wasAriaAutocompleteSet&&(this.input.getAttribute("aria-autocomplete")==="inline"&&this.input.removeAttribute("aria-autocomplete"),this.wasAriaAutocompleteSet=!1));let e=this.input.ownerDocument||(typeof document<"u"?document:null),i=!!(e&&typeof e.ariaNotify=="function");t&&!i?this.ensureSrStatusEl():!t&&this.srStatusEl&&(this.srStatusEl.remove(),this.srStatusEl=null)}onPasswordModeDetected(){this.srAnnounceTimerId!==null&&(clearTimeout(this.srAnnounceTimerId),this.srAnnounceTimerId=null),this.lastNotifiedValue="",this.lastTrackedValue="",this.lastAnnouncedSuggestion="",this.currentSuggestion={full:"",remaining:"",matchedDomain:null},this.syncAriaAutocomplete(),this.clearGhost()}onNativeValueSet(t){this.options.disabled||this.isComposing||this.isSensitiveField()||(this.isSuggestionDismissed=!1,this.updateSuggestion())}onDisabledChange(t){this.syncAriaAutocomplete(),t||this.isSensitiveField()?(this.currentSuggestion={full:"",remaining:"",matchedDomain:null},this.clearGhost()):(this.isSuggestionDismissed=!1,this.updateSuggestion())}bindEvents(){this.handleInput=this.handleInput.bind(this),this.handleKeyDown=this.handleKeyDown.bind(this),this.handlePaste=this.handlePaste.bind(this),this.handleBlur=this.handleBlur.bind(this),this.handleFocus=this.handleFocus.bind(this),this.onCutHandler=()=>{this.cutTimerId!==null&&clearTimeout(this.cutTimerId),this.cutTimerId=window.setTimeout(()=>{this.cutTimerId=null,!(this.isDestroyed||this.options.disabled||this.isSensitiveField())&&this.updateSuggestion()},0)};let{signal:t}=this.abortController;this.input.addEventListener("input",this.handleInput,{signal:t}),this.input.addEventListener("keydown",this.handleKeyDown,{signal:t}),this.input.addEventListener("paste",this.handlePaste,{signal:t}),this.input.addEventListener("blur",this.handleBlur,{signal:t}),this.input.addEventListener("focus",this.handleFocus,{signal:t}),this.input.addEventListener("scroll",this.onScroll,{passive:!0,signal:t}),this.input.addEventListener("cut",this.onCutHandler,{signal:t}),this.input.addEventListener("compositionstart",()=>{this.isComposing=!0},{signal:t}),this.input.addEventListener("compositionend",()=>{this.isComposing=!1,!this.isDestroyed&&!this.options.disabled&&!this.isSensitiveField()&&this.handleInput()},{signal:t}),this.input.form&&(this.onFormResetHandler=()=>{this.resetTimerId!==null&&clearTimeout(this.resetTimerId),this.resetTimerId=window.setTimeout(()=>{this.resetTimerId=null,!(this.isDestroyed||this.options.disabled||this.isSensitiveField())&&this.updateSuggestion()},0)},this.input.form.addEventListener("reset",this.onFormResetHandler,{signal:t}))}ensureSrStatusEl(){if(this.srStatusEl&&this.wrapper.contains(this.srStatusEl))return this.srStatusEl;let t=this.input.ownerDocument||(typeof document<"u"?document:null);if(!t)return null;let e=t.createElement("span");return e.className="wulf-mask-sr-status",e.setAttribute("aria-live","polite"),e.setAttribute("aria-atomic","true"),this.wrapper.appendChild(e),this.srStatusEl=e,e}scheduleSuggestionAnnouncement(t=!1){if(this.srAnnounceTimerId!==null&&(clearTimeout(this.srAnnounceTimerId),this.srAnnounceTimerId=null),!this.options.setAriaAutocomplete||!this.isFocused||this.isDestroyed||this.isSensitiveField())return;let e=this.currentSuggestion;if(!e.remaining||e.isHintOnly){this.lastAnnouncedSuggestion="",this.srStatusEl&&(this.srStatusEl.textContent="");return}let i=e.full;if(i===this.lastAnnouncedSuggestion&&!t)return;let s=()=>{if(this.srAnnounceTimerId=null,this.isDestroyed||!this.isFocused||this.isSensitiveField())return;this.lastAnnouncedSuggestion=i;let r=this.input.ownerDocument||(typeof document<"u"?document:null);if(r&&typeof r.ariaNotify=="function")try{r.ariaNotify(i,{priority:"normal"});return}catch{}let o=this.ensureSrStatusEl();o&&(o.textContent=o.textContent===i?`${i}\xA0`:i)};t?s():this.srAnnounceTimerId=window.setTimeout(s,250)}updateSuggestion(t){if(this.options.disabled||this.isSensitiveField()){this.currentSuggestion={full:"",remaining:"",matchedDomain:null},this.clearGhost();return}let e=this.input.value;if(this.currentSuggestion=this.isSuggestionDismissed?{full:e,remaining:"",matchedDomain:null}:this.engine.getSuggestion(e,this.currentSuggestionIndex),!!this.ghost){if(this.shouldHideGhostForPlaceholder(e.length===0))this.clearGhost();else if(this.currentSuggestion.remaining){let i=this.input.ownerDocument||document,s=i.createElement("span");s.className="mask-ghost-typed",s.textContent=e;let n=i.createElement("span");n.className="mask-ghost-remaining",n.textContent=this.currentSuggestion.remaining,this.setGhostContent(s,n)}else this.clearGhost();this.ghost.scrollLeft=this.input.scrollLeft,t?.announce&&this.scheduleSuggestionAnnouncement(!!t.immediate),this.notifyValueChange()}}notifyValueChange(){if(this.isNotifying){this.hasPendingNotification=!0;return}this.isNotifying=!0;try{let t=0;do{t++,this.hasPendingNotification=!1;let e=this.isSensitiveField(),i=!e,s=this.input.value,n=this.getDetail();this.options.onInput&&this.options.onInput(n),this.input.dispatchEvent(new CustomEvent("mask:input",{bubbles:i,detail:n})),s!==this.lastNotifiedValue&&(this.lastNotifiedValue=e?"":s,this.dispatchNativeInput())}while(this.hasPendingNotification&&t<oi)}finally{this.isNotifying=!1}}handleInput(t){if(!this.isDispatchingNativeInput&&!(this.options.disabled||this.isSensitiveField())&&!(this.isComposing||t&&"isComposing"in t&&t.isComposing)){if(this.options.autoLowercase){let e=this.input.selectionStart??0,i=this.input.selectionEnd??e,s=this.input.value.toLowerCase();s!==this.input.value&&(this.setNativeValue(s),this.input.setSelectionRange(e,i))}this.isSuggestionDismissed=!1,this.currentSuggestionIndex=0,this.updateSuggestion({announce:!0,immediate:!1})}}handlePaste(t){if(this.options.disabled||this.isSensitiveField())return;let e=this.getClipboardPlainText(t),i=this.preparePastedText(e,512);if(i===e)return;t.preventDefault();let s=this.input.selectionStart??this.input.value.length,n=this.input.selectionEnd??s,r=this.input.value.slice(0,s),o=this.input.value.slice(n),a=r+i+o,l=this.options.autoLowercase?a.toLowerCase():a;if(typeof document<"u"&&H(this.input.ownerDocument)===this.input&&typeof document.execCommand=="function")try{if(document.execCommand("insertText",!1,i)&&this.input.value===l)return}catch{}this.setNativeValue(a);let c=s+i.length;this.input.setSelectionRange(c,c),this.handleInput()}handleKeyDown(t){if(this.options.disabled||this.isSensitiveField()||N(t)||t.shiftKey||t.ctrlKey||t.altKey||t.metaKey)return;let e=!!this.currentSuggestion.remaining&&!this.currentSuggestion.isHintOnly,s=(this.input.selectionStart??0)===this.input.value.length,n=this.input.value.length>0;if(t.key==="Escape"&&e){t.preventDefault(),this.isSuggestionDismissed=!0,this.currentSuggestion={full:this.input.value,remaining:"",matchedDomain:null},this.srAnnounceTimerId!==null&&(clearTimeout(this.srAnnounceTimerId),this.srAnnounceTimerId=null),this.lastAnnouncedSuggestion="",this.srStatusEl&&(this.srStatusEl.textContent=""),this.clearGhost();return}if(this.options.cycleSuggestions&&e&&n&&s){if(t.key==="ArrowDown"){t.preventDefault(),this.currentSuggestionIndex++,this.updateSuggestion({announce:!0,immediate:!0});return}if(t.key==="ArrowUp"){t.preventDefault(),this.currentSuggestionIndex--,this.updateSuggestion({announce:!0,immediate:!0});return}}if(t.key==="Tab"&&e&&n&&this.options.completeOnTab){t.preventDefault(),this.acceptSuggestion();return}if(t.key==="Enter"&&e&&n&&this.options.completeOnEnter){t.preventDefault(),this.acceptSuggestion();return}if(t.key==="ArrowRight"&&e&&n&&s&&this.options.completeOnArrowRight){t.preventDefault(),this.acceptSuggestion();return}}acceptSuggestion(){if(!this.currentSuggestion.remaining||this.currentSuggestion.isHintOnly||this.options.disabled||this.isSensitiveField()||this.input.value.length===0)return!1;let t=this.currentSuggestion.full;this.setNativeValue(t),this.input.setSelectionRange(t.length,t.length),this.currentSuggestionIndex=0,this.updateSuggestion();let e=this.getDetail();this.options.onChange&&this.options.onChange(e);let i=!this.isSensitiveField();return this.input.dispatchEvent(new CustomEvent("mask:change",{bubbles:i,detail:e})),this.input.dispatchEvent(new CustomEvent("mask:complete",{bubbles:i,detail:e})),!0}setDefaultDomain(t){this.engine.setDefaultDomain(t),this.updateSuggestion()}setDefaultTld(t){this.engine.setDefaultTld(t),this.updateSuggestion()}setTlds(t){this.engine.setTlds(t),this.currentSuggestionIndex=0,this.updateSuggestion()}handleFocus(){this.wrapper.classList.add("is-focused"),this.isSuggestionDismissed=!1,this.syncGhostStyles(),this.updateSuggestion()}handleBlur(){if(this.wrapper.classList.remove("is-focused"),this.srAnnounceTimerId!==null&&(clearTimeout(this.srAnnounceTimerId),this.srAnnounceTimerId=null),this.lastAnnouncedSuggestion="",this.srStatusEl&&(this.srStatusEl.textContent=""),this.isSensitiveField()){this.lastNotifiedValue="",this.lastTrackedValue="",this.clearGhost();return}this.updateSuggestion();let t=this.getDetail();this.options.onChange&&this.options.onChange(t),this.input.dispatchEvent(new CustomEvent("mask:change",{bubbles:!this.isSensitiveField(),detail:t}))}handleAttributeMutation(t){if(super.handleAttributeMutation(t),t==="data-mask-cycle-suggestions")this.options.cycleSuggestions=this.getAttr("data-mask-cycle-suggestions")==="true";else if(t==="data-mask-auto-lowercase")this.options.autoLowercase=this.getAttr("data-mask-auto-lowercase")==="true";else if(t==="data-mask-default-tld"){let e=this.getAttr("data-mask-default-tld");this.setDefaultTld(e===null||e==="false"||e==="none"?null:e==="true"?!0:e)}else if(t==="data-mask-tlds"){let e=this.getAttr("data-mask-tlds");this.setTlds(e?e.split(",").map(i=>i.trim()).filter(Boolean):null)}else t==="placeholder"&&this.updateSuggestion()}getDetail(){return{value:this.input.value,suggestedValue:this.currentSuggestion.isHintOnly?"":this.currentSuggestion.full,domain:this.currentSuggestion.matchedDomain}}setValue(t){let e=t!=null?String(t):"";this.isSuggestionDismissed=!1,this.setNativeValue(e),this.updateSuggestion()}destroy(){this.isDestroyed||(this.cutTimerId!==null&&(clearTimeout(this.cutTimerId),this.cutTimerId=null),this.resetTimerId!==null&&(clearTimeout(this.resetTimerId),this.resetTimerId=null),this.srAnnounceTimerId!==null&&(clearTimeout(this.srAnnounceTimerId),this.srAnnounceTimerId=null),this.srStatusEl&&(this.srStatusEl.remove(),this.srStatusEl=null),this.lastNotifiedValue="",this.lastAnnouncedSuggestion="",this.wasInputModeInferred&&this.input.getAttribute("inputmode")==="email"&&this.input.removeAttribute("inputmode"),this.wasAriaAutocompleteSet&&this.input.getAttribute("aria-autocomplete")==="inline"&&this.input.removeAttribute("aria-autocomplete"),this.wasAutocorrectSet&&this.input.getAttribute("autocorrect")==="off"&&this.input.removeAttribute("autocorrect"),this.wasAutocapitalizeSet&&this.input.getAttribute("autocapitalize")==="none"&&this.input.removeAttribute("autocapitalize"),this.wasSpellcheckSet&&this.input.getAttribute("spellcheck")==="false"&&this.input.removeAttribute("spellcheck"),super.destroy())}};var St={iso:{format:"YYYY-MM-DD HH:mm:ss"},"iso-t":{format:"YYYY-MM-DD\\THH:mm:ss"},fr:{format:"DD/MM/YYYY HH:mm",placeholderTokens:{DD:"jj",MM:"mm",YYYY:"aaaa",HH:"hh",mm:"mm"}},"fr-sec":{format:"DD/MM/YYYY HH:mm:ss",placeholderTokens:{DD:"jj",MM:"mm",YYYY:"aaaa",HH:"hh",mm:"mm",ss:"ss"}},us:{format:"MM/DD/YYYY HH:mm"},"us-12h":{format:"MM/DD/YYYY hh:mm A"},uk:{format:"DD/MM/YYYY HH:mm"},no:{format:"DD/MM-YYYY HH:mm"},cz:{format:"DD. MM. YYYY HH:mm"},de:{format:"DD.MM.YYYY HH:mm"},jp:{format:"YYYY/MM/DD HH:mm"}},Bt={YYYY:"YYYY",MM:"MM",DD:"DD",HH:"HH",hh:"hh",mm:"mm",ss:"ss",A:"AM"},ai=[{token:"YYYY",length:4},{token:"MM",length:2},{token:"DD",length:2},{token:"HH",length:2},{token:"hh",length:2},{token:"mm",length:2},{token:"ss",length:2},{token:"A",length:2}],li=128,Tt=512,ui=new Set(["/","-",".",":"," ","T","t"]),ke=new Set(["HH","hh","mm","ss","A"]);function P(u){return u>="0"&&u<="9"}function F(u){let t=0;for(let e=0;e<u.length;e++){let i=u.charCodeAt(e);if(i<48||i>57)return NaN;t=t*10+(i-48)}return u.length>0?t:NaN}function ci(u,t,e){let i=Array.from(u||e),s=Array.from(e);for(;i.length<t;)i.push(s[i.length]||s[s.length-1]||"_");return i.slice(0,t).join("")}var tt=class u{formatSpec="YYYY-MM-DD HH:mm";customPlaceholders={};slots=[];segments=[];fullTemplate="";prefixSlotsCount=0;prefixString="";editableCount=0;hasMeridiemFlag=!1;utcIndicator=" UTC";includeMilliseconds=!1;convertPastedOffset=!0;defaultTimeOnDateOnly=!1;minTs=null;maxTs=null;constructor(t={}){this.updateOptions(t)}static format(t,e={}){return new u(e).formatFromValue(t)}updateOptions(t={}){t.utcIndicator!==void 0&&(this.utcIndicator=t.utcIndicator===!1?!1:String(t.utcIndicator).slice(0,32)),t.includeMilliseconds!==void 0&&(this.includeMilliseconds=!!t.includeMilliseconds),t.convertPastedOffset!==void 0&&(this.convertPastedOffset=t.convertPastedOffset!==!1),t.defaultTimeOnDateOnly!==void 0&&(this.defaultTimeOnDateOnly=t.defaultTimeOnDateOnly),t.min!==void 0&&(this.minTs=this.normalizeBoundary(t.min)),t.max!==void 0&&(this.maxTs=this.normalizeBoundary(t.max)),t.placeholderTokens!==void 0&&(this.customPlaceholders=t.placeholderTokens||{}),(t.format!==void 0||this.slots.length===0)&&this.compile(t.format??this.formatSpec,t.placeholderTokens)}setFormat(t,e){e!==void 0&&(this.customPlaceholders=e),this.compile(t,this.customPlaceholders)}setUtcIndicator(t){this.utcIndicator=t===!1?!1:String(t).slice(0,32)}getUtcIndicator(){return this.utcIndicator}getFormat(){return this.formatSpec}getFullTemplate(){return this.fullTemplate}getGhostRemaining(t){let e=this.utcIndicator?this.utcIndicator:"";return t.length>=this.fullTemplate.length?e:this.fullTemplate.slice(t.length)+e}getPrefix(){return this.prefixString}getPrefixLength(){return this.prefixSlotsCount}getEditableCount(){return this.editableCount}hasMeridiem(){return this.hasMeridiemFlag}isNumericOnly(){return!this.hasMeridiemFlag}getSegments(){return this.segments}getSlots(){return this.slots}isSeparatorAt(t){return t>=0&&t<this.slots.length&&this.slots[t].isStatic}getNextEditablePosition(t){let e=Math.max(0,t);for(let i=e;i<this.slots.length;i++)if(!this.slots[i].isStatic)return i;return this.slots.length}compile(t,e){let i=String(t||"YYYY-MM-DD HH:mm").trim().slice(0,li)||"YYYY-MM-DD HH:mm";this.formatSpec=i;let s=Object.hasOwn(St,i)?St[i]:null,n=s?s.format:i,r=Object.create(null);if(s?.placeholderTokens)for(let[h,p]of Object.entries(s.placeholderTokens))Object.hasOwn(Bt,h)&&typeof p=="string"&&(r[h]=p);let o=e!==void 0?e:this.customPlaceholders;if(o&&typeof o=="object")for(let[h,p]of Object.entries(o))Object.hasOwn(Bt,h)&&typeof p=="string"&&(r[h]=p);this.slots=[],this.segments=[],this.hasMeridiemFlag=!1;let a="",l=!0,c=0;for(;c<n.length;){let h=n[c];if(h==="\\"&&c+1<n.length){let d=n[c+1];this.slots.push({char:d,isStatic:!0,isPrefix:l,segmentIndex:-1,charIndexInSegment:-1,placeholder:d}),a+=d,c+=2;continue}let p=null;for(let d of ai)if(n.startsWith(d.token,c)){p=d;break}if(p){l=!1;let{token:d,length:f}=p;d==="A"&&(this.hasMeridiemFlag=!0);let m=r[d]??Bt[d],g=ci(m,f,Bt[d]),y=Array.from(g),v=this.segments.length,b=this.slots.length;for(let w=0;w<f;w++)this.slots.push({char:d==="A"?"A":"9",isStatic:!1,isPrefix:!1,segmentIndex:v,charIndexInSegment:w,tokenKind:d,placeholder:y[w]||"_"});this.segments.push({kind:d,start:b,end:b+f,length:f,placeholder:g,followingSeparator:""}),a+=g,c+=d.length}else this.slots.push({char:h,isStatic:!0,isPrefix:l,segmentIndex:-1,charIndexInSegment:-1,placeholder:h}),a+=h,c++}this.fullTemplate=a,this.editableCount=this.slots.filter(h=>!h.isStatic).length,this.prefixSlotsCount=0,this.prefixString="";for(let h of this.slots)if(h.isPrefix)this.prefixSlotsCount++,this.prefixString+=h.char;else break;for(let h=0;h<this.segments.length;h++){let p=this.segments[h],d="";for(let f=p.end;f<this.slots.length&&this.slots[f].isStatic;f++)d+=this.slots[f].char;p.followingSeparator=d}}extractRaw(t,e=!1){let i=String(t??"").slice(0,Tt);if(!i||this.slots.length===0)return"";let s="",n=0,r=0;if(this.prefixSlotsCount>0){for(;n<i.length&&(i[n]===" "||i[n]===" ");)n++;let o=0;for(;n<i.length&&o<this.prefixSlotsCount;){let a=this.slots[o].char,l=i[n];if(l.toUpperCase()===a.toUpperCase())n++,o++;else if(a===" "&&l!==" ")o++;else break}r=this.prefixSlotsCount}for(;n<i.length&&r<this.slots.length;){let o=this.slots[r],a=i[n];if(o.isStatic){a.toUpperCase()===o.char.toUpperCase()&&n++,r++;continue}if(o.tokenKind==="A"){let l=a.toUpperCase();o.charIndexInSegment===0?l==="A"||l==="P"?(s+=l,n++,r++,(n<i.length?i[n].toUpperCase():"")==="M"?(s+="M",n++,r++):e&&(s+="M",r++)):n++:l==="M"?(s+="M",n++,r++):e?(s+="M",r++):n++;continue}P(a)?(s+=a,n++,r++):n++}return s}format(t,e=!1){if(this.slots.length===0)return String(t??"").slice(0,Tt);let i=this.extractRaw(t,e);if(i.length===0)return this.prefixString;let s="",n=0;for(let r=0;r<this.slots.length;r++){let o=this.slots[r];if(o.isStatic){let a=n<i.length,l=n===0&&o.isPrefix,c=n>0&&n===i.length;if(a||l||c)s+=o.char;else break}else if(n<i.length)s+=i[n],n++;else break}return s}analyze(t,e=!1){let i=this.extractRaw(t,e),s=this.formatFromCleanRaw(i),n=this.editableCount,r=i.length,o=n>0&&r>=n,a=this.extractSegmentValues(i),l=a.parts,c=null,h=null,p=null,d=!1;if(o&&a.allSegmentsPresent){let f=this.resolveHour24(a);if(f!==null){let m={year:l.year,month:l.month,day:l.day,hour:f,minute:l.minute??0,second:l.second??0},g=this.buildStrictUTCDate(m);if(g){let y=g.getTime(),v=this.minTs===null||y>=this.minTs,b=this.maxTs===null||y<=this.maxTs;v&&b&&(c=g,p=y,h=this.formatDateToISO(g),d=!0)}}}return{formatted:s,rawValue:h||"",isoString:h,date:c,timestamp:p,parts:l,isComplete:o,isValid:d,totalSlots:n,filledSlots:r}}mapCursorPosition(t,e,i){let s=this.prefixSlotsCount,n=String(t??""),r=String(i??"");if(e<=0||!r)return s;let a=this.extractRaw(n.slice(0,e),!1).length;if(a===0)return Math.max(s,Math.min(this.getNextEditablePosition(0),r.length));let l=0,c=r.length;for(let h=0;h<r.length&&h<this.slots.length;h++)if(!this.slots[h].isStatic&&(l++,l===a)){c=h+1;break}for(;c<r.length&&this.slots[c]&&this.slots[c].isStatic;)c++;return Math.max(s,Math.min(c,r.length))}tryHandleSeparatorKey(t,e,i){let s={handled:!1,formatted:t,cursor:e};if(!i||i.length!==1)return s;if(e<this.slots.length&&this.slots[e].isStatic&&this.separatorMatchesKey(this.slots[e].char,i)){let a=this.getNextEditablePosition(e+1),l=this.format(t);return{handled:!0,formatted:l,cursor:Math.min(a,l.length)}}if(e>this.prefixSlotsCount&&e-1<this.slots.length&&this.slots[e-1].isStatic){let a=e-1;for(;a>=this.prefixSlotsCount&&this.slots[a].isStatic;){if(this.separatorMatchesKey(this.slots[a].char,i)){let l=this.getNextEditablePosition(a+1),c=this.format(t);return{handled:!0,formatted:c,cursor:Math.min(l,c.length)}}a--}}let n=-1;for(let a=0;a<this.segments.length;a++){let l=this.segments[a];if(e>=l.start&&e<=l.end){n=a;break}}if(n===-1)return s;let r=this.segments[n];if(!r.followingSeparator||!this.followingSeparatorMatchesKey(r.followingSeparator,i))return s;let o=t.slice(r.start,Math.min(e,r.end)).replace(/\D/g,"");if(r.kind!=="YYYY"&&r.kind!=="A"&&o.length>0&&o.length<r.length){let a="0".repeat(r.length-o.length)+o,l=t.slice(Math.min(t.length,r.end)),c=t.slice(0,r.start)+a+r.followingSeparator+l,h=this.format(c),p=this.getNextEditablePosition(r.end);return{handled:!0,formatted:h,cursor:Math.min(p,h.length)}}if(e===r.end){let a=this.format(t),l=this.getNextEditablePosition(r.end);return{handled:!0,formatted:a,cursor:Math.min(l,a.length)}}return s}formatFromValue(t){if(t==null)return this.prefixString;if(t instanceof Date)return Number.isNaN(t.getTime())?this.prefixString:this.formatPartsToTemplate(this.dateToUTCParts(t));if(typeof t=="number"){if(!Number.isFinite(t))return this.prefixString;let s=new Date(t);return Number.isNaN(s.getTime())?this.prefixString:this.formatPartsToTemplate(this.dateToUTCParts(s))}let e=String(t).slice(0,Tt).trim();if(!e)return this.prefixString;let i=this.parsePasted(e);return i.matched?i.formatted:i.rejected?this.prefixString:this.format(e,!0)}formatFromNativeValue(t){let e=String(t??"").slice(0,Tt);if(!e)return this.prefixString;let i=e.trim();if(i.length>=16){let s=this.parseISO8601Linear(i);if(s&&!s.dateOnly){let n=this.parsePasted(i);if(n.matched)return n.formatted}}return this.format(e,!1)}parsePasted(t){let e={matched:!1,formatted:"",cursor:0},i={matched:!1,rejected:!0,formatted:"",cursor:0},s=String(t??"").slice(0,Tt).trim();if(!s||this.segments.length===0)return e;let n=s.length>=10&&P(s[0])&&P(s[1])&&P(s[2])&&P(s[3])&&s[4]==="-"&&P(s[5])&&P(s[6])&&s[7]==="-"&&P(s[8])&&P(s[9]),r=this.parseISO8601Linear(s);if(r){if(r.dateOnly)return this.formatDateOnlyMatch({year:r.year,month:r.month,day:r.day},i);if(r.offsetMinutes!==null&&r.offsetMinutes!==0&&!this.convertPastedOffset)return i;let o=this.buildStrictUTCDate({year:r.year,month:r.month,day:r.day,hour:r.hour,minute:r.minute,second:r.second});if(!o)return i;let a=o,l;if(r.offsetMinutes!==null&&r.offsetMinutes!==0){let h=o.getTime()-r.offsetMinutes*6e4;if(a=new Date(h),Number.isNaN(a.getTime()))return i;l={original:s,offsetMinutes:r.offsetMinutes,utcIso:this.formatDateToISO(a)}}let c=this.formatPartsToTemplate(this.dateToUTCParts(a));return{matched:!0,formatted:c,cursor:c.length,offsetConverted:l}}return n&&s.length>10&&(s[10]==="T"||s[10]==="t"||this.segments[0]?.kind!=="YYYY")?i:this.parseConfiguredFormatLinear(s)}formatLocal(t,e,i){if(!t||Number.isNaN(t.getTime()))return null;try{let s=i||{dateStyle:"short",timeStyle:"medium"};return new Intl.DateTimeFormat(e,s).format(t)}catch{return null}}normalizeBoundary(t){if(t==null)return null;if(t instanceof Date){let n=t.getTime();return Number.isNaN(n)?null:n}if(typeof t=="number")return Number.isFinite(t)?t:null;let e=String(t).slice(0,Tt).trim();if(!e)return null;let i=this.parseISO8601Linear(e);if(i){let n=this.buildStrictUTCDate({year:i.year,month:i.month,day:i.day,hour:i.hour,minute:i.minute,second:i.second});if(!n)return null;let r=i.offsetMinutes?i.offsetMinutes*6e4:0;return n.getTime()-r}return this.analyze(e,!0).timestamp}separatorMatchesKey(t,e){return t===e||(t==="T"||t==="t")&&(e==="T"||e==="t"||e===" ")}followingSeparatorMatchesKey(t,e){let i=!1;for(let s=0;s<t.length;s++)if(t[s]!==" "){i=!0;break}for(let s=0;s<t.length;s++){let n=t[s];if(!(i&&n===" ")&&this.separatorMatchesKey(n,e))return!0}return!1}formatFromCleanRaw(t){if(this.slots.length===0)return"";if(t.length===0)return this.prefixString;let e="",i=0;for(let s=0;s<this.slots.length;s++){let n=this.slots[s];if(n.isStatic){let r=i<t.length,o=i===0&&n.isPrefix,a=i>0&&i===t.length;if(r||o||a)e+=n.char;else break}else if(i<t.length)e+=t[i],i++;else break}return e}extractSegmentValues(t){let e={},i,s,n=0,r=!0;for(let o of this.segments){if(n+o.length>t.length){r=!1;break}let a=t.slice(n,n+o.length);switch(n+=o.length,o.kind){case"YYYY":e.year=F(a);break;case"MM":e.month=F(a);break;case"DD":e.day=F(a);break;case"HH":e.hour=F(a);break;case"hh":i=F(a);break;case"mm":e.minute=F(a);break;case"ss":e.second=F(a);break;case"A":a==="AM"||a==="PM"?s=a:r=!1;break}}if((e.year===void 0||e.month===void 0||e.day===void 0)&&(r=!1),e.hour===void 0&&i===void 0&&(r=!1),r&&i!==void 0){let o=this.resolveHour24({parts:e,hour12:i,meridiem:s});o!==null&&(e.hour=o)}return{parts:e,hour12:i,meridiem:s,allSegmentsPresent:r}}resolveHour24(t){if(t.hour12!==void 0){let e=t.hour12;return e<1||e>12||!t.meridiem?null:t.meridiem==="AM"?e===12?0:e:e===12?12:e+12}return t.parts.hour!==void 0&&t.parts.hour>=0&&t.parts.hour<=23?t.parts.hour:null}buildStrictUTCDate(t){let{year:e,month:i,day:s,hour:n,minute:r,second:o}=t;if(!Number.isInteger(e)||e<1||e>9999||!Number.isInteger(i)||i<1||i>12||!Number.isInteger(s)||s<1||s>31||!Number.isInteger(n)||n<0||n>23||!Number.isInteger(r)||r<0||r>59||!Number.isInteger(o)||o<0||o>59)return null;let a=new Date(0);return a.setUTCFullYear(e,i-1,s),a.setUTCHours(n,r,o,0),a.getUTCFullYear()!==e||a.getUTCMonth()!==i-1||a.getUTCDate()!==s||a.getUTCHours()!==n||a.getUTCMinutes()!==r||a.getUTCSeconds()!==o?null:a}dateToUTCParts(t){return{year:t.getUTCFullYear(),month:t.getUTCMonth()+1,day:t.getUTCDate(),hour:t.getUTCHours(),minute:t.getUTCMinutes(),second:t.getUTCSeconds()}}formatDateToISO(t){let e=String(t.getUTCFullYear()).padStart(4,"0"),i=String(t.getUTCMonth()+1).padStart(2,"0"),s=String(t.getUTCDate()).padStart(2,"0"),n=String(t.getUTCHours()).padStart(2,"0"),r=String(t.getUTCMinutes()).padStart(2,"0"),o=String(t.getUTCSeconds()).padStart(2,"0");if(this.includeMilliseconds){let a=String(t.getUTCMilliseconds()).padStart(3,"0");return`${e}-${i}-${s}T${n}:${r}:${o}.${a}Z`}return`${e}-${i}-${s}T${n}:${r}:${o}Z`}formatPartsToTemplate(t){let e="";for(let i of this.segments)switch(i.kind){case"YYYY":e+=String(t.year).padStart(4,"0").slice(-4);break;case"MM":e+=String(t.month).padStart(2,"0");break;case"DD":e+=String(t.day).padStart(2,"0");break;case"HH":e+=String(t.hour).padStart(2,"0");break;case"hh":{let s=t.hour%12===0?12:t.hour%12;e+=String(s).padStart(2,"0");break}case"mm":e+=String(t.minute).padStart(2,"0");break;case"ss":e+=String(t.second).padStart(2,"0");break;case"A":e+=t.hour>=12?"PM":"AM";break}return this.formatFromCleanRaw(e)}formatDateOnlyMatch(t,e){if(!this.buildStrictUTCDate({year:t.year,month:t.month,day:t.day,hour:0,minute:0,second:0}))return e;if(typeof this.defaultTimeOnDateOnly=="string"&&this.defaultTimeOnDateOnly.trim()){let r=this.parseDefaultTime(this.defaultTimeOnDateOnly.trim());if(r){let o=this.formatPartsToTemplate({...t,hour:r.hour,minute:r.minute,second:r.second});return{matched:!0,formatted:o,cursor:o.length}}}let s="";for(let r of this.segments){if(ke.has(r.kind))break;r.kind==="YYYY"?s+=String(t.year).padStart(4,"0"):r.kind==="MM"?s+=String(t.month).padStart(2,"0"):r.kind==="DD"&&(s+=String(t.day).padStart(2,"0"))}if(!s)return e;let n=this.formatFromCleanRaw(s);return{matched:!0,formatted:n,cursor:n.length}}parseDefaultTime(t){let e=t.split(":");if(e.length<2||e.length>3)return null;let i=F(e[0]),s=F(e[1]),n=e.length===3?F(e[2]):0;return Number.isNaN(i)||i<0||i>23||Number.isNaN(s)||s<0||s>59||Number.isNaN(n)||n<0||n>59?null:{hour:i,minute:s,second:n}}parseISO8601Linear(t){if(t.length<10)return null;for(let c of[0,1,2,3,5,6,8,9])if(!P(t[c]))return null;if(t[4]!=="-"||t[7]!=="-")return null;let e=F(t.slice(0,4)),i=F(t.slice(5,7)),s=F(t.slice(8,10));if(t.length===10)return{year:e,month:i,day:s,hour:0,minute:0,second:0,dateOnly:!0,offsetMinutes:null};let n=10;if(t[n]!=="T"&&t[n]!=="t"&&t[n]!==" "||(n++,n+5>t.length)||!P(t[n])||!P(t[n+1])||t[n+2]!==":"||!P(t[n+3])||!P(t[n+4]))return null;let r=F(t.slice(n,n+2)),o=F(t.slice(n+3,n+5));n+=5;let a=0;if(n<t.length&&t[n]===":"){if(n++,n+2>t.length||!P(t[n])||!P(t[n+1]))return null;a=F(t.slice(n,n+2)),n+=2}if(n<t.length&&t[n]==="."){n++;let c=n;for(;n<t.length&&P(t[n]);)n++;if(n===c)return null}let l=null;if(n<t.length){for(;n<t.length&&t[n]===" ";)n++;if(n<t.length){let c=t[n];if(c==="Z"||c==="z")l=0,n++;else if(c==="+"||c==="-"){let h=c==="-"?-1:1;if(n++,n+2>t.length||!P(t[n])||!P(t[n+1]))return null;let p=F(t.slice(n,n+2));n+=2;let d=0;if(n<t.length){if(t[n]===":"&&n++,n+2>t.length||!P(t[n])||!P(t[n+1]))return null;d=F(t.slice(n,n+2)),n+=2}if(p>14||d>59||p===14&&d!==0)return null;l=h*(p*60+d)}else if(t.slice(n).toUpperCase()==="UTC")l=0,n=t.length;else return null}}return n!==t.length?null:{year:e,month:i,day:s,hour:r,minute:o,second:a,dateOnly:!1,offsetMinutes:l}}parseConfiguredFormatLinear(t){let e={matched:!1,formatted:"",cursor:0},i=t;i.toUpperCase().endsWith(" UTC")?i=i.slice(0,-4).trim():i.length>2&&(i.endsWith("Z")||i.endsWith("z"))&&P(i[i.length-2])&&(i=i.slice(0,-1).trim()),this.prefixString&&i.toLowerCase().startsWith(this.prefixString.trim().toLowerCase())&&(i=i.slice(this.prefixString.trim().length).trim());let s=[],n=-1;for(let d=0;d<i.length;d++){let f=i[d];ui.has(f)?n!==-1&&(s.push(i.slice(n,d)),n=-1):n===-1&&(n=d)}if(n!==-1&&s.push(i.slice(n)),s.length===0||s.length>this.segments.length)return e;let r=0;for(let d of this.segments){if(ke.has(d.kind))break;r++}let o=[],a,l,c;for(let d=0;d<s.length;d++){let f=s[d],m=this.segments[d];if(m.kind==="A"){let g=f.toUpperCase();if(g==="AM"||g==="A")o.push("AM");else if(g==="PM"||g==="P")o.push("PM");else return e;continue}for(let g=0;g<f.length;g++)if(!P(f[g]))return e;if(m.kind==="YYYY"){if(f.length!==4)return e;a=F(f),o.push(f)}else{if(f.length<1||f.length>2)return e;let g=f.length===1?"0"+f:f,y=F(g);m.kind==="MM"&&(l=y),m.kind==="DD"&&(c=y),o.push(g)}}if(s.length===r&&a!==void 0&&l!==void 0&&c!==void 0)return this.formatDateOnlyMatch({year:a,month:l,day:c},e);let h=this.segments.length;if(s.length<h&&!(r>0&&s.length>=r+2&&this.segments[r+1]?.kind==="mm"))return e;let p=this.formatFromCleanRaw(o.join(""));return{matched:!0,formatted:p,cursor:p.length}}};var hi=10,At=class extends V{engine;history;isComposing=!1;isUndoingRedoing=!1;isMouseDown=!1;isApplying=!1;isNotifying=!1;hasPendingNotification=!1;lastValue="";lastValueLength=0;lastInputType="";inferredInputModeValue=null;wasAutocorrectSet=!1;wasAutocapitalizeSet=!1;wasSpellcheckSet=!1;cutTimerId=null;pasteTimerId=null;resetTimerId=null;constructor(t,e,i){let s=Z(t,e,i),n=s.wrapper,r=s.input,o=s.options,a=n?.getAttribute("data-mask-format")||r?.getAttribute("data-mask-format")||void 0,l=n?.getAttribute("data-mask-utc-indicator")??r?.getAttribute("data-mask-utc-indicator"),c=n?.getAttribute("data-mask-infer-inputmode")??r?.getAttribute("data-mask-infer-inputmode"),h=o.utcIndicator!==void 0?o.utcIndicator:l!==null?l==="false"||l==="none"?!1:l:" UTC",p={...o,format:o.format??a??"YYYY-MM-DD HH:mm",utcIndicator:h,includeMilliseconds:o.includeMilliseconds??!1,convertPastedOffset:o.convertPastedOffset??!0,defaultTimeOnDateOnly:o.defaultTimeOnDateOnly??!1,inferInputMode:o.inferInputMode??(c!==null?c!=="false":!0),onInput:o.onInput||o.oninput,onChange:o.onChange||o.onchange,onComplete:o.onComplete||o.oncomplete};super(n,r,p),this.history=new Y,this.engine=new tt(this.options),this.input.hasAttribute("autocorrect")||(this.input.setAttribute("autocorrect","off"),this.wasAutocorrectSet=!0),this.input.hasAttribute("autocapitalize")||(this.input.setAttribute("autocapitalize","none"),this.wasAutocapitalizeSet=!0),this.input.hasAttribute("spellcheck")||(this.input.setAttribute("spellcheck","false"),this.wasSpellcheckSet=!0),this.syncInferredInputMode(),this.bindEvents(),this.lastValue=this.isSensitiveField()?this.computePasswordDigest(this.input.value):this.input.value,this.syncInitialValue(),this.runAuditWarning(this.options.audit)}static format(t,e={}){return tt.format(t,e)}getSpecificAuditWarnings(){let t=[],e=[],i=this.checkAriaIdReferences(this.input,"aria-describedby",e,!0),s=!!this.input.getAttribute("placeholder")?.trim(),n=!!this.input.getAttribute("aria-placeholder")?.trim();return!i&&!n&&!this.options.disabled&&(s?t.push(`Indication du format UTC fragile : placeholder seul dispara\xEEt \xE0 la saisie et l'indicateur UTC fant\xF4me est aria-hidden="true" ; d\xE9finissez aria-describedby ou aria-placeholder (WCAG 3.3.2).`):t.push("Indication du format UTC attendu manquante : d\xE9finissez aria-describedby ou aria-placeholder pour informer les technologies d'assistance du format et du r\xE9f\xE9rentiel UTC (WCAG 3.3.2).")),t}extractRawSnippet(t){return t?t===this.input.value&&this.isValid()?this.getRawValue():this.engine.extractRaw(t,!1):""}onPasswordModeDetected(){this.history.clear(),this.lastValue="",this.lastValueLength=0,this.lastTrackedValue="",this.clearGhost()}onNativeValueSet(t){if(this.options.disabled)this.checkValueChange(!1);else{let e=this.engine.formatFromNativeValue(t);this.applyFormatted(e,e.length,!1)}}onDisabledChange(t){if(t)this.wrapper.classList.remove("is-complete","has-selection"),this.clearGhost(),this.checkValueChange(!1);else{let e=this.engine.formatFromValue(this.input.value);this.applyFormatted(e,this.input.selectionStart??e.length,!1)}this.syncInferredInputMode()}handleAttributeMutation(t){if(super.handleAttributeMutation(t),t==="data-mask-format"){let e=this.getAttr("data-mask-format");e&&e!==this.engine.getFormat()&&this.setFormat(e)}else if(t==="data-mask-utc-indicator"){let e=this.getAttr("data-mask-utc-indicator"),i=e===null||e==="false"||e==="none"?!1:e;this.setUtcIndicator(i)}else t==="placeholder"&&this.updateGhost(this.input.value)}bindEvents(){this.onBeforeInput=this.onBeforeInput.bind(this),this.handleInput=this.handleInput.bind(this),this.onKeyDown=this.onKeyDown.bind(this),this.onPaste=this.onPaste.bind(this),this.onFocus=this.onFocus.bind(this),this.onBlur=this.onBlur.bind(this),this.onClick=this.onClick.bind(this),this.onKeyUp=this.onKeyUp.bind(this),this.onSelect=this.onSelect.bind(this),this.onMouseDown=this.onMouseDown.bind(this),this.onMouseUp=this.onMouseUp.bind(this),this.onCompositionStart=this.onCompositionStart.bind(this),this.onCompositionEnd=this.onCompositionEnd.bind(this),this.onCutHandler=()=>{this.cutTimerId!==null&&clearTimeout(this.cutTimerId),this.cutTimerId=window.setTimeout(()=>{if(this.cutTimerId=null,!this.isDestroyed)if(this.options.disabled)this.checkValueChange(!1);else{let i=this.input.selectionStart??this.input.value.length;this.applyFormatted(this.input.value,i,!1)}},0)};let t=()=>{this.isDestroyed||this.checkValueChange(!0,!0)},{signal:e}=this.abortController;this.input.addEventListener("beforeinput",this.onBeforeInput,{signal:e}),this.input.addEventListener("input",this.handleInput,{signal:e}),this.input.addEventListener("keydown",this.onKeyDown,{signal:e}),this.input.addEventListener("paste",this.onPaste,{signal:e}),this.input.addEventListener("focus",this.onFocus,{signal:e}),this.input.addEventListener("blur",this.onBlur,{signal:e}),this.input.addEventListener("click",this.onClick,{signal:e}),this.input.addEventListener("keyup",this.onKeyUp,{signal:e}),this.input.addEventListener("select",this.onSelect,{signal:e}),this.input.addEventListener("mousedown",this.onMouseDown,{signal:e}),window.addEventListener("mouseup",this.onMouseUp,{signal:e}),this.input.addEventListener("compositionstart",this.onCompositionStart,{signal:e}),this.input.addEventListener("compositionend",this.onCompositionEnd,{signal:e}),this.input.addEventListener("scroll",this.onScroll,{passive:!0,signal:e}),this.input.addEventListener("cut",this.onCutHandler,{signal:e}),this.input.addEventListener("change",t,{signal:e}),this.input.form&&(this.onFormResetHandler=()=>{this.resetTimerId!==null&&clearTimeout(this.resetTimerId),this.resetTimerId=window.setTimeout(()=>{this.resetTimerId=null,!this.isDestroyed&&(this.options.disabled?this.checkValueChange(!1):this.syncInitialValue())},0)},this.input.form.addEventListener("reset",this.onFormResetHandler,{signal:e}))}syncInferredInputMode(){if(this.options.inferInputMode===!1)return;if(this.options.disabled){this.inferredInputModeValue&&this.input.getAttribute("inputmode")===this.inferredInputModeValue&&this.input.removeAttribute("inputmode"),this.inferredInputModeValue=null;return}let t=this.engine.isNumericOnly()?"numeric":"text",e=this.input.getAttribute("inputmode");(!e||this.inferredInputModeValue===e)&&(this.input.inputMode=t,this.inferredInputModeValue=t)}getDetail(){let t=this.engine.analyze(this.input.value,!1);return{...t,value:this.options.disabled?this.input.value:t.formatted}}getRawValue(){return this.options.disabled?this.input.value:this.getDetail().rawValue}getISOString(){return this.getDetail().isoString}getDate(){return this.getDetail().date}getTimestamp(){return this.getDetail().timestamp}getParts(){return this.getDetail().parts}getTemporalInstant(){let t=this.getTimestamp();if(t===null)return null;let e=globalThis.Temporal;if(e?.Instant&&typeof e.Instant.fromEpochMilliseconds=="function")try{return e.Instant.fromEpochMilliseconds(t)}catch{return null}return null}isComplete(){return this.options.disabled?!0:this.getDetail().isComplete}isValid(){return this.options.disabled?!0:this.getDetail().isValid}setValue(t){if(this.options.disabled){let i=t instanceof Date?Number.isNaN(t.getTime())?"":this.engine.formatDateToISO(t):t!=null?String(t):"";this.setNativeValue(i),this.checkValueChange(!1);return}let e=this.engine.formatFromValue(t);this.applyFormatted(e,e.length,!0)}setNow(){this.setValue(new Date)}formatLocal(t,e){return this.engine.formatLocal(this.getDate(),t,e)}setFormat(t,e){let i=this.getDate();if(this.options.format=t,e!==void 0&&(this.options.placeholderTokens=e),this.engine.setFormat(t,e),this.syncInferredInputMode(),this.options.disabled){this.clearGhost();return}if(i){let s=this.engine.formatFromValue(i);this.applyFormatted(s,s.length,!0)}else{let s=this.engine.format(this.input.value,!1);this.applyFormatted(s,Math.min(this.input.selectionStart??s.length,s.length),!1)}}setUtcIndicator(t){this.options.utcIndicator=t,this.engine.setUtcIndicator(t),this.updateGhost(this.input.value)}undo(){if(this.options.disabled)return;let t=this.history.undo();if(t){this.isUndoingRedoing=!0;try{this.applyFormatted(this.engine.format(t.raw,!1),t.cursor,!0)}finally{this.isUndoingRedoing=!1}}}redo(){if(this.options.disabled)return;let t=this.history.redo();if(t){this.isUndoingRedoing=!0;try{this.applyFormatted(this.engine.format(t.raw,!1),t.cursor,!0)}finally{this.isUndoingRedoing=!1}}}destroy(){this.isDestroyed||(this.cutTimerId!==null&&(clearTimeout(this.cutTimerId),this.cutTimerId=null),this.pasteTimerId!==null&&(clearTimeout(this.pasteTimerId),this.pasteTimerId=null),this.resetTimerId!==null&&(clearTimeout(this.resetTimerId),this.resetTimerId=null),this.inferredInputModeValue&&this.input.getAttribute("inputmode")===this.inferredInputModeValue&&this.input.removeAttribute("inputmode"),this.wasAutocorrectSet&&this.input.removeAttribute("autocorrect"),this.wasAutocapitalizeSet&&this.input.removeAttribute("autocapitalize"),this.wasSpellcheckSet&&this.input.removeAttribute("spellcheck"),this.history.clear(),this.lastValue="",this.lastValueLength=0,super.destroy())}checkSelection(){if(this.options.disabled)return;let t=this.input.selectionStart??0,e=this.input.selectionEnd??t;this.wrapper.classList.toggle("has-selection",t!==e)}onBeforeInput(t){if(this.lastInputType=t.inputType||"",!(this.options.disabled||this.isComposing)&&!(t.inputType==="insertFromPaste"||t.inputType==="insertReplacementText")&&t.inputType&&t.inputType.startsWith("insert")){let e=this.engine.getEditableCount();if(e>0){let i=this.engine.extractRaw(this.input.value,!1),s=this.input.selectionStart??0,n=this.input.selectionEnd??s,r=Math.max(0,e-i.length);if(n>s){let o=this.engine.extractRaw(this.input.value.slice(s,n),!1);r=Math.max(0,e-(i.length-o.length))}r<=0&&t.preventDefault()}}}handleInput(t){if(this.isDispatchingNativeInput||this.isComposing)return;if(this.options.disabled){this.checkValueChange(!1);return}let e=t?.inputType||this.lastInputType||"";this.lastInputType="";let i=this.input.value,s=this.input.selectionStart??i.length,n=this.history.getCurrent(),r=this.engine.getEditableCount(),o=e.startsWith("delete")||!this.isSensitiveField()&&i.length<this.lastValueLength,a=this.engine.extractRaw(i,!1);if(r>0&&n&&n.raw.length>=r&&a.length>r){let h=this.engine.format(n.raw,!1);this.applyFormatted(h,n.cursor,!0);return}let l=i,c=!o;if(o&&this.engine.hasMeridiem()){for(let h of this.engine.getSegments())if(h.kind==="A"&&i.length>=h.start+1&&i.length<h.end){l=i.slice(0,h.start)+i.slice(h.start+1),c=!1;break}}this.applyFormatted(l,s,!1,c),this.checkSelection()}onKeyDown(t){if(this.options.disabled||N(t))return;let e=this.input.selectionStart??0,i=this.input.selectionEnd??e,s=this.engine.getPrefixLength();if((t.ctrlKey||t.metaKey)&&(t.key==="z"||t.key==="Z")&&!t.shiftKey){t.preventDefault(),this.undo();return}if((t.ctrlKey||t.metaKey)&&(t.key==="y"||t.key==="Y")||(t.ctrlKey||t.metaKey)&&t.shiftKey&&(t.key==="z"||t.key==="Z")){t.preventDefault(),this.redo();return}this.history.updateCurrentCursor(e);let n=t.key.length===1&&!t.ctrlKey&&!t.metaKey&&!t.altKey,r=i>e;if(n&&!r){let o=this.engine.tryHandleSeparatorKey(this.input.value,e,t.key);if(o.handled){t.preventDefault(),this.applyFormatted(o.formatted,o.cursor,!0);return}if(this.engine.hasMeridiem()){for(let l of this.engine.getSegments())if(l.kind==="A"&&e>=l.start&&e<=l.end){let c=t.key.toUpperCase();if(c==="A"||c==="P"){t.preventDefault();let h=c==="A"?"AM":"PM",p=this.input.value,d=p.slice(0,l.start)+h+p.slice(Math.min(p.length,l.end));this.applyFormatted(d,l.end,!0);return}}}let a=this.engine.getEditableCount();if(a>0&&this.engine.extractRaw(this.input.value,!1).length>=a){t.preventDefault();return}}if(r){if(t.key==="Backspace"||t.key==="Delete"){t.preventDefault();let o=this.input.value,a=o.slice(0,e)+o.slice(i);this.applyFormatted(a,Math.max(s,e),!1);return}return}if(t.key==="ArrowLeft"&&!t.shiftKey&&e<=s){t.preventDefault(),this.input.setSelectionRange(s,s);return}if(t.key==="Home"&&s>0&&!t.shiftKey&&!t.ctrlKey&&!t.metaKey&&!t.altKey){t.preventDefault(),this.input.setSelectionRange(s,s);return}if(t.key==="Backspace"&&e<=s){t.preventDefault(),this.input.setSelectionRange(s,s);return}if(t.key==="Delete"&&e<s){t.preventDefault(),this.input.setSelectionRange(s,s);return}if(t.key==="Backspace"&&this.engine.hasMeridiem()){for(let o of this.engine.getSegments())if(o.kind==="A"&&e>o.start&&e<=o.end){t.preventDefault();let a=this.input.value,l=a.slice(0,o.start)+a.slice(Math.min(a.length,o.end));this.applyFormatted(l,o.start,!0);return}}if(t.key==="Backspace"&&(t.ctrlKey||t.altKey||t.metaKey)){if(t.preventDefault(),e<=s){this.input.setSelectionRange(s,s);return}let o=e-1;for(;o>=s&&this.engine.isSeparatorAt(o);)o--;for(;o>=s&&!this.engine.isSeparatorAt(o);)o--;let a=Math.max(s,o+1),l=this.input.value;this.applyFormatted(l.slice(0,a)+l.slice(e),a,!0);return}if(t.key==="Delete"&&(t.ctrlKey||t.altKey||t.metaKey)){t.preventDefault();let o=this.input.value;if(e>=o.length)return;let a=e;for(;a<o.length&&this.engine.isSeparatorAt(a);)a++;for(;a<o.length&&!this.engine.isSeparatorAt(a);)a++;for(;a<o.length&&this.engine.isSeparatorAt(a);)a++;this.applyFormatted(o.slice(0,e)+o.slice(a),e,!0);return}if(t.key==="Backspace"&&e>s&&this.engine.isSeparatorAt(e-1)){t.preventDefault();let o=e-1;for(;o>s&&this.engine.isSeparatorAt(o-1);)o--;if(o>s){let a=this.input.value;this.applyFormatted(a.slice(0,o-1)+a.slice(e),o-1,!1)}else this.applyFormatted("",s,!0);return}if(t.key==="Delete"&&e<this.input.value.length&&this.engine.isSeparatorAt(e)){t.preventDefault();let o=e;for(;o<this.input.value.length&&this.engine.isSeparatorAt(o);)o++;if(o<this.input.value.length){let a=this.input.value;this.applyFormatted(a.slice(0,o)+a.slice(o+1),e,!0)}}}onPaste(t){if(this.options.disabled){this.pasteTimerId!==null&&clearTimeout(this.pasteTimerId),this.pasteTimerId=window.setTimeout(()=>{this.pasteTimerId=null,this.isDestroyed||this.checkValueChange(!1)},0);return}t.preventDefault(),this.history.updateCurrentCursor(this.input.selectionStart??0);let e=this.preparePastedText(this.getClipboardPlainText(t),512);if(!e)return;let i=this.engine.getPrefixLength(),s=this.input.selectionStart??0,n=this.input.selectionEnd??s,r=this.input.value,o=this.engine.getEditableCount(),a=this.engine.extractRaw(r,!1);if(a.length===0||s<=i&&n>=r.length||s===n){let f=this.engine.parsePasted(e);if(f.matched){if(this.applyFormatted(f.formatted,f.cursor,!0),f.offsetConverted&&this.options.onOffsetConverted)try{this.options.onOffsetConverted(f.offsetConverted)}catch{}this.checkSelection();return}if(f.rejected)return}let c=Math.max(0,o-a.length);if(n>s){let f=this.engine.extractRaw(r.slice(s,n),!1);c=Math.max(0,o-(a.length-f.length))}if(c<=0)return;let h=Math.max(i,s),p=Math.max(i,n),d=r.slice(0,h)+e+r.slice(p);this.applyFormatted(d,h+e.length,!1,!0),this.checkSelection()}onFocus(){this.syncGhostStyles(),this.wrapper.classList.add("is-focused"),!this.options.disabled&&!this.isMouseDown&&this.enforceMinCursor(),this.updateGhost(this.input.value),this.checkSelection()}onBlur(){if(this.wrapper.classList.remove("is-focused","has-selection"),this.isSensitiveField()){this.onPasswordModeDetected();return}this.updateGhost(this.input.value),this.checkValueChange(!1,!0)}onClick(){this.options.disabled||this.enforceMinCursor(),this.history.updateCurrentCursor(this.input.selectionStart??0),this.checkSelection()}onKeyUp(t){this.options.disabled||((t.key==="ArrowLeft"||t.key==="ArrowRight"||t.key==="Home")&&!t.shiftKey&&this.enforceMinCursor(),this.history.updateCurrentCursor(this.input.selectionStart??0)),this.checkSelection()}onSelect(){this.history.updateCurrentCursor(this.input.selectionStart??0),this.checkSelection()}onMouseDown(){this.isMouseDown=!0}onMouseUp(){this.isMouseDown=!1,this.checkSelection()}onCompositionStart(){this.isComposing=!0}onCompositionEnd(){if(this.isComposing=!1,this.options.disabled)return;let t=this.input.selectionStart??this.input.value.length;this.applyFormatted(this.input.value,t,!1,!0),this.checkSelection()}enforceMinCursor(){let t=this.engine.getPrefixLength();if(t<=0)return;let e=this.input.selectionStart??0,i=this.input.selectionEnd??e;e===i&&e<t&&this.input.setSelectionRange(t,t)}updateGhost(t){if(!this.ghost)return;if(this.options.disabled||this.isSensitiveField()){this.clearGhost();return}let e=!t||t===this.engine.getPrefix();if(this.shouldHideGhostForPlaceholder(e)){this.clearGhost();return}let i=this.engine.getGhostRemaining(t),s=this.input.ownerDocument||document,n=s.createElement("span");n.className="mask-ghost-typed",n.textContent=t;let r=s.createElement("span");r.className="mask-ghost-remaining",r.textContent=i,this.setGhostContent(n,r),this.ghost.scrollLeft=this.input.scrollLeft}applyFormatted(t,e,i=!1,s=!1){if(!(this.options.disabled||this.isApplying)){this.isApplying=!0;try{let n=this.engine.format(t,s),r=this.isSensitiveField();this.setNativeValue(n),r?this.clearGhost():this.updateGhost(n);let o=this.engine.getPrefixLength(),a;i||this.isUndoingRedoing?a=Math.max(o,Math.min(e,n.length)):a=Math.max(o,this.engine.mapCursorPosition(t,e,n)),this.input.setSelectionRange(a,a);let l=this.engine.analyze(n,!1);this.wrapper.classList.toggle("is-complete",l.isComplete),r?(this.options.copyRaw=!1,this.lastValueLength=0,this.history.clear()):(this.lastValueLength=n.length,this.isUndoingRedoing||this.history.push(this.engine.extractRaw(n,!1),a))}finally{this.isApplying=!1}this.checkValueChange(!1)}}syncInitialValue(){let t=this.isSensitiveField();if(this.options.disabled){this.clearGhost(),this.lastValue=t?this.computePasswordDigest(this.input.value):this.input.value,this.lastValueLength=t?0:this.input.value.length,this.checkValueChange(!1);return}this.syncGhostStyles();let e=this.input.value||"";if(e){let i=this.engine.formatFromValue(e);this.applyFormatted(i,i.length,!0)}else{let i=this.engine.getPrefixLength();i>0?this.applyFormatted("",i,!0):(t?this.clearGhost():(this.history.push("",0),this.updateGhost("")),this.checkValueChange(!1))}}checkValueChange(t=!1,e=!1){let i=this.isSensitiveField(),s=this.input.value;if((i?this.computePasswordDigest(s):s)===this.lastValue&&!t&&!this.hasPendingNotification){if(e){let r=!i,o=this.getDetail(),a=this.options.onChange||this.options.onchange;a&&a(o),this.input.dispatchEvent(new CustomEvent("mask:change",{bubbles:r,detail:o}))}return}if(this.isNotifying){this.hasPendingNotification=!0;return}this.isNotifying=!0;try{let r=0;for(;((this.isSensitiveField()?this.computePasswordDigest(this.input.value):this.input.value)!==this.lastValue||this.hasPendingNotification||t)&&r<hi;){r++,this.hasPendingNotification=!1,t=!1;let o=this.isSensitiveField(),a=!o,l=this.input.value;this.lastValue=o?this.computePasswordDigest(l):l,this.lastValueLength=o?0:l.length;let c=this.getDetail(),h=this.options.onInput||this.options.oninput;if(h&&h(c),this.input.dispatchEvent(new CustomEvent("mask:input",{bubbles:a,detail:c})),this.dispatchNativeInput(),e){let p=this.options.onChange||this.options.onchange;p&&p(c),this.input.dispatchEvent(new CustomEvent("mask:change",{bubbles:a,detail:c}))}if(c.isComplete){let p=this.options.onComplete||this.options.oncomplete;p&&p(c),this.input.dispatchEvent(new CustomEvent("mask:complete",{bubbles:a,detail:c}))}}}finally{this.isNotifying=!1}}};var di={BaseInputMask:V,InputMask:dt,MaskEngine:J,MaskHistory:Y,MaskKeyboard:ot,AmountEngine:Q,InputAmountMask:yt,EmailEngine:at,InputEmailMask:wt,DateUTCEngine:tt,DATE_UTC_PRESETS:St,InputDateUTCMask:At,sanitizePastedText:G,stripBidiAndInvisibles:O},_t=dt;var Jt={};$(Jt,{LocalizedComponent:()=>R,Scroll:()=>mi,ScrollBlock:()=>lt,createI18nManager:()=>B,default:()=>gi,scrollEn:()=>Zt,scrollFr:()=>jt,scrollI18n:()=>Ct});var R=class extends z{static _i18n;static setLocale(t){this._i18n&&this._i18n.setLocale(t)}static getLocale(){return this._i18n?this._i18n.getLocale():""}static registerLocale(t,e){this._i18n&&this._i18n.registerLocale(t,e)}static setI18n(t){this._i18n&&this._i18n.setI18n(t)}static getI18n(){return this._i18n?this._i18n.getAll():{}}static resetI18n(){this._i18n&&this._i18n.reset()}static t(t,e){return this._i18n?this._i18n.t(t,e):String(t)}i18nOverrides;constructor(t){super(),this.i18nOverrides=t}t(t){let e=this.constructor;return e._i18n?e._i18n.t(t,this.i18nOverrides):String(t)}};var pi=new Set(["__proto__","constructor","prototype"]);function Pt(u){return!!u&&!pi.has(u)}function Ut(u){let t=String(u??"").trim().toLowerCase().replace(/_/g,"-");return Pt(t)?t:""}function fi(u){let t=u.indexOf("-"),e=t>0?u.slice(0,t):null;return e&&Pt(e)?e:null}function q(u,t){if(!t||typeof t!="object")return u;for(let e of Object.keys(t))Pt(String(e))&&Object.hasOwn(t,e)&&t[e]!==void 0&&(u[e]=t[e]);return u}function B(u,t){let e=Ut(u)||"fr",i=Object.create(null);for(let[a,l]of Object.entries(t)){let c=Ut(a);c&&(i[c]=q(Object.create(null),l))}let s=e,n=Object.create(null);for(let[a,l]of Object.entries(i))n[a]=q(Object.create(null),l);let r=Object.create(null);function o(){let a=[];if(Pt(s)){let c=n[s];c&&a.push(c)}let l=fi(s);return l&&n[l]&&a.push(n[l]),a}return{setLocale(a){if(a&&typeof a=="string"&&a.trim()){let l=Ut(a);l&&(s=l)}},getLocale(){return s},registerLocale(a,l){if(!a||typeof a!="string"||!a.trim()||!l)return;let c=Ut(a);if(!c)return;let h=q(Object.create(null),n[c]);n[c]=q(h,l)},setI18n(a){if(!a||typeof a!="object")return;let l=q(Object.create(null),r);r=q(l,a)},t(a,l){if(!Pt(String(a)))return"";if(l&&typeof l=="object"&&Object.hasOwn(l,a)&&l[a]!==void 0)return String(l[a]);if(r[a]!==void 0)return String(r[a]);for(let h of o())if(h[a]!==void 0)return String(h[a]);let c=n[e]||i[e];return c&&c[a]!==void 0?String(c[a]):String(a)},getAll(a){let l={},c=n[e]||i[e];q(l,c);let h=o().reverse();for(let p of h)q(l,p);return q(l,r),q(l,a),l},reset(){s=e,r=Object.create(null),n=Object.create(null);for(let[a,l]of Object.entries(i))n[a]=q(Object.create(null),l)}}}var jt={viewport:"Zone de contenu d\xE9filable",verticalThumb:"D\xE9filement vertical",horizontalThumb:"D\xE9filement horizontal"};var Zt={viewport:"Scrollable content area",verticalThumb:"Vertical scroll",horizontalThumb:"Horizontal scroll"};var Ct=B("fr",{fr:jt,en:Zt});var Le=0,lt=class extends R{static _i18n=Ct;static i18n=Ct;root;viewport;options;createdViewport=!1;isDestroyed=!1;wasIdGenerated=!1;wasRoleInferred=!1;wasAriaLabelInferred=!1;hasExplicitAriaLabel=!1;hasRootAriaLabel=!1;propagatedRootLabel=null;lastInferredAriaLabel="";trackY;thumbY;trackX;thumbX;resizeObserver;mutationObserver;observedChildren=new Set;hideTimer;scrollEndFallbackTimer;rafId=null;resizeRafId=null;abortController=new AbortController;dragAbortController;activeScrollToController;supportsScrollEnd=typeof window<"u"&&"onscrollend"in window;cachedMaxTop=0;cachedMaxLeft=0;cachedTrackHeight=0;cachedThumbHeight=0;cachedTrackWidth=0;cachedThumbWidth=0;isDragging=!1;dragAxis;dragPointerId;dragStartPos=0;dragStartScroll=0;atBottom=!1;atTop=!0;atRight=!1;atLeft=!0;boundOnScroll;boundOnScrollEnd;boundOnMouseEnter;boundOnMouseLeave;boundOnFocusIn;boundOnFocusOut;boundPointerMove;boundPointerUp;constructor(t,e){super(e?.i18n);let i=null;if(typeof t=="string"){if(typeof document>"u")throw new Error("[ScrollBlock] Impossible de r\xE9soudre un s\xE9lecteur CSS sans environnement DOM (document).");try{i=document.querySelector(t)}catch{i=null}}else i=t;if(!i||typeof HTMLElement>"u"||!(i instanceof HTMLElement))throw new Error(`[ScrollBlock] \xC9l\xE9ment introuvable : "${t}".`);this.root=i,this.hasExplicitAriaLabel=!!(e?.ariaLabel||e?.i18n?.viewport);let s=e?.autoHideDelay,n=typeof s=="number"&&Number.isFinite(s)&&s>=0?Math.min(s,2147483647):1e3,r=e?.minThumbSize,o=typeof r=="number"&&Number.isFinite(r)&&r>0?r:24,a=e?.edgeThreshold,l=typeof a=="number"&&Number.isFinite(a)&&a>=0?a:10;this.options={axis:e?.axis||"y",mode:e?.mode||"custom",autoHide:e?.autoHide??!0,autoHideDelay:n,alwaysVisible:e?.alwaysVisible??!1,scrollShadows:e?.scrollShadows??!1,ariaLabel:e?.ariaLabel||this.t("viewport"),i18n:e?.i18n||{},minThumbSize:o,edgeThreshold:l,onScroll:e?.onScroll||(()=>{}),onScrollEnd:e?.onScrollEnd||(()=>{}),onTotalScroll:e?.onTotalScroll||(()=>{}),onTotalScrollBack:e?.onTotalScrollBack||(()=>{}),audit:e?.audit??!0},this.boundOnScroll=this.handleScroll.bind(this),this.boundOnScrollEnd=this.handleScrollEnd.bind(this),this.boundOnMouseEnter=this.handleMouseEnter.bind(this),this.boundOnMouseLeave=this.handleMouseLeave.bind(this),this.boundOnFocusIn=this.handleFocusIn.bind(this),this.boundOnFocusOut=this.handleFocusOut.bind(this),this.boundPointerMove=this.handlePointerMove.bind(this),this.boundPointerUp=this.handlePointerUp.bind(this),this.viewport=this.setupViewport(),this.setupAccessibility(),this.setupScrollbars(),this.setupEventListeners(),this.setupObserver(),this.update(),this.runAuditWarning(this.options.audit)}setupViewport(){this.root.classList.add("wulf-scrollblock",`wulf-scrollblock--axis-${this.options.axis}`),this.options.scrollShadows&&this.root.classList.add("wulf-scrollblock--shadows"),this.options.mode==="native"&&this.root.classList.add("wulf-scrollblock--native"),this.options.alwaysVisible&&this.root.classList.add("is-always-visible"),this.options.axis==="both"&&this.root.classList.add("has-both-axes");let t=this.root.querySelector(":scope > .wulf-scrollblock-viewport");if(t)return t;let e=Array.from(this.root.childNodes),i=document.createElement("div");i.className="wulf-scrollblock-viewport",this.root.appendChild(i);for(let s of e)_(i,s,null);return this.createdViewport=!0,i}setupAccessibility(){this.viewport.id||(Le+=1,this.viewport.id=`wulf-scrollblock-vp-${Le}`,this.wasIdGenerated=!0),this.viewport.hasAttribute("role")||(this.viewport.setAttribute("role","region"),this.wasRoleInferred=!0);let t=this.root.getAttribute("aria-labelledby")?.trim(),e=this.root.getAttribute("aria-label")?.trim();if(t?(this.hasRootAriaLabel=!0,!this.hasExplicitAriaLabel&&!this.viewport.hasAttribute("aria-labelledby")&&!this.viewport.hasAttribute("aria-label")&&(this.viewport.setAttribute("aria-labelledby",t),this.propagatedRootLabel="aria-labelledby")):e&&(this.hasRootAriaLabel=!0,!this.hasExplicitAriaLabel&&!this.viewport.hasAttribute("aria-label")&&!this.viewport.hasAttribute("aria-labelledby")&&(this.viewport.setAttribute("aria-label",e),this.propagatedRootLabel="aria-label")),this.hasExplicitAriaLabel&&!this.viewport.hasAttribute("aria-label"))this.viewport.setAttribute("aria-label",this.options.ariaLabel),this.lastInferredAriaLabel=this.options.ariaLabel,this.wasAriaLabelInferred=!0;else if(!this.viewport.hasAttribute("aria-label")&&!this.viewport.hasAttribute("aria-labelledby")){let i=this.t("viewport");this.viewport.setAttribute("aria-label",i),this.lastInferredAriaLabel=i,this.wasAriaLabelInferred=!0}}syncAccessibilityLabels(){if(this.wasAriaLabelInferred&&!this.hasExplicitAriaLabel&&this.viewport.getAttribute("aria-label")===this.lastInferredAriaLabel){let e=this.t("viewport");this.viewport.setAttribute("aria-label",e),this.lastInferredAriaLabel=e,this.options.ariaLabel=e}this.thumbY&&this.thumbY.setAttribute("aria-label",this.t("verticalThumb")),this.thumbX&&this.thumbX.setAttribute("aria-label",this.t("horizontalThumb"))}setupScrollbars(){this.options.mode!=="native"&&((this.options.axis==="y"||this.options.axis==="both")&&(this.trackY=document.createElement("div"),this.trackY.className="wulf-scrollblock-track wulf-scrollblock-vertical",this.thumbY=document.createElement("div"),this.thumbY.className="wulf-scrollblock-thumb",this.thumbY.setAttribute("role","scrollbar"),this.thumbY.setAttribute("aria-orientation","vertical"),this.thumbY.setAttribute("aria-controls",this.viewport.id),this.thumbY.setAttribute("aria-valuenow","0"),this.thumbY.setAttribute("aria-valuemin","0"),this.thumbY.setAttribute("aria-valuemax","100"),this.thumbY.setAttribute("aria-label",this.t("verticalThumb")),this.trackY.appendChild(this.thumbY),this.root.appendChild(this.trackY),this.attachTrackListeners(this.trackY,this.thumbY,"y")),(this.options.axis==="x"||this.options.axis==="both")&&(this.trackX=document.createElement("div"),this.trackX.className="wulf-scrollblock-track wulf-scrollblock-horizontal",this.thumbX=document.createElement("div"),this.thumbX.className="wulf-scrollblock-thumb",this.thumbX.setAttribute("role","scrollbar"),this.thumbX.setAttribute("aria-orientation","horizontal"),this.thumbX.setAttribute("aria-controls",this.viewport.id),this.thumbX.setAttribute("aria-valuenow","0"),this.thumbX.setAttribute("aria-valuemin","0"),this.thumbX.setAttribute("aria-valuemax","100"),this.thumbX.setAttribute("aria-label",this.t("horizontalThumb")),this.trackX.appendChild(this.thumbX),this.root.appendChild(this.trackX),this.attachTrackListeners(this.trackX,this.thumbX,"x")))}isRtl(){return typeof window<"u"&&window.getComputedStyle(this.viewport).direction==="rtl"}attachTrackListeners(t,e,i){let{signal:s}=this.abortController;e.addEventListener("pointerdown",n=>{if(n.button!==0)return;n.preventDefault(),n.stopPropagation(),this.dragAbortController?.abort(),this.dragAbortController=new AbortController;let r=this.dragAbortController.signal;this.isDragging=!0,this.dragAxis=i,this.dragPointerId=n.pointerId,this.dragStartPos=i==="y"?n.clientY:n.clientX,this.dragStartScroll=i==="y"?this.viewport.scrollTop:this.viewport.scrollLeft;try{e.setPointerCapture(n.pointerId)}catch{}e.classList.add("is-active"),this.root.classList.add("is-dragging"),typeof window<"u"&&(window.addEventListener("pointermove",this.boundPointerMove,{signal:r}),window.addEventListener("pointerup",this.boundPointerUp,{signal:r}),window.addEventListener("pointercancel",this.boundPointerUp,{signal:r})),e.addEventListener("lostpointercapture",this.boundPointerUp,{signal:r})},{signal:s}),e.addEventListener("keydown",n=>{if(n.ctrlKey||n.altKey||n.metaKey)return;let r=40,o=i==="y"?Math.max(r,Math.round(this.viewport.clientHeight*.9)):Math.max(r,Math.round(this.viewport.clientWidth*.9)),a=i==="y"?this.cachedMaxTop:this.cachedMaxLeft;if(a<=0)return;let l=i==="x"&&this.isRtl(),c=i==="y"?this.viewport.scrollTop:this.viewport.scrollLeft,h=null;if(i==="y")switch(n.key){case"ArrowDown":h=c+r;break;case"ArrowUp":h=c-r;break;case"PageDown":h=c+o;break;case"PageUp":h=c-o;break;case" ":h=c+(n.shiftKey?-o:o);break;case"Home":h=0;break;case"End":h=a;break}else switch(n.key){case"ArrowRight":h=c+r;break;case"ArrowLeft":h=c-r;break;case"PageDown":h=c+(l?-o:o);break;case"PageUp":h=c+(l?o:-o);break;case" ":h=c+(n.shiftKey?l?o:-o:l?-o:o);break;case"Home":h=0;break;case"End":h=l?-a:a;break}h!==null&&(n.preventDefault(),n.stopPropagation(),this.scrollTo(i==="y"?{top:h}:{left:h},{smooth:!1}),this.syncThumbs())},{signal:s}),t.addEventListener("pointerdown",n=>{if(n.button!==0||n.target===e)return;n.preventDefault();let r=i==="x"&&this.isRtl(),o=t.getBoundingClientRect(),a=i==="y"?n.clientY-o.top:r?o.right-n.clientX:n.clientX-o.left,l=i==="y"?o.height:o.width;if(l<=0)return;let c=i==="y"?this.cachedMaxTop:this.cachedMaxLeft,h=Math.max(0,Math.min(1,a/l)),p=r?-(h*c):h*c;this.scrollTo(i==="y"?{top:p}:{left:p},{smooth:!0})},{signal:s})}setupEventListeners(){let{signal:t}=this.abortController;this.viewport.addEventListener("scroll",this.boundOnScroll,{passive:!0,signal:t}),this.supportsScrollEnd&&this.viewport.addEventListener("scrollend",this.boundOnScrollEnd,{passive:!0,signal:t}),this.options.mode!=="native"&&this.options.autoHide&&!this.options.alwaysVisible&&(this.root.addEventListener("mouseenter",this.boundOnMouseEnter,{signal:t}),this.root.addEventListener("mouseleave",this.boundOnMouseLeave,{signal:t}),this.root.addEventListener("focusin",this.boundOnFocusIn,{signal:t}),this.root.addEventListener("focusout",this.boundOnFocusOut,{signal:t}))}setupObserver(){let t=()=>{this.isDestroyed||this.resizeRafId!==null||typeof window>"u"||(this.resizeRafId=window.requestAnimationFrame(()=>{this.resizeRafId=null,this.isDestroyed||this.update()}))};if(typeof ResizeObserver<"u"){this.resizeObserver=new ResizeObserver(t),this.resizeObserver.observe(this.root),this.resizeObserver.observe(this.viewport);for(let e of Array.from(this.viewport.children))this.resizeObserver.observe(e),this.observedChildren.add(e)}typeof MutationObserver<"u"&&(this.mutationObserver=new MutationObserver(t),this.mutationObserver.observe(this.viewport,{childList:!0}))}handlePointerMove(t){if(!this.isDragging||!this.dragAxis||this.dragPointerId!==void 0&&t.pointerId!==this.dragPointerId)return;let e=this.dragAxis==="y",i=(e?t.clientY:t.clientX)-this.dragStartPos,s=e?this.cachedTrackHeight:this.cachedTrackWidth,n=e?this.cachedThumbHeight:this.cachedThumbWidth,r=e?this.cachedMaxTop:this.cachedMaxLeft,o=s-n;if(o<=0||r<=0)return;let a=r/o,l=this.dragStartScroll+i*a;e?this.viewport.scrollTop=Math.max(0,Math.min(r,l)):this.isRtl()?this.viewport.scrollLeft=Math.max(-r,Math.min(0,l)):this.viewport.scrollLeft=Math.max(0,Math.min(r,l))}handlePointerUp(t){if(this.isDragging&&!(t&&t.type!=="lostpointercapture"&&this.dragPointerId!==void 0&&t.pointerId!==this.dragPointerId)){if(this.dragPointerId!==void 0){let e=this.dragAxis==="y"?this.thumbY:this.thumbX;try{e&&e.hasPointerCapture(this.dragPointerId)&&e.releasePointerCapture(this.dragPointerId)}catch{}}this.dragAbortController?.abort(),this.dragAbortController=void 0,this.isDragging=!1,this.dragAxis=void 0,this.dragPointerId=void 0,this.thumbY?.classList.remove("is-active"),this.thumbX?.classList.remove("is-active"),this.root.classList.remove("is-dragging"),this.scheduleAutoHide()}}getScrollInfo(){let{scrollTop:t,scrollLeft:e}=this.viewport,i=this.cachedMaxTop,s=this.cachedMaxLeft,r=this.isRtl()?Math.max(0,-e):Math.max(0,e),o=i>0?Math.max(0,Math.min(1,t/i)):0,a=s>0?Math.max(0,Math.min(1,r/s)):0;return{top:t,left:e,maxTop:i,maxLeft:s,progressY:Math.round(o*100),progressX:Math.round(a*100)}}handleScroll(){this.scheduleSyncThumbs();let t=this.getScrollInfo(),{top:e,left:i,maxTop:s,maxLeft:n}=t;try{this.options.onScroll(t)}catch(o){console.error("[Wulf.Scroll] Erreur dans onScroll:",o)}let r=this.options.edgeThreshold;if(s>0){let o=e>=s-r,a=e<=r;if(o&&!this.atBottom)try{this.options.onTotalScroll("bottom")}catch(l){console.error("[Wulf.Scroll] Erreur dans onTotalScroll:",l)}if(a&&!this.atTop)try{this.options.onTotalScrollBack("top")}catch(l){console.error("[Wulf.Scroll] Erreur dans onTotalScrollBack:",l)}this.atBottom=o,this.atTop=a}if(n>0){let o=this.isRtl(),a=o?i>=-r:i>=n-r,l=o?i<=-n+r:i<=r;if(a&&!this.atRight)try{this.options.onTotalScroll("right")}catch(c){console.error("[Wulf.Scroll] Erreur dans onTotalScroll:",c)}if(l&&!this.atLeft)try{this.options.onTotalScrollBack("left")}catch(c){console.error("[Wulf.Scroll] Erreur dans onTotalScrollBack:",c)}this.atRight=a,this.atLeft=l}this.options.mode!=="native"&&this.options.autoHide&&!this.options.alwaysVisible&&(this.clearAutoHideTimer(),this.root.classList.add("is-scrolling"),this.supportsScrollEnd||this.scheduleAutoHide()),!this.supportsScrollEnd&&typeof window<"u"&&(this.scrollEndFallbackTimer!==void 0&&window.clearTimeout(this.scrollEndFallbackTimer),this.scrollEndFallbackTimer=window.setTimeout(()=>{this.scrollEndFallbackTimer=void 0,this.handleScrollEnd()},150))}handleScrollEnd(){try{this.options.onScrollEnd(this.getScrollInfo())}catch(t){console.error("[Wulf.Scroll] Erreur dans onScrollEnd:",t)}this.options.mode!=="native"&&this.options.autoHide&&!this.options.alwaysVisible&&this.scheduleAutoHide()}scheduleSyncThumbs(){this.options.mode==="native"||this.isDestroyed||typeof window>"u"||this.rafId===null&&(this.rafId=window.requestAnimationFrame(()=>{this.rafId=null,this.isDestroyed||this.syncThumbs()}))}syncThumbs(){if(this.options.mode==="native"||this.isDestroyed)return;let{scrollTop:t,scrollLeft:e}=this.viewport;if(this.thumbY&&this.trackY){let i=this.cachedMaxTop,s=this.cachedTrackHeight-this.cachedThumbHeight;if(i>0){let n=Math.max(0,Math.min(1,t/i));if(this.thumbY.setAttribute("aria-valuenow",String(Math.round(n*100))),s>0){let r=Math.max(0,Math.min(s,n*s));this.thumbY.style.setProperty("--scrollblock-thumb-y",`${r}px`)}}else this.thumbY.setAttribute("aria-valuenow","0"),this.thumbY.style.setProperty("--scrollblock-thumb-y","0px")}if(this.thumbX&&this.trackX){let i=this.cachedMaxLeft,s=this.cachedTrackWidth-this.cachedThumbWidth;if(i>0){let n=this.isRtl(),r=n?Math.max(0,-e):Math.max(0,e),o=Math.max(0,Math.min(1,r/i));if(this.thumbX.setAttribute("aria-valuenow",String(Math.round(o*100))),s>0){let a=Math.max(0,Math.min(s,o*s)),l=n?-a:a;this.thumbX.style.setProperty("--scrollblock-thumb-x",`${l}px`)}}else this.thumbX.setAttribute("aria-valuenow","0"),this.thumbX.style.setProperty("--scrollblock-thumb-x","0px")}}handleMouseEnter(){this.root.classList.add("is-visible"),this.clearAutoHideTimer()}handleMouseLeave(){this.scheduleAutoHide()}handleFocusIn(){this.root.classList.add("is-visible"),this.clearAutoHideTimer()}handleFocusOut(){this.scheduleAutoHide()}clearAutoHideTimer(){this.hideTimer&&typeof window<"u"&&window.clearTimeout(this.hideTimer),this.hideTimer=void 0}scheduleAutoHide(){this.options.alwaysVisible||!this.options.autoHide||this.isDragging||typeof window>"u"||(this.clearAutoHideTimer(),this.hideTimer=window.setTimeout(()=>{this.root.classList.remove("is-scrolling"),this.root.classList.remove("is-visible")},this.options.autoHideDelay))}update(){if(this.isDestroyed)return;if(this.syncAccessibilityLabels(),this.resizeObserver){let d=new Set(Array.from(this.viewport.children));for(let f of this.observedChildren)d.has(f)||(this.resizeObserver.unobserve(f),this.observedChildren.delete(f));for(let f of d)this.observedChildren.has(f)||(this.resizeObserver.observe(f),this.observedChildren.add(f))}let{scrollHeight:t,clientHeight:e,scrollWidth:i,clientWidth:s}=this.viewport,n=this.trackY?this.trackY.clientHeight:0,r=this.trackX?this.trackX.clientWidth:0,o=this.thumbY&&typeof window<"u"&&parseFloat(window.getComputedStyle(this.thumbY).minBlockSize)||0,a=this.thumbX&&typeof window<"u"&&parseFloat(window.getComputedStyle(this.thumbX).minInlineSize)||0;this.cachedMaxTop=Math.max(0,t-e),this.cachedMaxLeft=Math.max(0,i-s),this.cachedTrackHeight=n,this.cachedTrackWidth=r;let l=t>e,c=i>s,h=this.cachedThumbHeight;if(this.trackY&&this.thumbY&&l&&t>0){let d=Math.max(this.options.minThumbSize,o);h=Math.max(d,n*(e/t)),this.cachedThumbHeight=h}let p=this.cachedThumbWidth;if(this.trackX&&this.thumbX&&c&&i>0){let d=Math.max(this.options.minThumbSize,a);p=Math.max(d,r*(s/i)),this.cachedThumbWidth=p}this.root.classList.toggle("has-scroll-y",l),this.root.classList.toggle("has-scroll-x",c),l||c?this.viewport.setAttribute("tabindex","0"):this.viewport.removeAttribute("tabindex"),this.trackY&&this.thumbY&&(this.trackY.hidden=!l,l?(this.thumbY.setAttribute("tabindex","0"),this.thumbY.style.height=`${h}px`):this.thumbY.removeAttribute("tabindex")),this.trackX&&this.thumbX&&(this.trackX.hidden=!c,c?(this.thumbX.setAttribute("tabindex","0"),this.thumbX.style.width=`${p}px`):this.thumbX.removeAttribute("tabindex")),this.syncThumbs()}scrollTo(t,e){if(this.isDestroyed)return Promise.resolve();let i=typeof t=="object"&&t!==null&&!(t instanceof HTMLElement)?t.smooth:void 0,n=(e?.smooth??i??!0)&&!rt()?"smooth":"auto",r=this.isRtl(),{scrollHeight:o,clientHeight:a,scrollWidth:l,clientWidth:c,scrollTop:h,scrollLeft:p}=this.viewport,d=Math.max(0,o-a),f=Math.max(0,l-c);this.cachedMaxTop=d,this.cachedMaxLeft=f;let m,g;if(typeof t=="number")m=t;else if(typeof t=="string")switch(t){case"top":m=0;break;case"bottom":m=d;break;case"left":g=r?-f:0;break;case"right":g=r?0:f;break;default:{if(/^-?\d+(\.\d+)?%$/.test(t.trim())){let E=Math.max(0,Math.min(100,parseFloat(t.trim())))/100;this.options.axis==="x"?g=r?-f*E:f*E:this.options.axis==="both"?(m=d*E,g=r?-f*E:f*E):m=d*E;break}let I=null;try{I=this.viewport.querySelector(t)}catch{I=null}if(I){let E=this.viewport.getBoundingClientRect(),C=I.getBoundingClientRect();m=C.top-E.top-this.viewport.clientTop+h,g=C.left-E.left-this.viewport.clientLeft+p}break}}else if(t instanceof HTMLElement){if(t.isConnected&&this.viewport.contains(t)){let I=this.viewport.getBoundingClientRect(),E=t.getBoundingClientRect();m=E.top-I.top-this.viewport.clientTop+h,g=E.left-I.left-this.viewport.clientLeft+p}}else typeof t=="object"&&t!==null&&(m=t.top,g=t.left);let y=m!==void 0&&Number.isFinite(m)?Math.max(0,Math.min(d,m)):void 0,v=r?-f:0,b=r?0:f,w=g!==void 0&&Number.isFinite(g)?Math.max(v,Math.min(b,g)):void 0,S=y??h,T=w??p;if(Math.abs(S-h)<=1&&Math.abs(T-p)<=1)return Promise.resolve();this.activeScrollToController?.abort();let A=new AbortController;this.activeScrollToController=A;let x=this.viewport.scrollTo({top:y,left:w,behavior:n});return x instanceof Promise?x.then(()=>{this.activeScrollToController===A&&(this.activeScrollToController=void 0)}):n!=="smooth"?(this.activeScrollToController===A&&(this.activeScrollToController=void 0),Promise.resolve()):new Promise(I=>{let E=!1,C,k,K=()=>{E||(E=!0,typeof window<"u"&&(C!==void 0&&window.clearTimeout(C),k!==void 0&&window.clearTimeout(k)),this.activeScrollToController===A&&(this.activeScrollToController=void 0),A.abort(),I())};if(A.signal.addEventListener("abort",K,{once:!0}),this.abortController.signal.addEventListener("abort",K,{once:!0,signal:A.signal}),this.supportsScrollEnd)this.viewport.addEventListener("scrollend",K,{once:!0,signal:A.signal});else if(typeof window<"u"){let L=()=>{C!==void 0&&window.clearTimeout(C),C=window.setTimeout(K,150)};this.viewport.addEventListener("scroll",L,{passive:!0,signal:A.signal}),L()}typeof window<"u"?k=window.setTimeout(K,2500):K()})}audit(){let t=[],e=this.checkAriaIdReferences(this.viewport,"aria-labelledby",t,!0),i=this.checkAriaIdReferences(this.root,"aria-labelledby",t,!0),s=e||i,n=this.root.getAttribute("aria-label")?.trim(),r=!this.wasAriaLabelInferred&&!!this.viewport.getAttribute("aria-label")?.trim();return!this.hasExplicitAriaLabel&&!this.hasRootAriaLabel&&!r&&!n&&!s&&t.push("Libell\xE9 contextuel manquant : d\xE9finissez l'option ariaLabel (ou un attribut aria-label / aria-labelledby sur le conteneur) pour d\xE9crire la zone d\xE9filable (WCAG 4.1.2)."),this.options.mode!=="native"&&this.options.minThumbSize<24&&t.push(`Taille minimale du curseur insuffisante (minThumbSize: ${this.options.minThumbSize}px) : utilisez au moins 24px pour respecter WCAG 2.5.8.`),(this.root.tabIndex>0||this.viewport.tabIndex>0)&&t.push('Attribut tabindex > 0 d\xE9tect\xE9 sur la zone d\xE9filable : utilisez uniquement tabindex="0" ou "-1" (WCAG 2.4.3).'),this.root.getAttribute("role")==="region"&&this.viewport.getAttribute("role")==="region"&&t.push('Landmark role="region" redondant : \xE9vitez de d\xE9clarer role="region" \xE0 la fois sur le conteneur racine et sur le viewport interne.'),t}getAuditPrefix(){return"Wulf.Scroll"}getAuditTargetLabel(){return this.root.id?`#${this.root.id}`:`<${this.root.tagName.toLowerCase()}.wulf-scrollblock>`}destroy(){if(!this.isDestroyed)if(this.isDragging&&this.handlePointerUp(),this.isDestroyed=!0,this.clearAutoHideTimer(),typeof window<"u"&&(this.scrollEndFallbackTimer!==void 0&&window.clearTimeout(this.scrollEndFallbackTimer),this.rafId!==null&&window.cancelAnimationFrame(this.rafId),this.resizeRafId!==null&&window.cancelAnimationFrame(this.resizeRafId)),this.scrollEndFallbackTimer=void 0,this.rafId=null,this.resizeRafId=null,this.activeScrollToController?.abort(),this.activeScrollToController=void 0,this.dragAbortController?.abort(),this.dragAbortController=void 0,this.abortController.abort(),this.resizeObserver&&this.resizeObserver.disconnect(),this.mutationObserver&&(this.mutationObserver.disconnect(),this.mutationObserver=void 0),this.observedChildren.clear(),this.trackY?.remove(),this.trackX?.remove(),this.root.classList.remove("wulf-scrollblock","wulf-scrollblock--native","wulf-scrollblock--shadows","wulf-scrollblock--axis-y","wulf-scrollblock--axis-x","wulf-scrollblock--axis-both","has-scroll-y","has-scroll-x","has-both-axes","is-visible","is-scrolling","is-dragging","is-always-visible"),this.createdViewport&&this.viewport.parentElement===this.root){for(;this.viewport.firstChild;)_(this.root,this.viewport.firstChild,this.viewport);this.viewport.remove()}else this.viewport.removeAttribute("tabindex"),this.wasIdGenerated&&this.viewport.removeAttribute("id"),this.wasRoleInferred&&this.viewport.getAttribute("role")==="region"&&this.viewport.removeAttribute("role"),this.propagatedRootLabel&&this.viewport.removeAttribute(this.propagatedRootLabel),this.wasAriaLabelInferred&&this.viewport.getAttribute("aria-label")===this.lastInferredAriaLabel&&this.viewport.removeAttribute("aria-label")}};var mi={ScrollBlock:lt,i18n:Ct};var gi=lt;var ee={};$(ee,{LayoutEngine:()=>X,LocalizedComponent:()=>R,Masonry:()=>pt,createI18nManager:()=>B,default:()=>vi,masonryEn:()=>te,masonryFr:()=>Qt,masonryI18n:()=>Vt});var X=class{static parseGutter(t){if(typeof t=="number"){let e=Number.isFinite(t)?Math.max(0,t):0;return{x:e,y:e}}if(t&&typeof t=="object"){let e=Number(t.x),i=Number(t.y);return{x:Number.isFinite(e)?Math.max(0,e):0,y:Number.isFinite(i)?Math.max(0,i):0}}return{x:0,y:0}}static resolveColumnWidth(t,e,i){if(typeof i=="number"&&Number.isFinite(i)&&i>0)return i;if(typeof i=="string"){let n=i.trim();if(/^\d+(\.\d+)?(px|%)?$/i.test(n)){let r=parseFloat(n);if(Number.isFinite(r)&&r>0)if(n.endsWith("%")){let a=t.getBoundingClientRect().width*r/100;if(a>0)return a}else return r}else if(n){let r=null;try{r=t.querySelector(n)}catch{r=null}if(r){let a=r.getBoundingClientRect().width;if(Number.isFinite(a)&&a>0)return a}let o=parseFloat(n);if(Number.isFinite(o)&&o>0)return o}}if(i instanceof HTMLElement){let n=i.getBoundingClientRect().width;if(n>0)return n}if(e){let n=e.getBoundingClientRect().width;if(n>0)return n}let s=t.getBoundingClientRect().width;return s>0?s:200}static getItemSpan(t,e,i,s){let n=t.getAttribute("data-masonry-span")||t.dataset.masonrySpan;if(n){let r=parseInt(n,10);if(!isNaN(r)&&r>0)return Math.min(s,r)}for(let r of t.classList){let o=/^(?:span|col-span)-(\d+)$/.exec(r);if(o&&o[1]){let a=parseInt(o[1],10);if(!isNaN(a)&&a>0)return Math.min(s,a)}}return 1}static calculate(t,e,i){let n=t.getBoundingClientRect().width,{x:r,y:o}=this.parseGutter(i.gutter);if(n<=0||e.length===0)return{cols:1,colWidth:n,gutterX:r,gutterY:o,containerHeight:0,containerWidth:n,positions:[]};let a=e[0]||null,l=this.resolveColumnWidth(t,a,i.columnWidth),c=l+r,h=c>0?Math.floor((n+r)/c):1;!Number.isFinite(h)||h<1?h=1:h>1e3&&(h=1e3),!i.columnWidth&&h>1&&(l=(n-(h-1)*r)/h);let p=i.fitWidth?h*l+(h-1)*r:void 0,d=new Array(h).fill(0),f=[],m=e.map(w=>{let S=w.classList.contains("wulf-masonry-item--hidden")&&w.offsetHeight>0?w.offsetHeight:w.getBoundingClientRect().height;return S>0?S:50}),g=typeof window<"u"&&typeof window.getComputedStyle=="function"&&window.getComputedStyle(t).direction==="rtl",y=0;for(let w=0;w<e.length;w++){let S=e[w],T=m[w],A=this.getItemSpan(S,l,r,h),x=0,I=0;if(i.horizontalOrder){y+A>h&&(y=0),x=y;let M=0;for(let D=0;D<A;D++)d[x+D]>M&&(M=d[x+D]);I=M,y=(x+A)%h}else if(A===1){let M=d[0];x=0;for(let D=1;D<h;D++)d[D]<M&&(M=d[D],x=D);I=M}else{let M=1/0;x=0;for(let D=0;D<=h-A;D++){let U=0;for(let ht=0;ht<A;ht++)d[D+ht]>U&&(U=d[D+ht]);U<M&&(M=U,x=D)}I=M}let E=A*l+(A-1)*r,C=p!==void 0?p:n,k=x*(l+r),K=g?Math.max(0,C-k-E):k;f.push({element:S,x:K,y:I,width:E,height:T,column:x,span:A});let L=I+T+o;for(let M=0;M<A;M++)d[x+M]=L}let v=0;for(let w=0;w<h;w++)d[w]>v&&(v=d[w]);let b=Math.max(0,v>0?v-o:0);return{cols:h,colWidth:l,gutterX:r,gutterY:o,containerHeight:b,containerWidth:n,fittedWidth:p,positions:f}}};var Qt={gallery:"Galerie en grille asym\xE9trique"};var te={gallery:"Masonry grid gallery"};var Vt=B("fr",{fr:Qt,en:te});var bi=new Set(["UL","OL","MAIN","NAV","ASIDE","ARTICLE","SECTION"]),pt=class extends R{static _i18n=Vt;static i18n=Vt;root;isNativeCSSGrid=!1;_items=[];options;resizeObserver=null;itemResizeObserver=null;observedItems=new Set;observedItemHeights=new WeakMap;removingItems=new Set;layoutRafId=null;lastObservedWidth=0;isDestroyed=!1;hasExplicitAriaRole=!1;wasRoleInferred=!1;wasAriaLabelInferred=!1;hasExplicitAriaLabel=!1;lastInferredAriaLabel="";abortController=new AbortController;watchedImages=new WeakSet;originalContainerStyles;constructor(t,e={}){if(super(e.i18n),typeof t=="string"){if(typeof document>"u")throw new Error("[Wulf.Masonry] Impossible de r\xE9soudre un s\xE9lecteur CSS sans environnement DOM (document).");let s=null;try{s=document.querySelector(t)}catch{s=null}if(!s)throw new Error(`[Wulf.Masonry] Conteneur introuvable pour le s\xE9lecteur : "${t}"`);this.root=s}else if(typeof HTMLElement<"u"&&t instanceof HTMLElement)this.root=t;else throw new Error("[Wulf.Masonry] Cible invalide : fournissez un \xE9l\xE9ment HTMLElement ou un s\xE9lecteur valide.");this.originalContainerStyles={height:this.root.style.height,width:this.root.style.width},this.hasExplicitAriaRole=!!e.ariaRole,this.hasExplicitAriaLabel=!!(e.ariaLabel||e.i18n?.gallery),this.options={itemSelector:e.itemSelector||"> *",columnWidth:e.columnWidth??0,gutter:e.gutter??0,percentPosition:!!e.percentPosition,fitWidth:!!e.fitWidth,horizontalOrder:!!e.horizontalOrder,transitionDuration:e.transitionDuration!==void 0?e.transitionDuration:300,stagger:e.stagger||0,resize:e.resize!==!1,autoImages:e.autoImages!==!1,useNativeCSSGrid:e.useNativeCSSGrid!==!1,ariaRole:e.ariaRole||"region",ariaLabel:e.ariaLabel||this.t("gallery"),i18n:e.i18n||{},onLayout:e.onLayout||(()=>{}),onItemPlaced:e.onItemPlaced||(()=>{}),audit:e.audit??!0};let i=typeof CSS<"u"&&typeof CSS.supports=="function"&&(CSS.supports("display","grid-lanes")||CSS.supports("grid-template-rows","masonry"));this.options.useNativeCSSGrid&&i?(this.isNativeCSSGrid=!0,this.root.classList.add("wulf-masonry","wulf-masonry--native"),this.syncNativeGridVariables()):this.root.classList.add("wulf-masonry"),this.initAccessibility(),this.applyTransitionDuration(),this.reloadItems(),this.initObservers(),this.initImages(),this.layout(),this.runAuditWarning(this.options.audit)}get items(){return[...this._items]}initAccessibility(){this.options.ariaRole&&!this.root.hasAttribute("role")&&(this.hasExplicitAriaRole||!bi.has(this.root.tagName))&&(this.root.setAttribute("role",this.options.ariaRole),this.wasRoleInferred=!0);let t=this.hasExplicitAriaLabel?this.options.ariaLabel:this.t("gallery");t&&!this.root.hasAttribute("aria-label")&&!this.root.hasAttribute("aria-labelledby")&&(this.root.setAttribute("aria-label",t),this.lastInferredAriaLabel=t,this.wasAriaLabelInferred=!0)}syncAccessibilityLabels(){if(this.wasAriaLabelInferred&&!this.hasExplicitAriaLabel&&this.root.getAttribute("aria-label")===this.lastInferredAriaLabel){let e=this.t("gallery");this.root.setAttribute("aria-label",e),this.lastInferredAriaLabel=e,this.options.ariaLabel=e}}applyTransitionDuration(){let t=this.options.transitionDuration,e="300ms";typeof t=="number"&&Number.isFinite(t)&&t>=0?e=`${Math.min(t,6e4)}ms`:typeof t=="string"&&/^\s*(?:\d+(?:\.\d+)?|\.\d+)(ms|s)\s*$/i.test(t)&&(e=Ft(t,300,6e4)>=6e4?"60000ms":t.trim()),this.root.style.setProperty("--wulf-masonry-duration",e)}reloadItems(){if(this.isDestroyed)return;let t=[];if(this.options.itemSelector==="> *")t=Array.from(this.root.children).filter(e=>e instanceof HTMLElement&&!e.hasAttribute("data-masonry-ignore")&&!this.removingItems.has(e));else try{let e=this.options.itemSelector.trim(),i=e.startsWith(">")?`:scope ${e}`:e;t=Array.from(this.root.querySelectorAll(i)).filter(s=>s.parentElement===this.root&&!s.hasAttribute("data-masonry-ignore")&&!this.removingItems.has(s))}catch{t=Array.from(this.root.children).filter(e=>e instanceof HTMLElement&&!e.hasAttribute("data-masonry-ignore")&&!this.removingItems.has(e))}if(this.itemResizeObserver){let e=new Set(t);for(let i of this.observedItems)e.has(i)||(this.itemResizeObserver.unobserve(i),this.observedItems.delete(i),this.observedItemHeights.delete(i))}this._items=t;for(let e of this._items)e.classList.add("wulf-masonry-item"),this.itemResizeObserver&&!this.observedItems.has(e)&&(this.itemResizeObserver.observe(e),this.observedItems.add(e))}initObservers(){if(!(!this.options.resize||typeof ResizeObserver>"u")){this.lastObservedWidth=this.root.getBoundingClientRect().width,this.resizeObserver=new ResizeObserver(t=>{for(let e of t){let i=e.contentRect.width;Math.abs(i-this.lastObservedWidth)>=1&&(this.lastObservedWidth=i,this.scheduleLayout())}}),this.resizeObserver.observe(this.root),this.itemResizeObserver=new ResizeObserver(t=>{let e=!1;for(let i of t){let s=i.borderBoxSize?.[0]?.blockSize??i.contentRect.height,n=this.observedItemHeights.get(i.target);(n===void 0||Math.abs(s-n)>=1)&&(this.observedItemHeights.set(i.target,s),n!==void 0&&(e=!0))}e&&this.scheduleLayout()});for(let t of this._items)this.itemResizeObserver.observe(t),this.observedItems.add(t)}}syncNativeGridVariables(){let{x:t,y:e}=X.parseGutter(this.options.gutter);if(this.root.style.setProperty("--wulf-masonry-gutter-x",`${t}px`),this.root.style.setProperty("--wulf-masonry-gutter-y",`${e}px`),typeof this.options.columnWidth=="number"&&Number.isFinite(this.options.columnWidth)&&this.options.columnWidth>0)this.root.style.setProperty("--wulf-masonry-col-min",`${this.options.columnWidth}px`);else if(this.options.columnWidth instanceof HTMLElement){let i=this.options.columnWidth.getBoundingClientRect().width;i>0&&this.root.style.setProperty("--wulf-masonry-col-min",`${i}px`)}else if(typeof this.options.columnWidth=="string"&&this.options.columnWidth.trim()){let i=this.options.columnWidth.trim();if(/^\d+(\.\d+)?(px|%)?$/i.test(i)){let s=X.resolveColumnWidth(this.root,null,i);s>0&&this.root.style.setProperty("--wulf-masonry-col-min",`${s}px`)}else try{let s=this.root.querySelector(i);if(s){let n=s.getBoundingClientRect().width;n>0&&this.root.style.setProperty("--wulf-masonry-col-min",`${n}px`)}}catch{}}}initImages(){if(!this.options.autoImages)return;let t=Array.from(this.root.querySelectorAll("img"));for(let e of t)if(!e.complete&&!this.watchedImages.has(e)){this.watchedImages.add(e);let i=()=>{e.addEventListener("load",()=>{this.isDestroyed||this.scheduleLayout()},{once:!0,signal:this.abortController.signal})};typeof e.decode=="function"?e.decode().then(()=>{this.isDestroyed||this.scheduleLayout()}).catch(()=>{i()}):i()}}scheduleLayout(){if(!this.isDestroyed){if(typeof window>"u"||typeof window.requestAnimationFrame!="function"){this.layout();return}this.layoutRafId!==null&&window.cancelAnimationFrame(this.layoutRafId),this.layoutRafId=window.requestAnimationFrame(()=>{this.layoutRafId=null,this.layout()})}}layout(){if(this.isDestroyed)return;if(this.syncAccessibilityLabels(),this.isNativeCSSGrid){this.syncNativeGridVariables();for(let e of this._items)e.classList.remove("wulf-masonry-item--hidden");try{this.options.onLayout([])}catch(e){console.error("[Wulf.Masonry] Erreur dans onLayout:",e)}return}this.root.setAttribute("aria-busy","true");let t=[];try{this.options.fitWidth&&this.root.classList.contains("wulf-masonry--fit-width")&&(this.root.style.width="");let e=X.calculate(this.root,this._items,this.options);t=e.positions,this.root.style.height=`${e.containerHeight}px`,this.options.fitWidth&&e.fittedWidth!==void 0?(this.root.style.width=`${e.fittedWidth}px`,this.lastObservedWidth=e.fittedWidth,this.root.classList.add("wulf-masonry--fit-width")):this.root.classList.remove("wulf-masonry--fit-width");let i=this.options.stagger,s=typeof i=="number"&&Number.isFinite(i)&&i>0;s?this.root.style.setProperty("--wulf-masonry-stagger",`${i}ms`):this.root.style.removeProperty("--wulf-masonry-stagger");let r=!(this._items.length!==this.root.children.length)&&typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("transition-delay","calc(sibling-index() * 1ms)"),o=this.options.percentPosition&&e.containerWidth>0;for(let a=0;a<e.positions.length;a++){let l=e.positions[a],c=l.element;if(o){let h=Number((l.width/e.containerWidth*100).toFixed(4));c.style.setProperty("--wulf-masonry-w",`${h}%`)}else c.style.setProperty("--wulf-masonry-w",`${l.width}px`);c.style.setProperty("--wulf-masonry-x",`${l.x}px`),c.style.setProperty("--wulf-masonry-y",`${l.y}px`),s&&!r?c.style.setProperty("--wulf-masonry-index",String(a)):c.style.removeProperty("--wulf-masonry-index"),c.classList.remove("wulf-masonry-item--hidden"),this.observedItemHeights.set(c,l.height);try{this.options.onItemPlaced(c,l)}catch(h){console.error("[Wulf.Masonry] Erreur dans onItemPlaced:",h)}}}finally{this.root.setAttribute("aria-busy","false")}try{this.options.onLayout(t)}catch(e){console.error("[Wulf.Masonry] Erreur dans onLayout:",e)}}append(t){if(this.isDestroyed)return;let e=(Array.isArray(t)?t:[t]).filter(s=>s instanceof HTMLElement&&!s.contains(this.root));if(e.length===0)return;let i=document.createDocumentFragment();for(let s of e)this.isNativeCSSGrid?s.classList.add("wulf-masonry-item"):s.classList.add("wulf-masonry-item","wulf-masonry-item--hidden"),i.appendChild(s);this.root.appendChild(i),this.reloadItems(),this.initImages(),this.layout()}prepend(t){if(this.isDestroyed)return;let e=(Array.isArray(t)?t:[t]).filter(n=>n instanceof HTMLElement&&!n.contains(this.root));if(e.length===0)return;let i=this.root.firstChild,s=document.createDocumentFragment();for(let n of e)this.isNativeCSSGrid?n.classList.add("wulf-masonry-item"):n.classList.add("wulf-masonry-item","wulf-masonry-item--hidden"),s.appendChild(n);this.root.insertBefore(s,i),this.reloadItems(),this.initImages(),this.layout()}remove(t){if(this.isDestroyed)return;let e=(Array.isArray(t)?t:[t]).filter(r=>r instanceof HTMLElement);if(e.length===0)return;let i=()=>{if(!this.isDestroyed){for(let r of e)this.removingItems.delete(r),r.parentElement===this.root&&(this.itemResizeObserver&&(this.itemResizeObserver.unobserve(r),this.observedItems.delete(r),this.observedItemHeights.delete(r)),this.root.removeChild(r));this.reloadItems(),this.layout()}},s=H();if(s&&e.some(r=>r.contains(s))){let r=new Set(e),o=this._items.findIndex(p=>r.has(p)),a=o>=0?this._items.slice(o+1).filter(p=>!r.has(p)):[],l=o>0?this._items.slice(0,o).filter(p=>!r.has(p)).reverse():[],c=a[0]||l[0]||null,h=!1;if(c){let d=c.querySelector('a[href], button:not([disabled]), input:not([disabled]):not([type="hidden"]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])')||(c.tabIndex>=0?c:null);if(d)try{d.focus({preventScroll:!0}),h=!0}catch{h=!1}}h||s.blur?.()}for(let r of e)this.removingItems.add(r),r.setAttribute("inert",""),r.style.transitionDelay="0ms",r.classList.add("wulf-masonry-item--hidden");let n=Ft(this.options.transitionDuration,300);if(n<=0||this.isNativeCSSGrid){i();return}this.reloadItems(),this.layout(),Promise.all(e.map(r=>Dt(r,n,this.abortController.signal))).then(()=>{this.abortController.signal.aborted||i()})}audit(){let t=[],e=this.checkAriaIdReferences(this.root,"aria-labelledby",t,!0),i=!this.wasAriaLabelInferred&&!!this.root.getAttribute("aria-label")?.trim();!this.hasExplicitAriaLabel&&!i&&!e&&t.push("Libell\xE9 contextuel manquant : d\xE9finissez l'option ariaLabel (ou un attribut aria-label / aria-labelledby sur le conteneur) pour qualifier la grille (WCAG 4.1.2).");let s=Array.from(this.root.querySelectorAll("img")).filter(r=>!r.hasAttribute("alt")&&r.getAttribute("aria-hidden")!=="true");s.length>0&&t.push(`${s.length} image(s) <img> d\xE9pourvue(s) d'attribut alt : renseignez alt="description" (ou alt="" si d\xE9corative) (WCAG 1.1.1).`);let n=Array.from(this.root.querySelectorAll("[tabindex]")).filter(r=>r.tabIndex>0);return n.length>0&&t.push(`${n.length} \xE9l\xE9ment(s) avec tabindex > 0 d\xE9tect\xE9(s) : utilisez uniquement tabindex="0" ou "-1" (WCAG 2.4.3).`),!this.options.horizontalOrder&&this.root.querySelector('a[href], button, input, select, textarea, [tabindex="0"]')!==null&&t.push("Grille interactive avec horizontalOrder: false : l'ordre visuel peut diverger de l'ordre de tabulation ; envisagez horizontalOrder: true (WCAG 1.3.2 / 2.4.3)."),t}getAuditPrefix(){return"Wulf.Masonry"}getAuditTargetLabel(){return this.root.id?`#${this.root.id}`:`<${this.root.tagName.toLowerCase()}.wulf-masonry>`}destroy(){if(!this.isDestroyed){this.isDestroyed=!0,this.abortController.abort(),this.layoutRafId!==null&&(typeof window<"u"&&typeof window.cancelAnimationFrame=="function"&&window.cancelAnimationFrame(this.layoutRafId),this.layoutRafId=null),this.resizeObserver&&(this.resizeObserver.disconnect(),this.resizeObserver=null),this.itemResizeObserver&&(this.itemResizeObserver.disconnect(),this.itemResizeObserver=null),this.root.classList.remove("wulf-masonry","wulf-masonry--native","wulf-masonry--fit-width"),this.root.removeAttribute("aria-busy"),this.wasRoleInferred&&this.root.getAttribute("role")===this.options.ariaRole&&this.root.removeAttribute("role"),this.wasAriaLabelInferred&&this.root.getAttribute("aria-label")===this.lastInferredAriaLabel&&this.root.removeAttribute("aria-label"),this.root.style.removeProperty("--wulf-masonry-duration"),this.root.style.removeProperty("--wulf-masonry-stagger"),this.root.style.removeProperty("--wulf-masonry-col-min"),this.root.style.removeProperty("--wulf-masonry-gutter-x"),this.root.style.removeProperty("--wulf-masonry-gutter-y"),this.originalContainerStyles.height?this.root.style.height=this.originalContainerStyles.height:this.root.style.removeProperty("height"),this.originalContainerStyles.width?this.root.style.width=this.originalContainerStyles.width:this.root.style.removeProperty("width");for(let t of this.removingItems)t.removeAttribute("inert"),t.style.removeProperty("transition-delay"),t.classList.remove("wulf-masonry-item","wulf-masonry-item--hidden"),t.style.removeProperty("--wulf-masonry-w"),t.style.removeProperty("--wulf-masonry-x"),t.style.removeProperty("--wulf-masonry-y"),t.style.removeProperty("--wulf-masonry-index");this.removingItems.clear();for(let t of this._items)t.classList.remove("wulf-masonry-item","wulf-masonry-item--hidden"),t.style.removeProperty("--wulf-masonry-w"),t.style.removeProperty("--wulf-masonry-x"),t.style.removeProperty("--wulf-masonry-y"),t.style.removeProperty("--wulf-masonry-index");this._items=[]}}};var vi=pt;var ue={};$(ue,{LocalizedComponent:()=>R,Toast:()=>mt,ToastInstance:()=>ft,ToastManager:()=>it,createI18nManager:()=>B,default:()=>Ai,isSafeCssValue:()=>Mt,toastEn:()=>se,toastFr:()=>ie,toastI18n:()=>et});var ie={closeButton:"Fermer la notification",notificationsRegion:"Notifications"};var se={closeButton:"Close notification",notificationsRegion:"Notifications"};var et=B("fr",{fr:ie,en:se});var yi=1,De=5e3,wi=/^(?:#(?:[0-9a-f]{3}|[0-9a-f]{4}|[0-9a-f]{6}|[0-9a-f]{8})|(?:rgb|rgba|hsl|hsla|oklch|oklab|lch|lab)\(\s*(?:[+-]?(?:\d+\.?\d*|\.\d+)(?:%|deg|rad|grad|turn)?|none)(?:\s*[,/\s]\s*(?:[+-]?(?:\d+\.?\d*|\.\d+)(?:%|deg|rad|grad|turn)?|none)){2,3}\s*\)|[a-z]{3,20})$/i;function Mt(u){if(!u||typeof u!="string"||u.length>128)return!1;let t=u.trim();return!t||/[\u0000-\u001F\u007F;{}<>\\]|(?:url|image-set|-webkit-image-set|image|src|expression|attr|env|var)\s*\(/i.test(t)?!1:typeof CSS<"u"&&typeof CSS.supports=="function"?CSS.supports("color",t)||CSS.supports("background-color",t):wi.test(t)}function Ti(u){return u.slice(0,128).trim().split(/\s+/).filter(t=>/^[a-zA-Z0-9_-]+$/.test(t)&&!t.startsWith("wulf-toast")).slice(0,8).join(" ")}var ft=class extends z{id;options;element;_isClosed=!1;_isFinalized=!1;closePromise=null;timerId=null;remainingTime=0;hasDuration=!1;timerStartTime=0;isPausedByHover=!1;isPausedByFocus=!1;isPausedByVisibility=!1;isPendingFocusDismiss=!1;actionPending=!1;previousActiveElement=null;eventsAbortController=new AbortController;disposeAbortController=new AbortController;onDismissCallback;constructor(t,e){if(super(),typeof document>"u")throw new Error("[Wulf.Toast] Impossible d'instancier une notification Toast sans environnement DOM (document).");this.id=`wulf-toast-${yi++}`,this.options=Object.freeze({...t}),this.onDismissCallback=e,this.previousActiveElement=H();let i=t.duration===void 0?De:t.duration;typeof i=="number"&&Number.isFinite(i)&&i>0?(this.remainingTime=Math.min(i,2147483647),this.hasDuration=!0):(this.remainingTime=0,this.hasDuration=!1),this.element=this.createDOM(),this.bindEvents(),this.runAuditWarning(t.audit!==!1)}get isClosed(){return this._isClosed}getPreviousActiveElement(){return this.previousActiveElement}audit(){let t=[],e=!!(this.options.title&&this.options.title.trim().length>0),i=!!(this.options.message&&this.options.message.trim().length>0);!e&&!i&&t.push("Contenu textuel vide : d\xE9finissez au moins un title ou un message pour que le lecteur d'\xE9cran puisse annoncer la notification (WCAG 4.1.3).");let s=this.options.duration===void 0?De:this.options.duration;typeof s=="number"&&s>0&&s<5e3&&t.push(`Dur\xE9e d'affichage trop courte (duration: ${s}ms) : pr\xE9voyez au moins 5000ms ou duration: false pour laisser le temps de lecture aux utilisateurs (WCAG 2.2.1).`);let n=this.options.closable??!0;return(s===!1||typeof s=="number"&&s<=0)&&!n&&t.push("Notification persistante impossible \xE0 fermer au clavier : activez closable: true lorsque duration est d\xE9sactiv\xE9 (WCAG 2.1.1)."),this.options.action&&(O(String(this.options.action.label??""),128).trim()||t.push("Bouton d'action invalide : action.label doit contenir un texte non vide (WCAG 4.1.2).")),t}getAuditPrefix(){return"Wulf.Toast"}getAuditTargetLabel(){return`#${this.id}`}createDOM(){let t=document.createElement("div");if(t.id=this.id,t.className="wulf-toast",t.setAttribute("data-toast-role",this.options.role==="alert"?"alert":"status"),this.options.backgroundColor&&Mt(this.options.backgroundColor)&&t.style.setProperty("--wulf-toast-bg",this.options.backgroundColor.trim()),this.options.titleColor&&Mt(this.options.titleColor)&&t.style.setProperty("--wulf-toast-title-color",this.options.titleColor.trim()),this.options.textColor&&Mt(this.options.textColor)&&t.style.setProperty("--wulf-toast-text-color",this.options.textColor.trim()),this.options.iconColor&&Mt(this.options.iconColor)&&t.style.setProperty("--wulf-toast-icon-color",this.options.iconColor.trim()),this.options.closeButtonColor&&Mt(this.options.closeButtonColor)&&t.style.setProperty("--wulf-toast-close-color",this.options.closeButtonColor.trim()),this.options.icon&&typeof this.options.icon=="string"&&this.options.icon.trim()!==""){let r=Ti(this.options.icon);if(r){let o=document.createElement("span");o.className=`wulf-toast-icon ${r}`,o.setAttribute("aria-hidden","true"),t.appendChild(o)}}let e=document.createElement("div"),i=!!(this.options.onClick||this.options.closeOnClick);if(e.className=i?"wulf-toast-content wulf-toast-content--interactive":"wulf-toast-content",i&&(e.setAttribute("role","button"),e.setAttribute("tabindex","0"),e.addEventListener("keydown",r=>{N(r)||(r.key==="Enter"?(r.preventDefault(),r.stopPropagation(),e.dispatchEvent(new MouseEvent("click",{bubbles:!0,cancelable:!0}))):r.key===" "&&(r.preventDefault(),r.stopPropagation()))},{signal:this.eventsAbortController.signal}),e.addEventListener("keyup",r=>{r.key===" "&&(r.preventDefault(),r.stopPropagation(),e.dispatchEvent(new MouseEvent("click",{bubbles:!0,cancelable:!0})))},{signal:this.eventsAbortController.signal})),this.options.title&&this.options.title.trim()!==""){let r=document.createElement("div");r.className="wulf-toast-title",this.appendTextWithLineBreaks(r,this.options.title),e.appendChild(r)}if(this.options.message&&this.options.message.trim()!==""){let r=document.createElement("div");r.className="wulf-toast-message",this.appendTextWithLineBreaks(r,this.options.message),e.appendChild(r)}t.appendChild(e);let s=this.options.action;if(s&&typeof s.onClick=="function"){let r=O(String(s.label??""),128).trim();if(r){let o=document.createElement("button");if(o.type="button",o.className="wulf-toast-action",o.textContent=r,typeof s.ariaLabel=="string"){let l=O(s.ariaLabel,256).trim();l&&o.setAttribute("aria-label",l)}let a=()=>{this.actionPending=!1,this._isClosed||(o.disabled=!1,o.removeAttribute("aria-busy"))};o.addEventListener("click",l=>{if(l.stopPropagation(),this._isClosed||this.actionPending)return;this.actionPending=!0,o.disabled=!0,o.setAttribute("aria-busy","true");let c=s.closeOnClick!==!1;try{let h=s.onClick(this,l);h&&typeof h.then=="function"?h.then(()=>{c&&!this._isClosed?this.close("action"):a()},p=>{console.error("[Wulf.Toast] Erreur dans action.onClick:",p),a()}):c&&!this._isClosed?this.close("action"):a()}catch(h){console.error("[Wulf.Toast] Erreur dans action.onClick:",h),a()}},{signal:this.eventsAbortController.signal}),t.appendChild(o)}}if(this.options.closable??!0){let r=document.createElement("button");r.type="button",r.className="wulf-toast-close",r.setAttribute("aria-label",et.t("closeButton",this.options.i18n));let o=document.createElement("span");o.className="wulf-toast-close-icon",o.setAttribute("aria-hidden","true"),o.textContent="\xD7",r.appendChild(o),r.addEventListener("click",a=>{a.stopPropagation(),this.close("close-button")},{signal:this.eventsAbortController.signal}),t.appendChild(r)}if(this.options.progressBar&&this.remainingTime>0){t.style.setProperty("--wulf-toast-duration",`${this.remainingTime}ms`);let r=document.createElement("div");r.className="wulf-toast-progress",r.setAttribute("aria-hidden","true"),t.appendChild(r)}return t}appendTextWithLineBreaks(t,e){O(String(e??""),4096).split(/\r\n|\r|\n/).slice(0,100).forEach((n,r)=>{r>0&&t.appendChild(document.createElement("br")),t.appendChild(document.createTextNode(n))})}bindEvents(){let{signal:t}=this.eventsAbortController;this.element.addEventListener("click",e=>{if(this.options.onClick)try{this.options.onClick(this,e)}catch(i){console.error("[Wulf.Toast] Erreur dans le callback onClick:",i)}this.options.closeOnClick&&this.close("toast-click")},{signal:t}),this.element.addEventListener("mouseenter",()=>this.pauseTimer("hover"),{signal:t}),this.element.addEventListener("mouseleave",()=>this.resumeTimer("hover"),{signal:t}),this.element.addEventListener("focusin",()=>this.pauseTimer("focus"),{signal:t}),this.element.addEventListener("focusout",e=>{let i=e.relatedTarget;if(!(i&&this.element.contains(i))){if(this.isPendingFocusDismiss&&!this._isClosed){this.isPendingFocusDismiss=!1,this.close("timeout");return}this.resumeTimer("focus")}},{signal:t}),this.element.addEventListener("keydown",e=>{if(e.key==="Escape"&&(this.options.closable??!0)){if(N(e))return;e.stopPropagation(),this.close("close-button")}},{signal:t}),typeof document<"u"&&document.addEventListener("visibilitychange",()=>{document.visibilityState==="hidden"?this.pauseTimer("visibility"):this.resumeTimer("visibility")},{signal:t})}get isPaused(){return this.isPausedByHover||this.isPausedByFocus||this.isPausedByVisibility}startTimer(){if(!(this._isClosed||this.remainingTime<=0||this.isPaused)){if(typeof document<"u"&&document.visibilityState==="hidden"){this.isPausedByVisibility=!0,this.element.classList.add("is-paused");return}this.timerId!==null&&(typeof window<"u"&&window.clearTimeout(this.timerId),this.timerId=null),!(typeof window>"u")&&(this.timerStartTime=typeof performance<"u"?performance.now():Date.now(),this.timerId=window.setTimeout(()=>{this.timerId=null;let t=H();if(t&&this.element.contains(t)){this.isPendingFocusDismiss=!0;return}this.close("timeout")},this.remainingTime))}}pauseTimer(t="interaction"){if(this._isClosed||!this.hasDuration||this.remainingTime<=0)return;let e=this.isPaused;if(t==="visibility"?this.isPausedByVisibility=!0:t==="focus"?this.isPausedByFocus=!0:this.isPausedByHover=!0,!e){if(this.timerId!==null){typeof window<"u"&&window.clearTimeout(this.timerId),this.timerId=null;let s=(typeof performance<"u"?performance.now():Date.now())-this.timerStartTime;this.remainingTime=Math.max(0,this.remainingTime-s)}this.element.classList.add("is-paused")}}resumeTimer(t="interaction"){if(!(this._isClosed||!this.hasDuration)){if(t==="visibility")this.isPausedByVisibility=!1;else if(t==="focus")this.isPausedByFocus=!1;else if(t==="hover"){this.isPausedByHover=!1;let e=H();e&&this.element.contains(e)&&(this.isPausedByFocus=!0)}else this.isPausedByHover=!1,this.isPausedByFocus=!1;if(!this.isPaused){if(this.element.classList.remove("is-paused"),this.remainingTime<=0){this.close("timeout");return}this.startTimer()}}}finalizeDismiss(t){if(!this._isFinalized&&(this._isFinalized=!0,this.eventsAbortController.abort(),this.onDismissCallback&&this.onDismissCallback(this,t),this.element.parentNode&&this.element.parentNode.removeChild(this.element),this.options.onClose))try{this.options.onClose(this,t)}catch(e){console.error("[Wulf.Toast] Erreur dans le callback onClose:",e)}}destroyImmediate(t="replace"){this._isClosed=!0,this.timerId!==null&&(typeof window<"u"&&window.clearTimeout(this.timerId),this.timerId=null),this.disposeAbortController.abort(),this.finalizeDismiss(t)}close(t="programmatic",e=!1){return this._isClosed?this.closePromise??Promise.resolve():(this._isClosed=!0,this.timerId!==null&&(typeof window<"u"&&window.clearTimeout(this.timerId),this.timerId=null),this.eventsAbortController.abort(),this.element.classList.add(e?"wulf-toast-hiding-fast":"wulf-toast-hiding"),rt()?(this.finalizeDismiss(t),this.closePromise=Promise.resolve(),this.closePromise):(this.closePromise=Dt(this.element,e?90:300,this.disposeAbortController.signal).then(()=>{this.disposeAbortController.signal.aborted||this.finalizeDismiss(t)}),this.closePromise))}};var Pe=Symbol.for("wulf.focusTrap.stack.v1"),Re=Symbol.for("wulf.toast.manager.v1"),ne=Symbol.for("wulf.toast.containers.v1"),re=Symbol.for("wulf.toast.announcers.v1");function Kt(){return typeof globalThis>"u"?null:globalThis}function Oe(){let u=Kt();if(!u)return[];let t=u[Pe];return Array.isArray(t)||(t=[],u[Pe]=t),t}function He(){let u=Kt();return u?u[Re]??null:null}function oe(u){let t=Kt();t&&(t[Re]=u)}function xt(u){if(typeof WeakSet>"u")return null;let t=Kt();if(!t)return null;let e=t[u];return e instanceof WeakSet||(e=new WeakSet,t[u]=e),e}function Ne(u){xt(ne)?.add(u)}function ae(u){xt(ne)?.delete(u)}function le(u){return!u||typeof HTMLElement>"u"||!(u instanceof HTMLElement)?!1:xt(ne)?.has(u)??!1}function Fe(u){xt(re)?.add(u)}function ze(u){xt(re)?.delete(u)}function Be(u){return!u||typeof HTMLElement>"u"||!(u instanceof HTMLElement)?!1:xt(re)?.has(u)??!1}var Ve=new Set(["top-left","top-center","top-right","bottom-left","bottom-center","bottom-right"]);function Ue(u){return u&&Ve.has(u)?u:"top-right"}var Si='button:not([disabled]), [href], [tabindex]:not([tabindex="-1"])',it=class u{containers=new Map;containerBaseLabels=new WeakMap;activeToasts=new Map;announcerEl=null;politeRegion=null;assertiveRegion=null;announceTimers=[];politeAnnounceTimerId=null;assertiveAnnounceTimerId=null;politeClearTimerId=null;assertiveClearTimerId=null;lastPoliteText="";lastAssertiveText="";announcerToggle=!1;isPopoverOpen(t){try{if(t.matches(":popover-open"))return!0}catch{}return t.classList.contains(":popover-open")}replaceTokens=new Map;pendingReplacements=new Set;constructor(){}static getInstance(){let t=He();return t||(t=new u,oe(t)),t}getContainerKey(t,e){return`${t}:${e?"top":"fixed"}`}add(t){if(typeof document>"u"||typeof window>"u")return;let e=Ue(t.options.position),i=this.activeToasts.get(e);i||(i=[],this.activeToasts.set(e,i));let s=t.options.maxToasts,n=typeof s=="number"&&Number.isFinite(s)&&s>0?Math.min(50,Math.max(1,Math.floor(s))):5;if(t.options.replace&&i.length>0){let r=[...i],o=(this.replaceTokens.get(e)||0)+1;this.replaceTokens.set(e,o),this.pendingReplacements.add(e);let a=r.map(l=>l.close("replace",!0));Promise.all(a).then(()=>{if(this.pendingReplacements.delete(e),this.replaceTokens.get(e)!==o){t.destroyImmediate("replace");return}this.mountToast(t,e,n)});return}if(this.pendingReplacements.has(e)&&(this.replaceTokens.set(e,(this.replaceTokens.get(e)||0)+1),this.pendingReplacements.delete(e)),i.length>=n){let r=i.length-n+1,o=i.splice(0,r);for(let a of o)a.close("max-limit",!0)}this.mountToast(t,e,n)}mountToast(t,e,i=5){if(t.isClosed||typeof document>"u")return;let s=t.options.useTopLayer??!0,n=this.getOrCreateContainer(e,t,s),r=this.activeToasts.get(e);r||(r=[],this.activeToasts.set(e,r));let o=i+10;if(n.children.length>=o){let a=Array.from(n.children);for(let l of a){if(n.children.length<o)break;(l.classList.contains("wulf-toast-hiding")||l.classList.contains("wulf-toast-hiding-fast"))&&l.remove()}}if(s&&typeof n.showPopover=="function"&&n.getAttribute("popover")==="manual")try{let a=n;this.isPopoverOpen(n)||a.showPopover()}catch{n.removeAttribute("popover")}if(n.appendChild(t.element),r.push(t),this.announce(t),t.options.onOpen)try{t.options.onOpen(t)}catch(a){console.error("[Wulf.Toast] Erreur dans le callback onOpen:",a)}t.startTimer()}announce(t){if(typeof document>"u"||typeof window>"u")return;let e=[t.options.title,t.options.message].filter(d=>typeof d=="string"&&d.trim().length>0).map(d=>O(d,512).trim()).filter(Boolean);if(e.length===0)return;let i=e.join(". "),s=i.length>512?`${i.slice(0,509)}...`:i,n=t.options.role==="alert",r=document;if(typeof r.ariaNotify=="function")try{r.ariaNotify(s,{priority:n?"high":"normal"});return}catch{}let o=!this.announcerEl||!this.announcerEl.isConnected;this.ensureAnnouncer();let a=n?this.assertiveRegion:this.politeRegion;if(!a)return;n?(this.assertiveAnnounceTimerId!==null&&(window.clearTimeout(this.assertiveAnnounceTimerId),this.assertiveAnnounceTimerId=null),this.assertiveClearTimerId!==null&&(window.clearTimeout(this.assertiveClearTimerId),this.assertiveClearTimerId=null)):(this.politeAnnounceTimerId!==null&&(window.clearTimeout(this.politeAnnounceTimerId),this.politeAnnounceTimerId=null),this.politeClearTimerId!==null&&(window.clearTimeout(this.politeClearTimerId),this.politeClearTimerId=null)),a.textContent="";let l=n?this.lastAssertiveText:this.lastPoliteText,c=s;s===l?(this.announcerToggle=!this.announcerToggle,c=this.announcerToggle?`${s}\xA0`:s):this.announcerToggle=!1,n?this.lastAssertiveText=s:this.lastPoliteText=s;let h=o?120:50,p=window.setTimeout(()=>{let d=this.announceTimers.indexOf(p);if(d!==-1&&this.announceTimers.splice(d,1),n?this.assertiveAnnounceTimerId=null:this.politeAnnounceTimerId=null,a.isConnected){a.textContent=c;let f=window.setTimeout(()=>{let m=this.announceTimers.indexOf(f);m!==-1&&this.announceTimers.splice(m,1),a.isConnected&&a.textContent===c&&(a.textContent="")},4e3);this.announceTimers.push(f),n?this.assertiveClearTimerId=f:this.politeClearTimerId=f}},h);this.announceTimers.push(p),n?this.assertiveAnnounceTimerId=p:this.politeAnnounceTimerId=p}ensureAnnouncer(){if(typeof document>"u"||!document.body||this.announcerEl&&document.body.contains(this.announcerEl))return;let t=document.createElement("div");t.className="wulf-toast-announcer",t.setAttribute("data-wulf-toast-announcer","true"),Fe(t);let e=document.createElement("div");e.setAttribute("role","status"),e.setAttribute("aria-live","polite"),e.setAttribute("aria-atomic","true");let i=document.createElement("div");i.setAttribute("role","alert"),i.setAttribute("aria-live","assertive"),i.setAttribute("aria-atomic","true"),t.appendChild(e),t.appendChild(i),document.body.appendChild(t),this.announcerEl=t,this.politeRegion=e,this.assertiveRegion=i}handleFocusHandoff(t,e){let i=H();if(!i||!t.element.contains(i))return;for(let n=e.length-1;n>=0;n--){let r=e[n];if(r===t||r.isClosed||!r.element.isConnected)continue;let o=r.element.querySelector(Si);if(o){o.focus({preventScroll:!0});return}}let s=t.getPreviousActiveElement();if(s&&s.isConnected&&typeof s.focus=="function"&&!s.disabled&&!s.hidden&&!s.closest("[hidden]")&&!s.closest("[inert]")&&s.getAttribute("aria-hidden")!=="true"&&(s.tabIndex>=0||s.getAttribute("tabindex")!==null)){let n=s;if(typeof n.checkVisibility=="function"&&!n.checkVisibility({checkOpacity:!1,checkVisibilityCSS:!0,visibilityProperty:!0}))return;try{s.focus()}catch{}}}remove(t,e){let i=Ue(t.options.position),s=this.activeToasts.get(i),n=t.options.useTopLayer??!0,r=this.getContainerKey(i,n),o=t.element.parentElement;if(s){let a=s.indexOf(t);a!==-1&&s.splice(a,1),this.handleFocusHandoff(t,s),t.element.parentNode&&t.element.parentNode.removeChild(t.element);let l=this.containers.get(r)||(o instanceof HTMLElement?o:void 0);if(l&&(!l.firstChild||l.children.length===0)){for(let[c,h]of Array.from(this.containers.entries()))h===l&&this.containers.delete(c);this.disposeContainer(l),this.syncContainerRegionLabels()}if(s.length===0&&!this.pendingReplacements.has(i)){for(let c of[!0,!1]){let h=this.getContainerKey(i,c),p=this.containers.get(h);p&&(!p.firstChild||p.children.length===0)&&(this.disposeContainer(p),this.containers.delete(h))}this.activeToasts.delete(i),this.syncContainerRegionLabels()}}else t.element.parentNode&&t.element.parentNode.removeChild(t.element)}disposeContainer(t){ae(t);try{let e=t;typeof e.hidePopover=="function"&&this.isPopoverOpen(t)&&e.hidePopover()}catch{}t.parentNode&&t.parentNode.removeChild(t)}clearAll(t){if(typeof document>"u"||typeof window>"u")return Promise.resolve();let e=[];if(t){this.replaceTokens.set(t,(this.replaceTokens.get(t)||0)+1),this.pendingReplacements.delete(t);let i=this.activeToasts.get(t);if(i&&i.length>0){let s=[...i];for(let n of s)e.push(n.close("programmatic"))}else{let s=!1;for(let n of[!0,!1]){let r=this.getContainerKey(t,n),o=this.containers.get(r);o&&(!o.firstChild||o.children.length===0)&&(this.disposeContainer(o),this.containers.delete(r),s=!0)}this.activeToasts.delete(t),s&&this.syncContainerRegionLabels()}}else{for(let s of this.replaceTokens.keys())this.replaceTokens.set(s,(this.replaceTokens.get(s)||0)+1);this.pendingReplacements.clear();for(let s of this.announceTimers)window.clearTimeout(s);this.announceTimers=[],this.politeAnnounceTimerId=null,this.assertiveAnnounceTimerId=null,this.politeClearTimerId=null,this.assertiveClearTimerId=null;let i=new Set(Array.from(this.activeToasts.keys()));for(let s of this.containers.keys()){let n=s.slice(0,s.lastIndexOf(":"));Ve.has(n)&&i.add(n)}for(let s of i)e.push(this.clearAll(s))}return Promise.all(e).then(()=>{if(!t){for(let[i,s]of Array.from(this.containers.entries()))(!s.firstChild||s.children.length===0)&&(this.disposeContainer(s),this.containers.delete(i));this.activeToasts.clear(),this.syncContainerRegionLabels()}})}destroy(){if(typeof window<"u")for(let t of this.announceTimers)window.clearTimeout(t);this.announceTimers=[],this.politeAnnounceTimerId=null,this.assertiveAnnounceTimerId=null,this.politeClearTimerId=null,this.assertiveClearTimerId=null;for(let t of Array.from(this.activeToasts.values()))for(let e of[...t])e.destroyImmediate("programmatic");for(let t of Array.from(this.containers.values()))this.disposeContainer(t);this.containers.clear(),this.activeToasts.clear(),this.replaceTokens.clear(),this.pendingReplacements.clear(),this.announcerEl&&(ze(this.announcerEl),this.announcerEl.remove(),this.announcerEl=null,this.politeRegion=null,this.assertiveRegion=null),oe(null)}syncContainerRegionLabels(){let t=this.containers.size>1;for(let[e,i]of this.containers.entries()){let s=this.containerBaseLabels.get(i)||et.t("notificationsRegion"),n=e.slice(0,e.lastIndexOf(":"));i.setAttribute("aria-label",t?`${s} (${n})`:s)}}getOrCreateContainer(t,e,i){let s=this.getContainerKey(t,i),n=this.containers.get(s);if(!n||!document.body.contains(n)){n&&ae(n),n=document.createElement("div"),n.className=`wulf-toast-container wulf-toast-${t}`,n.setAttribute("role","region");let r=et.t("notificationsRegion",e.options.i18n);this.containerBaseLabels.set(n,r),n.setAttribute("aria-label",r),i&&typeof n.showPopover=="function"&&n.setAttribute("popover","manual"),Ne(n),document.body.appendChild(n),this.containers.set(s,n),this.syncContainerRegionLabels()}return n}};var mt=class u extends R{static _i18n=et;static i18n=et;audit(){return[]}getAuditPrefix(){return"Wulf.Toast"}getAuditTargetLabel(){return"Toast"}static show(t={}){let e=it.getInstance(),i=new ft(t,(s,n)=>{e.remove(s,n)});return e.add(i),i}static async promise(t,e){let i=(a,l)=>{let c;if(typeof a=="function")try{c=a(l)}catch(h){return console.error("[Wulf.Toast] Erreur lors de la r\xE9solution du message Toast.promise:",h),{}}else c=a;return typeof c=="string"?{message:c}:c&&typeof c=="object"?{...c}:{}},s=e.baseOptions?{...e.baseOptions}:{},n=i(e.loading,void 0),r=u.show({...s,duration:!1,closable:!0,role:"status",...n,replace:!1}),o=typeof t=="function"?Promise.resolve().then(()=>t()):Promise.resolve(t);try{let a=await o;await r.close("replace",!0);let l=i(e.success,a);return u.show({...s,role:"status",...l,replace:!1}),a}catch(a){await r.close("replace",!0);let l=i(e.error,a);throw u.show({...s,role:"alert",...l,replace:!1}),a}}static clearAll(t){return it.getInstance().clearAll(t)}static destroy(){it.getInstance().destroy()}};var Ai=mt;var de={};$(de,{FocusTrap:()=>Et,default:()=>Et});var Ke=["a[href]","area[href]",'input:not([disabled]):not([type="hidden"])',"select:not([disabled])","textarea:not([disabled])","button:not([disabled])","audio[controls]","video[controls]","details > summary:first-of-type","iframe","object","embed",'[contenteditable]:not([contenteditable="false"])','[tabindex]:not([tabindex="-1"])'].join(",");function ce(u,t){if(!t||typeof t!="string")return null;try{return u.querySelector(t)}catch{return null}}function he(){return Oe()}var Et=class extends z{element;options;active=!1;paused=!1;previousActiveElement=null;inertSiblings=[];addedContainerTabIndex=!1;lastOutsidePointerDownTime=0;abortController;handleKeyDownBound;handleClickOutsideBound;handleFocusInBound;constructor(t,e={}){if(super(),typeof t=="string"&&typeof document>"u")throw new Error("[Wulf.FocusTrap] Impossible de r\xE9soudre un s\xE9lecteur CSS sans environnement DOM (document).");let i=typeof t=="string"?ce(document,t):t;if(!i||typeof HTMLElement>"u"||!(i instanceof HTMLElement))throw new Error(`[Wulf.FocusTrap] Conteneur introuvable ou invalide : "${t}"`);this.element=i;let s=e.allowOutsideClick??!1;this.options={initialFocus:e.initialFocus!==void 0?e.initialFocus:"[data-autofocus], [autofocus]",returnFocus:e.returnFocus??!0,fallbackReturnFocus:e.fallbackReturnFocus??"",escapeDeactivates:e.escapeDeactivates??!0,allowOutsideClick:s,setInert:e.setInert??!s,onActivate:e.onActivate??(()=>{}),onDeactivate:e.onDeactivate??(()=>{}),audit:e.audit??!0},this.handleKeyDownBound=this.handleKeyDown.bind(this),this.handleClickOutsideBound=this.handleClickOutside.bind(this),this.handleFocusInBound=this.handleFocusIn.bind(this),this.runAuditWarning(this.options.audit)}isNativeDialogElement(){return this.element.tagName.toLowerCase()==="dialog"}isNativeModalDialog(){if(!this.isNativeDialogElement())return!1;try{return this.element.matches(":modal")}catch{return!1}}isElementVisibleAndEnabled(t){if(!t||!t.isConnected||t.disabled)return!1;try{if(t.matches(":disabled"))return!1}catch{if(t.closest("fieldset[disabled]"))return!1}if(t.hasAttribute("inert")||t.closest("[inert]")||t.hidden||t.closest("[hidden]"))return!1;let e=t;if(typeof e.checkVisibility=="function"){if(!e.checkVisibility({checkOpacity:!1,checkVisibilityCSS:!0,visibilityProperty:!0}))return!1}else{if(t.style.display==="none"||t.style.visibility==="hidden")return!1;if(typeof window<"u"&&typeof window.getComputedStyle=="function"){let i=window.getComputedStyle(t);if(i.display==="none"||i.visibility==="hidden"||t.offsetWidth===0&&t.offsetHeight===0&&i.position!=="fixed")return!1}}return!0}isElementFocusableBase(t){return!t||t.tabIndex<0?!1:this.isElementVisibleAndEnabled(t)}isProgrammaticallyFocusable(t){return!t||!this.isElementVisibleAndEnabled(t)?!1:t.tabIndex>=0||t.getAttribute("tabindex")!==null}isFocusable(t){if(!this.isElementFocusableBase(t))return!1;if(t instanceof HTMLInputElement&&t.type==="radio"&&t.name){let e=typeof t.getRootNode=="function"?t.getRootNode():this.element,i=t.form&&this.isNodeInsideContainer(t.form)?t.form:e&&(e instanceof Document||typeof ShadowRoot<"u"&&e instanceof ShadowRoot)?e:this.element,s=Array.from(i.querySelectorAll(`input[type="radio"][name="${j(t.name)}"]`)).filter(r=>r.form===t.form&&this.isNodeInsideContainer(r)&&this.isElementFocusableBase(r));if(s.length===0)return!1;let n=s.find(r=>r.checked);return n?t===n:t===s[0]}return!0}collectFocusables(t,e,i){let s=t.children;for(let n=0;n<s.length;n++){let r=s[n];if(!(r instanceof HTMLElement)||r.hasAttribute("inert")||r.hidden)continue;let o=!1;try{o=r.matches(Ke)}catch{o=!1}if(o&&!i.has(r)&&this.isFocusable(r)&&(i.add(r),e.push(r)),r.shadowRoot&&this.collectFocusables(r.shadowRoot,e,i),r.tagName==="SLOT"){let a=r.assignedElements({flatten:!0});for(let l of a){if(!(l instanceof HTMLElement)||l.hasAttribute("inert")||l.hidden)continue;let c=!1;try{c=l.matches(Ke)}catch{c=!1}c&&!i.has(l)&&this.isFocusable(l)&&(i.add(l),e.push(l)),l.shadowRoot&&this.collectFocusables(l.shadowRoot,e,i),this.collectFocusables(l,e,i)}}else this.collectFocusables(r,e,i)}}getFocusableElements(){let t=[],e=new Set;return this.element.shadowRoot&&this.collectFocusables(this.element.shadowRoot,t,e),this.collectFocusables(this.element,t,e),t}activate(){if(this.active||typeof document>"u")return this;let t=he(),e=t[t.length-1];e&&e.pause(),this.active=!0,this.paused=!1,t.push(this);let i=H(document);this.previousActiveElement=i instanceof HTMLElement?i:document.activeElement,this.options.setInert&&!this.isNativeModalDialog()&&this.applyInert(),this.abortController?.abort(),this.abortController=new AbortController;let{signal:s}=this.abortController;document.addEventListener("keydown",this.handleKeyDownBound,{capture:!0,signal:s}),document.addEventListener("focusin",this.handleFocusInBound,{capture:!0,signal:s}),document.addEventListener("pointerdown",this.handleClickOutsideBound,{capture:!0,signal:s}),this.options.allowOutsideClick||(document.addEventListener("mousedown",this.handleClickOutsideBound,{capture:!0,signal:s}),document.addEventListener("touchstart",this.handleClickOutsideBound,{capture:!0,signal:s}),document.addEventListener("click",this.handleClickOutsideBound,{capture:!0,signal:s})),this.isNativeDialogElement()&&this.element.addEventListener("close",()=>this.deactivate(),{signal:s}),this.applyInitialFocus(),this.runAuditWarning(this.options.audit);try{this.options.onActivate()}catch(n){console.error("[Wulf.FocusTrap] Erreur dans onActivate:",n)}return this}deactivate(){if(!this.active)return this;let t=he(),e=t[t.length-1]===this;this.active=!1,this.paused=!1;let i=t.indexOf(this);if(i!==-1&&t.splice(i,1),this.abortController?.abort(),this.abortController=void 0,this.removeInert(),this.addedContainerTabIndex&&(this.element.removeAttribute("tabindex"),this.addedContainerTabIndex=!1),e){let s=t[t.length-1];s&&s.unpause(),this.options.returnFocus&&this.restoreFocus()}this.previousActiveElement=null;try{this.options.onDeactivate()}catch(s){console.error("[Wulf.FocusTrap] Erreur dans onDeactivate:",s)}return this}pause(){this.paused=!0,this.removeInert()}unpause(){if(!this.active)return;let t=he();t[t.length-1]===this&&(this.paused=!1,this.options.setInert&&!this.isNativeModalDialog()&&this.applyInert())}isActive(){return this.active&&!this.paused}audit(){let t=[],e=this.element.getAttribute("role");this.isNativeDialogElement()?(e==="dialog"&&t.push('Attribut redondant : role="dialog" est d\xE9j\xE0 implicite sur une balise native <dialog>.'),this.element.hasAttribute("aria-modal")&&t.push('Attribut redondant : <dialog> ouvert via showModal() g\xE8re nativement la modalit\xE9 sans n\xE9cessiter aria-modal="true".'),this.element.hasAttribute("open")&&!this.isNativeModalDialog()&&t.push("Dialogue non modal d\xE9tect\xE9 : pr\xE9f\xE9rez dialog.showModal() plut\xF4t que l'attribut open pour obtenir la Top Layer et l'inertie natives.")):((!e||!["dialog","alertdialog","menu","listbox","tree","grid"].includes(e))&&t.push('R\xF4le s\xE9mantique manquant ou inadapt\xE9 : d\xE9finissez role="dialog" (ou "alertdialog", "menu", "listbox") sur le conteneur.'),(e==="dialog"||e==="alertdialog")&&this.element.getAttribute("aria-modal")!=="true"&&t.push('Isolation modale manquante : d\xE9finissez aria-modal="true" sur le conteneur de dialogue (WCAG 4.1.2).'));let n=this.element.getAttribute("aria-label")?.trim(),r=this.checkAriaIdReferences(this.element,"aria-labelledby",t,!0);!n&&!r&&t.push('Nom accessible manquant : d\xE9finissez aria-labelledby="id-titre" ou aria-label="..." sur le conteneur (WCAG 4.1.2).'),this.element.hasAttribute("aria-describedby")&&this.checkAriaIdReferences(this.element,"aria-describedby",t,!0);let o=Array.from(this.element.querySelectorAll("[tabindex]")).filter(a=>a.tabIndex>0);return o.length>0&&t.push(`${o.length} \xE9l\xE9ment(s) avec tabindex > 0 d\xE9tect\xE9(s) : utilisez uniquement tabindex="0" ou "-1" pour pr\xE9server l'ordre s\xE9quentiel de tabulation (WCAG 2.4.3).`),t}getAuditPrefix(){return"Wulf.FocusTrap"}getAuditTargetLabel(){return this.element.id?`#${this.element.id}`:`<${this.element.tagName.toLowerCase()}>`}destroy(){this.deactivate()}isNodeInsideContainer(t){let e=t;for(;e;){if(e===this.element||this.element.contains(e))return!0;let i=typeof e.getRootNode=="function"?e.getRootNode():null;if(typeof ShadowRoot<"u"&&i instanceof ShadowRoot&&i.host)e=i.host;else break}return!1}isEventInside(t,e){return!!(this.isNodeInsideContainer(e)||typeof t.composedPath=="function"&&t.composedPath().includes(this.element))}isInsideToastContainer(t){if(typeof document>"u"||!t)return!1;let e=t;for(;e;){if(e instanceof Element){let s=e.closest(".wulf-toast-container");if(s&&le(s)&&s.parentElement===document.body&&!this.isNodeInsideContainer(s))return!0}let i=typeof e.getRootNode=="function"?e.getRootNode():null;if(typeof ShadowRoot<"u"&&i instanceof ShadowRoot&&i.host)e=i.host;else break}return!1}ensureContainerTabIndex(){this.element.getAttribute("tabindex")===null&&(this.element.setAttribute("tabindex","-1"),this.addedContainerTabIndex=!0)}handleKeyDown(t){if(!this.isActive())return;if(this.element.isConnected===!1){this.deactivate();return}if(t.key==="Escape"&&this.options.escapeDeactivates){if(t.defaultPrevented||t.ctrlKey||t.altKey||t.metaKey||t.shiftKey||N(t))return;let a=H(document);if(this.isInsideToastContainer(a)||this.isInsideToastContainer(t.target)||this.isNativeModalDialog())return;t.preventDefault(),t.stopPropagation(),this.deactivate();return}if(t.key!=="Tab")return;let e=this.getFocusableElements();if(e.length===0){t.preventDefault(),this.ensureContainerTabIndex(),this.element.focus();return}let i=e[0],s=e[e.length-1],n=H(document),r=n instanceof HTMLElement?n:document.activeElement,o=r?this.isNodeInsideContainer(r)||this.isEventInside(t,r):!1;!t.shiftKey&&(r===s||!o)?(t.preventDefault(),i.focus()):t.shiftKey&&(r===i||r===this.element||!o)&&(t.preventDefault(),s.focus())}handleFocusIn(t){if(!this.isActive())return;if(this.element.isConnected===!1){this.deactivate();return}let e=t.target;if(e&&!this.isInsideToastContainer(e)&&!(this.options.allowOutsideClick&&performance.now()-this.lastOutsidePointerDownTime<150)&&!this.isEventInside(t,e)){let i=this.getFocusableElements();i.length>0?i[0].focus():(this.ensureContainerTabIndex(),this.element.focus())}}handleClickOutside(t){if(!this.isActive())return;if(this.element.isConnected===!1){this.deactivate();return}let e=t.target;if(e&&!this.isEventInside(t,e)){if(this.isInsideToastContainer(e))return;if(this.options.allowOutsideClick){this.lastOutsidePointerDownTime=performance.now();return}t.preventDefault(),t.stopPropagation()}}applyInert(){if(this.removeInert(),typeof document>"u")return;let t=this.element,e=new Set(["SCRIPT","STYLE","TEMPLATE","LINK","META","NOSCRIPT"]);for(;t&&t!==document.body;){let i=t.parentElement;if(i){for(let s of Array.from(i.children))s instanceof HTMLElement&&s!==t&&!e.has(s.tagName)&&!s.hasAttribute("inert")&&!(i===document.body&&(le(s)||Be(s)))&&(s.setAttribute("inert",""),this.inertSiblings.push(s));t=i}else{let s=typeof t.getRootNode=="function"?t.getRootNode():null;if(typeof ShadowRoot<"u"&&s instanceof ShadowRoot){for(let n of Array.from(s.children))n instanceof HTMLElement&&n!==t&&!e.has(n.tagName)&&!n.hasAttribute("inert")&&(n.setAttribute("inert",""),this.inertSiblings.push(n));t=s.host instanceof HTMLElement?s.host:null}else break}}}removeInert(){this.inertSiblings.forEach(t=>t.removeAttribute("inert")),this.inertSiblings=[]}applyInitialFocus(){if(this.options.initialFocus===!1)return;let t=null;if(typeof this.options.initialFocus=="string"?t=ce(this.element,this.options.initialFocus):this.options.initialFocus instanceof HTMLElement&&(t=this.isNodeInsideContainer(this.options.initialFocus)?this.options.initialFocus:null),t&&(t instanceof HTMLInputElement&&t.type==="radio"&&!!t.name&&t.tabIndex>=0?this.isFocusable(t):this.isProgrammaticallyFocusable(t))){t.focus();return}let e=this.getFocusableElements();e.length>0?e[0].focus():(this.ensureContainerTabIndex(),this.element.focus())}restoreFocus(){if(this.previousActiveElement&&this.previousActiveElement.isConnected&&this.isProgrammaticallyFocusable(this.previousActiveElement)){this.previousActiveElement.focus();return}if(this.options.fallbackReturnFocus&&typeof document<"u"){let t=typeof this.options.fallbackReturnFocus=="string"?ce(document,this.options.fallbackReturnFocus):this.options.fallbackReturnFocus;t&&t.isConnected&&this.isProgrammaticallyFocusable(t)&&t.focus()}}};var pe={};$(pe,{ShortcutFormatter:()=>W,ShortcutManager:()=>ut,default:()=>ut});var W=class u{static isApple(){if(typeof navigator>"u")return!1;let t=navigator.userAgentData;if(t&&typeof t.platform=="string"){let s=t.platform.toLowerCase();if(s.includes("mac")||s.includes("ios"))return!0}let e=(navigator.platform||"").toLowerCase();if(e.includes("mac")||e.includes("iphone")||e.includes("ipad")||e.includes("ipod"))return!0;let i=(navigator.userAgent||"").toLowerCase();return i.includes("macintosh")||i.includes("mac os x")||i.includes("ipad")||i.includes("iphone")}static normalizeKeyName(t){if(t===" ")return" ";let e=t.trim().toLowerCase();switch(e){case"esc":return"escape";case"return":return"enter";case"space":case"spacebar":return" ";case"plus":return"+";case"del":return"delete";case"ins":return"insert";case"up":return"arrowup";case"down":return"arrowdown";case"left":return"arrowleft";case"right":return"arrowright";default:return e}}static parseCombo(t,e=u.isApple()){if(typeof t!="string")return[];if(t===" ")return[{ctrl:!1,alt:!1,shift:!1,meta:!1,key:" "}];let i=t.slice(0,512).trim();if(!i)return[];let n=i.replace(/\b(ctrl|control|alt|option|opt|shift|maj|cmd|command|meta|win|super|mod|\$mod)\s*\+\s*/gi,"$1+").split(/\s+/).slice(0,10),r=[];for(let o of n){let a=[];if(o==="+")a.push("+");else{let f="";for(let m=0;m<o.length;m++){let g=o[m];g==="+"?f===""&&a.length>0?a.push("+"):f!==""&&(a.push(f),f=""):f+=g}f!==""&&a.push(f)}let l=!1,c=!1,h=!1,p=!1,d="";for(let f of a){let m=f.trim().toLowerCase();m==="ctrl"||m==="control"?l=!0:m==="alt"||m==="option"||m==="opt"?c=!0:m==="shift"||m==="maj"?h=!0:m==="cmd"||m==="command"||m==="meta"||m==="win"||m==="super"?p=!0:m==="mod"||m==="$mod"?e?p=!0:l=!0:d=u.normalizeKeyName(f)}r.push({ctrl:l,alt:c,shift:h,meta:p,key:d})}return r}static format(t,e=u.isApple()){let i=u.parseCombo(t,e);return i.length===0?t:i.map(n=>{let r=[];if(e){n.ctrl&&r.push("\u2303"),n.alt&&r.push("\u2325"),n.shift&&r.push("\u21E7"),n.meta&&r.push("\u2318");let o=u.formatKeyDisplay(n.key,!0);return r.push(o),r.join("")}else{n.ctrl&&r.push("Ctrl"),n.alt&&r.push("Alt"),n.shift&&r.push("Shift"),n.meta&&r.push("Win");let o=u.formatKeyDisplay(n.key,!1);return r.push(o),r.join("+")}}).join(" ")}static toAriaKeyShortcuts(t,e=u.isApple()){let i=u.parseCombo(t,e);if(i.length!==1)return"";let s=i[0],n=u.formatAriaKey(s.key);if(!n)return"";let r=[];return s.ctrl&&r.push("Control"),s.alt&&r.push("Alt"),s.shift&&r.push("Shift"),s.meta&&r.push("Meta"),r.push(n),r.join("+")}static formatAriaKey(t){if(!t)return"";switch(t.toLowerCase()){case"escape":return"Escape";case"enter":return"Enter";case" ":return"Space";case"tab":return"Tab";case"backspace":return"Backspace";case"delete":return"Delete";case"insert":return"Insert";case"home":return"Home";case"end":return"End";case"pageup":return"PageUp";case"pagedown":return"PageDown";case"arrowup":return"ArrowUp";case"arrowdown":return"ArrowDown";case"arrowleft":return"ArrowLeft";case"arrowright":return"ArrowRight";case"printscreen":return"PrintScreen";case"scrolllock":return"ScrollLock";case"numlock":return"NumLock";case"capslock":return"CapsLock";case"contextmenu":return"ContextMenu";case"+":return"Plus";default:return t.length===1?t.toUpperCase():t.charAt(0).toUpperCase()+t.slice(1)}}static formatKeyDisplay(t,e){if(!t)return"";switch(t.toLowerCase()){case"escape":return e?"\u238B":"Esc";case"enter":return e?"\u21A9":"Enter";case" ":return e?"\u2423":"Space";case"tab":return e?"\u21E5":"Tab";case"backspace":return e?"\u232B":"Backspace";case"delete":return e?"\u2326":"Delete";case"arrowup":return"\u2191";case"arrowdown":return"\u2193";case"arrowleft":return"\u2190";case"arrowright":return"\u2192";default:return t.length===1?t.toUpperCase():t.charAt(0).toUpperCase()+t.slice(1)}}};var Ci=new Set(["current-password","new-password","one-time-code","cc-number","cc-csc"]),ut=class u extends z{options;shortcuts=new Map;scopeStack=[];sequenceBuffer=[];sequenceTimer=null;isListening=!0;isDestroyed=!1;emittedAuditWarnings=new Set;boundListener=null;abortController=null;idCounter=0;constructor(t){super();let e=t?.sequenceTimeout,i=typeof e=="number"&&Number.isFinite(e)&&e>0?Math.min(e,1e4):800;this.options={defaultScope:t?.defaultScope||"global",sequenceTimeout:i,target:t?.target||(typeof window<"u"?window:{}),onError:t?.onError,audit:t?.audit??!0},this.scopeStack=[this.options.defaultScope],this.initListener()}static isEditable(t){if(!t||typeof t.tagName!="string")return!1;let e=t,i=e.tagName.toUpperCase();if(i==="INPUT"){let r=e.type?.toLowerCase()||"text";return!["button","checkbox","radio","submit","reset","range","color","file","image"].includes(r)}if(i==="TEXTAREA"||i==="SELECT")return!0;let s=e.getAttribute?.("contenteditable")?.toLowerCase();if(e.isContentEditable||s==="true"||s==="plaintext-only"||s==="")return!0;let n=e.getAttribute?.("role");return!!(n==="textbox"||n==="searchbox"||n==="combobox"||n==="spinbutton"||typeof e.closest=="function"&&e.closest('[contenteditable="true"], [contenteditable="plaintext-only"], [contenteditable=""], [role="textbox"], [role="searchbox"], [role="combobox"], [role="spinbutton"]'))}static isTypeaheadWidget(t){if(!t||typeof t.tagName!="string")return!1;let e=t,i=e.getAttribute?.("role");return i==="listbox"||i==="menu"||i==="menubar"||i==="tree"||i==="grid"?!0:typeof e.closest=="function"?!!e.closest('[role="listbox"], [role="menu"], [role="menubar"], [role="tree"], [role="grid"]'):!1}static isSensitiveField(t){if(!t||typeof t.tagName!="string")return!1;let e=t;if(e.tagName.toUpperCase()==="INPUT"&&(e.type||"").toLowerCase()==="password")return!0;let i=e.getAttribute?.("data-mask-sensitive");if(i!=null&&i!=="false")return!0;let s=e.getAttribute?.("autocomplete");return!!(s&&s.trim().toLowerCase().split(/\s+/).some(r=>Ci.has(r)))}bind(t){if(this.isDestroyed)return()=>{};let e=Array.isArray(t)?t:[t],i=[];for(let s of e){if(!s.combo||typeof s.handler!="function")continue;let n=W.parseCombo(s.combo);if(n.length===0||n.some(c=>!c.key))continue;let r=`wulf_shortcut_${++this.idCounter}`,o=n.length>1,a=W.format(s.combo),l={...s,id:r,scope:s.scope||"global",category:s.category||"G\xE9n\xE9ral",allowInEditable:s.allowInEditable??!1,preventDefault:s.preventDefault??!0,stopPropagation:s.stopPropagation??!0,priority:s.priority??0,formattedCombo:a,normalizedSteps:n,isSequence:o};this.shortcuts.set(r,l),i.push(r)}if(i.length>0&&this.options.audit){let n=this.audit().filter(r=>!this.emittedAuditWarnings.has(r));n.length>0&&(n.forEach(r=>this.emittedAuditWarnings.add(r)),typeof console<"u"&&typeof console.warn=="function"&&console.warn(`[${this.getAuditPrefix()}] Audit d'accessibilit\xE9 \u2014 ${n.length} contrainte(s) manquante(s) sur ${this.getAuditTargetLabel()} :
5
+ `+n.map(r=>` - ${r}`).join(`
6
+ `)+`
7
+ (${this.getAuditDisableHint()})`))}return()=>{for(let s of i)this.shortcuts.delete(s)}}unbind(t,e){if(typeof t!="string"||!t.trim())return;let i=W.format(t);for(let[s,n]of this.shortcuts.entries())(n.formattedCombo===i||n.combo.trim().toLowerCase()===t.trim().toLowerCase())&&(!e||n.scope===e)&&this.shortcuts.delete(s)}pushScope(t){if(t&&typeof t=="string"){if(this.scopeStack.length>=64)return;this.scopeStack.push(t),this.clearSequenceBuffer()}}popScope(t){if(this.scopeStack.length<=1)return this.scopeStack[0];if(t){if(this.getScope()===t){let i=this.scopeStack.pop();return this.clearSequenceBuffer(),i}return}let e=this.scopeStack.pop();return this.clearSequenceBuffer(),e}setScope(t){this.scopeStack=[t||this.options.defaultScope],this.clearSequenceBuffer()}getScope(){return this.scopeStack[this.scopeStack.length-1]||this.options.defaultScope}getScopeStack(){return[...this.scopeStack]}pause(){this.isListening=!1,this.clearSequenceBuffer()}resume(){this.isDestroyed||(this.isListening=!0)}isActive(){return this.isListening}getRegistry(t){let e=[];for(let i of this.shortcuts.values())(!t||i.scope===t||i.scope==="*")&&e.push({...i,normalizedSteps:i.normalizedSteps.map(s=>({...s}))});return e}audit(){let t=[],e=new Set(["c","v","x","a","z"]);for(let i of this.shortcuts.values())if(i.normalizedSteps.length>0&&i.normalizedSteps.every(n=>!n.ctrl&&!n.alt&&!n.meta&&n.key.length===1)&&t.push(`Raccourci mono-caract\xE8re sans modificateur "${i.combo}" : pr\xE9voyez une option pour le d\xE9sactiver ou le reconfigurer (WCAG 2.1.4).`),i.allowInEditable&&!i.isSequence&&i.normalizedSteps.length===1){let n=i.normalizedSteps[0];!n.alt&&!n.shift&&(n.ctrl&&!n.meta||n.meta&&!n.ctrl)&&e.has(n.key)&&t.push(`Raccourci "${i.combo}" avec allowInEditable: true risque d'\xE9craser une commande d'\xE9dition native (Ctrl/Cmd+${n.key.toUpperCase()}).`)}return t}getAuditPrefix(){return"Wulf.Shortcut"}getAuditTargetLabel(){return`${this.shortcuts.size} raccourci(s)`}attachAria(t,e){if(t&&typeof t.setAttribute=="function"){let i=W.toAriaKeyShortcuts(e);i?t.setAttribute("aria-keyshortcuts",i):typeof t.removeAttribute=="function"&&t.removeAttribute("aria-keyshortcuts")}}static format(t,e){return W.format(t,e)}destroy(){this.isDestroyed||(this.isDestroyed=!0,this.pause(),this.removeListener(),this.shortcuts.clear(),this.emittedAuditWarnings.clear(),this.scopeStack=[],this.clearSequenceBuffer())}initListener(){if(typeof window>"u"||!this.options.target)return;this.abortController=new AbortController,this.boundListener=e=>this.handleKeyDown(e);let t=this.options.target;typeof t.addEventListener=="function"&&t.addEventListener("keydown",this.boundListener,{capture:!1,signal:this.abortController.signal})}removeListener(){if(this.abortController)this.abortController.abort(),this.abortController=null;else if(this.boundListener&&this.options.target){let t=this.options.target;typeof t.removeEventListener=="function"&&t.removeEventListener("keydown",this.boundListener,!1)}this.boundListener=null}handleKeyDown(t){if(this.isDestroyed||!this.isListening||N(t))return;let e=(t.key||"").toLowerCase();if(["control","alt","shift","meta"].includes(e))return;let i=this.getScope(),s=typeof t.composedPath=="function"?t.composedPath():[],n=s.length>0?s:t.target?[t.target]:[],r=u.isEditable(t.target),o=u.isSensitiveField(t.target),a=u.isTypeaheadWidget(t.target);for(let m of n)!r&&u.isEditable(m)&&(r=!0),!o&&u.isSensitiveField(m)&&(o=!0),!a&&u.isTypeaheadWidget(m)&&(a=!0);let l={ctrl:t.ctrlKey,alt:t.altKey,shift:t.shiftKey,meta:t.metaKey,key:W.normalizeKeyName(t.key||"")},c=typeof performance<"u"?performance.now():Date.now();if(this.sequenceBuffer.length>0){let m=this.sequenceBuffer[this.sequenceBuffer.length-1];c-m.timestamp>this.options.sequenceTimeout&&this.clearSequenceBuffer()}let h=this.getActiveShortcuts(i,r,o,a),p=[...this.sequenceBuffer.map(m=>m.step),l],d=this.findMatchingSequence(h,p,t);if(d){this.clearSequenceBuffer(),this.executeShortcut(d,t,i,!0);return}if(this.isPrefixOfAnySequence(h,p,t)){this.sequenceBuffer.push({step:l,timestamp:c}),this.resetSequenceTimer(),t.key.length===1&&!t.ctrlKey&&!t.altKey&&!t.metaKey&&!r&&!a&&t.preventDefault();return}this.clearSequenceBuffer();let f=this.findMatchingChord(h,l,t);f&&this.executeShortcut(f,t,i,!1)}getActiveShortcuts(t,e,i=!1,s=!1){let n=[];for(let r of this.shortcuts.values())if(!(r.scope!==t&&r.scope!=="*")&&!(e&&!r.allowInEditable)){if(s){let o=r.normalizedSteps[0];if(o&&!o.ctrl&&!o.alt&&!o.meta&&o.key.length===1)continue}if(i){if(r.isSequence)continue;let o=r.normalizedSteps[0];if(o){if(o.key.length===1){let a=!o.ctrl&&!o.alt&&!o.meta,l=o.ctrl&&o.alt&&!o.meta||o.alt&&!o.ctrl&&!o.meta;if(a||l)continue}else if(!o.ctrl&&!o.alt&&!o.meta&&(o.key==="backspace"||o.key==="delete"||o.key==="dead"))continue}}n.push(r)}return n.sort((r,o)=>(o.priority??0)-(r.priority??0))}stepMatches(t,e,i){if(t.ctrl!==e.ctrl||t.alt!==e.alt||t.meta!==e.meta)return!1;let s=typeof i?.key=="string"?i.key:"";if(!(t.key===e.key||s!==""&&t.key===s.toLowerCase()))return!1;if(t.shift===e.shift)return!0;if(!t.shift&&e.shift){let r=t.key.length===1&&!/^[a-z]$/i.test(t.key);if(s!==""&&s===t.key||r&&e.key===t.key)return!0}return!1}findMatchingChord(t,e,i){for(let s of t){if(s.isSequence||s.normalizedSteps.length!==1)continue;let n=s.normalizedSteps[0];if(this.stepMatches(n,e,i))return s}return null}findMatchingSequence(t,e,i){for(let s of t){if(!s.isSequence||s.normalizedSteps.length!==e.length)continue;let n=!0;for(let r=0;r<e.length;r++){let o=r===e.length-1?i:void 0;if(!this.stepMatches(s.normalizedSteps[r],e[r],o)){n=!1;break}}if(n)return s}return null}isPrefixOfAnySequence(t,e,i){for(let s of t){if(!s.isSequence||s.normalizedSteps.length<=e.length)continue;let n=!0;for(let r=0;r<e.length;r++){let o=r===e.length-1?i:void 0;if(!this.stepMatches(s.normalizedSteps[r],e[r],o)){n=!1;break}}if(n)return!0}return!1}executeShortcut(t,e,i,s){t.preventDefault&&e.preventDefault(),t.stopPropagation&&e.stopPropagation();let n={combo:t.combo,formattedCombo:t.formattedCombo,scope:i,target:e.target,isSequence:s};try{t.handler(e,n)}catch(r){if(this.options.onError)try{this.options.onError(r instanceof Error?r:new Error(String(r)),t.combo)}catch(o){console.error("[Wulf.Shortcut] Erreur dans le callback onError:",o)}else console.error(`[Wulf.Shortcut] Erreur lors de l'ex\xE9cution du raccourci "${t.combo}":`,r)}}resetSequenceTimer(){this.sequenceTimer&&clearTimeout(this.sequenceTimer),this.sequenceTimer=setTimeout(()=>{this.clearSequenceBuffer()},this.options.sequenceTimeout)}clearSequenceBuffer(){this.sequenceBuffer=[],this.sequenceTimer&&(clearTimeout(this.sequenceTimer),this.sequenceTimer=null)}};var ge={};$(ge,{Anchor:()=>It,default:()=>It});var Mi=0,Ye=["bottom-start","bottom","bottom-end","top-start","top","top-end","right-start","right","right-end","left-start","left","left-end"],xi=new Set(Ye);function We(u){let t=new Set,e=[];if(Array.isArray(u))for(let i of u)typeof i=="string"&&xi.has(i)&&!t.has(i)&&(t.add(i),e.push(i));for(let i of Ye)t.has(i)||e.push(i);return e}var Ei={top:"bottom",bottom:"top",left:"right",right:"left"},fe={menu:"menu",listbox:"listbox",tree:"tree",grid:"grid",dialog:"dialog"};function Rt(u,t){if(typeof u!="string")return typeof HTMLElement<"u"&&u instanceof HTMLElement?u:null;if(!u||typeof document>"u")return null;try{return(t??document).querySelector(u)}catch{return null}}function Ht(u){if(u.parentElement)return u.parentElement;let t=typeof u.getRootNode=="function"?u.getRootNode():null;return typeof ShadowRoot<"u"&&t instanceof ShadowRoot&&t.host instanceof HTMLElement?t.host:null}function me(u){try{return u.matches(":popover-open")||u.matches(":modal")}catch{return u.classList.contains(":popover-open")}}function Wt(u){return typeof window>"u"||typeof window.getComputedStyle!="function"?!1:window.getComputedStyle(u).direction==="rtl"}function Ot(u){let t=u.indexOf("-");return t===-1?[u,null]:[u.slice(0,t),u.slice(t+1)]}function Ii(u,t,e){let i=e?"right":"left",s=u==="top"?"block-start":u==="bottom"?"block-end":null;if(s)return t?`${s} ${t==="start"?"span-inline-end":"span-inline-start"}`:s;let n=u===i?"inline-start":"inline-end";return t?`${n} ${t==="start"?"span-block-end":"span-block-start"}`:n}function ki(u,t){let e=Math.max(u.x,t.x),i=Math.max(u.y,t.y),s=Math.min(u.x+u.width,t.x+t.width),n=Math.min(u.y+u.height,t.y+t.height);return{x:e,y:i,width:Math.max(0,s-e),height:Math.max(0,n-i)}}function Li(){if(typeof window>"u"||typeof document>"u")return{x:0,y:0,width:0,height:0};let u=window.visualViewport;return u?{x:u.offsetLeft,y:u.offsetTop,width:u.width,height:u.height}:{x:0,y:0,width:document.documentElement.clientWidth||window.innerWidth,height:document.documentElement.clientHeight||window.innerHeight}}function Di(u,t){if(t&&typeof t=="object"&&!("nodeType"in t))return{...t};if(typeof HTMLElement<"u"&&t instanceof HTMLElement){let n=t.getBoundingClientRect();return{x:n.left,y:n.top,width:n.width,height:n.height}}let e=Li();if(t==="viewport"||me(u)||typeof window>"u")return e;let i=/(hidden|clip|auto|scroll)/,s=Ht(u);for(;s&&s!==document.body&&s!==document.documentElement;){let n=window.getComputedStyle(s);if(i.test(n.overflow+n.overflowX+n.overflowY)){let r=s.getBoundingClientRect();e=ki(e,{x:r.left+s.clientLeft,y:r.top+s.clientTop,width:s.clientWidth||r.width,height:s.clientHeight||r.height})}s=Ht(s)}return e}function Pi(u,t){if(typeof window>"u")return{x:0,y:0};if(t==="absolute"){let i=u.offsetParent;if(i instanceof HTMLElement&&i!==document.body&&i!==document.documentElement){let s=i.getBoundingClientRect();return{x:s.left+i.clientLeft-i.scrollLeft,y:s.top+i.clientTop-i.scrollTop}}return{x:-window.scrollX,y:-window.scrollY}}if(me(u))return{x:0,y:0};let e=Ht(u);for(;e&&e!==document.documentElement;){let i=window.getComputedStyle(e);if(i.transform!=="none"||i.perspective!=="none"||i.filter!=="none"||i.backdropFilter&&i.backdropFilter!=="none"||/layout|paint|strict|content/.test(i.contain)||/transform|perspective|filter/.test(i.willChange)){let s=e.getBoundingClientRect();return{x:s.left+e.clientLeft-e.scrollLeft,y:s.top+e.clientTop-e.scrollTop}}e=Ht(e)}return{x:0,y:0}}var It=class u extends z{reference;floating;options;anchorName;isDestroyed=!1;isRunning=!1;nativeApplied=!1;rafId=null;resizeObserver=null;abortController=null;savedRefAnchorName="";savedFloatingStyles={};savedPlacementAttr=null;savedArrowStyles=null;constructor(t,e,i={}){super();let s=Rt(t),n=Rt(e);if(!s||!n)throw new Error("[Wulf.Anchor] \xC9l\xE9ments reference et floating valides requis.");this.reference=s,this.floating=n,this.anchorName=`--wulf-anchor-${++Mi}`;let r=i.arrow?typeof i.arrow=="string"?Rt(i.arrow,n)??Rt(i.arrow):Rt(i.arrow):null,o=i.padding,a=typeof o=="number"&&Number.isFinite(o)&&o>=0?o:8,l=i.arrowPadding,c=typeof l=="number"&&Number.isFinite(l)&&l>=0?l:6;this.options={placement:i.placement??"bottom-start",strategy:i.strategy??"fixed",offset:i.offset??8,flip:i.flip??!0,shift:i.shift??!0,padding:a,arrow:r,arrowPadding:c,boundary:i.boundary??"clippingAncestors",autoUpdate:i.autoUpdate??!0,useNativeAnchor:i.useNativeAnchor??!1,preferredPlacements:Array.isArray(i.preferredPlacements)?[...i.preferredPlacements]:void 0,onPosition:i.onPosition,audit:i.audit??!0},this.saveInitialState(),this.update(),this.options.autoUpdate&&this.start(),this.runAuditWarning(this.options.audit)}static supportsNativeAnchor(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("anchor-name","--wulf-a")&&CSS.supports("position-area","block-end")}static computePosition(t,e,i={}){let s=i.placement??"bottom-start",n=i.strategy??"fixed",r=i.flip??!0,o=i.shift??!0,a=typeof i.padding=="number"&&Number.isFinite(i.padding)?Math.max(0,i.padding):8,l=typeof i.arrowPadding=="number"&&Number.isFinite(i.arrowPadding)?Math.max(0,i.arrowPadding):6,c=i.offset??8,h=typeof c=="number"?c:c.mainAxis??8,p=typeof c=="number"?0:c.crossAxis??0,d=t.getBoundingClientRect(),f=e.getBoundingClientRect(),m=Di(e,i.boundary??"clippingAncestors"),g=Pi(e,n),y=Wt(e)||Wt(t),v=(L,M)=>{let D=0,U=0;return L==="top"||L==="bottom"?(U=L==="bottom"?d.bottom+h:d.top-f.height-h,M?D=M==="start"!==y?d.left:d.right-f.width:D=d.left+(d.width-f.width)/2,D+=y?-p:p):(D=L==="right"?d.right+h:d.left-f.width-h,M?U=M==="start"?d.top:d.bottom-f.height:U=d.top+(d.height-f.height)/2,U+=p),{vx:D,vy:U}},b,w,S,T;if(s==="best"){let L=We(i.preferredPlacements),M=L[0];if(f.width>0||f.height>0){let D=m.x+a-.5,U=m.x+m.width-a+.5,ht=m.y+a-.5,Xe=m.y+m.height-a+.5;for(let Ee of L){let[je,Ze]=Ot(Ee),Nt=v(je,Ze);if(Nt.vx>=D&&Nt.vx+f.width<=U&&Nt.vy>=ht&&Nt.vy+f.height<=Xe){M=Ee;break}}}[b,w]=Ot(M),{vx:S,vy:T}=v(b,w)}else if([b,w]=Ot(s),{vx:S,vy:T}=v(b,w),r){let L=Ei[b],M=b==="bottom"?m.y+m.height-a-(d.bottom+h):b==="top"?d.top-h-(m.y+a):b==="right"?m.x+m.width-a-(d.right+h):d.left-h-(m.x+a),D=L==="bottom"?m.y+m.height-a-(d.bottom+h):L==="top"?d.top-h-(m.y+a):L==="right"?m.x+m.width-a-(d.right+h):d.left-h-(m.x+a),U=b==="top"||b==="bottom"?f.height:f.width;M<U&&D>M&&(b=L,{vx:S,vy:T}=v(b,w))}if(o)if(b==="top"||b==="bottom"){let L=m.x+a,M=Math.max(L,m.x+m.width-f.width-a);S=Math.min(Math.max(S,L),M)}else{let L=m.y+a,M=Math.max(L,m.y+m.height-f.height-a);T=Math.min(Math.max(T,L),M)}let A=w?`${b}-${w}`:b,x=Math.round((S-g.x)*100)/100,I=Math.round((T-g.y)*100)/100,E=null,C=null,k=i.arrow instanceof HTMLElement?i.arrow:null;if(k){let L=k.getBoundingClientRect();if(b==="top"||b==="bottom"){let M=Math.max(l,f.width-L.width-l);E=Math.round(Math.min(Math.max(d.left+d.width/2-S-L.width/2,l),M)*100)/100}else{let M=Math.max(l,f.height-L.height-l);C=Math.round(Math.min(Math.max(d.top+d.height/2-T-L.height/2,l),M)*100)/100}}let K=d.right<=m.x||d.left>=m.x+m.width||d.bottom<=m.y||d.top>=m.y+m.height;return{x,y:I,viewportX:Math.round(S*100)/100,viewportY:Math.round(T*100)/100,placement:A,side:b,alignment:w,arrowX:E,arrowY:C,isNative:!1,isReferenceClipped:K}}update(){if(this.isDestroyed){let i=this.options.placement==="best"?We(this.options.preferredPlacements)[0]:this.options.placement,[s,n]=Ot(i);return{x:0,y:0,viewportX:0,viewportY:0,placement:i,side:s,alignment:n,arrowX:null,arrowY:null,isNative:!1,isReferenceClipped:!1}}let t=this.options.useNativeAnchor&&this.options.placement!=="best"&&!this.options.arrow&&this.options.strategy==="fixed"&&u.supportsNativeAnchor(),e;if(t){let i=this.options.placement,[s,n]=Ot(i),r=Wt(this.floating)||Wt(this.reference),o=this.floating.style,a=this.reference.style;a.anchorName=this.anchorName,o.position="fixed",o.inset="auto",o.margin="0",o.positionAnchor=this.anchorName,o.positionArea=Ii(s,n,r),this.options.flip&&(o.positionTryFallbacks="flip-block, flip-inline, flip-block flip-inline"),this.nativeApplied=!0,this.floating.setAttribute("data-anchor-placement",i);let l=this.floating.getBoundingClientRect();e={x:l.left,y:l.top,viewportX:l.left,viewportY:l.top,placement:i,side:s,alignment:n,arrowX:null,arrowY:null,isNative:!0,isReferenceClipped:!1}}else this.nativeApplied&&this.restoreNativeStyles(),e=u.computePosition(this.reference,this.floating,{...this.options,arrow:this.options.arrow}),this.floating.style.position=this.options.strategy,this.floating.style.left=`${e.x}px`,this.floating.style.top=`${e.y}px`,this.floating.style.setProperty("--wulf-anchor-x",`${e.x}px`),this.floating.style.setProperty("--wulf-anchor-y",`${e.y}px`),this.floating.setAttribute("data-anchor-placement",e.placement),this.options.arrow&&(e.arrowX!==null?(this.options.arrow.style.left=`${e.arrowX}px`,this.options.arrow.style.top="",this.options.arrow.style.setProperty("--wulf-anchor-arrow-x",`${e.arrowX}px`)):e.arrowY!==null&&(this.options.arrow.style.top=`${e.arrowY}px`,this.options.arrow.style.left="",this.options.arrow.style.setProperty("--wulf-anchor-arrow-y",`${e.arrowY}px`)));if(this.options.onPosition)try{this.options.onPosition(e)}catch(i){console.error("[Wulf.Anchor] Erreur dans onPosition:",i)}return e}setPlacement(t){return this.isDestroyed||(this.options.placement=t,this.update()),this}start(){if(this.isDestroyed||this.isRunning||typeof window>"u")return this;this.isRunning=!0,this.abortController=new AbortController;let{signal:t}=this.abortController,e=()=>{this.isDestroyed||this.rafId!==null||(this.rafId=window.requestAnimationFrame(()=>{this.rafId=null,this.isDestroyed||this.update()}))};if(typeof ResizeObserver<"u"){let s=new WeakMap;this.resizeObserver=new ResizeObserver(n=>{if(this.isDestroyed)return;let r=!1;for(let o of n){let a=o.borderBoxSize?.[0]?.inlineSize??o.contentRect.width,l=o.borderBoxSize?.[0]?.blockSize??o.contentRect.height,c=s.get(o.target);(!c||Math.abs(a-c.w)>=.5||Math.abs(l-c.h)>=.5)&&(s.set(o.target,{w:a,h:l}),r=!0)}r&&this.update()}),this.resizeObserver.observe(this.reference),this.resizeObserver.observe(this.floating)}let i=new Set;for(let s of[this.reference,this.floating]){let n=s;for(;n;)i.has(n)||(i.add(n),n.addEventListener("scroll",e,{passive:!0,signal:t})),n=Ht(n)}return window.addEventListener("scroll",e,{passive:!0,signal:t}),window.addEventListener("resize",e,{passive:!0,signal:t}),window.visualViewport&&(window.visualViewport.addEventListener("scroll",e,{passive:!0,signal:t}),window.visualViewport.addEventListener("resize",e,{passive:!0,signal:t})),this.floating.addEventListener("beforetoggle",s=>{s.newState==="open"&&(e(),queueMicrotask(()=>{!this.isDestroyed&&me(this.floating)&&this.update()}))},{signal:t}),this}stop(){return this.isRunning=!1,this.rafId!==null&&typeof window<"u"&&(window.cancelAnimationFrame(this.rafId),this.rafId=null),this.abortController?.abort(),this.abortController=null,this.resizeObserver?.disconnect(),this.resizeObserver=null,this}audit(){let t=[],e=this.floating.getAttribute("role");e==="tooltip"?this.checkAriaIdReferences(this.reference,"aria-describedby",t,!0)||t.push('\xC9l\xE9ment role="tooltip" sans liaison aria-describedby valide sur la r\xE9f\xE9rence (WCAG 4.1.2).'):this.reference.hasAttribute("aria-describedby")&&this.checkAriaIdReferences(this.reference,"aria-describedby",t,!0),this.reference.hasAttribute("aria-controls")&&this.checkAriaIdReferences(this.reference,"aria-controls",t,!1);let i=this.reference.getAttribute("aria-haspopup");return i&&fe[i]&&e!==fe[i]&&t.push(`Attribut aria-haspopup="${i}" sur la r\xE9f\xE9rence sans role="${fe[i]}" correspondant sur le panneau.`),t}getAuditPrefix(){return"Wulf.Anchor"}getAuditTargetLabel(){return this.floating.id?`#${this.floating.id}`:`<${this.floating.tagName.toLowerCase()}>`}destroy(){if(this.isDestroyed)return;this.isDestroyed=!0,this.stop(),this.restoreNativeStyles();let t=this.floating.style;t.position=this.savedFloatingStyles.position,t.left=this.savedFloatingStyles.left,t.top=this.savedFloatingStyles.top,this.floating.style.removeProperty("--wulf-anchor-x"),this.floating.style.removeProperty("--wulf-anchor-y"),this.savedPlacementAttr===null?this.floating.removeAttribute("data-anchor-placement"):this.floating.setAttribute("data-anchor-placement",this.savedPlacementAttr),this.options.arrow&&this.savedArrowStyles&&(this.options.arrow.style.left=this.savedArrowStyles.left,this.options.arrow.style.top=this.savedArrowStyles.top,this.options.arrow.style.removeProperty("--wulf-anchor-arrow-x"),this.options.arrow.style.removeProperty("--wulf-anchor-arrow-y"))}restoreNativeStyles(){let t=this.reference.style;t.anchorName=this.savedRefAnchorName;let e=this.floating.style;e.inset=this.savedFloatingStyles.inset,e.margin=this.savedFloatingStyles.margin,e.positionAnchor=this.savedFloatingStyles.positionAnchor,e.positionArea=this.savedFloatingStyles.positionArea,e.positionTryFallbacks=this.savedFloatingStyles.positionTryFallbacks,this.nativeApplied=!1}saveInitialState(){let t=this.reference.style;this.savedRefAnchorName=t.anchorName??"";let e=this.floating.style;this.savedFloatingStyles={position:e.position,left:e.left,top:e.top,inset:e.inset,margin:e.margin,positionAnchor:e.positionAnchor??"",positionArea:e.positionArea??"",positionTryFallbacks:e.positionTryFallbacks??""},this.savedPlacementAttr=this.floating.getAttribute("data-anchor-placement"),this.options.arrow&&(this.savedArrowStyles={left:this.options.arrow.style.left,top:this.options.arrow.style.top})}};var Te={};$(Te,{LocalizedComponent:()=>R,Sortable:()=>gt,createI18nManager:()=>B,default:()=>gt,sortableEn:()=>ve,sortableFr:()=>be,sortableI18n:()=>st});var be={grabbed:(u,t,e)=>`${u} saisi en position ${t} sur ${e}. Utilisez les fl\xE8ches pour d\xE9placer, Entr\xE9e ou Espace pour d\xE9poser, \xC9chap pour annuler.`,moved:(u,t,e)=>`${u} d\xE9plac\xE9 en position ${t} sur ${e}.`,dropped:(u,t,e)=>`${u} d\xE9pos\xE9 en position ${t} sur ${e}.`,cancelled:(u,t,e)=>`D\xE9placement annul\xE9. ${u} replac\xE9 en position ${t} sur ${e}.`,defaultItemLabel:u=>`\xC9l\xE9ment ${u}`};var ve={grabbed:(u,t,e)=>`${u} grabbed at position ${t} of ${e}. Use arrow keys to move, Enter or Space to drop, Escape to cancel.`,moved:(u,t,e)=>`${u} moved to position ${t} of ${e}.`,dropped:(u,t,e)=>`${u} dropped at position ${t} of ${e}.`,cancelled:(u,t,e)=>`Reordering cancelled. ${u} returned to position ${t} of ${e}.`,defaultItemLabel:u=>`Item ${u}`};var st=B("fr",{fr:be,en:ve});var Ri='input, textarea, select, button, a[href], label, [contenteditable], [role="button"], [role="textbox"], [role="searchbox"], [role="combobox"], [role="spinbutton"], [role="slider"]',Oi="button, a[href], input, select, textarea, summary, [tabindex]";function kt(u,t,e,i){return typeof u!="number"||!Number.isFinite(u)?t:Math.min(i,Math.max(e,u))}function Hi(u){if(typeof u=="string"){if(!u)return null;try{return document.querySelector(u)}catch{return null}}return typeof HTMLElement<"u"&&u instanceof HTMLElement?u:null}function ye(u){if(!u||typeof u.tagName!="string")return!1;let t=u,e=t.tagName.toUpperCase();if(e==="INPUT"){let n=t.type?.toLowerCase()||"text";return!["button","checkbox","radio","submit","reset","range","color","file","image"].includes(n)}if(e==="TEXTAREA"||e==="SELECT")return!0;let i=t.getAttribute?.("contenteditable")?.toLowerCase();if(t.isContentEditable||i==="true"||i==="plaintext-only"||i==="")return!0;let s=t.getAttribute?.("role");return s==="textbox"||s==="searchbox"||s==="combobox"||s==="spinbutton"?!0:!!t.closest?.('[contenteditable="true"], [contenteditable="plaintext-only"], [contenteditable=""], [role="textbox"], [role="searchbox"], [role="combobox"], [role="spinbutton"]')}function we(u,t,e,i){if(e.length===0)return;let s=Math.max(0,Math.min(i,e.length)),n=s<e.length?e[s]:e[e.length-1].nextSibling;t.nextSibling!==n&&_(u,t,n)}function Lt(u,t,e){let i=u.slice();if(t<0||t>=i.length)return i;let s=Math.max(0,Math.min(e,i.length-1)),[n]=i.splice(t,1);return i.splice(s,0,n),i}var gt=class extends R{static _i18n=st;static i18n=st;container;options;isDestroyed=!1;isMovingFocus=!1;dragSessionSeq=0;rootAbort=new AbortController;pointerDrag=null;keyboardGrab=null;hadRootClass=!1;savedAttributes=new Map;addedHandles=new Set;activeAnimations=new WeakMap;srStatusEl=null;announceTimerId=null;mutationObserver=null;constructor(t,e={}){if(super(e.i18n),this.options={itemSelector:e.itemSelector,handleSelector:e.handleSelector,axis:e.axis??"y",autoMove:e.autoMove??!0,threshold:kt(e.threshold,5,0,100),animationDuration:kt(e.animationDuration,180,0,2e3),autoScroll:e.autoScroll??!0,autoScrollSpeed:kt(e.autoScrollSpeed,12,1,30),disabled:!!e.disabled,lang:e.lang,getItemLabel:e.getItemLabel,onStart:e.onStart,onMove:e.onMove,onReorder:e.onReorder,onCancel:e.onCancel,audit:e.audit??!0},typeof document>"u"||typeof window>"u"){this.container=null;return}let i=Hi(t);if(!i)throw new Error("[Wulf.Sortable] Conteneur HTMLElement ou s\xE9lecteur CSS valide requis.");this.container=i,this.hadRootClass=i.classList.contains("wulf-sortable"),i.classList.add("wulf-sortable"),this.mountStatusRegion(),this.refresh(),this.bindContainerEvents(),this.observeDomChanges(),this.runAuditWarning(this.options.audit)}getAuditPrefix(){return"Wulf.Sortable"}getAuditTargetLabel(){return this.container?this.container.id?`#${this.container.id}`:`<${this.container.tagName.toLowerCase()}>`:"<ssr>"}getItems(){if(!this.container||this.isDestroyed)return[];if(this.options.itemSelector)try{return Array.from(this.container.querySelectorAll(this.options.itemSelector)).filter(e=>!e.hasAttribute("data-wulf-sortable-ignore")&&!e.classList.contains("wulf-sortable-sr-status"))}catch{return[]}let t=[];for(let e of Array.from(this.container.children))typeof HTMLElement<"u"&&e instanceof HTMLElement&&!e.hasAttribute("data-wulf-sortable-ignore")&&!e.classList.contains("wulf-sortable-sr-status")&&t.push(e);return t}isDisabled(){return this.options.disabled}isDragging(){return!!(this.pointerDrag?.started||this.keyboardGrab)}setDisabled(t){let e=!!t;this.options.disabled!==e&&(this.options.disabled=e,e&&this.cancel())}updateOptions(t){this.isDestroyed||!t||(t.i18n!==void 0&&(this.i18nOverrides=t.i18n),t.itemSelector!==void 0&&(this.options.itemSelector=t.itemSelector),t.handleSelector!==void 0&&(this.options.handleSelector=t.handleSelector),t.axis!==void 0&&(this.options.axis=t.axis),t.autoMove!==void 0&&(this.options.autoMove=!!t.autoMove),t.threshold!==void 0&&(this.options.threshold=kt(t.threshold,5,0,100)),t.animationDuration!==void 0&&(this.options.animationDuration=kt(t.animationDuration,180,0,2e3)),t.autoScroll!==void 0&&(this.options.autoScroll=!!t.autoScroll),t.autoScrollSpeed!==void 0&&(this.options.autoScrollSpeed=kt(t.autoScrollSpeed,12,1,30)),t.lang!==void 0&&(this.options.lang=t.lang),t.getItemLabel!==void 0&&(this.options.getItemLabel=t.getItemLabel),t.onStart!==void 0&&(this.options.onStart=t.onStart),t.onMove!==void 0&&(this.options.onMove=t.onMove),t.onReorder!==void 0&&(this.options.onReorder=t.onReorder),t.onCancel!==void 0&&(this.options.onCancel=t.onCancel),t.disabled!==void 0&&this.setDisabled(t.disabled),this.refresh())}refresh(){if(!this.container||this.isDestroyed)return;let t=this.getItems();for(let e of t){let i=this.resolveTriggerForItem(e);i&&(this.options.handleSelector&&i!==e&&(i.classList.add("wulf-sortable-handle"),this.addedHandles.add(i)),this.savedAttributes.has(i)||this.savedAttributes.set(i,{hadTabIndex:i.hasAttribute("tabindex"),prevTabIndex:i.getAttribute("tabindex"),hadAriaPressed:i.hasAttribute("aria-pressed"),prevAriaPressed:i.getAttribute("aria-pressed")}),!i.matches(Oi)&&!i.hasAttribute("tabindex")&&i.setAttribute("tabindex","0"))}}move(t,e){if(!this.container||this.isDestroyed)return!1;let i=this.getItems();if(!Number.isInteger(t)||!Number.isInteger(e)||t<0||e<0||t>=i.length||e>=i.length||t===e)return!1;let s=i[t],n=i.filter(o=>o!==s),r=Lt(i,t,e);if(this.options.autoMove){let o=this.snapshotRects(i);we(this.container,s,n,e),this.animateFlip(i,o)}return this.emitReorder({item:s,oldIndex:t,newIndex:e,items:r,trigger:"programmatic"}),!0}cancel(){this.isDestroyed||(this.pointerDrag&&this.endPointerDrag(!0),this.keyboardGrab&&this.cancelKeyboardGrab())}audit(){if(!this.container||this.isDestroyed)return[];let t=[],e=!!this.container.getAttribute("aria-label")?.trim(),i=this.checkAriaIdReferences(this.container,"aria-labelledby",t,!0);return this.checkAriaIdReferences(this.container,"aria-describedby",t,!0),!e&&!i&&t.push("Aucun nom accessible d\xE9tect\xE9 sur le conteneur triable (ajoutez aria-label ou aria-labelledby)."),this.container.hasAttribute("aria-live")&&t.push("\xC9vitez aria-live directement sur le conteneur triable (annoncez via une r\xE9gion status d\xE9di\xE9e ou ariaNotify)."),this.getItems().forEach((n,r)=>{let o=n.getAttribute("tabindex");if(o!==null&&Number.parseInt(o,10)>0&&t.push(`\xC9vitez tabindex="${o}" (> 0) sur l'\xE9l\xE9ment #${r+1} pour pr\xE9server l'ordre de tabulation naturel.`),this.options.handleSelector){let a=this.resolveTriggerForItem(n);if(!a||a===n){t.push(`Poign\xE9e introuvable ("${this.options.handleSelector}") dans l'\xE9l\xE9ment #${r+1}.`);return}let l=a.getAttribute("tabindex");l!==null&&Number.parseInt(l,10)>0&&t.push(`\xC9vitez tabindex="${l}" (> 0) sur la poign\xE9e de l'\xE9l\xE9ment #${r+1}.`),a.matches("button:not([disabled]), a[href], input:not([disabled]), [tabindex]")&&a.getAttribute("tabindex")!=="-1"||t.push(`La poign\xE9e de l'\xE9l\xE9ment #${r+1} doit \xEAtre focusable au clavier.`);let h=a.getAttribute("aria-label")?.trim()||a.textContent?.trim()||"",p=this.checkAriaIdReferences(a,"aria-labelledby",t,!0);!h&&!p&&t.push(`La poign\xE9e de l'\xE9l\xE9ment #${r+1} ne poss\xE8de aucun nom accessible.`)}}),t}destroy(){if(!this.isDestroyed){this.isDestroyed=!0,this.cancel(),this.rootAbort.abort(),this.mutationObserver&&(this.mutationObserver.disconnect(),this.mutationObserver=null),this.announceTimerId!==null&&(clearTimeout(this.announceTimerId),this.announceTimerId=null),this.srStatusEl&&(this.srStatusEl.remove(),this.srStatusEl=null),this.container&&(this.clearDropMarker(),this.container.classList.remove("wulf-sortable--dragging"),this.hadRootClass||this.container.classList.remove("wulf-sortable"));for(let t of this.addedHandles)t.classList.remove("wulf-sortable-handle");this.addedHandles.clear();for(let[t,e]of this.savedAttributes.entries())t.classList.remove("wulf-sortable-item--dragging","wulf-sortable-item--grabbed"),t.removeAttribute("data-wulf-dragging"),t.removeAttribute("data-wulf-grabbed"),e.hadTabIndex&&e.prevTabIndex!==null?t.setAttribute("tabindex",e.prevTabIndex):e.hadTabIndex||t.removeAttribute("tabindex"),e.hadAriaPressed&&e.prevAriaPressed!==null?t.setAttribute("aria-pressed",e.prevAriaPressed):e.hadAriaPressed||t.removeAttribute("aria-pressed");this.savedAttributes.clear()}}resolveI18n(){if(this.options.lang){let t=st.getLocale();st.setLocale(this.options.lang);let e=st.getAll(this.i18nOverrides);return st.setLocale(t),e}return st.getAll(this.i18nOverrides)}getItemLabelText(t,e){if(typeof this.options.getItemLabel=="function")try{let n=O(this.options.getItemLabel(t,e),200).trim();if(n)return n}catch{}let i=t.getAttribute("aria-label")||t.getAttribute("data-label")||t.textContent||"",s=O(i,200).replace(/\s+/g," ").trim();return s?s.slice(0,80):this.resolveI18n().defaultItemLabel(e+1)}mountStatusRegion(){if(!this.container||typeof document>"u"||typeof document.ariaNotify=="function")return;let t=document.createElement("div");t.className="wulf-sortable-sr-status",t.setAttribute("role","status"),t.setAttribute("aria-live","polite"),t.setAttribute("aria-atomic","true"),t.setAttribute("data-wulf-sortable-ignore","true");let e=typeof this.container.getRootNode=="function"?this.container.getRootNode():document;(typeof ShadowRoot<"u"&&e instanceof ShadowRoot?e:document.body||this.container).appendChild(t),this.srStatusEl=t}announce(t){if(this.isDestroyed||typeof document>"u")return;let e=O(t,400).trim();if(!e)return;let i=document;if(typeof i.ariaNotify=="function")try{i.ariaNotify(e,{priority:"normal"});return}catch{}this.srStatusEl||this.mountStatusRegion(),this.srStatusEl&&(this.announceTimerId!==null&&(clearTimeout(this.announceTimerId),this.announceTimerId=null),this.srStatusEl.textContent="",this.announceTimerId=setTimeout(()=>{this.announceTimerId=null,!this.isDestroyed&&this.srStatusEl&&(this.srStatusEl.textContent=e)},40))}resolveTriggerForItem(t){if(!this.options.handleSelector)return t;try{return t.querySelector(this.options.handleSelector)??null}catch{return null}}findItemForEvent(t){if(!this.container)return null;let e=this.getItems();if(e.length===0)return null;let i=new Set(e),s=typeof t.composedPath=="function"?t.composedPath():[t.target];for(let n of s){if(n&&i.has(n))return n;if(n===this.container)break}return null}hasInteractiveDescendantBeforeItem(t,e){let i=typeof t.composedPath=="function"?t.composedPath():[t.target];for(let s of i){if(!s||s===e)break;if(typeof Element<"u"&&s instanceof Element&&(ye(s)||s.matches(Ri)))return!0}return!1}findHandleInPath(t,e){if(!this.options.handleSelector)return e;let i=typeof t.composedPath=="function"?t.composedPath():[t.target];for(let s of i)if(s){if(typeof HTMLElement<"u"&&s instanceof HTMLElement)try{if(s.matches(this.options.handleSelector)&&e.contains(s))return s.hasAttribute("disabled")||s.getAttribute("aria-disabled")==="true"?null:s}catch{return null}if(s===e)break}return null}bindContainerEvents(){if(!this.container)return;let t=this.rootAbort.signal;this.container.addEventListener("pointerdown",e=>this.handlePointerDown(e),{signal:t}),this.container.addEventListener("keydown",e=>this.handleKeyDown(e),{signal:t}),this.container.addEventListener("focusout",e=>this.handleFocusOut(e),{signal:t}),this.container.addEventListener("focusin",e=>this.handleFocusIn(e),{signal:t})}observeDomChanges(){!this.container||typeof MutationObserver>"u"||(this.mutationObserver=new MutationObserver(()=>{!this.isDestroyed&&!this.pointerDrag?.started&&this.refresh()}),this.mutationObserver.observe(this.container,{childList:!0}))}handleFocusIn(t){if(!this.container||this.isDestroyed)return;let e=t.target;if(!e||typeof e.matches!="function")return;let i=!1;try{i=e.matches(":focus-visible")}catch{i=!1}if(!i)return;let s=this.findItemForEvent(t);if(!s||typeof s.scrollIntoView!="function")return;typeof s.getAnimations=="function"&&s.getAnimations().some(r=>r.playState==="running")||s.scrollIntoView({block:"nearest",inline:"nearest"})}handlePointerDown(t){if(!this.container||this.isDestroyed||this.options.disabled||this.pointerDrag||t.button!==0||t.isPrimary===!1||ye(t.target))return;let e=this.findItemForEvent(t);if(!e)return;let i=e;if(this.options.handleSelector){if(i=this.findHandleInPath(t,e),!i)return}else if(this.hasInteractiveDescendantBeforeItem(t,e))return;this.keyboardGrab&&this.commitKeyboardGrab();let s=this.getItems(),n=s.indexOf(e);if(n===-1||s.length<2)return;let r=s.filter(l=>l!==e),o=new AbortController;this.pointerDrag={sessionId:++this.dragSessionSeq,pointerId:t.pointerId,item:e,handle:i,oldIndex:n,targetIndex:n,startX:t.clientX,startY:t.clientY,lastClientX:t.clientX,lastClientY:t.clientY,startScrollLeft:this.container.scrollLeft,startScrollTop:this.container.scrollTop,started:!1,prevTranslate:e.style.translate,slotRect:e.getBoundingClientRect(),siblings:r,items:s,abortController:o,rafId:null,lastFrameTime:typeof performance<"u"?performance.now():Date.now()};let a=o.signal;document.addEventListener("pointermove",l=>this.handlePointerMove(l),{signal:a}),document.addEventListener("pointerup",l=>this.handlePointerUp(l),{signal:a}),document.addEventListener("pointercancel",l=>this.handlePointerCancel(l),{signal:a}),document.addEventListener("keydown",l=>this.handlePointerEscape(l),{signal:a}),this.options.threshold===0&&this.activatePointerDrag(this.pointerDrag)}activatePointerDrag(t){if(!this.container||t.started)return;t.started=!0;let e=this.activeAnimations.get(t.item);if(e){try{e.cancel()}catch{}this.activeAnimations.delete(t.item)}try{t.handle.setPointerCapture?.(t.pointerId)}catch{}t.handle.addEventListener("lostpointercapture",()=>{this.pointerDrag===t&&t.started&&this.endPointerDrag(!0)},{signal:t.abortController.signal}),this.container.classList.add("wulf-sortable--dragging"),t.item.classList.add("wulf-sortable-item--dragging"),t.item.setAttribute("data-wulf-dragging","true"),this.safeInvoke(this.options.onStart,{item:t.item,index:t.oldIndex,trigger:"pointer"}),this.options.autoScroll&&this.startAutoScrollLoop(t)}handlePointerMove(t){let e=this.pointerDrag;if(!(!e||t.pointerId!==e.pointerId||!this.container)){if(e.lastClientX=t.clientX,e.lastClientY=t.clientY,!e.started){if(Math.hypot(t.clientX-e.startX,t.clientY-e.startY)<this.options.threshold)return;this.activatePointerDrag(e)}this.updatePointerPosition(e)}}updatePointerPosition(t){if(!this.container)return;let e=this.options.axis,i=this.container.scrollLeft-t.startScrollLeft,s=this.container.scrollTop-t.startScrollTop,n=e==="y"?0:t.lastClientX-t.startX+i,r=e==="x"?0:t.lastClientY-t.startY+s;t.item.style.translate=`${n}px ${r}px`;let o=this.computePointerTargetIndex(t,n,r);if(this.updateDropMarker(t,o),o!==t.targetIndex){let a=t.targetIndex;t.targetIndex=o,this.safeInvoke(this.options.onMove,{item:t.item,oldIndex:t.oldIndex,fromIndex:a,toIndex:o,items:Lt(t.items,t.oldIndex,o),trigger:"pointer"})}}computePointerTargetIndex(t,e,i){if(!this.container)return t.oldIndex;let s=this.options.axis,n=this.container.getBoundingClientRect(),r=this.isRtl();if(s==="y"){let h=Math.max(n.top,Math.min(n.bottom,t.lastClientY)),p=0;for(let d of t.siblings){let f=d.getBoundingClientRect();f.top+f.height/2<h&&p++}return p}if(s==="x"){let h=Math.max(n.left,Math.min(n.right,t.lastClientX)),p=0;for(let d of t.siblings){let f=d.getBoundingClientRect(),m=f.left+f.width/2;(r?m>h:m<h)&&p++}return p}let o=t.lastClientX,a=t.lastClientY,l=t.oldIndex,c=Number.POSITIVE_INFINITY;for(let h=0;h<t.items.length;h++){let p=t.items[h],d=p.getBoundingClientRect();if(p===t.item&&(d=new DOMRect(d.left-e,d.top-i,d.width,d.height)),o>=d.left&&o<=d.right&&a>=d.top&&a<=d.bottom)return h;let f=d.left+d.width/2,m=d.top+d.height/2,g=(o-f)*(o-f)+(a-m)*(a-m);g<c&&(c=g,l=h)}return l}updateDropMarker(t,e){if(!this.container)return;if(e===t.oldIndex||t.siblings.length===0){this.clearDropMarker();return}let i=this.options.axis;this.container.setAttribute("data-wulf-drop",i);let s=3;if(i==="both"){let l=t.items[e];if(l){let c=l.getBoundingClientRect();this.setDropMarkerVars(c.left,c.top,c.width,c.height)}return}let n=t.siblings,r=n[Math.min(e,n.length-1)].getBoundingClientRect();if(i==="y"){let l;if(e===0)l=n[0].getBoundingClientRect().top-s;else if(e>=n.length)l=n[n.length-1].getBoundingClientRect().bottom;else{let c=n[e-1].getBoundingClientRect(),h=n[e].getBoundingClientRect();l=(c.bottom+h.top-s)/2}this.setDropMarkerVars(r.left,l,r.width,s);return}let o=this.isRtl(),a;if(e===0){let l=n[0].getBoundingClientRect();a=o?l.right:l.left-s}else if(e>=n.length){let l=n[n.length-1].getBoundingClientRect();a=o?l.left-s:l.right}else{let l=n[e-1].getBoundingClientRect(),c=n[e].getBoundingClientRect();a=o?(c.right+l.left-s)/2:(l.right+c.left-s)/2}this.setDropMarkerVars(a,r.top,s,r.height)}setDropMarkerVars(t,e,i,s){this.container&&(this.container.style.setProperty("--wulf-drop-x",`${Math.round(t)}px`),this.container.style.setProperty("--wulf-drop-y",`${Math.round(e)}px`),this.container.style.setProperty("--wulf-drop-w",`${Math.max(1,Math.round(i))}px`),this.container.style.setProperty("--wulf-drop-h",`${Math.max(1,Math.round(s))}px`))}clearDropMarker(){this.container&&(this.container.removeAttribute("data-wulf-drop"),this.container.style.removeProperty("--wulf-drop-x"),this.container.style.removeProperty("--wulf-drop-y"),this.container.style.removeProperty("--wulf-drop-w"),this.container.style.removeProperty("--wulf-drop-h"))}startAutoScrollLoop(t){let e=i=>{if(this.pointerDrag!==t||!t.started||!this.container||this.isDestroyed)return;let s=Math.min(64,Math.max(0,i-t.lastFrameTime))/16.6667;t.lastFrameTime=i;let n=this.container.getBoundingClientRect(),r=this.options.axis,o=this.options.autoScrollSpeed*s,a=!1;if(r==="y"||r==="both"){let l=Math.min(t.slotRect.height||40,n.height/3);if(l>0){if(t.lastClientY<n.top+l&&this.container.scrollTop>0){let c=Math.min(2,(n.top+l-t.lastClientY)/l);this.container.scrollTop-=o*c,a=!0}else if(t.lastClientY>n.bottom-l&&this.container.scrollTop<this.container.scrollHeight-this.container.clientHeight){let c=Math.min(2,(t.lastClientY-(n.bottom-l))/l);this.container.scrollTop+=o*c,a=!0}}}if(r==="x"||r==="both"){let l=Math.min(t.slotRect.width||40,n.width/3);if(l>0){if(t.lastClientX<n.left+l){let c=Math.min(2,(n.left+l-t.lastClientX)/l);this.container.scrollLeft-=o*c,a=!0}else if(t.lastClientX>n.right-l){let c=Math.min(2,(t.lastClientX-(n.right-l))/l);this.container.scrollLeft+=o*c,a=!0}}}a&&this.updatePointerPosition(t),t.rafId=requestAnimationFrame(e)};t.rafId=requestAnimationFrame(e)}handlePointerUp(t){let e=this.pointerDrag;!e||t.pointerId!==e.pointerId||this.endPointerDrag(!1)}handlePointerCancel(t){let e=this.pointerDrag;!e||t.pointerId!==e.pointerId||this.endPointerDrag(!0)}handlePointerEscape(t){t.key!=="Escape"||N(t)||!this.pointerDrag||(t.preventDefault(),this.endPointerDrag(!0))}endPointerDrag(t){let e=this.pointerDrag;if(!e||!this.container)return;this.pointerDrag=null,e.abortController.abort(),e.rafId!==null&&(cancelAnimationFrame(e.rafId),e.rafId=null);try{e.handle.hasPointerCapture?.(e.pointerId)&&e.handle.releasePointerCapture(e.pointerId)}catch{}if(!e.started)return;let i=e.item.getBoundingClientRect();this.clearDropMarker(),this.container.classList.remove("wulf-sortable--dragging"),e.item.classList.remove("wulf-sortable-item--dragging"),e.item.removeAttribute("data-wulf-dragging"),e.item.style.translate=e.prevTranslate;let s=!t&&e.targetIndex!==e.oldIndex;if(t){let o=new Map([[e.item,i]]);this.animateFlip([e.item],o),this.safeInvoke(this.options.onCancel,{item:e.item,index:e.oldIndex,trigger:"pointer"});let a=this.getItemLabelText(e.item,e.oldIndex);this.announce(this.resolveI18n().cancelled(a,e.oldIndex+1,e.items.length));return}if(!s){let o=new Map([[e.item,i]]);this.animateFlip([e.item],o);return}let n=Lt(e.items,e.oldIndex,e.targetIndex);if(this.options.autoMove){let o=this.snapshotRects(e.siblings);o.set(e.item,i),we(this.container,e.item,e.siblings,e.targetIndex),e.item.scrollIntoView?.({block:"nearest",inline:"nearest"}),this.animateFlip(n,o)}this.emitReorder({item:e.item,oldIndex:e.oldIndex,newIndex:e.targetIndex,items:n,trigger:"pointer"});let r=this.getItemLabelText(e.item,e.targetIndex);this.announce(this.resolveI18n().dropped(r,e.targetIndex+1,e.items.length))}handleKeyDown(t){if(!this.container||this.isDestroyed||this.options.disabled||N(t)||t.ctrlKey||t.altKey||t.metaKey||ye(t.target))return;let e=this.findItemForEvent(t);if(!e)return;let i=this.resolveTriggerForItem(e),s=t.target;if(this.options.handleSelector){if(!i||s!==i&&!i.contains(s))return}else if(s!==e&&this.hasInteractiveDescendantBeforeItem(t,e))return;let n=i??e;if(t.key===" "||t.key==="Enter"){t.preventDefault(),this.keyboardGrab&&this.keyboardGrab.item===e?this.commitKeyboardGrab():this.startKeyboardGrab(e,n);return}if(!this.keyboardGrab||this.keyboardGrab.item!==e)return;if(t.key==="Escape"){t.preventDefault(),this.cancelKeyboardGrab();return}let r=this.computeKeyboardNextIndex(t.key,this.keyboardGrab);r!==null&&(t.preventDefault(),this.stepKeyboardGrab(r))}startKeyboardGrab(t,e){if(!this.container)return;this.keyboardGrab&&this.commitKeyboardGrab();let i=this.getItems(),s=i.indexOf(t);if(s===-1||i.length<2)return;this.keyboardGrab={item:t,trigger:e,originIndex:s,currentIndex:s,initialOrder:i.slice(),tailRef:i[i.length-1]?.nextSibling??null},this.container.classList.add("wulf-sortable--dragging"),t.classList.add("wulf-sortable-item--grabbed"),t.setAttribute("data-wulf-grabbed","true"),e.setAttribute("aria-pressed","true"),this.safeInvoke(this.options.onStart,{item:t,index:s,trigger:"keyboard"});let n=this.getItemLabelText(t,s);this.announce(this.resolveI18n().grabbed(n,s+1,i.length))}computeKeyboardNextIndex(t,e){let i=this.options.axis,s=this.isRtl(),n=this.options.autoMove?this.getItems():Lt(e.initialOrder,e.originIndex,e.currentIndex),r=n.length,o=e.currentIndex;if(t==="Home")return 0;if(t==="End")return r-1;if(i==="y")return t==="ArrowUp"?Math.max(0,o-1):t==="ArrowDown"?Math.min(r-1,o+1):null;if(i==="x")return t==="ArrowLeft"?s?Math.min(r-1,o+1):Math.max(0,o-1):t==="ArrowRight"?s?Math.max(0,o-1):Math.min(r-1,o+1):null;if(t==="ArrowLeft")return s?Math.min(r-1,o+1):Math.max(0,o-1);if(t==="ArrowRight")return s?Math.max(0,o-1):Math.min(r-1,o+1);if(t!=="ArrowUp"&&t!=="ArrowDown")return null;let a=e.item.getBoundingClientRect(),l=a.left+a.width/2,c=a.top+a.height/2,h=Math.max(4,a.height*.35),p=[];for(let v=0;v<r;v++){if(v===o)continue;let b=n[v].getBoundingClientRect(),w=b.top+b.height/2;t==="ArrowDown"&&w-c>h?p.push({index:v,cx:b.left+b.width/2,cy:w}):t==="ArrowUp"&&c-w>h&&p.push({index:v,cx:b.left+b.width/2,cy:w})}if(p.length===0)return o;let d=t==="ArrowDown"?Math.min(...p.map(v=>v.cy)):Math.max(...p.map(v=>v.cy)),f=Math.max(8,a.height*.5),m=p.filter(v=>Math.abs(v.cy-d)<=f),g=m[0],y=Math.abs(g.cx-l);for(let v=1;v<m.length;v++){let b=Math.abs(m[v].cx-l);b<y&&(y=b,g=m[v])}return g.index}stepKeyboardGrab(t){let e=this.keyboardGrab;if(!e||!this.container||t===e.currentIndex)return;let i=e.currentIndex,s=this.getItems(),n=s.length;if(this.options.autoMove){let a=this.snapshotRects(s),l=s.filter(c=>c!==e.item);this.isMovingFocus=!0;try{we(this.container,e.item,l,t),e.item.scrollIntoView?.({block:"nearest",inline:"nearest"}),H()!==e.trigger&&e.trigger.focus({preventScroll:!0})}finally{this.isMovingFocus=!1}this.animateFlip(s,a)}e.currentIndex=t;let r=this.options.autoMove?this.getItems():Lt(e.initialOrder,e.originIndex,t);this.safeInvoke(this.options.onMove,{item:e.item,oldIndex:e.originIndex,fromIndex:i,toIndex:t,items:r,trigger:"keyboard"});let o=this.getItemLabelText(e.item,t);this.announce(this.resolveI18n().moved(o,t+1,n))}clearKeyboardGrabVisuals(t){this.container?.classList.remove("wulf-sortable--dragging"),t.item.classList.remove("wulf-sortable-item--grabbed"),t.item.removeAttribute("data-wulf-grabbed");let e=this.savedAttributes.get(t.trigger);e?.hadAriaPressed&&e.prevAriaPressed!==null?t.trigger.setAttribute("aria-pressed",e.prevAriaPressed):t.trigger.removeAttribute("aria-pressed")}commitKeyboardGrab(){let t=this.keyboardGrab;if(t&&(this.keyboardGrab=null,this.clearKeyboardGrabVisuals(t),t.currentIndex!==t.originIndex)){let e=this.options.autoMove?this.getItems():Lt(t.initialOrder,t.originIndex,t.currentIndex);this.emitReorder({item:t.item,oldIndex:t.originIndex,newIndex:t.currentIndex,items:e,trigger:"keyboard"});let i=this.getItemLabelText(t.item,t.currentIndex);this.announce(this.resolveI18n().dropped(i,t.currentIndex+1,e.length))}}cancelKeyboardGrab(){let t=this.keyboardGrab;if(!t||!this.container)return;if(this.keyboardGrab=null,this.options.autoMove&&t.currentIndex!==t.originIndex){let s=this.getItems(),n=this.snapshotRects(s);this.isMovingFocus=!0;try{let r=t.tailRef&&t.tailRef.parentNode===this.container?t.tailRef:null;for(let o of t.initialOrder)o.parentNode===this.container&&o!==r&&_(this.container,o,r);t.item.scrollIntoView?.({block:"nearest",inline:"nearest"}),H()!==t.trigger&&t.trigger.focus({preventScroll:!0})}finally{this.isMovingFocus=!1}this.animateFlip(t.initialOrder,n)}this.clearKeyboardGrabVisuals(t),this.safeInvoke(this.options.onCancel,{item:t.item,index:t.originIndex,trigger:"keyboard"});let e=this.getItems().length||t.initialOrder.length,i=this.getItemLabelText(t.item,t.originIndex);this.announce(this.resolveI18n().cancelled(i,t.originIndex+1,e))}handleFocusOut(t){if(this.isMovingFocus||!this.keyboardGrab)return;let e=this.keyboardGrab,i=t.relatedTarget;(!i||i!==e.trigger&&!e.trigger.contains(i))&&this.commitKeyboardGrab()}snapshotRects(t){let e=new Map;for(let i of t){let s=this.activeAnimations.get(i);if(s){try{s.finish()}catch{}this.activeAnimations.delete(i)}e.set(i,i.getBoundingClientRect())}return e}animateFlip(t,e){let i=this.options.animationDuration;if(!(i<=0||rt()))for(let s of t){if(typeof s.animate!="function")continue;let n=e.get(s);if(!n)continue;let r=s.getBoundingClientRect(),o=n.left-r.left,a=n.top-r.top;if(!(Math.abs(o)<.5&&Math.abs(a)<.5))try{let l=s.animate([{translate:`${o}px ${a}px`},{translate:"0px 0px"}],{duration:i,easing:"cubic-bezier(0.2, 0.8, 0.2, 1)"});this.activeAnimations.set(s,l),l.addEventListener("finish",()=>{this.activeAnimations.get(s)===l&&this.activeAnimations.delete(s)},{once:!0})}catch{}}}isRtl(){return!this.container||typeof window>"u"||typeof window.getComputedStyle!="function"?!1:window.getComputedStyle(this.container).direction==="rtl"}emitReorder(t){this.safeInvoke(this.options.onReorder,t),this.container&&typeof CustomEvent=="function"&&this.container.dispatchEvent(new CustomEvent("wulf:sortable:reorder",{bubbles:!0,detail:t}))}safeInvoke(t,e){if(typeof t=="function")try{t(e)}catch{}}};var Ae={};$(Ae,{Autosize:()=>vt,default:()=>vt});function bt(u){if(u==null||u==="")return;let t=typeof u=="number"?u:Number(u);return Number.isFinite(t)&&t>0?t:void 0}function Se(u){let t=bt(u);return t!==void 0&&Math.floor(t)||void 0}function Ni(u){if(typeof document>"u")return null;let t=typeof u=="string"?(()=>{try{return u?document.querySelector(u):null}catch{return null}})():u;return typeof HTMLTextAreaElement<"u"&&t instanceof HTMLTextAreaElement?t:null}function $e(u){if(u.assignedSlot)return u.assignedSlot;if(u.parentElement)return u.parentElement;let t=typeof u.getRootNode=="function"?u.getRootNode():null;return typeof ShadowRoot<"u"&&t instanceof ShadowRoot&&t.host instanceof Element?t.host:null}function Fi(u){let t=[],e=$e(u);for(;e;){if(e.scrollTop!==0||e.scrollLeft!==0)t.push({el:e,top:e.scrollTop,left:e.scrollLeft});else if(typeof window<"u"&&typeof window.getComputedStyle=="function"){let n=window.getComputedStyle(e).overflowY;(n==="auto"||n==="scroll"||n==="overlay")&&t.push({el:e,top:e.scrollTop,left:e.scrollLeft})}e=$e(e)}let i=typeof window<"u"?window.scrollX:0,s=typeof window<"u"?window.scrollY:0;return{ancestors:t,winX:i,winY:s}}function Ge(u){for(let t of u.ancestors)t.el.scrollTop!==t.top&&(t.el.scrollTop=t.top),t.el.scrollLeft!==t.left&&(t.el.scrollLeft=t.left);typeof window<"u"&&(window.scrollX!==u.winX||window.scrollY!==u.winY)&&window.scrollTo(u.winX,u.winY)}var vt=class u extends z{element;mode="fallback";options;disabled;isDestroyed=!1;isMeasuring=!1;savedStyles=null;abortController=null;resizeObserver=null;rafId=null;lastInlineSize=null;lastHeight=0;lastAppliedHeight=null;manualHeightPx=null;constructor(t,e={}){super(),this.element=Ni(t),this.options={useNativeFieldSizing:e.useNativeFieldSizing??!0,resize:e.resize==="vertical"?"vertical":"none",observeFonts:e.observeFonts??!0,audit:e.audit??!0,...e},this.disabled=!!this.options.disabled,this.element&&(this.captureInitialStyles(this.element),this.lastHeight=this.readBoundingHeight(this.element),this.bindEvents(),this.disabled||this.applyModeAndMeasure(!1),this.runAuditWarning(this.options.audit!==!1))}static supportsNativeFieldSizing(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("field-sizing","content")}static initAll(t,e={}){if(typeof document>"u")return[];let s=(t??document).querySelectorAll("textarea[data-wulf-autosize]"),n=[];for(let r of s){let o=r.getAttribute("data-wulf-resize"),a=r.getAttribute("data-wulf-native"),l={minRows:Se(r.getAttribute("data-wulf-min-rows")),maxRows:Se(r.getAttribute("data-wulf-max-rows")),minHeight:bt(r.getAttribute("data-wulf-min-height")),maxHeight:bt(r.getAttribute("data-wulf-max-height")),resize:o==="vertical"?"vertical":"none",useNativeFieldSizing:a==="false"?!1:void 0,...e};n.push(new u(r,l))}return n}update(){return this.isDestroyed||!this.element||this.disabled?this.lastHeight:this.applyModeAndMeasure(!0)}reset(){this.isDestroyed||!this.element||(this.manualHeightPx=null,this.disabled||this.applyModeAndMeasure(!0))}setDisabled(t){if(this.isDestroyed||!this.element)return;let e=!!t;this.disabled!==e&&(this.disabled=e,e?this.restoreInitialStyles():this.applyModeAndMeasure(!0))}isDisabled(){return this.disabled}updateOptions(t){if(this.isDestroyed||!t)return;let e=this.disabled;this.options={...this.options,...t},t.resize!==void 0&&(this.options.resize=t.resize==="vertical"?"vertical":"none",this.options.resize==="none"&&(this.manualHeightPx=null)),t.disabled!==void 0&&(this.disabled=!!t.disabled),this.element&&(this.disabled?e||this.restoreInitialStyles():this.applyModeAndMeasure(!0))}audit(){let t=[],e=this.element;if(!e)return t.push("\xC9l\xE9ment cible introuvable ou non valide (un <textarea> est requis)."),t;let i=!!e.getAttribute("aria-label")?.trim(),s=this.checkAriaIdReferences(e,"aria-labelledby",t,!0),n=this.hasNonEmptyLabel(e);!i&&!s&&!n&&(e.getAttribute("placeholder")?.trim()?t.push("Un placeholder est pr\xE9sent sans libell\xE9 accessible persistant (<label>, aria-label ou aria-labelledby) \u2014 non conforme WCAG 3.3.2."):t.push('Aucun nom accessible d\xE9tect\xE9 sur le <textarea> (ajoutez un <label for="...">, un <label> englobant, aria-label ou aria-labelledby).')),e.hasAttribute("aria-describedby")&&this.checkAriaIdReferences(e,"aria-describedby",t),e.hasAttribute("aria-errormessage")&&this.checkAriaIdReferences(e,"aria-errormessage",t);let r=e.getAttribute("tabindex");if(r!==null){let o=Number.parseInt(r,10);Number.isFinite(o)&&o>0&&t.push(`\xC9vitez tabindex="${o}" (> 0) qui perturbe l'ordre de tabulation naturel.`)}return t}getAuditPrefix(){return"Wulf.Autosize"}getAuditTargetLabel(){return this.element&&this.element.id?`#${this.element.id}`:"<textarea>"}destroy(){this.isDestroyed||(this.isDestroyed=!0,this.rafId!==null&&typeof cancelAnimationFrame=="function"&&(cancelAnimationFrame(this.rafId),this.rafId=null),this.resizeObserver&&(this.resizeObserver.disconnect(),this.resizeObserver=null),this.abortController&&(this.abortController.abort(),this.abortController=null),this.restoreInitialStyles())}hasNonEmptyLabel(t){if(t.labels&&t.labels.length>0){for(let i of Array.from(t.labels))if((i.textContent?.trim()||"").length>0)return!0}if(t.id){let i=typeof t.getRootNode=="function"?t.getRootNode():document,s=i&&"querySelector"in i?i:document;try{let n=s.querySelector(`label[for="${j(t.id)}"]`);if(n&&(n.textContent?.trim()||"").length>0)return!0}catch{}}let e=typeof t.closest=="function"?t.closest("label"):null;return!!(e&&(e.textContent?.trim()||"").length>0)}captureInitialStyles(t){this.savedStyles={height:t.style.height,blockSize:t.style.blockSize,minBlockSize:t.style.minBlockSize,maxBlockSize:t.style.maxBlockSize,overflowY:t.style.overflowY,resize:t.style.resize,fieldSizing:t.style.getPropertyValue("field-sizing"),hadDataAttr:t.hasAttribute("data-wulf-autosize"),prevDataAttr:t.getAttribute("data-wulf-autosize")}}restoreInitialStyles(){let t=this.element,e=this.savedStyles;if(!t||!e)return;t.classList.remove("wulf-autosize","wulf-autosize--native","wulf-autosize--fallback","wulf-autosize--resize-none","wulf-autosize--resize-vertical");let i=(s,n)=>{n?t.style.setProperty(s,n):t.style.removeProperty(s)};i("height",e.height),i("block-size",e.blockSize),i("min-block-size",e.minBlockSize),i("max-block-size",e.maxBlockSize),i("overflow-y",e.overflowY),i("resize",e.resize),i("field-sizing",e.fieldSizing),e.hadDataAttr&&e.prevDataAttr!==null?t.setAttribute("data-wulf-autosize",e.prevDataAttr):e.hadDataAttr?t.setAttribute("data-wulf-autosize",""):t.removeAttribute("data-wulf-autosize")}bindEvents(){let t=this.element;if(!t||typeof window>"u")return;this.abortController=new AbortController;let{signal:e}=this.abortController,i=()=>{!this.isDestroyed&&!this.disabled&&this.mode==="fallback"&&this.applyModeAndMeasure(!0)};t.addEventListener("input",i,{signal:e}),t.addEventListener("change",i,{signal:e}),t.form&&t.form.addEventListener("reset",()=>{queueMicrotask(()=>{!this.isDestroyed&&!this.disabled&&(this.manualHeightPx=null,this.applyModeAndMeasure(!0))})},{signal:e});let s=()=>{!this.isDestroyed&&!this.disabled&&this.options.resize==="vertical"&&this.captureManualResizeIfNeeded()};window.addEventListener("pointerup",s,{signal:e,passive:!0}),window.addEventListener("mouseup",s,{signal:e,passive:!0}),this.options.observeFonts!==!1&&typeof document<"u"&&document.fonts?.ready&&document.fonts.ready.then(()=>{!this.isDestroyed&&!this.disabled&&this.applyModeAndMeasure(!0)}).catch(()=>{}),typeof ResizeObserver<"u"&&(this.resizeObserver=new ResizeObserver(n=>{if(this.isDestroyed||this.disabled||!this.element)return;let r=n[0];if(!r)return;let o=r.borderBoxSize&&r.borderBoxSize[0]?r.borderBoxSize[0].inlineSize:r.contentRect.width,a=r.borderBoxSize&&r.borderBoxSize[0]?r.borderBoxSize[0].blockSize:r.contentRect.height;if(this.mode==="native"){if(a>0&&Math.abs(a-this.lastHeight)>=.5){let p=this.lastHeight;this.lastHeight=a,this.emitResize(a,p,this.isElementOverflowing(this.element))}return}!this.isMeasuring&&this.options.resize==="vertical"&&this.captureManualResizeIfNeeded(a);let l=this.lastInlineSize,c=l===0&&o>0,h=l!==null&&Math.abs(o-l)>=.5;this.lastInlineSize=o,(c||h)&&this.scheduleUpdate()}),this.resizeObserver.observe(t))}captureManualResizeIfNeeded(t){let e=this.element;if(!e||this.isMeasuring||this.lastAppliedHeight===null)return;let i=e.style.height;if(!i)return;let s=i.endsWith("px")?parseFloat(i):NaN,n=Number.isFinite(s)&&s>0?s:NaN;if(!Number.isFinite(n)){let r=t??this.readBoundingHeight(e),o=typeof window<"u"&&typeof window.getComputedStyle=="function"?window.getComputedStyle(e):null;if(o&&o.boxSizing!=="border-box"){let a=(parseFloat(o.paddingTop)||0)+(parseFloat(o.paddingBottom)||0),l=(parseFloat(o.borderTopWidth)||0)+(parseFloat(o.borderBottomWidth)||0);n=Math.max(0,r-a-l)}else n=r}if(n>0&&Math.abs(n-this.lastAppliedHeight)>=2){this.manualHeightPx=n,this.lastAppliedHeight=n;let r=this.isElementOverflowing(e);e.style.overflowY=r?"auto":"hidden";let o=t??this.readBoundingHeight(e);if(Math.abs(o-this.lastHeight)>=.5){let a=this.lastHeight;this.lastHeight=o,this.emitResize(o,a,r)}}}scheduleUpdate(){if(this.rafId!==null)return;let t=typeof requestAnimationFrame=="function"?requestAnimationFrame:e=>setTimeout(e,0);this.rafId=t(()=>{this.rafId=null,!this.isDestroyed&&!this.disabled&&this.applyModeAndMeasure(!0)})}readBoundingHeight(t){return typeof t.getBoundingClientRect=="function"?t.getBoundingClientRect().height:0}isElementOverflowing(t){return t.scrollHeight>t.clientHeight+1}computeBounds(t){let e=typeof window<"u"&&typeof window.getComputedStyle=="function"?window.getComputedStyle(t):null,i=e&&parseFloat(e.fontSize)||16,s=e?parseFloat(e.lineHeight):NaN,n=Number.isFinite(s)&&s>0?s:i*1.2,r=e?(parseFloat(e.paddingTop)||0)+(parseFloat(e.paddingBottom)||0):0,o=e?(parseFloat(e.borderTopWidth)||0)+(parseFloat(e.borderBottomWidth)||0):0,a=e?e.boxSizing==="border-box":!0,l=a?r+o:0,c=bt(this.options.minRows),h=Se(t.getAttribute("rows")),p=c??h,d=p!==void 0?p*n+l:0,f=bt(this.options.minHeight)??0,m=Math.max(d,f),g=bt(this.options.maxRows),y=g!==void 0?g*n+l:1/0,v=bt(this.options.maxHeight)??1/0,b=Math.min(y,v);return b<m&&(b=m),{minPx:m,maxPx:b,paddingY:r,borderY:o,isBorderBox:a}}applyModeAndMeasure(t){let e=this.element;if(!e)return 0;let i=this.options.resize==="vertical"?"vertical":"none",s=this.options.useNativeFieldSizing!==!1&&u.supportsNativeFieldSizing()&&i==="none"&&this.manualHeightPx===null;this.mode=s?"native":"fallback",e.classList.add("wulf-autosize"),e.classList.toggle("wulf-autosize--native",s),e.classList.toggle("wulf-autosize--fallback",!s),e.classList.toggle("wulf-autosize--resize-none",i==="none"),e.classList.toggle("wulf-autosize--resize-vertical",i==="vertical"),e.setAttribute("data-wulf-autosize",this.mode);let n=this.computeBounds(e);if(s){e.style.setProperty("field-sizing","content"),e.style.blockSize="auto",e.style.resize="none",e.style.removeProperty("height"),e.style.removeProperty("overflow-y"),n.minPx>0?e.style.minBlockSize=`${Math.ceil(n.minPx)}px`:e.style.removeProperty("min-block-size"),Number.isFinite(n.maxPx)?e.style.maxBlockSize=`${Math.ceil(n.maxPx)}px`:e.style.removeProperty("max-block-size");let l=typeof e.getBoundingClientRect=="function"?e.getBoundingClientRect():null;if(l&&(this.lastInlineSize=l.width,l.height>0)){let c=this.lastHeight;this.lastHeight=l.height,t&&Math.abs(l.height-c)>=.5&&this.emitResize(l.height,c,this.isElementOverflowing(e))}return this.lastHeight}e.style.removeProperty("field-sizing"),e.style.removeProperty("block-size"),e.style.removeProperty("min-block-size"),e.style.removeProperty("max-block-size"),e.style.resize=i;let r=typeof e.getBoundingClientRect=="function"?e.getBoundingClientRect():null;if(!e.isConnected||!r||r.width===0)return this.lastInlineSize=r?r.width:0,this.lastHeight;if(this.lastInlineSize=r.width,this.manualHeightPx!==null){let l=Math.ceil(this.manualHeightPx);e.style.height=`${l}px`,this.lastAppliedHeight=l,e.style.overflowY=this.isElementOverflowing(e)?"auto":"hidden";let c=this.readBoundingHeight(e);return c>0&&(this.lastHeight=c),this.lastHeight}let o=Fi(e),a=e.style.height;this.isMeasuring=!0;try{e.style.height="auto";let l=e.scrollHeight;if(l===0)return e.style.height=a,Ge(o),this.lastHeight;let c=n.isBorderBox?l+n.borderY:Math.max(0,l-n.paddingY),h=Number.isFinite(n.maxPx)&&c>n.maxPx+.5,p=Math.ceil(Math.min(n.maxPx,Math.max(n.minPx,c)));e.style.height=`${p}px`,e.style.overflowY=h?"auto":"hidden",this.lastAppliedHeight=p,Ge(o);let d=this.lastHeight;return this.lastHeight=p,t&&Math.abs(p-d)>=.5&&this.emitResize(p,d,h),p}finally{this.isMeasuring=!1}}emitResize(t,e,i){let s=this.element;if(!s)return;let n={textarea:s,height:t,previousHeight:e,overflowing:i,mode:this.mode};if(typeof this.options.onResize=="function")try{this.options.onResize(n)}catch(r){console.error("[Wulf.Autosize] Erreur dans onResize :",r)}typeof CustomEvent=="function"&&s.dispatchEvent(new CustomEvent("wulf:autosize:resize",{detail:n,bubbles:!0}))}};var xe={};$(xe,{LocalizedComponent:()=>R,Undo:()=>nt,UndoManager:()=>nt,createI18nManager:()=>B,default:()=>nt,undoEn:()=>Me,undoFr:()=>Ce,undoI18n:()=>ct});var Ce={undone:u=>u?`Action annul\xE9e : ${u}`:"Action annul\xE9e.",redone:u=>u?`Action r\xE9tablie : ${u}`:"Action r\xE9tablie.",nothingToUndo:"Aucune action \xE0 annuler.",nothingToRedo:"Aucune action \xE0 r\xE9tablir."};var Me={undone:u=>u?`Undone: ${u}`:"Action undone.",redone:u=>u?`Redone: ${u}`:"Action redone.",nothingToUndo:"Nothing to undo.",nothingToRedo:"Nothing to redo."};var ct=B("fr",{fr:Ce,en:Me});var zi=new Set(["current-password","new-password","one-time-code","cc-number","cc-csc"]);function qe(u,t,e,i){return typeof u!="number"||!Number.isFinite(u)?t:Math.min(i,Math.max(e,Math.floor(u)))}function Yt(){return typeof performance<"u"&&typeof performance.now=="function"?performance.now():Date.now()}function _e(){if(typeof navigator>"u")return!1;let t=navigator.userAgentData?.platform||navigator.platform||navigator.userAgent||"";return/mac|iphone|ipad|ipod/i.test(t)}function Bi(u){if(!u||typeof u.tagName!="string")return!1;let t=u,e=t.tagName.toUpperCase();if(e==="INPUT"){let n=t.type?.toLowerCase()||"text";return!["button","checkbox","radio","submit","reset","range","color","file","image"].includes(n)}if(e==="TEXTAREA"||e==="SELECT")return!0;let i=t.getAttribute?.("contenteditable")?.toLowerCase();if(t.isContentEditable||i==="true"||i==="plaintext-only"||i==="")return!0;let s=t.getAttribute?.("role");return s==="textbox"||s==="searchbox"||s==="combobox"||s==="spinbutton"?!0:!!(typeof t.closest=="function"&&t.closest('[contenteditable="true"], [contenteditable="plaintext-only"], [contenteditable=""], [role="textbox"], [role="searchbox"], [role="combobox"], [role="spinbutton"]'))}function Ui(u){if(!u||typeof u.tagName!="string")return!1;let t=u;if(t.tagName.toUpperCase()==="INPUT"&&(t.type||"").toLowerCase()==="password")return!0;let e=t.getAttribute?.("data-mask-sensitive");if(e!=null&&e!=="false")return!0;let i=t.getAttribute?.("autocomplete");return!!(i&&i.trim().toLowerCase().split(/\s+/).some(n=>zi.has(n)))}function $t(u){return typeof u!="string"?void 0:O(u,256).trim()||void 0}var nt=class extends R{static _i18n=ct;maxDepth;coalesceMs;cloneStrategy;equalsFn;keyboardOptions;announceEnabled;announceRoot;langOverride;onChange;onUndo;onRedo;onError;stack=[];index=0;lastPushTime=-1/0;batchDepth=0;batchHasChange=!1;batchPendingState;batchPendingLabel;isApplying=!1;paused=!1;isDestroyed=!1;abortController=null;bindings=new Set;srStatusEl=null;announceTimerId=null;constructor(t,e={}){super(e.i18n),this.maxDepth=qe(e.maxDepth,100,1,1e4),this.coalesceMs=qe(e.coalesceMs,500,0,6e4),this.cloneStrategy=e.clone??"structured",this.equalsFn=e.equals,this.announceEnabled=e.announce??!0,this.announceRoot=e.announceRoot??null,this.langOverride=e.lang,this.onChange=e.onChange,this.onUndo=e.onUndo,this.onRedo=e.onRedo,this.onError=e.onError,e.keyboard===!1?this.keyboardOptions=null:typeof e.keyboard=="object"&&e.keyboard!==null?this.keyboardOptions={...e.keyboard}:this.keyboardOptions={},this.stack=[{state:this.cloneState(t),timestamp:Yt()}],this.index=0,this.bindKeyboard(),this.runAuditWarning(e.audit??!0)}push(t,e){if(this.isDestroyed||this.isApplying)return!1;let i=$t(e?.label),s=this.cloneState(t);if(this.batchDepth>0)return this.batchPendingState=s,this.batchHasChange=!0,i&&!this.batchPendingLabel&&(this.batchPendingLabel=i),!0;let n=this.stack[this.index];if(this.equalsFn&&n&&this.equalsFn(n.state,s))return!1;let r=n.state;this.stack.length=this.index+1;let o=Yt();return e?.coalesce!==!1&&this.index>0&&this.coalesceMs>0&&o-this.lastPushTime<=this.coalesceMs&&(e?.mergeKey!==void 0&&n.mergeKey===e.mergeKey||e?.mergeKey===void 0&&n.mergeKey===void 0)?this.stack[this.index]={state:s,label:i??n.label,mergeKey:e?.mergeKey,timestamp:o}:(this.stack.push({state:s,label:i,mergeKey:e?.mergeKey,timestamp:o}),this.trimToMaxDepth(),this.index=this.stack.length-1),this.lastPushTime=o,this.syncControls(),this.notifyCallback(this.onChange,"push",this.stack[this.index].state,r,this.stack[this.index].label),!0}undo(){return this.isDestroyed||this.isApplying||!this.canUndo()?null:this.stepTo(this.index-1,"undo")}redo(){return this.isDestroyed||this.isApplying||!this.canRedo()?null:this.stepTo(this.index+1,"redo")}go(t){return this.isDestroyed||this.isApplying||!Number.isInteger(t)||t<0||t>=this.stack.length||t===this.index?null:this.stepTo(t,"go")}batch(t,e){if(this.isDestroyed)return t();let i=this.batchDepth===0;i?(this.batchHasChange=!1,this.batchPendingState=void 0,this.batchPendingLabel=$t(e)):e&&!this.batchPendingLabel&&(this.batchPendingLabel=$t(e)),this.batchDepth++;try{let s=t();if(i&&this.batchHasChange&&this.batchPendingState!==void 0){let n=this.batchPendingState,r=this.batchPendingLabel,o=this.stack[this.index];if(!this.equalsFn||!this.equalsFn(o.state,n)){let a=o.state;this.stack.length=this.index+1,this.stack.push({state:n,label:r,timestamp:Yt()}),this.trimToMaxDepth(),this.index=this.stack.length-1,this.lastPushTime=-1/0,this.syncControls(),this.notifyCallback(this.onChange,"batch",n,a,r)}}return s}catch(s){throw i&&(this.batchHasChange=!1,this.batchPendingState=void 0,this.batchPendingLabel=void 0),s}finally{this.batchDepth--,i&&(this.batchHasChange=!1,this.batchPendingState=void 0,this.batchPendingLabel=void 0)}}checkpoint(){this.lastPushTime=-1/0}reset(t,e){if(this.isDestroyed||this.isApplying)return;let i=this.stack[this.index]?.state,s=$t(e),n=this.cloneState(t);this.stack=[{state:n,label:s,timestamp:Yt()}],this.index=0,this.lastPushTime=-1/0,this.syncControls(),this.notifyCallback(this.onChange,"reset",n,i,s)}clear(){if(this.isDestroyed||this.isApplying||this.stack.length===0)return;let t=this.stack[this.index];this.stack=[{state:t.state,label:t.label,timestamp:t.timestamp}],this.index=0,this.lastPushTime=-1/0,this.syncControls(),this.notifyCallback(this.onChange,"clear",t.state,t.state,t.label)}canUndo(){return!this.isDestroyed&&this.index>0}canRedo(){return!this.isDestroyed&&this.index<this.stack.length-1}getState(){if(this.batchDepth>0&&this.batchHasChange&&this.batchPendingState!==void 0)return this.cloneState(this.batchPendingState);if(this.stack.length!==0)return this.cloneState(this.stack[this.index].state)}getIndex(){return this.index}getLength(){return this.stack.length}getUndoLabel(){return this.canUndo()?this.stack[this.index].label:void 0}getRedoLabel(){return this.canRedo()?this.stack[this.index+1].label:void 0}getHistory(){return this.stack.map(t=>({state:this.cloneState(t.state),label:t.label,mergeKey:t.mergeKey,timestamp:t.timestamp}))}bindControls(t){if(this.isDestroyed||typeof HTMLElement>"u")return()=>{};let e=t.undo instanceof HTMLElement?t.undo:null,i=t.redo instanceof HTMLElement?t.redo:null,s={useNativeDisabled:!!t.useNativeDisabled,updateAriaKeyShortcuts:t.updateAriaKeyShortcuts!==!1,updateLabelAttribute:t.updateLabelAttribute!==!1},n=new AbortController,r=e?this.captureControlAttrs(e,"data-wulf-undo-label"):null,o=i?this.captureControlAttrs(i,"data-wulf-redo-label"):null,a=(f,m)=>{f.addEventListener("click",g=>{if(!(m==="undo"?this.canUndo():this.canRedo())||this.paused||this.isDestroyed){g.preventDefault(),g.stopImmediatePropagation();return}m==="undo"?this.undo():this.redo()},{capture:!0,signal:n.signal})};e&&a(e,"undo"),i&&a(i,"redo");let l=_e(),c=()=>{e&&this.applyControlState(e,this.canUndo(),s,l?"Meta+Z":"Control+Z","data-wulf-undo-label",this.getUndoLabel()),i&&this.applyControlState(i,this.canRedo(),s,l?"Meta+Shift+Z":"Control+Y Control+Shift+Z","data-wulf-redo-label",this.getRedoLabel())},h=!1,p=()=>{h||(h=!0,n.abort(),e&&r&&this.restoreControlAttrs(e,"data-wulf-undo-label",r),i&&o&&this.restoreControlAttrs(i,"data-wulf-redo-label",o),this.bindings.delete(d))},d={undoEl:e,redoEl:i,options:s,sync:c,unbind:p};return this.bindings.add(d),c(),p}pause(){this.paused=!0}resume(){this.isDestroyed||(this.paused=!1)}isPaused(){return this.paused}audit(){let t=[];this.keyboardOptions?.allowInEditable&&t.push("Option keyboard.allowInEditable: true d\xE9tect\xE9e \u2014 risque de d\xE9tourner Ctrl/Cmd+Z natif dans les zones de saisie (Axiome Primordial).");for(let e of this.bindings)for(let i of[e.undoEl,e.redoEl]){if(!i)continue;!!i.getAttribute("aria-label")?.trim()||this.checkAriaIdReferences(i,"aria-labelledby",t,!0)||!!i.textContent?.trim()||t.push(`Contr\xF4le Undo/Redo li\xE9 (${i.tagName.toLowerCase()}) sans nom accessible (ajoutez du texte visible, aria-label ou aria-labelledby).`);let n=i.getAttribute("tabindex");if(n!==null){let r=Number.parseInt(n,10);Number.isFinite(r)&&r>0&&t.push(`\xC9vitez tabindex="${r}" (> 0) sur un contr\xF4le Undo/Redo.`)}}return t}getAuditPrefix(){return"Wulf.Undo"}getAuditTargetLabel(){return`UndoManager (${this.stack.length} \xE9tat(s))`}destroy(){if(!this.isDestroyed){this.isDestroyed=!0,this.abortController&&(this.abortController.abort(),this.abortController=null);for(let t of Array.from(this.bindings))t.unbind();this.bindings.clear(),this.announceTimerId!==null&&(clearTimeout(this.announceTimerId),this.announceTimerId=null),this.srStatusEl&&(this.srStatusEl.remove(),this.srStatusEl=null),this.stack=[],this.index=-1,this.batchPendingState=void 0}}cloneState(t){if(this.cloneStrategy==="none")return t;if(typeof this.cloneStrategy=="function")return this.cloneStrategy(t);try{return structuredClone(t)}catch(e){throw new TypeError(`[Wulf.Undo] Impossible de cloner l'\xE9tat via structuredClone() (fonction, n\u0153ud DOM ou Proxy non clonable). Utilisez { clone: "none" } ou fournissez une fonction clone personnalis\xE9e.`,{cause:e})}}trimToMaxDepth(){let t=this.maxDepth+1;this.stack.length>t&&this.stack.splice(0,this.stack.length-t)}stepTo(t,e){let i=this.stack[this.index],s=this.stack[t],n=e==="undo"?i?.label:s?.label;this.isApplying=!0;try{this.index=t,this.lastPushTime=-1/0,this.syncControls();let r=this.cloneState(s.state),o=this.cloneState(i.state);if(e==="undo"?this.notifyCallback(this.onUndo,"undo",r,o,n):e==="redo"&&this.notifyCallback(this.onRedo,"redo",r,o,n),this.notifyCallback(this.onChange,e,r,o,n),this.announceEnabled&&(e==="undo"||e==="redo")){let a=this.resolveI18n();this.announce(e==="undo"?a.undone(n):a.redone(n))}return this.cloneState(s.state)}finally{this.isApplying=!1}}notifyCallback(t,e,i,s,n){if(typeof t!="function")return;let r={state:this.cloneState(i),previousState:this.cloneState(s),action:e,label:n,index:this.index,length:this.stack.length,canUndo:this.canUndo(),canRedo:this.canRedo()};try{t(r)}catch(o){let a=o instanceof Error?o:new Error(String(o));if(typeof this.onError=="function")try{this.onError(a,e)}catch(l){console.error("[Wulf.Undo] Erreur dans onError :",l)}else console.error(`[Wulf.Undo] Erreur dans callback (${e}) :`,a)}}bindKeyboard(){if(!this.keyboardOptions||typeof window>"u")return;let t=this.keyboardOptions.target??window;!t||typeof t.addEventListener!="function"||(this.abortController=new AbortController,t.addEventListener("keydown",e=>this.handleKeyDown(e),{capture:!1,signal:this.abortController.signal}))}handleKeyDown(t){if(this.isDestroyed||this.paused||!this.keyboardOptions||t.defaultPrevented||N(t))return;let e=typeof t.composedPath=="function"?t.composedPath():[],i=e.length>0?e:t.target?[t.target]:[],s=!1,n=!1;for(let h of i)!n&&Ui(h)&&(n=!0),!s&&Bi(h)&&(s=!0);if(n||s&&!this.keyboardOptions.allowInEditable)return;let r=(t.key||"").toLowerCase();if(r!=="z"&&r!=="y")return;let o=_e(),a=o?t.metaKey&&!t.ctrlKey:t.ctrlKey&&!t.metaKey,l=a&&!t.altKey&&!t.shiftKey&&r==="z",c=a&&!t.altKey&&t.shiftKey&&r==="z"||!o&&t.ctrlKey&&!t.metaKey&&!t.altKey&&!t.shiftKey&&r==="y";l&&this.canUndo()?(this.keyboardOptions.preventDefault!==!1&&t.preventDefault(),this.undo()):c&&this.canRedo()&&(this.keyboardOptions.preventDefault!==!1&&t.preventDefault(),this.redo())}captureControlAttrs(t,e){return{hadDisabled:t.hasAttribute("disabled"),prevDisabled:t.disabled??!1,hadAriaDisabled:t.hasAttribute("aria-disabled"),prevAriaDisabled:t.getAttribute("aria-disabled"),hadAriaKeyShortcuts:t.hasAttribute("aria-keyshortcuts"),prevAriaKeyShortcuts:t.getAttribute("aria-keyshortcuts"),hadLabelAttr:t.hasAttribute(e),prevLabelAttr:t.getAttribute(e)}}restoreControlAttrs(t,e,i){"disabled"in t&&(i.hadDisabled?t.disabled=i.prevDisabled:t.removeAttribute("disabled")),i.hadAriaDisabled&&i.prevAriaDisabled!==null?t.setAttribute("aria-disabled",i.prevAriaDisabled):t.removeAttribute("aria-disabled"),i.hadAriaKeyShortcuts&&i.prevAriaKeyShortcuts!==null?t.setAttribute("aria-keyshortcuts",i.prevAriaKeyShortcuts):t.removeAttribute("aria-keyshortcuts"),i.hadLabelAttr&&i.prevLabelAttr!==null?t.setAttribute(e,i.prevLabelAttr):t.removeAttribute(e)}applyControlState(t,e,i,s,n,r){i.useNativeDisabled&&"disabled"in t?(t.disabled=!e,t.removeAttribute("aria-disabled")):t.setAttribute("aria-disabled",e?"false":"true"),i.updateAriaKeyShortcuts&&t.setAttribute("aria-keyshortcuts",s),i.updateLabelAttribute&&(r?t.setAttribute(n,r):t.removeAttribute(n))}syncControls(){for(let t of this.bindings)t.sync()}resolveI18n(){if(this.langOverride){let t=ct.getLocale();ct.setLocale(this.langOverride);let e=ct.getAll(this.i18nOverrides);return ct.setLocale(t),e}return ct.getAll(this.i18nOverrides)}mountStatusRegion(){if(typeof document>"u"||this.srStatusEl)return;let t=document.createElement("div");t.setAttribute("role","status"),t.setAttribute("aria-live","polite"),t.setAttribute("aria-atomic","true"),t.setAttribute("data-wulf-undo-status","true"),t.style.position="absolute",t.style.width="1px",t.style.height="1px",t.style.overflow="hidden",t.style.clipPath="inset(50%)",t.style.whiteSpace="nowrap",t.style.pointerEvents="none";let e=null;this.announceRoot&&(typeof ShadowRoot<"u"&&this.announceRoot instanceof ShadowRoot?e=this.announceRoot:typeof HTMLElement<"u"&&this.announceRoot instanceof HTMLElement?e=this.announceRoot:typeof Document<"u"&&this.announceRoot instanceof Document&&(e=this.announceRoot.body||this.announceRoot.documentElement)),e||(e=document.body||document.documentElement),e&&(e.appendChild(t),this.srStatusEl=t)}announce(t){if(this.isDestroyed||typeof document>"u")return;let e=O(t,400).trim();if(!e)return;let i=document;if(typeof i.ariaNotify=="function")try{i.ariaNotify(e,{priority:"normal"});return}catch{}this.srStatusEl||this.mountStatusRegion(),this.srStatusEl&&(this.announceTimerId!==null&&(clearTimeout(this.announceTimerId),this.announceTimerId=null),this.srStatusEl.textContent="",this.announceTimerId=setTimeout(()=>{this.announceTimerId=null,!this.isDestroyed&&this.srStatusEl&&(this.srStatusEl.textContent=e)},40))}};return ii(Vi);})();
8
+ if (typeof window !== "undefined") { var __w = window.Wulf; if (!__w || typeof __w !== "object" || (typeof Node !== "undefined" && __w instanceof Node) || (typeof HTMLCollection !== "undefined" && __w instanceof HTMLCollection)) { __w = {}; window.Wulf = __w; } var __set = function(obj, key, val) { try { Object.defineProperty(obj, key, { value: val, writable: true, configurable: true, enumerable: true }); } catch (_) { try { obj[key] = val; } catch (__) {} } }; if (typeof __WulfIIFE !== "undefined" && __WulfIIFE) { var __e = __WulfIIFE; var __skip = ["__proto__","constructor","prototype","Mask","Scroll","Masonry","Toast","FocusTrap","Shortcut","Anchor","Sortable","Autosize","Undo"]; for (var k in __e) { if (Object.hasOwn(__e, k) && __skip.indexOf(k) === -1 && __w[k] === undefined) { __set(__w, k, __e[k]); } } if (__e.Mask && __e.Mask.Mask) __set(__w, "Mask", __e.Mask.Mask); if (__e.Scroll && __e.Scroll.Scroll) __set(__w, "Scroll", __e.Scroll.Scroll); if (__e.WulfMasonry) __set(__w, "Masonry", Object.assign(__e.WulfMasonry, { Masonry: __e.WulfMasonry, LayoutEngine: __e.LayoutEngine, i18n: __e.Masonry && __e.Masonry.masonryI18n })); if (__e.WulfToast) __set(__w, "Toast", Object.assign(__e.WulfToast, { Toast: __e.WulfToast, ToastInstance: __e.ToastInstance, ToastManager: __e.ToastManager, i18n: __e.Toast && __e.Toast.toastI18n })); if (__e.WulfFocusTrap) __set(__w, "FocusTrap", Object.assign(__e.WulfFocusTrap, { FocusTrap: __e.WulfFocusTrap, default: __e.WulfFocusTrap })); if (__e.ShortcutManager) __set(__w, "Shortcut", Object.assign(__e.ShortcutManager, { ShortcutManager: __e.ShortcutManager, ShortcutFormatter: __e.ShortcutFormatter, default: __e.ShortcutManager })); if (__e.WulfAnchor) __set(__w, "Anchor", Object.assign(__e.WulfAnchor, { Anchor: __e.WulfAnchor, default: __e.WulfAnchor })); if (__e.WulfSortable) __set(__w, "Sortable", Object.assign(__e.WulfSortable, { Sortable: __e.WulfSortable, i18n: __e.Sortable && __e.Sortable.sortableI18n, default: __e.WulfSortable })); if (__e.WulfAutosize) __set(__w, "Autosize", Object.assign(__e.WulfAutosize, { Autosize: __e.WulfAutosize, default: __e.WulfAutosize })); if (__e.WulfUndo) __set(__w, "Undo", Object.assign(__e.WulfUndo, { Undo: __e.WulfUndo, UndoManager: __e.WulfUndo, i18n: __e.Undo && __e.Undo.undoI18n, default: __e.WulfUndo })); }}
6
9
  //# sourceMappingURL=index.global.min.js.map