@undrr/undrr-mangrove 2.2.0 → 2.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/components/BookCard.js +1 -1
- package/components/Breadcrumbs.js +1 -1
- package/components/Checkbox.js +1 -1
- package/components/Chips.js +1 -1
- package/components/ContentCard.js +1 -1
- package/components/ContentTeaser.js +1 -1
- package/components/CopyButton.js +2 -2
- package/components/CtaButton.js +1 -1
- package/components/Drawer.js +2 -2
- package/components/Drawer.js.LICENSE.txt +1 -1
- package/components/DrupalContentPatterns.js +1 -1
- package/components/EmbedContainer.js +1 -1
- package/components/Footer.js +1 -1
- package/components/FormAction.js +1 -1
- package/components/FormErrorSummary.js +1 -1
- package/components/FormGroup.js +1 -1
- package/components/FullWidth.js +1 -1
- package/components/Gallery.js +2 -2
- package/components/Hero.js +1 -1
- package/components/HighlightBox.js +1 -1
- package/components/HorizontalBookCard.js +2 -2
- package/components/HorizontalBookCard.js.LICENSE.txt +1 -1
- package/components/HorizontalCard.js +2 -2
- package/components/HorizontalCard.js.LICENSE.txt +1 -1
- package/components/IconCard.js +2 -2
- package/components/IconCard.js.LICENSE.txt +1 -1
- package/components/Legend.js +1 -1
- package/components/Loader.js +1 -1
- package/components/MegaMenu.js +2 -2
- package/components/Notice.js +1 -1
- package/components/PageHeader.js +1 -1
- package/components/Pager.js +1 -1
- package/components/ProgressBar.js +1 -1
- package/components/QuoteHighlight.js +2 -2
- package/components/QuoteHighlight.js.LICENSE.txt +1 -1
- package/components/Radio.js +1 -1
- package/components/Range.js +1 -1
- package/components/ScrollContainer.js +2 -2
- package/components/SegmentedControl.js +1 -1
- package/components/Select.js +1 -1
- package/components/ServiceNotice.js +2 -2
- package/components/ShareButtons.js +2 -2
- package/components/ShowMore.js +1 -1
- package/components/SkipLink.js +1 -1
- package/components/StatsCard.js +2 -2
- package/components/StatsCard.js.LICENSE.txt +1 -1
- package/components/SyndicationSearchWidget.js +2 -2
- package/components/Tab.js +2 -2
- package/components/TextCta.js +2 -2
- package/components/TextCta.js.LICENSE.txt +1 -1
- package/components/TextInput.js +1 -1
- package/components/Textarea.js +1 -1
- package/components/Tree.js +1 -1
- package/components/UserFeedback.js +2 -2
- package/components/VerticalCard.js +2 -2
- package/components/VerticalCard.js.LICENSE.txt +1 -1
- package/components/hydrate.js +1 -1
- package/css/style-all.css +4 -4
- package/css/style-all.css.map +1 -1
- package/css/style-delta.css +4 -4
- package/css/style-delta.css.map +1 -1
- package/css/style-gutenberg.css +1 -1
- package/css/style-irp.css +4 -4
- package/css/style-irp.css.map +1 -1
- package/css/style-mcr.css +4 -4
- package/css/style-mcr.css.map +1 -1
- package/css/style-preventionweb.css +4 -4
- package/css/style-preventionweb.css.map +1 -1
- package/css/style.css +4 -4
- package/css/style.css.map +1 -1
- package/docs/EDITORIAL-MANUAL.md +1 -1
- package/error-pages/401.html +1 -1
- package/error-pages/403.html +1 -1
- package/error-pages/404.html +1 -1
- package/error-pages/429.html +1 -1
- package/error-pages/500.html +1 -1
- package/error-pages/502.html +1 -1
- package/error-pages/503.html +1 -1
- package/error-pages/504.html +1 -1
- package/error-pages/5xx.html +1 -1
- package/error-pages/challenge.html +1 -1
- package/error-pages/managed-challenge.html +1 -1
- package/package.json +1 -1
- package/scss/Components/MegaMenu/mega-menu.scss +57 -33
- package/scss/assets/scss/_variables.scss +1 -1
package/components/Tab.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Storybook: https://mangrove.undrr.org/
|
|
4
4
|
* LLMs context: https://mangrove.undrr.org/llms.txt
|
|
5
5
|
* Repository: https://github.com/PreventionWeb/undrr-mangrove
|
|
6
|
-
* Compiled on: 2026-10-
|
|
6
|
+
* Compiled on: 2026-10-27T09:44:34.250Z
|
|
7
7
|
*/
|
|
8
8
|
/*! For license information please see Tab.js.LICENSE.txt */
|
|
9
|
-
import{default as e,memo as t,useEffect as n,useRef as s}from"react";var a={2694(e,t,n){var s=n(6925);function a(){}function r(){}r.resetWarningCache=a,e.exports=function(){function e(e,t,n,a,r,i){if(i!==s){var o=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw o.name="Invariant Violation",o}}function t(){return e}e.isRequired=e;var n={array:e,bigint:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:r,resetWarningCache:a};return n.PropTypes=n,n}},5556(e,t,n){e.exports=n(2694)()},6925(e){e.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"}};const r={};function i(e){const t=r[e];if(void 0!==t)return t.exports;const n=r[e]={exports:{}};return a[e](n,n.exports,i),n.exports}i.n=e=>{const t=e&&e.__esModule?()=>e.default:()=>e;return i.d(t,{a:t}),t},i.cw=e=>{var t;return()=>{if(e){var n=e;e=0,t={exports:{}},n.call(t.exports,t,t.exports)}return t.exports}},i.d=(e,t)=>{for(var n in t)i.o(t,n)&&!i.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},i.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);var o=i.cw(function(e,t){var n=Symbol.for("react.transitional.element"),s=Symbol.for("react.fragment");function a(e,t,s){var a=null;if(void 0!==s&&(a=""+s),void 0!==t.key&&(a=""+t.key),"key"in t)for(var r in s={},t)"key"!==r&&(s[r]=t[r]);else s=t;return t=s.ref,{$$typeof:n,type:e,key:a,ref:void 0!==t?t:null,props:s}}t.Fragment=s,t.jsx=a,t.jsxs=a}),l=i.cw(function(e,t){e.exports=o()}),c=i(5556),d=i.n(c);const u=new WeakMap,m=new WeakMap,f=new WeakMap,g=new WeakMap,b="function"==typeof WeakRef,p=new Set;let h=!1;const v=["resize","hashchange"];let _=!1;const y=["pointerdown","focusin","keydown","click"],x={capture:!0},w=e=>"stacked"===e.dataset.mgJsTabsVariant;function E(e,t,n){n?t.removeAttribute("hidden"):t.setAttribute("hidden","until-found"),e.setAttribute("aria-expanded",String(n)),e.classList.toggle("is-active",n),e.classList.toggle("mg-tabs__stacked--open",n)}function A(e,t,n){for(let s=0;s<e.length;s++)if(!e[t=(t+n+e.length)%e.length].closest(".mg-tabs__item--hidden"))return t;return-1}function L(e){return e.replace(/[\u2018\u2019\u201A\u2032]/g,"'").replace(/[\u201C\u201D\u201E\u2033]/g,'"').replace(/[\u2013\u2014\u2015]/g,"-").replace(/\u2026/g,"...").replace(/\u00A0/g," ")}function k(e=document){return e.querySelectorAll?[...e.matches?.("[data-mg-js-tabs]")?[e]:[],...e.querySelectorAll("[data-mg-js-tabs]")]:Array.from(e).flatMap(k)}const j=e=>m.has(e)||u.has(e),S=e=>m.get(e)||u.get(e);function C(e){let t,n=!1;if(e.forEach(e=>{try{e()}catch(e){n||(t=e),n=!0}}),n)throw t}function O(){const e=p.size>0;e!==_&&(_=e,v.forEach(t=>{e?window.addEventListener(t,D):window.removeEventListener(t,D)}))}function T(e){let t;return{connect(n=!1){if(t)return;const s=[];t=()=>{t=void 0,C(s.reverse())},e((e,t,n)=>{e.addEventListener(t,n),s.push(()=>e.removeEventListener(t,n))},e=>s.push(e),n)},disconnect(){t?.()}}}function R(e,t=!0,n={}){const s=n?.signal;D(),s?.aborted||k(e).forEach(n=>{if(s?.aborted)return;if(!e&&n.hasAttribute("data-mg-js-tabs-skip-auto-init"))return;if(j(n))return void q(n);const a=f.get(n),r=w(n)?"stacked":"horizontal",i=a?.requestedVariant===r?a:void 0;f.delete(n),W(n,t,{initialState:i}),j(n)&&(s?.aborted?N(n):function(e,t){const n={attached:e.isConnected,suspended:!1,ref:b?new WeakRef(e):e};if(t){const s=()=>N(e);t.addEventListener("abort",s,{once:!0}),n.release=()=>t.removeEventListener("abort",s)}g.set(e,n),p.add(n.ref),O()}(n,s))})}function N(e,t=!1){if(t){const t=P(e);t&&f.set(e,{...t,restoreOpenPanels:!0})}else f.delete(e);const n=g.get(e);try{S(e)?.destroy()}finally{n&&(g.delete(e),s=n.ref,p.delete(s),O(),C([n.cancelResume,n.cancelDeferred,n.release].filter(Boolean)))}var s}function M(e,t){return t.attached||!S(e)?.needsLayout}function z(e,t){const n=g.get(e),s=S(e);if(!n||n.suspended||!s)return;n.suspended=!0;const a=t=>q(e,t);y.forEach(t=>e.addEventListener(t,a,x)),n.cancelResume=()=>y.forEach(t=>e.removeEventListener(t,a,x));const r=n.cancelDeferred;n.cancelDeferred=void 0,C([r,()=>s.suspend(function(e){if("hashchange"===e?.type&&e.oldURL)try{return new URL(e.oldURL).hash}catch{return}}(t))].filter(Boolean))}function q(e,t){const n=g.get(e);if(!n?.suspended||!e.isConnected)return;n.suspended=!1,n.attached=!0;const s=n.cancelResume;let a;if(n.cancelResume=void 0,t){const e=[];a=t=>e.push(t),n.cancelDeferred=function(t){let s;const a=[],r=()=>{clearTimeout(s),C(a.splice(0).reverse())},i=()=>{r(),(()=>{n.cancelDeferred=void 0;try{C(e)}finally{D()}})()},o=(e,t,n=!1)=>{window.addEventListener(e,t,n),a.push(()=>window.removeEventListener(e,t,n))},l=e=>{clearTimeout(s),s=setTimeout(i,e)};if(o("click",i),"pointerdown"===t.type){const e=()=>l(400);o("pointerup",e,!0),o("pointercancel",e,!0),l(5e3)}else l(0);return r}(t)}try{s?.()}finally{S(e)?.resume({defer:a})}}function D(e){if(!h){h=!0;try{p.forEach(t=>{try{const n=b?t.deref():t,s=n&&g.get(n);if(s?.ref!==t)return void p.delete(t);n.isConnected?(s.attached=!0,q(n)):M(n,s)&&z(n,e)}catch(e){!function(e){"function"==typeof globalThis.reportError?globalThis.reportError(e):setTimeout(()=>{throw e})}(e)}})}finally{h=!1,O()}}}function I(e,t){const n=g.get(e);if(e.isConnected)return n&&(n.attached=!0),!0;if(!n||!M(e,n))return!0;try{z(e,t)}finally{D(t)}return!1}function P(e){return u.get(e)?.getState()}function W(e,t,n={}){if(u.has(e))return;if(!1!==n.responsive&&e.hasAttribute("data-mg-js-tabs-stack-on-mobile")&&!w(e))return void(m.has(e)||function(e,t,n){const s=e.closest(".mg-tabs")||e,a=e.getAttribute("data-mg-js-tabs-variant"),r=s.classList.contains("mg-tabs--horizontal"),i=s.classList.contains("mg-tabs--stacked"),o=t=>Array.from(e.querySelectorAll(t)).filter(t=>t.closest("[data-mg-js-tabs]")===e),l=o(".mg-tabs__link:not(.mg-tabs__mobile-link)"),c=[],d=l.map(e=>{const t=e.getAttribute("href")?.split("#")[1],n=Array.from(s.querySelectorAll("[id]")).find(e=>e.id===t);if(!n)return null;let a=n.previousElementSibling;if(!a?.classList.contains("mg-tabs__mobile-item")){a=document.createElement("div"),a.className="mg-tabs__mobile-item";const t=e.cloneNode(!0);t.removeAttribute("id"),t.classList.add("mg-tabs__mobile-link"),a.append(t),n.before(a),c.push(a)}return a}).filter(Boolean),f=new Map,g=(e,t)=>{e&&(f.has(e)||f.set(e,e.getAttribute("hidden")),e.hidden=t)},b=()=>{f.forEach((e,t)=>{null===e?t.removeAttribute("hidden"):t.setAttribute("hidden",e)}),f.clear()};let p;const h=()=>{const t=e.getAttribute("data-mg-js-tabs-variant")!==a;s.classList.toggle("mg-tabs--horizontal",t?!w(e):r),s.classList.toggle("mg-tabs--stacked",t?w(e):i),s.classList.remove("mg-tabs--responsive-stacked")},v=(a=!1)=>{const r=window.innerWidth<480;if(r===p)return;const i=P(e)||n;n=void 0,u.get(e)?.destroy(),b(),h(),p=r,p&&(s.classList.remove("mg-tabs--horizontal"),s.classList.add("mg-tabs--stacked","mg-tabs--responsive-stacked")),l.forEach(e=>g(e.closest(".mg-tabs__item"),p)),d.forEach(e=>g(e,!p)),g(o(".mg-tabs__rail")[0],p),W(e,t,{responsive:!1,responsiveMobile:p,initialState:i,resumed:a})},_=()=>{I(e)&&v()},y=T(e=>{e(window,"resize",_),e(window,"orientationchange",_)});m.set(e,{get needsLayout(){return Boolean(u.get(e)?.needsLayout)},suspend(t){C([()=>y.disconnect(),()=>u.get(e)?.suspend(t)])},resume({defer:t}={}){y.connect(),t?(u.get(e)?.resume({defer:t}),t(()=>{m.has(e)&&v(!0)})):(v(!0),u.get(e)?.resume())},destroy(){try{C([()=>y.disconnect(),()=>u.get(e)?.destroy(),b,()=>c.forEach(e=>e.remove()),h])}finally{m.delete(e)}}}),v(),y.connect()}(e,t,n.initialState));const s=e.closest(".mg-tabs")||e,a=t=>Array.from((n.responsiveMobile?s:e).querySelectorAll(t)).filter(t=>{const s=t.closest("[data-mg-js-tabs]");return s===e||n.responsiveMobile&&!s}),r=a(n.responsiveMobile?".mg-tabs__mobile-link":".mg-tabs__link:not(.mg-tabs__mobile-link)"),i=r.map(t=>{const n=t.getAttribute("href")?.split("#")[1];return Array.from(s.querySelectorAll("[id]")).find(t=>{const s=t.closest("[data-mg-js-tabs]");return t.id===n&&(!s||s===e)})});if(!r.length||i.some(e=>!e))return;const o=w(e)?"stacked":"horizontal",l=n.responsiveMobile||w(e),c=[],d=new Map,f=e=>{if(!d.has(e)){const t=["role","aria-controls","aria-selected","aria-expanded","aria-labelledby","aria-label","aria-orientation","tabindex","hidden","data-tabs__item","data-mg-tabs-initialized","data-mg-tabs-overflow-start","data-mg-tabs-overflow-end"];r.includes(e)&&t.push("id"),d.set(e,t.map(t=>[t,e.getAttribute(t)]))}},g=(e,t,n,s)=>{e.addEventListener(t,n,s),c.push(()=>e.removeEventListener(t,n,s))};[e,...r,...i,...r.map(e=>e.parentElement)].forEach(f);let b,p,h=a(".mg-tabs__list")[0]||e;if(f(h),!l){if(s.classList.contains("mg-tabs--horizontal")||(s.classList.add("mg-tabs--horizontal"),c.push(()=>s.classList.remove("mg-tabs--horizontal"))),b=a(".mg-tabs__rail")[0],b)p=a(".mg-tabs__scroll")[0];else{b=document.createElement("div"),b.className="mg-tabs__rail",p=document.createElement("div"),p.className="mg-tabs__scroll";const e=document.createElement("div");e.className="mg-tabs__panels";const t=document.createComment("mg-tabs list");h.before(t,b),b.append(p),p.append(h),b.after(e);const n=i.map(e=>{const t=e.closest(".mg-tabs-content");return t&&t!==s&&1===i.filter(e=>t.contains(e)).length?t:e}),a=i.map((t,s)=>{const a=n[s],r=document.createComment("mg-tabs panel");a.before(r);const i=document.createElement("div");if(i.className="mg-tabs-content",i.setAttribute("data-mg-js-tabs-content",""),e.append(i),a===t)i.append(t);else{for(;a.firstChild;)i.append(a.firstChild);a.remove()}return{original:a,marker:r,replacement:i,panel:t}});c.push(()=>{a.forEach(({original:e,marker:t,replacement:n,panel:s})=>{if(e===s)t.replaceWith(s);else{for(;n.firstChild;)e.append(n.firstChild);t.replaceWith(e)}}),t.replaceWith(h),b.remove(),e.remove()})}f(b),h.setAttribute("role","tablist"),h.setAttribute("aria-label",e.dataset.mgJsTabsLabel||h.getAttribute("aria-label")||"Sections"),h.setAttribute("aria-orientation","horizontal")}const v=()=>"rtl"===getComputedStyle(e).direction,_=()=>{if(!p)return;const e=p.getBoundingClientRect(),t=h.getBoundingClientRect(),n=p.scrollWidth>p.clientWidth+1;b.toggleAttribute("data-mg-tabs-overflow-start",n&&(v()?t.right>e.right+1:t.left<e.left-1)),b.toggleAttribute("data-mg-tabs-overflow-end",n&&(v()?t.left<e.left-1:t.right>e.right+1))};let y,x,k,j;const S=(e,t=!1)=>{if(!p||!e)return;const n=p.getBoundingClientRect(),s=e.getBoundingClientRect(),a=getComputedStyle(h),r=parseFloat(a.paddingInlineStart||(v()?a.paddingRight:a.paddingLeft))||0,i=s.width>n.width-2*r?v()?s.right-n.right+r:s.left-n.left-r:(s.left+s.right-n.left-n.right)/2,o=window.matchMedia?.("(prefers-reduced-motion: reduce)").matches;p.scrollBy?.({left:i,behavior:t&&!o?"smooth":"instant"}),_()},O=(t,{focus:s=!1,toggle:a=!1,animate:o=!1}={})=>{const c=r.indexOf(t);if(x=t,j=void 0,l){const s=!a||i[c].hasAttribute("hidden");s&&!n.responsiveMobile&&e.hasAttribute("data-mg-js-tabs-single-open")&&r.forEach((e,t)=>E(e,i[t],!1)),E(t,i[c],s)}else y=t,r.forEach((e,n)=>{const s=e===t;e.setAttribute("aria-selected",String(s)),e.setAttribute("tabindex",s?"0":"-1"),e.classList.toggle("is-active",s),i[n].hidden=!s}),S(t,o);s&&t.focus({preventScroll:!0})};r.forEach((e,t)=>{const s=i[t];e.id=e.id||s.id+(n.responsiveMobile?"--mobile-trigger":"--trigger"),e.setAttribute("data-tabs__item",s.id),e.setAttribute("aria-controls",s.id),e.setAttribute("role",l?"button":"tab"),e.removeAttribute("aria-selected"),l?e.removeAttribute("tabindex"):e.parentElement.setAttribute("role","presentation"),s.setAttribute("role",l?"region":"tabpanel"),s.setAttribute("aria-labelledby",e.id),s.setAttribute("tabindex","-1"),g(e,"click",t=>{t.preventDefault(),O(e,{focus:!0,toggle:!0,animate:!0})}),g(e,"keydown",n=>{if(" "===n.key||"Enter"===n.key)return n.preventDefault(),void O(e,{focus:!0,toggle:!0,animate:!0});if(!l&&"ArrowDown"===n.key)return n.preventDefault(),void s.focus({preventScroll:!0});const a=l?"ArrowUp":v()?"ArrowRight":"ArrowLeft",i=l?"ArrowDown":v()?"ArrowLeft":"ArrowRight";let o=-1;n.key===a?o=A(r,t,-1):n.key===i?o=A(r,t,1):"Home"===n.key?o=A(r,-1,1):"End"===n.key&&(o=A(r,r.length,-1)),o<0||(n.preventDefault(),l?r[o].focus({preventScroll:!0}):O(r[o],{focus:!0,animate:!0}))}),l&&g(s,"beforematch",()=>O(e))});const R=()=>{let e=window.location.hash.slice(1);try{e=decodeURIComponent(e)}catch{}return i.findIndex(t=>t.id===e)},N=()=>{const e=R();return!(e<0||(O(r[e]),0))},M=n.initialState,z=t&&M&&M.hash!==window.location.hash&&R()>=0;if(l?B(e,r,i):O(r.find(e=>"true"===e.dataset.mgJsTabsDefault)||r[0]),n.responsiveMobile&&!n.initialState&&(r.forEach((e,t)=>E(e,i[t],!1)),O(r.find(e=>"true"===e.dataset.mgJsTabsDefault)||r[0])),t&&N(),M&&!z){const{panelId:e,focus:t}=M,n=i.findIndex(t=>t.id===e);if(n>=0&&(l&&r.forEach((e,t)=>E(e,i[t],!1)),O(r[n]),t)){let e=t.trigger?r[n]:i[n];t.trigger||t.path.forEach(t=>{e=e?.children[t]}),e?.focus({preventScroll:!0})}}if(l&&n.initialState?.stacked&&n.initialState.restoreOpenPanels){const e=new Set(n.initialState.openPanelIds);r.forEach((t,n)=>E(t,i[n],e.has(i[n].id)))}z&&N(),l&&!n.responsiveMobile&&e.hasAttribute("data-mg-js-tabs-filterable")&&c.push(function(e,t,n,s){const a=e.dataset.mgJsTabsFilterPlaceholder||"Filter sections…",r=a.replace(/\u2026$/,"").trim(),i=t.length,o=document.createElement("div");o.className="mg-tabs__filter";const l=document.createElement("input");l.type="search",l.className="mg-form-input mg-tabs__filter-input",l.placeholder=a,l.setAttribute("aria-label",r);const c="mg-tabs-filter-hint-"+Math.random().toString(36).slice(2,8);l.setAttribute("aria-describedby",c);const d=document.createElement("span");d.id=c,d.className="mg-u-sr-only",d.textContent="Results will filter as you type",o.appendChild(l),o.appendChild(d);const u=document.createElement("p");u.className="mg-u-sr-only",u.setAttribute("role","status");const m=e.querySelector(".mg-tabs__list");e.insertBefore(o,m);const f=document.createElement("p");f.className="mg-tabs__no-results mg-tabs__no-results--hidden",f.textContent="No matching sections found.",m.nextSibling?e.insertBefore(f,m.nextSibling):e.appendChild(f),e.appendChild(u);let g=!1,b=null;function p(){const s=l.value.toLowerCase().trim();if(!s){if(!g)return;return t.map(e=>e.closest(".mg-tabs__item")).forEach(e=>{e.classList.remove("mg-tabs__item--hidden");const t=e.nextElementSibling;t?.classList.contains("mg-tabs-content")&&t.classList.remove("mg-tabs-content--hidden")}),B(e,t,n),f.classList.add("mg-tabs__no-results--hidden"),void(u.textContent="")}g=!0;const a=t.map(e=>e.closest(".mg-tabs__item")),r=L(s).split(/\s+/).filter(Boolean);if(0===r.length)return;let o=0;a.forEach(e=>{const t=e.querySelector(".mg-tabs__link"),n=e.nextElementSibling,s=n?.querySelector(".mg-tabs__section"),a=L((t?.textContent?.toLowerCase()||"")+" "+(s?.textContent?.toLowerCase()||"")),i=r.every(e=>a.includes(e));e.classList.toggle("mg-tabs__item--hidden",!i),n?.classList.contains("mg-tabs-content")&&n.classList.toggle("mg-tabs-content--hidden",!i),s&&t&&E(t,s,i),i&&o++});const c=document.activeElement;c&&c.closest&&c.closest(".mg-tabs__item--hidden")&&l.focus(),0===o?(f.classList.remove("mg-tabs__no-results--hidden"),u.textContent="No matching sections found."):(f.classList.add("mg-tabs__no-results--hidden"),u.textContent=o+" of "+i+" sections match.")}const h=()=>{clearTimeout(b),b=setTimeout(p,150)},v=()=>{clearTimeout(b),p()};return l.addEventListener("input",h),l.addEventListener("search",v),s&&(l.value=s.query,l.value&&p(),s.focused&&l.focus({preventScroll:!0})),()=>{clearTimeout(b),l.removeEventListener("input",h),l.removeEventListener("search",v),t.forEach(e=>{const t=e.closest(".mg-tabs__item");t.classList.remove("mg-tabs__item--hidden"),t.nextElementSibling?.classList.remove("mg-tabs-content--hidden")}),o.remove(),f.remove(),u.remove()}}(e,r,i,n.initialState?.filter));let q=!0;p&&g(p,"scroll",_,{passive:!0});const D=()=>{q&&I(e)&&S(y)},F=T((t,n,s)=>{if(t(window,"hashchange",t=>{q&&I(e,t)&&N()}),p){if(t(window,"resize",D),t(window,"orientationchange",D),"undefined"!=typeof ResizeObserver){let t=s;const a=new ResizeObserver(()=>{t?q&&I(e)&&_():D(),t=!1});a.observe(p),a.observe(h),n(()=>a.disconnect())}document.fonts&&(s||document.fonts.ready?.then(D),t(document.fonts,"loadingdone",D))}});F.connect(!0===n.resumed),c.push(()=>F.disconnect()),e.setAttribute("data-mg-tabs-initialized","true"),u.set(e,{needsLayout:Boolean(p),getState(){const t=document.activeElement,n=r.indexOf(t),s=i.findIndex(e=>e.contains(t)),a=s>=0?s:n,c=x||y||r.find(e=>"true"===e.getAttribute("aria-expanded"))||r[0],d=a>=0?a:r.indexOf(c);let u;if(a>=0){const e=[];if(s>=0){let n=t;for(;n!==i[s];)e.unshift(Array.from(n.parentElement.children).indexOf(n)),n=n.parentElement}u={trigger:n>=0,path:e}}const m=e.querySelector(":scope > .mg-tabs__filter > .mg-tabs__filter-input");return{filter:m?{query:m.value,focused:m===t}:void 0,panelId:i[d].id,hash:k??j??window.location.hash,requestedVariant:o,focus:u,stacked:l,openPanelIds:i.filter(e=>!e.hasAttribute("hidden")).map(e=>e.id)}},suspend(e){k=j??e??window.location.hash,j=void 0,F.disconnect()},resume({defer:e}={}){j=k,k=void 0,F.connect(!0),_();const n=()=>{const e=j;j=void 0,q&&t&&void 0!==e&&e!==window.location.hash&&N()};e?e(n):n()},destroy(){q=!1;try{C([...c.slice().reverse(),()=>d.forEach((e,t)=>{e.forEach(([e,n])=>{null===n?t.removeAttribute(e):t.setAttribute(e,n)}),t.classList.remove("is-active","mg-tabs__stacked--open")})])}finally{u.delete(e)}}})}function B(e,t,n){const s=e.dataset.mgJsTabsDefaultOpen;Array.prototype.forEach.call(t,(e,t)=>{const a=e.getAttribute("data-tabs__item");let r=null;for(let e=0;e<n.length;e++)if(n[e].id===a){r=n[e];break}if(!r)return;const i=e.getAttribute("data-mg-js-tabs-default");let o;o="true"===i||"false"!==i&&("true"===s||"false"!==s&&0===t),E(e,r,o)})}"loading"===document.readyState?document.addEventListener("DOMContentLoaded",()=>R(),{once:!0}):R(),l();const F={filterPlaceholder:"Filter sections…",tabListLabel:"Sections"};function U({tabdata:t,variant:a="horizontal",defaultOpen:r,singleOpen:i=!1,stackOnMobile:l=!1,filterable:c=!1,labels:d=F}){const{filterPlaceholder:u,tabListLabel:m}={...F,...d},f=s(null);return n(()=>{const e=f.current;if(!e)return;const t=new AbortController;return function(e=document,t=!0,n={}){R(e,t,n)}(e,!0,{signal:t.signal}),()=>{!function(e=document,t=!1){C(k(e).reverse().map(e=>()=>N(e,t)))}(e,!0),t.abort()}},[t,a,r,i,l,c,u,m]),t?(0,o().jsx)("article",{ref:f,className:"mg-tabs "+("stacked"===a?"mg-tabs--stacked":"mg-tabs--horizontal"),"data-mg-js-tabs":!0,"data-mg-js-tabs-label":m,...l&&"stacked"!==a?{"data-mg-js-tabs-stack-on-mobile":""}:{},"data-mg-js-tabs-variant":"stacked"===a?"stacked":"horizontal",..."stacked"===a&&null!=r?{"data-mg-js-tabs-default-open":String(r)}:{},..."stacked"===a&&i?{"data-mg-js-tabs-single-open":""}:{},...c&&"stacked"===a?{"data-mg-js-tabs-filterable":""}:{},...c&&"stacked"===a&&u?{"data-mg-js-tabs-filter-placeholder":u}:{},children:"stacked"===a?(0,o().jsx)("ul",{className:"mg-tabs__list",children:t.map(t=>(0,o().jsxs)(e.Fragment,{children:[(0,o().jsx)("li",{className:"mg-tabs__item",children:(0,o().jsx)(J,{tab:t})}),(0,o().jsx)("li",{className:"mg-tabs-content","data-mg-js-tabs-content":!0,children:(0,o().jsx)($,{textId:t.text_id,data:t.data})})]},t.text_id))}):(0,o().jsxs)(o().Fragment,{children:[(0,o().jsx)("div",{className:"mg-tabs__rail",children:(0,o().jsx)("div",{className:"mg-tabs__scroll",children:(0,o().jsx)("ul",{className:"mg-tabs__list",children:t.map(e=>(0,o().jsx)("li",{className:"mg-tabs__item",children:(0,o().jsx)(J,{tab:e})},e.text_id))})})}),(0,o().jsx)("div",{className:"mg-tabs__panels",children:t.map(e=>(0,o().jsxs)("div",{className:"mg-tabs-content","data-mg-js-tabs-content":!0,children:[l&&(0,o().jsx)("div",{className:"mg-tabs__mobile-item",hidden:!0,children:(0,o().jsx)(J,{tab:e,mobile:!0})}),(0,o().jsx)($,{textId:e.text_id,data:e.data})]},e.text_id))})]})}):(0,o().jsx)("div",{dangerouslySetInnerHTML:{__html:"\x3c!-- mgTabs: No tab data passed --\x3e"}})}function J({tab:e,mobile:t=!1}){return(0,o().jsx)("a",{className:t?"mg-tabs__link mg-tabs__mobile-link":"mg-tabs__link",href:`#mg-tabs__section-${e.text_id}`,"data-mg-js-tabs-default":e.is_default,children:e.text})}const $=t(function({textId:e,data:t}){return(0,o().jsx)("section",{className:"mg-tabs__section mg-content",id:`mg-tabs__section-${e}`,children:t?(0,o().jsx)("div",{dangerouslySetInnerHTML:{__html:t}}):null})});U.propTypes={tabdata:d().arrayOf(d().shape({text:d().string.isRequired,text_id:d().string.isRequired,data:d().string,is_default:d().string})).isRequired,variant:d().oneOf(["stacked","horizontal"]),defaultOpen:d().bool,singleOpen:d().bool,stackOnMobile:d().bool,filterable:d().bool,labels:d().shape({filterPlaceholder:d().string,tabListLabel:d().string})};export{F as DEFAULT_TAB_LABELS,U as Tab};
|
|
9
|
+
import{default as e,memo as t,useEffect as n,useRef as s}from"react";var a={2694(e,t,n){var s=n(6925);function a(){}function r(){}r.resetWarningCache=a,e.exports=function(){function e(e,t,n,a,r,i){if(i!==s){var o=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw o.name="Invariant Violation",o}}function t(){return e}e.isRequired=e;var n={array:e,bigint:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:r,resetWarningCache:a};return n.PropTypes=n,n}},5556(e,t,n){e.exports=n(2694)()},6925(e){e.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"}};const r={};function i(e){const t=r[e];if(void 0!==t)return t.exports;const n=r[e]={exports:{}};return a[e](n,n.exports,i),n.exports}i.n=e=>{const t=e&&e.__esModule?()=>e.default:()=>e;return i.d(t,{a:t}),t},i.cw=e=>{var t;return()=>{if(e){var n=e;e=0,t={exports:{}},n.call(t.exports,t,t.exports)}return t.exports}},i.d=(e,t)=>{for(var n in t)i.o(t,n)&&!i.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},i.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);var o=i.cw(function(e,t){var n=Symbol.for("react.transitional.element"),s=Symbol.for("react.fragment");function a(e,t,s){var a=null;if(void 0!==s&&(a=""+s),void 0!==t.key&&(a=""+t.key),"key"in t)for(var r in s={},t)"key"!==r&&(s[r]=t[r]);else s=t;return t=s.ref,{$$typeof:n,type:e,key:a,ref:void 0!==t?t:null,props:s}}t.Fragment=s,t.jsx=a,t.jsxs=a}),l=i.cw(function(e,t){e.exports=o()});const c={en:"ltr",ar:"rtl",es:"ltr",fr:"ltr",ja:"ltr",ru:"ltr",zh:"ltr"};function d(e="en"){return String(e).trim().toLowerCase().split(/[-_]/)[0]}function u(e,t){const n=d(e),s=void 0!==e&&Object.hasOwn(c,n)?c[n]:void 0,a=void 0===t?s:t;return{...void 0===e?{}:{lang:e},...void 0===a?{}:{dir:a}}}const m={filterPlaceholder:"Filter sections…",tabListLabel:"Sections"},f=(b=m,g={ar:{tabListLabel:"الأقسام",filterPlaceholder:"تصفية الأقسام…"},es:{tabListLabel:"Secciones",filterPlaceholder:"Filtrar secciones…"},fr:{tabListLabel:"Sections",filterPlaceholder:"Filtrer les sections…"},ja:{tabListLabel:"セクション",filterPlaceholder:"セクションを絞り込む…"},ru:{tabListLabel:"Разделы",filterPlaceholder:"Фильтр разделов…"},zh:{tabListLabel:"章节",filterPlaceholder:"筛选章节…"}},(e,t)=>{const n=d(e),s=Object.hasOwn(g,n)?g[n]:void 0,a=Object.fromEntries(Object.entries(t??{}).filter(([,e])=>void 0!==e));return{...b,...s,...a}});var b,g,h=i(5556),p=i.n(h);const v=new WeakMap,_=new WeakMap,y=new WeakMap,L=new WeakMap,w="function"==typeof WeakRef,x=new Set;let E=!1;const A=["resize","hashchange"];let k=!1;const j=["pointerdown","focusin","keydown","click"],S={capture:!0},C=e=>"stacked"===e.dataset.mgJsTabsVariant;function O(e,t,n){n?t.removeAttribute("hidden"):t.setAttribute("hidden","until-found"),e.setAttribute("aria-expanded",String(n)),e.classList.toggle("is-active",n),e.classList.toggle("mg-tabs__stacked--open",n)}function T(e,t,n){for(let s=0;s<e.length;s++)if(!e[t=(t+n+e.length)%e.length].closest(".mg-tabs__item--hidden"))return t;return-1}function R(e){return e.replace(/[\u2018\u2019\u201A\u2032]/g,"'").replace(/[\u201C\u201D\u201E\u2033]/g,'"').replace(/[\u2013\u2014\u2015]/g,"-").replace(/\u2026/g,"...").replace(/\u00A0/g," ")}function N(e=document){return e.querySelectorAll?[...e.matches?.("[data-mg-js-tabs]")?[e]:[],...e.querySelectorAll("[data-mg-js-tabs]")]:Array.from(e).flatMap(N)}const M=e=>_.has(e)||v.has(e),z=e=>_.get(e)||v.get(e);function P(e){let t,n=!1;if(e.forEach(e=>{try{e()}catch(e){n||(t=e),n=!0}}),n)throw t}function q(){const e=x.size>0;e!==k&&(k=e,A.forEach(t=>{e?window.addEventListener(t,J):window.removeEventListener(t,J)}))}function D(e){let t;return{connect(n=!1){if(t)return;const s=[];t=()=>{t=void 0,P(s.reverse())},e((e,t,n)=>{e.addEventListener(t,n),s.push(()=>e.removeEventListener(t,n))},e=>s.push(e),n)},disconnect(){t?.()}}}function I(e,t=!0,n={}){const s=n?.signal;J(),s?.aborted||N(e).forEach(n=>{if(s?.aborted)return;if(!e&&n.hasAttribute("data-mg-js-tabs-skip-auto-init"))return;if(M(n))return void U(n);const a=y.get(n),r=C(n)?"stacked":"horizontal",i=a?.requestedVariant===r?a:void 0;y.delete(n),V(n,t,{initialState:i}),M(n)&&(s?.aborted?W(n):function(e,t){const n={attached:e.isConnected,suspended:!1,ref:w?new WeakRef(e):e};if(t){const s=()=>W(e);t.addEventListener("abort",s,{once:!0}),n.release=()=>t.removeEventListener("abort",s)}L.set(e,n),x.add(n.ref),q()}(n,s))})}function W(e,t=!1){if(t){const t=H(e);t&&y.set(e,{...t,restoreOpenPanels:!0})}else y.delete(e);const n=L.get(e);try{z(e)?.destroy()}finally{n&&(L.delete(e),s=n.ref,x.delete(s),q(),P([n.cancelResume,n.cancelDeferred,n.release].filter(Boolean)))}var s}function B(e,t){return t.attached||!z(e)?.needsLayout}function F(e,t){const n=L.get(e),s=z(e);if(!n||n.suspended||!s)return;n.suspended=!0;const a=t=>U(e,t);j.forEach(t=>e.addEventListener(t,a,S)),n.cancelResume=()=>j.forEach(t=>e.removeEventListener(t,a,S));const r=n.cancelDeferred;n.cancelDeferred=void 0,P([r,()=>s.suspend(function(e){if("hashchange"===e?.type&&e.oldURL)try{return new URL(e.oldURL).hash}catch{return}}(t))].filter(Boolean))}function U(e,t){const n=L.get(e);if(!n?.suspended||!e.isConnected)return;n.suspended=!1,n.attached=!0;const s=n.cancelResume;let a;if(n.cancelResume=void 0,t){const e=[];a=t=>e.push(t),n.cancelDeferred=function(t){let s;const a=[],r=()=>{clearTimeout(s),P(a.splice(0).reverse())},i=()=>{r(),(()=>{n.cancelDeferred=void 0;try{P(e)}finally{J()}})()},o=(e,t,n=!1)=>{window.addEventListener(e,t,n),a.push(()=>window.removeEventListener(e,t,n))},l=e=>{clearTimeout(s),s=setTimeout(i,e)};if(o("click",i),"pointerdown"===t.type){const e=()=>l(400);o("pointerup",e,!0),o("pointercancel",e,!0),l(5e3)}else l(0);return r}(t)}try{s?.()}finally{z(e)?.resume({defer:a})}}function J(e){if(!E){E=!0;try{x.forEach(t=>{try{const n=w?t.deref():t,s=n&&L.get(n);if(s?.ref!==t)return void x.delete(t);n.isConnected?(s.attached=!0,U(n)):B(n,s)&&F(n,e)}catch(e){!function(e){"function"==typeof globalThis.reportError?globalThis.reportError(e):setTimeout(()=>{throw e})}(e)}})}finally{E=!1,q()}}}function $(e,t){const n=L.get(e);if(e.isConnected)return n&&(n.attached=!0),!0;if(!n||!B(e,n))return!0;try{F(e,t)}finally{J(t)}return!1}function H(e){return v.get(e)?.getState()}function V(e,t,n={}){if(v.has(e))return;if(!1!==n.responsive&&e.hasAttribute("data-mg-js-tabs-stack-on-mobile")&&!C(e))return void(_.has(e)||function(e,t,n){const s=e.closest(".mg-tabs")||e,a=e.getAttribute("data-mg-js-tabs-variant"),r=s.classList.contains("mg-tabs--horizontal"),i=s.classList.contains("mg-tabs--stacked"),o=t=>Array.from(e.querySelectorAll(t)).filter(t=>t.closest("[data-mg-js-tabs]")===e),l=o(".mg-tabs__link:not(.mg-tabs__mobile-link)"),c=[],d=l.map(e=>{const t=e.getAttribute("href")?.split("#")[1],n=Array.from(s.querySelectorAll("[id]")).find(e=>e.id===t);if(!n)return null;let a=n.previousElementSibling;if(!a?.classList.contains("mg-tabs__mobile-item")){a=document.createElement("div"),a.className="mg-tabs__mobile-item";const t=e.cloneNode(!0);t.removeAttribute("id"),t.classList.add("mg-tabs__mobile-link"),a.append(t),n.before(a),c.push(a)}return a}).filter(Boolean),u=new Map,m=(e,t)=>{e&&(u.has(e)||u.set(e,e.getAttribute("hidden")),e.hidden=t)},f=()=>{u.forEach((e,t)=>{null===e?t.removeAttribute("hidden"):t.setAttribute("hidden",e)}),u.clear()};let b;const g=()=>{const t=e.getAttribute("data-mg-js-tabs-variant")!==a;s.classList.toggle("mg-tabs--horizontal",t?!C(e):r),s.classList.toggle("mg-tabs--stacked",t?C(e):i),s.classList.remove("mg-tabs--responsive-stacked")},h=(a=!1)=>{const r=window.innerWidth<480;if(r===b)return;const i=H(e)||n;n=void 0,v.get(e)?.destroy(),f(),g(),b=r,b&&(s.classList.remove("mg-tabs--horizontal"),s.classList.add("mg-tabs--stacked","mg-tabs--responsive-stacked")),l.forEach(e=>m(e.closest(".mg-tabs__item"),b)),d.forEach(e=>m(e,!b)),m(o(".mg-tabs__rail")[0],b),V(e,t,{responsive:!1,responsiveMobile:b,initialState:i,resumed:a})},p=()=>{$(e)&&h()},y=D(e=>{e(window,"resize",p),e(window,"orientationchange",p)});_.set(e,{get needsLayout(){return Boolean(v.get(e)?.needsLayout)},suspend(t){P([()=>y.disconnect(),()=>v.get(e)?.suspend(t)])},resume({defer:t}={}){y.connect(),t?(v.get(e)?.resume({defer:t}),t(()=>{_.has(e)&&h(!0)})):(h(!0),v.get(e)?.resume())},destroy(){try{P([()=>y.disconnect(),()=>v.get(e)?.destroy(),f,()=>c.forEach(e=>e.remove()),g])}finally{_.delete(e)}}}),h(),y.connect()}(e,t,n.initialState));const s=e.closest(".mg-tabs")||e,a=t=>Array.from((n.responsiveMobile?s:e).querySelectorAll(t)).filter(t=>{const s=t.closest("[data-mg-js-tabs]");return s===e||n.responsiveMobile&&!s}),r=a(n.responsiveMobile?".mg-tabs__mobile-link":".mg-tabs__link:not(.mg-tabs__mobile-link)"),i=r.map(t=>{const n=t.getAttribute("href")?.split("#")[1];return Array.from(s.querySelectorAll("[id]")).find(t=>{const s=t.closest("[data-mg-js-tabs]");return t.id===n&&(!s||s===e)})});if(!r.length||i.some(e=>!e))return;const o=C(e)?"stacked":"horizontal",l=n.responsiveMobile||C(e),c=[],d=new Map,u=e=>{if(!d.has(e)){const t=["role","aria-controls","aria-selected","aria-expanded","aria-labelledby","aria-label","aria-orientation","tabindex","hidden","data-tabs__item","data-mg-tabs-initialized","data-mg-tabs-overflow-start","data-mg-tabs-overflow-end"];r.includes(e)&&t.push("id"),d.set(e,t.map(t=>[t,e.getAttribute(t)]))}},m=(e,t,n,s)=>{e.addEventListener(t,n,s),c.push(()=>e.removeEventListener(t,n,s))};[e,...r,...i,...r.map(e=>e.parentElement)].forEach(u);let f,b,g=a(".mg-tabs__list")[0]||e;if(u(g),!l){if(s.classList.contains("mg-tabs--horizontal")||(s.classList.add("mg-tabs--horizontal"),c.push(()=>s.classList.remove("mg-tabs--horizontal"))),f=a(".mg-tabs__rail")[0],f)b=a(".mg-tabs__scroll")[0];else{f=document.createElement("div"),f.className="mg-tabs__rail",b=document.createElement("div"),b.className="mg-tabs__scroll";const e=document.createElement("div");e.className="mg-tabs__panels";const t=document.createComment("mg-tabs list");g.before(t,f),f.append(b),b.append(g),f.after(e);const n=i.map(e=>{const t=e.closest(".mg-tabs-content");return t&&t!==s&&1===i.filter(e=>t.contains(e)).length?t:e}),a=i.map((t,s)=>{const a=n[s],r=document.createComment("mg-tabs panel");a.before(r);const i=document.createElement("div");if(i.className="mg-tabs-content",i.setAttribute("data-mg-js-tabs-content",""),e.append(i),a===t)i.append(t);else{for(;a.firstChild;)i.append(a.firstChild);a.remove()}return{original:a,marker:r,replacement:i,panel:t}});c.push(()=>{a.forEach(({original:e,marker:t,replacement:n,panel:s})=>{if(e===s)t.replaceWith(s);else{for(;n.firstChild;)e.append(n.firstChild);t.replaceWith(e)}}),t.replaceWith(g),f.remove(),e.remove()})}u(f),g.setAttribute("role","tablist"),g.setAttribute("aria-label",e.dataset.mgJsTabsLabel||g.getAttribute("aria-label")||"Sections"),g.setAttribute("aria-orientation","horizontal")}const h=()=>"rtl"===getComputedStyle(e).direction,p=()=>{if(!b)return;const e=b.getBoundingClientRect(),t=g.getBoundingClientRect(),n=b.scrollWidth>b.clientWidth+1;f.toggleAttribute("data-mg-tabs-overflow-start",n&&(h()?t.right>e.right+1:t.left<e.left-1)),f.toggleAttribute("data-mg-tabs-overflow-end",n&&(h()?t.left<e.left-1:t.right>e.right+1))};let y,L,w,x;const E=(e,t=!1)=>{if(!b||!e)return;const n=b.getBoundingClientRect(),s=e.getBoundingClientRect(),a=getComputedStyle(g),r=parseFloat(a.paddingInlineStart||(h()?a.paddingRight:a.paddingLeft))||0,i=s.width>n.width-2*r?h()?s.right-n.right+r:s.left-n.left-r:(s.left+s.right-n.left-n.right)/2,o=window.matchMedia?.("(prefers-reduced-motion: reduce)").matches;b.scrollBy?.({left:i,behavior:t&&!o?"smooth":"instant"}),p()},A=(t,{focus:s=!1,toggle:a=!1,animate:o=!1}={})=>{const c=r.indexOf(t);if(L=t,x=void 0,l){const s=!a||i[c].hasAttribute("hidden");s&&!n.responsiveMobile&&e.hasAttribute("data-mg-js-tabs-single-open")&&r.forEach((e,t)=>O(e,i[t],!1)),O(t,i[c],s)}else y=t,r.forEach((e,n)=>{const s=e===t;e.setAttribute("aria-selected",String(s)),e.setAttribute("tabindex",s?"0":"-1"),e.classList.toggle("is-active",s),i[n].hidden=!s}),E(t,o);s&&t.focus({preventScroll:!0})};r.forEach((e,t)=>{const s=i[t];e.id=e.id||s.id+(n.responsiveMobile?"--mobile-trigger":"--trigger"),e.setAttribute("data-tabs__item",s.id),e.setAttribute("aria-controls",s.id),e.setAttribute("role",l?"button":"tab"),e.removeAttribute("aria-selected"),l?e.removeAttribute("tabindex"):e.parentElement.setAttribute("role","presentation"),s.setAttribute("role",l?"region":"tabpanel"),s.setAttribute("aria-labelledby",e.id),s.setAttribute("tabindex","-1"),m(e,"click",t=>{t.preventDefault(),A(e,{focus:!0,toggle:!0,animate:!0})}),m(e,"keydown",n=>{if(" "===n.key||"Enter"===n.key)return n.preventDefault(),void A(e,{focus:!0,toggle:!0,animate:!0});if(!l&&"ArrowDown"===n.key)return n.preventDefault(),void s.focus({preventScroll:!0});const a=l?"ArrowUp":h()?"ArrowRight":"ArrowLeft",i=l?"ArrowDown":h()?"ArrowLeft":"ArrowRight";let o=-1;n.key===a?o=T(r,t,-1):n.key===i?o=T(r,t,1):"Home"===n.key?o=T(r,-1,1):"End"===n.key&&(o=T(r,r.length,-1)),o<0||(n.preventDefault(),l?r[o].focus({preventScroll:!0}):A(r[o],{focus:!0,animate:!0}))}),l&&m(s,"beforematch",()=>A(e))});const k=()=>{let e=window.location.hash.slice(1);try{e=decodeURIComponent(e)}catch{}return i.findIndex(t=>t.id===e)},j=()=>{const e=k();return!(e<0||(A(r[e]),0))},S=n.initialState,N=t&&S&&S.hash!==window.location.hash&&k()>=0;if(l?Y(e,r,i):A(r.find(e=>"true"===e.dataset.mgJsTabsDefault)||r[0]),n.responsiveMobile&&!n.initialState&&(r.forEach((e,t)=>O(e,i[t],!1)),A(r.find(e=>"true"===e.dataset.mgJsTabsDefault)||r[0])),t&&j(),S&&!N){const{panelId:e,focus:t}=S,n=i.findIndex(t=>t.id===e);if(n>=0&&(l&&r.forEach((e,t)=>O(e,i[t],!1)),A(r[n]),t)){let e=t.trigger?r[n]:i[n];t.trigger||t.path.forEach(t=>{e=e?.children[t]}),e?.focus({preventScroll:!0})}}if(l&&n.initialState?.stacked&&n.initialState.restoreOpenPanels){const e=new Set(n.initialState.openPanelIds);r.forEach((t,n)=>O(t,i[n],e.has(i[n].id)))}N&&j(),l&&!n.responsiveMobile&&e.hasAttribute("data-mg-js-tabs-filterable")&&c.push(function(e,t,n,s){const a=e.dataset.mgJsTabsFilterPlaceholder||"Filter sections…",r=a.replace(/\u2026$/,"").trim(),i=t.length,o=document.createElement("div");o.className="mg-tabs__filter";const l=document.createElement("input");l.type="search",l.className="mg-form-input mg-tabs__filter-input",l.placeholder=a,l.setAttribute("aria-label",r);const c="mg-tabs-filter-hint-"+Math.random().toString(36).slice(2,8);l.setAttribute("aria-describedby",c);const d=document.createElement("span");d.id=c,d.className="mg-u-sr-only",d.textContent="Results will filter as you type",o.appendChild(l),o.appendChild(d);const u=document.createElement("p");u.className="mg-u-sr-only",u.setAttribute("role","status");const m=e.querySelector(".mg-tabs__list");e.insertBefore(o,m);const f=document.createElement("p");f.className="mg-tabs__no-results mg-tabs__no-results--hidden",f.textContent="No matching sections found.",m.nextSibling?e.insertBefore(f,m.nextSibling):e.appendChild(f),e.appendChild(u);let b=!1,g=null;function h(){const s=l.value.toLowerCase().trim();if(!s){if(!b)return;return t.map(e=>e.closest(".mg-tabs__item")).forEach(e=>{e.classList.remove("mg-tabs__item--hidden");const t=e.nextElementSibling;t?.classList.contains("mg-tabs-content")&&t.classList.remove("mg-tabs-content--hidden")}),Y(e,t,n),f.classList.add("mg-tabs__no-results--hidden"),void(u.textContent="")}b=!0;const a=t.map(e=>e.closest(".mg-tabs__item")),r=R(s).split(/\s+/).filter(Boolean);if(0===r.length)return;let o=0;a.forEach(e=>{const t=e.querySelector(".mg-tabs__link"),n=e.nextElementSibling,s=n?.querySelector(".mg-tabs__section"),a=R((t?.textContent?.toLowerCase()||"")+" "+(s?.textContent?.toLowerCase()||"")),i=r.every(e=>a.includes(e));e.classList.toggle("mg-tabs__item--hidden",!i),n?.classList.contains("mg-tabs-content")&&n.classList.toggle("mg-tabs-content--hidden",!i),s&&t&&O(t,s,i),i&&o++});const c=document.activeElement;c&&c.closest&&c.closest(".mg-tabs__item--hidden")&&l.focus(),0===o?(f.classList.remove("mg-tabs__no-results--hidden"),u.textContent="No matching sections found."):(f.classList.add("mg-tabs__no-results--hidden"),u.textContent=o+" of "+i+" sections match.")}const p=()=>{clearTimeout(g),g=setTimeout(h,150)},v=()=>{clearTimeout(g),h()};return l.addEventListener("input",p),l.addEventListener("search",v),s&&(l.value=s.query,l.value&&h(),s.focused&&l.focus({preventScroll:!0})),()=>{clearTimeout(g),l.removeEventListener("input",p),l.removeEventListener("search",v),t.forEach(e=>{const t=e.closest(".mg-tabs__item");t.classList.remove("mg-tabs__item--hidden"),t.nextElementSibling?.classList.remove("mg-tabs-content--hidden")}),o.remove(),f.remove(),u.remove()}}(e,r,i,n.initialState?.filter));let M=!0;b&&m(b,"scroll",p,{passive:!0});const z=()=>{M&&$(e)&&E(y)},q=D((t,n,s)=>{if(t(window,"hashchange",t=>{M&&$(e,t)&&j()}),b){if(t(window,"resize",z),t(window,"orientationchange",z),"undefined"!=typeof ResizeObserver){let t=s;const a=new ResizeObserver(()=>{t?M&&$(e)&&p():z(),t=!1});a.observe(b),a.observe(g),n(()=>a.disconnect())}document.fonts&&(s||document.fonts.ready?.then(z),t(document.fonts,"loadingdone",z))}});q.connect(!0===n.resumed),c.push(()=>q.disconnect()),e.setAttribute("data-mg-tabs-initialized","true"),v.set(e,{needsLayout:Boolean(b),getState(){const t=document.activeElement,n=r.indexOf(t),s=i.findIndex(e=>e.contains(t)),a=s>=0?s:n,c=L||y||r.find(e=>"true"===e.getAttribute("aria-expanded"))||r[0],d=a>=0?a:r.indexOf(c);let u;if(a>=0){const e=[];if(s>=0){let n=t;for(;n!==i[s];)e.unshift(Array.from(n.parentElement.children).indexOf(n)),n=n.parentElement}u={trigger:n>=0,path:e}}const m=e.querySelector(":scope > .mg-tabs__filter > .mg-tabs__filter-input");return{filter:m?{query:m.value,focused:m===t}:void 0,panelId:i[d].id,hash:w??x??window.location.hash,requestedVariant:o,focus:u,stacked:l,openPanelIds:i.filter(e=>!e.hasAttribute("hidden")).map(e=>e.id)}},suspend(e){w=x??e??window.location.hash,x=void 0,q.disconnect()},resume({defer:e}={}){x=w,w=void 0,q.connect(!0),p();const n=()=>{const e=x;x=void 0,M&&t&&void 0!==e&&e!==window.location.hash&&j()};e?e(n):n()},destroy(){M=!1;try{P([...c.slice().reverse(),()=>d.forEach((e,t)=>{e.forEach(([e,n])=>{null===n?t.removeAttribute(e):t.setAttribute(e,n)}),t.classList.remove("is-active","mg-tabs__stacked--open")})])}finally{v.delete(e)}}})}function Y(e,t,n){const s=e.dataset.mgJsTabsDefaultOpen;Array.prototype.forEach.call(t,(e,t)=>{const a=e.getAttribute("data-tabs__item");let r=null;for(let e=0;e<n.length;e++)if(n[e].id===a){r=n[e];break}if(!r)return;const i=e.getAttribute("data-mg-js-tabs-default");let o;o="true"===i||"false"!==i&&("true"===s||"false"!==s&&0===t),O(e,r,o)})}function G({tabdata:t,variant:a="horizontal",defaultOpen:r,singleOpen:i=!1,stackOnMobile:l=!1,filterable:c=!1,lang:d,dir:m,labels:b}){const{filterPlaceholder:g,tabListLabel:h}=f(d,b),p=s(null);return n(()=>{const e=p.current;if(!e)return;const t=new AbortController;return function(e=document,t=!0,n={}){I(e,t,n)}(e,!0,{signal:t.signal}),()=>{!function(e=document,t=!1){P(N(e).reverse().map(e=>()=>W(e,t)))}(e,!0),t.abort()}},[t,a,r,i,l,c,g,h]),t?(0,o().jsx)("article",{...u(d,m),ref:p,className:"mg-tabs "+("stacked"===a?"mg-tabs--stacked":"mg-tabs--horizontal"),"data-mg-js-tabs":!0,"data-mg-js-tabs-label":h,...l&&"stacked"!==a?{"data-mg-js-tabs-stack-on-mobile":""}:{},"data-mg-js-tabs-variant":"stacked"===a?"stacked":"horizontal",..."stacked"===a&&null!=r?{"data-mg-js-tabs-default-open":String(r)}:{},..."stacked"===a&&i?{"data-mg-js-tabs-single-open":""}:{},...c&&"stacked"===a?{"data-mg-js-tabs-filterable":""}:{},...c&&"stacked"===a&&g?{"data-mg-js-tabs-filter-placeholder":g}:{},children:"stacked"===a?(0,o().jsx)("ul",{className:"mg-tabs__list",children:t.map(t=>(0,o().jsxs)(e.Fragment,{children:[(0,o().jsx)("li",{className:"mg-tabs__item",children:(0,o().jsx)(K,{tab:t})}),(0,o().jsx)("li",{className:"mg-tabs-content","data-mg-js-tabs-content":!0,children:(0,o().jsx)(Q,{textId:t.text_id,data:t.data})})]},t.text_id))}):(0,o().jsxs)(o().Fragment,{children:[(0,o().jsx)("div",{className:"mg-tabs__rail",children:(0,o().jsx)("div",{className:"mg-tabs__scroll",children:(0,o().jsx)("ul",{className:"mg-tabs__list",children:t.map(e=>(0,o().jsx)("li",{className:"mg-tabs__item",children:(0,o().jsx)(K,{tab:e})},e.text_id))})})}),(0,o().jsx)("div",{className:"mg-tabs__panels",children:t.map(e=>(0,o().jsxs)("div",{className:"mg-tabs-content","data-mg-js-tabs-content":!0,children:[l&&(0,o().jsx)("div",{className:"mg-tabs__mobile-item",hidden:!0,children:(0,o().jsx)(K,{tab:e,mobile:!0})}),(0,o().jsx)(Q,{textId:e.text_id,data:e.data})]},e.text_id))})]})}):(0,o().jsx)("div",{dangerouslySetInnerHTML:{__html:"\x3c!-- mgTabs: No tab data passed --\x3e"}})}function K({tab:e,mobile:t=!1}){return(0,o().jsx)("a",{className:t?"mg-tabs__link mg-tabs__mobile-link":"mg-tabs__link",href:`#mg-tabs__section-${e.text_id}`,"data-mg-js-tabs-default":e.is_default,children:e.text})}"loading"===document.readyState?document.addEventListener("DOMContentLoaded",()=>I(),{once:!0}):I(),l();const Q=t(function({textId:e,data:t}){return(0,o().jsx)("section",{className:"mg-tabs__section mg-content",id:`mg-tabs__section-${e}`,children:t?(0,o().jsx)("div",{dangerouslySetInnerHTML:{__html:t}}):null})});G.propTypes={tabdata:p().arrayOf(p().shape({text:p().string.isRequired,text_id:p().string.isRequired,data:p().string,is_default:p().string})).isRequired,variant:p().oneOf(["stacked","horizontal"]),defaultOpen:p().bool,singleOpen:p().bool,stackOnMobile:p().bool,filterable:p().bool,lang:p().string,dir:p().oneOf(["ltr","rtl","auto"]),labels:p().shape({filterPlaceholder:p().string,tabListLabel:p().string})};export{m as DEFAULT_TAB_LABELS,G as Tab,f as getTabLabels};
|
package/components/TextCta.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Storybook: https://mangrove.undrr.org/
|
|
4
4
|
* LLMs context: https://mangrove.undrr.org/llms.txt
|
|
5
5
|
* Repository: https://github.com/PreventionWeb/undrr-mangrove
|
|
6
|
-
* Compiled on: 2026-10-
|
|
6
|
+
* Compiled on: 2026-10-27T09:44:34.250Z
|
|
7
7
|
*/
|
|
8
8
|
/*! For license information please see TextCta.js.LICENSE.txt */
|
|
9
|
-
import{useId as e}from"react";var t={2694(e,t,n){var r=n(6925);function o(){}function i(){}i.resetWarningCache=o,e.exports=function(){function e(e,t,n,o,i,a){if(a!==r){var l=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw l.name="Invariant Violation",l}}function t(){return e}e.isRequired=e;var n={array:e,bigint:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:i,resetWarningCache:o};return n.PropTypes=n,n}},5556(e,t,n){e.exports=n(2694)()},6925(e){e.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"}};const n={};function r(e){const o=n[e];if(void 0!==o)return o.exports;const i=n[e]={exports:{}};return t[e](i,i.exports,r),i.exports}r.n=e=>{const t=e&&e.__esModule?()=>e.default:()=>e;return r.d(t,{a:t}),t},r.cw=e=>{var t;return()=>{if(e){var n=e;e=0,t={exports:{}},n.call(t.exports,t,t.exports)}return t.exports}},r.d=(e,t)=>{for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);var o=r.cw(function(e,t){var n=Symbol.for("react.transitional.element");function r(e,t,r){var o=null;if(void 0!==r&&(o=""+r),void 0!==t.key&&(o=""+t.key),"key"in t)for(var i in r={},t)"key"!==i&&(r[i]=t[i]);else r=t;return t=r.ref,{$$typeof:n,type:e,key:o,ref:void 0!==t?t:null,props:r}}Symbol.for("react.fragment"),t.jsx=r,t.jsxs=r}),i=r.cw(function(e,t){e.exports=o()}),a=r(5556),l=r.n(a);function c(e,t){this.v=e,this.k=t}function s(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function u(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,i,a,l=[],c=!0,s=!1;try{if(i=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=i.call(n)).done)&&(l.push(r.value),l.length!==t);c=!0);}catch(e){s=!0,o=e}finally{try{if(!c&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(s)throw o}}return l}}(e,t)||function(e,t){if(e){if("string"==typeof e)return s(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?s(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function f(e){var t,n;function r(t,n){try{var i=e[t](n),a=i.value,l=a instanceof c;Promise.resolve(l?a.v:a).then(function(n){if(l){var c="return"===t&&a.k?t:"next";if(!a.k||n.done)return r(c,n);n=e[c](n).value}o(!!i.done,n)},function(e){r("throw",e)})}catch(e){o(2,e)}}function o(e,o){2===e?t.reject(o):t.resolve({value:o,done:e}),(t=t.next)?r(t.key,t.arg):n=null}this._invoke=function(e,o){return new Promise(function(i,a){var l={key:e,arg:o,resolve:i,reject:a,next:null};n?n=n.next=l:(t=n=l,r(e,o))})},"function"!=typeof e.return&&(this.return=void 0)}f.prototype["function"==typeof Symbol&&Symbol.asyncIterator||"@@asyncIterator"]=function(){return this},f.prototype.next=function(e){return this._invoke("next",e)},f.prototype.throw=function(e){return this._invoke("throw",e)},f.prototype.return=function(e){return this._invoke("return",e)};const p=Object.entries,m=Object.setPrototypeOf,d=Object.isFrozen,h=Object.getPrototypeOf,y=Object.getOwnPropertyDescriptor;let g=Object.freeze,b=Object.seal,v=Object.create,S="undefined"!=typeof Reflect&&Reflect,T=S.apply,A=S.construct;g||(g=function(e){return e}),b||(b=function(e){return e}),T||(T=function(e,t){for(var n=arguments.length,r=new Array(n>2?n-2:0),o=2;o<n;o++)r[o-2]=arguments[o];return e.apply(t,r)}),A||(A=function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];return new e(...n)});const w=Y(Array.prototype.forEach);Array.prototype.indexOf;const x=Y(Array.prototype.lastIndexOf),E=Y(Array.prototype.pop),_=Y(Array.prototype.push);Array.prototype.slice;const O=Y(Array.prototype.splice),N=Array.isArray,k=Y(String.prototype.toLowerCase),D=Y(String.prototype.toString),C=Y(String.prototype.match),R=Y(String.prototype.replace),I=Y(String.prototype.indexOf),L=Y(String.prototype.trim),z=Y(Number.prototype.toString),P=Y(Boolean.prototype.toString),M="undefined"==typeof BigInt?null:Y(BigInt.prototype.toString),j="undefined"==typeof Symbol?null:Y(Symbol.prototype.toString),U=Y(Object.prototype.hasOwnProperty),F=Y(Object.prototype.toString),H=Y(RegExp.prototype.test),B=(W=TypeError,function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return A(W,t)});var W;function Y(e){return function(t){t instanceof RegExp&&(t.lastIndex=0);for(var n=arguments.length,r=new Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];return T(e,t,r)}}function G(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:k;if(m&&m(e,null),!N(t))return e;let r=t.length;for(;r--;){let o=t[r];if("string"==typeof o){const e=n(o);e!==o&&(d(t)||(t[r]=e),o=e)}e[o]=!0}return e}function q(e){for(let t=0;t<e.length;t++)U(e,t)||(e[t]=null);return e}function $(e){const t=v(null);for(const r of p(e)){var n=u(r,2);const o=n[0],i=n[1];U(e,o)&&(N(i)?t[o]=q(i):i&&"object"==typeof i&&i.constructor===Object?t[o]=$(i):t[o]=i)}return t}function V(e,t){for(;null!==e;){const n=y(e,t);if(n){if(n.get)return Y(n.get);if("function"==typeof n.value)return Y(n.value)}e=h(e)}return function(){return null}}const X=g(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","search","section","select","shadow","slot","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),K=g(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","enterkeyhint","exportparts","filter","font","g","glyph","glyphref","hkern","image","inputmode","line","lineargradient","marker","mask","metadata","mpath","part","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),Z=g(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),J=g(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),Q=g(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),ee=g(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),te=g(["#text"]),ne=g(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","command","commandfor","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","exportparts","face","for","headers","height","hidden","high","href","hreflang","id","inert","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","part","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","slot","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns"]),re=g(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dominant-baseline","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","mask-type","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","pointer-events","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-orientation","text-rendering","textlength","type","u1","u2","unicode","values","vector-effect","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),oe=g(["accent","accentunder","align","bevelled","close","columnalign","columnlines","columnspacing","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lquote","lspace","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),ie=g(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),ae=b(/{{[\w\W]*|^[\w\W]*}}/g),le=b(/<%[\w\W]*|^[\w\W]*%>/g),ce=b(/\${[\w\W]*/g),se=b(/^data-[\-\w.\u00B7-\uFFFF]+$/),ue=b(/^aria-[\-\w]+$/),fe=b(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),pe=b(/^(?:\w+script|data):/i),me=b(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),de=b(/^html$/i),he=b(/^[a-z][.\w]*(-[.\w]+)+$/i),ye=b(/<[/\w!]/g),ge=b(/<[/\w]/g),be=b(/<\/no(script|embed|frames)/i),ve=b(/\/>/i),Se=["style","script","xmp","iframe","noembed","noframes","plaintext","noscript"],Te=g(G({},Se)),Ae=function(){const e={};return w(Se,t=>{e[t]=b(new RegExp("</"+t+"(?=[\\t\\n\\f\\r />])","i"))}),g(e)}(),we=function(){return"undefined"==typeof window?null:window},xe=function(e,t,n,r){return U(e,t)&&N(e[t])?G(r.base?$(r.base):{},e[t],r.transform):n},Ee=function(e,t,n){const r=U(e,t)?e[t]:void 0;return r&&"object"==typeof r?$(r):n()};var _e=function e(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:we();const n=t=>e(t);if(n.version="3.4.16",n.removed=[],!t||!t.document||9!==t.document.nodeType||!t.Element)return n.isSupported=!1,n;let r=t.document;const o=r,i=o.currentScript;t.DocumentFragment;const a=t.HTMLTemplateElement,l=t.Node,c=t.Element,s=t.NodeFilter;void 0===t.NamedNodeMap&&(t.NamedNodeMap||t.MozNamedAttrMap),t.HTMLFormElement;const u=t.DOMParser,f=t.trustedTypes,m=c.prototype,d=V(m,"cloneNode"),h=V(m,"remove"),y=V(m,"removeAttributeNode"),S=V(m,"nextSibling"),T=V(m,"childNodes"),A=V(m,"parentNode"),W=V(m,"shadowRoot"),Y=V(m,"attributes"),q=l&&l.prototype?V(l.prototype,"nodeType"):null,Se=l&&l.prototype?V(l.prototype,"nodeName"):null,_e=l&&l.prototype?V(l.prototype,"ownerDocument"):null,Oe=function(e){return q?q(e):e.nodeType},Ne=function(e){return Se?Se(e):e.nodeName};if("function"==typeof a){const e=r.createElement("template");e.content&&e.content.ownerDocument&&(r=e.content.ownerDocument)}let ke,De,Ce="",Re=!1,Ie=0;const Le=function(){if(Ie>0)throw B('A configured TRUSTED_TYPES_POLICY callback (createHTML or createScriptURL) must not call DOMPurify.sanitize, as that causes infinite recursion. Do not pass a policy whose callbacks wrap DOMPurify as TRUSTED_TYPES_POLICY; see the "DOMPurify and Trusted Types" section of the README.')},ze=function(e){Le(),Ie++;try{return ke.createHTML(e)}finally{Ie--}},Pe=r,Me=Pe.implementation,je=Pe.createNodeIterator,Ue=Pe.createDocumentFragment,Fe=Pe.getElementsByTagName,He=o.importNode;let Be={afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]};n.isSupported="function"==typeof p&&"function"==typeof A&&Me&&void 0!==Me.createHTMLDocument;const We=ae,Ye=le,Ge=ce,qe=se,$e=ue,Ve=pe,Xe=me,Ke=he;let Ze=fe,Je=null;const Qe=G({},[...X,...K,...Z,...Q,...te]);let et=null;const tt=G({},[...ne,...re,...oe,...ie]);let nt=Object.seal(v(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),rt=null,ot=null;const it=Object.seal(v(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let at=!0,lt=!0,ct=!1,st=!0,ut=!1,ft=!0,pt=!1,mt=!1,dt=null,ht=null,yt=!1,gt=!1,bt=!1,vt=!1,St=!0,Tt=!1;const At="user-content-";let wt=!0,xt=!1,Et={},_t=null;const Ot=G({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","selectedcontent","style","svg","template","thead","title","video","xmp"]);let Nt=null;const kt=G({},["audio","video","img","source","image","track"]);let Dt=null;const Ct=G({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),Rt="http://www.w3.org/1998/Math/MathML",It="http://www.w3.org/2000/svg",Lt="http://www.w3.org/1999/xhtml";let zt=Lt,Pt=!1,Mt=null;const jt=G({},[Rt,It,Lt],D),Ut=g(["mi","mo","mn","ms","mtext"]);let Ft=G({},Ut);const Ht=g(["annotation-xml"]);let Bt=G({},Ht);const Wt=G({},["title","style","font","a","script"]);let Yt=null;const Gt=["application/xhtml+xml","text/html"];let qt=null,$t=null;const Vt=r.createElement("form"),Xt=function(e){return e instanceof RegExp||e instanceof Function},Kt=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if($t&&$t===e)return;e&&"object"==typeof e||(e={}),e=$(e),Yt=-1===Gt.indexOf(e.PARSER_MEDIA_TYPE)?"text/html":e.PARSER_MEDIA_TYPE,qt="application/xhtml+xml"===Yt?D:k,Je=xe(e,"ALLOWED_TAGS",Qe,{transform:qt}),et=xe(e,"ALLOWED_ATTR",tt,{transform:qt}),Mt=xe(e,"ALLOWED_NAMESPACES",jt,{transform:D}),Dt=xe(e,"ADD_URI_SAFE_ATTR",Ct,{transform:qt,base:Ct}),Nt=xe(e,"ADD_DATA_URI_TAGS",kt,{transform:qt,base:kt}),_t=xe(e,"FORBID_CONTENTS",Ot,{transform:qt}),rt=xe(e,"FORBID_TAGS",$({}),{transform:qt}),ot=xe(e,"FORBID_ATTR",$({}),{transform:qt}),Et=!!U(e,"USE_PROFILES")&&(e.USE_PROFILES&&"object"==typeof e.USE_PROFILES?$(e.USE_PROFILES):e.USE_PROFILES),at=!1!==e.ALLOW_ARIA_ATTR,lt=!1!==e.ALLOW_DATA_ATTR,ct=e.ALLOW_UNKNOWN_PROTOCOLS||!1,st=!1!==e.ALLOW_SELF_CLOSE_IN_ATTR,ut=e.SAFE_FOR_TEMPLATES||!1,ft=!1!==e.SAFE_FOR_XML,pt=e.WHOLE_DOCUMENT||!1,gt=e.RETURN_DOM||!1,bt=e.RETURN_DOM_FRAGMENT||!1,vt=e.RETURN_TRUSTED_TYPE||!1,yt=e.FORCE_BODY||!1,St=!1!==e.SANITIZE_DOM,Tt=e.SANITIZE_NAMED_PROPS||!1,wt=!1!==e.KEEP_CONTENT,xt=e.IN_PLACE||!1,Ze=function(e){try{return H(e,""),!0}catch(e){return!1}}(e.ALLOWED_URI_REGEXP)?e.ALLOWED_URI_REGEXP:fe,zt="string"==typeof e.NAMESPACE?e.NAMESPACE:Lt,Ft=Ee(e,"MATHML_TEXT_INTEGRATION_POINTS",()=>G({},Ut)),Bt=Ee(e,"HTML_INTEGRATION_POINTS",()=>G({},Ht));const t=Ee(e,"CUSTOM_ELEMENT_HANDLING",()=>v(null));if(nt=v(null),U(t,"tagNameCheck")&&Xt(t.tagNameCheck)&&(nt.tagNameCheck=t.tagNameCheck),U(t,"attributeNameCheck")&&Xt(t.attributeNameCheck)&&(nt.attributeNameCheck=t.attributeNameCheck),U(t,"allowCustomizedBuiltInElements")&&"boolean"==typeof t.allowCustomizedBuiltInElements&&(nt.allowCustomizedBuiltInElements=t.allowCustomizedBuiltInElements),b(nt),ut&&(lt=!1),bt&&(gt=!0),Et&&(Je=G({},te),et=v(null),!0===Et.html&&(G(Je,X),G(et,ne)),!0===Et.svg&&(G(Je,K),G(et,re),G(et,ie)),!0===Et.svgFilters&&(G(Je,Z),G(et,re),G(et,ie)),!0===Et.mathMl&&(G(Je,Q),G(et,oe),G(et,ie))),it.tagCheck=null,it.attributeCheck=null,U(e,"ADD_TAGS")&&("function"==typeof e.ADD_TAGS?it.tagCheck=e.ADD_TAGS:N(e.ADD_TAGS)&&(Je===Qe&&(Je=$(Je)),G(Je,e.ADD_TAGS,qt))),U(e,"ADD_ATTR")&&("function"==typeof e.ADD_ATTR?it.attributeCheck=e.ADD_ATTR:N(e.ADD_ATTR)&&(et===tt&&(et=$(et)),G(et,e.ADD_ATTR,qt))),U(e,"ADD_FORBID_CONTENTS")&&N(e.ADD_FORBID_CONTENTS)&&(_t===Ot&&(_t=$(_t)),G(_t,e.ADD_FORBID_CONTENTS,qt)),wt&&(Je["#text"]=!0),pt&&G(Je,["html","head","body"]),Je.table&&(G(Je,["tbody"]),delete rt.tbody),e.TRUSTED_TYPES_POLICY){if("function"!=typeof e.TRUSTED_TYPES_POLICY.createHTML)throw B('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if("function"!=typeof e.TRUSTED_TYPES_POLICY.createScriptURL)throw B('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');const t=ke;ke=e.TRUSTED_TYPES_POLICY;try{Ce=ze("")}catch(e){throw ke=t,e}}else null===e.TRUSTED_TYPES_POLICY?(ke=void 0,Ce=""):(void 0===ke&&(Re||(De=function(e,t){if("object"!=typeof e||"function"!=typeof e.createPolicy)return null;let n=null;const r="data-tt-policy-suffix";t&&t.hasAttribute(r)&&(n=t.getAttribute(r));const o="dompurify"+(n?"#"+n:"");try{return e.createPolicy(o,{createHTML:e=>e,createScriptURL:e=>e})}catch(e){return console.warn("TrustedTypes policy "+o+" could not be created."),null}}(f,i),Re=!0),ke=De),ke&&"string"==typeof Ce&&(Ce=ze("")));g&&g(e),$t=e},Zt=G({},[...K,...Z,...J]),Jt=G({},[...Q,...ee]),Qt=function(e){_(n.removed,{element:e});try{A(e).removeChild(e)}catch(t){if(h(e),!A(e))throw B("a node selected for removal could not be detached from its tree and cannot be safely returned; refusing to sanitize in place")}},en=function(e,t,n){try{y(e,t)}catch(t){try{e.removeAttribute(n)}catch(e){}}},tn=function(e){on(e);const t=T(e);if(t){const e=[];w(t,t=>{_(e,t)}),w(e,e=>{try{h(e)}catch(e){}})}const n=Y(e);if(n)for(let t=n.length-1;t>=0;--t){const r=n[t],o=r&&r.name;"string"==typeof o&&en(e,r,o)}},nn=function(e,t,r){if(!r)try{r=t.getAttributeNode(e)}catch(e){r=null}_(n.removed,{attribute:r||null,from:t});try{r?y(t,r):t.removeAttribute(e)}catch(n){try{t.removeAttribute(e)}catch(e){}}if("is"===e)if(gt||bt)try{Qt(t)}catch(e){}else try{t.setAttribute(e,"")}catch(e){}},rn=function(e){const t=Y(e);if(t)for(let n=t.length-1;n>=0;--n){const r=t[n],o=r&&r.name;"string"!=typeof o||et[qt(o)]||en(e,r,o)}},on=function(e){const t=[e];for(;t.length>0;){const e=t.pop();1===Oe(e)&&rn(e);const n=T(e);if(n)for(let e=n.length-1;e>=0;--e)t.push(n[e])}},an=function(e,t){return!!ft&&("patchsrc"===e||"for"===e&&"label"!==t&&"output"!==t)},ln=function(e){let t=null,n=null;if(yt)e="<remove></remove>"+e;else{const t=C(e,/^[\r\n\t ]+/);n=t&&t[0]}"application/xhtml+xml"===Yt&&zt===Lt&&(e='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+e+"</body></html>");const o=ke?ze(e):e;if(zt===Lt)try{t=(new u).parseFromString(o,Yt)}catch(e){}if(!t||!t.documentElement){t=Me.createDocument(zt,"template",null);try{t.documentElement.innerHTML=Pt?Ce:o}catch(e){}}const i=t.body||t.documentElement;return e&&n&&i.insertBefore(r.createTextNode(n),i.childNodes[0]||null),zt===Lt?Fe.call(t,pt?"html":"body")[0]:pt?t.documentElement:i},cn=function(e){const t=_e?_e(e):e.ownerDocument;return je.call(t||e,e,s.SHOW_ELEMENT|s.SHOW_COMMENT|s.SHOW_TEXT|s.SHOW_PROCESSING_INSTRUCTION|s.SHOW_CDATA_SECTION,null)},sn=function(e){return e=R(e,We," "),e=R(e,Ye," "),R(e,Ge," ")},un=function(e){var t;e.normalize();const n=_e?_e(e):e.ownerDocument,r=je.call(n||e,e,s.SHOW_TEXT|s.SHOW_COMMENT|s.SHOW_CDATA_SECTION|s.SHOW_PROCESSING_INSTRUCTION,null);let o=r.nextNode();for(;o;)o.data=sn(o.data),o=r.nextNode();const i=null===(t=e.querySelectorAll)||void 0===t?void 0:t.call(e,"template");i&&w(i,e=>{pn(e.content)&&un(e.content)})},fn=function(e){const t=Se?Se(e):null;return"string"==typeof t&&"form"===qt(t)&&("string"!=typeof e.nodeName||"string"!=typeof e.textContent||"function"!=typeof e.removeChild||e.attributes!==Y(e)||"function"!=typeof e.removeAttribute||"function"!=typeof e.removeAttributeNode||"function"!=typeof e.getAttributeNode||"function"!=typeof e.setAttribute||"string"!=typeof e.namespaceURI||"function"!=typeof e.insertBefore||"function"!=typeof e.hasChildNodes||e.nodeType!==q(e)||e.childNodes!==T(e))},pn=function(e){if(!q||"object"!=typeof e||null===e)return!1;try{return 11===q(e)}catch(e){return!1}},mn=function(e){if(!q||"object"!=typeof e||null===e)return!1;try{return"number"==typeof q(e)}catch(e){return!1}};function dn(e,t,r){0!==e.length&&w(e,e=>{e.call(n,t,r,$t)})}const hn=function(e,t){if(e instanceof RegExp)return H(e,t);if(e instanceof Function){for(var n=arguments.length,r=new Array(n>2?n-2:0),o=2;o<n;o++)r[o-2]=arguments[o];return Boolean(e(t,...r))}return!1},yn=function(e,t,n,r){return 0===e.length?t:t===n||t===r?$(t):t},gn=function(e,t){return e!==t&&null===A(e)&&(xt&&on(e),!0)},bn=function(e,t){if(dn(Be.beforeSanitizeElements,e,null),gn(e,t))return!0;if(fn(e))return Qt(e),!0;const r=qt(Ne(e));if(Je=yn(Be.uponSanitizeElement,Je,Qe,dt),dn(Be.uponSanitizeElement,e,{tagName:r,allowedTags:Je}),gn(e,t))return!0;if(function(e,t){return!!(ft&&e.hasChildNodes()&&!mn(e.firstElementChild)&&H(ye,e.textContent)&&H(ye,e.innerHTML))||!!(ft&&e.namespaceURI===Lt&&Te[t]&&(mn(e.firstElementChild)||"string"==typeof e.textContent&&H(Ae[t],e.textContent)))||7===e.nodeType||!(!ft||8!==e.nodeType||!H(ge,e.data))}(e,r))return Qt(e),!0;if(rt[r]||!(it.tagCheck instanceof Function&&it.tagCheck(r))&&!Je[r]){const n=function(e,t,n){if(!rt[t]&&Tn(t)&&hn(nt.tagNameCheck,t))return!1;if(wt&&!_t[t]){const t=A(e),r=T(e);if(r&&t)for(let o=r.length-1;o>=0;--o){const i=e===n?d(r[o],!0):r[o];t.insertBefore(i,S(e))}}return Qt(e),!0}(e,r,t);return!(!1!==n||(dn(Be.afterSanitizeElements,e,null),!gn(e,t)))||n}if(1===Oe(e)&&!function(e){let t=A(e);t&&t.tagName||(t={namespaceURI:zt,tagName:"template"});const n=k(e.tagName),r=k(t.tagName);return!!Mt[e.namespaceURI]&&(e.namespaceURI===It?function(e,t,n){return t.namespaceURI===Lt?"svg"===e:t.namespaceURI===Rt?"svg"===e&&("annotation-xml"===n||Ft[n]):Boolean(Zt[e])}(n,t,r):e.namespaceURI===Rt?function(e,t,n){return t.namespaceURI===Lt?"math"===e:t.namespaceURI===It?"math"===e&&Bt[n]:Boolean(Jt[e])}(n,t,r):e.namespaceURI===Lt?function(e,t,n){return!(t.namespaceURI===It&&!Bt[n])&&!(t.namespaceURI===Rt&&!Ft[n])&&!Jt[e]&&(Wt[e]||!Zt[e])}(n,t,r):!("application/xhtml+xml"!==Yt||!Mt[e.namespaceURI]))}(e))return Qt(e),!0;if(("noscript"===r||"noembed"===r||"noframes"===r)&&H(be,e.innerHTML))return Qt(e),!0;if(ut&&3===e.nodeType){const t=sn(e.textContent);e.textContent!==t&&(_(n.removed,{element:e.cloneNode()}),e.textContent=t)}return dn(Be.afterSanitizeElements,e,null),gn(e,t)},vn=function(e,t,n){if(ot[t])return!1;if(an(t,e))return!1;if(St&&("id"===t||"name"===t)&&(n in r||n in Vt))return!1;const o=et[t]||it.attributeCheck instanceof Function&&it.attributeCheck(t,e);return!(!lt||!H(qe,t))||!(!at||!H($e,t))||(o?!(!Dt[t]&&!H(Ze,R(n,Xe,""))&&("src"!==t&&"xlink:href"!==t&&"href"!==t||"script"===e||0!==I(n,"data:")||!Nt[e])&&(!ct||H(Ve,R(n,Xe,"")))&&n):Tn(e)&&hn(nt.tagNameCheck,e)&&hn(nt.attributeNameCheck,t,e)||"is"===t&&nt.allowCustomizedBuiltInElements&&hn(nt.tagNameCheck,n))},Sn=G({},["annotation-xml","color-profile","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","missing-glyph"]),Tn=function(e){return!Sn[k(e)]&&H(Ke,e)},An=function(e,t,n,r){if(ke&&"object"==typeof f&&"function"==typeof f.getAttributeType&&!n)switch(f.getAttributeType(e,t)){case"TrustedHTML":return ze(r);case"TrustedScriptURL":return function(e){Le(),Ie++;try{return ke.createScriptURL(e)}finally{Ie--}}(r)}return r},wn=function(e,t,n,r){try{return n?e.setAttributeNS(n,t,r):e.setAttribute(t,r),!fn(e)||(Qt(e),!1)}catch(n){return nn(t,e),!1}},xn=function(e,t){if(dn(Be.beforeSanitizeAttributes,e,null),gn(e,t))return;const r=e.attributes;if(!r||fn(e))return;et=yn(Be.uponSanitizeAttribute,et,tt,ht);const o={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:et,forceKeepAttr:void 0};let i=r.length;const a=qt(e.nodeName);for(;i--;){const t=r[i],l=t.name,c=t.namespaceURI,s=t.value,u=qt(l),f=s;let p="value"===l?f:L(f),m=!1;o.attrName=u,o.attrValue=p,o.keepAttr=!0,o.forceKeepAttr=void 0,dn(Be.uponSanitizeAttribute,e,o),p=o.attrValue,!Tt||"id"!==u&&"name"!==u||0===I(p,At)||(nn(l,e,t),p=At+p,m=!0),ft&&H(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,p)||"attributename"===u&&C(p,"href")?nn(l,e,t):o.forceKeepAttr||(!o.keepAttr||!st&&H(ve,p)?nn(l,e,t):(ut&&(p=sn(p)),vn(a,u,p)?(p=An(a,u,c,p),p!==f&&wn(e,l,c,p)&&m&&E(n.removed)):nn(l,e,t)))}dn(Be.afterSanitizeAttributes,e,null),gn(e,t)},En=function(e){let t=null;const n=cn(e);for(dn(Be.beforeSanitizeShadowDOM,e,null);t=n.nextNode();)if(dn(Be.uponSanitizeShadowNode,t,null),bn(t,e),xn(t,e),pn(t.content)&&En(t.content),1===Oe(t)){const e=W(t);pn(e)&&(_n(e),En(e))}dn(Be.afterSanitizeShadowDOM,e,null)},_n=function(e){const t=[{node:e,shadow:null}];for(;t.length>0;){const e=t.pop();if(e.shadow){En(e.shadow);continue}const n=e.node,r=1===Oe(n),o=T(n);if(o)for(let e=o.length-1;e>=0;--e)t.push({node:o[e],shadow:null});if(r){const e=Se?Se(n):null;if("string"==typeof e&&"template"===qt(e)){const e=n.content;pn(e)&&t.push({node:e,shadow:null})}}if(r){const e=W(n);pn(e)&&t.push({node:null,shadow:e},{node:e,shadow:null})}}};return n.sanitize=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=null,i=null,a=null,l=null;if(Pt=!e,Pt&&(e="\x3c!--\x3e"),"string"!=typeof e&&!mn(e)&&"string"!=typeof(e=function(e){switch(typeof e){case"string":return e;case"number":return z(e);case"boolean":return P(e);case"bigint":return M?M(e):"0";case"symbol":return j?j(e):"Symbol()";case"undefined":default:return F(e);case"function":case"object":{if(null===e)return F(e);const t=e,n=V(t,"toString");if("function"==typeof n){const e=n(t);return"string"==typeof e?e:F(e)}return F(e)}}}(e)))throw B("dirty is not a string, aborting");if(!n.isSupported)return e;mt?(Je=dt,et=ht):Kt(t),(Be.uponSanitizeElement.length>0||Be.uponSanitizeAttribute.length>0)&&(Je=$(Je)),Be.uponSanitizeAttribute.length>0&&(et=$(et)),n.removed=[];const c=xt&&"string"!=typeof e&&mn(e);if(c){!function(e){if(!ft)return;const t=[e];for(;t.length>0;){const e=t.pop(),n=Oe(e);if(7===n||8===n&&H(ge,e.data)){try{h(e)}catch(e){}continue}if(1===n){const t=e,n=qt(Ne(e));try{t.hasAttribute&&t.hasAttribute("patchsrc")&&t.removeAttribute("patchsrc"),t.hasAttribute&&t.hasAttribute("for")&&an("for",n)&&t.removeAttribute("for")}catch(e){}}const r=T(e);if(r)for(let e=r.length-1;e>=0;--e)t.push(r[e])}}(e);const t=Ne(e);if("string"==typeof t){const n=qt(t);if(!Je[n]||rt[n])throw tn(e),B("root node is forbidden and cannot be sanitized in-place")}if(fn(e))throw tn(e),B("root node is clobbered and cannot be sanitized in-place");try{_n(e)}catch(t){throw tn(e),t}}else if(mn(e))r=ln("\x3c!----\x3e"),i=r.ownerDocument.importNode(e,!0),1===i.nodeType&&"BODY"===i.nodeName||"HTML"===i.nodeName?r=i:r.appendChild(i),_n(r);else{if(!gt&&!ut&&!pt&&-1===e.indexOf("<"))return ke&&vt?ze(e):e;if(r=ln(e),!r)return gt?null:vt?Ce:""}r&&yt&&Qt(r.firstChild);const s=c?e:r;try{const e=cn(s);for(;a=e.nextNode();)bn(a,s),xn(a,s),pn(a.content)&&En(a.content)}catch(t){throw c&&(tn(e),w(n.removed,e=>{e.element&&on(e.element)})),t}if(c){let t=!1;if(w(n.removed,n=>{n.element&&(n.element===e&&(t=!0),on(n.element))}),t)throw B("a node selected for removal could not be safely returned; refusing to sanitize in place");return ut&&un(e),e}if(gt){if(ut&&un(r),bt)for(l=Ue.call(r.ownerDocument);r.firstChild;)l.appendChild(r.firstChild);else l=r;return(et.shadowroot||et.shadowrootmode)&&(l=He.call(o,l,!0)),l}let u=pt?r.outerHTML:r.innerHTML;return pt&&Je["!doctype"]&&r.ownerDocument&&r.ownerDocument.doctype&&r.ownerDocument.doctype.name&&H(de,r.ownerDocument.doctype.name)&&(u="<!DOCTYPE "+r.ownerDocument.doctype.name+">\n"+u),ut&&(u=sn(u)),ke&&vt?ze(u):u},n.setConfig=function(){Kt(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}),mt=!0,dt=Je,ht=et},n.clearConfig=function(){$t=null,mt=!1,dt=null,ht=null,ke=De,Ce=""},n.isValidAttribute=function(e,t,n){$t||Kt({});const r=qt(e),o=qt(t);return vn(r,o,n)},n.addHook=function(e,t){"function"==typeof t&&U(Be,e)&&_(Be[e],t)},n.removeHook=function(e,t){if(U(Be,e)){if(void 0!==t){const n=x(Be[e],t);return-1===n?void 0:O(Be[e],n,1)[0]}return E(Be[e])}},n.removeHooks=function(e){U(Be,e)&&(Be[e]=[])},n.removeAllHooks=function(){Be={afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},n}();function Oe({label:e,Type:t="Primary",Variant:n="Default",Outline:r=!1,State:i="Default",href:a="#",onClick:l,className:c,...s}){const u="Disabled"===i,f=["mg-button","CTA"===n&&"mg-button-cta","mg-button-"+("Secondary"===t?"secondary":"primary"),r&&"mg-button-outline",u&&"disabled",c].filter(Boolean).join(" ");return(0,o().jsx)("a",{className:f,...s,...u?{"aria-disabled":"true",tabIndex:-1}:{href:a,onClick:l},children:e})}i(),Oe.propTypes={label:l().string.isRequired,Type:l().oneOf(["Primary","Secondary"]),Variant:l().oneOf(["Default","CTA"]),Outline:l().bool,State:l().oneOf(["Default","Disabled"]),href:l().string,onClick:l().func,className:l().string};const Ne=(...e)=>e.filter(Boolean).join(" ")||null,ke=[];function De({eyebrow:t,headline:n,headlineSize:r="600",headlineLevel:i=2,text:a,buttons:l=ke,variant:c="primary",tone:s="strong",backgroundColor:u,padding:f,image:p,imageAlt:m="",centered:d=!0,layout:h="stacked",className:y,children:g}){const b=!!p,v="inline"===h&&null==g,S=e(),T=`h${i}`;return(0,o().jsx)("section",{className:Ne("mg-cta",c&&`mg-cta--${c}`,"soft"===s&&"mg-cta--soft",v&&"mg-cta--inline",b&&"mg-cta--with-image",!b&&d&&"inline"!==h&&"mg-cta--centered",y),...n?{"aria-labelledby":S}:{"aria-label":"Call to action"},...(u||f)&&{style:{...u&&{"--mg-cta-bg":u},...f&&{padding:f}}},children:(0,o().jsxs)("div",{className:"mg-cta__inner mg-container",children:[(0,o().jsxs)("div",{className:"mg-cta__body",children:[(0,o().jsxs)("div",{className:"mg-cta__content",children:[t&&(0,o().jsx)("p",{className:"mg-cta__eyebrow",children:t}),n&&(0,o().jsx)(T,{id:S,className:Ne("mg-cta__headline",`mg-u-font-size-${r}`),children:n}),a&&(0,o().jsx)("div",{className:"mg-cta__text",dangerouslySetInnerHTML:{__html:_e.sanitize(a)}})]}),null!=g&&(0,o().jsx)("div",{className:"mg-cta__custom-content",children:g}),l.length>0&&(0,o().jsx)("div",{className:"mg-cta__actions",children:l.map((e,t)=>(0,o().jsx)(Oe,{label:e.label,href:e.url||"#",Type:e.type,Variant:e.variant,Outline:e.outline,target:e.target,rel:e.rel},t))})]}),b&&(0,o().jsx)("div",{className:"mg-cta__image",children:(0,o().jsx)("img",{src:p,alt:m})})]})})}De.propTypes={children:l().node,tone:l().oneOf(["strong","soft"]),eyebrow:l().string,headline:l().string,headlineSize:l().string,headlineLevel:l().oneOf([2,3,4,5,6]),text:l().string,buttons:l().arrayOf(l().shape({label:l().string.isRequired,url:l().string,type:l().oneOf(["Primary","Secondary"]),variant:l().oneOf(["Default","CTA"]),outline:l().bool,target:l().string,rel:l().string})),variant:l().oneOf(["primary","secondary","tertiary","quaternary"]),backgroundColor:l().string,padding:l().string,image:l().string,imageAlt:l().string,centered:l().bool,layout:l().oneOf(["stacked","inline"]),className:l().string};const Ce=De;function Re(e){const{dataset:t}=e;let n=[];try{n=t.buttons?JSON.parse(t.buttons):[]}catch{n=[]}const r=parseInt(t.headlineLevel,10),o=r>=2&&r<=6?r:2;return{eyebrow:t.eyebrow||"",headline:t.headline||"",headlineSize:t.headlineSize||"600",headlineLevel:o,text:t.text||"",buttons:n,variant:t.variant||"primary",tone:"soft"===t.tone?"soft":"strong",backgroundColor:t.backgroundColor||void 0,padding:t.padding||void 0,image:t.image||void 0,imageAlt:t.imageAlt||"",centered:"false"!==t.centered,layout:"inline"===t.layout?"inline":"stacked",className:t.className||void 0}}export{De as TextCta,Ce as default,Re as fromElement};
|
|
9
|
+
import{useId as t}from"react";var e={2694(t,e,n){var r=n(6925);function o(){}function i(){}i.resetWarningCache=o,t.exports=function(){function t(t,e,n,o,i,a){if(a!==r){var l=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw l.name="Invariant Violation",l}}function e(){return t}t.isRequired=t;var n={array:t,bigint:t,bool:t,func:t,number:t,object:t,string:t,symbol:t,any:t,arrayOf:e,element:t,elementType:t,instanceOf:e,node:t,objectOf:e,oneOf:e,oneOfType:e,shape:e,exact:e,checkPropTypes:i,resetWarningCache:o};return n.PropTypes=n,n}},5556(t,e,n){t.exports=n(2694)()},6925(t){t.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"}};const n={};function r(t){const o=n[t];if(void 0!==o)return o.exports;const i=n[t]={exports:{}};return e[t](i,i.exports,r),i.exports}r.n=t=>{const e=t&&t.__esModule?()=>t.default:()=>t;return r.d(e,{a:e}),e},r.cw=t=>{var e;return()=>{if(t){var n=t;t=0,e={exports:{}},n.call(e.exports,e,e.exports)}return e.exports}},r.d=(t,e)=>{for(var n in e)r.o(e,n)&&!r.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},r.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e);var o=r.cw(function(t,e){var n=Symbol.for("react.transitional.element");function r(t,e,r){var o=null;if(void 0!==r&&(o=""+r),void 0!==e.key&&(o=""+e.key),"key"in e)for(var i in r={},e)"key"!==i&&(r[i]=e[i]);else r=e;return e=r.ref,{$$typeof:n,type:t,key:o,ref:void 0!==e?e:null,props:r}}Symbol.for("react.fragment"),e.jsx=r,e.jsxs=r}),i=r.cw(function(t,e){t.exports=o()}),a=r(5556),l=r.n(a);function c(t,e){this.v=t,this.k=e}function s(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function u(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var r,o,i,a,l=[],c=!0,s=!1;try{if(i=(n=n.call(t)).next,0===e){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=i.call(n)).done)&&(l.push(r.value),l.length!==e);c=!0);}catch(t){s=!0,o=t}finally{try{if(!c&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(s)throw o}}return l}}(t,e)||function(t,e){if(t){if("string"==typeof t)return s(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?s(t,e):void 0}}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function f(t){var e,n;function r(e,n){try{var i=t[e](n),a=i.value,l=a instanceof c;Promise.resolve(l?a.v:a).then(function(n){if(l){var c="return"===e&&a.k?e:"next";if(!a.k||n.done)return r(c,n);n=t[c](n).value}o(!!i.done,n)},function(t){r("throw",t)})}catch(t){o(2,t)}}function o(t,o){2===t?e.reject(o):e.resolve({value:o,done:t}),(e=e.next)?r(e.key,e.arg):n=null}this._invoke=function(t,o){return new Promise(function(i,a){var l={key:t,arg:o,resolve:i,reject:a,next:null};n?n=n.next=l:(e=n=l,r(t,o))})},"function"!=typeof t.return&&(this.return=void 0)}f.prototype["function"==typeof Symbol&&Symbol.asyncIterator||"@@asyncIterator"]=function(){return this},f.prototype.next=function(t){return this._invoke("next",t)},f.prototype.throw=function(t){return this._invoke("throw",t)},f.prototype.return=function(t){return this._invoke("return",t)};const p=Object.entries,m=Object.setPrototypeOf,d=Object.isFrozen,h=Object.getPrototypeOf,y=Object.getOwnPropertyDescriptor;let g=Object.freeze,b=Object.seal,v=Object.create,S="undefined"!=typeof Reflect&&Reflect,T=S.apply,A=S.construct;g||(g=function(t){return t}),b||(b=function(t){return t}),T||(T=function(t,e){for(var n=arguments.length,r=new Array(n>2?n-2:0),o=2;o<n;o++)r[o-2]=arguments[o];return t.apply(e,r)}),A||(A=function(t){for(var e=arguments.length,n=new Array(e>1?e-1:0),r=1;r<e;r++)n[r-1]=arguments[r];return new t(...n)});const w=$(Array.prototype.forEach);Array.prototype.indexOf;const x=$(Array.prototype.lastIndexOf),E=$(Array.prototype.pop),_=$(Array.prototype.push),O=$(Array.prototype.slice),N=$(Array.prototype.splice),k=Array.isArray,D=V(Set),C=$(Set.prototype.add),R=$(Set.prototype.has),I=$(String.prototype.toLowerCase),L=$(String.prototype.toString),z=$(String.prototype.match),P=$(String.prototype.replace),M=$(String.prototype.indexOf),j=$(String.prototype.trim),U=$(Number.prototype.toString),F=$(Boolean.prototype.toString),H="undefined"==typeof BigInt?null:$(BigInt.prototype.toString),B="undefined"==typeof Symbol?null:$(Symbol.prototype.toString),W=$(Object.prototype.hasOwnProperty),Y=$(Object.prototype.toString),G=$(RegExp.prototype.test),q=V(TypeError);function $(t){return function(e){e instanceof RegExp&&(e.lastIndex=0);for(var n=arguments.length,r=new Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];return T(t,e,r)}}function V(t){return function(){for(var e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];return A(t,n)}}function X(t,e){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:I;if(m&&m(t,null),!k(e))return t;let r=e.length;for(;r--;){let o=e[r];if("string"==typeof o){const t=n(o);t!==o&&(d(e)||(e[r]=t),o=t)}t[o]=!0}return t}function K(t){for(let e=0;e<t.length;e++)W(t,e)||(t[e]=null);return t}function Z(t){const e=v(null);for(const r of p(t)){var n=u(r,2);const o=n[0],i=n[1];W(t,o)&&(k(i)?e[o]=K(i):i&&"object"==typeof i&&i.constructor===Object?e[o]=Z(i):e[o]=i)}return e}function J(t,e){for(;null!==t;){const n=y(t,e);if(n){if(n.get)return $(n.get);if("function"==typeof n.value)return $(n.value)}t=h(t)}return function(){return null}}const Q=g(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","search","section","select","shadow","slot","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),tt=g(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","enterkeyhint","exportparts","filter","font","g","glyph","glyphref","hkern","image","inputmode","line","lineargradient","marker","mask","metadata","mpath","part","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),et=g(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),nt=g(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),rt=g(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),ot=g(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),it=g(["#text"]),at=g(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","command","commandfor","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","exportparts","face","for","headers","height","hidden","high","href","hreflang","id","inert","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","part","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","slot","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns"]),lt=g(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dominant-baseline","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","mask-type","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","pointer-events","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-orientation","text-rendering","textlength","type","u1","u2","unicode","values","vector-effect","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),ct=g(["accent","accentunder","align","bevelled","close","columnalign","columnlines","columnspacing","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lquote","lspace","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),st=g(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),ut=b(/{{[\w\W]*|^[\w\W]*}}/g),ft=b(/<%[\w\W]*|^[\w\W]*%>/g),pt=b(/\${[\w\W]*/g),mt=b(/^data-[\-\w.\u00B7-\uFFFF]+$/),dt=b(/^aria-[\-\w]+$/),ht=b(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),yt=b(/^(?:\w+script|data):/i),gt=b(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),bt=b(/^html$/i),vt=b(/^[a-z][.\w]*(-[.\w]+)+$/i),St=b(/<[/\w!]/g),Tt=b(/<[/\w]/g),At=b(/<\/no(script|embed|frames)/i),wt=b(/\/>/i),xt=g(X({},["style","script","xmp","iframe","noembed","noframes","plaintext","noscript"])),Et=function(){return"undefined"==typeof window?null:window},_t=function(t,e,n,r){return W(t,e)&&k(t[e])?X(r.base?Z(r.base):{},t[e],r.transform):n},Ot=function(t,e,n){const r=W(t,e)?t[e]:void 0;return r&&"object"==typeof r?Z(r):n()};var Nt=function t(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Et();const n=e=>t(e);if(n.version="3.4.17",n.removed=[],!e||!e.document||9!==e.document.nodeType||!e.Element)return n.isSupported=!1,n;let r=e.document;const o=r,i=o.currentScript;e.DocumentFragment;const a=e.HTMLTemplateElement,l=e.Node,c=e.Element,s=e.NodeFilter;void 0===e.NamedNodeMap&&(e.NamedNodeMap||e.MozNamedAttrMap),e.HTMLFormElement;const u=e.DOMParser,f=e.trustedTypes,m=c.prototype,d=J(m,"cloneNode"),S=J(m,"remove"),T=J(m,"removeAttributeNode"),A=J(m,"nextSibling"),V=J(m,"childNodes"),K=J(m,"parentNode"),Nt=J(m,"shadowRoot"),kt=J(m,"attributes"),Dt=l&&l.prototype?J(l.prototype,"nodeType"):null,Ct=l&&l.prototype?J(l.prototype,"nodeName"):null,Rt=l&&l.prototype?J(l.prototype,"ownerDocument"):null,It=function(t){return Dt?Dt(t):t.nodeType},Lt=function(t){return Ct?Ct(t):t.nodeName},zt=function(t){for(;null!==t;){const e=y(t,"namespaceURI");if(e)return e.get?$(e.get):null;t=h(t)}return null}(m),Pt=function(t){return zt?zt(t):t.namespaceURI};if("function"==typeof a){const t=r.createElement("template");t.content&&t.content.ownerDocument&&(r=t.content.ownerDocument)}let Mt,jt,Ut="",Ft=!1,Ht=0;const Bt=function(){if(Ht>0)throw q('A configured TRUSTED_TYPES_POLICY callback (createHTML or createScriptURL) must not call DOMPurify.sanitize, as that causes infinite recursion. Do not pass a policy whose callbacks wrap DOMPurify as TRUSTED_TYPES_POLICY; see the "DOMPurify and Trusted Types" section of the README.')},Wt=function(t){Bt(),Ht++;try{return Mt.createHTML(t)}finally{Ht--}},Yt=r,Gt=Yt.implementation,qt=Yt.createNodeIterator,$t=Yt.createDocumentFragment,Vt=Yt.getElementsByTagName,Xt=o.importNode;let Kt={afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]};n.isSupported="function"==typeof p&&"function"==typeof K&&Gt&&void 0!==Gt.createHTMLDocument;const Zt=ut,Jt=ft,Qt=pt,te=mt,ee=dt,ne=yt,re=gt,oe=vt;let ie=ht,ae=null;const le=X({},[...Q,...tt,...et,...rt,...it]);let ce=null;const se=X({},[...at,...lt,...ct,...st]);let ue=Object.seal(v(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),fe=null,pe=null;const me=Object.seal(v(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let de=!0,he=!0,ye=!1,ge=!0,be=!1,ve=!0,Se=!1,Te=!1,Ae=null,we=null,xe=!1,Ee=!1,_e=!1,Oe=!1,Ne=!0,ke=!1;const De="user-content-";let Ce=!0,Re=!1,Ie=null,Le={},ze=null;const Pe=X({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","selectedcontent","style","svg","template","thead","title","video","xmp"]);let Me=null;const je=X({},["audio","video","img","source","image","track"]);let Ue=null;const Fe=X({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),He="http://www.w3.org/1998/Math/MathML",Be="http://www.w3.org/2000/svg",We="http://www.w3.org/1999/xhtml";let Ye=We,Ge=!1,qe=null;const $e=X({},[He,Be,We],L),Ve=g(["mi","mo","mn","ms","mtext"]);let Xe=X({},Ve);const Ke=g(["annotation-xml"]);let Ze=X({},Ke);const Je=X({},["title","style","font","a","script"]);let Qe=null;const tn=["application/xhtml+xml","text/html"];let en=null,nn=null;const rn=r.createElement("form"),on=function(t){return t instanceof RegExp||t instanceof Function},an=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(nn&&nn===t)return;t&&"object"==typeof t||(t={}),t=Z(t),Qe=-1===tn.indexOf(t.PARSER_MEDIA_TYPE)?"text/html":t.PARSER_MEDIA_TYPE,en="application/xhtml+xml"===Qe?L:I,ae=_t(t,"ALLOWED_TAGS",le,{transform:en}),ce=_t(t,"ALLOWED_ATTR",se,{transform:en}),qe=_t(t,"ALLOWED_NAMESPACES",$e,{transform:L}),Ue=_t(t,"ADD_URI_SAFE_ATTR",Fe,{transform:en,base:Fe}),Me=_t(t,"ADD_DATA_URI_TAGS",je,{transform:en,base:je}),ze=_t(t,"FORBID_CONTENTS",Pe,{transform:en}),fe=_t(t,"FORBID_TAGS",Z({}),{transform:en}),pe=_t(t,"FORBID_ATTR",Z({}),{transform:en}),Le=!!W(t,"USE_PROFILES")&&(t.USE_PROFILES&&"object"==typeof t.USE_PROFILES?Z(t.USE_PROFILES):t.USE_PROFILES),de=!1!==t.ALLOW_ARIA_ATTR,he=!1!==t.ALLOW_DATA_ATTR,ye=t.ALLOW_UNKNOWN_PROTOCOLS||!1,ge=!1!==t.ALLOW_SELF_CLOSE_IN_ATTR,be=t.SAFE_FOR_TEMPLATES||!1,ve=!1!==t.SAFE_FOR_XML,Se=t.WHOLE_DOCUMENT||!1,Ee=t.RETURN_DOM||!1,_e=t.RETURN_DOM_FRAGMENT||!1,Oe=t.RETURN_TRUSTED_TYPE||!1,xe=t.FORCE_BODY||!1,Ne=!1!==t.SANITIZE_DOM,ke=t.SANITIZE_NAMED_PROPS||!1,Ce=!1!==t.KEEP_CONTENT,Re=t.IN_PLACE||!1,ie=function(t){try{return G(t,""),!0}catch(t){return!1}}(t.ALLOWED_URI_REGEXP)?t.ALLOWED_URI_REGEXP:ht,Ye="string"==typeof t.NAMESPACE?t.NAMESPACE:We,Xe=Ot(t,"MATHML_TEXT_INTEGRATION_POINTS",()=>X({},Ve)),Ze=Ot(t,"HTML_INTEGRATION_POINTS",()=>X({},Ke));const e=Ot(t,"CUSTOM_ELEMENT_HANDLING",()=>v(null));if(ue=v(null),W(e,"tagNameCheck")&&on(e.tagNameCheck)&&(ue.tagNameCheck=e.tagNameCheck),W(e,"attributeNameCheck")&&on(e.attributeNameCheck)&&(ue.attributeNameCheck=e.attributeNameCheck),W(e,"allowCustomizedBuiltInElements")&&"boolean"==typeof e.allowCustomizedBuiltInElements&&(ue.allowCustomizedBuiltInElements=e.allowCustomizedBuiltInElements),b(ue),be&&(he=!1),_e&&(Ee=!0),Le&&(ae=X({},it),ce=v(null),!0===Le.html&&(X(ae,Q),X(ce,at)),!0===Le.svg&&(X(ae,tt),X(ce,lt),X(ce,st)),!0===Le.svgFilters&&(X(ae,et),X(ce,lt),X(ce,st)),!0===Le.mathMl&&(X(ae,rt),X(ce,ct),X(ce,st))),me.tagCheck=null,me.attributeCheck=null,W(t,"ADD_TAGS")&&("function"==typeof t.ADD_TAGS?me.tagCheck=t.ADD_TAGS:k(t.ADD_TAGS)&&(ae===le&&(ae=Z(ae)),X(ae,t.ADD_TAGS,en))),W(t,"ADD_ATTR")&&("function"==typeof t.ADD_ATTR?me.attributeCheck=t.ADD_ATTR:k(t.ADD_ATTR)&&(ce===se&&(ce=Z(ce)),X(ce,t.ADD_ATTR,en))),W(t,"ADD_FORBID_CONTENTS")&&k(t.ADD_FORBID_CONTENTS)&&(ze===Pe&&(ze=Z(ze)),X(ze,t.ADD_FORBID_CONTENTS,en)),Ce&&(ae["#text"]=!0),Se&&X(ae,["html","head","body"]),ae.table&&(X(ae,["tbody"]),delete fe.tbody),t.TRUSTED_TYPES_POLICY){if("function"!=typeof t.TRUSTED_TYPES_POLICY.createHTML)throw q('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if("function"!=typeof t.TRUSTED_TYPES_POLICY.createScriptURL)throw q('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');const e=Mt;Mt=t.TRUSTED_TYPES_POLICY;try{Ut=Wt("")}catch(t){throw Mt=e,t}}else null===t.TRUSTED_TYPES_POLICY?(Mt=void 0,Ut=""):(void 0===Mt&&(Ft||(jt=function(t,e){if("object"!=typeof t||"function"!=typeof t.createPolicy)return null;let n=null;const r="data-tt-policy-suffix";e&&e.hasAttribute(r)&&(n=e.getAttribute(r));const o="dompurify"+(n?"#"+n:"");try{return t.createPolicy(o,{createHTML:t=>t,createScriptURL:t=>t})}catch(t){return console.warn("TrustedTypes policy "+o+" could not be created."),null}}(f,i),Ft=!0),Mt=jt),Mt&&"string"==typeof Ut&&(Ut=Wt("")));g&&g(t),nn=t},ln=X({},[...tt,...et,...nt]),cn=X({},[...rt,...ot]),sn=function(t){_(n.removed,{element:t});try{K(t).removeChild(t)}catch(e){if(S(t),!K(t))throw q("a node selected for removal could not be detached from its tree and cannot be safely returned; refusing to sanitize in place")}},un=function(t,e,n){try{T(t,e)}catch(e){try{t.removeAttribute(n)}catch(t){}}},fn=function(t){hn(t);const e=V(t);e&&w(O(e),t=>{try{S(t)}catch(t){}});const n=1===It(t)?kt(t):null;if(n)for(let e=n.length-1;e>=0;--e){const r=n[e],o=r&&r.name;"string"==typeof o&&un(t,r,o)}},pn=function(t,e,r){if(!r)try{r=e.getAttributeNode(t)}catch(t){r=null}_(n.removed,{attribute:r||null,from:e});try{r?T(e,r):e.removeAttribute(t)}catch(n){try{e.removeAttribute(t)}catch(t){}}if("is"===t)if(Ee||_e)try{sn(e)}catch(t){}else try{e.setAttribute(t,"")}catch(t){}},mn=function(t){const e=kt(t);if(e)for(let n=e.length-1;n>=0;--n){const r=e[n],o=r&&r.name;"string"!=typeof o||ce[en(o)]||un(t,r,o)}},dn=function(t,e){let n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];const r=[t];for(;r.length>0;){const t=r.pop();if(!1===e(t))continue;if(n&&1===It(t)){const e=Nt(t);_n(e)&&r.push(e)}const o=V(t);if(o)for(let t=o.length-1;t>=0;--t)r.push(o[t])}},hn=function(t){dn(t,t=>{1===It(t)&&mn(t)})},yn=function(t){const e=[];return dn(t,t=>{e.push(t)},!0),e},gn=function(t,e){let r=!1;return w(n.removed,e=>{e.element&&(r=r||e.element===t,hn(e.element))}),function(t,e){const n=D();w(yn(t),t=>{1===It(t)&&C(n,t)}),w(e,t=>{1!==It(t)||R(n,t)||mn(t)})}(t,e),r},bn=function(t,e,n,r){const o=Tn(t);let i;for(;i=o.nextNode();)R(r,i)&&!R(Ie,i)&&(e&&Nn(Kt.uponSanitizeShadowNode,i,null),Rn(i,n),Un(i,n),_n(i.content)&&Fn(i.content))},vn=function(t,e){return!!ve&&("patchsrc"===t||"for"===t&&"label"!==e&&"output"!==e)},Sn=function(t){let e=null,n=null;if(xe)t="<remove></remove>"+t;else{const e=z(t,/^[\r\n\t ]+/);n=e&&e[0]}"application/xhtml+xml"===Qe&&Ye===We&&(t='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+t+"</body></html>");const o=Mt?Wt(t):t;if(Ye===We)try{e=(new u).parseFromString(o,Qe)}catch(t){}if(!e||!e.documentElement){e=Gt.createDocument(Ye,"template",null);try{e.documentElement.innerHTML=Ge?Ut:o}catch(t){}}const i=e.body||e.documentElement;return t&&n&&i.insertBefore(r.createTextNode(n),i.childNodes[0]||null),Ye===We?Vt.call(e,Se?"html":"body")[0]:Se?e.documentElement:i},Tn=function(t){const e=Rt?Rt(t):t.ownerDocument;return qt.call(e||t,t,s.SHOW_ELEMENT|s.SHOW_COMMENT|s.SHOW_TEXT|s.SHOW_PROCESSING_INSTRUCTION|s.SHOW_CDATA_SECTION,null)},An=function(t){return t=P(t,Zt," "),t=P(t,Jt," "),P(t,Qt," ")},wn=function(t){var e;xn(t);const n=null===(e=t.querySelectorAll)||void 0===e?void 0:e.call(t,"template");n&&w(n,t=>{_n(t.content)&&wn(t.content)})},xn=function(t){t.normalize();const e=Rt?Rt(t):t.ownerDocument,n=qt.call(e||t,t,s.SHOW_TEXT|s.SHOW_COMMENT|s.SHOW_CDATA_SECTION|s.SHOW_PROCESSING_INSTRUCTION,null);let r=n.nextNode();for(;r;)r.data=An(r.data),r=n.nextNode()},En=function(t){const e=Ct?Ct(t):null;return"string"==typeof e&&"form"===en(e)&&("string"!=typeof t.nodeName||"string"!=typeof t.textContent||"function"!=typeof t.removeChild||t.attributes!==kt(t)||"function"!=typeof t.removeAttribute||"function"!=typeof t.removeAttributeNode||"function"!=typeof t.getAttributeNode||"function"!=typeof t.setAttribute||"string"!=typeof t.namespaceURI||"function"!=typeof t.insertBefore||"function"!=typeof t.hasChildNodes||t.nodeType!==Dt(t)||t.childNodes!==V(t))},_n=function(t){if(!Dt||"object"!=typeof t||null===t)return!1;try{return 11===Dt(t)}catch(t){return!1}},On=function(t){if(!Dt||"object"!=typeof t||null===t)return!1;try{return"number"==typeof Dt(t)}catch(t){return!1}};function Nn(t,e,r){0!==t.length&&w(t,t=>{t.call(n,e,r,nn)})}const kn=function(t,e){if(t instanceof RegExp)return G(t,e);if(t instanceof Function){for(var n=arguments.length,r=new Array(n>2?n-2:0),o=2;o<n;o++)r[o-2]=arguments[o];return Boolean(t(e,...r))}return!1},Dn=function(t,e,n,r){return 0===t.length?e:e===n||e===r?Z(e):e},Cn=function(t,e){return t!==e&&null===K(t)&&(Re&&hn(t),!0)},Rn=function(t,e){if(Ie&&C(Ie,t),Nn(Kt.beforeSanitizeElements,t,null),Cn(t,e))return!0;if(En(t))return sn(t),!0;const r=en(Lt(t));if(ae=Dn(Kt.uponSanitizeElement,ae,le,Ae),Nn(Kt.uponSanitizeElement,t,{tagName:r,allowedTags:ae}),Cn(t,e))return!0;if(function(t,e){return!!(ve&&t.hasChildNodes()&&!On(t.firstElementChild)&&G(St,t.textContent)&&G(St,t.innerHTML))||!!(ve&&xt[e]&&1===It(t)&&Pt(t)===We&&(On(t.firstElementChild)||"string"==typeof t.textContent&&G(St,t.textContent)))||7===t.nodeType||!(!ve||8!==t.nodeType||!G(Tt,t.data))}(t,r))return sn(t),!0;if(fe[r]||!(me.tagCheck instanceof Function&&me.tagCheck(r))&&!ae[r]){const n=function(t,e,n){if(!fe[e]&&zn(e)&&kn(ue.tagNameCheck,e))return!1;if(Ce&&!ze[e]&&!ze[I(e)]){const e=K(t),r=V(t);if(r&&e)for(let o=r.length-1;o>=0;--o){const i=t===n?d(r[o],!0):r[o];e.insertBefore(i,A(t))}}return sn(t),!0}(t,r,e);return!(!1!==n||(Nn(Kt.afterSanitizeElements,t,null),!Cn(t,e)))||n}if(1===It(t)&&!function(t){const e=Pt(t),n=I(Lt(t)),r=K(t);let o,i;return r&&1===It(r)?(o={namespaceURI:Pt(r)},i=I(Lt(r))):(o={namespaceURI:Ye},i="template"),!!qe[e]&&(e===Be?function(t,e,n){return e.namespaceURI===We?"svg"===t:e.namespaceURI===He?"svg"===t&&("annotation-xml"===n||Xe[n]):Boolean(ln[t])}(n,o,i):e===He?function(t,e,n){return e.namespaceURI===We?"math"===t:e.namespaceURI===Be?"math"===t&&Ze[n]:Boolean(cn[t])}(n,o,i):e===We?function(t,e,n){return!(e.namespaceURI===Be&&!Ze[n])&&!(e.namespaceURI===He&&!Xe[n])&&!cn[t]&&(Je[t]||!ln[t])}(n,o,i):!("application/xhtml+xml"!==Qe||!qe[e]))}(t))return sn(t),!0;if(("noscript"===r||"noembed"===r||"noframes"===r)&&G(At,t.innerHTML))return sn(t),!0;if(be&&3===t.nodeType){const e=An(t.textContent);t.textContent!==e&&(_(n.removed,{element:t.cloneNode()}),t.textContent=e)}return Nn(Kt.afterSanitizeElements,t,null),Cn(t,e)},In=function(t,e,n){if(pe[e])return!1;if(vn(e,t))return!1;if(Ne&&("id"===e||"name"===e)&&(n in r||n in rn))return!1;const o=ce[e]||me.attributeCheck instanceof Function&&me.attributeCheck(e,t);return!(!he||!G(te,e))||!(!de||!G(ee,e))||(o?!(!Ue[e]&&!G(ie,P(n,re,""))&&("src"!==e&&"xlink:href"!==e&&"href"!==e||"script"===t||0!==M(n,"data:")||!Me[t])&&(!ye||G(ne,P(n,re,"")))&&n):zn(t)&&kn(ue.tagNameCheck,t)&&kn(ue.attributeNameCheck,e,t)||"is"===e&&ue.allowCustomizedBuiltInElements&&kn(ue.tagNameCheck,n))},Ln=X({},["annotation-xml","color-profile","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","missing-glyph"]),zn=function(t){return!Ln[I(t)]&&G(oe,t)},Pn=function(t,e,n,r){if(Mt&&"object"==typeof f&&"function"==typeof f.getAttributeType&&!n)switch(f.getAttributeType(t,e)){case"TrustedHTML":return Wt(r);case"TrustedScriptURL":return function(t){Bt(),Ht++;try{return Mt.createScriptURL(t)}finally{Ht--}}(r)}return r},Mn=function(t,e,n,r){try{return n?t.setAttributeNS(n,e,r):t.setAttribute(e,r),!En(t)||(sn(t),!1)}catch(n){return pn(e,t),!1}},jn=function(t,e){return!(!ve||!G(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,e))||"attributename"===I(t)&&null!==z(e,"href")},Un=function(t,e){if(Nn(Kt.beforeSanitizeAttributes,t,null),Cn(t,e))return;const r=t.attributes;if(!r||En(t))return;ce=Dn(Kt.uponSanitizeAttribute,ce,se,we);const o={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:ce,forceKeepAttr:void 0};let i=r.length;const a=en(t.nodeName);for(;i--;){const e=r[i],l=e.name,c=e.namespaceURI,s=e.value,u=en(l),f=s;let p="value"===l?f:j(f),m=!1;o.attrName=u,o.attrValue=p,o.keepAttr=!0,o.forceKeepAttr=void 0,Nn(Kt.uponSanitizeAttribute,t,o),p=o.attrValue,!ke||"id"!==u&&"name"!==u||0===M(p,De)||(pn(l,t,e),p=De+p,m=!0),jn(l,p)?pn(l,t,e):o.forceKeepAttr||(!o.keepAttr||!ge&&G(wt,p)?pn(l,t,e):(be&&(p=An(p)),In(a,u,p)?(p=Pn(a,u,c,p),p!==f&&Mn(t,l,c,p)&&m&&E(n.removed)):pn(l,t,e)))}Nn(Kt.afterSanitizeAttributes,t,null),Cn(t,e)},Fn=function(t){let e=null;const n=Tn(t);for(Nn(Kt.beforeSanitizeShadowDOM,t,null);e=n.nextNode();)if(Nn(Kt.uponSanitizeShadowNode,e,null),Rn(e,t),Un(e,t),_n(e.content)&&Fn(e.content),1===It(e)){const t=Nt(e);_n(t)&&(Hn(t),Fn(t))}be&&xn(t),Nn(Kt.afterSanitizeShadowDOM,t,null)},Hn=function(t){const e=[{node:t,shadow:null}];for(;e.length>0;){const t=e.pop();if(t.shadow){Fn(t.shadow);continue}const n=t.node,r=1===It(n),o=V(n);if(o)for(let t=o.length-1;t>=0;--t)e.push({node:o[t],shadow:null});if(r){const t=Ct?Ct(n):null;if("string"==typeof t&&"template"===en(t)){const t=n.content;_n(t)&&e.push({node:t,shadow:null})}}if(r){const t=Nt(n);_n(t)&&e.push({node:null,shadow:t},{node:t,shadow:null})}}};return n.sanitize=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=null,i=null,a=null,l=null;if(Ge=!t,Ge&&(t="\x3c!--\x3e"),"string"!=typeof t&&!On(t)&&"string"!=typeof(t=function(t){switch(typeof t){case"string":return t;case"number":return U(t);case"boolean":return F(t);case"bigint":return H?H(t):"0";case"symbol":return B?B(t):"Symbol()";case"undefined":default:return Y(t);case"function":case"object":{if(null===t)return Y(t);const e=t,n=J(e,"toString");if("function"==typeof n){const t=n(e);return"string"==typeof t?t:Y(t)}return Y(t)}}}(t)))throw q("dirty is not a string, aborting");if(!n.isSupported)return t;Te?(ae=Ae,ce=we):an(e),(Kt.uponSanitizeElement.length>0||Kt.uponSanitizeAttribute.length>0)&&(ae=Z(ae)),Kt.uponSanitizeAttribute.length>0&&(ce=Z(ce)),n.removed=[];const c=Re&&"string"!=typeof t&&On(t);let s=[];const u=Ie;if(c){ve&&dn(t,t=>{const e=It(t);if(7===e||8===e&&G(Tt,t.data)){try{S(t)}catch(t){}return!1}if(1===e){const e=t,n=en(Lt(t));try{e.hasAttribute&&e.hasAttribute("patchsrc")&&e.removeAttribute("patchsrc"),e.hasAttribute&&e.hasAttribute("for")&&vn("for",n)&&e.removeAttribute("for")}catch(t){}}return!0});const e=Lt(t);if("string"==typeof e){const n=en(e);if(!ae[n]||fe[n])throw fn(t),q("root node is forbidden and cannot be sanitized in-place")}if(En(t))throw fn(t),q("root node is clobbered and cannot be sanitized in-place");s=yn(t),Ie=D()}else if(On(t))r=Sn("\x3c!----\x3e"),i=r.ownerDocument.importNode(t,!0),1===i.nodeType&&"BODY"===i.nodeName||"HTML"===i.nodeName?r=i:r.appendChild(i),Hn(r);else{if(!Ee&&!be&&!Se&&-1===t.indexOf("<"))return Mt&&Oe?Wt(t):t;if(r=Sn(t),!r)return Ee?null:Oe?Ut:""}r&&xe&&sn(r.firstChild);const f=c?t:r;try{c&&Hn(t);const e=Tn(f);for(;a=e.nextNode();)Rn(a,f),Un(a,f),_n(a.content)&&Fn(a.content);c&&function(t,e){const n=Ie;let r=null;const o=()=>(r||(r=D(),w(e,t=>{C(r,t)})),r);for(let e=0;;e++){const r=yn(t),i=[t];let a=!1;if(w(r,t=>{11===It(t)?_(i,t):a||R(n,t)||(a=R(o(),t))}),!a)return;if(e>=8)throw q("the tree kept changing during in-place sanitization; refusing to return it");w(i,(e,n)=>{bn(e,n>0,t,o())})}}(t,s)}catch(e){throw c&&(fn(t),gn(t,s)),e}finally{Ie=u}if(c){if(gn(t,s))throw q("a node selected for removal could not be safely returned; refusing to sanitize in place");return be&&wn(t),t}if(Ee){if(be&&wn(r),_e)for(l=$t.call(r.ownerDocument);r.firstChild;)l.appendChild(r.firstChild);else l=r;return(ce.shadowroot||ce.shadowrootmode)&&(l=Xt.call(o,l,!0)),l}let p=Se?r.outerHTML:r.innerHTML;return Se&&ae["!doctype"]&&r.ownerDocument&&r.ownerDocument.doctype&&r.ownerDocument.doctype.name&&G(bt,r.ownerDocument.doctype.name)&&(p="<!DOCTYPE "+r.ownerDocument.doctype.name+">\n"+p),be&&(p=An(p)),Mt&&Oe?Wt(p):p},n.setConfig=function(){an(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}),Te=!0,Ae=ae,we=ce},n.clearConfig=function(){nn=null,Te=!1,Ae=null,we=null,Mt=jt,Ut=""},n.isValidAttribute=function(t,e,n){nn||an({});const r=en(t),o=en(e);return("string"!=typeof n||!(jn(e,n)||!ge&&G(wt,n)))&&In(r,o,n)},n.addHook=function(t,e){"function"==typeof e&&W(Kt,t)&&_(Kt[t],e)},n.removeHook=function(t,e){if(W(Kt,t)){if(void 0!==e){const n=x(Kt[t],e);return-1===n?void 0:N(Kt[t],n,1)[0]}return E(Kt[t])}},n.removeHooks=function(t){W(Kt,t)&&(Kt[t]=[])},n.removeAllHooks=function(){Kt={afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},n}();function kt({label:t,Type:e="Primary",Variant:n="Default",Outline:r=!1,State:i="Default",href:a="#",onClick:l,className:c,...s}){const u="Disabled"===i,f=["mg-button","CTA"===n&&"mg-button-cta","mg-button-"+("Secondary"===e?"secondary":"primary"),r&&"mg-button-outline",u&&"disabled",c].filter(Boolean).join(" ");return(0,o().jsx)("a",{className:f,...s,...u?{"aria-disabled":"true",tabIndex:-1}:{href:a,onClick:l},children:t})}i(),kt.propTypes={label:l().string.isRequired,Type:l().oneOf(["Primary","Secondary"]),Variant:l().oneOf(["Default","CTA"]),Outline:l().bool,State:l().oneOf(["Default","Disabled"]),href:l().string,onClick:l().func,className:l().string};const Dt=(...t)=>t.filter(Boolean).join(" ")||null,Ct=[];function Rt({eyebrow:e,headline:n,headlineSize:r="600",headlineLevel:i=2,text:a,buttons:l=Ct,variant:c="primary",tone:s="strong",backgroundColor:u,padding:f,image:p,imageAlt:m="",centered:d=!0,layout:h="stacked",className:y,children:g}){const b=!!p,v="inline"===h&&null==g,S=t(),T=`h${i}`;return(0,o().jsx)("section",{className:Dt("mg-cta",c&&`mg-cta--${c}`,"soft"===s&&"mg-cta--soft",v&&"mg-cta--inline",b&&"mg-cta--with-image",!b&&d&&"inline"!==h&&"mg-cta--centered",y),...n?{"aria-labelledby":S}:{"aria-label":"Call to action"},...(u||f)&&{style:{...u&&{"--mg-cta-bg":u},...f&&{padding:f}}},children:(0,o().jsxs)("div",{className:"mg-cta__inner mg-container",children:[(0,o().jsxs)("div",{className:"mg-cta__body",children:[(0,o().jsxs)("div",{className:"mg-cta__content",children:[e&&(0,o().jsx)("p",{className:"mg-cta__eyebrow",children:e}),n&&(0,o().jsx)(T,{id:S,className:Dt("mg-cta__headline",`mg-u-font-size-${r}`),children:n}),a&&(0,o().jsx)("div",{className:"mg-cta__text",dangerouslySetInnerHTML:{__html:Nt.sanitize(a)}})]}),null!=g&&(0,o().jsx)("div",{className:"mg-cta__custom-content",children:g}),l.length>0&&(0,o().jsx)("div",{className:"mg-cta__actions",children:l.map((t,e)=>(0,o().jsx)(kt,{label:t.label,href:t.url||"#",Type:t.type,Variant:t.variant,Outline:t.outline,target:t.target,rel:t.rel},e))})]}),b&&(0,o().jsx)("div",{className:"mg-cta__image",children:(0,o().jsx)("img",{src:p,alt:m})})]})})}Rt.propTypes={children:l().node,tone:l().oneOf(["strong","soft"]),eyebrow:l().string,headline:l().string,headlineSize:l().string,headlineLevel:l().oneOf([2,3,4,5,6]),text:l().string,buttons:l().arrayOf(l().shape({label:l().string.isRequired,url:l().string,type:l().oneOf(["Primary","Secondary"]),variant:l().oneOf(["Default","CTA"]),outline:l().bool,target:l().string,rel:l().string})),variant:l().oneOf(["primary","secondary","tertiary","quaternary"]),backgroundColor:l().string,padding:l().string,image:l().string,imageAlt:l().string,centered:l().bool,layout:l().oneOf(["stacked","inline"]),className:l().string};const It=Rt;function Lt(t){const{dataset:e}=t;let n=[];try{n=e.buttons?JSON.parse(e.buttons):[]}catch{n=[]}const r=parseInt(e.headlineLevel,10),o=r>=2&&r<=6?r:2;return{eyebrow:e.eyebrow||"",headline:e.headline||"",headlineSize:e.headlineSize||"600",headlineLevel:o,text:e.text||"",buttons:n,variant:e.variant||"primary",tone:"soft"===e.tone?"soft":"strong",backgroundColor:e.backgroundColor||void 0,padding:e.padding||void 0,image:e.image||void 0,imageAlt:e.imageAlt||"",centered:"false"!==e.centered,layout:"inline"===e.layout?"inline":"stacked",className:e.className||void 0}}export{Rt as TextCta,It as default,Lt as fromElement};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! @license DOMPurify 3.4.
|
|
1
|
+
/*! @license DOMPurify 3.4.17 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.4.17/LICENSE */
|
|
2
2
|
|
|
3
3
|
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */
|
|
4
4
|
|
package/components/TextInput.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Storybook: https://mangrove.undrr.org/
|
|
4
4
|
* LLMs context: https://mangrove.undrr.org/llms.txt
|
|
5
5
|
* Repository: https://github.com/PreventionWeb/undrr-mangrove
|
|
6
|
-
* Compiled on: 2026-10-
|
|
6
|
+
* Compiled on: 2026-10-27T09:44:34.250Z
|
|
7
7
|
*/
|
|
8
8
|
/*! For license information please see TextInput.js.LICENSE.txt */
|
|
9
9
|
import{useId as e}from"react";var r={2694(e,r,o){var t=o(6925);function a(){}function n(){}n.resetWarningCache=a,e.exports=function(){function e(e,r,o,a,n,l){if(l!==t){var i=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw i.name="Invariant Violation",i}}function r(){return e}e.isRequired=e;var o={array:e,bigint:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:r,element:e,elementType:e,instanceOf:r,node:e,objectOf:r,oneOf:r,oneOfType:r,shape:r,exact:r,checkPropTypes:n,resetWarningCache:a};return o.PropTypes=o,o}},5556(e,r,o){e.exports=o(2694)()},6925(e){e.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"}};const o={};function t(e){const a=o[e];if(void 0!==a)return a.exports;const n=o[e]={exports:{}};return r[e](n,n.exports,t),n.exports}t.n=e=>{const r=e&&e.__esModule?()=>e.default:()=>e;return t.d(r,{a:r}),r},t.cw=e=>{var r;return()=>{if(e){var o=e;e=0,r={exports:{}},o.call(r.exports,r,r.exports)}return r.exports}},t.d=(e,r)=>{for(var o in r)t.o(r,o)&&!t.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:r[o]})},t.o=(e,r)=>Object.prototype.hasOwnProperty.call(e,r);var a=t.cw(function(e,r){var o=Symbol.for("react.transitional.element");function t(e,r,t){var a=null;if(void 0!==t&&(a=""+t),void 0!==r.key&&(a=""+r.key),"key"in r)for(var n in t={},r)"key"!==n&&(t[n]=r[n]);else t=r;return r=t.ref,{$$typeof:o,type:e,key:a,ref:void 0!==r?r:null,props:t}}Symbol.for("react.fragment"),r.jsx=t,r.jsxs=t}),n=t.cw(function(e,r){e.exports=a()}),l=t(5556),i=t.n(l);function s({id:r,name:o,type:t="text",label:n,hideLabel:l=!1,placeholder:i,value:s,defaultValue:p,onChange:c,disabled:d=!1,required:f=!1,helpText:u,error:m=!1,errorText:b,className:y,...g}){const h=e(),x=r||h,v=u?`${x}-help`:void 0,j=m&&b?`${x}-error`:void 0,T=[v,j].filter(Boolean).join(" ")||void 0,O=["mg-form-input",d&&"mg-form-input--disabled",m&&"mg-form-input--error"].filter(Boolean).join(" "),_=["mg-form-label",l&&"mg-u-sr-only",d&&"mg-form-label--disabled",f&&"mg-form-label--required"].filter(Boolean).join(" ");return(0,a().jsxs)("div",{className:["mg-form-field",y].filter(Boolean).join(" "),children:[n&&(0,a().jsx)("label",{className:_,htmlFor:x,children:n}),(0,a().jsx)("input",{className:O,type:t,id:x,name:o,placeholder:i,value:s,defaultValue:p,onChange:c,disabled:d,required:f,"aria-describedby":T,"aria-invalid":m||void 0,...n?{}:{"aria-label":i},...g}),u&&(0,a().jsx)("p",{className:"mg-form-help",id:v,children:u}),m&&b&&(0,a().jsx)("p",{className:"mg-form-error",id:j,role:"alert",children:b})]})}n(),s.propTypes={id:i().string,name:i().string,type:i().oneOf(["text","email","password","number","tel","search","date","url"]),label:i().string,hideLabel:i().bool,placeholder:i().string,value:i().string,defaultValue:i().string,onChange:i().func,disabled:i().bool,required:i().bool,helpText:i().string,error:i().bool,errorText:i().string,className:i().string};const p=s;export{s as TextInput,p as default};
|
package/components/Textarea.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Storybook: https://mangrove.undrr.org/
|
|
4
4
|
* LLMs context: https://mangrove.undrr.org/llms.txt
|
|
5
5
|
* Repository: https://github.com/PreventionWeb/undrr-mangrove
|
|
6
|
-
* Compiled on: 2026-10-
|
|
6
|
+
* Compiled on: 2026-10-27T09:44:34.250Z
|
|
7
7
|
*/
|
|
8
8
|
/*! For license information please see Textarea.js.LICENSE.txt */
|
|
9
9
|
import{useId as e}from"react";var r={2694(e,r,o){var a=o(6925);function t(){}function n(){}n.resetWarningCache=t,e.exports=function(){function e(e,r,o,t,n,l){if(l!==a){var s=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw s.name="Invariant Violation",s}}function r(){return e}e.isRequired=e;var o={array:e,bigint:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:r,element:e,elementType:e,instanceOf:r,node:e,objectOf:r,oneOf:r,oneOfType:r,shape:r,exact:r,checkPropTypes:n,resetWarningCache:t};return o.PropTypes=o,o}},5556(e,r,o){e.exports=o(2694)()},6925(e){e.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"}};const o={};function a(e){const t=o[e];if(void 0!==t)return t.exports;const n=o[e]={exports:{}};return r[e](n,n.exports,a),n.exports}a.n=e=>{const r=e&&e.__esModule?()=>e.default:()=>e;return a.d(r,{a:r}),r},a.cw=e=>{var r;return()=>{if(e){var o=e;e=0,r={exports:{}},o.call(r.exports,r,r.exports)}return r.exports}},a.d=(e,r)=>{for(var o in r)a.o(r,o)&&!a.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:r[o]})},a.o=(e,r)=>Object.prototype.hasOwnProperty.call(e,r);var t=a.cw(function(e,r){var o=Symbol.for("react.transitional.element");function a(e,r,a){var t=null;if(void 0!==a&&(t=""+a),void 0!==r.key&&(t=""+r.key),"key"in r)for(var n in a={},r)"key"!==n&&(a[n]=r[n]);else a=r;return r=a.ref,{$$typeof:o,type:e,key:t,ref:void 0!==r?r:null,props:a}}Symbol.for("react.fragment"),r.jsx=a,r.jsxs=a}),n=a.cw(function(e,r){e.exports=t()}),l=a(5556),s=a.n(l);function i({id:r,name:o,label:a,hideLabel:n=!1,placeholder:l,value:s,defaultValue:i,onChange:c,rows:d=4,cols:p,disabled:f=!1,required:u=!1,helpText:m,error:b=!1,errorText:g,className:y,...x}){const h=e(),v=r||h,j=m?`${v}-help`:void 0,T=b&&g?`${v}-error`:void 0,O=[j,T].filter(Boolean).join(" ")||void 0,_=["mg-form-textarea",f&&"mg-form-textarea--disabled",b&&"mg-form-textarea--error"].filter(Boolean).join(" "),k=["mg-form-label",n&&"mg-u-sr-only",f&&"mg-form-label--disabled",u&&"mg-form-label--required"].filter(Boolean).join(" ");return(0,t().jsxs)("div",{className:["mg-form-field",y].filter(Boolean).join(" "),children:[a&&(0,t().jsx)("label",{className:k,htmlFor:v,children:a}),(0,t().jsx)("textarea",{className:_,id:v,name:o,placeholder:l,value:s,defaultValue:i,onChange:c,rows:d,cols:p,disabled:f,required:u,"aria-describedby":O,"aria-invalid":b||void 0,...a?{}:{"aria-label":l},...x}),m&&(0,t().jsx)("p",{className:"mg-form-help",id:j,children:m}),b&&g&&(0,t().jsx)("p",{className:"mg-form-error",id:T,role:"alert",children:g})]})}n(),i.propTypes={id:s().string,name:s().string,label:s().string,hideLabel:s().bool,placeholder:s().string,value:s().string,defaultValue:s().string,onChange:s().func,rows:s().number,cols:s().number,disabled:s().bool,required:s().bool,helpText:s().string,error:s().bool,errorText:s().string,className:s().string};const c=i;export{i as Textarea,c as default};
|
package/components/Tree.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Storybook: https://mangrove.undrr.org/
|
|
4
4
|
* LLMs context: https://mangrove.undrr.org/llms.txt
|
|
5
5
|
* Repository: https://github.com/PreventionWeb/undrr-mangrove
|
|
6
|
-
* Compiled on: 2026-10-
|
|
6
|
+
* Compiled on: 2026-10-27T09:44:34.250Z
|
|
7
7
|
*/
|
|
8
8
|
/*! For license information please see Tree.js.LICENSE.txt */
|
|
9
9
|
import{createContext as e,default as t,useCallback as r,useContext as n,useEffect as o,useId as a,useMemo as i,useRef as l,useState as s}from"react";var c={2694(e,t,r){var n=r(6925);function o(){}function a(){}a.resetWarningCache=o,e.exports=function(){function e(e,t,r,o,a,i){if(i!==n){var l=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw l.name="Invariant Violation",l}}function t(){return e}e.isRequired=e;var r={array:e,bigint:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:a,resetWarningCache:o};return r.PropTypes=r,r}},5556(e,t,r){e.exports=r(2694)()},6925(e){e.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"},6942(e,t){var r;!function(){var n={}.hasOwnProperty;function o(){for(var e="",t=0;t<arguments.length;t++){var r=arguments[t];r&&(e=i(e,a(r)))}return e}function a(e){if("string"==typeof e||"number"==typeof e)return e;if("object"!=typeof e)return"";if(Array.isArray(e))return o.apply(null,e);if(e.toString!==Object.prototype.toString&&!e.toString.toString().includes("[native code]"))return e.toString();var t="";for(var r in e)n.call(e,r)&&e[r]&&(t=i(t,r));return t}function i(e,t){return t?e?e+" "+t:e+t:e}e.exports?(o.default=o,e.exports=o):void 0===(r=function(){return o}.apply(t,[]))||(e.exports=r)}()}};const d={};function u(e){const t=d[e];if(void 0!==t)return t.exports;const r=d[e]={exports:{}};return c[e](r,r.exports,u),r.exports}u.n=e=>{const t=e&&e.__esModule?()=>e.default:()=>e;return u.d(t,{a:t}),t},u.cw=e=>{var t;return()=>{if(e){var r=e;e=0,t={exports:{}},r.call(t.exports,t,t.exports)}return t.exports}},u.d=(e,t)=>{for(var r in t)u.o(t,r)&&!u.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},u.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);var f=u.cw(function(e,t){var r=Symbol.for("react.transitional.element");function n(e,t,n){var o=null;if(void 0!==n&&(o=""+n),void 0!==t.key&&(o=""+t.key),"key"in t)for(var a in n={},t)"key"!==a&&(n[a]=t[a]);else n=t;return t=n.ref,{$$typeof:r,type:e,key:o,ref:void 0!==t?t:null,props:n}}Symbol.for("react.fragment"),t.jsx=n,t.jsxs=n}),g=u.cw(function(e,t){e.exports=f()}),p=u(5556),m=u.n(p),h=u(6942),b=u.n(h);g();const y=e(null),x=[],v="mg-icon-right",I='li[role="treeitem"][data-mg-treeitem-id]',A=e=>e.getAttribute("data-mg-treeitem-id"),S=(e,r,n=[])=>{let o=null;return t.Children.forEach(e,e=>{if(o||!t.isValidElement(e))return;const{id:a,children:i}=e.props;o=a!==r?S(i,r,null!=a?[...n,a]:n):n}),o},_=({id:e,label:r,children:o,isExpanded:a,isSelected:i,onToggle:l,onSelect:c,href:d,asLink:u=!1,current:g,toggleIcon:p})=>{const m=n(y),[h,x]=s(a||!1),I=Boolean(o&&t.Children.count(o)>0),A=void 0!==a?a:m?m.expandedIds.has(e):h,S=void 0!==i?i:!!m&&m.selectedId===e,_=!!m&&m.tabStopId===e,w=p||m&&m.toggleIcon||v,k=t=>{t&&t.stopPropagation();const r=!A;void 0===a&&x(r),m&&m.toggleItem(e,r),l&&l(e,r)},j=t=>{I?k(t):(m&&m.selectItem(e),c&&c(e))};return(0,f().jsxs)("li",{id:m?`${m.domIdPrefix}${e}`:`mg-treeitem-${e}`,"data-mg-treeitem-id":e,className:b()("mg-tree__item",{"mg-tree__item--selected":S}),role:"treeitem","aria-expanded":I?A:void 0,"aria-selected":S,tabIndex:_?0:-1,onKeyDown:t=>{m&&(t.stopPropagation(),m.handleKeyDown(t,e,I,A,k))},onFocus:t=>{t&&t.stopPropagation(),m&&m.setFocusedId(e)},children:[(0,f().jsxs)("div",{className:"mg-tree__label-container",onClick:j,children:[I&&(0,f().jsx)("button",{type:"button",className:"mg-tree__toggle",onClick:k,tabIndex:-1,"aria-hidden":"true",children:(0,f().jsx)("span",{className:b()("mg-tree__icon mg-icon",w,{"is-expanded":A}),"aria-hidden":"true"})}),u&&d?(0,f().jsx)("a",{href:d,tabIndex:-1,className:"mg-tree__label","aria-current":g||void 0,onClick:j,children:r}):(0,f().jsx)("span",{className:"mg-tree__label",children:r})]}),I&&A&&(0,f().jsx)("ul",{className:"mg-tree__group",role:"group",children:o})]})};_.propTypes={id:m().string.isRequired,label:m().node.isRequired,children:m().node,isExpanded:m().bool,isSelected:m().bool,onToggle:m().func,onSelect:m().func,href:m().string,asLink:m().bool,current:m().oneOfType([m().string,m().bool]),toggleIcon:m().string};const w=({children:e,guides:t=!0,expandedIds:n,defaultExpandedIds:c=x,selectedId:d,defaultSelectedId:u=null,onToggle:g,onSelect:p,toggleIcon:m=v,className:h,onBlur:_,...w})=>{const k=l(null),j=`mg-tree${a().replace(/[^\w-]/g,"")}item-`,[T,E]=s(()=>new Set(c)),[O,N]=s(u),[C,P]=s(null),[L,R]=s(null),q=n?new Set(n):T,D=void 0!==d?d:O;o(()=>{if(!k.current)return;const t=new Set(Array.from(k.current.querySelectorAll(I),A));if(0===t.size)return;let r=null;if(null!==C&&t.has(C))r=C;else if(null!=D){const n=[D,...(S(e,D)||[]).reverse()];r=n.find(e=>t.has(e))??null}null===r&&(r=A(k.current.querySelector(I))),R(e=>e===r?e:r)},[C,D,q,e]);const $=r((e,t)=>{n||E(r=>{const n=new Set(r);return t?n.add(e):n.delete(e),n}),g&&g(e,t)},[n,g]),B=r(e=>{void 0===d&&N(e),p&&p(e)},[d,p]),F=r((e,t,r,n,o)=>{if(!k.current)return;const a=Array.from(k.current.querySelectorAll(I)).filter(e=>{let t=e.parentElement?.closest('ul[role="group"]');for(;t;){const e=t.closest(I);if(!e)break;const r=e.getAttribute("data-mg-treeitem-id");if(!q.has(r))return!1;t=e.parentElement?.closest('ul[role="group"]')}return!0}),i=a.findIndex(e=>e.getAttribute("data-mg-treeitem-id")===t);if(-1===i)return;const l=a[i],s=k.current.closest("[dir]"),c=s?"rtl"===s.getAttribute("dir").toLowerCase():"rtl"===getComputedStyle(k.current).direction;let{key:d}=e;switch(c&&"ArrowRight"===d?d="ArrowLeft":c&&"ArrowLeft"===d&&(d="ArrowRight"),d){case"ArrowDown":if(e.preventDefault(),i<a.length-1){const e=a[i+1],t=e.getAttribute("data-mg-treeitem-id");P(t),e.focus()}break;case"ArrowUp":if(e.preventDefault(),i>0){const e=a[i-1],t=e.getAttribute("data-mg-treeitem-id");P(t),e.focus()}break;case"ArrowRight":if(e.preventDefault(),r)if(n){const e=l.querySelector(':scope > ul[role="group"] > li[role="treeitem"]');if(e){const t=e.getAttribute("data-mg-treeitem-id");P(t),e.focus()}}else o();break;case"ArrowLeft":if(e.preventDefault(),r&&n)o();else{const e=l.parentElement?.closest(I);if(e){const t=e.getAttribute("data-mg-treeitem-id");P(t),e.focus()}}break;case"Home":if(e.preventDefault(),a.length>0){const e=a[0],t=e.getAttribute("data-mg-treeitem-id");P(t),e.focus()}break;case"End":if(e.preventDefault(),a.length>0){const e=a[a.length-1],t=e.getAttribute("data-mg-treeitem-id");P(t),e.focus()}break;case"Enter":case" ":{e.preventDefault(),B(t);const n=l.querySelector(":scope > .mg-tree__label-container > a");n?n.click():r&&o();break}}},[q,B]),U=i(()=>({expandedIds:q,selectedId:D,tabStopId:L,domIdPrefix:j,setFocusedId:P,toggleItem:$,selectItem:B,handleKeyDown:F,toggleIcon:m}),[q,D,L,j,P,$,B,F,m]);return(0,f().jsx)(y.Provider,{value:U,children:(0,f().jsx)("ul",{ref:k,className:b()("mg-tree",{"mg-tree--guides":t},h),role:"tree",...w,onBlur:e=>{e.currentTarget.contains(e.relatedTarget)||P(null),_&&_(e)},children:e})})};w.propTypes={children:m().node.isRequired,guides:m().bool,expandedIds:m().arrayOf(m().string),defaultExpandedIds:m().arrayOf(m().string),selectedId:m().string,defaultSelectedId:m().string,onToggle:m().func,onSelect:m().func,toggleIcon:m().string,className:m().string};const k=e=>e.map(({id:e,label:t,href:r,current:n,children:o})=>(0,f().jsx)(_,{id:e,label:t,href:r,asLink:Boolean(r),current:n,children:o&&o.length>0?k(o):void 0},e)),j=({items:e,children:t,...r})=>(0,f().jsx)(w,{...r,children:e?k(e):t}),T={id:m().string.isRequired,label:m().string.isRequired,href:m().string,current:m().string};T.children=m().arrayOf(m().shape(T)),j.propTypes={items:m().arrayOf(m().shape(T)),children:m().node};const E=/^(javascript|data|vbscript):/i,O=e=>"UL"===e.tagName||"OL"===e.tagName,N=e=>void 0!==e&&"false"!==e,C=e=>(e||"").replace(/\s+/g," ").trim();function P(e,t){if(t){const e=t.querySelector("img[alt]");return C(t.textContent)||C(t.getAttribute("aria-label"))||C(e?e.getAttribute("alt"):"")}return C(Array.from(e.childNodes).filter(e=>!(1===e.nodeType&&O(e))).map(e=>e.textContent).join(" "))}function L(e){const{dataset:t}=e,r=new Set,n=new Map,o=[];let a=null;const i=(e,t,l)=>Array.from(e.children).filter(e=>"LI"===e.tagName).map((e,s)=>{const c=t?`${t}-${s+1}`:`${s+1}`,d=function(e){const t=Array.from(e.children);return t.find(e=>"A"===e.tagName)||t.filter(e=>!O(e)).map(e=>Array.from(e.children).find(e=>"A"===e.tagName)).find(Boolean)}(e),u=Array.from(e.children).find(O),f=(e=>{let t=e,n=2;for(;r.has(t);)t=`${e}-${n}`,n+=1;return r.add(t),t})(e.dataset.id||e.id||c);n.set(f,l);const g={id:f,label:P(e,d)},p=function(e){if(!e)return;const t=(e.getAttribute("href")||"").trim(),r=t.replace(/[\u0000-\u0020]/g,"");return t&&!E.test(r)?t:void 0}(d);p&&(g.href=p);const m=d?d.getAttribute("aria-current"):null,h=Boolean(m)&&"false"!==m;p&&h&&(g.current=m);const b=u?i(u,c,[...l,f]):[];return b.length>0&&(g.children=b,(N(e.dataset.expanded)||"true"===e.getAttribute("aria-expanded"))&&o.push(f)),null===a&&(N(e.dataset.selected)||h)&&(a=f),g}),l=Array.from(e.children).find(O)||e.querySelector("ul, ol"),s=l?i(l,"",[]):[],c=a||t.selectedId||null;return(n.get(c)||[]).forEach(e=>{o.includes(e)||o.push(e)}),{items:s,defaultExpandedIds:o,defaultSelectedId:c,guides:"false"!==t.guides,toggleIcon:t.toggleIcon||void 0,"aria-label":t.ariaLabel||void 0,"aria-labelledby":t.ariaLabelledby||void 0,className:t.className||void 0}}export{j as HydratedTree,w as Tree,_ as TreeItem,j as default,L as fromElement};
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Storybook: https://mangrove.undrr.org/
|
|
4
4
|
* LLMs context: https://mangrove.undrr.org/llms.txt
|
|
5
5
|
* Repository: https://github.com/PreventionWeb/undrr-mangrove
|
|
6
|
-
* Compiled on: 2026-10-
|
|
6
|
+
* Compiled on: 2026-10-27T09:44:34.250Z
|
|
7
7
|
*/
|
|
8
8
|
/*! For license information please see UserFeedback.js.LICENSE.txt */
|
|
9
|
-
import{useEffect as e,useRef as r,useState as n}from"react";var t={2694(e,r,n){var t=n(6925);function o(){}function
|
|
9
|
+
import{useEffect as e,useRef as r,useState as n}from"react";var t={2694(e,r,n){var t=n(6925);function o(){}function i(){}i.resetWarningCache=o,e.exports=function(){function e(e,r,n,o,i,a){if(a!==t){var s=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw s.name="Invariant Violation",s}}function r(){return e}e.isRequired=e;var n={array:e,bigint:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:r,element:e,elementType:e,instanceOf:r,node:e,objectOf:r,oneOf:r,oneOfType:r,shape:r,exact:r,checkPropTypes:i,resetWarningCache:o};return n.PropTypes=n,n}},5556(e,r,n){e.exports=n(2694)()},6925(e){e.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"}};const o={};function i(e){const r=o[e];if(void 0!==r)return r.exports;const n=o[e]={exports:{}};return t[e](n,n.exports,i),n.exports}i.n=e=>{const r=e&&e.__esModule?()=>e.default:()=>e;return i.d(r,{a:r}),r},i.cw=e=>{var r;return()=>{if(e){var n=e;e=0,r={exports:{}},n.call(r.exports,r,r.exports)}return r.exports}},i.d=(e,r)=>{for(var n in r)i.o(r,n)&&!i.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:r[n]})},i.o=(e,r)=>Object.prototype.hasOwnProperty.call(e,r);var a=i.cw(function(e,r){var n=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function o(e,r,t){var o=null;if(void 0!==t&&(o=""+t),void 0!==r.key&&(o=""+r.key),"key"in r)for(var i in t={},r)"key"!==i&&(t[i]=r[i]);else t=r;return r=t.ref,{$$typeof:n,type:e,key:o,ref:void 0!==r?r:null,props:t}}r.Fragment=t,r.jsx=o,r.jsxs=o}),s=i.cw(function(e,r){e.exports=a()});const c={en:"ltr",ar:"rtl",es:"ltr",fr:"ltr",ja:"ltr",ru:"ltr",zh:"ltr"};function f(e="en"){return String(e).trim().toLowerCase().split(/[-_]/)[0]}function u(e,r){const n=f(e),t=void 0!==e&&Object.hasOwn(c,n)?c[n]:void 0,o=void 0===r?t:r;return{...void 0===e?{}:{lang:e},...void 0===o?{}:{dir:o}}}function l(e){const r=e.dataset.lang??e.closest("[lang]")?.getAttribute("lang"),n=e.getAttribute("dir")?.toLowerCase();return{...null==r?{}:{lang:r},...["ltr","rtl","auto"].includes(n)?{dir:n}:{}}}function m(e){try{const r=JSON.parse(e.dataset.labels);return r&&"object"==typeof r&&!Array.isArray(r)?r:void 0}catch{return}}var p=i(5556),d=i.n(p);const k={question:"Is this page useful?",yes:"Yes",no:"No",reportIssue:"Report an issue on this page",confirmationBeforeLink:"Thank you for your feedback. If you would like, you can also",confirmationSeparator:" ",confirmationLink:"tell us more",confirmationAfterLink:"."},g=(b=k,y={ar:{question:"هل كانت هذه الصفحة مفيدة؟",yes:"نعم",no:"لا",reportIssue:"الإبلاغ عن مشكلة في هذه الصفحة",confirmationBeforeLink:"شكراً لملاحظاتك. وإذا رغبت، يمكنك أيضاً",confirmationLink:"إخبارنا بالمزيد",confirmationAfterLink:"."},es:{question:"¿Te ha resultado útil esta página?",yes:"Sí",no:"No",reportIssue:"Informar de un problema en esta página",confirmationBeforeLink:"Gracias por tus comentarios. Si quieres, también puedes",confirmationLink:"contarnos más",confirmationAfterLink:"."},fr:{question:"Cette page vous a-t-elle été utile ?",yes:"Oui",no:"Non",reportIssue:"Signaler un problème sur cette page",confirmationBeforeLink:"Merci pour votre avis. Si vous le souhaitez, vous pouvez aussi",confirmationLink:"nous en dire plus",confirmationAfterLink:"."},ja:{question:"このページは役に立ちましたか?",yes:"はい",no:"いいえ",reportIssue:"このページの問題を報告する",confirmationBeforeLink:"ご意見ありがとうございます。よろしければ、",confirmationSeparator:"",confirmationLink:"詳細をお聞かせください",confirmationAfterLink:"。"},ru:{question:"Была ли эта страница полезной?",yes:"Да",no:"Нет",reportIssue:"Сообщить о проблеме на этой странице",confirmationBeforeLink:"Спасибо за ваш отзыв. При желании вы также можете",confirmationLink:"рассказать нам подробнее",confirmationAfterLink:"."},zh:{question:"此页面对您有帮助吗?",yes:"是",no:"否",reportIssue:"报告此页面的问题",confirmationBeforeLink:"感谢您的反馈。如您愿意,也可以",confirmationSeparator:"",confirmationLink:"告诉我们更多信息",confirmationAfterLink:"。"}},(e,r)=>{const n=f(e),t=Object.hasOwn(y,n)?y[n]:void 0,o=Object.fromEntries(Object.entries(r??{}).filter(([,e])=>void 0!==e));return{...b,...t,...o}});var b,y;s();const L=(...e)=>e.filter(Boolean).join(" "),v=({feedbackUrl:t="https://www.undrr.org/contact/website-feedback",lang:o,dir:i,labels:s,onResponse:c,className:f,...l})=>{const[m,p]=n(null),d=r(null),k=g(o,s);return e(()=>{m&&d.current?.focus()},[m]),(0,a().jsx)("section",{className:L("mg-user-feedback","mg-container","mg-grid","mg-grid__col-2",f),"aria-label":k.question,...u(o,i),"data-vf-google-analytics-region":"undrr-feedback-container",...l,children:m?(0,a().jsxs)("p",{"aria-live":"polite",className:"mg-user-feedback__confirmation","data-mg-user-feedback-message":!0,ref:d,tabIndex:"-1",children:[k.confirmationBeforeLink,k.confirmationSeparator,(0,a().jsx)("a",{"data-mg-user-feedback-form":!0,href:t,rel:"noopener noreferrer",target:"_blank",children:k.confirmationLink}),k.confirmationAfterLink]}):(0,a().jsxs)(a().Fragment,{children:[(0,a().jsxs)("div",{className:"mg-user-feedback__prompt",children:[(0,a().jsx)("h2",{className:"mg-user-feedback__question",children:k.question}),(0,a().jsx)("div",{className:"mg-user-feedback__actions",children:["yes","no"].map(e=>(0,a().jsx)("button",{className:"mg-button mg-button-secondary","data-mg-user-feedback-prompt":!0,"data-mg-user-feedback-type":e,onClick:()=>(e=>{p(e),c?.(e)})(e),type:"button",children:k[e]},e))})]}),(0,a().jsx)("a",{className:"mg-user-feedback__issue","data-mg-user-feedback-form":!0,"data-mg-user-feedback-prompt":!0,"data-mg-user-feedback-type":"report-issue",href:t,children:k.reportIssue})]})})};v.propTypes={feedbackUrl:d().string,lang:d().string,dir:d().oneOf(["ltr","rtl","auto"]),labels:d().shape({question:d().string,yes:d().string,no:d().string,reportIssue:d().string,confirmationBeforeLink:d().string,confirmationSeparator:d().string,confirmationLink:d().string,confirmationAfterLink:d().string}),onResponse:d().func,className:d().string};const h=v;function x(e){const{dataset:r}=e,n={question:r.question,yes:r.yesLabel,no:r.noLabel,reportIssue:r.reportIssueLabel,confirmationBeforeLink:r.confirmationBeforeLink,confirmationSeparator:r.confirmationSeparator,confirmationLink:r.confirmationLink,confirmationAfterLink:r.confirmationAfterLink};return{...l(e),feedbackUrl:r.feedbackUrl||"https://www.undrr.org/contact/website-feedback",labels:{...m(e),...Object.fromEntries(Object.entries(n).filter(([,e])=>void 0!==e))}}}export{k as DEFAULT_USER_FEEDBACK_LABELS,h as default,x as fromElement,g as getUserFeedbackLabels};
|