ladle-inject-custom-addons
Version:
Adds a button to the Ladle addon bar
57 lines (49 loc) • 46.4 kB
JavaScript
;var An=Object.create;var ve=Object.defineProperty;var xn=Object.getOwnPropertyDescriptor;var Dn=Object.getOwnPropertyNames;var kn=Object.getPrototypeOf,In=Object.prototype.hasOwnProperty;var Fn=(e,t)=>{for(var n in t)ve(e,n,{get:t[n],enumerable:!0})},gt=(e,t,n,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of Dn(t))!In.call(e,r)&&r!==n&&ve(e,r,{get:()=>t[r],enumerable:!(o=xn(t,r))||o.enumerable});return e};var we=(e,t,n)=>(n=e!=null?An(kn(e)):{},gt(t||!e||!e.__esModule?ve(n,"default",{value:e,enumerable:!0}):n,e)),_n=e=>gt(ve({},"__esModule",{value:!0}),e);var Zr={};Fn(Zr,{AddonButton:()=>We,AddonDialog:()=>pt,AddonDialogButton:()=>qr,ExampleLadleIcon:()=>Mn,LadleDialogCloseButton:()=>He,LadleDialogCloseIcon:()=>Ue,LadleIconButton:()=>Ye});module.exports=_n(Zr);var $e=we(require("react")),bt=require("react-dom");function je(){return document.getElementsByClassName("ladle-addons")[0]?.getElementsByTagName("ul")?.[0]??null}var vt=(e,{position:t=0})=>{let[n]=$e.default.useState(document.createElement("li"));return $e.default.useEffect(()=>{let o=je();if(!o){console.warn("Unable to find addon panel. Custom addons won't be mounted!");return}return Ln(o,n,t),()=>{o.removeChild(n)}},[t]),n?(0,bt.createPortal)(e,n):null},Ln=(e,t,n)=>{t.setAttribute("data-position",n.toString()),e.insertBefore(t,Nn(Array.from(e.getElementsByTagName("li")),n))};function Nn(e,t){let n=null;for(let o of e){let r=Number(o.dataset.position);if(o.dataset.position!=null&&!isNaN(r)?n=r:n===null||isNaN(n)?n=1:++n,t<n)return o}return null}var q=require("react/jsx-runtime"),We=({icon:e,tooltip:t,children:n,badge:o=!1,label:r="",position:i=0,...c})=>{let u=o||["string","number"].includes(typeof o);return vt((0,q.jsxs)(q.Fragment,{children:[(0,q.jsxs)("button",{"aria-label":t,title:t,type:"button",...c,children:[e,(0,q.jsx)("span",{className:"ladle-addon-tooltip",children:t}),r&&(0,q.jsx)("label",{children:r}),u&&(0,q.jsx)("div",{className:"ladle-badge",children:o})]}),n]}),{position:i})};function J(...e){return e.flat().filter(t=>t&&!!t.trim()).join(" ")}var wt=require("react/jsx-runtime"),Ye=({icon:e,...t})=>(0,wt.jsx)("button",{...t,className:J("ladle-button",t.className),style:{height:36,width:36,borderColor:"transparent",boxShadow:"none",...t.style},children:e});var K=require("react/jsx-runtime"),Et=({size:e=24,...t})=>(0,K.jsx)("svg",{width:e,height:e,viewBox:"0 0 24 24",stroke:"currentColor",fill:"none",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",...t}),Ue=({size:e=18,...t})=>(0,K.jsxs)(Et,{size:e,...t,children:[(0,K.jsx)("path",{d:"M0 0h24v24H0z",stroke:"none"}),(0,K.jsx)("path",{d:"M18 6L6 18M6 6l12 12"})]}),Mn=e=>(0,K.jsx)(Et,{...e,children:(0,K.jsx)("path",{d:"M 21.609 10.914 C 18.931 17.502 12.002 22.249 12.002 22.249 C 12.002 22.249 4.872 17.177 2.394 10.914 C -0.669 3.172 8.281 -0.396 12.002 6.99 C 15.722 -0.396 24.744 3.201 21.609 10.914 Z"})});var Ee=require("react/jsx-runtime"),He=({iconProps:e,wrapperProps:t,...n})=>(0,Ee.jsx)("div",{...t,style:{position:"absolute",insetInlineEnd:-6,top:0,...t?.style},children:(0,Ee.jsx)(Ye,{"aria-label":"Close modal",...n,icon:(0,Ee.jsx)(Ue,{...e})})});var a=we(require("react")),_t=we(require("react-dom"));function Qe(){return H=Object.assign||function(e){for(let t=1;t<arguments.length;t++){let n=arguments[t];for(let o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},H.apply(this,arguments)}function it(e,t,n){return n={path:t,exports:{},require:function(o,r){return Bn(o,r??n.path)}},e(n,n.exports),n.exports}function Bn(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}function Lt(){throw new Error("setTimeout has not been defined")}function Nt(){throw new Error("clearTimeout has not been defined")}var X=Lt,Q=Nt,ue;typeof window<"u"?ue=window:typeof self<"u"?ue=self:ue={};typeof ue.setTimeout=="function"&&(X=setTimeout);typeof ue.clearTimeout=="function"&&(Q=clearTimeout);function Mt(e){if(X===setTimeout)return setTimeout(e,0);if((X===Lt||!X)&&setTimeout)return X=setTimeout,setTimeout(e,0);try{return X(e,0)}catch{try{return X.call(null,e,0)}catch{return X.call(this,e,0)}}}function jn(e){if(Q===clearTimeout)return clearTimeout(e);if((Q===Nt||!Q)&&clearTimeout)return Q=clearTimeout,clearTimeout(e);try{return Q(e)}catch{try{return Q.call(null,e)}catch{return Q.call(this,e)}}}var Z=[],le=!1,te,Pe=-1;function $n(){!le||!te||(le=!1,te.length?Z=te.concat(Z):Pe=-1,Z.length&&Bt())}function Bt(){if(le)return;let e=Mt($n);le=!0;let t=Z.length;for(;t;){for(te=Z,Z=[];++Pe<t;)te&&te[Pe].run();Pe=-1,t=Z.length}te=null,le=!1,jn(e)}function Wn(e){let t=new Array(arguments.length-1);if(arguments.length>1)for(let n=1;n<arguments.length;n++)t[n-1]=arguments[n];Z.push(new jt(e,t)),Z.length===1&&!le&&Mt(Bt)}function jt(e,t){this.fun=e,this.array=t}jt.prototype.run=function(){this.fun.apply(null,this.array)};var Yn="browser",Un="browser",Hn=!0,Gn=[],qn="",Zn={},zn={},Kn={};function U(){}var Xn=U,Qn=U,Vn=U,Jn=U,eo=U,to=U,no=U;function oo(e){throw new Error("process.binding is not supported")}function ro(){return"/"}function co(e){throw new Error("process.chdir is not supported")}function io(){return 0}var ie=ue.performance||{},ao=ie.now||ie.mozNow||ie.msNow||ie.oNow||ie.webkitNow||function(){return new Date().getTime()};function so(e){let t=ao.call(ie)*.001,n=Math.floor(t),o=Math.floor(t%1*1e9);return e&&(n=n-e[0],o=o-e[1],o<0&&(n--,o+=1e9)),[n,o]}var uo=new Date;function lo(){return(new Date-uo)/1e3}var Tt={nextTick:Wn,title:Yn,browser:Hn,env:{NODE_ENV:"development"},argv:Gn,version:qn,versions:Zn,on:Xn,addListener:Qn,once:Vn,off:Jn,removeListener:eo,removeAllListeners:to,emit:no,binding:oo,cwd:ro,chdir:co,umask:io,hrtime:so,platform:Un,release:zn,config:Kn,uptime:lo},fo=function(e,t){let n,o=toObject(e),r;for(let i=1;i<arguments.length;i++){n=Object(arguments[i]);for(let c in n)hasOwnProperty.call(n,c)&&(o[c]=n[c]);if(getOwnPropertySymbols){r=getOwnPropertySymbols(n);for(let c=0;c<r.length;c++)propIsEnumerable.call(n,r[c])&&(o[r[c]]=n[r[c]])}}return o},mo=Wt()?a.useLayoutEffect:a.useEffect,Ct={},$t=U;{let e=typeof Tt<"u"?Tt:{env:{NODE_ENV:"development"}},t=e.env;$t=function(o){Ct[o]||(Ct[o]=!0)}}function po(e,t){if(e!=null)if(yo(e))e(t);else try{e.current=t}catch{throw new Error('Cannot assign value "'+t+'" to ref "'+e+'"')}}function Wt(){return!!(typeof window<"u"&&window.document&&window.document.createElement)}function Fe(e){return a.forwardRef(e)}function ho(e){return Wt()?e?e.ownerDocument:document:null}function yo(e){return!!(e&&{}.toString.call(e)=="[object Function]")}function go(e){return typeof e=="string"}var Yt=U;Yt=function(t){let n=a.useRef(t);a.useEffect(function(){return void(n.current=t)},[t]),a.useEffect(function(){return $t(n.current)},[])};function bo(){let e=a.useState(Object.create(null)),t=e[1];return a.useCallback(function(){t(Object.create(null))},[])}function vo(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return a.useMemo(function(){return t.every(function(o){return o==null})?null:function(o){t.forEach(function(r){po(r,o)})}},[].concat(t))}function Se(e,t){return function(n){if(e&&e(n),!n.defaultPrevented)return t(n)}}var Ut=function(t){let n=t.children,o=t.type,r=o===void 0?"reach-portal":o,i=a.useRef(null),c=a.useRef(null),u=bo();return mo(function(){if(!i.current)return;let l=i.current.ownerDocument;return c.current=l?.createElement(r),l.body.appendChild(c.current),u(),function(){c.current&&c.current.ownerDocument&&c.current.ownerDocument.body.removeChild(c.current)}},[r,u]),c.current?_t.createPortal(n,c.current):a.createElement("span",{ref:i})};Ut.displayName="Portal";function wo(e,t){if(e==null)return{};let n={},o=Object.keys(e),r,i;for(i=0;i<o.length;i++)r=o[i],!(t.indexOf(r)>=0)&&(n[r]=e[r]);return n}var Eo=it(function(e,t){(function(){let n=typeof Symbol=="function"&&Symbol.for,o=n?Symbol.for("react.element"):60103,r=n?Symbol.for("react.portal"):60106,i=n?Symbol.for("react.fragment"):60107,c=n?Symbol.for("react.strict_mode"):60108,u=n?Symbol.for("react.profiler"):60114,l=n?Symbol.for("react.provider"):60109,f=n?Symbol.for("react.context"):60110,y=n?Symbol.for("react.async_mode"):60111,h=n?Symbol.for("react.concurrent_mode"):60111,g=n?Symbol.for("react.forward_ref"):60112,R=n?Symbol.for("react.suspense"):60113,I=n?Symbol.for("react.suspense_list"):60120,p=n?Symbol.for("react.memo"):60115,b=n?Symbol.for("react.lazy"):60116,L=n?Symbol.for("react.block"):60121,N=n?Symbol.for("react.fundamental"):60117,k=n?Symbol.for("react.responder"):60118,F=n?Symbol.for("react.scope"):60119;function M(m){return typeof m=="string"||typeof m=="function"||m===i||m===h||m===u||m===c||m===R||m===I||typeof m=="object"&&m!==null&&(m.$$typeof===b||m.$$typeof===p||m.$$typeof===l||m.$$typeof===f||m.$$typeof===g||m.$$typeof===N||m.$$typeof===k||m.$$typeof===F||m.$$typeof===L)}function A(m){if(typeof m=="object"&&m!==null){let Be=m.$$typeof;switch(Be){case o:var be=m.type;switch(be){case y:case h:case i:case u:case c:case R:return be;default:var yt=be&&be.$$typeof;switch(yt){case f:case g:case b:case p:case l:return yt;default:return Be}}case r:return Be}}}let W=y,_=h,Y=f,j=l,z=o,s=g,d=i,v=b,w=p,E=r,S=u,C=c,T=R,P=!1;function x(m){return P||(P=!0,console.warn("The ReactIs.isAsyncMode() alias has been deprecated, and will be removed in React 17+. Update your code to use ReactIs.isConcurrentMode() instead. It has the exact same API.")),D(m)||A(m)===y}function D(m){return A(m)===h}function B(m){return A(m)===f}function $(m){return A(m)===l}function Me(m){return typeof m=="object"&&m!==null&&m.$$typeof===o}function G(m){return A(m)===g}function oe(m){return A(m)===i}function ge(m){return A(m)===b}function Cn(m){return A(m)===p}function Pn(m){return A(m)===r}function Sn(m){return A(m)===u}function On(m){return A(m)===c}function Rn(m){return A(m)===R}t.AsyncMode=W,t.ConcurrentMode=_,t.ContextConsumer=Y,t.ContextProvider=j,t.Element=z,t.ForwardRef=s,t.Fragment=d,t.Lazy=v,t.Memo=w,t.Portal=E,t.Profiler=S,t.StrictMode=C,t.Suspense=T,t.isAsyncMode=x,t.isConcurrentMode=D,t.isContextConsumer=B,t.isContextProvider=$,t.isElement=Me,t.isForwardRef=G,t.isFragment=oe,t.isLazy=ge,t.isMemo=Cn,t.isPortal=Pn,t.isProfiler=Sn,t.isStrictMode=On,t.isSuspense=Rn,t.isValidElementType=M,t.typeOf=A})()}),Ht=it(function(e){e.exports=Eo}),To="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED",ee=To,Ve=function(){};Gt=ee,Ae={},qt=Function.call.bind(Object.prototype.hasOwnProperty),Ve=function(e){let t="Warning: "+e;typeof console<"u"&&console.error(t);try{throw new Error(t)}catch{}};var Gt,Ae,qt;function Zt(e,t,n,o,r){for(let c in e)if(qt(e,c)){var i;try{if(typeof e[c]!="function"){let u=Error((o||"React class")+": "+n+" type `"+c+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof e[c]+"`.");throw u.name="Invariant Violation",u}i=e[c](t,c,o,n,null,Gt)}catch(u){i=u}if(i&&!(i instanceof Error)&&Ve((o||"React class")+": type specification of "+n+" `"+c+"` is invalid; the type checker function must return `null` or an `Error` but returned a "+typeof i+". You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument)."),i instanceof Error&&!(i.message in Ae)){Ae[i.message]=!0;let u=r?r():"";Ve("Failed "+n+" type: "+i.message+(u??""))}}}Zt.resetWarningCache=function(){Ae={}};var Pt=Zt,Co=Function.call.bind(Object.prototype.hasOwnProperty),ae=function(){};ae=function(e){let t="Warning: "+e;typeof console<"u"&&console.error(t);try{throw new Error(t)}catch{}};function Te(){return null}var Po=function(e,t){let n=typeof Symbol=="function"&&Symbol.iterator,o="@@iterator";function r(s){let d=s&&(n&&s[n]||s[o]);if(typeof d=="function")return d}let i="<<anonymous>>",c={array:y("array"),bool:y("boolean"),func:y("function"),number:y("number"),object:y("object"),string:y("string"),symbol:y("symbol"),any:h(),arrayOf:g,element:R(),elementType:I(),instanceOf:p,node:k(),objectOf:L,oneOf:b,oneOfType:N,shape:F,exact:M};function u(s,d){return s===d?s!==0||1/s===1/d:s!==s&&d!==d}function l(s){this.message=s,this.stack=""}l.prototype=Error.prototype;function f(s){var d={},v=0;function w(S,C,T,P,x,D,B){if(P=P||i,D=D||T,B!==ee){if(t){let $=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 $.name="Invariant Violation",$}else if(typeof console<"u"){let $=P+":"+T;!d[$]&&v<3&&(ae("You are manually calling a React.PropTypes validation function for the `"+D+"` prop on `"+P+"`. This is deprecated and will throw in the standalone `prop-types` package. You may be seeing this warning due to a third-party PropTypes library. See https://fb.me/react-warning-dont-call-proptypes for details."),d[$]=!0,v++)}}return C[T]==null?S?C[T]===null?new l("The "+x+" `"+D+"` is marked as required "+("in `"+P+"`, but its value is `null`.")):new l("The "+x+" `"+D+"` is marked as required in "+("`"+P+"`, but its value is `undefined`.")):null:s(C,T,P,x,D)}let E=w.bind(null,!1);return E.isRequired=w.bind(null,!0),E}function y(s){function d(v,w,E,S,C,T){let P=v[w];if(_(P)!==s){let D=Y(P);return new l("Invalid "+S+" `"+C+"` of type "+("`"+D+"` supplied to `"+E+"`, expected ")+("`"+s+"`."))}return null}return f(d)}function h(){return f(Te)}function g(s){function d(v,w,E,S,C){if(typeof s!="function")return new l("Property `"+C+"` of component `"+E+"` has invalid PropType notation inside arrayOf.");let T=v[w];if(!Array.isArray(T)){let P=_(T);return new l("Invalid "+S+" `"+C+"` of type "+("`"+P+"` supplied to `"+E+"`, expected an array."))}for(let P=0;P<T.length;P++){let x=s(T,P,E,S,C+"["+P+"]",ee);if(x instanceof Error)return x}return null}return f(d)}function R(){function s(d,v,w,E,S){let C=d[v];if(!e(C)){let T=_(C);return new l("Invalid "+E+" `"+S+"` of type "+("`"+T+"` supplied to `"+w+"`, expected a single ReactElement."))}return null}return f(s)}function I(){function s(d,v,w,E,S){let C=d[v];if(!Ht.isValidElementType(C)){let T=_(C);return new l("Invalid "+E+" `"+S+"` of type "+("`"+T+"` supplied to `"+w+"`, expected a single ReactElement type."))}return null}return f(s)}function p(s){function d(v,w,E,S,C){if(!(v[w]instanceof s)){let T=s.name||i,P=z(v[w]);return new l("Invalid "+S+" `"+C+"` of type "+("`"+P+"` supplied to `"+E+"`, expected ")+("instance of `"+T+"`."))}return null}return f(d)}function b(s){if(!Array.isArray(s))return arguments.length>1?ae("Invalid arguments supplied to oneOf, expected an array, got "+arguments.length+" arguments. A common mistake is to write oneOf(x, y, z) instead of oneOf([x, y, z])."):ae("Invalid argument supplied to oneOf, expected an array."),Te;function d(v,w,E,S,C){let T=v[w];for(let x=0;x<s.length;x++)if(u(T,s[x]))return null;let P=JSON.stringify(s,function(D,B){return Y(B)==="symbol"?String(B):B});return new l("Invalid "+S+" `"+C+"` of value `"+String(T)+"` "+("supplied to `"+E+"`, expected one of "+P+"."))}return f(d)}function L(s){function d(v,w,E,S,C){if(typeof s!="function")return new l("Property `"+C+"` of component `"+E+"` has invalid PropType notation inside objectOf.");let T=v[w],P=_(T);if(P!=="object")return new l("Invalid "+S+" `"+C+"` of type "+("`"+P+"` supplied to `"+E+"`, expected an object."));for(let x in T)if(Co(T,x)){let D=s(T,x,E,S,C+"."+x,ee);if(D instanceof Error)return D}return null}return f(d)}function N(s){if(!Array.isArray(s))return ae("Invalid argument supplied to oneOfType, expected an instance of array."),Te;for(let v=0;v<s.length;v++){let w=s[v];if(typeof w!="function")return ae("Invalid argument supplied to oneOfType. Expected an array of check functions, but received "+j(w)+" at index "+v+"."),Te}function d(v,w,E,S,C){for(let T=0;T<s.length;T++){let P=s[T];if(P(v,w,E,S,C,ee)==null)return null}return new l("Invalid "+S+" `"+C+"` supplied to "+("`"+E+"`."))}return f(d)}function k(){function s(d,v,w,E,S){return A(d[v])?null:new l("Invalid "+E+" `"+S+"` supplied to "+("`"+w+"`, expected a ReactNode."))}return f(s)}function F(s){function d(v,w,E,S,C){let T=v[w],P=_(T);if(P!=="object")return new l("Invalid "+S+" `"+C+"` of type `"+P+"` "+("supplied to `"+E+"`, expected `object`."));for(let x in s){let D=s[x];if(!D)continue;let B=D(T,x,E,S,C+"."+x,ee);if(B)return B}return null}return f(d)}function M(s){function d(v,w,E,S,C){let T=v[w],P=_(T);if(P!=="object")return new l("Invalid "+S+" `"+C+"` of type `"+P+"` "+("supplied to `"+E+"`, expected `object`."));let x=fo({},v[w],s);for(let D in x){let B=s[D];if(!B)return new l("Invalid "+S+" `"+C+"` key `"+D+"` supplied to `"+E+"`.\nBad object: "+JSON.stringify(v[w],null," ")+`
Valid keys: `+JSON.stringify(Object.keys(s),null," "));let $=B(T,D,E,S,C+"."+D,ee);if($)return $}return null}return f(d)}function A(s){switch(typeof s){case"number":case"string":case"undefined":return!0;case"boolean":return!s;case"object":if(Array.isArray(s))return s.every(A);if(s===null||e(s))return!0;var d=r(s);if(d){let v=d.call(s),w;if(d!==s.entries){for(;!(w=v.next()).done;)if(!A(w.value))return!1}else for(;!(w=v.next()).done;){let E=w.value;if(E&&!A(E[1]))return!1}}else return!1;return!0;default:return!1}}function W(s,d){return s==="symbol"?!0:d?d["@@toStringTag"]==="Symbol"||typeof Symbol=="function"&&d instanceof Symbol:!1}function _(s){let d=typeof s;return Array.isArray(s)?"array":s instanceof RegExp?"object":W(d,s)?"symbol":d}function Y(s){if(typeof s>"u"||s===null)return""+s;let d=_(s);if(d==="object"){if(s instanceof Date)return"date";if(s instanceof RegExp)return"regexp"}return d}function j(s){let d=Y(s);switch(d){case"array":case"object":return"an "+d;case"boolean":case"date":case"regexp":return"a "+d;default:return d}}function z(s){return!s.constructor||!s.constructor.name?i:s.constructor.name}return c.checkPropTypes=Pt,c.resetWarningCache=Pt.resetWarningCache,c.PropTypes=c,c},O=it(function(e){{let t=Ht,n=!0;e.exports=Po(t.isElement,n)}}),Je="data-focus-lock",zt="data-focus-lock-disabled",So="data-no-focus-lock",Oo="data-autofocus-inside";function Ro(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function Ao(e,t){var n=a.useState(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(o){let r=n.value;r!==o&&(n.value=o,n.callback(o,r))}}}})[0];return n.callback=t,n.facade}function Kt(e,t){return Ao(t,function(n){return e.forEach(function(o){return Ro(o,n)})})}var Ge={width:"1px",height:"0px",padding:0,overflow:"hidden",position:"fixed",top:"1px",left:"1px"};O.node;var xe=function(){return xe=Object.assign||function(t){for(var n,o=1,r=arguments.length;o<r;o++){n=arguments[o];for(let i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t},xe.apply(this,arguments)};function xo(e,t){let n={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.indexOf(o)<0&&(n[o]=e[o]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(e);r<o.length;r++)t.indexOf(o[r])<0&&Object.prototype.propertyIsEnumerable.call(e,o[r])&&(n[o[r]]=e[o[r]]);return n}function Xt(e){return e}function Qt(e,t){t===void 0&&(t=Xt);let n=[],o=!1;return{read:function(){if(o)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:e},useMedium:function(i){let c=t(i,o);return n.push(c),function(){n=n.filter(function(u){return u!==c})}},assignSyncMedium:function(i){for(o=!0;n.length;){let c=n;n=[],c.forEach(i)}n={push:function(c){return i(c)},filter:function(){return n}}},assignMedium:function(i){o=!0;let c=[];if(n.length){let f=n;n=[],f.forEach(i),c=n}let u=function(){let f=c;c=[],f.forEach(i)},l=function(){return Promise.resolve().then(u)};l(),n={push:function(f){c.push(f),l()},filter:function(f){return c=c.filter(f),n}}}}}function at(e,t){return t===void 0&&(t=Xt),Qt(e,t)}function Vt(e){e===void 0&&(e={});let t=Qt(null);return t.options=xe({async:!0,ssr:!1},e),t}var Jt=function(e){let t=e.sideCar,n=xo(e,["sideCar"]);if(!t)throw new Error("Sidecar: please provide `sideCar` property to import the right car");let o=t.read();if(!o)throw new Error("Sidecar medium not found");return a.createElement(o,xe({},n))};Jt.isSideCarExport=!0;function Do(e,t){return e.useMedium(t),Jt}var en=at({},function(e){let t=e.target,n=e.currentTarget;return{target:t,currentTarget:n}}),tn=at(),ko=at(),Io=Vt({async:!0}),Fo=[],_e=a.forwardRef(function(t,n){let o,r=a.useState(),i=r[0],c=r[1],u=a.useRef(),l=a.useRef(!1),f=a.useRef(null),y=t.children,h=t.disabled,g=t.noFocusGuards,R=t.persistentFocus,I=t.crossFrame,p=t.autoFocus,b=t.allowTextSelection,L=t.group,N=t.className,k=t.whiteList,F=t.shards,M=F===void 0?Fo:F,A=t.as,W=A===void 0?"div":A,_=t.lockProps,Y=_===void 0?{}:_,j=t.sideCar,z=t.returnFocus,s=t.onActivation,d=t.onDeactivation,v=a.useState({}),w=v[0],E=a.useCallback(function(){f.current=f.current||document&&document.activeElement,u.current&&s&&s(u.current),l.current=!0},[s]),S=a.useCallback(function(){l.current=!1,d&&d(u.current)},[d]),C=a.useCallback(function(G){let oe=f.current;if(z&&oe&&oe.focus){let ge=typeof z=="object"?z:void 0;f.current=null,G?Promise.resolve().then(function(){return oe.focus(ge)}):oe.focus(ge)}},[z]),T=a.useCallback(function(G){l.current&&en.useMedium(G)},[]),P=tn.useMedium,x=a.useCallback(function(G){u.current!==G&&(u.current=G,c(G))},[]);typeof b<"u"&&console.warn("React-Focus-Lock: allowTextSelection is deprecated and enabled by default"),a.useEffect(function(){u.current||console.error("FocusLock: could not obtain ref to internal node")},[]);let D=Qe((o={},o[zt]=h&&"disabled",o[Je]=L,o),Y),B=g!==!0,$=B&&g!=="tail",Me=Kt([n,x]);return a.createElement(a.Fragment,null,B&&[a.createElement("div",{key:"guard-first","data-focus-guard":!0,tabIndex:h?-1:0,style:Ge}),a.createElement("div",{key:"guard-nearest","data-focus-guard":!0,tabIndex:h?-1:1,style:Ge})],!h&&a.createElement(j,{id:w,sideCar:Io,observed:i,disabled:h,persistentFocus:R,crossFrame:I,autoFocus:p,whiteList:k,shards:M,onActivation:E,onDeactivation:S,returnFocus:C}),a.createElement(W,Qe({ref:Me},D,{className:N,onBlur:P,onFocus:T}),y),$&&a.createElement("div",{"data-focus-guard":!0,tabIndex:h?-1:0,style:Ge}))});_e.propTypes={children:O.node,disabled:O.bool,returnFocus:O.oneOfType([O.bool,O.object]),noFocusGuards:O.bool,allowTextSelection:O.bool,autoFocus:O.bool,persistentFocus:O.bool,crossFrame:O.bool,group:O.string,className:O.string,whiteList:O.func,shards:O.arrayOf(O.any),as:O.oneOfType([O.string,O.func,O.object]),lockProps:O.object,onActivation:O.func,onDeactivation:O.func,sideCar:O.any.isRequired};_e.defaultProps={children:void 0,disabled:!1,returnFocus:!1,noFocusGuards:!1,autoFocus:!0,persistentFocus:!1,crossFrame:!0,allowTextSelection:void 0,group:void 0,className:void 0,whiteList:void 0,shards:void 0,as:"div",lockProps:{},onActivation:void 0,onDeactivation:void 0};function et(e,t){return et=Object.setPrototypeOf||function(o,r){return o.__proto__=r,o},et(e,t)}function _o(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,et(e,t)}function Lo(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function No(e,t){{if(typeof e!="function")throw new Error("Expected reducePropsToState to be a function.");if(typeof t!="function")throw new Error("Expected handleStateChangeOnClient to be a function.")}function n(o){return o.displayName||o.name||"Component"}return function(r){if(typeof r!="function")throw new Error("Expected WrappedComponent to be a React component.");let i=[],c;function u(){c=e(i.map(function(f){return f.props})),t(c)}let l=function(f){_o(y,f);function y(){return f.apply(this,arguments)||this}y.peek=function(){return c};let h=y.prototype;return h.componentDidMount=function(){i.push(this),u()},h.componentDidUpdate=function(){u()},h.componentWillUnmount=function(){let R=i.indexOf(this);i.splice(R,1),u()},h.render=function(){return a.createElement(r,this.props)},y}(a.PureComponent);return Lo(l,"displayName","SideEffect("+n(r)+")"),l}}var V=function(e){let t=Array(e.length);for(let n=0;n<e.length;++n)t[n]=e[n];return t},tt=function(e){return Array.isArray(e)?e:[e]},Mo=function(e){let t=new Set,n=e.length;for(let o=0;o<n;o+=1)for(let r=o+1;r<n;r+=1){let i=e[o].compareDocumentPosition(e[r]);(i&Node.DOCUMENT_POSITION_CONTAINED_BY)>0&&t.add(r),(i&Node.DOCUMENT_POSITION_CONTAINS)>0&&t.add(o)}return e.filter(function(o,r){return!t.has(r)})},nn=function(e){return e.parentNode?nn(e.parentNode):e},st=function(e){return tt(e).filter(Boolean).reduce(function(n,o){let r=o.getAttribute(Je);return n.push.apply(n,r?Mo(V(nn(o).querySelectorAll("["+Je+'="'+r+'"]:not(['+zt+'="disabled"])'))):[o]),n},[])},Bo=function(e){return!e||!e.getPropertyValue?!1:e.getPropertyValue("display")==="none"||e.getPropertyValue("visibility")==="hidden"},on=function(e){return!e||e===document||e&&e.nodeType===Node.DOCUMENT_NODE||!Bo(window.getComputedStyle(e,null))&&on(e.parentNode&&e.parentNode.nodeType===Node.DOCUMENT_FRAGMENT_NODE?e.parentNode.host:e.parentNode)},jo=function(e){return!((e.tagName==="INPUT"||e.tagName==="BUTTON")&&(e.type==="hidden"||e.disabled))},ut=function(e){return!!(e&&e.dataset&&e.dataset.focusGuard)},De=function(e){return!ut(e)},$o=function(e){return!!e},Wo=function(e,t){let n=e.tabIndex-t.tabIndex,o=e.index-t.index;if(n){if(!e.tabIndex)return 1;if(!t.tabIndex)return-1}return n||o},rn=function(e,t,n){return V(e).map(function(o,r){return{node:o,index:r,tabIndex:n&&o.tabIndex===-1?(o.dataset||{}).focusGuard?0:-1:o.tabIndex}}).filter(function(o){return!t||o.tabIndex>=0}).sort(Wo)},Yo=["button:enabled","select:enabled","textarea:enabled","input:enabled","a[href]","area[href]","summary","iframe","object","embed","audio[controls]","video[controls]","[tabindex]","[contenteditable]","[autofocus]"],nt=Yo.join(","),Uo=nt+", [data-focus-guard]",lt=function(e,t){return e.reduce(function(n,o){return n.concat(V(o.querySelectorAll(t?Uo:nt)),o.parentNode?V(o.parentNode.querySelectorAll(nt)).filter(function(r){return r===o}):[])},[])},Ho=function(e){let t=e.querySelectorAll("["+Oo+"]");return V(t).map(function(n){return lt([n])}).reduce(function(n,o){return n.concat(o)},[])},ft=function(e){return V(e).filter(function(t){return on(t)}).filter(function(t){return jo(t)})},ot=function(e,t){return rn(ft(lt(e,t)),!0,t)},St=function(e){return rn(ft(lt(e)),!1)},Go=function(e){return ft(Ho(e))},rt=function(e,t){return t===void 0&&(t=[]),t.push(e),e.parentNode&&rt(e.parentNode,t),t},qe=function(e,t){let n=rt(e),o=rt(t);for(let r=0;r<n.length;r+=1){let i=n[r];if(o.indexOf(i)>=0)return i}return!1},cn=function(e,t,n){let o=tt(e),r=tt(t),i=o[0],c=!1;return r.filter(Boolean).forEach(function(u){c=qe(c||u,u)||c,n.filter(Boolean).forEach(function(l){let f=qe(i,l);f&&(!c||f.contains(c)?c=f:c=qe(f,c))})}),c},qo=function(e){return e.reduce(function(t,n){return t.concat(Go(n))},[])},Zo=function(e){let t=st(e).filter(De),n=cn(e,e,t),o=ot([n],!0),r=ot(t).filter(function(i){let c=i.node;return De(c)}).map(function(i){return i.node});return o.map(function(i){let c=i.node,u=i.index;return{node:c,index:u,lockItem:r.indexOf(c)>=0,guard:ut(c)}})},zo=function(e){return e===document.activeElement},Ko=function(e){return!!V(e.querySelectorAll("iframe")).some(function(t){return zo(t)})},an=function(e){let t=document&&document.activeElement;return!t||t.dataset&&t.dataset.focusGuard?!1:st(e).reduce(function(n,o){return n||o.contains(t)||Ko(o)},!1)},Xo=function(){return document&&V(document.querySelectorAll("["+So+"]")).some(function(e){return e.contains(document.activeElement)})},sn=function(e){return e.tagName==="INPUT"&&e.type==="radio"},Qo=function(e,t){return t.filter(sn).filter(function(n){return n.name===e.name}).filter(function(n){return n.checked})[0]||e},dt=function(e,t){return sn(e)&&e.name?Qo(e,t):e},Vo=function(e){let t=new Set;return e.forEach(function(n){return t.add(dt(n,e))}),e.filter(function(n){return t.has(n)})},Ot=function(e){return e[0]&&e.length>1?dt(e[0],e):e[0]},Rt=function(e,t){return e.length>1?e.indexOf(dt(e[t],e)):t},un="NEW_FOCUS",Jo=function(e,t,n,o){let r=e.length,i=e[0],c=e[r-1],u=ut(n);if(e.indexOf(n)>=0)return;let l=t.indexOf(n),f=o?t.indexOf(o):l,y=o?e.indexOf(o):-1,h=l-f,g=t.indexOf(i),R=t.indexOf(c),I=Vo(t),p=I.indexOf(n)-(o?I.indexOf(o):l),b=Rt(e,0),L=Rt(e,r-1);if(l===-1||y===-1)return un;if(!h&&y>=0)return y;if(l<=g&&u&&Math.abs(h)>1)return L;if(l>=R&&u&&Math.abs(h)>1)return b;if(h&&Math.abs(p)>1)return y;if(l<=g)return L;if(l>R)return b;if(h)return Math.abs(h)>1?y:(r+y+h)%r},er=function(e){return function(t){return t.autofocus||t.dataset&&!!t.dataset.autofocus||e.indexOf(t)>=0}},tr=function(e,t){let n=new Map;return t.forEach(function(o){return n.set(o.node,o)}),e.map(function(o){return n.get(o)}).filter($o)},nr=function(e,t){let n=document&&document.activeElement,o=st(e).filter(De),r=cn(n||e,e,o),i=St(o),c=ot(o).filter(function(h){let g=h.node;return De(g)});if(!c[0]&&(c=i,!c[0]))return;let u=St([r]).map(function(h){return h.node}),l=tr(u,c),f=l.map(function(h){return h.node}),y=Jo(f,u,n,t);if(y===un){let h=i.map(function(g){return g.node}).filter(er(qo(o)));return{node:h&&h.length?Ot(h):Ot(f)}}return y===void 0?y:l[y]},or=function(e){e.focus(),"contentWindow"in e&&e.contentWindow&&e.contentWindow.focus()},Ze=0,ze=!1,ln=function(e,t){let n=nr(e,t);if(!ze&&n){if(Ze>2){console.error("FocusLock: focus-fighting detected. Only one focus management system could be active. See https://github.com/theKashey/focus-lock/#focus-fighting"),ze=!0,setTimeout(function(){ze=!1},1);return}Ze++,or(n.node),Ze--}};function fn(e){let t=window,n=t.setImmediate;typeof n<"u"?n(e):setTimeout(e,1)}var rr=function(){return document&&document.activeElement===document.body},cr=function(){return rr()||Xo()},fe=null,se=null,de=null,he=!1,ir=function(){return!0},ar=function(t){return(fe.whiteList||ir)(t)},sr=function(t,n){de={observerNode:t,portaledElement:n}},ur=function(t){return de&&de.portaledElement===t};function At(e,t,n,o){let r=null,i=e;do{let c=o[i];if(c.guard)c.node.dataset.focusAutoGuard&&(r=c);else if(c.lockItem){if(i!==e)return;r=null}else break}while((i+=n)!==t);r&&(r.node.tabIndex=0)}var lr=function(t){return t&&"current"in t?t.current:t},fr=function(t){return t?!!he:he==="meanwhile"},ke=function(){let t=!1;if(fe){let n=fe,o=n.observed,r=n.persistentFocus,i=n.autoFocus,c=n.shards,u=n.crossFrame,l=o||de&&de.portaledElement,f=document&&document.activeElement;if(l){let y=[l].concat(c.map(lr).filter(Boolean));if((!f||ar(f))&&(r||fr(u)||!cr()||!se&&i)&&(l&&!(an(y)||ur(f))&&(document&&!se&&f&&!i?(f.blur&&f.blur(),document.body.focus()):(t=ln(y,se),de={})),he=!1,se=document&&document.activeElement),document){let h=document&&document.activeElement,g=Zo(y),R=g.map(function(I){return I.node}).indexOf(h);R>-1&&(g.filter(function(I){let p=I.guard,b=I.node;return p&&b.dataset.focusAutoGuard}).forEach(function(I){return I.node.removeAttribute("tabIndex")}),At(R,g.length,1,g),At(R,-1,-1,g))}}}return t},dn=function(t){ke()&&t&&(t.stopPropagation(),t.preventDefault())},mt=function(){return fn(ke)},dr=function(t){let n=t.target,o=t.currentTarget;o.contains(n)||sr(o,n)},mr=function(){return null};O.node.isRequired;var mn=function(){he="just",setTimeout(function(){he="meanwhile"},0)},pr=function(){document.addEventListener("focusin",dn,!0),document.addEventListener("focusout",mt),window.addEventListener("blur",mn)},hr=function(){document.removeEventListener("focusin",dn,!0),document.removeEventListener("focusout",mt),window.removeEventListener("blur",mn)};function yr(e){return e.filter(function(t){return!t.disabled})}function gr(e){let t=e.slice(-1)[0];t&&!fe&&pr();let n=fe,o=n&&t&&t.id===n.id;fe=t,n&&!o&&(n.onDeactivation(),e.filter(function(r){return r.id===n.id}).length||n.returnFocus(!t)),t?(se=null,(!o||n.observed!==t.observed)&&t.onActivation(),ke(),fn(ke)):(hr(),se=null)}en.assignSyncMedium(dr);tn.assignMedium(mt);ko.assignMedium(function(e){return e({moveFocusInside:ln,focusInside:an})});var br=No(yr,gr)(mr),pn=a.forwardRef(function(t,n){return a.createElement(_e,Qe({sideCar:br,ref:n},t))}),hn=_e.propTypes||{};hn.sideCar;var vr=wo(hn,["sideCar"]);pn.propTypes=vr;var me=function(){return me=Object.assign||function(t){for(var n,o=1,r=arguments.length;o<r;o++){n=arguments[o];for(let i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t},me.apply(this,arguments)};function wr(e,t){let n={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.indexOf(o)<0&&(n[o]=e[o]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(e);r<o.length;r++)t.indexOf(o[r])<0&&Object.prototype.propertyIsEnumerable.call(e,o[r])&&(n[o[r]]=e[o[r]]);return n}var Oe="right-scroll-bar-position",Re="width-before-scroll-bar",Er="with-scroll-bars-hidden",Tr="--removed-body-scroll-bar-size",yn=Vt(),Ke=function(){},Le=a.forwardRef(function(e,t){let n=a.useRef(null),o=a.useState({onScrollCapture:Ke,onWheelCapture:Ke,onTouchMoveCapture:Ke}),r=o[0],i=o[1],c=e.forwardProps,u=e.children,l=e.className,f=e.removeScrollBar,y=e.enabled,h=e.shards,g=e.sideCar,R=e.noIsolation,I=e.inert,p=e.allowPinchZoom,b=e.as,L=b===void 0?"div":b,N=wr(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noIsolation","inert","allowPinchZoom","as"]),k=g,F=Kt([n,t]),M=me({},N,r);return a.createElement(a.Fragment,null,y&&a.createElement(k,{sideCar:yn,removeScrollBar:f,shards:h,noIsolation:R,inert:I,setCallbacks:i,allowPinchZoom:!!p,lockRef:n}),c?a.cloneElement(a.Children.only(u),me({},M,{ref:F})):a.createElement(L,me({},M,{className:l,ref:F}),u))});Le.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};Le.classNames={fullWidth:Re,zeroRight:Oe};var Cr=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function Pr(){if(!document)return null;let e=document.createElement("style");e.type="text/css";let t=Cr();return t&&e.setAttribute("nonce",t),e}function Sr(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function Or(e){(document.head||document.getElementsByTagName("head")[0]).appendChild(e)}var Rr=function(){let e=0,t=null;return{add:function(n){e==0&&(t=Pr())&&(Sr(t,n),Or(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},Ar=function(){let e=Rr();return function(t){a.useEffect(function(){return e.add(t),function(){e.remove()}},[])}},gn=function(){let e=Ar();return function(n){let o=n.styles;return e(o),null}},xr={left:0,top:0,right:0,gap:0},Xe=function(e){return parseInt(e||"",10)||0},Dr=function(e){let t=window.getComputedStyle(document.body),n=t[e==="padding"?"paddingLeft":"marginLeft"],o=t[e==="padding"?"paddingTop":"marginTop"],r=t[e==="padding"?"paddingRight":"marginRight"];return[Xe(n),Xe(o),Xe(r)]},xt=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return xr;let t=Dr(e),n=document.documentElement.clientWidth,o=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,o-n+t[2]-t[0])}},kr=gn(),Ir=function(e,t,n,o){let r=e.left,i=e.top,c=e.right,u=e.gap;return n===void 0&&(n="margin"),`
.`+Er+` {
overflow: hidden `+o+`;
padding-right: `+u+"px "+o+`;
}
body {
overflow: hidden `+o+`;
`+[t&&"position: relative "+o+";",n==="margin"&&`
padding-left: `+r+`px;
padding-top: `+i+`px;
padding-right: `+c+`px;
margin-left:0;
margin-top:0;
margin-right: `+u+"px "+o+`;
`,n==="padding"&&"padding-right: "+u+"px "+o+";"].filter(Boolean).join("")+`
}
.`+Oe+` {
right: `+u+"px "+o+`;
}
.`+Re+` {
margin-right: `+u+"px "+o+`;
}
.`+Oe+" ."+Oe+` {
right: 0 `+o+`;
}
.`+Re+" ."+Re+` {
margin-right: 0 `+o+`;
}
body {
`+Tr+": "+u+`px;
}
`},Fr=function(e){let t=a.useState(xt(e.gapMode)),n=t[0],o=t[1];a.useEffect(function(){o(xt(e.gapMode))},[e.gapMode]);let r=e.noRelative,i=e.noImportant,c=e.gapMode;return a.createElement(kr,{styles:Ir(n,!r,c===void 0?"margin":c,i?"":"!important")})},_r=function(e){let t=window.getComputedStyle(e);return t.overflowY!=="hidden"&&!(t.overflowY===t.overflowX&&t.overflowY==="visible")},Lr=function(e){let t=window.getComputedStyle(e);return t.overflowX!=="hidden"&&!(t.overflowY===t.overflowX&&t.overflowX==="visible")},Dt=function(e,t){let n=t;do{if(bn(e,n)){let r=vn(e,n),i=r[1],c=r[2];if(i>c)return!0}n=n.parentNode}while(n&&n!==document.body);return!1},Nr=function(e){let t=e.scrollTop,n=e.scrollHeight,o=e.clientHeight;return[t,n,o]},Mr=function(e){let t=e.scrollLeft,n=e.scrollWidth,o=e.clientWidth;return[t,n,o]},bn=function(e,t){return e==="v"?_r(t):Lr(t)},vn=function(e,t){return e==="v"?Nr(t):Mr(t)},Br=function(e,t,n,o,r){let i=o,c=n.target,u=t.contains(c),l=!1,f=i>0,y=0,h=0;do{let g=vn(e,c),R=g[0],I=g[1],p=g[2],b=I-p-R;(R||b)&&bn(e,c)&&(y+=b,h+=R),c=c.parentNode}while(!u&&c!==document.body||u&&(t.contains(c)||t===c));return(f&&(r&&y===0||!r&&i>y)||!f&&(r&&h===0||!r&&-i>h))&&(l=!0),l},ct=!1;if(typeof window<"u")try{let e=Object.defineProperty({},"passive",{get:function(){return ct=!0,!0}});window.addEventListener("test",e,e),window.removeEventListener("test",e,e)}catch{ct=!1}var re=ct?{passive:!1}:!1,Ce=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},kt=function(e){return[e.deltaX,e.deltaY]},It=function(e){return e&&"current"in e?e.current:e},jr=function(e,t){return e[0]===t[0]&&e[1]===t[1]},$r=function(e){return`
.block-interactivity-`+e+` {pointer-events: none;}
.allow-interactivity-`+e+` {pointer-events: all;}
`},Wr=0,ce=[];function Yr(e){let t=a.useRef([]),n=a.useRef([0,0]),o=a.useRef(),r=a.useState(Wr++)[0],i=a.useState(function(){return gn()})[0],c=a.useRef(e);a.useEffect(function(){c.current=e},[e]),a.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-"+r);let p=[e.lockRef.current].concat((e.shards||[]).map(It)).filter(Boolean);return p.forEach(function(b){return b.classList.add("allow-interactivity-"+r)}),function(){document.body.classList.remove("block-interactivity-"+r),p.forEach(function(b){return b.classList.remove("allow-interactivity-"+r)})}}},[e.inert,e.lockRef.current,e.shards]);let u=a.useCallback(function(p,b){if("touches"in p&&p.touches.length===2)return!c.current.allowPinchZoom;let L=Ce(p),N=n.current,k="deltaX"in p?p.deltaX:N[0]-L[0],F="deltaY"in p?p.deltaY:N[1]-L[1],M,A=p.target,W=Math.abs(k)>Math.abs(F)?"h":"v",_=Dt(W,A);if(!_)return!0;if(_?M=W:(M=W==="v"?"h":"v",_=Dt(W,A)),!_)return!1;if(!o.current&&"changedTouches"in p&&(k||F)&&(o.current=M),!M)return!0;let Y=o.current||M;return Br(Y,b,p,Y==="h"?k:F,!0)},[]),l=a.useCallback(function(p){let b=p;if(!ce.length||ce[ce.length-1]!==i)return;let L="deltaY"in b?kt(b):Ce(b),N=t.current.filter(function(k){return k.name===b.type&&k.target===b.target&&jr(k.delta,L)})[0];if(N&&N.should){b.preventDefault();return}if(!N){let k=(c.current.shards||[]).map(It).filter(Boolean).filter(function(M){return M.contains(b.target)});(k.length>0?u(b,k[0]):!c.current.noIsolation)&&b.preventDefault()}},[]),f=a.useCallback(function(p,b,L,N){let k={name:p,delta:b,target:L,should:N};t.current.push(k),setTimeout(function(){t.current=t.current.filter(function(F){return F!==k})},1)},[]),y=a.useCallback(function(p){n.current=Ce(p),o.current=void 0},[]),h=a.useCallback(function(p){f(p.type,kt(p),p.target,u(p,e.lockRef.current))},[]),g=a.useCallback(function(p){f(p.type,Ce(p),p.target,u(p,e.lockRef.current))},[]);a.useEffect(function(){return ce.push(i),e.setCallbacks({onScrollCapture:h,onWheelCapture:h,onTouchMoveCapture:g}),document.addEventListener("wheel",l,re),document.addEventListener("touchmove",l,re),document.addEventListener("touchstart",y,re),function(){ce=ce.filter(function(p){return p!==i}),document.removeEventListener("wheel",l,re),document.removeEventListener("touchmove",l,re),document.removeEventListener("touchstart",y,re)}},[]);let R=e.removeScrollBar,I=e.inert;return a.createElement(a.Fragment,null,I?a.createElement(i,{styles:$r(r)}):null,R?a.createElement(Fr,{gapMode:"margin"}):null)}var Ur=Do(yn,Yr),wn=a.forwardRef(function(e,t){return a.createElement(Le,me({},e,{ref:t,sideCar:Ur}))});wn.classNames=Le.classNames;function H(){return H=Object.assign||function(e){for(let t=1;t<arguments.length;t++){let n=arguments[t];for(let o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},H.apply(this,arguments)}function Ne(e,t){if(e==null)return{};let n={},o=Object.keys(e),r,i;for(i=0;i<o.length;i++)r=o[i],!(t.indexOf(r)>=0)&&(n[r]=e[r]);return n}var En={allowPinchZoom:O.bool,dangerouslyBypassFocusLock:O.bool,dangerouslyBypassScrollLock:O.bool,initialFocusRef:function(){return null},onDismiss:O.func},ne=Fe(function(t,n){let o=t.as,r=o===void 0?"div":o,i=t.isOpen,c=i===void 0?!0:i,u=Ne(t,["as","isOpen"]);return Yt("dialog"),a.useEffect(function(){c?window.__REACH_DISABLE_TOOLTIPS=!0:window.requestAnimationFrame(function(){window.__REACH_DISABLE_TOOLTIPS=!1})},[c]),c?a.createElement(Ut,{"data-reach-dialog-wrapper":""},a.createElement(Hr,H({ref:n,as:r},u))):null});ne.displayName="DialogOverlay",ne.propTypes=H({},En,{isOpen:O.bool});var Hr=Fe(function(t,n){let o=t.allowPinchZoom,r=t.as,i=r===void 0?"div":r,c=t.dangerouslyBypassFocusLock,u=c===void 0?!1:c,l=t.dangerouslyBypassScrollLock,f=l===void 0?!1:l,y=t.initialFocusRef,h=t.onClick,g=t.onDismiss,R=g===void 0?U:g,I=t.onKeyDown,p=t.onMouseDown,b=t.unstable_lockFocusAcrossFrames,L=b===void 0?!0:b,N=Ne(t,["allowPinchZoom","as","dangerouslyBypassFocusLock","dangerouslyBypassScrollLock","initialFocusRef","onClick","onDismiss","onKeyDown","onMouseDown","unstable_lockFocusAcrossFrames"]),k=a.useRef(null),F=a.useRef(null),M=vo(F,n),A=a.useCallback(function(){y&&y.current&&y.current.focus()},[y]);function W(j){k.current===j.target&&(j.stopPropagation(),R(j))}function _(j){j.key==="Escape"&&(j.stopPropagation(),R(j))}function Y(j){k.current=j.target}return a.useEffect(function(){return F.current?Gr(F.current):void 0},[]),a.createElement(pn,{autoFocus:!0,returnFocus:!0,onActivation:A,disabled:u,crossFrame:L},a.createElement(wn,{allowPinchZoom:o,enabled:!f},a.createElement(i,H({},N,{ref:M,"data-reach-dialog-overlay":"",onClick:Se(h,W),onKeyDown:Se(I,_),onMouseDown:Se(p,Y)}))))});ne.displayName="DialogOverlay",ne.propTypes=H({},En);var ye=Fe(function(t,n){let o=t.as,r=o===void 0?"div":o,i=t.onClick;t.onKeyDown;let c=Ne(t,["as","onClick","onKeyDown"]);return a.createElement(r,H({"aria-modal":"true",role:"dialog",tabIndex:-1},c,{ref:n,"data-reach-dialog-content":"",onClick:Se(i,function(u){u.stopPropagation()})}))});ye.displayName="DialogContent",ye.propTypes={"aria-label":Ie,"aria-labelledby":Ie};var Ft=Fe(function(t,n){let o=t.allowPinchZoom,r=o===void 0?!1:o,i=t.initialFocusRef,c=t.isOpen,u=t.onDismiss,l=u===void 0?U:u,f=Ne(t,["allowPinchZoom","initialFocusRef","isOpen","onDismiss"]);return a.createElement(ne,{allowPinchZoom:r,initialFocusRef:i,isOpen:c,onDismiss:l},a.createElement(ye,H({ref:n},f)))});Ft.displayName="Dialog",Ft.propTypes={isOpen:O.bool,onDismiss:O.func,"aria-label":Ie,"aria-labelledby":Ie};function Gr(e){let t=[],n=[],o=ho(e);return e?(Array.prototype.forEach.call(o.querySelectorAll("body > *"),function(r){let i,c,u=(i=e.parentNode)==null||(c=i.parentNode)==null?void 0:c.parentNode;if(r===u)return;let l=r.getAttribute("aria-hidden");l!==null&&l!=="false"||(t.push(l),n.push(r),r.setAttribute("aria-hidden","true"))}),function(){n.forEach(function(r,i){let c=t[i];c===null?r.removeAttribute("aria-hidden"):r.setAttribute("aria-hidden",c)})}):(console.warn("A ref has not yet been attached to a dialog node when attempting to call `createAriaHider`."),U)}function Ie(e,t,n,o,r){let i=`
See https://www.w3.org/TR/wai-aria/#aria-label for details.`;return!e["aria-label"]&&!e["aria-labelledby"]?new Error("A <"+n+"> must have either an `aria-label` or `aria-labelledby` prop.\n "+i):e["aria-label"]&&e["aria-labelledby"]?new Error("You provided both `aria-label` and `aria-labelledby` props to a <"+n+">. If the a label for this component is visible on the screen, that label's component should be given a unique ID prop, and that ID should be passed as the `aria-labelledby` prop into <"+n+">. If the label cannot be determined programmatically from the content of the element, an alternative label should be provided as the `aria-label` prop, which will be used as an `aria-label` on the HTML tag."+i):e[t]!=null&&!go(e[t])?new Error("Invalid prop `"+t+"` supplied to `"+n+"`. Expected `string`, received `"+(Array.isArray(r)?"array":typeof r)+"`."):null}var pe=require("react/jsx-runtime"),pt=({label:e,close:t,children:n,modalBodyProps:o={},closeButtonProps:r={},isOpen:i,maxWidth:c="40em",...u})=>(0,pe.jsx)(ne,{"data-testid":"ladle-dialog-overlay",...u,isOpen:i,onDismiss:t,children:(0,pe.jsxs)(ye,{"aria-label":e||"Modal","data-testid":"ladle-dialog",style:{maxWidth:c},children:[(0,pe.jsx)(He,{...r,onClick:l=>{r.onClick?.(l),!l.isDefaultPrevented()&&t(l)}}),(0,pe.jsx)("div",{...o,className:J("ladle-addon-modal-body",o?.id),children:n})]})});var Tn=we(require("react"));var ht=require("react/jsx-runtime"),qr=({children:e,dialogProps:t={},...n})=>{let[o,r]=Tn.default.useState(!1);return(0,ht.jsx)(We,{...n,onClick:i=>{n.onClick?.(i),!i.isDefaultPrevented()&&r(!0)},className:J(o&&"ladle-active",n.className),children:(0,ht.jsx)(pt,{isOpen:o,close:()=>r(!1),...t,children:e})})};0&&(module.exports={AddonButton,AddonDialog,AddonDialogButton,ExampleLadleIcon,LadleDialogCloseButton,LadleDialogCloseIcon,LadleIconButton});
/*! *****************************************************************************
Copyright (c) Microsoft Corporation.
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */