diff --git a/.forceignore b/.forceignore index a8f4acb..6f56f31 100644 --- a/.forceignore +++ b/.forceignore @@ -10,5 +10,4 @@ package.xml **/profiles/ # LWC Jes **/__tests__/** -triggerHandler.md -force-app/main/** \ No newline at end of file +triggerHandler.md \ No newline at end of file diff --git a/docs/Collection.md b/docs/Collection.md index 3630174..84daf12 100644 --- a/docs/Collection.md +++ b/docs/Collection.md @@ -13,6 +13,7 @@ sf project deploy start \ -o sfdxOrg ``` + --- # Documentation diff --git a/docs/HttpCalloutMockRouter.md b/docs/HttpCalloutMockRouter.md index cc1a549..eb82dea 100644 --- a/docs/HttpCalloutMockRouter.md +++ b/docs/HttpCalloutMockRouter.md @@ -2,8 +2,8 @@ *Configuration-driven, endpoint pattern-based router for Http Mocks.* [Source](https://github.com/pkozuchowski/Apex-Opensource-Library/tree/master/force-app/commons/httpMocks) -[Install In Sandbox](https://test.salesforce.com/packaging/installPackage.apexp?p0=04t08000000UK7EAAW) -[Install In Production](https://login.salesforce.com/packaging/installPackage.apexp?p0=04t08000000UK7EAAW) +[Install In Sandbox](https://test.salesforce.com/packaging/installPackage.apexp?p0=04tJ6000000LVAGIA4) +[Install In Production](https://login.salesforce.com/packaging/installPackage.apexp?p0=04tJ6000000LVAGIA4) ```bash sf project deploy start -d force-app/commons/httpMocks -o sfdxOrg @@ -11,26 +11,19 @@ sf project deploy start -d force-app/commons/httpMocks -o sfdxOrg --- # Documentation -HTTP Callout Router is a configuration-driven framework for mocking Http Callouts that matches mocks by endpoint pattern and HTTP method. +Http Callout Mock Router is a configuration-driven framework for mocking Http Callouts, that matches mocks by endpoint pattern and HTTP method. Let's consider the following configuration for Salesforce REST API: -#### Variables +#### Mocks +![http-router-example.png](/img/http-router-example.png) -| DeveloperName | Pattern | -|---------------|----------------------| -| sfId | ([0-9a-zA-Z]{15,18}) | -| sObjectType | \w+ | +Reusable patterns visible in curly braces are defined in **Http Callout Mock Variables** as follows: -#### Mocks -| Developer Name | Default | Methods | Endpoint | Status Code | Status | Response | Static Resource | Apex Class | -|-----------------------------------|---------|------------|------------------------------------------------------|-------------|--------------|------------------------------------------------------------------------|------------------|-------------------------------------| -| SampleAPI_Get_Beers_Ale_OK | ☑ | GET | callout:SampleAPI/beers/ale | 200 | OK | [{"price":"$16.99","name":"Founders All Day IPA","rating":4,"id":1}] | | | -| SampleAPI_Update_Beers_Ale_OK | ☑ | POST,Patch | callout:SampleAPI/beers/ale | 200 | OK | | | | -| SampleAPI_Common_401_Unauthorized | ☐ | GET | callout:SampleAPI/.* | 401 | Unauthorized | [{"message":"Invalid access token. Please pass a valid access token"}] | | | -| SF_REST_Query | ☑ | GET | callout:SfRestAPI/query/.* | 200 | OK | {"records":[{"Name":"Test Account"}]} | | | -| SF_REST_Query_Empty | ☐ | GET | callout:SfRestAPI/query/.* | 200 | OK | {"records":[]} | | | -| SF_REST_SObject_Describe | ☑ | GET | callout:SfRestAPI/sobjects/{{sObjectType}}/describe/ | 200 | OK | | | SalesforceMocks.SObjectDescribeMock | -| SF_REST_SObject_Row_Get_Account | ☑ | GET | callout:SfRestAPI/sobjects/Account/{{sfId}} | 200 | OK | | Mocks_SF_Account | | +| DeveloperName | Pattern | +|---------------|----------------------------------------| +| recordId | ^[a-zA-Z0-9]{15}([a-zA-Z0-9]{3})?$ | +| datetime | ^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}Z$ | +| | | Router loads default (*Default__c=true*) configuration and substitutes all endpoint variables (*{{variable}}*) with their values defined in HttpCalloutMockVariable__mdt custom metadata. @@ -60,9 +53,9 @@ tests uses OrgMocks class. 1. Router respond method checks mocks from custom metadata and any other mocks defined in code. 1. Each mock is checked for handled HTTP Methods, and if the endpoint matches with the request. 1. The first mock that matches response will have its response returned according to the settings. - - If StaticResource__c field is provided, mock will respond with it's content - - If ApexClass__c is provided, mock creates instance of this class and returns it. The class should implement HttpCalloutMock interface. - If Response__c field is provided, it's returned as callout response body. + - If StaticResource__c field is provided, mock will respond with its content + - If ApexClass__c is provided, mock creates an instance of this class and returns it. The class should implement HttpCalloutMock interface. - If Headers__c field is provided - it's split by new lines and colons and added to response body headers. 1. The response is handled. @@ -86,11 +79,57 @@ Each mock is registered under a unique developer name. We can utilize this name Consider this example: ```apex -Test.setMock(HttpCalloutMock.class, new OrgMocks() - .overrideMock('SF_REST_Query', HttpMocks.config('SF_REST_Query_Empty'))); +Test.setMock(HttpCalloutMock.class, HttpMocks.config() + .overrideMock('SF_Query_Account', 'SF_Query_Account_Empty') + .overrideMock('SF_Account_Get', new MyMockClass()) +); ``` `SF_REST_Query` mock was replaced, and now it will respond with mock registered under name `SF_REST_Query_Empty`. +`SF_Account_Get` mock will be replaced by MyMockClass—an implementation of HttpCalloutMock. + + +## Requests and Responses +You can check issued Http Requests and returned responses using the following methods: +```apex +List requests = HttpMocks.getRequests(); +List responses = HttpMocks.getResponses(); +``` +This is helpful when request and response are not directly exposed in unit tests, but we want to check if the payload is correct. + +--- +# Interfaces + +## HttpMocks +| Modifier and Type | Method and Description | +|---------------------------|------------------------------------------------------------------------------------------------------------------------------| +| static List | **getRequests()**
Returns list of handled HttpRequests in the order they were issued. | +| static List | **getResponses()**
Returns list of returned HttpResponses in order they were returned.* | +| static HttpCalloutMock | **json(Integer statusCode, String status, Object jsonObject)**
Returns mock with serialized JSON object as response. | +| static HttpCalloutMock | **staticResource(Integer statusCode, String status, String staticResource)**
Returns mock with Static Resource as body. | +| static HttpCalloutMock | **text(Integer statusCode, String status, String body)**
Returns mock with plain text body. | +| static HttpCalloutMock | **config()**
Returns router with all custom metadata mocks loaded. | +| static HttpCalloutMock | **config(String customMetadataName)**
Returns mock loaded from custom metadata by given developer name. | +| static HttpCalloutMock | **config(HttpCalloutMock__mdt customMetadata)**
Returns mock loaded from custom metadata record. | + +## HttpCalloutChainMock Interface +Extension of HttpCalloutMock, which adds `handles` method - This method checks if this mock class should handle incoming request. +```apex +public interface HttpCalloutChainMock extends HttpCalloutMock { + Boolean handles(HttpRequest request); +} +``` + +## HttpCalloutMockRouter + +| Modifier and Type | Method and Description | +|-----------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------| +| HttpCalloutMockRouter | **mock(String name, String methods, String endpointPattern, HttpCalloutMock mock)**
Register HttpCalloutMock for given Http method and endpoint pattern. | +| HttpCalloutMockRouter | **mock(String name, HttpCalloutChainMock handler)**
Register HttpCalloutChainMock implementation. | +| HttpCalloutMockRouter | **overrideMock(String name, String overrideMetadataName)**
Replaces mock registered under given name with different mock loaded from custom metadata | +| HttpCalloutMockRouter | **overrideMock(String name, HttpCalloutMock mock)**
Replaces mock registered under given name with different mock | +| HttpCalloutMockRouter | **variable(String name, String regexp)**
Registers regexp variable which will can be referenced in endpoint. | +| HttpCalloutMockRouter | **variables(Map vars)**
Registers regexp variables which will can be referenced in endpoint. | --- # Custom Metadata @@ -215,6 +254,14 @@ public class MyCustomMock implements HttpCalloutMock { --- # Change Log +### 1.1.0 +- Added shorthand override method Http + ```apex + public HttpCalloutMockRouter overrideMock(String name, String overrideMetadataName) + ``` +- Added HttpMocks methods to return issued requests and responses. + ### 1.0.2 -- Fixed bug in HTTP Headers specified in metadata, where header value would not be parsed correctly if it contained colon, which would cause issues for Location headers. +- Fixed bug in HTTP Headers specified in metadata, where header value would not be parsed correctly if it contained colon, which would cause issues for Location + headers. - Added help text to custom metadata fields. \ No newline at end of file diff --git a/docs/img/http-router-example.png b/docs/img/http-router-example.png index 39f647b..eb17967 100644 Binary files a/docs/img/http-router-example.png and b/docs/img/http-router-example.png differ diff --git a/docs/index.html b/docs/index.html index d7e1b00..d0505bc 100644 --- a/docs/index.html +++ b/docs/index.html @@ -1 +1 @@ -Apex Libra - Library of Salesforce Accelerators, Frameworks, Utilities

Apex Commons

Salesforce Frameworks

Salesforce Accelerators

Trigger Handler

Lambda

Collection

XML

Selectors

Selector Layer

LWC

\ No newline at end of file +Apex Libra - Library of Salesforce Accelerators, Frameworks, Utilities

Apex Commons

Salesforce Frameworks

Salesforce Accelerators

Trigger Handler

Lambda

Collection

XML

Selectors

Selector Layer

LWC

\ No newline at end of file diff --git a/docs/news/24_11_10.md b/docs/news/24_11_10.md new file mode 100644 index 0000000..0abb80c --- /dev/null +++ b/docs/news/24_11_10.md @@ -0,0 +1,30 @@ +# 2024/07/18 + +--- +# News +Http Mock Router now features a new shorthand method to override mocks with custom metadata: + +Previously: +```apex +Test.setMock(HttpCalloutMock.class, HttpMocks.config() + .overrideMock('SF_REST_Query', HttpMocks.config('SF_REST_Query_Empty'))); +``` + +Now becomes: +```apex +Test.setMock(HttpCalloutMock.class, HttpMocks.config() + .overrideMock('SF_REST_Query', 'SF_REST_Query_Empty')); +``` + +Also, HttpMocks has 2 new methods that will give you access to handled HttpRequests and returned HttpResponses: +```apex +/** + * @return List of handled HttpRequests in the order they were issued. + */ +public static List getRequests(); + +/** + * @return List of returned HttpResponses in order they were returned. + */ +public static List getResponses(); +``` \ No newline at end of file diff --git a/docs/static/js/main.fa12e836.js b/docs/static/js/main.fa12e836.js new file mode 100644 index 0000000..c9c3c69 --- /dev/null +++ b/docs/static/js/main.fa12e836.js @@ -0,0 +1,2 @@ +/*! For license information please see main.fa12e836.js.LICENSE.txt */ +!function(){var e={3512:function(e){e.exports={"global-setup":"#2A739E","service-cloud":"#7f2443","industry-cloud":"#4c2248","sales-cloud":"#00857d","commerce-cloud":"#41693d","community-cloud":"#ffc20e","marketing-cloud":"#ea7600",quip:"#cf451d"}},6185:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.bodyOpenClassName=t.portalClassName=void 0;var r=Object.assign||function(e){for(var t=1;t0&&0===(y-=1)&&c.show(t),n.props.shouldFocusAfterRender&&(n.props.shouldReturnFocusAfterClose?(l.returnFocus(n.props.preventScroll),l.teardownScopedFocus()):l.popWithoutFocus()),n.props.onAfterClose&&n.props.onAfterClose(),m.default.deregister(n)},n.open=function(){n.beforeOpen(),n.state.afterOpen&&n.state.beforeClose?(clearTimeout(n.closeTimer),n.setState({beforeClose:!1})):(n.props.shouldFocusAfterRender&&(l.setupScopedFocus(n.node),l.markForFocusLater()),n.setState({isOpen:!0},(function(){n.openAnimationFrame=requestAnimationFrame((function(){n.setState({afterOpen:!0}),n.props.isOpen&&n.props.onAfterOpen&&n.props.onAfterOpen({overlayEl:n.overlay,contentEl:n.content})}))})))},n.close=function(){n.props.closeTimeoutMS>0?n.closeWithTimeout():n.closeWithoutTimeout()},n.focusContent=function(){return n.content&&!n.contentHasFocus()&&n.content.focus({preventScroll:!0})},n.closeWithTimeout=function(){var e=Date.now()+n.props.closeTimeoutMS;n.setState({beforeClose:!0,closesAt:e},(function(){n.closeTimer=setTimeout(n.closeWithoutTimeout,n.state.closesAt-Date.now())}))},n.closeWithoutTimeout=function(){n.setState({beforeClose:!1,isOpen:!1,afterOpen:!1,closesAt:null},n.afterClose)},n.handleKeyDown=function(e){9===e.keyCode&&(0,u.default)(n.content,e),n.props.shouldCloseOnEsc&&27===e.keyCode&&(e.stopPropagation(),n.requestClose(e))},n.handleOverlayOnClick=function(e){null===n.shouldClose&&(n.shouldClose=!0),n.shouldClose&&n.props.shouldCloseOnOverlayClick&&(n.ownerHandlesClose()?n.requestClose(e):n.focusContent()),n.shouldClose=null},n.handleContentOnMouseUp=function(){n.shouldClose=!1},n.handleOverlayOnMouseDown=function(e){n.props.shouldCloseOnOverlayClick||e.target!=n.overlay||e.preventDefault()},n.handleContentOnClick=function(){n.shouldClose=!1},n.handleContentOnMouseDown=function(){n.shouldClose=!1},n.requestClose=function(e){return n.ownerHandlesClose()&&n.props.onRequestClose(e)},n.ownerHandlesClose=function(){return n.props.onRequestClose},n.shouldBeClosed=function(){return!n.state.isOpen&&!n.state.beforeClose},n.contentHasFocus=function(){return document.activeElement===n.content||n.content.contains(document.activeElement)},n.buildClassName=function(e,t){var r="object"===("undefined"===typeof t?"undefined":a(t))?t:{base:b[e],afterOpen:b[e]+"--after-open",beforeClose:b[e]+"--before-close"},o=r.base;return n.state.afterOpen&&(o=o+" "+r.afterOpen),n.state.beforeClose&&(o=o+" "+r.beforeClose),"string"===typeof t&&t?o+" "+t:o},n.attributesFromObject=function(e,t){return Object.keys(t).reduce((function(n,r){return n[e+"-"+r]=t[r],n}),{})},n.state={afterOpen:!1,beforeClose:!1},n.shouldClose=null,n.moveFromContentToOverlay=null,n}return function(e,t){if("function"!==typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,e),o(t,[{key:"componentDidMount",value:function(){this.props.isOpen&&this.open()}},{key:"componentDidUpdate",value:function(e,t){this.props.isOpen&&!e.isOpen?this.open():!this.props.isOpen&&e.isOpen&&this.close(),this.props.shouldFocusAfterRender&&this.state.isOpen&&!t.isOpen&&this.focusContent()}},{key:"componentWillUnmount",value:function(){this.state.isOpen&&this.afterClose(),clearTimeout(this.closeTimer),cancelAnimationFrame(this.openAnimationFrame)}},{key:"beforeOpen",value:function(){var e=this.props,t=e.appElement,n=e.ariaHideApp,r=e.htmlOpenClassName,a=e.bodyOpenClassName;a&&d.add(document.body,a),r&&d.add(document.getElementsByTagName("html")[0],r),n&&(y+=1,c.hide(t)),m.default.register(this)}},{key:"render",value:function(){var e=this.props,t=e.id,n=e.className,a=e.overlayClassName,o=e.defaultStyles,i=e.children,s=n?{}:o.content,l=a?{}:o.overlay;if(this.shouldBeClosed())return null;var u={ref:this.setOverlayRef,className:this.buildClassName("overlay",a),style:r({},l,this.props.style.overlay),onClick:this.handleOverlayOnClick,onMouseDown:this.handleOverlayOnMouseDown},c=r({id:t,ref:this.setContentRef,style:r({},s,this.props.style.content),className:this.buildClassName("content",n),tabIndex:"-1",onKeyDown:this.handleKeyDown,onMouseDown:this.handleContentOnMouseDown,onMouseUp:this.handleContentOnMouseUp,onClick:this.handleContentOnClick,role:this.props.role,"aria-label":this.props.contentLabel},this.attributesFromObject("aria",r({modal:!0},this.props.aria)),this.attributesFromObject("data",this.props.data||{}),{"data-testid":this.props.testId}),d=this.props.contentElement(c,i);return this.props.overlayElement(u,d)}}]),t}(i.Component);v.defaultProps={style:{overlay:{},content:{}},defaultStyles:{}},v.propTypes={isOpen:s.default.bool.isRequired,defaultStyles:s.default.shape({content:s.default.object,overlay:s.default.object}),style:s.default.shape({content:s.default.object,overlay:s.default.object}),className:s.default.oneOfType([s.default.string,s.default.object]),overlayClassName:s.default.oneOfType([s.default.string,s.default.object]),bodyOpenClassName:s.default.string,htmlOpenClassName:s.default.string,ariaHideApp:s.default.bool,appElement:s.default.oneOfType([s.default.instanceOf(f.default),s.default.instanceOf(p.SafeHTMLCollection),s.default.instanceOf(p.SafeNodeList),s.default.arrayOf(s.default.instanceOf(f.default))]),onAfterOpen:s.default.func,onAfterClose:s.default.func,onRequestClose:s.default.func,closeTimeoutMS:s.default.number,shouldFocusAfterRender:s.default.bool,shouldCloseOnOverlayClick:s.default.bool,shouldReturnFocusAfterClose:s.default.bool,preventScroll:s.default.bool,role:s.default.string,contentLabel:s.default.string,aria:s.default.object,data:s.default.object,children:s.default.node,shouldCloseOnEsc:s.default.bool,overlayRef:s.default.func,contentRef:s.default.func,id:s.default.string,overlayElement:s.default.func,contentElement:s.default.func,testId:s.default.string},t.default=v,e.exports=t.default},978:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.resetState=function(){s&&(s.removeAttribute?s.removeAttribute("aria-hidden"):null!=s.length?s.forEach((function(e){return e.removeAttribute("aria-hidden")})):document.querySelectorAll(s).forEach((function(e){return e.removeAttribute("aria-hidden")})));s=null},t.log=function(){return void 0;var e=s||{};console.log("ariaAppHider ----------"),console.log(e.nodeName,e.className,e.id),console.log("end ariaAppHider ----------")},t.assertNodeList=l,t.setElement=function(e){var t=e;if("string"===typeof t&&i.canUseDOM){var n=document.querySelectorAll(t);l(n,t),t=n}return s=t||s},t.validateElement=u,t.hide=function(e){var t=!0,n=!1,r=void 0;try{for(var a,o=u(e)[Symbol.iterator]();!(t=(a=o.next()).done);t=!0){a.value.setAttribute("aria-hidden","true")}}catch(i){n=!0,r=i}finally{try{!t&&o.return&&o.return()}finally{if(n)throw r}}},t.show=function(e){var t=!0,n=!1,r=void 0;try{for(var a,o=u(e)[Symbol.iterator]();!(t=(a=o.next()).done);t=!0){a.value.removeAttribute("aria-hidden")}}catch(i){n=!0,r=i}finally{try{!t&&o.return&&o.return()}finally{if(n)throw r}}},t.documentNotReadyOrSSRTesting=function(){s=null};var r,a=n(1024),o=(r=a)&&r.__esModule?r:{default:r},i=n(592);var s=null;function l(e,t){if(!e||!e.length)throw new Error("react-modal: No elements were found for selector "+t+".")}function u(e){var t=e||s;return t?Array.isArray(t)||t instanceof HTMLCollection||t instanceof NodeList?t:[t]:((0,o.default)(!1,["react-modal: App element is not defined.","Please use `Modal.setAppElement(el)` or set `appElement={el}`.","This is needed so screen readers don't see main content","when modal is opened. It is not recommended, but you can opt-out","by setting `ariaHideApp={false}`."].join(" ")),[])}},3318:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.resetState=function(){for(var e=[i,s],t=0;t0?(document.body.firstChild!==i&&document.body.insertBefore(i,document.body.firstChild),document.body.lastChild!==s&&document.body.appendChild(s)):(i.parentElement&&i.parentElement.removeChild(i),s.parentElement&&s.parentElement.removeChild(s))}))},6373:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.resetState=function(){var e=document.getElementsByTagName("html")[0];for(var t in n)a(e,n[t]);var o=document.body;for(var i in r)a(o,r[i]);n={},r={}},t.log=function(){return void 0;var e=document.getElementsByTagName("html")[0].className,t="Show tracked classes:\n\n";for(var a in t+=" ("+e+"):\n",n)t+=" "+a+" "+n[a]+"\n";for(var o in e=document.body.className,t+="\n\ndoc.body ("+e+"):\n",r)t+=" "+o+" "+r[o]+"\n";t+="\n",console.log(t)};var n={},r={};function a(e,t){e.classList.remove(t)}t.add=function(e,t){return a=e.classList,o="html"==e.nodeName.toLowerCase()?n:r,void t.split(" ").forEach((function(e){!function(e,t){e[t]||(e[t]=0),e[t]+=1}(o,e),a.add(e)}));var a,o},t.remove=function(e,t){return a=e.classList,o="html"==e.nodeName.toLowerCase()?n:r,void t.split(" ").forEach((function(e){!function(e,t){e[t]&&(e[t]-=1)}(o,e),0===o[e]&&a.remove(e)}));var a,o}},6983:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.resetState=function(){i=[]},t.log=function(){return void 0;console.log("focusManager ----------"),i.forEach((function(e){var t=e||{};console.log(t.nodeName,t.className,t.id)})),console.log("end focusManager ----------")},t.handleBlur=u,t.handleFocus=c,t.markForFocusLater=function(){i.push(document.activeElement)},t.returnFocus=function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=null;try{return void(0!==i.length&&(t=i.pop()).focus({preventScroll:e}))}catch(n){console.warn(["You tried to return focus to",t,"but it is not in the DOM anymore"].join(" "))}},t.popWithoutFocus=function(){i.length>0&&i.pop()},t.setupScopedFocus=function(e){s=e,window.addEventListener?(window.addEventListener("blur",u,!1),document.addEventListener("focus",c,!0)):(window.attachEvent("onBlur",u),document.attachEvent("onFocus",c))},t.teardownScopedFocus=function(){s=null,window.addEventListener?(window.removeEventListener("blur",u),document.removeEventListener("focus",c)):(window.detachEvent("onBlur",u),document.detachEvent("onFocus",c))};var r,a=n(1227),o=(r=a)&&r.__esModule?r:{default:r};var i=[],s=null,l=!1;function u(){l=!0}function c(){if(l){if(l=!1,!s)return;setTimeout((function(){s.contains(document.activeElement)||((0,o.default)(s)[0]||s).focus()}),0)}}},3754:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.log=function(){console.log("portalOpenInstances ----------"),console.log(r.openInstances.length),r.openInstances.forEach((function(e){return console.log(e)})),console.log("end portalOpenInstances ----------")},t.resetState=function(){r=new n};var n=function e(){var t=this;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.register=function(e){-1===t.openInstances.indexOf(e)&&(t.openInstances.push(e),t.emit("register"))},this.deregister=function(e){var n=t.openInstances.indexOf(e);-1!==n&&(t.openInstances.splice(n,1),t.emit("deregister"))},this.subscribe=function(e){t.subscribers.push(e)},this.emit=function(e){t.subscribers.forEach((function(n){return n(e,t.openInstances.slice())}))},this.openInstances=[],this.subscribers=[]},r=new n;t.default=r},592:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.canUseDOM=t.SafeNodeList=t.SafeHTMLCollection=void 0;var r,a=n(5538);var o=((r=a)&&r.__esModule?r:{default:r}).default,i=o.canUseDOM?window.HTMLElement:{};t.SafeHTMLCollection=o.canUseDOM?window.HTMLCollection:{},t.SafeNodeList=o.canUseDOM?window.NodeList:{},t.canUseDOM=o.canUseDOM;t.default=i},1009:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t){var n=(0,o.default)(e);if(!n.length)return void t.preventDefault();var r=void 0,a=t.shiftKey,i=n[0],s=n[n.length-1];if(e===document.activeElement){if(!a)return;r=s}s!==document.activeElement||a||(r=i);i===document.activeElement&&a&&(r=s);if(r)return t.preventDefault(),void r.focus();var l=/(\bChrome\b|\bSafari\b)\//.exec(navigator.userAgent);if(null==l||"Chrome"==l[1]||null!=/\biPod\b|\biPad\b/g.exec(navigator.userAgent))return;var u=n.indexOf(document.activeElement);u>-1&&(u+=a?-1:1);if("undefined"===typeof(r=n[u]))return t.preventDefault(),void(r=a?s:i).focus();t.preventDefault(),r.focus()};var r,a=n(1227),o=(r=a)&&r.__esModule?r:{default:r};e.exports=t.default},1227:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){return[].slice.call(e.querySelectorAll("*"),0).filter(o)};var n=/input|select|textarea|button|object/;function r(e){var t=e.offsetWidth<=0&&e.offsetHeight<=0;if(t&&!e.innerHTML)return!0;try{var n=window.getComputedStyle(e);return t?"visible"!==n.getPropertyValue("overflow")||e.scrollWidth<=0&&e.scrollHeight<=0:"none"==n.getPropertyValue("display")}catch(r){return console.warn("Failed to inspect element style"),!1}}function a(e,t){var a=e.nodeName.toLowerCase();return(n.test(a)&&!e.disabled||"a"===a&&e.href||t)&&function(e){for(var t=e;t&&t!==document.body;){if(r(t))return!1;t=t.parentNode}return!0}(e)}function o(e){var t=e.getAttribute("tabindex");null===t&&(t=void 0);var n=isNaN(t);return(n||t>=0)&&a(e,!n)}e.exports=t.default},5196:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r,a=n(6185),o=(r=a)&&r.__esModule?r:{default:r};t.default=o.default,e.exports=t.default},6123:function(e,t){var n;!function(){"use strict";var r={}.hasOwnProperty;function a(){for(var e=[],t=0;t4&&n.slice(0,4)===i&&s.test(t)&&("-"===t.charAt(4)?p=function(e){var t=e.slice(5).replace(l,d);return i+t.charAt(0).toUpperCase()+t.slice(1)}(t):t=function(e){var t=e.slice(4);if(l.test(t))return e;t=t.replace(u,c),"-"!==t.charAt(0)&&(t="-"+t);return i+t}(t),f=a);return new f(p,t)};var s=/^data[-\w.:]+$/i,l=/-[a-z]/g,u=/[A-Z]/g;function c(e){return"-"+e.toLowerCase()}function d(e){return e.charAt(1).toUpperCase()}},3261:function(e,t,n){"use strict";var r=n(7883),a=n(748),o=n(6885),i=n(3009),s=n(8470),l=n(6134);e.exports=r([o,a,i,s,l])},8470:function(e,t,n){"use strict";var r=n(8118),a=n(6512),o=r.booleanish,i=r.number,s=r.spaceSeparated;e.exports=a({transform:function(e,t){return"role"===t?t:"aria-"+t.slice(4).toLowerCase()},properties:{ariaActiveDescendant:null,ariaAtomic:o,ariaAutoComplete:null,ariaBusy:o,ariaChecked:o,ariaColCount:i,ariaColIndex:i,ariaColSpan:i,ariaControls:s,ariaCurrent:null,ariaDescribedBy:s,ariaDetails:null,ariaDisabled:o,ariaDropEffect:s,ariaErrorMessage:null,ariaExpanded:o,ariaFlowTo:s,ariaGrabbed:o,ariaHasPopup:null,ariaHidden:o,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:s,ariaLevel:i,ariaLive:null,ariaModal:o,ariaMultiLine:o,ariaMultiSelectable:o,ariaOrientation:null,ariaOwns:s,ariaPlaceholder:null,ariaPosInSet:i,ariaPressed:o,ariaReadOnly:o,ariaRelevant:null,ariaRequired:o,ariaRoleDescription:s,ariaRowCount:i,ariaRowIndex:i,ariaRowSpan:i,ariaSelected:o,ariaSetSize:i,ariaSort:null,ariaValueMax:i,ariaValueMin:i,ariaValueNow:i,ariaValueText:null,role:null}})},6134:function(e,t,n){"use strict";var r=n(8118),a=n(6512),o=n(7136),i=r.boolean,s=r.overloadedBoolean,l=r.booleanish,u=r.number,c=r.spaceSeparated,d=r.commaSeparated;e.exports=a({space:"html",attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},transform:o,mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:d,acceptCharset:c,accessKey:c,action:null,allow:null,allowFullScreen:i,allowPaymentRequest:i,allowUserMedia:i,alt:null,as:null,async:i,autoCapitalize:null,autoComplete:c,autoFocus:i,autoPlay:i,capture:i,charSet:null,checked:i,cite:null,className:c,cols:u,colSpan:null,content:null,contentEditable:l,controls:i,controlsList:c,coords:u|d,crossOrigin:null,data:null,dateTime:null,decoding:null,default:i,defer:i,dir:null,dirName:null,disabled:i,download:s,draggable:l,encType:null,enterKeyHint:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:i,formTarget:null,headers:c,height:u,hidden:i,high:u,href:null,hrefLang:null,htmlFor:c,httpEquiv:c,id:null,imageSizes:null,imageSrcSet:d,inputMode:null,integrity:null,is:null,isMap:i,itemId:null,itemProp:c,itemRef:c,itemScope:i,itemType:c,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:i,low:u,manifest:null,max:null,maxLength:u,media:null,method:null,min:null,minLength:u,multiple:i,muted:i,name:null,nonce:null,noModule:i,noValidate:i,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforePrint:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextMenu:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:i,optimum:u,pattern:null,ping:c,placeholder:null,playsInline:i,poster:null,preload:null,readOnly:i,referrerPolicy:null,rel:c,required:i,reversed:i,rows:u,rowSpan:u,sandbox:c,scope:null,scoped:i,seamless:i,selected:i,shape:null,size:u,sizes:null,slot:null,span:u,spellCheck:l,src:null,srcDoc:null,srcLang:null,srcSet:d,start:u,step:null,style:null,tabIndex:u,target:null,title:null,translate:null,type:null,typeMustMatch:i,useMap:null,value:l,width:u,wrap:null,align:null,aLink:null,archive:c,axis:null,background:null,bgColor:null,border:u,borderColor:null,bottomMargin:u,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:i,declare:i,event:null,face:null,frame:null,frameBorder:null,hSpace:u,leftMargin:u,link:null,longDesc:null,lowSrc:null,marginHeight:u,marginWidth:u,noResize:i,noHref:i,noShade:i,noWrap:i,object:null,profile:null,prompt:null,rev:null,rightMargin:u,rules:null,scheme:null,scrolling:l,standby:null,summary:null,text:null,topMargin:u,valueType:null,version:null,vAlign:null,vLink:null,vSpace:u,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:i,disableRemotePlayback:i,prefix:null,property:null,results:u,security:null,unselectable:null}})},7136:function(e,t,n){"use strict";var r=n(1989);e.exports=function(e,t){return r(e,t.toLowerCase())}},1989:function(e){"use strict";e.exports=function(e,t){return t in e?e[t]:t}},6512:function(e,t,n){"use strict";var r=n(8134),a=n(8815),o=n(4388);e.exports=function(e){var t,n,i=e.space,s=e.mustUseProperty||[],l=e.attributes||{},u=e.properties,c=e.transform,d={},p={};for(t in u)n=new o(t,c(l,t),u[t],i),-1!==s.indexOf(t)&&(n.mustUseProperty=!0),d[t]=n,p[r(t)]=t,p[r(n.attribute)]=t;return new a(d,p,i)}},4388:function(e,t,n){"use strict";var r=n(6721),a=n(8118);e.exports=s,s.prototype=new r,s.prototype.defined=!0;var o=["boolean","booleanish","overloadedBoolean","number","commaSeparated","spaceSeparated","commaOrSpaceSeparated"],i=o.length;function s(e,t,n,s){var u,c=-1;for(l(this,"space",s),r.call(this,e,t);++c=97&&t<=122||t>=65&&t<=90}},9319:function(e,t,n){"use strict";var r=n(7631),a=n(4597);e.exports=function(e){return r(e)||a(e)}},3110:function(e){e.exports=function(e){return null!=e&&null!=e.constructor&&"function"===typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)}},4597:function(e){"use strict";e.exports=function(e){var t="string"===typeof e?e.charCodeAt(0):e;return t>=48&&t<=57}},6422:function(e){"use strict";e.exports=function(e){var t="string"===typeof e?e.charCodeAt(0):e;return t>=97&&t<=102||t>=65&&t<=70||t>=48&&t<=57}},3108:function(e,t,n){e=n.nmd(e);var r="__lodash_hash_undefined__",a=1,o=2,i=9007199254740991,s="[object Arguments]",l="[object Array]",u="[object AsyncFunction]",c="[object Boolean]",d="[object Date]",p="[object Error]",f="[object Function]",m="[object GeneratorFunction]",g="[object Map]",h="[object Number]",b="[object Null]",y="[object Object]",v="[object Promise]",E="[object Proxy]",S="[object RegExp]",w="[object Set]",k="[object String]",T="[object Symbol]",_="[object Undefined]",x="[object WeakMap]",A="[object ArrayBuffer]",O="[object DataView]",N=/^\[object .+?Constructor\]$/,C=/^(?:0|[1-9]\d*)$/,R={};R["[object Float32Array]"]=R["[object Float64Array]"]=R["[object Int8Array]"]=R["[object Int16Array]"]=R["[object Int32Array]"]=R["[object Uint8Array]"]=R["[object Uint8ClampedArray]"]=R["[object Uint16Array]"]=R["[object Uint32Array]"]=!0,R[s]=R[l]=R[A]=R[c]=R[O]=R[d]=R[p]=R[f]=R[g]=R[h]=R[y]=R[S]=R[w]=R[k]=R[x]=!1;var I="object"==typeof n.g&&n.g&&n.g.Object===Object&&n.g,L="object"==typeof self&&self&&self.Object===Object&&self,D=I||L||Function("return this")(),P=t&&!t.nodeType&&t,M=P&&e&&!e.nodeType&&e,F=M&&M.exports===P,U=F&&I.process,B=function(){try{return U&&U.binding&&U.binding("util")}catch(e){}}(),j=B&&B.isTypedArray;function z(e,t){for(var n=-1,r=null==e?0:e.length;++nu))return!1;var d=s.get(e);if(d&&s.get(t))return d==t;var p=-1,f=!0,m=n&o?new xe:void 0;for(s.set(e,t),s.set(t,e);++p-1},Te.prototype.set=function(e,t){var n=this.__data__,r=Ne(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this},_e.prototype.clear=function(){this.size=0,this.__data__={hash:new ke,map:new(de||Te),string:new ke}},_e.prototype.delete=function(e){var t=Fe(this,e).delete(e);return this.size-=t?1:0,t},_e.prototype.get=function(e){return Fe(this,e).get(e)},_e.prototype.has=function(e){return Fe(this,e).has(e)},_e.prototype.set=function(e,t){var n=Fe(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this},xe.prototype.add=xe.prototype.push=function(e){return this.__data__.set(e,r),this},xe.prototype.has=function(e){return this.__data__.has(e)},Ae.prototype.clear=function(){this.__data__=new Te,this.size=0},Ae.prototype.delete=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n},Ae.prototype.get=function(e){return this.__data__.get(e)},Ae.prototype.has=function(e){return this.__data__.has(e)},Ae.prototype.set=function(e,t){var n=this.__data__;if(n instanceof Te){var r=n.__data__;if(!de||r.length<199)return r.push([e,t]),this.size=++n.size,this;n=this.__data__=new _e(r)}return n.set(e,t),this.size=n.size,this};var Be=se?function(e){return null==e?[]:(e=Object(e),function(e,t){for(var n=-1,r=null==e?0:e.length,a=0,o=[];++n-1&&e%1==0&&e-1&&e%1==0&&e<=i}function Ke(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function Xe(e){return null!=e&&"object"==typeof e}var Ze=j?function(e){return function(t){return e(t)}}(j):function(e){return Xe(e)&&Ye(e.length)&&!!R[Ce(e)]};function Qe(e){return null!=(t=e)&&Ye(t.length)&&!qe(t)?Oe(e):De(e);var t}e.exports=function(e,t){return Ie(e,t)}},6174:function(e,t,n){var r="[object Null]",a="[object Undefined]",o="object"==typeof n.g&&n.g&&n.g.Object===Object&&n.g,i="object"==typeof self&&self&&self.Object===Object&&self,s=o||i||Function("return this")(),l=Object.prototype,u=l.hasOwnProperty,c=l.toString,d=s.Symbol,p=d?d.toStringTag:void 0;function f(e){return null==e?void 0===e?a:r:p&&p in Object(e)?function(e){var t=u.call(e,p),n=e[p];try{e[p]=void 0;var r=!0}catch(o){}var a=c.call(e);r&&(t?e[p]=n:delete e[p]);return a}(e):function(e){return c.call(e)}(e)}e.exports=function(e){if(!function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}(e))return!1;var t=f(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t}},1843:function(e){"use strict";var t=Object.getOwnPropertySymbols,n=Object.prototype.hasOwnProperty,r=Object.prototype.propertyIsEnumerable;e.exports=function(){try{if(!Object.assign)return!1;var e=new String("abc");if(e[5]="de","5"===Object.getOwnPropertyNames(e)[0])return!1;for(var t={},n=0;n<10;n++)t["_"+String.fromCharCode(n)]=n;if("0123456789"!==Object.getOwnPropertyNames(t).map((function(e){return t[e]})).join(""))return!1;var r={};return"abcdefghijklmnopqrst".split("").forEach((function(e){r[e]=e})),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},r)).join("")}catch(a){return!1}}()?Object.assign:function(e,a){for(var o,i,s=function(e){if(null===e||void 0===e)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(e)}(e),l=1;l65535&&(V+=c((z-=65536)>>>10|55296),z=56320|1023&z),z=V+c(z))):K!==_&&G(L,J)),z?(Ee(),Z=ye(),pe=ee-1,me+=ee-Y+1,be.push(z),(Q=ye()).offset++,ae&&ae.call(se,z,{start:Z,end:Q},e.slice(Y-1,ee)),Z=Q):(p=e.slice(Y-1,ee),he+=p,me+=p.length,pe=ee-1)}else 10===j&&(ge++,fe++,me=0),j===j?(he+=c(j),me++):Ee();return be.join("");function ye(){return{line:ge,column:me,offset:pe+(ue.offset||0)}}function ve(e,t){var n=ye();n.column+=t,n.offset+=t,oe.call(le,F[e],n,e)}function Ee(){he&&(be.push(he),re&&re.call(ie,he,{start:Z,end:ye()}),he="")}}(e,i)};var u={}.hasOwnProperty,c=String.fromCharCode,d=Function.prototype,p={warning:null,reference:null,text:null,warningContext:null,referenceContext:null,textContext:null,position:{},additional:null,attribute:!1,nonTerminated:!0},f=9,m=10,g=12,h=32,b=38,y=59,v=60,E=61,S=35,w=88,k=120,T=65533,_="named",x="hexadecimal",A="decimal",O={};O[x]=16,O[A]=10;var N={};N[_]=s,N[A]=o,N[x]=i;var C=1,R=2,I=3,L=4,D=5,P=6,M=7,F={};function U(e){return e>=55296&&e<=57343||e>1114111}function B(e){return e>=1&&e<=8||11===e||e>=13&&e<=31||e>=127&&e<=159||e>=64976&&e<=65007||65535===(65535&e)||65534===(65535&e)}F[C]="Named character references must be terminated by a semicolon",F[R]="Numeric character references must be terminated by a semicolon",F[I]="Named character references cannot be empty",F[L]="Numeric character references cannot be empty",F[D]="Named character references must be known",F[P]="Numeric character references cannot be disallowed",F[M]="Numeric character references cannot be outside the permissible Unicode range"},1729:function(e,t,n){"use strict";var r=n(9165);function a(){}function o(){}o.resetWarningCache=a,e.exports=function(){function e(e,t,n,a,o,i){if(i!==r){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 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:o,resetWarningCache:a};return n.PropTypes=n,n}},5192:function(e,t,n){e.exports=n(1729)()},9165:function(e){"use strict";e.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"},534:function(e,t,n){"use strict";var r=n(7313),a=n(2224);function o(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,n=1;n