wulf.js 1.9.1 → 1.9.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +154 -21
- package/changelog.md +21 -0
- package/dist/focus-trap.global.js +1 -1
- package/dist/focus-trap.global.min.js +1 -1
- package/dist/index.esm.js +589 -0
- package/dist/index.esm.js.map +4 -4
- package/dist/index.global.js +590 -1
- package/dist/index.global.js.map +4 -4
- package/dist/index.global.min.js +3 -3
- package/dist/index.global.min.js.map +4 -4
- package/dist/mask.global.js +1 -1
- package/dist/mask.global.min.js +1 -1
- package/dist/masonry.global.js +1 -1
- package/dist/masonry.global.min.js +1 -1
- package/dist/scroll.global.js +1 -1
- package/dist/scroll.global.min.js +1 -1
- package/dist/shortcut.esm.js +584 -0
- package/dist/shortcut.esm.js.map +7 -0
- package/dist/shortcut.global.js +610 -0
- package/dist/shortcut.global.js.map +7 -0
- package/dist/shortcut.global.min.js +3 -0
- package/dist/shortcut.global.min.js.map +7 -0
- package/dist/toast.global.js +1 -1
- package/dist/toast.global.min.js +1 -1
- package/dist/types/index.d.ts +2 -0
- package/dist/types/shortcut/ShortcutFormatter.d.ts +31 -0
- package/dist/types/shortcut/ShortcutManager.d.ts +91 -0
- package/dist/types/shortcut/index.d.ts +4 -0
- package/dist/types/shortcut/types.d.ts +101 -0
- package/package.json +17 -10
- package/dist/focus-trap.cjs.js +0 -430
- package/dist/focus-trap.cjs.js.map +0 -7
- package/dist/index.cjs.js +0 -5365
- package/dist/index.cjs.js.map +0 -7
- package/dist/mask.cjs.js +0 -3086
- package/dist/mask.cjs.js.map +0 -7
- package/dist/masonry.cjs.js +0 -858
- package/dist/masonry.cjs.js.map +0 -7
- package/dist/scroll.cjs.js +0 -823
- package/dist/scroll.cjs.js.map +0 -7
- package/dist/toast.cjs.js +0 -715
- package/dist/toast.cjs.js.map +0 -7
package/dist/mask.global.js
CHANGED
|
@@ -3085,5 +3085,5 @@ var Wulf = (() => {
|
|
|
3085
3085
|
var index_default = InputMask;
|
|
3086
3086
|
return __toCommonJS(index_exports);
|
|
3087
3087
|
})();
|
|
3088
|
-
if (typeof window !== "undefined") { window.Wulf = window.Wulf || {}; if (typeof Wulf !== "undefined" && Wulf) { var targets = ["Mask", "Scroll", "Masonry", "Toast"]; for (var i = 0; i < targets.length; i++) { var t = targets[i]; if (Wulf[t] && window.Wulf[t] !== Wulf[t]) { try { Object.defineProperty(window.Wulf, t, { value: Wulf[t], writable: true, configurable: true, enumerable: true }); } catch (_) { try { window.Wulf[t] = Wulf[t]; } catch (__) {} } } } for (var k in Wulf) { if (window.Wulf[k] === undefined) { try { Object.defineProperty(window.Wulf, k, { value: Wulf[k], writable: true, configurable: true, enumerable: true }); } catch (_) { try { window.Wulf[k] = Wulf[k]; } catch (__) {} } } } } }
|
|
3088
|
+
if (typeof window !== "undefined") { window.Wulf = window.Wulf || {}; if (typeof Wulf !== "undefined" && Wulf) { var targets = ["Mask", "Scroll", "Masonry", "Toast", "FocusTrap", "Shortcut"]; for (var i = 0; i < targets.length; i++) { var t = targets[i]; if (Wulf[t] && window.Wulf[t] !== Wulf[t]) { try { Object.defineProperty(window.Wulf, t, { value: Wulf[t], writable: true, configurable: true, enumerable: true }); } catch (_) { try { window.Wulf[t] = Wulf[t]; } catch (__) {} } } } for (var k in Wulf) { if (window.Wulf[k] === undefined) { try { Object.defineProperty(window.Wulf, k, { value: Wulf[k], writable: true, configurable: true, enumerable: true }); } catch (_) { try { window.Wulf[k] = Wulf[k]; } catch (__) {} } } } } }
|
|
3089
3089
|
//# sourceMappingURL=mask.global.js.map
|
package/dist/mask.global.min.js
CHANGED
|
@@ -2,5 +2,5 @@
|
|
|
2
2
|
`+t.map(e=>` - ${e}`).join(`
|
|
3
3
|
`)+`
|
|
4
4
|
(${this.getAuditDisableHint()})`),t}checkAriaIdReferences(i,t,e){let n=i.getAttribute(t)?.trim();if(!n)return!1;let o=i.ownerDocument||document,s=n.split(/\s+/).filter(Boolean),r=s.length>0&&s.every(a=>!!o.getElementById(a));return r||e.push(`Attribut ${t}="${n}" invalide : l'\xE9l\xE9ment cible est introuvable dans le DOM.`),r}};function T(b,i,t){return i&&typeof i=="object"&&"tagName"in i&&i.tagName==="INPUT"?{wrapper:b||null,input:i,options:t||{}}:{wrapper:null,input:b,options:i&&typeof i=="object"&&!("tagName"in i)?i:{}}}var A=class extends B{constructor(t,e,n){super();this.ghost=null;this.isWrapperCreated=!1;this.isDestroyed=!1;this.isFocused=!1;this.isDispatchingNativeInput=!1;this.lastTrackedValue="";this.nativeValueDescriptor=null;this.onCutHandler=()=>{};this.mutationObserver=null;this.focusSelectTimerId=null;this.onBaseCopy=t=>{if(!this.options.copyRaw||this.options.disabled||this.input.type==="password")return;let e=this.input.selectionStart??0,n=this.input.selectionEnd??e,o="";e!==n?o=this.extractRawSnippet(this.input.value.slice(e,n)):o=this.getRawValue(),o&&t.clipboardData&&(t.preventDefault(),t.clipboardData.setData("text/plain",o))};this.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&&document.activeElement===this.input&&this.input.select()},0))};this.onBaseBlur=()=>{this.isFocused=!1};this.onScroll=()=>{this.ghost&&(this.ghost.scrollLeft=this.input.scrollLeft)};let{wrapper:o,input:s,options:r}=T(t,e,n);if(!s||typeof s!="object"||s.nodeType!==1||s.tagName!=="INPUT")throw new Error(`[${new.target.name||"InputMask"}] input (HTMLInputElement) est requis.`);this.input=s;let a=this.input.getAttribute("data-mask-create-wrapper")==="true",u=!!(r.createWrapper??a),d=o;if(!d&&u){let w=document.createElement("span");w.className="wulf-mask-wrapper",w.style.display="inline-grid",w.style.gridTemplateColumns="1fr",w.style.gridTemplateRows="1fr",w.style.verticalAlign="middle",w.style.boxSizing="border-box",w.style.position="relative",this.input.parentNode&&this.input.parentNode.insertBefore(w,this.input),w.appendChild(this.input),this.input.style.gridArea="1 / 1 / 2 / 2",this.input.style.boxSizing="border-box",d=w,this.isWrapperCreated=!0}if(!d)throw new Error(`[${new.target.name||"InputMask"}] wrapper (HTMLElement) et input (HTMLInputElement) sont requis, ou activez l'option createWrapper: true.`);this.wrapper=d,this.normalizeInputType();let m=this.getAttr("data-mask-focus-only")==="true",l=this.hasAttr("data-disabled"),p=this.getAttr("data-mask-select-on-focus")==="true",h=this.getAttr("data-mask-copy-raw")==="true",c=this.getAttr("data-mask-align")||this.getAttr("data-align"),g=this.getAttr("data-mask-audit"),{disabled:f,align:v,...y}=r,E=f!==void 0?f:!!l,k=r.audit??(g!==null?g!=="false":!0),M=this.input.type==="password";this.options={...y,createWrapper:u,showMaskOnFocus:r.showMaskOnFocus??m??!1,selectAllOnFocus:r.selectAllOnFocus??p??!1,copyRaw:M?!1:r.copyRaw??h??!1,disabled:E,align:v??(c||void 0),emitNativeInput:r.emitNativeInput??!0,audit:k},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(){this.input.addEventListener("copy",this.onBaseCopy),this.input.addEventListener("focus",this.onBaseFocus),this.input.addEventListener("blur",this.onBaseBlur)}extractRawSnippet(t){return t}initMutationObserver(){if(typeof MutationObserver>"u")return;this.mutationObserver=new MutationObserver(e=>{for(let n of e)n.type==="attributes"&&n.attributeName&&this.handleAttributeMutation(n.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-pad-decimals","data-mask-auto-lowercase","data-mask-cycle-suggestions","data-mask-default-tld","data-mask-tlds","data-disabled","data-mask-align","data-align","placeholder"]};this.mutationObserver.observe(this.wrapper,t),this.input!==this.wrapper&&this.mutationObserver.observe(this.input,t)}setAlign(t){let e=t||void 0,n=this.wrapper.getAttribute("data-align");this.options.align===e&&n===(t||null)||(this.options.align=e,this.wrapper.classList.remove("align-left","align-right","align-center"),t?(this.wrapper.classList.add(`align-${t}`),this.wrapper.getAttribute("data-align")!==t&&this.wrapper.setAttribute("data-align",t)):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.getAttr("data-mask-copy-raw")==="true";else if(t==="data-mask-align"||t==="data-align"){let e=this.getAttr("data-mask-align")||this.getAttr("data-align");e!==(this.options.align??null)&&this.setAlign(e)}}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(),this.ghost=document.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"),this.syncGhostStyles()}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.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";t.textAlign==="right"||t.textAlign==="end"||e&&t.textAlign!=="left"&&t.textAlign!=="center"?this.ghost.style.justifyContent="flex-end":t.textAlign==="center"?this.ghost.style.justifyContent="center":this.ghost.style.justifyContent="flex-start"}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.input._valueTracker;t&&typeof t.setValue=="function"&&t.setValue(this.lastTrackedValue),this.lastTrackedValue=this.input.value,this.input.dispatchEvent(new Event("input",{bubbles:!0,cancelable:!1}))}finally{this.isDispatchingNativeInput=!1}}}hookValueProperty(){try{let t=HTMLInputElement.prototype,e=Object.getOwnPropertyDescriptor(t,"value");if(!e||!e.set||!e.get)return;this.nativeValueDescriptor=e;let n=this;Object.defineProperty(this.input,"value",{get(){return e.get.call(this)},set(o){let s=String(o??"");e.set.call(this,s),!n.isDestroyed&&n.onNativeValueSet(s)},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}audit(){let t=[],e=this.input.ownerDocument||document,n=this.input.getAttribute("aria-label")?.trim(),o=this.checkAriaIdReferences(this.input,"aria-labelledby",t),s=!!this.input.closest("label"),r=!!(this.input.labels&&this.input.labels.length>0),a=!1;this.input.id&&typeof CSS<"u"&&typeof CSS.escape=="function"?a=!!e.querySelector(`label[for="${CSS.escape(this.input.id)}"]`):this.input.id&&(a=!!e.querySelector(`label[for="${this.input.id}"]`)),!n&&!o&&!s&&!r&&!a&&t.push(`\xC9tiquetage accessible manquant : associez un <label for="id"> (ou d\xE9finissez aria-label / aria-labelledby) sur l'input (WCAG 4.1.2).`),this.checkAriaIdReferences(this.input,"aria-describedby",t);let u=this.getSpecificAuditWarnings();return t.push(...u),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[]}destroy(){this.isDestroyed||(this.isDestroyed=!0,this.focusSelectTimerId!==null&&(clearTimeout(this.focusSelectTimerId),this.focusSelectTimerId=null),this.mutationObserver&&(this.mutationObserver.disconnect(),this.mutationObserver=null),this.input.removeEventListener("copy",this.onBaseCopy),this.input.removeEventListener("focus",this.onBaseFocus),this.input.removeEventListener("blur",this.onBaseBlur),this.unhookValueProperty(),this.ghost&&(this.ghost.remove(),this.ghost=null),this.isWrapperCreated&&this.wrapper?(this.input.style.gridArea="",this.input.style.boxSizing="",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.wrapper.classList.remove("is-complete","is-focused","mask-focus-only","has-selection","has-ghost")))}};var j={9:{pattern:/[0-9]/},a:{pattern:/[a-zA-Z]/},A:{pattern:/[a-zA-Z]/,transform:b=>b.toUpperCase()},"*":{pattern:/[a-zA-Z0-9]/},"#":{pattern:/[a-zA-Z0-9]/,transform:b=>b.toUpperCase()}},x=class b{constructor(i,t={}){this.patterns=[];this.subEngines=[];this.activeEngine=null;this.slots=[];this.fullMaskTemplate="";this.prefixSlotsCount=0;this.prefixString="";this.strict=!0;this.autoLowercase=!1;let e=t||{};this.placeholderChar=e.placeholderChar||"_",this.tokens={...j,...e.tokens||{}},this.strict=e.strict!==!1,this.autoLowercase=e.autoLowercase??!1,this.pattern="",this.compile(i)}static format(i,t,e={}){return!t||Array.isArray(t)&&t.length===0?i??"":new b(t,e||{}).format(i??"")}compile(i){if(i!==void 0&&(Array.isArray(i)?(this.patterns=[...i],this.pattern=this.patterns[0]||""):(this.patterns=[],this.pattern=i)),this.patterns.length>0)return this.subEngines=this.patterns.map(n=>new b(n,{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 t="",e=!0;for(let n=0;n<this.pattern.length;n++){let o=this.pattern[n],s=!1;o==="\\"&&n+1<this.pattern.length&&(s=!0,n++,o=this.pattern[n]);let r=s?void 0:this.tokens[o];r?(e=!1,this.slots.push({char:o,isStatic:!1,isPrefix:!1,token:r,placeholder:this.placeholderChar}),t+=this.placeholderChar):(this.slots.push({char:o,isStatic:!0,isPrefix:e,placeholder:o}),t+=o)}this.fullMaskTemplate=t,this.prefixSlotsCount=0,this.prefixString="";for(let n of this.slots)if(n.isPrefix)this.prefixSlotsCount++,this.prefixString+=n.char;else break;return this.slots}selectEngine(i){if(this.subEngines.length<=1)return this;let t=String(i??""),e=this.subEngines.filter(a=>{let u=a.getPrefix();return u.length>0&&t.toLowerCase().startsWith(u.trim().toLowerCase())}),n=e.length>0?e:this.subEngines,o=[...n].sort((a,u)=>u.getEditableCount()-a.getEditableCount())[0],r=(o?o.extractRaw(t):t).length;for(let a of n)if(a.getEditableCount()>=r)return this.activeEngine=a,a;return this.activeEngine=n[n.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}getEditableCount(){return this.subEngines.length>0?Math.max(...this.subEngines.map(i=>i.getEditableCount())):this.activeEngine?this.activeEngine.getEditableCount():this.slots.filter(i=>!i.isStatic).length}isNumericOnly(){if(this.subEngines.length>0)return this.subEngines.every(e=>e.isNumericOnly());let t=(this.activeEngine?this.activeEngine.slots:this.slots).filter(e=>!e.isStatic);return t.length===0?!1:t.every(e=>e.char==="9"||e.token&&e.token.pattern.test("0")&&!e.token.pattern.test("a")&&!e.token.pattern.test("Z"))}setStrict(i){this.strict=i}isStrict(){return this.strict}extractRaw(i){if(this.subEngines.length>0){let s=this.selectEngine(i);if(s!==this)return s.extractRaw(i)}let t=String(i??"");if(!t)return"";let e="",n=0,o=0;if(this.prefixSlotsCount>0){for(;n<t.length&&(t[n]===" "||t[n]===" ");)n++;let s=0;for(;n<t.length&&s<this.prefixSlotsCount;){let r=this.slots[s].char,a=t[n];if(a.toUpperCase()===r.toUpperCase())n++,s++;else if(r===" "&&a!==" ")s++;else break}o=this.prefixSlotsCount}for(;n<t.length&&o<this.slots.length;){let s=this.slots[o],r=t[n];if(s.isStatic)r.toUpperCase()===s.char.toUpperCase()&&n++,o++;else if(s.token&&s.token.pattern.test(r)){let a=s.token.transform?s.token.transform(r):r;this.autoLowercase&&!s.token.transform&&(a=a.toLowerCase()),e+=a,n++,o++}else this.strict?n++:(e+=this.autoLowercase?r.toLowerCase():r,n++,o++)}if(!this.strict&&n<t.length){let s=t.slice(n);e+=this.autoLowercase?s.toLowerCase():s}return e}format(i){if(this.subEngines.length>0){let s=this.selectEngine(i);if(s!==this)return s.format(i)}let t=String(i??"");if(!this.slots.length)return t;let e=this.extractRaw(t);if(e.length===0)return this.prefixString;let n="",o=0;for(let s=0;s<this.slots.length;s++){let r=this.slots[s];if(r.isStatic){let a=o<e.length,u=o===0&&!!r.isPrefix,d=o>0&&o===e.length;if(a||u||d)n+=r.char;else break}else if(o<e.length){let a=e[o],u=r.token?.transform?r.token.transform(a):a;this.autoLowercase&&!r.token?.transform&&(u=u.toLowerCase()),n+=u,o++}else break}if(!this.strict&&o<e.length){let s=e.substring(o);n+=this.autoLowercase?s.toLowerCase():s}return n}getRemainingMask(i){return this.activeEngine&&this.activeEngine!==this?this.activeEngine.getRemainingMask(i):this.fullMaskTemplate?i.length>=this.fullMaskTemplate.length?i:i+this.fullMaskTemplate.substring(i.length):""}mapCursorPosition(i,t,e){if(this.activeEngine&&this.activeEngine!==this)return this.activeEngine.mapCursorPosition(i,t,e);let n=this.prefixSlotsCount,o=String(i??""),s=String(e??"");if(t<=0||!s)return n;let a=this.extractRaw(o.slice(0,t)).length;if(a===0)return Math.max(n,Math.min(this.getNextEditablePosition(0),s.length));let u=0,d=s.length;for(let m=0;m<s.length&&m<this.slots.length;m++)if(!this.slots[m].isStatic&&(u++,u===a)){d=m+1;break}for(;d<s.length&&this.slots[d]&&this.slots[d].isStatic;)d++;return Math.max(n,Math.min(d,s.length))}isSeparatorAt(i){return this.activeEngine&&this.activeEngine!==this?this.activeEngine.isSeparatorAt(i):i>=0&&i<this.slots.length?this.slots[i].isStatic:!1}getNextEditablePosition(i){if(this.activeEngine&&this.activeEngine!==this)return this.activeEngine.getNextEditablePosition(i);let t=Math.max(0,i);for(let e=t;e<this.slots.length;e++)if(!this.slots[e].isStatic)return e;return this.slots.length}getSlotAt(i){return this.activeEngine&&this.activeEngine!==this?this.activeEngine.getSlotAt(i):this.slots[i]}getSlots(){return this.activeEngine&&this.activeEngine!==this?this.activeEngine.getSlots():this.slots}};var C=class{constructor(i=50){this.stack=[];this.index=-1;this.maxDepth=i}push(i,t){let e=this.getCurrent();if(e&&e.raw===i){e.cursor=t;return}this.stack=this.stack.slice(0,this.index+1),this.stack.push({raw:i,cursor:t}),this.stack.length>this.maxDepth&&this.stack.shift(),this.index=this.stack.length-1}updateCurrentCursor(i){let t=this.getCurrent();t&&(t.cursor=i)}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 L=class{constructor(i){this.delegate=i}handleKeyDown(i){let t=this.delegate.getInput(),e=this.delegate.getEngine(),n=this.delegate.getHistory(),o=e.getPrefixLength(),s=t.selectionStart??0,r=t.selectionEnd??s;if((i.ctrlKey||i.metaKey)&&(i.key==="z"||i.key==="Z")&&!i.shiftKey){i.preventDefault(),this.delegate.undo();return}if((i.ctrlKey||i.metaKey)&&(i.key==="y"||i.key==="Y")||(i.ctrlKey||i.metaKey)&&i.shiftKey&&(i.key==="z"||i.key==="Z")){i.preventDefault(),this.delegate.redo();return}n.updateCurrentCursor(s);let a=i.key.length===1&&!i.ctrlKey&&!i.metaKey&&!i.altKey,u=r>s;if(a&&!u){let l=e.getSlots(),p=s<l.length&&l[s].isStatic&&l[s].char===i.key,h=s>0&&s-1<l.length&&l[s-1].isStatic&&l[s-1].char===i.key;if(p||h){i.preventDefault();let g=p?s:s-1,f=e.getNextEditablePosition(g+1);this.delegate.applyMask(t.value,f,!0);return}let c=-1;for(let g=s;g<l.length;g++)if(l[g].isStatic){l[g].char===i.key&&(c=g);break}if(c!==-1){i.preventDefault();let g=c-1;for(;g>=o&&!l[g].isStatic;)g--;g++;let f=c-g,v=t.value.slice(g,s);if(l.slice(g,c).every(k=>!k.token||k.token.pattern.test("0"))&&f>v.length&&v.length>0){let k=f-v.length,M="0".repeat(k)+v,w=t.value.slice(c),N=t.value.slice(0,g)+M+w,S=e.getNextEditablePosition(c+1);this.delegate.applyMask(N,S,!0);return}let E=e.getNextEditablePosition(c+1);this.delegate.applyMask(t.value,E,!0);return}}if(a&&e.isStrict()){let l=e.getEditableCount();if(l>0){let p=e.extractRaw(t.value),h=l-p.length;if(r>s){let c=e.extractRaw(t.value.slice(s,r));h=l-(p.length-c.length)}if(h<=0){i.preventDefault();return}}}if(r>s){if(i.key==="Backspace"||i.key==="Delete"){i.preventDefault();let l=t.value,p=l.slice(0,s)+l.slice(r);this.delegate.applyMask(p,Math.max(o,s));return}return}if(i.key==="ArrowLeft"&&!i.shiftKey&&s<=o){i.preventDefault(),t.setSelectionRange(o,o);return}if(i.key==="Home"&&!i.shiftKey){i.preventDefault(),t.setSelectionRange(o,o);return}if(i.key==="Backspace"&&s<=o){i.preventDefault(),t.setSelectionRange(o,o);return}if(i.key==="Delete"&&s<o){i.preventDefault(),t.setSelectionRange(o,o);return}if(i.key==="Backspace"&&(i.ctrlKey||i.altKey||i.metaKey)){if(i.preventDefault(),s<=o){t.setSelectionRange(o,o);return}let l=s-1;for(;l>=o&&e.isSeparatorAt(l);)l--;for(;l>=o&&!e.isSeparatorAt(l);)l--;let p=Math.max(o,l+1),h=t.value,c=h.slice(0,p)+h.slice(s);this.delegate.applyMask(c,p);return}if(i.key==="Delete"&&(i.ctrlKey||i.altKey||i.metaKey)){i.preventDefault();let l=t.value;if(s>=l.length)return;let p=s;for(;p<l.length&&e.isSeparatorAt(p);)p++;for(;p<l.length&&!e.isSeparatorAt(p);)p++;for(;p<l.length&&e.isSeparatorAt(p);)p++;let h=p,c=l.slice(0,s)+l.slice(h);this.delegate.applyMask(c,s);return}if(i.key==="Backspace"&&s>o){if(e.isSeparatorAt(s-1)){i.preventDefault();let l=s-1;for(;l>o&&e.isSeparatorAt(l-1);)l--;if(l>o){let p=t.value,h=p.slice(0,l-1)+p.slice(s);this.delegate.applyMask(h,l-1)}else this.delegate.applyMask("",o)}return}if(i.key==="Delete"&&s<t.value.length){if(e.isSeparatorAt(s)){i.preventDefault();let l=s;for(;l<t.value.length&&e.isSeparatorAt(l);)l++;if(l<t.value.length){let p=t.value,h=p.slice(0,l)+p.slice(l+1);this.delegate.applyMask(h,s)}}return}}handleKeyUp(i){let t=this.delegate.getInput(),e=this.delegate.getHistory();(i.key==="ArrowLeft"||i.key==="ArrowRight"||i.key==="Home")&&!i.shiftKey&&this.delegate.enforceMinCursor(),e.updateCurrentCursor(t.selectionStart??0)}};var R=class extends A{constructor(t,e,n){let o=T(t,e,n),s=o.wrapper,r=o.input,a=o.options,u=s?.getAttribute("data-mask")||r?.getAttribute("data-mask"),d=a.mask||u||"";typeof d=="string"&&d.includes("|")&&(d=d.split("|").map(k=>k.trim()));let m=a.placeholderChar||s?.getAttribute("data-mask-placeholder")||r?.getAttribute("data-mask-placeholder")||"_",l=s?.hasAttribute("data-disabled")||r?.hasAttribute("data-disabled"),p=s?.getAttribute("data-mask-strict")||r?.getAttribute("data-mask-strict"),h=s?.getAttribute("data-mask-auto-lowercase")==="true"||r?.getAttribute("data-mask-auto-lowercase")==="true",c=s?.getAttribute("data-mask-infer-inputmode")??r?.getAttribute("data-mask-infer-inputmode"),g=a.inferInputMode??(c!==null?c!=="false":!0),{disabled:f,...v}=a,y=f!==void 0?f:l?!0:!d||Array.isArray(d)&&d.length===0,E={...v,mask:d,placeholderChar:m,strict:a.strict??(p!==null?p!=="false":!0),autoLowercase:a.autoLowercase??h??!1,disabled:y,resetHistoryOnMaskChange:a.resetHistoryOnMaskChange??!1,inferInputMode:g,onInput:a.onInput||a.oninput,onChange:a.onChange||a.onchange,onComplete:a.onComplete||a.oncomplete};super(s,r,E);this.isComposing=!1;this.isUndoingRedoing=!1;this.isMouseDown=!1;this.isApplyingMask=!1;this.lastValue="";this.lastInternalRemainingMask="";this.isNotifying=!1;this.hasPendingNotification=!1;this.onChangeNativeHandler=()=>{};this.wasInputModeInferred=!1;this.cutTimerId=null;this.pasteTimerId=null;this.resetTimerId=null;this.history=new C,this.engine=new x(this.options.mask||"",{placeholderChar:this.options.placeholderChar,tokens:this.options.tokens,strict:this.options.strict,autoLowercase:this.options.autoLowercase}),this.syncInferredInputMode(),this.keyboard=new L({getInput:()=>this.input,getEngine:()=>this.engine,getHistory:()=>this.history,applyMask:(k,M,w)=>this.applyMask(k,M,w),undo:()=>this.undo(),redo:()=>this.redo(),enforceMinCursor:()=>this.enforceMinCursor()}),this.bindEvents(),this.lastValue=this.input.value,this.syncInitialValue(),this.runAuditWarning(this.options.audit)}getSpecificAuditWarnings(){let t=[],e=!!this.input.getAttribute("aria-describedby")?.trim(),n=!!this.input.getAttribute("placeholder")?.trim(),o=!!this.input.getAttribute("aria-placeholder")?.trim();return!e&&!n&&!o&&!this.options.disabled&&t.push("Indication du format attendu manquante : d\xE9finissez aria-describedby, placeholder ou aria-placeholder pour informer les technologies d'assistance (WCAG 3.3.2)."),t}extractRawSnippet(t){return this.engine.extractRaw(t)}static format(t,e,n={}){return x.format(t,e,n)}onNativeValueSet(t){this.options.disabled?this.checkValueChange():this.applyMask(t,t.length)}onDisabledChange(t){t?(this.wrapper.removeAttribute("data-mask"),this.wrapper.classList.remove("is-complete","has-selection"),this.ghost&&(this.ghost.textContent=""),this.checkValueChange()):this.applyMask(this.input.value,this.input.selectionStart??this.input.value.length)}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 t=this.input.selectionStart??this.input.value.length;this.applyMask(this.input.value,t)}},0)},this.onChangeNativeHandler=()=>{this.isDestroyed||this.checkValueChange()},this.input.addEventListener("beforeinput",this.onBeforeInput),this.input.addEventListener("input",this.handleInput),this.input.addEventListener("keydown",this.onKeyDown),this.input.addEventListener("paste",this.onPaste),this.input.addEventListener("focus",this.onFocus),this.input.addEventListener("blur",this.onBlur),this.input.addEventListener("click",this.onClick),this.input.addEventListener("keyup",this.onKeyUp),this.input.addEventListener("select",this.onSelect),this.input.addEventListener("mousedown",this.onMouseDown),window.addEventListener("mouseup",this.onMouseUp),this.input.addEventListener("compositionstart",this.onCompositionStart),this.input.addEventListener("compositionend",this.onCompositionEnd),this.input.addEventListener("scroll",this.onScroll),this.input.addEventListener("cut",this.onCutHandler),this.input.addEventListener("change",this.onChangeNativeHandler),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))}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.input.removeEventListener("beforeinput",this.onBeforeInput),this.input.removeEventListener("input",this.handleInput),this.input.removeEventListener("keydown",this.onKeyDown),this.input.removeEventListener("paste",this.onPaste),this.input.removeEventListener("focus",this.onFocus),this.input.removeEventListener("blur",this.onBlur),this.input.removeEventListener("click",this.onClick),this.input.removeEventListener("keyup",this.onKeyUp),this.input.removeEventListener("select",this.onSelect),this.input.removeEventListener("mousedown",this.onMouseDown),window.removeEventListener("mouseup",this.onMouseUp),this.input.removeEventListener("compositionstart",this.onCompositionStart),this.input.removeEventListener("compositionend",this.onCompositionEnd),this.input.removeEventListener("scroll",this.onScroll),this.input.removeEventListener("cut",this.onCutHandler),this.input.removeEventListener("change",this.onChangeNativeHandler),this.input.form&&this.onFormResetHandler&&this.input.form.removeEventListener("reset",this.onFormResetHandler),this.wasInputModeInferred&&this.input.getAttribute("inputmode")==="numeric"&&this.input.removeAttribute("inputmode"),this.history.clear(),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 n=typeof e=="boolean"?e:e&&typeof e=="object"&&e.strict!==void 0?e.strict:this.options.strict,o=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=n,this.engine.setStrict(n??!0),this.engine.compile(""),o&&this.history.clear(),this.setDisabled(!0),this.syncInferredInputMode();return}this.options.mask=t,this.options.strict=n,this.engine.setStrict(n??!0),this.engine.compile(t),o&&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===this.lastInternalRemainingMask)return;let n=Array.isArray(this.options.mask)?this.options.mask.join("|"):this.options.mask||"";if(e===n)return;if(e){let o=e.includes("|")?e.split("|").map(s=>s.trim()):e;this.setMask(o)}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.compile(this.options.mask||""),this.applyMask(this.input.value,this.input.selectionStart??this.input.value.length)):t==="placeholder"&&this.updateGhost(this.input.value)}setValue(t){let e=t!=null?String(t):"";if(this.options.disabled){this.input.value=e,this.checkValueChange();return}this.applyMask(e,e.length)}getRawValue(){return this.engine.extractRaw(this.input.value)}isComplete(){return this.options.disabled?!0:this.getRawValue().length>=this.engine.getEditableCount()}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,n=t!==e;this.wrapper.classList.toggle("has-selection",n)}onBeforeInput(t){if(!this.options.disabled&&!this.isComposing&&this.engine.isStrict()&&t.inputType!=="insertFromPaste"&&t.inputType&&t.inputType.startsWith("insert")){let e=this.engine.getEditableCount();if(e>0){let n=this.getRawValue(),o=this.input.selectionStart??0,s=this.input.selectionEnd??o,r=Math.max(0,e-n.length);if(s>o){let a=this.engine.extractRaw(this.input.value.slice(o,s));r=Math.max(0,e-(n.length-a.length))}r<=0&&t.preventDefault()}}}handleInput(t){if(this.isDispatchingNativeInput||this.isComposing)return;if(!!(this.options.onInput||this.options.oninput)&&this.input.value!==this.lastValue&&this.checkValueChange(),this.options.disabled){this.checkValueChange();return}let n=this.history.getCurrent(),o=this.engine.getEditableCount();if(o>0&&this.engine.isStrict()&&n&&n.raw.length>=o&&this.engine.extractRaw(this.input.value).length>o){this.applyMask(n.raw,n.cursor);return}let s=this.input.selectionStart??this.input.value.length;this.applyMask(this.input.value,s),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 n=(t.clipboardData?.getData("text")||"").trim();if(!n)return;let o=this.engine.getPrefixLength(),s=this.input.selectionStart??0,r=this.input.selectionEnd??s,a=this.input.value,u=this.engine.getEditableCount(),d=this.getRawValue(),l=this.engine.getPrefix().replace(/[\s.-]+/g,"").toUpperCase(),p=n.replace(/[\s.-]+/g,"").toUpperCase(),h=l.length>0&&p.startsWith(l),c=a.slice(0,Math.max(o,s)).replace(/[\s.-]+/g,"").toUpperCase(),g=c.length>=2&&p.startsWith(c),f=Math.max(o,s),v=Math.max(o,r);(h||g)&&(f=0,v=a.length);let y=Math.max(0,u-d.length);if(f!==v){let M=this.engine.extractRaw(a.slice(f,v));y=Math.max(0,u-(d.length-M.length))}if(this.engine.isStrict()&&y<=0)return;let E,k;f===0&&v===a.length?(E=n,k=n.length):(E=a.slice(0,f)+n+a.slice(v),k=f+n.length),this.applyMask(E,k),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(){this.wrapper.classList.remove("is-focused","has-selection"),this.input.type==="password"&&this.history.clear(),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,n=this.input.selectionEnd??e;e===n&&e<t&&this.input.setSelectionRange(t,t)}updateGhost(t){if(!this.ghost)return;if(this.options.disabled){this.ghost.textContent="";return}let e=!t||t===this.engine.getPrefix();if(this.shouldHideGhostForPlaceholder(e)){this.ghost.textContent="";return}let n=this.engine.getFullMaskTemplate(),o=n.length>t.length?n.substring(t.length):"";this.ghost.textContent="";let s=document.createElement("span");s.className="mask-ghost-typed",s.textContent=t;let r=document.createElement("span");r.className="mask-ghost-remaining",r.textContent=o,this.ghost.appendChild(s),this.ghost.appendChild(r),this.ghost.scrollLeft=this.input.scrollLeft}applyMask(t,e,n=!1){if(this.options.disabled||this.isApplyingMask)return;this.isApplyingMask=!0;let o="",s=!1;try{o=this.engine.format(t);let r=this.engine.getRemainingMask(o);this.input.value=o,this.lastInternalRemainingMask=r,this.wrapper.setAttribute("data-mask",r),this.updateGhost(o);let a=this.engine.getPrefixLength(),u;if(n||this.isUndoingRedoing)u=Math.max(a,Math.min(e,o.length));else{let d=this.engine.mapCursorPosition(t,e,o);u=Math.max(a,d)}this.input.setSelectionRange(u,u),s=this.isComplete(),this.wrapper.classList.toggle("is-complete",s),!this.isUndoingRedoing&&this.input.type!=="password"&&this.history.push(this.getRawValue(),u)}finally{this.isApplyingMask=!1}this.checkValueChange()}syncInitialValue(){if(this.options.disabled){this.wrapper.removeAttribute("data-mask"),this.ghost&&(this.ghost.textContent=""),this.lastValue=this.input.value,this.checkValueChange();return}this.syncGhostStyles();let t=this.input.value||"";if(t)this.applyMask(t,t.length);else{let e=this.engine.getPrefixLength();if(e>0)this.applyMask("",e);else{this.input.type!=="password"&&this.history.push("",0);let n=this.engine.getFullMaskTemplate();this.lastInternalRemainingMask=n,this.wrapper.setAttribute("data-mask",n),this.updateGhost(""),this.checkValueChange()}}}checkValueChange(t=!1){if(!(this.input.value===this.lastValue&&!t&&!this.hasPendingNotification)){if(this.isNotifying){this.hasPendingNotification=!0;return}this.isNotifying=!0;try{for(;this.input.value!==this.lastValue||this.hasPendingNotification||t;){this.hasPendingNotification=!1,t=!1;let n=this.input.value;this.lastValue=n;let o=this.options.disabled?n:this.getRawValue(),s=this.options.disabled?0:this.engine.getEditableCount(),r=this.isComplete(),a={value:n,rawValue:o,isComplete:r,totalSlots:s,filledSlots:this.options.disabled?n.length:o.length},u=this.options.onInput||this.options.oninput;u&&u(n,a),this.input.dispatchEvent(new CustomEvent("mask:input",{bubbles:!0,detail:a})),this.dispatchNativeInput();let d=this.options.onChange||this.options.onchange;d&&d(a),this.input.dispatchEvent(new CustomEvent("mask:change",{bubbles:!0,detail:a}));let m=this.options.onComplete||this.options.oncomplete;r&&(m&&m(a),this.input.dispatchEvent(new CustomEvent("mask:complete",{bubbles:!0,detail:a})))}}finally{this.isNotifying=!1}}}};var I=class b{constructor(i={}){let t=i.currency??"";!t&&i.unit&&(t=i.unit);let e=t==="$"||t==="\xA3"||t==="\xA5"?"prefix":"suffix";this.options={currency:t,unit:i.unit??t,currencyPosition:i.currencyPosition??e,decimals:i.decimals!==void 0?Math.max(0,i.decimals):2,decimalSeparator:i.decimalSeparator??",",thousandSeparator:i.thousandSeparator??"\xA0",allowNegative:i.allowNegative??!1,min:i.min??-1/0,max:i.max??1/0}}parse(i){let t=i.trim(),e=!1;this.options.allowNegative&&t.includes("-")&&(e=!0),this.options.currency&&(t=t.replace(new RegExp(this.escapeRegExp(this.options.currency),"g"),"")),this.options.thousandSeparator&&(t=t.replace(new RegExp(this.escapeRegExp(this.options.thousandSeparator),"g"),"")),t=t.replace(/[\s\u00A0]/g,"");let n=this.options.decimalSeparator,o=t.indexOf(n);o===-1&&(o=t.search(/[,.]/));let s="",r=null,a=!1;return o!==-1?(s=t.substring(0,o).replace(/\D/g,""),this.options.decimals>0&&(a=!0,r=t.substring(o+1).replace(/\D/g,"").slice(0,this.options.decimals))):s=t.replace(/\D/g,""),s.length>1&&(s=s.replace(/^0+/,"")||"0"),{isNegative:e,integerPart:s,decimalPart:r,hasDecimal:a}}format(i,t=i.length,e=!1){if(!i||i.trim()===""||i===this.options.currency.trim())return{formatted:"",rawNumber:null,rawValue:"",cursor:0,isValid:!0};let n=i.substring(0,t),o=n.replace(/\D/g,"").length,s=this.options.decimals>0&&/[,.]/.test(n),{isNegative:r,integerPart:a,decimalPart:u,hasDecimal:d}=this.parse(i),m=u,l=d;if(e&&this.options.decimals>0&&(a||u!==null)&&(l=!0,m===null?m="0".repeat(this.options.decimals):m.length<this.options.decimals&&(m=m+"0".repeat(this.options.decimals-m.length))),r&&!a&&!m&&!l&&this.options.allowNegative){let S="-",D=1;return this.options.currency&&(this.options.currencyPosition==="prefix"?(S=`${this.options.currency} -`,D=S.length):(S=`- ${this.options.currency}`,D=1)),{formatted:S,rawNumber:null,rawValue:"-",cursor:D,isValid:!0}}if(!a&&!m&&!l)return{formatted:"",rawNumber:null,rawValue:"",cursor:0,isValid:!0};let h=(a||"0").replace(/\B(?=(\d{3})+(?!\d))/g,this.options.thousandSeparator);l&&this.options.decimals>0&&(h+=this.options.decimalSeparator+(m??"")),r&&h!=="0"&&(h="-"+h);let c=h;this.options.currency&&(this.options.currencyPosition==="prefix"?c=`${this.options.currency} ${h}`:c=`${h} ${this.options.currency}`);let g=(r?"-":"")+(a||"0")+(u?"."+u:""),f=parseFloat(g);isNaN(f)&&(f=0);let v=f>=this.options.min&&f<=this.options.max,y=0;this.options.currency&&this.options.currencyPosition==="prefix"&&(y=this.options.currency.length+1);let E=0,k=!1,M=y;for(let S=y;S<c.length;S++){let D=c[S];if(D===this.options.currency.trim()[0]&&this.options.currencyPosition==="suffix")break;if(/\d/.test(D)?(E++,M=S+1):D===this.options.decimalSeparator&&(k=!0,M=S+1),s){if(k&&E>=o){y=S+1;break}}else if(E>=o){y=S+1;break}}o>0&&E<o&&M>y&&(y=M);let w=this.options.currency&&this.options.currencyPosition==="prefix"?this.options.currency.length+1:0,N=this.options.currency&&this.options.currencyPosition==="suffix"?Math.max(0,c.length-this.options.currency.length-1):c.length;return y=Math.max(w,Math.min(y,Math.max(w,N))),{formatted:c,rawNumber:f,rawValue:g,cursor:y,isValid:v}}static format(i,t={}){let e=new b(t),n=typeof i=="number"?i.toString():i;return e.format(n).formatted}escapeRegExp(i){return i.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}};var P=class extends A{constructor(t,e,n){let o=T(t,e,n),s=o.wrapper,r=o.input,a=o.options,u=s?.getAttribute("data-mask-pad-decimals")==="true"||r?.getAttribute("data-mask-pad-decimals")==="true",d=r?.getAttribute("data-mask-align")||r?.getAttribute("data-align")||s?.getAttribute("data-mask-align")||s?.getAttribute("data-align"),m={align:a.align??d??"right",padDecimalsOnBlur:a.padDecimalsOnBlur??u??!1,...a};super(s,r,m);this.isUndoingRedoing=!1;this.isApplying=!1;this.isComposing=!1;this.lastValue="";this.cutTimerId=null;this.resetTimerId=null;this.input.inputMode="decimal",this.history=new C,this.engine=new I(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:"")}static format(t,e={}){return I.format(t,e)}onNativeValueSet(t){if(this.options.disabled||this.isComposing){this.lastValue=t;return}this.applyAmount(t,t.length)}onDisabledChange(t){t||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.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 t=this.input.selectionStart??this.input.value.length;this.applyAmount(this.input.value,t)},0)},this.input.addEventListener("input",this.handleInput),this.input.addEventListener("keydown",this.handleKeyDown),this.input.addEventListener("blur",this.handleBlur),this.input.addEventListener("focus",this.handleFocus),this.input.addEventListener("click",this.handleClick),this.input.addEventListener("scroll",this.onScroll),this.input.addEventListener("cut",this.onCutHandler),this.input.addEventListener("compositionstart",this.onCompositionStart),this.input.addEventListener("compositionend",this.onCompositionEnd),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))}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)){this.isApplying=!0;try{let n=this.engine.format(t,e);this.setNativeValue(n.formatted),this.input.setSelectionRange(n.cursor,n.cursor),!this.isUndoingRedoing&&this.input.type!=="password"&&this.history.push(n.rawValue,n.cursor),this.updateGhost(n),this.lastValue!==n.formatted&&(this.lastValue=n.formatted,this.notifyChange(n))}finally{this.isApplying=!1}}}updateGhost(t){if(this.ghost){if(!t.formatted){if(this.shouldHideGhostForPlaceholder(!0)){this.ghost.textContent="";return}let e=this.options.currency?this.options.currencyPosition==="prefix"?`${this.options.currency} 0`:`0 ${this.options.currency}`:"0,00";this.ghost.textContent="";let n=document.createElement("span");n.className="mask-ghost-remaining",n.textContent=e,this.ghost.appendChild(n);return}this.ghost.textContent="",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)}handleKeyDown(t){if(!this.options.disabled){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,n=this.input.selectionEnd??0;if(e===n&&e>0){let o=this.input.value,s=o[e-1];if(s===this.engine.options.thousandSeparator||s===" "){t.preventDefault();let r=Math.max(0,e-2),a=o.slice(0,r)+o.slice(e);this.applyAmount(a,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,n=this.input.selectionEnd??0;if(e===n&&e<this.input.value.length){let o=this.input.value,s=o[e];if(s===this.engine.options.thousandSeparator||s===" "){t.preventDefault();let r=o.slice(0,e)+o.slice(e+2);this.applyAmount(r,e);return}if(this.options.currency&&this.options.currencyPosition==="suffix"){let r=o.length-this.options.currency.length-1;if(e>=r){t.preventDefault();return}}}}setTimeout(()=>this.enforceCursorBounds(),0)}}enforceCursorBounds(){if(!this.input.value||this.options.disabled)return;let t=this.input.selectionStart??0,e=this.input.selectionEnd??0;if(t!==e)return;let n=this.input.value,o=this.options.currency;if(o){if(this.options.currencyPosition==="prefix"){let s=o.length+1;t<s&&this.input.setSelectionRange(s,s)}else if(this.options.currencyPosition==="suffix"){let s=Math.max(0,n.length-o.length-1);t>s&&this.input.setSelectionRange(s,s)}}}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.input.type==="password"&&this.history.clear(),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:!0,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))}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:!0,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}setValue(t){let e=t!=null?String(t):"";this.options.disabled?(this.setNativeValue(e),this.lastValue=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.input.removeEventListener("input",this.handleInput),this.input.removeEventListener("keydown",this.handleKeyDown),this.input.removeEventListener("blur",this.handleBlur),this.input.removeEventListener("focus",this.handleFocus),this.input.removeEventListener("click",this.handleClick),this.input.removeEventListener("scroll",this.onScroll),this.input.removeEventListener("cut",this.onCutHandler),this.input.removeEventListener("compositionstart",this.onCompositionStart),this.input.removeEventListener("compositionend",this.onCompositionEnd),this.input.form&&this.onFormResetHandler&&this.input.form.removeEventListener("reset",this.onFormResetHandler),this.history.clear(),super.destroy())}};var O=class O{constructor(i={}){this.defaultDomain=null;this.defaultTld="__";this.domains=i.domains&&i.domains.length>0?i.domains:O.DEFAULT_DOMAINS,this.tlds=i.tlds&&i.tlds.length>0?i.tlds.map(t=>t.trim().replace(/^\./,"")).filter(Boolean):[...O.DEFAULT_TLDS],this.suggestOnAt=i.suggestOnAt??!0,this.setDefaultDomain(i.defaultDomain??null),this.setDefaultTld(i.defaultTld!==void 0?i.defaultTld:"__")}setDefaultDomain(i){i===!0?this.defaultDomain=this.domains.length>0?this.domains[0]:null:typeof i=="string"&&i.trim().length>0?this.defaultDomain=i.trim().replace(/^@/,""):this.defaultDomain=null}setDefaultTld(i){i===!0?this.defaultTld=this.tlds.length>0?this.tlds[0]:null:typeof i=="string"&&i.trim().length>0?this.defaultTld=i.trim().replace(/^\./,""):this.defaultTld=null}setTlds(i){this.tlds=i&&i.length>0?i.map(t=>t.trim().replace(/^\./,"")).filter(Boolean):[...O.DEFAULT_TLDS]}getMatchingTlds(i){let t=(i??"").toLowerCase();return t.length===0?[...this.tlds]:this.tlds.filter(e=>e.toLowerCase().startsWith(t)&&e.toLowerCase()!==t)}getMatchingDomains(i){let t=i??"";if(!t.includes("@"))return this.defaultDomain?[this.defaultDomain]:[];let e=t.indexOf("@");if(t.indexOf("@",e+1)!==-1)return[];let n=t.substring(e+1);if(n.length===0)return this.suggestOnAt?[...this.domains]:[];let o=n.toLowerCase();return this.domains.filter(s=>s.toLowerCase().startsWith(o)&&s.toLowerCase()!==o)}getSuggestion(i,t=0){let e=i??"";if(!e.includes("@"))return this.defaultDomain?{full:e?`${e}@${this.defaultDomain}`:`@${this.defaultDomain}`,remaining:`@${this.defaultDomain}`,matchedDomain:this.defaultDomain,isHintOnly:!1}:{full:e,remaining:"",matchedDomain:null,isHintOnly:!1};let n=e.indexOf("@"),o=e.substring(0,n),s=e.substring(n+1);if(e.indexOf("@",n+1)!==-1)return{full:e,remaining:"",matchedDomain:null,isHintOnly:!1};let r=this.getMatchingDomains(i);if(r.length>0){let h=(t%r.length+r.length)%r.length,c=r[h],g=s.toLowerCase(),f=c.substring(g.length);return{full:`${o}@${c}`,remaining:f,matchedDomain:c,isHintOnly:!1}}if(s.length===0||s.startsWith("."))return{full:i,remaining:"",matchedDomain:null,isHintOnly:!1};let a=s.toLowerCase();if(this.domains.some(h=>h.toLowerCase()===a))return{full:i,remaining:"",matchedDomain:s,isHintOnly:!1};let u=s.lastIndexOf(".");if(u===-1){if(!this.defaultTld)return{full:i,remaining:"",matchedDomain:null,isHintOnly:!1};let h=this.defaultTld.includes("_"),c=`.${this.defaultTld}`,g=`${s}.${this.defaultTld}`;return{full:h?i:`${o}@${g}`,remaining:c,matchedDomain:h?null:g,isHintOnly:h}}let d=s.substring(0,u),m=s.substring(u+1);if(!d||d.endsWith("."))return{full:i,remaining:"",matchedDomain:null,isHintOnly:!1};if(m.length===0){if(this.defaultTld&&!this.defaultTld.includes("_")){let h=`${d}.${this.defaultTld}`;return{full:`${o}@${h}`,remaining:this.defaultTld,matchedDomain:h,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 l=m.toLowerCase(),p=this.getMatchingTlds(m);if(p.length>0){let h=(t%p.length+p.length)%p.length,c=p[h],g=c.substring(l.length),f=`${d}.${c}`;return{full:`${o}@${f}`,remaining:g,matchedDomain:f,isHintOnly:!1}}if(this.defaultTld&&this.defaultTld.includes("_")&&m.length<this.defaultTld.length){let h=this.defaultTld.substring(m.length);if(h.includes("_"))return{full:i,remaining:h,matchedDomain:null,isHintOnly:!0}}return{full:i,remaining:"",matchedDomain:null,isHintOnly:!1}}};O.DEFAULT_DOMAINS=["gmail.com","outlook.com","orange.fr","free.fr","sfr.fr","yahoo.com","hotmail.com","icloud.com","laposte.net","proton.me"],O.DEFAULT_TLDS=["com","fr","net","org","eu","io","co","info","biz","me","tv","fi","be","ch","ca","uk","de","es","it"];var H=O;var V=class extends A{constructor(t,e,n){let o=T(t,e,n),s=o.wrapper,r=o.input,a=o.options,u=s?.getAttribute("data-mask-cycle-suggestions")==="true"||r?.getAttribute("data-mask-cycle-suggestions")==="true",d=s?.getAttribute("data-mask-auto-lowercase")==="true"||r?.getAttribute("data-mask-auto-lowercase")==="true",m=s?.getAttribute("data-mask-aria-autocomplete")??r?.getAttribute("data-mask-aria-autocomplete"),l=a.setAriaAutocomplete??(m!==null?m!=="false":!0),p=s?.getAttribute("data-mask-tlds")??r?.getAttribute("data-mask-tlds"),h=a.tlds??(p?p.split(",").map(v=>v.trim()).filter(Boolean):void 0),c=s?.getAttribute("data-mask-default-tld")??r?.getAttribute("data-mask-default-tld"),g=a.defaultTld!==void 0?a.defaultTld:c!==null?c==="false"||c==="none"?null:c==="true"?!0:c:void 0,f={completeOnTab:!0,completeOnArrowRight:!0,completeOnEnter:!0,cycleSuggestions:a.cycleSuggestions??u??!1,autoLowercase:a.autoLowercase??d??!1,setAriaAutocomplete:l,...a,...h!==void 0?{tlds:h}:{},...g!==void 0?{defaultTld:g}:{}};super(s,r,f);this.currentSuggestion={full:"",remaining:"",matchedDomain:null};this.currentSuggestionIndex=0;this.wasAriaAutocompleteSet=!1;this.cutTimerId=null;this.resetTimerId=null;this.input.inputMode="email",this.options.setAriaAutocomplete&&!this.input.hasAttribute("aria-autocomplete")&&(this.input.setAttribute("aria-autocomplete","inline"),this.wasAriaAutocompleteSet=!0),this.engine=new H(this.options),this.bindEvents(),this.options.disabled||this.updateSuggestion(),this.runAuditWarning(this.options.audit)}onNativeValueSet(t){this.options.disabled||this.updateSuggestion()}onDisabledChange(t){t?this.ghost&&(this.ghost.textContent=""):this.updateSuggestion()}bindEvents(){this.handleInput=this.handleInput.bind(this),this.handleKeyDown=this.handleKeyDown.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.updateSuggestion()},0)},this.input.addEventListener("input",this.handleInput),this.input.addEventListener("keydown",this.handleKeyDown),this.input.addEventListener("blur",this.handleBlur),this.input.addEventListener("focus",this.handleFocus),this.input.addEventListener("scroll",this.onScroll),this.input.addEventListener("cut",this.onCutHandler),this.input.form&&(this.onFormResetHandler=()=>{this.resetTimerId!==null&&clearTimeout(this.resetTimerId),this.resetTimerId=window.setTimeout(()=>{this.resetTimerId=null,!(this.isDestroyed||this.options.disabled)&&this.updateSuggestion()},0)},this.input.form.addEventListener("reset",this.onFormResetHandler))}updateSuggestion(){if(this.options.disabled){this.ghost&&(this.ghost.textContent="");return}let t=this.input.value;if(this.currentSuggestion=this.engine.getSuggestion(t,this.currentSuggestionIndex),!this.ghost)return;if(this.shouldHideGhostForPlaceholder(t.length===0))this.ghost.textContent="";else if(this.currentSuggestion.remaining){this.ghost.textContent="";let n=document.createElement("span");n.className="mask-ghost-typed",n.textContent=t;let o=document.createElement("span");o.className="mask-ghost-remaining",o.textContent=this.currentSuggestion.remaining,this.ghost.appendChild(n),this.ghost.appendChild(o)}else this.ghost.textContent="";this.ghost.scrollLeft=this.input.scrollLeft;let e=this.getDetail();this.options.onInput&&this.options.onInput(e),this.input.dispatchEvent(new CustomEvent("mask:input",{bubbles:!0,detail:e})),this.dispatchNativeInput()}handleInput(){if(!this.isDispatchingNativeInput&&!this.options.disabled){if(this.options.autoLowercase){let t=this.input.selectionStart??0,e=this.input.selectionEnd??t,n=this.input.value.toLowerCase();n!==this.input.value&&(this.setNativeValue(n),this.input.setSelectionRange(t,e))}this.currentSuggestionIndex=0,this.updateSuggestion()}}handleKeyDown(t){if(this.options.disabled)return;let e=!!this.currentSuggestion.remaining&&!this.currentSuggestion.isHintOnly,o=(this.input.selectionStart??0)===this.input.value.length,s=this.input.value.length>0;if(this.options.cycleSuggestions&&e&&s&&o){if(t.key==="ArrowDown"){t.preventDefault(),this.currentSuggestionIndex++,this.updateSuggestion();return}if(t.key==="ArrowUp"){t.preventDefault(),this.currentSuggestionIndex--,this.updateSuggestion();return}}if(t.key==="Tab"&&e&&s&&this.options.completeOnTab){t.preventDefault(),this.acceptSuggestion();return}if(t.key==="Enter"&&e&&s&&this.options.completeOnEnter){t.preventDefault(),this.acceptSuggestion();return}if(t.key==="ArrowRight"&&e&&s&&o&&this.options.completeOnArrowRight){t.preventDefault(),this.acceptSuggestion();return}}acceptSuggestion(){if(!this.currentSuggestion.remaining||this.currentSuggestion.isHintOnly||this.options.disabled||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();return this.options.onChange&&this.options.onChange(e),this.input.dispatchEvent(new CustomEvent("mask:change",{bubbles:!0,detail:e})),this.input.dispatchEvent(new CustomEvent("mask:complete",{bubbles:!0,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.syncGhostStyles(),this.updateSuggestion()}handleBlur(){this.wrapper.classList.remove("is-focused"),this.updateSuggestion();let t=this.getDetail();this.options.onChange&&this.options.onChange(t),this.input.dispatchEvent(new CustomEvent("mask:change",{bubbles:!0,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(n=>n.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.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.input.removeEventListener("input",this.handleInput),this.input.removeEventListener("keydown",this.handleKeyDown),this.input.removeEventListener("blur",this.handleBlur),this.input.removeEventListener("focus",this.handleFocus),this.input.removeEventListener("scroll",this.onScroll),this.input.removeEventListener("cut",this.onCutHandler),this.input.form&&this.onFormResetHandler&&this.input.form.removeEventListener("reset",this.onFormResetHandler),this.wasAriaAutocompleteSet&&this.input.getAttribute("aria-autocomplete")==="inline"&&this.input.removeAttribute("aria-autocomplete"),super.destroy())}};var K={BaseInputMask:A,InputMask:R,MaskEngine:x,MaskHistory:C,MaskKeyboard:L,AmountEngine:I,InputAmountMask:P,EmailEngine:H,InputEmailMask:V};if(typeof window<"u"){let b=window,i=b.Wulf||{};b.Wulf=i,i.Mask=K}var _=R;return q(Z);})();
|
|
5
|
-
if (typeof window !== "undefined") { window.Wulf = window.Wulf || {}; if (typeof Wulf !== "undefined" && Wulf) { var targets = ["Mask", "Scroll", "Masonry", "Toast"]; for (var i = 0; i < targets.length; i++) { var t = targets[i]; if (Wulf[t] && window.Wulf[t] !== Wulf[t]) { try { Object.defineProperty(window.Wulf, t, { value: Wulf[t], writable: true, configurable: true, enumerable: true }); } catch (_) { try { window.Wulf[t] = Wulf[t]; } catch (__) {} } } } for (var k in Wulf) { if (window.Wulf[k] === undefined) { try { Object.defineProperty(window.Wulf, k, { value: Wulf[k], writable: true, configurable: true, enumerable: true }); } catch (_) { try { window.Wulf[k] = Wulf[k]; } catch (__) {} } } } } }
|
|
5
|
+
if (typeof window !== "undefined") { window.Wulf = window.Wulf || {}; if (typeof Wulf !== "undefined" && Wulf) { var targets = ["Mask", "Scroll", "Masonry", "Toast", "FocusTrap", "Shortcut"]; for (var i = 0; i < targets.length; i++) { var t = targets[i]; if (Wulf[t] && window.Wulf[t] !== Wulf[t]) { try { Object.defineProperty(window.Wulf, t, { value: Wulf[t], writable: true, configurable: true, enumerable: true }); } catch (_) { try { window.Wulf[t] = Wulf[t]; } catch (__) {} } } } for (var k in Wulf) { if (window.Wulf[k] === undefined) { try { Object.defineProperty(window.Wulf, k, { value: Wulf[k], writable: true, configurable: true, enumerable: true }); } catch (_) { try { window.Wulf[k] = Wulf[k]; } catch (__) {} } } } } }
|
|
6
6
|
//# sourceMappingURL=mask.global.min.js.map
|
package/dist/masonry.global.js
CHANGED
|
@@ -857,5 +857,5 @@ var Wulf = (() => {
|
|
|
857
857
|
}
|
|
858
858
|
return __toCommonJS(index_exports);
|
|
859
859
|
})();
|
|
860
|
-
if (typeof window !== "undefined") { window.Wulf = window.Wulf || {}; if (typeof Wulf !== "undefined" && Wulf) { var targets = ["Mask", "Scroll", "Masonry", "Toast"]; for (var i = 0; i < targets.length; i++) { var t = targets[i]; if (Wulf[t] && window.Wulf[t] !== Wulf[t]) { try { Object.defineProperty(window.Wulf, t, { value: Wulf[t], writable: true, configurable: true, enumerable: true }); } catch (_) { try { window.Wulf[t] = Wulf[t]; } catch (__) {} } } } for (var k in Wulf) { if (window.Wulf[k] === undefined) { try { Object.defineProperty(window.Wulf, k, { value: Wulf[k], writable: true, configurable: true, enumerable: true }); } catch (_) { try { window.Wulf[k] = Wulf[k]; } catch (__) {} } } } } }
|
|
860
|
+
if (typeof window !== "undefined") { window.Wulf = window.Wulf || {}; if (typeof Wulf !== "undefined" && Wulf) { var targets = ["Mask", "Scroll", "Masonry", "Toast", "FocusTrap", "Shortcut"]; for (var i = 0; i < targets.length; i++) { var t = targets[i]; if (Wulf[t] && window.Wulf[t] !== Wulf[t]) { try { Object.defineProperty(window.Wulf, t, { value: Wulf[t], writable: true, configurable: true, enumerable: true }); } catch (_) { try { window.Wulf[t] = Wulf[t]; } catch (__) {} } } } for (var k in Wulf) { if (window.Wulf[k] === undefined) { try { Object.defineProperty(window.Wulf, k, { value: Wulf[k], writable: true, configurable: true, enumerable: true }); } catch (_) { try { window.Wulf[k] = Wulf[k]; } catch (__) {} } } } } }
|
|
861
861
|
//# sourceMappingURL=masonry.global.js.map
|
|
@@ -2,5 +2,5 @@
|
|
|
2
2
|
`+t.map(e=>` - ${e}`).join(`
|
|
3
3
|
`)+`
|
|
4
4
|
(${this.getAuditDisableHint()})`),t}checkAriaIdReferences(i,t,e){let n=i.getAttribute(t)?.trim();if(!n)return!1;let r=i.ownerDocument||document,s=n.split(/\s+/).filter(Boolean),a=s.length>0&&s.every(o=>!!r.getElementById(o));return a||e.push(`Attribut ${t}="${n}" invalide : l'\xE9l\xE9ment cible est introuvable dans le DOM.`),a}};var L=class extends S{static setLocale(i){this._i18n&&this._i18n.setLocale(i)}static getLocale(){return this._i18n?this._i18n.getLocale():""}static registerLocale(i,t){this._i18n&&this._i18n.registerLocale(i,t)}static setI18n(i){this._i18n&&this._i18n.setI18n(i)}static getI18n(){return this._i18n?this._i18n.getAll():{}}static resetI18n(){this._i18n&&this._i18n.reset()}static t(i,t){return this._i18n?this._i18n.t(i,t):String(i)}constructor(i){super(),this.i18nOverrides=i}t(i){let t=this.constructor;return t._i18n?t._i18n.t(i,this.i18nOverrides):String(i)}};function E(c){return c.trim().toLowerCase().replace(/_/g,"-")}function X(c){let i=c.indexOf("-");return i>0?c.slice(0,i):null}function I(c,i){if(!i)return c;for(let t of Object.keys(i))i[t]!==void 0&&(c[t]=i[t]);return c}function H(c,i){let t=E(c),e={};for(let[o,u]of Object.entries(i))e[E(o)]={...u};let n=t,r={...e},s={};function a(){let o=[],u=r[n];u&&o.push(u);let l=X(n);return l&&r[l]&&o.push(r[l]),o}return{setLocale(o){o&&o.trim()&&(n=E(o))},getLocale(){return n},registerLocale(o,u){if(!o||!o.trim()||!u)return;let l=E(o);r[l]=I({...r[l]||{}},u)},setI18n(o){o&&(s=I({...s},o))},t(o,u){if(u&&u[o]!==void 0)return String(u[o]);if(s[o]!==void 0)return String(s[o]);for(let v of a())if(v[o]!==void 0)return String(v[o]);let l=r[t]||e[t];return l&&l[o]!==void 0?String(l[o]):String(o)},getAll(o){let u={},l=r[t]||e[t];I(u,l);let v=a().reverse();for(let f of v)I(u,f);return I(u,s),I(u,o),u},reset(){n=t,s={},r={};for(let[o,u]of Object.entries(e))r[o]={...u}}}}var z={gallery:"Galerie en grille asym\xE9trique"};var D={gallery:"Masonry grid gallery"};var w=H("fr",{fr:z,en:D});var p=class extends L{constructor(t,e={}){super(e.i18n);this.isNativeCSSGrid=!1;this._items=[];this.resizeObserver=null;this.itemResizeObserver=null;this.layoutRafId=null;this.isDestroyed=!1;this.wasRoleInferred=!1;this.wasAriaLabelInferred=!1;this.hasExplicitAriaLabel=!1;this.lastInferredAriaLabel="";this.removeTimers=new Set;this.pendingImageListeners=[];if(typeof t=="string"){let r=document.querySelector(t);if(!r)throw new Error(`[Wulf.Masonry] Conteneur introuvable pour le s\xE9lecteur : "${t}"`);this.root=r}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 n=typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("grid-template-rows","masonry");this.options.useNativeCSSGrid&&n?(this.isNativeCSSGrid=!0,this.root.classList.add("wulf-masonry","wulf-masonry--native")):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.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=typeof t=="number"?`${t}ms`:t;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"));else try{t=Array.from(this.root.querySelectorAll(this.options.itemSelector)).filter(e=>e.parentElement===this.root&&!e.hasAttribute("data-masonry-ignore"))}catch{t=Array.from(this.root.children).filter(e=>e instanceof HTMLElement&&!e.hasAttribute("data-masonry-ignore"))}this._items=t;for(let e of this._items)e.classList.add("wulf-masonry-item"),this.itemResizeObserver&&this.itemResizeObserver.observe(e)}initObservers(){if(!this.options.resize||typeof ResizeObserver>"u")return;let t=this.root.getBoundingClientRect().width;this.resizeObserver=new ResizeObserver(e=>{for(let n of e){let r=n.contentRect.width;Math.abs(r-t)>=1&&(t=r,this.scheduleLayout())}}),this.resizeObserver.observe(this.root),this.itemResizeObserver=new ResizeObserver(()=>{this.scheduleLayout()});for(let e of this._items)this.itemResizeObserver.observe(e)}initImages(){if(!this.options.autoImages)return;let t=Array.from(this.root.querySelectorAll("img"));for(let e of t)if(!e.complete){let n=()=>{let r=()=>{this.pendingImageListeners=this.pendingImageListeners.filter(s=>s.handler!==r),this.isDestroyed||this.scheduleLayout()};this.pendingImageListeners.push({img:e,handler:r}),e.addEventListener("load",r,{once:!0})};typeof e.decode=="function"?e.decode().then(()=>{this.isDestroyed||this.scheduleLayout()}).catch(()=>{n()}):n()}}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.options.onLayout([]);return}this.root.setAttribute("aria-busy","true");let t=b.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,n=this.options.percentPosition&&t.containerWidth>0;for(let r=0;r<t.positions.length;r++){let s=t.positions[r],a=s.element;if(n){let o=Number((s.width/t.containerWidth*100).toFixed(4));a.style.setProperty("--wulf-masonry-w",`${o}%`)}else a.style.setProperty("--wulf-masonry-w",`${s.width}px`);a.style.setProperty("--wulf-masonry-x",`${s.x}px`),a.style.setProperty("--wulf-masonry-y",`${s.y}px`),e>0?a.style.transitionDelay=`${r*e}ms`:a.style.removeProperty("transition-delay"),a.classList.remove("wulf-masonry-item--hidden"),this.options.onItemPlaced(a,s)}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 n=document.createDocumentFragment();for(let r of e)r.classList.add("wulf-masonry-item","wulf-masonry-item--hidden"),n.appendChild(r);this.root.appendChild(n),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 n=this.root.firstChild,r=document.createDocumentFragment();for(let s of e)s.classList.add("wulf-masonry-item","wulf-masonry-item--hidden"),r.appendChild(s);this.root.insertBefore(r,n),this.reloadItems(),this.initImages(),this.layout()}remove(t){if(this.isDestroyed)return;let e=Array.isArray(t)?t:[t];if(e.length===0)return;for(let s of e)s.classList.add("wulf-masonry-item--hidden");let n=typeof this.options.transitionDuration=="number"?this.options.transitionDuration:300;if(n<=0){for(let s of e)s.parentElement===this.root&&(this.itemResizeObserver&&this.itemResizeObserver.unobserve(s),this.root.removeChild(s));this.reloadItems(),this.layout();return}let r=window.setTimeout(()=>{if(this.removeTimers.delete(r),!this.isDestroyed){for(let s of e)s.parentElement===this.root&&(this.itemResizeObserver&&this.itemResizeObserver.unobserve(s),this.root.removeChild(s));this.reloadItems(),this.layout()}},n);this.removeTimers.add(r)}audit(){let t=[],e=this.checkAriaIdReferences(this.root,"aria-labelledby",t),n=!this.wasAriaLabelInferred&&!!this.root.getAttribute("aria-label")?.trim();!this.hasExplicitAriaLabel&&!n&&!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 r=Array.from(this.root.querySelectorAll("img")).filter(s=>!s.hasAttribute("alt")&&s.getAttribute("aria-hidden")!=="true");return r.length>0&&t.push(`${r.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;for(let t of this.removeTimers)clearTimeout(t);this.removeTimers.clear();for(let{img:t,handler:e}of this.pendingImageListeners)t.removeEventListener("load",e);this.pendingImageListeners=[],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.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("transition-delay");this._items=[]}}};p._i18n=w,p.i18n=w;var J=p;if(typeof window<"u"){let c=window,i=c.Wulf||{};c.Wulf=i,i.Masonry=Object.assign(p,{Masonry:p,LayoutEngine:b,i18n:w})}return V(K);})();
|
|
5
|
-
if (typeof window !== "undefined") { window.Wulf = window.Wulf || {}; if (typeof Wulf !== "undefined" && Wulf) { var targets = ["Mask", "Scroll", "Masonry", "Toast"]; for (var i = 0; i < targets.length; i++) { var t = targets[i]; if (Wulf[t] && window.Wulf[t] !== Wulf[t]) { try { Object.defineProperty(window.Wulf, t, { value: Wulf[t], writable: true, configurable: true, enumerable: true }); } catch (_) { try { window.Wulf[t] = Wulf[t]; } catch (__) {} } } } for (var k in Wulf) { if (window.Wulf[k] === undefined) { try { Object.defineProperty(window.Wulf, k, { value: Wulf[k], writable: true, configurable: true, enumerable: true }); } catch (_) { try { window.Wulf[k] = Wulf[k]; } catch (__) {} } } } } }
|
|
5
|
+
if (typeof window !== "undefined") { window.Wulf = window.Wulf || {}; if (typeof Wulf !== "undefined" && Wulf) { var targets = ["Mask", "Scroll", "Masonry", "Toast", "FocusTrap", "Shortcut"]; for (var i = 0; i < targets.length; i++) { var t = targets[i]; if (Wulf[t] && window.Wulf[t] !== Wulf[t]) { try { Object.defineProperty(window.Wulf, t, { value: Wulf[t], writable: true, configurable: true, enumerable: true }); } catch (_) { try { window.Wulf[t] = Wulf[t]; } catch (__) {} } } } for (var k in Wulf) { if (window.Wulf[k] === undefined) { try { Object.defineProperty(window.Wulf, k, { value: Wulf[k], writable: true, configurable: true, enumerable: true }); } catch (_) { try { window.Wulf[k] = Wulf[k]; } catch (__) {} } } } } }
|
|
6
6
|
//# sourceMappingURL=masonry.global.min.js.map
|
package/dist/scroll.global.js
CHANGED
|
@@ -822,5 +822,5 @@ var Wulf = (() => {
|
|
|
822
822
|
}
|
|
823
823
|
return __toCommonJS(index_exports);
|
|
824
824
|
})();
|
|
825
|
-
if (typeof window !== "undefined") { window.Wulf = window.Wulf || {}; if (typeof Wulf !== "undefined" && Wulf) { var targets = ["Mask", "Scroll", "Masonry", "Toast"]; for (var i = 0; i < targets.length; i++) { var t = targets[i]; if (Wulf[t] && window.Wulf[t] !== Wulf[t]) { try { Object.defineProperty(window.Wulf, t, { value: Wulf[t], writable: true, configurable: true, enumerable: true }); } catch (_) { try { window.Wulf[t] = Wulf[t]; } catch (__) {} } } } for (var k in Wulf) { if (window.Wulf[k] === undefined) { try { Object.defineProperty(window.Wulf, k, { value: Wulf[k], writable: true, configurable: true, enumerable: true }); } catch (_) { try { window.Wulf[k] = Wulf[k]; } catch (__) {} } } } } }
|
|
825
|
+
if (typeof window !== "undefined") { window.Wulf = window.Wulf || {}; if (typeof Wulf !== "undefined" && Wulf) { var targets = ["Mask", "Scroll", "Masonry", "Toast", "FocusTrap", "Shortcut"]; for (var i = 0; i < targets.length; i++) { var t = targets[i]; if (Wulf[t] && window.Wulf[t] !== Wulf[t]) { try { Object.defineProperty(window.Wulf, t, { value: Wulf[t], writable: true, configurable: true, enumerable: true }); } catch (_) { try { window.Wulf[t] = Wulf[t]; } catch (__) {} } } } for (var k in Wulf) { if (window.Wulf[k] === undefined) { try { Object.defineProperty(window.Wulf, k, { value: Wulf[k], writable: true, configurable: true, enumerable: true }); } catch (_) { try { window.Wulf[k] = Wulf[k]; } catch (__) {} } } } } }
|
|
826
826
|
//# sourceMappingURL=scroll.global.js.map
|
|
@@ -2,5 +2,5 @@
|
|
|
2
2
|
`+t.map(i=>` - ${i}`).join(`
|
|
3
3
|
`)+`
|
|
4
4
|
(${this.getAuditDisableHint()})`),t}checkAriaIdReferences(r,t,i){let o=r.getAttribute(t)?.trim();if(!o)return!1;let n=r.ownerDocument||document,h=o.split(/\s+/).filter(Boolean),u=h.length>0&&h.every(e=>!!n.getElementById(e));return u||i.push(`Attribut ${t}="${o}" invalide : l'\xE9l\xE9ment cible est introuvable dans le DOM.`),u}};var m=class extends w{static setLocale(r){this._i18n&&this._i18n.setLocale(r)}static getLocale(){return this._i18n?this._i18n.getLocale():""}static registerLocale(r,t){this._i18n&&this._i18n.registerLocale(r,t)}static setI18n(r){this._i18n&&this._i18n.setI18n(r)}static getI18n(){return this._i18n?this._i18n.getAll():{}}static resetI18n(){this._i18n&&this._i18n.reset()}static t(r,t){return this._i18n?this._i18n.t(r,t):String(r)}constructor(r){super(),this.i18nOverrides=r}t(r){let t=this.constructor;return t._i18n?t._i18n.t(r,this.i18nOverrides):String(r)}};function T(c){return c.trim().toLowerCase().replace(/_/g,"-")}function Y(c){let r=c.indexOf("-");return r>0?c.slice(0,r):null}function f(c,r){if(!r)return c;for(let t of Object.keys(r))r[t]!==void 0&&(c[t]=r[t]);return c}function A(c,r){let t=T(c),i={};for(let[e,s]of Object.entries(r))i[T(e)]={...s};let o=t,n={...i},h={};function u(){let e=[],s=n[o];s&&e.push(s);let a=Y(o);return a&&n[a]&&e.push(n[a]),e}return{setLocale(e){e&&e.trim()&&(o=T(e))},getLocale(){return o},registerLocale(e,s){if(!e||!e.trim()||!s)return;let a=T(e);n[a]=f({...n[a]||{}},s)},setI18n(e){e&&(h=f({...h},e))},t(e,s){if(s&&s[e]!==void 0)return String(s[e]);if(h[e]!==void 0)return String(h[e]);for(let l of u())if(l[e]!==void 0)return String(l[e]);let a=n[t]||i[t];return a&&a[e]!==void 0?String(a[e]):String(e)},getAll(e){let s={},a=n[t]||i[t];f(s,a);let l=u().reverse();for(let d of l)f(s,d);return f(s,h),f(s,e),s},reset(){o=t,h={},n={};for(let[e,s]of Object.entries(i))n[e]={...s}}}}var x={viewport:"Zone de contenu d\xE9filable",verticalThumb:"D\xE9filement vertical",horizontalThumb:"D\xE9filement horizontal"};var S={viewport:"Scrollable content area",verticalThumb:"Vertical scroll",horizontalThumb:"Horizontal scroll"};var g=A("fr",{fr:x,en:S});var M=0,v=class extends m{constructor(t,i){super(i?.i18n);this.createdViewport=!1;this.wasIdGenerated=!1;this.wasRoleInferred=!1;this.wasAriaLabelInferred=!1;this.hasExplicitAriaLabel=!1;this.lastInferredAriaLabel="";this.isDragging=!1;this.dragStartPos=0;this.dragStartScroll=0;this.atBottom=!1;this.atTop=!0;this.atRight=!1;this.atLeft=!0;let o=typeof t=="string"?document.querySelector(t):t;if(!o)throw new Error(`[ScrollBlock] \xC9l\xE9ment introuvable : "${t}".`);this.root=o,this.hasExplicitAriaLabel=!!(i?.ariaLabel||i?.i18n?.viewport),this.options={axis:i?.axis||"y",autoHide:i?.autoHide??!0,autoHideDelay:i?.autoHideDelay??1e3,alwaysVisible:i?.alwaysVisible??!1,ariaLabel:i?.ariaLabel||this.t("viewport"),i18n:i?.i18n||{},minThumbSize:i?.minThumbSize??24,edgeThreshold:i?.edgeThreshold??10,onScroll:i?.onScroll||(()=>{}),onTotalScroll:i?.onTotalScroll||(()=>{}),onTotalScrollBack:i?.onTotalScrollBack||(()=>{}),audit:i?.audit??!0},this.boundOnScroll=this.handleScroll.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.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 i=document.createElement("div");for(i.className="wulf-scrollblock-viewport";this.root.firstChild;)i.appendChild(this.root.firstChild);return this.root.appendChild(i),this.createdViewport=!0,i}setupAccessibility(){if(this.viewport.id||(M+=1,this.viewport.id=`wulf-scrollblock-vp-${M}`,this.wasIdGenerated=!0),this.viewport.hasAttribute("role")||(this.viewport.setAttribute("role","region"),this.wasRoleInferred=!0),!this.viewport.hasAttribute("aria-label")){let t=this.hasExplicitAriaLabel?this.options.ariaLabel:this.t("viewport");this.viewport.setAttribute("aria-label",t),this.lastInferredAriaLabel=t,this.wasAriaLabelInferred=!0}}syncAccessibilityLabels(){if(this.wasAriaLabelInferred&&!this.hasExplicitAriaLabel&&this.viewport.getAttribute("aria-label")===this.lastInferredAriaLabel){let i=this.t("viewport");this.viewport.setAttribute("aria-label",i),this.lastInferredAriaLabel=i,this.options.ariaLabel=i}this.thumbY&&this.thumbY.setAttribute("aria-label",this.t("verticalThumb")),this.thumbX&&this.thumbX.setAttribute("aria-label",this.t("horizontalThumb"))}setupScrollbars(){(this.options.axis==="y"||this.options.axis==="both")&&(this.trackY=document.createElement("div"),this.trackY.className="wulf-scrollblock-track wulf-scrollblock-vertical",this.trackY.setAttribute("aria-hidden","true"),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.trackX.setAttribute("aria-hidden","true"),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"))}attachTrackListeners(t,i,o){i.addEventListener("pointerdown",n=>{n.preventDefault(),n.stopPropagation(),this.isDragging=!0,this.dragAxis=o,this.dragPointerId=n.pointerId,this.dragStartPos=o==="y"?n.clientY:n.clientX,this.dragStartScroll=o==="y"?this.viewport.scrollTop:this.viewport.scrollLeft,i.setPointerCapture(n.pointerId),i.classList.add("is-active"),this.root.classList.add("is-dragging"),window.addEventListener("pointermove",this.boundPointerMove),window.addEventListener("pointerup",this.boundPointerUp),window.addEventListener("pointercancel",this.boundPointerUp)}),t.addEventListener("pointerdown",n=>{if(n.target===i)return;n.preventDefault();let h=t.getBoundingClientRect(),u=o==="y"?n.clientY-h.top:n.clientX-h.left,e=o==="y"?h.height:h.width,s=o==="y"?this.viewport.clientHeight:this.viewport.clientWidth,a=o==="y"?this.viewport.scrollHeight:this.viewport.scrollWidth,d=u/e*(a-s);this.scrollTo(o==="y"?{top:d}:{left:d},{smooth:!0})})}setupEventListeners(){this.viewport.addEventListener("scroll",this.boundOnScroll,{passive:!0}),this.options.autoHide&&!this.options.alwaysVisible&&(this.root.addEventListener("mouseenter",this.boundOnMouseEnter),this.root.addEventListener("mouseleave",this.boundOnMouseLeave),this.root.addEventListener("focusin",this.boundOnFocusIn),this.root.addEventListener("focusout",this.boundOnFocusOut))}setupObserver(){typeof ResizeObserver<"u"&&(this.resizeObserver=new ResizeObserver(()=>{window.requestAnimationFrame(()=>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)return;let i=this.dragAxis==="y",o=(i?t.clientY:t.clientX)-this.dragStartPos,n=i?this.trackY:this.trackX,h=i?this.thumbY:this.thumbX;if(!n||!h)return;let u=i?n.clientHeight:n.clientWidth,e=i?h.clientHeight:h.clientWidth,s=i?this.viewport.clientHeight:this.viewport.clientWidth,l=(i?this.viewport.scrollHeight:this.viewport.scrollWidth)-s,d=u-e;if(d<=0||l<=0)return;let b=l/d,p=this.dragStartScroll+o*b;i?this.viewport.scrollTop=Math.max(0,Math.min(l,p)):this.viewport.scrollLeft=Math.max(0,Math.min(l,p))}handlePointerUp(t){if(this.isDragging){if(this.dragPointerId!==void 0){let i=this.dragAxis==="y"?this.thumbY:this.thumbX;i&&i.hasPointerCapture(this.dragPointerId)&&i.releasePointerCapture(this.dragPointerId)}window.removeEventListener("pointermove",this.boundPointerMove),window.removeEventListener("pointerup",this.boundPointerUp),window.removeEventListener("pointercancel",this.boundPointerUp),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()}}handleScroll(){this.syncThumbs();let{scrollTop:t,scrollLeft:i,scrollHeight:o,scrollWidth:n,clientHeight:h,clientWidth:u}=this.viewport,e=Math.max(0,o-h),s=Math.max(0,n-u),a=e>0?t/e:0,l=s>0?i/s:0;this.options.onScroll({top:t,left:i,maxTop:e,maxLeft:s,progressY:Math.round(a*100),progressX:Math.round(l*100)});let d=this.options.edgeThreshold;if(e>0){let b=t>=e-d,p=t<=d;b&&!this.atBottom&&this.options.onTotalScroll("bottom"),p&&!this.atTop&&this.options.onTotalScrollBack("top"),this.atBottom=b,this.atTop=p}if(s>0){let b=i>=s-d,p=i<=d;b&&!this.atRight&&this.options.onTotalScroll("right"),p&&!this.atLeft&&this.options.onTotalScrollBack("left"),this.atRight=b,this.atLeft=p}this.options.autoHide&&!this.options.alwaysVisible&&(this.root.classList.add("is-scrolling"),this.scheduleAutoHide())}syncThumbs(){let{scrollTop:t,scrollLeft:i,scrollHeight:o,scrollWidth:n,clientHeight:h,clientWidth:u}=this.viewport;if(this.thumbY&&this.trackY){let e=o-h,s=this.trackY.clientHeight,a=this.thumbY.clientHeight,l=s-a;if(e>0&&l>0){let d=t/e,b=Math.max(0,Math.min(l,d*l));this.thumbY.style.transform=`translate3d(0, ${b}px, 0)`,this.thumbY.setAttribute("aria-valuenow",String(Math.round(d*100)))}}if(this.thumbX&&this.trackX){let e=n-u,s=this.trackX.clientWidth,a=this.thumbX.clientWidth,l=s-a;if(e>0&&l>0){let d=i/e,b=Math.max(0,Math.min(l,d*l));this.thumbX.style.transform=`translate3d(${b}px, 0, 0)`,this.thumbX.setAttribute("aria-valuenow",String(Math.round(d*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(){this.syncAccessibilityLabels();let{scrollHeight:t,clientHeight:i,scrollWidth:o,clientWidth:n}=this.viewport,h=t>i,u=o>n;if(this.root.classList.toggle("has-scroll-y",h),this.root.classList.toggle("has-scroll-x",u),h||u?this.viewport.setAttribute("tabindex","0"):this.viewport.removeAttribute("tabindex"),this.trackY&&this.thumbY&&h){let e=this.trackY.clientHeight,s=Math.max(this.options.minThumbSize,e*(i/t));this.thumbY.style.height=`${s}px`}if(this.trackX&&this.thumbX&&u){let e=this.trackX.clientWidth,s=Math.max(this.options.minThumbSize,e*(n/o));this.thumbX.style.width=`${s}px`}this.syncThumbs()}scrollTo(t,i){let o=typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-reduced-motion: reduce)").matches,n=typeof t=="object"&&t!==null&&!(t instanceof HTMLElement)?t.smooth:void 0,u=(i?.smooth??n??!0)&&!o?"smooth":"auto",e=Math.max(0,this.viewport.scrollHeight-this.viewport.clientHeight),s=Math.max(0,this.viewport.scrollWidth-this.viewport.clientWidth),a,l;if(typeof t=="number")a=t;else if(typeof t=="string")switch(t){case"top":a=0;break;case"bottom":a=e;break;case"left":l=0;break;case"right":l=s;break;default:{if(/^-?\d+(\.\d+)?%$/.test(t.trim())){let b=Math.max(0,Math.min(100,parseFloat(t.trim())))/100;this.options.axis==="x"?l=s*b:this.options.axis==="both"?(a=e*b,l=s*b):a=e*b;break}let d=null;try{d=this.viewport.querySelector(t)}catch{d=null}d&&(a=d.offsetTop,l=d.offsetLeft);break}}else t instanceof HTMLElement?(a=t.offsetTop,l=t.offsetLeft):typeof t=="object"&&(a=t.top,l=t.left);this.viewport.scrollTo({top:a!==void 0?Math.max(0,Math.min(e,a)):void 0,left:l!==void 0?Math.max(0,Math.min(s,l)):void 0,behavior:u})}audit(){let t=[],i=this.checkAriaIdReferences(this.viewport,"aria-labelledby",t),o=this.checkAriaIdReferences(this.root,"aria-labelledby",t),n=i||o,h=this.root.getAttribute("aria-label")?.trim(),u=!this.wasAriaLabelInferred&&!!this.viewport.getAttribute("aria-label")?.trim();return!this.hasExplicitAriaLabel&&!u&&!h&&!n&&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.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.clearAutoHideTimer(),this.resizeObserver&&this.resizeObserver.disconnect(),this.viewport.removeEventListener("scroll",this.boundOnScroll),this.root.removeEventListener("mouseenter",this.boundOnMouseEnter),this.root.removeEventListener("mouseleave",this.boundOnMouseLeave),this.root.removeEventListener("focusin",this.boundOnFocusIn),this.root.removeEventListener("focusout",this.boundOnFocusOut),window.removeEventListener("pointermove",this.boundPointerMove),window.removeEventListener("pointerup",this.boundPointerUp),window.removeEventListener("pointercancel",this.boundPointerUp),this.trackY?.remove(),this.trackX?.remove(),this.root.classList.remove("wulf-scrollblock","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.insertBefore(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.wasAriaLabelInferred&&this.viewport.getAttribute("aria-label")===this.lastInferredAriaLabel&&this.viewport.removeAttribute("aria-label")}};v._i18n=g,v.i18n=g;var y={ScrollBlock:v,i18n:g};var X=v;if(typeof window<"u"){let c=window,r=c.Wulf||{};c.Wulf=r,r.Scroll=y}return O(z);})();
|
|
5
|
-
if (typeof window !== "undefined") { window.Wulf = window.Wulf || {}; if (typeof Wulf !== "undefined" && Wulf) { var targets = ["Mask", "Scroll", "Masonry", "Toast"]; for (var i = 0; i < targets.length; i++) { var t = targets[i]; if (Wulf[t] && window.Wulf[t] !== Wulf[t]) { try { Object.defineProperty(window.Wulf, t, { value: Wulf[t], writable: true, configurable: true, enumerable: true }); } catch (_) { try { window.Wulf[t] = Wulf[t]; } catch (__) {} } } } for (var k in Wulf) { if (window.Wulf[k] === undefined) { try { Object.defineProperty(window.Wulf, k, { value: Wulf[k], writable: true, configurable: true, enumerable: true }); } catch (_) { try { window.Wulf[k] = Wulf[k]; } catch (__) {} } } } } }
|
|
5
|
+
if (typeof window !== "undefined") { window.Wulf = window.Wulf || {}; if (typeof Wulf !== "undefined" && Wulf) { var targets = ["Mask", "Scroll", "Masonry", "Toast", "FocusTrap", "Shortcut"]; for (var i = 0; i < targets.length; i++) { var t = targets[i]; if (Wulf[t] && window.Wulf[t] !== Wulf[t]) { try { Object.defineProperty(window.Wulf, t, { value: Wulf[t], writable: true, configurable: true, enumerable: true }); } catch (_) { try { window.Wulf[t] = Wulf[t]; } catch (__) {} } } } for (var k in Wulf) { if (window.Wulf[k] === undefined) { try { Object.defineProperty(window.Wulf, k, { value: Wulf[k], writable: true, configurable: true, enumerable: true }); } catch (_) { try { window.Wulf[k] = Wulf[k]; } catch (__) {} } } } } }
|
|
6
6
|
//# sourceMappingURL=scroll.global.min.js.map
|