UNPKG

@codegouvfr/react-dsfr

Version:

French State Design System React integration library

2 lines 72.3 kB
/*! DSFR v1.13.2 | SPDX-License-Identifier: MIT | License-Filename: LICENSE.md | restricted use (see terms and conditions) */ const t=window.dsfr,e="a4e35ba2a938ba9d007689dbf3f46acbb9807869",s={MANUAL:"manual",LOAD:"load",FULL:"full",HASH:"hash"},i="_EA_",n=`${i}disabled`,r=`${i}toggle`;const a=new class{constructor(){this._configure()}_configure(){const t=this;window[n]=()=>t.isDisabled,window[r]=this.toggle.bind(this)}get isDisabled(){return localStorage.getItem(i)}toggle(){this.isDisabled?this.enable():this.disable()}enable(){localStorage.getItem(i)&&localStorage.removeItem(i)}disable(){localStorage.setItem(i,"1")}},o="EA_push";class l{constructor(t){this._domain=t,this._isLoaded=!1,this._promise=new Promise(((t,e)=>{this._resolve=t,this._reject=e}))}get id(){return this._id}get store(){return this._store}configure(){return this.init(),this._promise}init(){let e=5381;for(let t=this._domain.length-1;t>0;t--)e=33*e^this._domain.charCodeAt(t);e>>>=0,this._id=`_EA_${e}`,this._store=[],this._store.eah=this._domain,window[this._id]=this._store,window[o]||(window[o]=(...t)=>this.store.push(t)),a.isDisabled?(t.inspector.warn("User opted out, eulerian is disabled"),this._reject("User opted out, eulerian is disabled")):this.load()}load(){const t=new Date/1e7|0,e=t%26,s=String.fromCharCode(97+e,122-e,65+e)+t%1e3;this._script=document.createElement("script"),this._script.ea=this.id,this._script.async=!0,this._script.addEventListener("load",this.loaded.bind(this)),this._script.addEventListener("error",this.error.bind(this)),this._script.src=`//${this._domain}/${s}.js?2`;const i=document.getElementsByTagName("script")[0];i.parentNode.insertBefore(this._script,i)}error(){t.inspector.error("unable to load Eulerian script file. the domain declared in your configuration must match the domain provided by the Eulerian interface (tag creation)"),this._reject("eulerian script loading error")}loaded(){this._isLoaded||(this._isLoaded=!0,this._resolve())}}const c=-1,h=0,u=1,g=2,d=3;class _{constructor(t){this._config=t,this._state=c,this._promise=new Promise(((t,e)=>{this._resolve=t,this._reject=e}))}configure(){if(this._state>=u)return this._promise;this._state===c&&(t.inspector.info("analytics configures tarteaucitron"),this._state=h);const e=window.tarteaucitron;if(!e||!e.services)return void window.requestAnimationFrame(this.configure.bind(this));this._state=u;const s={key:"eulerian",type:"analytic",name:"Eulerian Analytics",needConsent:!0,cookies:["etuix"],uri:"https://eulerian.com/vie-privee",js:this.init.bind(this),fallback:()=>{e.services.eulerian.js()}};return e.services.eulerian=s,e.job||(e.job=[]),e.job.push("eulerian"),this._promise}init(){if(this._state>=g)return;this._state=g,window.__eaGenericCmpApi=this.integrate.bind(this);const t=this.update.bind(this);window.addEventListener("tac.close_alert",t),window.addEventListener("tac.close_panel",t)}integrate(e){this._state>=d||(this._state=d,this._cmpApi=e,t.inspector.info("analytics has integrated tarteaucitron"),this._resolve(),this.update())}update(){this._state<d||this._cmpApi("tac",window.tarteaucitron,1)}}class p{constructor(t){if(this._config=t,t&&"tarteaucitron"===t.id)this.integrateTarteAuCitron()}integrateTarteAuCitron(){return this._tac=new _(this._config),this._tac.configure()}optin(){}}const m=(e,s)=>{"function"==typeof window.EA_push?(t.inspector.info("analytics",e,s),window.EA_push(e,s)):t.inspector.warn("Analytics datalayer not sent, Eulerian API isn't yet avalaible")},b={COLLECTOR:"collector",ACTION:"action",ACTION_PARAMETER:"actionparam"};const f=new class{constructor(){this._renderables=[],this._rendering=this.render.bind(this),requestAnimationFrame(this._rendering)}add(t){-1===this._renderables.indexOf(t)&&this._renderables.push(t)}remove(t){const e=this._renderables.indexOf(t);e>-1&&this._renderables.splice(e,1)}render(){this._renderables.forEach((t=>t.render())),requestAnimationFrame(this._rendering)}},y={ENFORCE:"enforce",PREVENT:"prevent",NONE:"none"};class E{constructor(t,e){this._action=t,this._data=e}test(t){return this._action===t}start(){return this._action.start(this._data)}end(){return this._action.end(this._data)}}const N=new class{constructor(){this._startingActions=[],this._endingActions=[],this._handlingVisibilityChange=this._handleVisibilityChange.bind(this),this._handlingEnd=this._handleEnd.bind(this),this._isStarted=!1,this._isListening=!1,this.reset()}setCollector(t){this._collector=t}reset(t=!1){this._type=b.ACTION,t||(this._startingActions.length=0),this._endingActions.length=0,this._count=0,this._delay=-1,this._isRequested=!1,this._unlisten()}start(){this._isStarted||(this._isStarted=!0,f.add(this))}collect(){this._type=b.COLLECTOR,this._request()}regulate(e,s){if(!e)return!1;if(s.some((t=>t.test(e))))return t.inspector.log("action exists in queue",e),!1;switch(e.regulation){case y.PREVENT:return!1;case y.ENFORCE:return!0;default:return!0===this._collector.isActionEnabled}}appendStartingAction(t,e){if(!this.regulate(t,this._startingActions))return;const s=new E(t,e);this._startingActions.push(s),this._request()}appendEndingAction(t,e){if(!this.regulate(t,this._endingActions))return;const s=new E(t,e);this._endingActions.push(s),this._request()}_request(){this._listen(),this._isRequested=!0,this._delay=4}_listen(){this._isListening||(this._isListening=!0,document.addEventListener("visibilitychange",this._handlingVisibilityChange),document.addEventListener("unload",this._handlingEnd),document.addEventListener("beforeunload",this._handlingEnd),document.addEventListener("pagehide",this._handlingEnd))}_unlisten(){this._isListening&&(this._isListening=!1,document.removeEventListener("visibilitychange",this._handlingVisibilityChange),document.removeEventListener("unload",this._handlingEnd),document.removeEventListener("beforeunload",this._handlingEnd),document.removeEventListener("pagehide",this._handlingEnd))}_handleVisibilityChange(t){"hidden"===document.visibilityState&&this.send()}_handleEnd(){this.send()}render(){if(!(this._delay<=-1))switch(this._delay--,this._count++,!0){case this._count>20:case 0===this._delay:this.send()}}send(t=!1){if(!this._isRequested)return;const e=[];t||e.push(...this._startingActions.map((t=>t.start())).filter((t=>t.length>0))),e.push(...this._endingActions.map((t=>t.end())).filter((t=>t.length>0)));const s=e.length/80+1|0,i=[];for(let t=0;t<s;t++){const s=e.slice(80*t,80*(t+1));i.push(s.flat())}if(this._type===b.COLLECTOR&&this._collector.isCollecting){const t=this._collector.layer;if(i.length>0){const e=i.splice(0,1)[0];e.length>0&&t.push.apply(t,e)}t.flat(),t.length>0&&m(b.COLLECTOR,t)}if(i.length>0)for(let t=0;t<i.length;t++){const e=i[t];e.length>0&&m(b.ACTION,e)}this.reset(t)}};const T=new class{get debugger(){return window._oEa}get isActive(){return!!this.debugger&&"1"===this.debugger._dbg}set isActive(t){this.debugger&&this.isActive!==t&&this.debugger.debug(t?1:0)}},v={CONNECTED:{id:"connected",value:"connecté",isConnected:!0,isDefault:!0},ANONYMOUS:{id:"anonymous",value:"anonyme",isConnected:!1,isDefault:!0},GUEST:{id:"guest",value:"invité",isConnected:!1}},A={INDIVIDUAL:{id:"individual",value:"part"},PROFESSIONNAL:{id:"professionnal",value:"pro"}};var C={"0x0022":""","0x0024":"$","0x0026":"&","0x0027":"'","0x002a":"*","0x002c":",","0x003c":"<","0x003e":">","0x003f":"?","0x005c":"\","0x005e":"^","0x0060":"`","0x007c":"|","0x007e":"~"};const L=t=>t?t=(t=(t=[...t].map((t=>C[(t=>{const e=t.charCodeAt(0).toString(16);return"0x0000".slice(0,-e.length)+e})(t)]||t)).join("")).replace(/\s+/g," ").replace(/\s/g,"_")).toLowerCase():t,I=(e,s,i=!0)=>{switch(!0){case"number"==typeof e:return`${e}`;case"string"==typeof e:return e;case void 0===e&&i:case null===e&&i:return""}return t.inspector.warn(`unexpected value '${e}' set at analytics.${s}. Expecting a String`),null},S=(e,s,i=!0)=>{switch(!0){case!isNaN(e):return e;case"string"==typeof e&&!isNaN(Number(e)):return Number(e);case void 0===e&&i:case null===e&&i:return-1}return t.inspector.warn(`unexpected value '${e}' set at analytics.${s}. Expecting a Number`),null},O=(e,s)=>{switch(!0){case"boolean"==typeof e:return e;case"string"==typeof e&&"true"===e.toLowerCase():case"1"===e:case 1===e:return!0;case"string"==typeof e&&"false"===e.toLowerCase():case"0"===e:case 0===e:return!1;case void 0===e:case null===e:return e}return t.inspector.warn(`unexpected value '${e}' set at analytics.${s}. Expecting a Boolean`),null},w=(e,s,i=!0)=>{switch(!0){case"string"==typeof e&&/^[A-Za-z]{2}$|^[A-Za-z]{2}[-_]/.test(e):return e.split(/[-_]/)[0].toLowerCase();case void 0===e&&i:case null===e&&i:return""}return t.inspector.warn(`unexpected value '${e}' set at analytics.${s}. Expecting language as a String following ISO 639-1 format`),null},x=(e,s,i=!0)=>{switch(!0){case"string"==typeof e:return/^FR-[A-Z0-9]{2,3}$/.test(e)||t.inspector.warn(`value '${e}' set at analytics.${s} with wrong format. Geographic location should be a String following ISO 3166-2:FR format`),e;case void 0===e&&i:case null===e&&i:return""}return t.inspector.warn(`unexpected value '${e}' set at analytics.${s}. Expecting geographic location as a String following ISO 3166-2:FR format`),null},k=t=>t.toISOString().split("T")[0];class D{constructor(t){this._config=t||{}}reset(t=!1){this._isConnected=!1,this.status=v.ANONYMOUS,!t&&this._config.connect?this.connect(this._config.connect.uid,this._config.connect.email,this._config.connect.isNew):(this._uid=void 0,this._email=void 0,this._isNew=!1),this.profile=t?void 0:this._config.profile,this.language=t?void 0:this._config.language,this.type=t?void 0:this._config.type}connect(e,s,i=!1){this._uid=I(e,"user.uid"),/^[a-zA-Z0-9!#$%&'*+/=?^_`{|}~.-]{2,}@[a-zA-Z0-9-]{2,}\.[a-zA-Z]{2,}$/.test(s)&&t.inspector.warn("Please check analytics.user.email is properly encrypted "),this._email=I(s,"user.email"),this._isNew=O(i),this._isConnected=!0,this.status=v.CONNECTED}get uid(){return this._uid}get email(){return this._email}get isNew(){return this._isNew}set status(t){const e=Object.values(v).filter((t=>t.isConnected===this._isConnected));this._status=e.filter((e=>e.id===t||e.value===t))[0]||e.filter((t=>t.isDefault))[0]}get status(){return this._status.id}set profile(t){const e=I(t,"user.profile");null!==e&&(this._profile=e)}get profile(){return this._profile.id}set language(t){const e=w(t,"user.language");null!==e&&(this._language=e)}get language(){return this._language||navigator.language}set type(t){this._type=Object.values(A).filter((e=>e.id===t||e.value===t))[0]}get type(){return this._type.id}get layer(){const t=[];return this.uid&&t.push("uid",L(this.uid)),this.email&&t.push("email",L(this.email)),this.isNew&&t.push("newcustomer","1"),this.language&&t.push("user_language",this.language),t.push("user_login_status",this._status.value),this._profile&&t.push("profile",this._profile),this._type&&t.push("user_type",this._type.value),t}}D.Status=v,D.Type=A;const R={DEVELOPMENT:{id:"development",value:"dev"},STAGE:{id:"stage",value:"stage"},PRODUCTION:{id:"production",value:"prod"}};class ${constructor(t){this._config=t||{}}reset(e=!1){this.environment=e?R.DEVELOPMENT.id:this._config.environment,this.entity=e?void 0:this._config.entity,this.language=e?void 0:this._config.language,this.target=e?void 0:this._config.target,this.type=e?void 0:this._config.type,this.region=e?void 0:this._config.region,this.department=e?void 0:this._config.department,this.version=e?void 0:this._config.version,this._api=t.version}set environment(t){switch(t){case R.PRODUCTION.id:case R.PRODUCTION.value:this._environment=R.PRODUCTION;break;case R.STAGE.id:case R.STAGE.value:this._environment=R.STAGE;break;case R.DEVELOPMENT.id:case R.DEVELOPMENT.value:default:this._environment=R.DEVELOPMENT}}get environment(){return this._environment?this._environment.id:R.DEVELOPMENT.id}set entity(t){const e=I(t,"site.entity");null!==e&&(this._entity=e)}get entity(){return this._entity}set language(t){const e=w(t,"site.language");null!==e&&(this._language=e)}get language(){return this._language||document.documentElement.lang}set target(t){const e=I(t,"site.target");null!==e&&(this._target=e)}get target(){return this._target}set type(t){const e=I(t,"site.type");null!==e&&(this._type=e)}get type(){return this._type}set region(t){const e=x(t,"site.region");null!==e&&(this._region=e)}get region(){return this._region}set department(t){const e=x(t,"site.department");null!==e&&(this._department=e)}get department(){return this._department}set version(t){const e=I(t,"site.version");null!==e&&(this._version=e)}get version(){return this._version}get api(){return this._api}get layer(){const e=[];return e.push("site_environment",this._environment.value),this.entity?e.push("site_entity",L(this.entity)):t.inspector.warn("entity is required in analytics.site"),this.language&&e.push("site_language",this.language),this.target&&e.push("site_target",L(this.target)),this.type&&e.push("site_type",L(this.type)),this.region&&e.push("site_region",this.region),this.department&&e.push("site_department",this.department),this.version&&e.push("site_version",this.version),this.api&&e.push("api_version",this.api),e}}$.Environment=R;const P={accordion:t.internals.ns.selector("accordion"),alert:t.internals.ns.selector("alert"),badge:t.internals.ns.selector("badge"),breadcrumb:t.internals.ns.selector("breadcrumb"),button:t.internals.ns.selector("btn"),callout:t.internals.ns.selector("callout"),card:t.internals.ns.selector("card"),checkbox:t.internals.ns.selector("checkbox-group"),connect:t.internals.ns.selector("connect"),consent:t.internals.ns.selector("consent-banner"),content:t.internals.ns.selector("content-media"),download:t.internals.ns.selector("download"),follow:t.internals.ns.selector("follow"),footer:t.internals.ns.selector("footer"),header:t.internals.ns.selector("header"),highlight:t.internals.ns.selector("highlight"),input:t.internals.ns.selector("input-group"),link:t.internals.ns.selector("link"),modal:t.internals.ns.selector("modal"),navigation:t.internals.ns.selector("nav"),notice:t.internals.ns.selector("notice"),pagination:t.internals.ns.selector("pagination"),quote:t.internals.ns.selector("quote"),radio:t.internals.ns.selector("radio-group"),search:t.internals.ns.selector("search-bar"),select:t.internals.ns.selector("select"),share:t.internals.ns.selector("share"),sidemenu:t.internals.ns.selector("sidemenu"),stepper:t.internals.ns.selector("stepper"),summary:t.internals.ns.selector("summary"),tab:t.internals.ns.selector("tabs"),table:t.internals.ns.selector("table"),tag:t.internals.ns.selector("tag"),tile:t.internals.ns.selector("tile"),toggle:t.internals.ns.selector("toggle"),tooltip:t.internals.ns.selector("tooltip"),transcription:t.internals.ns.selector("transcription"),translate:t.internals.ns.selector("translate"),upload:t.internals.ns.selector("upload-group")},M="collectable",B="collecting",F="collected";class U{constructor(t){this._config=t||{},this._state=M}reset(t=!1){this.path=t?"":this._config.path,this.referrer=t?"":this._config.referrer,this.title=t?"":this._config.title,this.name=t?"":this._config.name,this.id=t?"":this._config.id,this.author=t?"":this._config.author,this.date=t?"":this._config.date,this._labels=t||!this._config.labels?["","","","",""]:this._config.labels,this._labels.length=5,this._tags=t||!this._config.tags?[]:this._config.tags,this._categories=t||!this._config.categories?["","",""]:this._config.categories,this.isError=!t&&this._config.isError,this.template=t?"":this._config.template,this.group=t?"":this._config.group,this.segment=t?"":this._config.segment,this.subtemplate=t?"":this._config.subtemplate,this.theme=t?"":this._config.theme,this.subtheme=t?"":this._config.subtheme,this.related=t?"":this._config.related,this.depth=t||isNaN(this._config.depth)?0:this._config.depth,this.current=t||isNaN(this._config.current)?-1:this._config.current,this.total=t||isNaN(this._config.total)?-1:this._config.total,this._filters=t||!this._config.filters?[]:this._config.filters}collecting(){return this._state!==M?(t.inspector.warn(`current path '${this.path}' was already collected`),!1):(this._state=B,!0)}get isCollecting(){return this._state===B}set path(t){const e=I(t,"page.path");null!==e&&(this._path=e,this._state=M)}get path(){return this._path||`${document.location.pathname}${document.location.search}`}set referrer(t){const e=I(t,"page.referrer");null!==e&&(this._referrer=e)}get referrer(){return this._referrer}set title(t){const e=I(t,"page.title");null!==e&&(this._title=e)}get title(){return this._title||document.title}set id(t){const e=I(t,"page.id");null!==e&&(this._id=e)}get id(){return this._id}set author(t){const e=I(t,"page.author");null!==e&&(this._author=e)}get author(){return this._author}set date(e){const s=((e,s,i=!0)=>{switch(!0){case e instanceof Date:return k(e);case"string"==typeof e:{const t=new Date(e);if("Invalid Date"!==t.toString())return k(t);break}case void 0===e&&i:case null===e&&i:return null}return t.inspector.warn(`unexpected value '${e}' set at analytics.${s}. Expecting a Date`),null})(e,"page.date");null!==s&&(this._date=s)}get date(){return this._date}get tags(){return this._tags}set name(t){const e=I(t,"page.name");null!==e&&(this._name=e)}get name(){return this._name||this.title}get labels(){return this._labels}get categories(){return this._categories}set isError(t){const e=O(t,"page.isError");null!==e&&(this._isError=e)}get isError(){return this._isError}set template(t){const e=I(t,"page.template");null!==e&&(this._template=e)}get template(){return this._template||"autres"}set segment(t){const e=I(t,"page.segment");null!==e&&(this._segment=e)}get segment(){return this._segment||this.template}set group(t){const e=I(t,"page.group");null!==e&&(this._group=e)}get group(){return this._group||this.template}set subtemplate(t){const e=I(t,"page.subtemplate");null!==e&&(this._subtemplate=e)}get subtemplate(){return this._subtemplate}set theme(t){const e=I(t,"page.theme");null!==e&&(this._theme=e)}get theme(){return this._theme}set subtheme(t){const e=I(t,"page.subtheme");null!==e&&(this._subtheme=e)}get subtheme(){return this._subtheme}set related(t){const e=I(t,"page.related");null!==e&&(this._related=e)}get related(){return this._related}set depth(t){const e=S(t,"page.depth");null!==e&&(this._depth=e)}get depth(){return this._depth}set current(t){const e=S(t,"page.current");null!==e&&(this._current=e)}get current(){return this._current}set total(t){const e=S(t,"page.total");null!==e&&(this._total=e)}get total(){return this._total}get filters(){return this._filters}get layer(){this._state=F;const t=[];this.path&&t.push("path",L(this.path)),this.referrer&&t.push("referrer",L(this.referrer)),this.title&&t.push("page_title",L(this.title)),this.name&&t.push("page_name",L(this.name)),this.id&&t.push("page_id",L(this.id)),this.author&&t.push("page_author",L(this.author)),this.date&&t.push("page_date",L(this.date));const e=Object.keys(P).map((t=>null!==document.querySelector(P[t])?t:null)).filter((t=>null!==t)).join(",");e&&t.push("page_components",e);const s=this._labels.slice(0,5);s.length=5,s.some((t=>t))&&t.push("pagelabel",s.map((t=>"string"==typeof t?L(t):"")).join(","));const i=this._tags;if(i.some((t=>t))&&t.push("pagetag",i.map((t=>"string"==typeof t?L(t):"")).join(",")),this._categories.forEach(((e,s)=>{e&&t.push(`page_category${s+1}`,e)})),this._isError&&t.push("error","1"),t.push("page_template",L(this.template)),t.push("pagegroup",L(this.group)),t.push("site-segment",L(this.segment)),this.subtemplate&&t.push("page_subtemplate",L(this.subtemplate)),this.theme&&t.push("page_theme",L(this.theme)),this.subtheme&&t.push("page_subtheme",L(this.subtheme)),this.related&&t.push("page_related",L(this.related)),isNaN(this.depth)||t.push("page_depth",this.depth),!isNaN(this.current)&&this.current>-1){let e=`${this.current}`;!isNaN(this.total)&&this.total>-1&&(e+=`/${this.total}`),t.push("page_pagination",e)}if(this.filters.length&&this.filters.some((t=>t))){const e=this.filters.map((t=>"string"==typeof t?L(t):""));t.push("page_filters",e.join(","))}return t}}const q={STANDARD:{id:"standard",value:"standard",isDefault:!0},AUTOCOMPLETE:{id:"autocomplete",value:"autocompletion"}};class j{constructor(t){this._config=t||{}}reset(t=!1){this.engine=t?void 0:this._config.engine,this.results=t||isNaN(this._config.results)?-1:this._config.results,this.terms=t?void 0:this._config.terms,this.category=t?void 0:this._config.category,this.theme=t?void 0:this._config.theme,this.type=t?void 0:this._config.type,this.method=t?void 0:this._config.method}set engine(t){const e=I(t,"search.engine");null!==e&&(this._engine=e)}get engine(){return this._engine}set results(t){const e=S(t,"search.results");null!==e&&(this._results=e)}get results(){return this._results}set terms(t){const e=I(t,"search.terms");null!==e&&(this._terms=e)}get terms(){return this._terms}set category(t){const e=I(t,"search.category");null!==e&&(this._category=e)}get category(){return this._category}set theme(t){const e=I(t,"search.theme");null!==e&&(this._theme=e)}get theme(){return this._theme}set type(t){const e=I(t,"search.type");null!==e&&(this._type=e),this._type=t}get type(){return this._type}set method(t){const e=Object.values(q);this._method=e.filter((e=>e.id===t||e.value===t))[0]||e.filter((t=>t.isDefault))[0]}get method(){return this._method}get layer(){const t=[];return this.engine&&t.push("isearchengine",L(this.engine)),this.results>-1&&t.push("isearchresults",this.results),this.terms&&t.push("isearchkey","search_terms","isearchdata",L(this.terms)),this.category&&t.push("isearchkey","search_category","isearchdata",L(this.category)),this.theme&&t.push("isearchkey","search_theme","isearchdata",L(this.theme)),this.type&&t.push("isearchkey","search_type","isearchdata",L(this.type)),this._method&&t.length&&t.push("isearchkey","search_method","isearchdata",this._method.value),t}}j.Method=q;class H{constructor(t){this._config=t||{}}reset(t=!1){this.id=t?void 0:this._config.id,this.type=t?void 0:this._config.type,this.name=t?void 0:this._config.name,this.step=t?void 0:this._config.step,this.current=t||isNaN(this._config.current)?-1:this._config.current,this.total=t||isNaN(this._config.total)?-1:this._config.total,this.objective=t?void 0:this._config.objective,this.error=t?void 0:this._config.error}set id(t){const e=I(t,"funnel.id");null!==e&&(this._id=e)}get id(){return this._id}set type(t){const e=I(t,"funnel.type");null!==e&&(this._type=e)}get type(){return this._type}set name(t){const e=I(t,"funnel.name");null!==e&&(this._name=e)}get name(){return this._name}set step(t){const e=I(t,"funnel.step");null!==e&&(this._step=e)}get step(){return this._step}set current(t){const e=S(t,"funnel.current");null!==e&&(this._current=e)}get current(){return this._current}set total(t){const e=S(t,"funnel.total");null!==e&&(this._total=e)}get total(){return this._total}set objective(t){const e=I(t,"funnel.objective");null!==e&&(this._objective=e),this._objective=t}get objective(){return this._objective}set error(t){const e=I(t,"funnel.error");null!==e&&(this._error=e),this._error=t}get error(){return this._error}get layer(){const t=[];return this.id&&t.push("funnel_id",L(this.id)),this.type&&t.push("funnel_type",L(this.type)),this.name&&t.push("funnel_name",L(this.name)),this.step&&t.push("funnel_step_name",L(this.step)),!isNaN(this.current)&&this.current>-1&&t.push("funnel_step_number",this.current),!isNaN(this.total)&&this.total>-1&&t.push("funnel_step_max",this.total),this.objective&&t.push("funnel_objective",L(this.objective)),this.error&&t.push("funnel_error",L(this.error)),t}}const K={IN:"in",OUT:"out",NONE:"none"},V={id:"unstarted",value:-1},G={id:"started",value:1},W={id:"singular",value:2},Y={id:"ended",value:3},z=t=>Object.entries(t).map((([t,e])=>["actionpname",L(t),"actionpvalue",L(e)])).flat();class Z{constructor(t){this._isMuted=!1,this._regulation=y.NONE,this._name=t,this._status=V,this._labels=[],this._parameters={},this._sentData=[]}get isMuted(){return this._isMuted}set isMuted(t){this._isMuted=t}get regulation(){return this._regulation}set regulation(t){Object.values(y).includes(t)&&(this._regulation=t)}get isSingular(){return this._status===W}get status(){return this._status}get name(){return this._name}get labels(){return this._labels}get reference(){return this._reference}get parameters(){return this._parameters}get mode(){return this._mode}singularize(){this._status=W}rewind(){this._sentData=[],this._status=V}addParameter(t,e){this._parameters[t]=e}removeParameter(t){delete this._parameters[t]}set reference(t){const e=I(t,`action ${this._name}`);null!==e&&(this._reference=e)}get _base(){return["actionname",this._name]}_getLayer(t={}){if(this._isMuted)return[];this._mode!==K.IN&&this._sentData.push(JSON.stringify(t));const e=this._base;switch(this._mode){case K.IN:case K.OUT:e.push("actionmode",this._mode)}const s=this._labels.slice(0,5);return s.length=5,s.some((t=>t))&&e.push("actionlabel",s.map((t=>"string"==typeof t?L(t):"")).join(",")),this._reference&&e.push("actionref",this._reference),e.push.apply(e,z(Object.assign(this._parameters,t||{}))),e}start(e){switch(this._status){case V:this._mode=K.IN,this._status=G;break;case W:this._mode=K.NONE,this._status=Y;break;default:return t.inspector.error(`unexpected start on action ${this._name} with status ${this._status.id}`),[]}return this._getLayer(e)}end(t){switch(this._status){case G:this._mode=K.OUT,this._status=Y;break;case V:case W:this._mode=K.NONE,this._status=Y;break;case Y:if(this._sentData.includes(JSON.stringify(t)))return[];this._mode=K.NONE,this._status=Y;break;default:return[]}return this._getLayer(t)}resume(e){if(this._isMuted)return[];if(this._status.value>=Y.value)return t.inspector.error(`unexpected resuming on action ${this._name} with status ${this._status.id}`),[];const s=this._base;return e&&s.push.apply(s,z(e)),s}}class X{constructor(){this._actions=[]}rewind(){this._actions.forEach((t=>t.rewind()))}getAction(t){let e=this._actions.filter((e=>e.name===t))[0];return e||(e=new Z(t),this._actions.push(e)),e}hasAction(t){return this._actions.some((e=>e.name===t))}remove(t){const e=this._actions.indexOf(t);return-1!==e&&(this._actions.splice(e,1),!0)}}X.ActionMode=K;const Q=new X;X.instance=Q;class J{constructor(t,e=!1){this._onRouteChange=t,this._isListeningHash=e,this._update(),f.add(this)}_update(){this._pathname=document.location.pathname,this._search=document.location.search,this._hash=document.location.hash,this._path=`${this._pathname}${this._search}`,this._isListeningHash&&(this._path+=this._hash),this._hasTitle=this._title===document.title,this._title=document.title}render(){this._pathname===document.location.pathname&&this._search===document.location.search||this.change(),this._isListeningHash&&this._hash!==document.location.hash&&this.change()}change(){this._referrer=this._path,this._update(),this._onRouteChange()}get path(){return this._path}get hasTitle(){return this._hasTitle}get title(){return this._title}get referrer(){return this._referrer}}const tt={COLLECT:t.internals.ns.event("collect")},et={REWIND:t.internals.ns.emission("analytics","rewind")},st={ENABLE:{entries:["enable","enabled","true","yes","1",!0],value:!0,output:!0},DISABLE:{entries:["disable","disabled","false","no","0",!1],value:!1,output:!1},REDUCE:{entries:["reduce"],value:"reduce",output:!1}};class it{constructor(e){switch(e.collection){case s.MANUAL:case s.LOAD:case s.FULL:case s.HASH:this._collection=e.collection;break;default:if(e.mode&&"manual"===e.mode)this._collection=e.collection;switch(!0){case"manual"===e.mode:this._collection=s.MANUAL;break;case t.mode===t.Modes.ANGULAR:case t.mode===t.Modes.REACT:case t.mode===t.Modes.VUE:this._collection=s.FULL;break;default:this._collection=s.LOAD}}this.isActionEnabled=e.isActionEnabled,this._user=new D(e.user),this._site=new $(e.site),this._page=new U(e.page),this._search=new j(e.search),this._funnel=new H(e.funnel),this._delay=-1,N.setCollector(this)}get page(){return this._page}get user(){return this._user}get site(){return this._site}get search(){return this._search}get funnel(){return this._funnel}start(){const t=this._handleRouteChange.bind(this);switch(this._collection){case s.LOAD:this.collect();break;case s.FULL:this.collect(),this._location=new J(t);break;case s.HASH:this.collect(),this._location=new J(t,!0)}}_handleRouteChange(){N.send(!0),this._delay=6,f.add(this)}render(){this._delay--,this._delay<0&&(f.remove(this),this._routeChanged())}_routeChanged(){Q.rewind(),this._page.referrer=this._location.referrer,this._location.hasTitle&&(this._page.title=this._location.title),this._page.path=this._location.path;const e=new CustomEvent(tt.COLLECT);document.documentElement.dispatchEvent(e),this.collect(),t.internals&&t.internals.stage&&t.internals.stage.root&&t.internals.stage.root.descend(et.REWIND)}reset(t=!1){this._user.reset(t),this._site.reset(t),this._page.reset(t),this._search.reset(t),this._funnel.reset(t)}collect(){this.page.collecting()&&N.collect()}get collection(){return this._collection}get isCollecting(){return this._page.isCollecting}get isActionEnabled(){return this._isActionEnabled.value}set isActionEnabled(t){this._isActionEnabled=Object.values(st).find((e=>e.entries.includes(t)))||st.DISABLE}get isActionReduced(){return this._isActionEnabled===st.REDUCE}get layer(){return[...this._user.layer,...this._site.layer,...this._page.layer,...this._search.layer,...this._funnel.layer]}}const nt=new class{constructor(){this._isReady=!1,this._readiness=new Promise(((t,e)=>{this._isReady?t():(this._resolve=t,this._reject=e)})),this._configure()}_configure(){switch(!0){case void 0!==window[e]:this._config=window[e].configuration.analytics,window[e].promise.then(this._build.bind(this),(()=>{}));break;case void 0!==t.internals&&void 0!==t.internals.configuration&&void 0!==t.internals.configuration.analytics&&void 0!==t.internals.configuration.analytics.domain:this._config=t.internals.configuration.analytics,this._build();break;case void 0!==t.analytics&&void 0!==t.analytics.domain:this._config=t.analytics,this._build();break;default:t.inspector.warn("analytics configuration is incorrect or missing (required : domain)")}}_build(){this._init=new l(this._config.domain),this._init.configure().then(this._start.bind(this),(t=>this._reject(t)))}get isReady(){return this._isReady}get readiness(){return this._readiness}_start(){this._isReady||(this._cmp=new p(this._config.cmp),this._collector=new it(this._config),this._collector.reset(),this._isReady=!0,this._resolve(),N.start(),this._collector.start())}get page(){return this._collector.page}get user(){return this._collector.user}get site(){return this._collector._site}get search(){return this._collector.search}get funnel(){return this._collector.funnel}get cmp(){return this._cmp}get opt(){return a}get collection(){return this._collector.collection}get isActionEnabled(){return this._collector.isActionEnabled}set isActionEnabled(t){this._collector.isActionEnabled=t}get isDebugging(){return T.isActive}set isDebugging(t){T.isActive=t}push(t,e){m(t,e)}reset(t=!1){this._collector.reset()}collect(){this._collector.collect()}};nt.Collection=s,nt.PushType=b;t.analytics=((t,...e)=>(e.forEach((e=>{const s=Object.keys(e).reduce(((t,s)=>(t[s]=Object.getOwnPropertyDescriptor(e,s),t)),{});Object.getOwnPropertySymbols(e).forEach((t=>{const i=Object.getOwnPropertyDescriptor(e,t);i.enumerable&&(s[t]=i)})),Object.defineProperties(t,s)})),t))(nt,{});const rt={IMPRESSION:{id:"impression",isSingular:!0,isBeginning:!0,attributed:!1,type:"impression"},CLICK:{id:"click",isBeginning:!0,attributed:!0,type:"interaction",event:"click",method:"eventListener"},INTERNAL:{id:"internal",isBeginning:!0,attributed:!0,type:"interaction",event:"click",method:"eventListener"},EXTERNAL:{id:"external",isBeginning:!0,attributed:!0,type:"interaction",event:"click",method:"eventListener"},DOWNLOAD:{id:"download",isBeginning:!0,attributed:!0,type:"interaction",event:"click",method:"eventListener"},BUTTON:{id:"button",isBeginning:!0,attributed:!0,type:"interaction",event:"click",method:"eventListener"},DOUBLE_CLICK:{id:"dblclick",isBeginning:!0,attributed:!0,type:"interaction",event:"dblclick",method:"eventListener"},OPEN:{id:"open",isSingular:!0,attributed:!1,type:"event",method:"eventListener"},COMPLETE:{id:"complete",isSingular:!0,attributed:!1,type:"event",method:"eventListener"},FOCUS:{id:"focus",isSingular:!0,attributed:!1,type:"event",method:"eventListener"},ERROR:{id:"error",isSingular:!0,attributed:!1,type:"event"},ADD:{id:"add",isSingular:!0,attributed:!1,type:"event"},REMOVE:{id:"remove",isSingular:!0,attributed:!1,type:"event"},DISPLAY:{id:"display",isSingular:!0,attributed:!1,type:"event"},CHANGE:{id:"change",isSingular:!0,attributed:!0,type:"event",event:"change",method:"change"},PROGRESS:{id:"progress",isBeginning:!0,attributed:!0,type:"event"},SHARE:{id:"share",isBeginning:!0,attributed:!1,type:"interaction"},PRESS:{id:"press",isBeginning:!0,attributed:!1,type:"interaction"},RELEASE:{id:"release",isBeginning:!0,attributed:!1,type:"interaction"},DISMISS:{id:"dismiss",isBeginning:!0,attributed:!1,type:"interaction"},UPLOAD:{id:"upload",isBeginning:!0,attributed:!1,type:"interaction"},CHECK:{id:"check",isBeginning:!0,attributed:!1,type:"interaction"},UNCHECK:{id:"uncheck",isBeginning:!0,attributed:!1,type:"interaction"},SELECT:{id:"select",isBeginning:!0,attributed:!1,type:"interaction"},SUBSCRIBE:{id:"subscribe",isBeginning:!0,attributed:!1,type:"interaction"},DISCLOSE:{id:"disclose",isBeginning:!0,attributed:!1,type:"event"},SEARCH:{id:"search",isBeginning:!0,attributed:!1,type:"event"},SHOW:{id:"show",isSingular:!0,attributed:!1,type:"event"},HIDE:{id:"hide",isSingular:!0,attributed:!1,type:"event"},AUTOPLAY:{id:"autoplay",isBeginning:!0,attributed:!1,type:"event"},PLAY:{id:"play",isBeginning:!0,attributed:!1,type:"interaction"},PAUSE:{id:"pause",isBeginning:!0,attributed:!1,type:"interaction"},END:{id:"end",isBeginning:!0,attributed:!1,type:"event"}},at="undefined",ot="heading",lt="component",ct="content",ht=Node.DOCUMENT_POSITION_PRECEDING|Node.DOCUMENT_POSITION_CONTAINED_BY;class ut{constructor(t){this._label=t.textContent.trim(),this._level=Number(t.tagName.charAt(1))}get level(){return this._level}get label(){return this._label}}class gt{constructor(t,e,s){this._type=at,this._node=t,this._target=e,this._level=s,this._label="",this._component="",this._isValid=!0,this.analyse()}_parseHeadings(){const t=Array.from({length:this._level},((t,e)=>`h${e+1}`)).join(",");this._headings=Array.from(this._node.querySelectorAll(t)).filter((t=>t===this._node||t.parentNode===this._node||null!=t.parentNode&&t.parentNode.parentNode===this._node)).filter((t=>(this._target.compareDocumentPosition(t)&ht)>0)).map((t=>new ut(t))).reverse()}_getComponent(){if("function"!=typeof t)return!1;const e=t(this._node);if(!e)return!1;const s=Object.values(e).filter((t=>t.isActionee)).sort(((t,e)=>e.priority-t.priority))[0];if(!s)return!1;this._type=lt,this._isValid=s.validate(this._target);const i=Array.from({length:6},((t,e)=>`h${e+1}`)).join(","),n=Array.from(this._node.querySelectorAll(i)).map((t=>new ut(t))).sort(((t,e)=>t.level-e.level))[0];n&&n.level<=this._level&&(this._level=n.level-1);const r=this._node.closest(i);if(r){const t=new ut(r);t.level<=this._level&&(this._level=t.level-1)}return!isNaN(s.level)&&s.level<this._level&&(this._level=s.level),this._label=s.label,this._component=s.component,!0}_getHeading(){if(!this._headings.length)return!1;const t=[];return this._headings.forEach((e=>{e.level<=this._level&&(e.level>1&&t.unshift(e.label),this._level=e.level-1)})),!!t.length&&(this._type=ot,this._label=t.join(" › "),!0)}analyse(){if(this._parseHeadings(),this._getComponent())return;if(this._getHeading())return;if(this._node!==this._target)return;const t=this._node.textContent.trim();t&&(this._type=ct,this._label=t)}get type(){return this._type}get level(){return this._level}get label(){return this._label}get component(){return this._component}get node(){return this._node}get target(){return this._target}get isValid(){return this._isValid}}class dt{constructor(t){this._node=t,this._process()}_process(){const t=new gt(this._node,this._node,6);this._level=t.level,this._members=[t];let e=this._node.parentNode;for(;document.documentElement.contains(e)&&e!==document.documentElement&&this._level>0;){const t=new gt(e,this._node,this._level);switch(!0){case t.type===at:case!t.isValid:case t.label===this._members[0].label&&t.type===ot&&this._members[0].type===lt:break;case t.label===this._members[0].label&&t.type===lt&&this._members[0].type===ot:this._members.splice(0,1,t);break;default:this._members.unshift(t),t.level<this._level&&(this._level=t.level)}e=e.parentNode}this._label=L(this._members[this._members.length-1].label),this._title=L(this._members.filter((t=>t.label)).map((t=>t.label)).join(" › "));const s=this._members.filter((t=>t.component)).map((t=>t.component));this._component=L(s.join(" › ")),this._localComponent=s[s.length-1],this._globalComponent=s[0]}get localComponent(){return this._localComponent}get globalComponent(){return this._globalComponent}get label(){return this._label}get title(){return this._title}get component(){return this._component}}class _t{constructor(t,e,s,i="",n=null,r={},a=!1,o=y.NONE){this._node=t,this._type=e,this._id=s||this._node.id,this._isMuted=!1,this._title=n,this._category=i,this._parameters=r,this._isRating=a,this._regulation=o,this._hasBegun=!1,requestAnimationFrame(this._init.bind(this))}_init(){this._hierarchy=new dt(this._node);let e="",s="";this._id?e=`_[${this._id}]`:t.inspector.warn(`Analytics API requires an id to be set on tracked element. Missing on ${this._node.outerHTML}`),this._type&&(s=`(${this._type.id})_`),this._name=`${s}${this._title||this._hierarchy.title}${e}`,this._action=Q.getAction(this._name,this._type.status),this._type.isSingular&&this._action.singularize(),Object.keys(this._parameters).forEach((t=>this._action.addParameter(t,this._parameters[t]))),this._action.isMuted=this._isMuted,this._action.regulation=this._regulation,this._action.labels[0]=this._type.id,this._action.labels[1]=this._hierarchy.globalComponent,this._action.labels[2]=this._hierarchy.localComponent,this._action.labels[4]=this._category,this._hierarchy.label&&this._action.addParameter("component_label",this._hierarchy.label),this._hierarchy.title&&this._action.addParameter("heading_hierarchy",this._hierarchy.title),this._hierarchy.component&&this._action.addParameter("component_hierarchy",this._hierarchy.component),this.begin()}get isMuted(){return this._action?this._action.isMuted:this._isMuted}set isMuted(t){this._isMuted=t,this._action&&(this._action.isMuted=t)}get regulation(){return this._regulation}set regulation(t){this._regulation=t,this._action&&(this._action.regulation=t)}get action(){return this._action}rewind(){this._hasBegun=!1,this.begin()}begin(t={}){this._hasBegun||(this._hasBegun=!0,this._type.isBeginning&&(this._type.isSingular||this._isRating)&&N.appendStartingAction(this._action,t))}act(t={}){this._isMuted||(this._action?N.appendEndingAction(this._action,t):requestAnimationFrame((()=>this.act(t))))}dispose(){Q.remove(this._action)}}const pt={RATING:t.internals.ns.attr("analytics-rating"),ACTION:t.internals.ns.attr("analytics-action")};class mt extends t.core.Instance{constructor(t=-1,e="",s=null,i=y.NONE){super(),this._type=null,this._priority=t,this._category=e,this._title=s,this._parameters={},this._data={},this._isMuted=!1,this._regulation=i}static get instanceClassName(){return"Actionee"}get proxy(){const e=this,s={validate:(t,s)=>e.validate(t,s)},i={get isActionee(){return!0},get label(){return e.label},get priority(){return e.priority},get level(){return e.level},get node(){return e.node},get act(){return e.act.bind(e)}};return t.internals.property.completeAssign(super.proxy,s,i)}get data(){return this._data}_config(t,e){if(super._config(t,e),null===this._type)return this._sort(t),void(this._isMuted=!0);const s=this.getRegulation();this._regulation=s!==y.NONE?s:this._regulation;const i=this.getAttribute(pt.ACTION),n="string"==typeof i&&"false"!==i.toLowerCase()&&"true"!==i.toLowerCase()?L(i):this._title;this._isRating=this.hasAttribute(pt.RATING),this._actionElement=new _t(this.node,this._type,this.id,this._category,n,this._parameters,this._isRating,this._regulation),this._isMuted&&(this._actionElement.isMuted=!0),this.addDescent(et.REWIND,this.rewind.bind(this)),this._sort(t)}getRegulation(){const t=this.getAttribute(pt.ACTION);switch(!0){case"string"==typeof t&&"false"===t.toLowerCase():return y.PREVENT;case null!==t:return y.ENFORCE;default:return y.NONE}}mutate(t){if(t.includes(pt.ACTION)){const t=this.getRegulation();this._regulation!==t&&(this._regulation=t,this._actionElement&&(this._actionElement.regulation=t))}super.mutate(t)}_sort(t){const e=t.instances.filter((t=>t.isActionee)).sort(((t,e)=>e.priority-t.priority));e.length<=1||e.forEach(((t,e)=>{t.isMuted=e>0}))}get isMuted(){return this._actionElement?this._actionElement.isMuted:this._isMuted}set isMuted(t){this._isMuted=t,this._actionElement&&(this._actionElement.isMuted=t)}get priority(){return this._priority}setPriority(t){this._priority=t}get isInteractive(){return"A"===this.node.tagName||"BUTTON"===this.node.tagName}detectInteractionType(t){t||(t=this.node);const e=t.tagName,s=t.getAttribute("href"),i=t.hasAttribute("download"),n=t.hostname;switch(!0){case"A"!==e:this._type=rt.CLICK;break;case i:this._type=rt.DOWNLOAD,this.value=s;break;case n===location.hostname:this._type=rt.INTERNAL,this.value=s;break;case n.length>0:this._type=rt.EXTERNAL,this.value=s;break;default:this._type=rt.CLICK}}setClickType(){this._type=rt.CLICK}listenActionClick(t){t?(this._clickTarget=t,this._clickTarget.addEventListener("click",this._handlingClick,{capture:!0})):this.listenClick({capture:!0})}handleClick(){this.act()}setImpressionType(){this._type=rt.IMPRESSION}rewind(){this._actionElement&&this._actionElement.rewind()}act(t={}){void 0!==this._actionElement&&(this._data.component_value=this.value,this._actionElement.act(Object.assign(this._data,t)))}getFirstText(t){if(t||(t=this.node),t.childNodes&&t.childNodes.length>0){for(let e=0;e<t.childNodes.length;e++)if(t.childNodes[e].nodeType===Node.TEXT_NODE){const s=t.childNodes[e].textContent.trim();if(s)return this.cropText(s)}for(let e=0;e<t.childNodes.length;e++){const s=this.getFirstText(t.childNodes[e]);if(s)return this.cropText(s)}}return""}cropText(t,e=50){return t.length>50?`${t.substring(0,50).trim()}[...]`:t}getInteractionLabel(){const t=this.getAttribute("title");if(t)return this.cropText(t);const e=this.getFirstText();if(e)return e;const s=this.node.querySelector("img");if(s){const t=s.getAttribute("alt");if(t)return this.cropText(t)}return null}getHeadingLabel(t=6){const e=Array.from({length:t},((t,e)=>`h${e+1}`)).join(","),s=Array.from(this.querySelectorAll(e)).filter((t=>(this.node.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_CONTAINED_BY)>0));if(s.length)for(const t of s){const e=this.getFirstText(t);if(e)return e}}detectLevel(t){t||(t=this.node);const e=Array.from({length:6},((t,e)=>`h${e+1}`)).join(","),s=Array.from(t.querySelectorAll(e)).map((t=>Number(t.tagName.charAt(1))));s.length&&(this._level=Math.min.apply(null,s)-1)}validate(t){return!0}get actionElement(){return this._actionElement}get label(){return null}get value(){return this._value||this.label}set value(t){this._value=t}get isActionee(){return!0}get level(){return this._level}get type(){return this._type}dispose(){this._clickTarget&&this._clickTarget.removeEventListener("click",this._handlingClick),super.dispose()}}class bt extends mt{constructor(){super(100,"",null,y.ENFORCE)}static get instanceClassName(){return"AttributeActionee"}init(){this._attribute=this.registration.selector.replace(/[[\]]/g,"");const t=this._attribute.split("-").pop();switch(this._type=Object.values(rt).filter((e=>e.id===t))[0],this._title=this.getAttribute(this._attribute),this._type===rt.CLICK&&this.detectInteractionType(),this._type.method){case"eventListener":this.listen(this._type.event,this.handleEvent.bind(this));break;case"change":this.listen(this._type.event,this.handleChange.bind(this))}}handleEvent(t){this._actionElement.act()}handleChange(t){this._actionElement.act({change_value:t.target.value})}dispose(){this._actionElement.dispose(),super.dispose()}}const ft={CLICK:t.internals.ns.emission("button","click")};class yt extends mt{constructor(t=-1){super(t,"dsfr_component")}static get instanceClassName(){return"ComponentActionee"}get proxy(){const e=this,s={get component(){return e.component}};return t.internals.property.completeAssign(super.proxy,s)}setDiscloseType(){this._type=rt.DISCLOSE}listenDisclose(){this.listen(t.core.DisclosureEvent.DISCLOSE,this._handleDisclose.bind(this),{capture:!0})}_handleDisclose(){this.act()}setChangeType(){this._type=rt.CHANGE}listenChange(){this.listen("change",this._handleChange.bind(this),{capture:!0})}_handleChange(t){t.target&&t.target.value&&(this.setChangeValue(t),this.act())}setChangeValue(t){this.value=t.target.value}listenInputValidation(t,e=rt.CLICK,s=!1){t||(t=this.node),this._type=e,this._isSendingInputValue=s,this.addAscent(ft.CLICK,this._actValidatedInput.bind(this));const i=this.element.getDescendantInstances("ButtonActionee",null,!0)[0];i&&(i.isMuted=!0),this._validatedInput=t.querySelector("input"),this._handlingInputValidation=this._handleInputValidation.bind(this),this._validatedInput&&this._validatedInput.addEventListener("keydown",this._handlingInputValidation)}_handleInputValidation(t){13===t.keyCode&&this._actValidatedInput()}_actValidatedInput(){this._isActingValidatedInput||(this._isActingValidatedInput=!0,this._isSendingInputValue&&(this.value=this._validatedInput.value.trim()),this.act(),this.request(this._actedValidatedInput.bind(this)))}_actedValidatedInput(){this._isActingValidatedInput=!1}setCheckType(){this._type=rt.CHECK}detectCheckableType(){const t=this.node.checked;this._type=t?rt.UNCHECK:rt.CHECK}listenCheckable(){this.listen("change",this._handleCheckable.bind(this),{capture:!0})}_handleCheckable(t){switch(t.target&&"on"!==t.target.value&&(this.value=t.target.value),!0){case this._type===rt.CHECK&&t.target.checked:case this._type===rt.UNCHECK&&!t.target.checked:this.act()}}detectPressableType(){const t=this.node.hasAttribute("aria-pressed");if(t){const t="true"===this.node.getAttribute("aria-pressed");this._type=t?rt.RELEASE:rt.PRESS}return t}listenPressable(){this.listen("click",this._handlePressable.bind(this),{capture:!0})}_handlePressable(t){switch(!0){case this._type===rt.PRESS&&"false"===t.target.getAttribute("aria-pressed"):case this._type===rt.RELEASE&&"true"===t.target.getAttribute("aria-pressed"):this.act()}}setDismissType(){this._type=rt.DISMISS}get component(){return null}dispose(){this._validatedInput&&this._validatedInput.removeEventListener("keydown",this._handlingInputValidation),super.dispose()}}const Et={ACCORDION:t.internals.ns.selector("accordion"),TITLE:t.internals.ns.selector("accordion__title")},Nt="accordion";class Tt extends yt{constructor(){super(2)}static get instanceClassName(){return"AccordionButtonActionee"}init(){this.isMuted=!0}get button(){return this.element.getInstance("CollapseButton")}get label(){const t=this.getFirstText();return t||"bouton d'accordéon"}get component(){return Nt}}class vt extends yt{constructor(){super(2)}static get instanceClassName(){return"AccordionActionee"}init(){this.setDiscloseType(),this.wrapper=this.node.closest(Et.ACCORDION),this.detectLevel(this.wrapper),this.register(`[aria-controls="${this.id}"]`,Tt),this.listenDisclose()}get label(){if(this.wrapper){const t=this.wrapper.querySelector(Et.TITLE);if(t){const e=this.getFirstText(t);if(e)return e}}const t=this.element.getInstance("Collapse");if(t){const e=t.buttons.filter((t=>t.isPrimary))[0];if(e){const t=this.getFirstText(e);if(t)return t}}return"accordéon"}get component(){return Nt}dispose(){super.dispose()}}const At=(t,e)=>t.split(",").map((t=>`${t}${e}`)).join(","),Ct={ALERT:t.internals.ns.selector("alert"),TITLE:t.internals.ns.selector("alert__title")};class Lt extends yt{constructor(){super(1)}static get instanceClassName(){return"AlertActionee"}get label(){const t=this.node.querySelector(Ct.TITLE);if(t){const e=this.getFirstText(t);if(e)return e}return"alerte"}get component(){return"alert"}}const It={LINK:`${t.internals.ns.selector("breadcrumb__link")}:not([aria-current])`,COLLAPSE:`${t.internals.ns.selector("breadcrumb")} ${t.internals.ns.selector("collapse")}`};class St extends yt{constructor(){super(2)}static get instanceClassName(){return"BreadcrumbActionee"}get label(){return"fil d'ariane"}get component(){return"breadcrumb"}}class Ot extends yt{constructor(){super(2)}static get instanceClassName(){return"BreadcrumbLinkActionee"}init(){this.detectInteractionType(),this.listenActionClick()}handleClick(){this.act()}get label(){const t=this.getFirstText();return t||"lien fil d'ariane"}get component(){return null}}const wt={BUTTON:`${t.internals.ns.selector("btn")}:not(${t.internals.ns.selector("btn--close")})`};class xt extends yt{constructor(){super(1),this._data={}}static get instanceClassName(){return"ButtonActionee"}init(){this.detectInteractionType(),this.listenActionClick()}handleClick(){this.ascend(ft.CLICK),this.act()}get label(){if("input"===this.node.tagName)switch(this.node.type){case"button":case"submit":if(this.hasAttribute("value"))return this.getAttribute("value")}const t=this.getFirstText();return t||"bouton"}get component(){return"button"}}const kt={CALLOUT:t.internals.ns.selector("callout"),TITLE:t.internals.ns.selector("callout__title")};class Dt extends yt{constructor(){super(1)}static get instanceClassName(){return"CalloutActionee"}get label(){const t=this.node.querySelector(kt.TITLE);if(t){const e=this.getFirstText(t);if(e)return e}return"mise en avant"}get component(){return"callout"}}const Rt={CARD:t.int