brew-js-react 0.5.5 → 0.5.6

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.
@@ -1,3 +1,3 @@
1
- /*! brew-js-react v0.5.5 | (c) misonou | https://misonou.github.io */
2
- !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("zeta-dom"),require("react"),require("react-dom"),require("brew-js"),require("zeta-dom-react"),require("waterpipe"),require("jquery")):"function"==typeof define&&define.amd?define("brew-js-react",["zeta-dom","react","react-dom","brew-js","zeta-dom-react","waterpipe","jquery"],t):"object"==typeof exports?exports["brew-js-react"]=t(require("zeta-dom"),require("react"),require("react-dom"),require("brew-js"),require("zeta-dom-react"),require("waterpipe"),require("jquery")):(e.brew=e.brew||{},e.brew.react=t(e.zeta,e.React,e.ReactDOM,e.brew,e.zeta.react,e.waterpipe,e.jQuery))}(self,((e,t,n,r,i,o,a)=>(()=>{var s={87:e=>{"use strict";e.exports=o},760:e=>{"use strict";e.exports=r},942:e=>{"use strict";e.exports=a},12:e=>{"use strict";e.exports=t},311:e=>{"use strict";e.exports=n},231:t=>{"use strict";t.exports=e},402:e=>{"use strict";e.exports=i},621:(e,t,n)=>{var r,i=n(311);r=i.createRoot?i:{createRoot:(e,t)=>({render(t){i.render(t,e)},unmount(){i.unmountComponentAtNode(e)}}),hydrateRoot:(e,t,n)=>(i.hydrate(t,e),r.createRoot(e,n))},e.exports=r}},u={};function c(e){var t=u[e];if(void 0!==t)return t.exports;var n=u[e]={exports:{}};return s[e](n,n.exports,c),n.exports}c.d=(e,t)=>{for(var n in t)c.o(t,n)&&!c.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},c.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),c.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var l={};return(()=>{"use strict";c.r(l),c.d(l,{AnimateMixin:()=>Vt,AnimateSequenceItemMixin:()=>Rt,AnimateSequenceMixin:()=>Ft,ClassNameMixin:()=>At,ClassNameToggleMixin:()=>kt,Dialog:()=>de,FlyoutMixin:()=>zt,FlyoutToggleMixin:()=>It,FocusStateMixin:()=>_t,LoadingStateMixin:()=>Qt,Mixin:()=>yt,ScrollIntoViewMixin:()=>Jt,ScrollableMixin:()=>$t,StatefulMixin:()=>Pt,UnmanagedClassNameMixin:()=>Kt,ViewStateContainer:()=>lt,createDialog:()=>me,isViewMatched:()=>He,isViewRendered:()=>We,linkTo:()=>Xe,makeTranslation:()=>vt,matchView:()=>Qe,navigateTo:()=>Ye,redirectTo:()=>Ze,registerErrorView:()=>$e,registerView:()=>Ge,renderView:()=>Je,resolvePath:()=>Ke,useAnimateMixin:()=>Zt,useAnimateSequenceMixin:()=>en,useAppReady:()=>at,useAppReadyState:()=>st,useClassNameToggleMixin:()=>tn,useFlyoutMixin:()=>nn,useFocusStateMixin:()=>rn,useLanguage:()=>gt,useLoadingStateMixin:()=>on,useMixin:()=>cn,useMixinRef:()=>ln,useRouteParam:()=>ut,useRouteState:()=>ct,useScrollIntoViewMixin:()=>sn,useScrollableMixin:()=>an,useUnmanagedClassNameMixin:()=>un,useViewContainerState:()=>_e,useViewContext:()=>_e});var e=c(231),t=e.util,n=t.any,r=t.arrRemove,i=t.catchAsync,o=t.combineFn,a=t.createPrivateStore,s=t.define,u=t.defineGetterProperty,f=t.defineHiddenProperty,p=t.defineObservableProperty,m=t.defineOwnProperty,d=t.definePrototype,h=t.delay,g=t.each,v=t.either,w=t.equal,y=t.exclude,b=t.executeOnce,x=t.extend,C=t.fill,S=t.freeze,E=t.grep,P=t.isArray,M=t.isFunction,A=t.isPlainObject,O=t.isThenable,V=t.isUndefinedOrNull,N=t.keys,R=t.kv,T=t.makeArray,j=t.makeAsync,q=t.map,F=t.noop,k=t.pick,L=t.pipe,I=t.randomId,D=t.resolve,U=t.resolveAll,z=t.setImmediate,B=t.setImmediateOnce,_=t.single,H=t.throwNotFunction,W=t.watch,Q=t.watchable,G=c(12),$=c(311),J=c(621),K=e.util,X=K.containsOrEquals,Y=K.getClass,Z=K.removeNode,ee=K.scrollIntoView,te=K.setClass;const ne=e.dom;var re=e.dom,ie=re.lock,oe=re.notifyAsync,ae=re.preventLeave,se=re.subscribeAsync,ue=c(760),ce=ue.closeFlyout,le=ue.isFlyoutOpen,fe=ue.openFlyout,pe=ue.toggleFlyout;function me(e){var t,n=document.createElement("div"),r=J.createRoot(n),i=ce.bind(0,n);return ne.on(n,{flyoutshow:function(){(e.onOpen||F)(n)},flyouthide:function(){t=null,Z(n),(e.onClose||F)(n),e.onRender&&r.unmount()}}),n.setAttribute("loading-class",""),se(n,!0),{root:n,close:i,open:function(){if(t)return t;if(n.className=e.className||"",document.body.appendChild(n),ne.retainFocus(ne.activeElement,n),e.modal&&n.setAttribute("is-modal",""),e.onRender){var o=x({},e,{closeDialog:function(t){var n=j(e.onCommit||L)(t);return oe(ne.activeElement,n),n.then(i)}}),a=(0,G.createElement)(e.onRender,o);e.wrapper&&(a=(0,G.createElement)(e.wrapper,o,a)),r.render(a)}return t=D().then((function(){return fe(n,null,k(e,["focus"]))})),e.preventLeave?ae(n,t):e.preventNavigation&&ie(n,t),t}}}function de(e){var t=(0,G.useState)({})[0],n=(0,G.useState)((function(){return me(t)}))[0];return x(t,e),(0,G.useEffect)((function(){var e=X(ne.root,n.root);v(e,t.isOpen)&&(e?n.close():n.open())}),[t.isOpen]),(0,G.useEffect)((function(){return n.close}),[n]),$.createPortal(e.children,n.root)}var he=c(402),ge=e.EventContainer;var ve=ue.install;const we=ue.defaults;var ye,be=[];ve("react",(function(e){ye=e,o(be)(ye)})),we.react=!0;var xe,Ce,Se=ue.animateIn,Ee=ue.animateOut,Pe=ue.removeQueryAndHash,Me=a(),Ae=ne.root,Oe=new Map,Ve={},Ne=[],Re=new ge,Te=S(x(new ke,{container:Ae})),je=Me(Te),qe=G.createContext(Te),Fe={};function ke(e,t,n){var r=this;m(r,"view",e||null,!0),m(r,"parent",n||null,!0),Me(r,{children:[],setPage:p(r,"page",t||null,!0),setActive:p(r,"active",!!t,!0)}),W(r,"page",(function(e,t){Re.emit("pagechange",r,{previousPage:t})}))}function Le(){G.Component.apply(this,arguments),this.state={}}function Ie(){G.Component.apply(this,arguments)}function De(e,t,r){var i=Oe.get(e);if(!i.maxParams){var o=y(i.matchers,["remainingSegments"]),a=q(ye.routes,(function(e){var t=ye.parseRoute(e),r=t.length&&!n(o,(function(e,n){var r=t.params[n];return(e?!(r>=0):r<t.minLength)||!M(e)&&!t.match(n,e)}));return r?t:null}));if(a[1]&&(a=E(a,(function(e){return!_(e.params,(function(e,t){return Ve[t]&&!o[t]}))}))),a[0]){var s=a.slice(-1)[0];i.maxParams=N(x.apply(0,[{remainingSegments:!0}].concat(a.map((function(e){return e.params}))))),i.minParams=q(s.params,(function(e,t){return i.params[t]||e>=s.minLength?null:t}))}}return k(r||ye.route,t?i.maxParams:i.minParams)}function Ue(e,t){return(Oe.get(t)||{}).matchCount-(Oe.get(e)||{}).matchCount}function ze(e,t){var n=Oe.get(e);return!!n&&!_(n.matchers,(function(e,n){var r=t[n]||"";return M(e)?!e(r):(e||"")!==r}))}function Be(e){var t;return H(e),e.prototype instanceof G.Component&&(e=G.createElement.bind(null,e)),function(n){var r=n.viewProps,o=!t&&e(r);O(o)&&(t=o,o=null,i(t));var a=(0,he.useAsync)((function(){return t.then((function(e){return G.createElement(e.default,r)}))}),!!t)[1];if((!t||!a.loading)&&(n.onComponentLoaded(),a.error))throw a.error;return o||a.value||G.createElement(G.Fragment)}}function _e(){return G.useContext(qe)}function He(e){return ze(e,ye.route)}function We(e){return!!(Oe.get(e)||"").rendered}function Qe(){var e=T(arguments),t=ye.route;return"string"==typeof e[0]&&(t=t.parse(e.shift())),e=e[0]?(P(e[0])?T(e[0]):e).sort(Ue):Ne,n(e,(function(e){return ze(e,t)}))||void 0}function Ge(e,t){var n=Be(e);return t=x({},t),g(t,(function(e,n){Ve[e]=!0,n instanceof RegExp&&(t[e]=n.test.bind(n))})),Oe.set(n,{id:I(),rendered:0,matchCount:N(t).length,matchers:t,params:k(t,(function(e){return V(e)||"string"==typeof e}))}),Ne.push(n),Ne.sort(Ue),n}function $e(e){xe=Be(e)}function Je(){var e=T(arguments),t=M(e[0])?{}:e.shift(),n=e[0];return g(e,(function(e,t){if(!Oe.has(t))throw new Error("Invalid argument to renderView: "+(M(t)?t.name:t))})),e.sort(Ue),G.createElement(Ie,{rootProps:t,views:e,defaultView:n})}function Ke(e,t){var n=Oe.get(e);if(!n)return"/";var r=x(De(e),De(e,!0,t||{}),n.params);return ye.route.getPath(r)}function Xe(e,t){return ye.toHref(Ke(e,t))}function Ye(e,t,n,r){return ye.navigate(Ke(e,t),r,n&&S(x({},n)))}function Ze(e,t,n){return Ye(e,t,n,!0)}Ce=function(){ye.on("beforepageload",(function(e){je.setPage(ye.page),je.setActive(!0),Fe=e,e.waitFor(new Promise((function(e){!function t(n){if(!n[0])return e();U(q(n,(function(e){return new Promise((function(t){e.onRender=t,e.forceUpdate()}))}))).then((function(){t(q(n,(function(e){return e.children})))}))}(je.children)})))}))},be.push(H(Ce)),d(ke,{getChildren:function(){return q(Me(this).children,(function(e){return e.currentState}))},on:function(e,t){return Re.add(this,e,t)}}),Le.contextType=qe,d(Le,G.Component,{componentDidCatch:function(e){var t=this;xe&&!t.state.error?t.setState({error:e}):z((function(){ne.emit("error",t.context.container,{error:e},!0)}))},render:function(){var e=this,t={view:e.context.view,error:e.state.error,reset:e.reset.bind(e)},n=e.props.onComponentLoaded;return t.error?G.createElement(xe,{onComponentLoaded:n,viewProps:t}):G.createElement(t.view,{onComponentLoaded:n,viewProps:e.props.viewProps})},reset:function(){this.setState({error:null})}}),Ie.contextType=qe,d(Ie,G.Component,{setActive:F,componentDidMount:function(){var e=this,t=Me(e.context).children,n=W(ye.route,(function(){e.setActive(e.getViewComponent()===e.currentViewComponent)}));e.componentWillUnmount=function(){e.setActive(!1),r(t,e),n(),z((function(){e.unmountView&&!e.currentState.active&&e.unmountView()}))},t.push(e),e.setActive(!0)},render:function(){var e=this;return e.context.active&&e.updateView(),(e.onRender||F)(),G.createElement(G.Fragment,null,e.prevView,e.currentView)},updateView:function(){var e=this,t=e.getViewComponent(),n=t!==e.currentViewComponent;if(t&&(n||!(e.children||"")[0])){var r=Ke(t,De(t,!0));if(r!==Pe(ye.path))return void ye.navigate(r,!0)}if(t&&n){(e.unmountView||F)(!0);var i,o=new ke(t,ye.page,e.context),a=new Promise((function(e){i=e})),s=i,u=b((function(t){o.container=t,a.then((function(){e.currentState===o&&(s=function(){e.prevView=e.currentView,ye.emit("pageleave",t,{pathname:o.page.path},!0),Ee(t,"show").then((function(){e.prevView=void 0,e.forceUpdate()}))},Se(t,"show","[brew-view]",!0),ye.emit("pageenter",t,{pathname:o.page.path},!0))})),oe(t,a)})),c=S({navigationType:Fe.navigationType,viewContext:o,viewData:Fe.data||{}}),l=G.createElement(qe.Provider,{key:Oe.get(t).id,value:o},G.createElement(lt,null,G.createElement("div",x({},e.props.rootProps,{ref:u,"brew-view":""}),G.createElement(Le,{onComponentLoaded:i,viewProps:c}))));x(e,Me(o),{currentState:o,currentView:l,currentViewComponent:t,unmountView:b((function(){e.setActive(!1),Oe.get(t).rendered--,s()}))}),Oe.get(t).rendered++,(Fe.waitFor||F)(a)}(e.setPage||F)(ye.page)},getViewComponent:function(){var e=this.props;return n(e.views,He)||e.defaultView}});var et=new ge;function tt(){return ye.historyStorage.current}function nt(e,t){this.key=e,this.store=tt(),this.dispose=t}function rt(e,t,n,r){return e.get(t)!==n&&(r&&e.has(t)&&(ye.snapshot(),e=tt()),e.set(t,n)),e}function it(e,t,n){var r=e.get();(t!==e.key||n!==e.store&&n.has(t))&&(r=n.get(t),et.emit("popstate",e,{newValue:r})),e.key=t,e.store=n,n.set(t,r)}function ot(e,t){var n=_e();return(0,G.useEffect)((function(){return ye.on("beforepageload popstate",(function(){n.active&&e(tt())}))}),t),n}function at(){return st().ready}function st(){var e=(0,he.useObservableProperty)(ye,"readyState");return{ready:"ready"===e,error:"error"===e}}function ut(e,t){var n=_e(),r=n.page.params,i=r[e]||"",o=(0,G.useRef)(i),a=(0,he.useUpdateTrigger)();return(0,G.useEffect)((function(){var t=function(){(n.page.params[e]||"")!==o.current&&a()};return t(),n.on("pagechange",t)}),[e]),o.current=i,t&&n.active&&(!i||"remainingSegments"===e&&"/"===i)&&ye.navigate(ye.route.getPath(x({},r,R(e,t))),!0),i}function ct(e,t,n){var r=tt(),i=(0,G.useState)(r&&r.has(e)?r.get(e):t),o=ot((function(t){i[1]((function(n){return t.has(e)?t.get(e):(t.set(e,n),n)}))}),[e]);return r?o.active&&rt(r,e,i[0],n):ye.beforeInit(h(1)),i}function lt(e){var t=(0,G.useState)({})[0],n=ot((function(e){g(t,(function(t,n){it(n,n.key,e)}))}),[]),r=(0,G.useState)((function(){return{getState:function(e,r){var i=t[e];return i&&n.active&&it(i,r,tt()),i||(t[e]=new nt(r,(function(){delete t[e]})))}}}))[0];return(0,G.createElement)(he.ViewStateProvider,{value:r},e.children)}d(nt,{get:function(){return this.store.get(this.key)},set:function(e,t){this.store=rt(this.store,this.key,e,t)},onPopState:function(e){return H(e),et.add(this,"popstate",(function(t){e.call(this,t.newValue)}))}});var ft=c(87),pt=Object.create(null),mt="function"==typeof Symbol&&Symbol.toPrimitive;function dt(e){this.toString=e}function ht(e){return x((function(t,n,r){var i=e(t,n,r,!0);return void 0!==i?i:t}),{html:function(t,n,r){return{__html:e(t,n,r)}},lazy:function(t,n,r){return new dt(e.bind(0,t,n,r,!0))}})}function gt(){return(0,he.useObservableProperty)(ye,"language")}function vt(e,t){var n=new RegExp("^("+Object.keys(e[t]).join("|")+")\\."),r={};function i(n,r,o,a,s){var u=((e[s]||pt)[n]||pt)[r];return"string"==typeof u?!u||a&&void 0===o?u:ft(u,o,{noEncode:a}):s!==t?i(n,r,o,a,t):void 0}function o(e,t,r,o){var a=n.test(e)?RegExp.$1:"";return i(a,a?e.slice(RegExp.lastMatch.length):e,t,o,r||ye.language)}function a(){var e=String(this),t=T(arguments),n=e+" "+t.join(" ");return r[n]||(r[n]=t[0]?ht((function(n,r,o,a){return o=o||e||ye.language,_(t,(function(e){return i(e,n,r,a,o)}))})):ht((function(t,n,r,i){return o(t,n,r||e,i)})))}return{translate:ht(o),getTranslation:a.bind(""),useTranslation:function(){var e=gt();return{language:e,t:a.apply(e,arguments)}},keys:function(n){return N(e[t][n]||pt)}}}function wt(e,t){yt.call(this),this.attributes=A(e)||R(e,t||"")}function yt(){}mt&&(dt.prototype[mt]=function(){return this.toString()}),d(wt,yt,{getCustomAttributes:function(){return x({},this.attributes)}}),d(yt,{reset:function(){return this},next:function(){},getRef:function(){return F},getClassNames:function(){return[]},getCustomAttributes:function(){return{}},dispose:function(){}}),Q(yt.prototype),s(yt,{get scrollableTarget(){return new wt("scrollable-target")},get tabRoot(){return new wt("tab-root")},use:function(){var e=T(arguments),t=e[0],n={},r=e.filter((function(e){return e instanceof yt})),i=r.map((function(e){return e.getRef()}));return!t||t instanceof yt?t||e.shift():("function"!=typeof t?i.push((function(e){t.current=e})):i.push(t),e.shift()),g(r,(function(e,t){x(n,t.getCustomAttributes())})),x(n,{ref:o(i),className:he.classNames.apply(null,e)}),g(r,(function(e,t){t.next()})),n}});var bt=e.dom,xt=bt.watchElements,Ct=bt.watchOwnAttributes,St=a();function Et(e){this.mixin=e}function Pt(){yt.call(this),St(this,{elements:new Set,states:new WeakMap,flush:W(this,!1),dispose:[]})}function Mt(e,t,n,r){var i=n.classNames,o=x({},i);g(i,(function(e){i[e]=t.classList.contains(e)})),r&&!w(n.prev||o,i)&&(n.prev=o,e.onClassNameUpdated(t,o,x({},i)))}function At(e){Pt.call(this),this.classNames=e||[]}d(Et,{getMixin:function(){return this.mixin}}),d(Pt,yt,{get ref(){var e=St(this);return e.ref||(e.ref=new Et(this))},get state(){return St(this).pending},reset:function(){return St(this).pending={},this},next:function(){return St(this).pending={},this},getRef:function(){var e,t=this,n=St(t),r=n.pending;return function(i){if(i)(e=n.states.get(i)||x(t.initState(),r)).element!==i?(e.element=i,t.initElement(i,e),n.states.set(i,e)):N(r)[0]&&t.mergeState(i,e,r),t.onLayoutEffect(i,e),n.elements.add(i);else if(e){var o=e.element;t.onBeforeUpdate(o,e),n.elements.delete(o)}}},elements:function(){return q(St(this).elements,L)},onDispose:function(e){St(this).dispose.push(e)},initState:function(){return{element:null}},initElement:function(e,t){},mergeState:function(e,t,n){x(t,n)},onLayoutEffect:function(e,t){},onBeforeUpdate:function(e,t){},clone:function(){return this},dispose:function(){var e=St(this);o(e.dispose.splice(0))(),e.flush(),e.states={},e.pending={}}}),d(At,Pt,{initState:function(){return{element:null,classNames:C(this.classNames,!1)}},initElement:function(e,t){var n=this;Mt(n,e,t),Ct(e,"class",(function(){Mt(n,e,t,!0)}))},onLayoutEffect:function(e,t){te(e,t.classNames)},onBeforeUpdate:function(e,t){Mt(this,e,t)},onClassNameUpdated:function(e,t,n){}});var Ot=At.prototype;function Vt(){At.call(this,["tweening-in","tweening-out"])}d(Vt,At,{next:function(){var e=this;return e.effects=void 0,e.trigger=void 0,Ot.next.call(e)},with:function(e){var t=this;return t.effects=e.effects,t.trigger=e.trigger,t},withEffects:function(){return this.effects=T(arguments),this},getCustomAttributes:function(){var e=this;return x(Ot.getCustomAttributes.call(e),{"animate-in":(e.effects||[]).join(" "),"animate-on":e.trigger||"show"})}});var Nt=At.prototype;function Rt(e){At.call(this,["tweening-in","tweening-out"]),this.className=e}d(Rt,At,{getCustomAttributes:function(){return x(Nt.getCustomAttributes.call(this),{"is-animate-sequence":""})},getClassNames:function(){return[this.className].concat(Nt.getClassNames.call(this))}});var Tt=c(942),jt=Vt.prototype,qt=0;function Ft(){var e=this;Vt.call(e),e.className="brew-anim-"+ ++qt,e.item=new Rt(e.className)}function kt(){Pt.call(this)}d(Ft,Vt,{withOptions:function(e){return this.selector=e,this},getCustomAttributes:function(){var e=this;return x(jt.getCustomAttributes.call(e),{"animate-in":null,"animate-sequence-type":(e.effects||[]).join(" "),"animate-sequence":e.selector||"."+e.className})},initElement:function(e,t){var n=this;jt.initElement.call(n,e,t),n.selector&&n.onDispose(xt(e,n.selector,(function(e){Tt(e).attr("is-animate-sequence","")})))}}),d(kt,Pt,{withOptions:function(e){this.classes=x({},e)},getClassNames:function(){return this.classes},set:function(e,t){t=A(e)||R(e,t),g(this.elements(),(function(e,n){te(n,t)})),x(this.classes,t)}});var Lt=At.prototype;function It(e){At.call(this,["target-opened"]),this.flyoutMixin=e}d(It,At,{open:function(e,t){return this.flyoutMixin.open(e,t)},close:function(e){return this.flyoutMixin.close(e)},initElement:function(e,t){var n=this;Lt.initElement.call(n,e,t),n.onDispose(ne.on(e,"click",(function(){pe(n.flyoutMixin.elements()[0],e,n.flyoutMixin.getOptions())})))}});var Dt=At.prototype,Ut=new WeakMap;function zt(){var e=this;At.call(e,["open","closing","visible","tweening-in","tweening-out"]),e.modal=!1,e.tabThrough=!1,e.isFlyoutOpened=!1,e.animating=!1,e.visible=!1,e.initialFocus=void 0,e.toggle=new It(e),e.onDispose((function(){e.isFlyoutOpened=!1,e.visible=!1,e.toggle.dispose()}))}d(zt,At,{getOptions:function(){var e=this,t=k(e,["closeOnBlur"]);return void 0!==e.initialFocus&&(t.focus=e.initialFocus),t},next:function(){return this.effects=void 0,Dt.next.call(this)},withEffects:function(){return this.effects=T(arguments),this},getCustomAttributes:function(){var e=this;return x(Dt.getCustomAttributes.call(e),{"is-flyout":"","swipe-dismiss":e.swipeToDismiss},e.modal&&{"is-modal":""},e.tabThrough&&{"tab-through":""},e.effects&&{"animate-on":"open","animate-in":e.effects.join(" "),"animate-out":""})},open:function(e,t){var n=this.elements()[0];return le(n)||Ut.set(n,e),fe(n,t,this.getOptions())},close:function(e){return ce(this.elements()[0],e)},onOpen:function(e){var t=this.elements()[0];return this.onToggleState((function(n){if(n)return e(Ut.get(t))}))},onToggleState:function(e){return this.watch("isFlyoutOpened",e)},onVisibilityChanged:function(e){return this.watch("visible",e)},initElement:function(e,t){var n=this;Dt.initElement.call(n,e,t),n.onDispose(ye.on(e,{animationstart:function(){n.animating=!0},animationcomplete:function(){n.animating=!1}},!0))},onClassNameUpdated:function(e,t,n){var r=le(e);r||Ut.delete(e),this.visible=n.open,this.isFlyoutOpened=r}});var Bt=Pt.prototype;function _t(){Pt.call(this)}d(_t,Pt,{for:function(e){return this.state.ref=e,this},initElement:function(e,t){Bt.initElement.call(this,e,t);var n=function(n,r){var i=t.ref,o=i&&("string"==typeof i?e.querySelector(i):i.current);o&&!ne.focused(o)&&n(r||o)};this.onDispose(ne.on(e,{focusin:function(r){t.focused=r.source,te(e,"focused",r.source),n(ne.focus)},focusout:function(){t.focused=!1,te(e,"focused",!1)},focuschange:function(){n(ne.blur,e)}}))},onLayoutEffect:function(e,t){te(e,"focused",t.focused)}});var Ht=ue.getDirectiveComponent,Wt=At.prototype;function Qt(){At.call(this,["loading","loading-complete"]),this.loading=!1}d(Qt,At,{initElement:function(e,t){var r=this;Wt.initElement.call(r,e,t),Ht(e).enableLoadingClass=!0,r.onDispose(se(e,(function(t){r.loading=t||!!n(r.elements(),(function(t){return t!==e&&!0===Y(t,"loading")}))})))}});var Gt=At.prototype;function $t(){var e=this;At.call(e,["scrollable-x","scrollable-x-l","scrollable-x-r","scrollable-y","scrollable-y-d","scrollable-y-u"]),e.target=yt.scrollableTarget,e.pageIndex=0,e.scrolling=!1}function Jt(){Pt.call(this)}function Kt(){At.call(this)}function Xt(e){x(this,e)}function Yt(e){return function(){var t=cn(e);return(t.withOptions||Xt).apply(t,arguments),t}}d($t,At,{withOptions:function(e){return this.options=e,this},getCustomAttributes:function(){var e=this.options||{};return x(Gt.getCustomAttributes.call(this),{scrollable:[e.direction||"both",e.handle||"auto"].join(" ")},e.pagedItemSelector&&{"scroller-snap-page":e.paged,"scroller-page":e.pagedItemSelector},e.persistScroll&&{"persist-scroll":""})},onPageIndexChanged:function(e){return this.watch("pageIndex",e)},initElement:function(e,t){var n=this;Gt.initElement.call(n,e,t),n.onDispose(ye.on(e,{scrollIndexChange:function(e){n.pageIndex=e.newIndex},scrollStart:function(){n.scrolling=!0},scrollStop:function(){n.scrolling=!1}},!0))}}),g("destroy enable disable setOptions setStickyPosition refresh scrollPadding stop scrollLeft scrollTop scrollBy scrollTo scrollByPage scrollToPage scrollToElement",(function(e,t){f($t.prototype,t,(function(){return Ht(this.elements()[0]).scrollable[t].apply(null,arguments)}))})),d(Jt,Pt,{when:function(e){return this.state.deps=e,this},initElement:function(e,t){t.callback=function(){ee(e)}},mergeState:function(e,t,n){n.deps&&!w(n.deps,t.deps)&&B(t.callback),x(t,n)}}),d(Kt,At,{memorize:function(){return this.classNames=T(arguments),this}});var Zt=Yt(Vt),en=Yt(Ft),tn=Yt(kt),nn=Yt(zt),rn=Yt(_t),on=Yt(Qt),an=Yt($t),sn=Yt(Jt),un=Yt(Kt);function cn(e){return(0,he.useSingleton)((function(){return new e})).reset()}function ln(e){return e&&e.getMixin().reset()}u(window,"brew-js-react",(function(){return console.warn('window["brew-js-react"] is deprecated, access brew.react instead.'),brew.react}))})(),l})()));
1
+ /*! brew-js-react v0.5.6 | (c) misonou | https://misonou.github.io */
2
+ !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("zeta-dom"),require("react"),require("react-dom"),require("brew-js"),require("zeta-dom-react"),require("waterpipe"),require("jquery")):"function"==typeof define&&define.amd?define("brew-js-react",["zeta-dom","react","react-dom","brew-js","zeta-dom-react","waterpipe","jquery"],t):"object"==typeof exports?exports["brew-js-react"]=t(require("zeta-dom"),require("react"),require("react-dom"),require("brew-js"),require("zeta-dom-react"),require("waterpipe"),require("jquery")):(e.brew=e.brew||{},e.brew.react=t(e.zeta,e.React,e.ReactDOM,e.brew,e.zeta.react,e.waterpipe,e.jQuery))}(self,((e,t,n,i,r,o,a)=>(()=>{var s={87:e=>{"use strict";e.exports=o},760:e=>{"use strict";e.exports=i},942:e=>{"use strict";e.exports=a},12:e=>{"use strict";e.exports=t},311:e=>{"use strict";e.exports=n},231:t=>{"use strict";t.exports=e},402:e=>{"use strict";e.exports=r},621:(e,t,n)=>{var i,r=n(311);i=r.createRoot?r:{createRoot:(e,t)=>({render(t){r.render(t,e)},unmount(){r.unmountComponentAtNode(e)}}),hydrateRoot:(e,t,n)=>(r.hydrate(t,e),i.createRoot(e,n))},e.exports=i}},u={};function c(e){var t=u[e];if(void 0!==t)return t.exports;var n=u[e]={exports:{}};return s[e](n,n.exports,c),n.exports}c.d=(e,t)=>{for(var n in t)c.o(t,n)&&!c.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},c.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),c.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var l={};return(()=>{"use strict";c.r(l),c.d(l,{AnimateMixin:()=>jt,AnimateSequenceItemMixin:()=>qt,AnimateSequenceMixin:()=>It,ClassNameMixin:()=>Nt,ClassNameToggleMixin:()=>Dt,Dialog:()=>he,FlyoutMixin:()=>_t,FlyoutToggleMixin:()=>Ut,FocusStateMixin:()=>Wt,LoadingStateMixin:()=>Jt,Mixin:()=>Ct,ScrollIntoViewMixin:()=>Yt,ScrollableMixin:()=>Xt,StatefulMixin:()=>Ot,UnmanagedClassNameMixin:()=>Zt,ViewStateContainer:()=>mt,createDialog:()=>me,isViewMatched:()=>We,isViewRendered:()=>Ge,linkTo:()=>Ze,makeTranslation:()=>bt,matchView:()=>$e,navigateTo:()=>et,redirectTo:()=>tt,registerErrorView:()=>Ke,registerView:()=>Je,renderView:()=>Xe,resolvePath:()=>Ye,useAnimateMixin:()=>nn,useAnimateSequenceMixin:()=>rn,useAppReady:()=>ut,useAppReadyState:()=>ct,useClassNameToggleMixin:()=>on,useFlyoutMixin:()=>an,useFocusStateMixin:()=>sn,useLanguage:()=>yt,useLoadingStateMixin:()=>un,useMixin:()=>pn,useMixinRef:()=>mn,useQueryParam:()=>pt,useRouteParam:()=>lt,useRouteState:()=>ft,useScrollIntoViewMixin:()=>ln,useScrollableMixin:()=>cn,useUnmanagedClassNameMixin:()=>fn,useViewContainerState:()=>He,useViewContext:()=>He});var e=c(231),t=e.util,n=t.any,i=t.arrRemove,r=t.catchAsync,o=t.combineFn,a=t.createPrivateStore,s=t.define,u=t.defineGetterProperty,f=t.defineHiddenProperty,p=t.defineObservableProperty,m=t.defineOwnProperty,h=t.definePrototype,d=t.delay,g=t.each,v=t.either,w=t.equal,y=t.exclude,b=t.executeOnce,x=t.extend,C=t.fill,S=t.freeze,E=t.grep,P=t.isArray,M=t.isFunction,A=t.isPlainObject,O=t.isThenable,V=t.isUndefinedOrNull,N=t.keys,R=t.kv,j=t.makeArray,T=t.makeAsync,q=t.map,F=t.mapObject,k=t.noop,L=t.pick,I=t.pipe,D=t.randomId,z=t.resolve,U=t.resolveAll,B=t.setImmediate,Q=t.setImmediateOnce,_=t.single,H=t.throwNotFunction,W=t.watch,G=t.watchable,$=c(12),J=c(311),K=c(621),X=e.util,Y=X.containsOrEquals,Z=X.getClass,ee=X.removeNode,te=X.scrollIntoView,ne=X.setClass;const ie=e.dom;var re=e.dom,oe=re.lock,ae=re.notifyAsync,se=re.preventLeave,ue=re.subscribeAsync,ce=c(760),le=ce.closeFlyout,fe=ce.openFlyout,pe=ce.toggleFlyout;function me(e){var t,n=document.createElement("div"),i=K.createRoot(n),r=le.bind(0,n);return ie.on(n,{flyoutshow:function(){(e.onOpen||k)(n)},flyouthide:function(){t=null,ee(n),(e.onClose||k)(n),e.onRender&&i.unmount()}}),n.setAttribute("loading-class",""),ue(n,!0),{root:n,close:r,open:function(){if(t)return t;if(n.className=e.className||"",document.body.appendChild(n),ie.retainFocus(ie.activeElement,n),e.modal&&n.setAttribute("is-modal",""),e.onRender){var o=x({},e,{closeDialog:function(t){var n=T(e.onCommit||I)(t);return ae(ie.activeElement,n),n.then(r)}}),a=(0,$.createElement)(e.onRender,o);e.wrapper&&(a=(0,$.createElement)(e.wrapper,o,a)),i.render(a)}return t=z().then((function(){return fe(n,null,L(e,["focus"]))})),e.preventLeave?se(n,t):e.preventNavigation&&oe(n,t),t}}}function he(e){var t=(0,$.useState)({})[0],n=(0,$.useState)((function(){return me(t)}))[0];return x(t,e),(0,$.useEffect)((function(){var e=Y(ie.root,n.root);v(e,t.isOpen)&&(e?n.close():n.open())}),[t.isOpen]),(0,$.useEffect)((function(){return n.close}),[n]),J.createPortal(e.children,n.root)}var de=c(402),ge=e.EventContainer,ve=ce.getQueryParam,we=ce.setQueryParam,ye=ce.parsePath,be=ce.removeQueryAndHash;var xe=ce.install;const Ce=ce.defaults;var Se,Ee=[];xe("react",(function(e){Se=e,o(Ee)(Se)})),Ce.react=!0;var Pe,Me,Ae=ce.animateIn,Oe=ce.animateOut,Ve=a(),Ne=ie.root,Re=new Map,je={},Te=[],qe=new ge,Fe=S(x(new De,{container:Ne})),ke=Ve(Fe),Le=$.createContext(Fe),Ie={};function De(e,t,n){var i=this;m(i,"view",e||null,!0),m(i,"parent",n||null,!0),Ve(i,{children:[],setPage:p(i,"page",t||null,!0),setActive:p(i,"active",!!t,!0)}),W(i,"page",(function(e,t){qe.emit("pagechange",i,{previousPage:t})}))}function ze(){$.Component.apply(this,arguments),this.state={}}function Ue(){$.Component.apply(this,arguments)}function Be(e,t){return(Re.get(t)||{}).matchCount-(Re.get(e)||{}).matchCount}function Qe(e,t){var n=Re.get(e);return!!n&&!_(n.matchers,(function(e,n){var i=t[n]||"";return M(e)?!e(i):(e||"")!==i}))}function _e(e){var t;return H(e),e.prototype instanceof $.Component&&(e=$.createElement.bind(null,e)),function(n){var i=n.viewProps,o=!t&&e(i);O(o)&&(t=o,o=null,r(t));var a=(0,de.useAsync)((function(){return t.then((function(e){return $.createElement(e.default,i)}))}),!!t)[1],s=!t||!a.loading;if($.useEffect((function(){s&&B(n.onComponentLoaded)}),[s]),a.error)throw a.error;return o||a.value||$.createElement($.Fragment)}}function He(){return $.useContext(Le)}function We(e){return Qe(e,Se.route)}function Ge(e){return!!(Re.get(e)||"").rendered}function $e(){var e=j(arguments),t=Se.route;return"string"==typeof e[0]&&(t=t.parse(e.shift())),e=e[0]?(P(e[0])?j(e[0]):e).sort(Be):Te,n(e,(function(e){return Qe(e,t)}))||void 0}function Je(e,t){var n=_e(e);return t=x({},t),g(t,(function(e,n){je[e]=!0,n instanceof RegExp&&(t[e]=n.test.bind(n))})),Re.set(n,{id:D(),rendered:0,matchCount:N(t).length,matchers:t,params:L(t,(function(e){return V(e)||"string"==typeof e}))}),Te.push(n),Te.sort(Be),n}function Ke(e){Pe=_e(e)}function Xe(){var e=j(arguments),t=M(e[0])?{}:e.shift(),n=e[0];return g(e,(function(e,t){if(!Re.has(t))throw new Error("Invalid argument to renderView: "+(M(t)?t.name:t))})),e.sort(Be),$.createElement(Ue,{rootProps:t,views:e,defaultView:n})}function Ye(e,t){return Re.has(e)?Se.route.getPath(function(e,t){var i=Re.get(e);if(!i.maxParams){var r=y(i.matchers,["remainingSegments"]),o=q(Se.routes,(function(e){var t=Se.parseRoute(e),i=t.length&&!n(r,(function(e,n){var i=t.params[n];return(e?!(i>=0):i<t.minLength)||!M(e)&&!t.match(n,e)}));return i?t:null}));if(o[1]&&(o=E(o,(function(e){return!_(e.params,(function(e,t){return je[t]&&!r[t]}))}))),o[0]){var a=o.slice(-1)[0];i.maxParams=N(x.apply(0,[{remainingSegments:!0}].concat(o.map((function(e){return e.params}))))),i.minParams=q(a.params,(function(e,t){return i.params[t]||e>=a.minLength?null:t}))}}return x(L(Se.route,i.minParams),t&&L(t,i.maxParams),i.params)}(e,t)):"/"}function Ze(e,t){return Se.toHref(Ye(e,t))}function et(e,t,n,i){return Se.navigate(Ye(e,t),i,n&&S(x({},n)))}function tt(e,t,n){return et(e,t,n,!0)}Me=function(){Se.on("beforepageload",(function(e){ke.setPage(Se.page),ke.setActive(!0),Ie=e,e.waitFor(new Promise((function(e){!function t(n){if(!n[0])return e();U(q(n,(function(e){return new Promise((function(t){e.onRender=t,e.forceUpdate()}))}))).then((function(){t(q(n,(function(e){return e.children})))}))}(ke.children)})))}))},Ee.push(H(Me)),h(De,{getChildren:function(){return q(Ve(this).children,(function(e){return e.currentState}))},on:function(e,t){return qe.add(this,e,t)}}),ze.contextType=Le,h(ze,$.Component,{componentDidCatch:function(e){var t=this;Pe&&!t.state.error?t.setState({error:e}):(B((function(){ie.emit("error",t.context.container,{error:e},!0)})),t.props.onComponentLoaded())},render:function(){var e=this,t={view:e.context.view,error:e.state.error,reset:e.reset.bind(e)},n=e.props.onComponentLoaded;return t.error?$.createElement(Pe,{onComponentLoaded:n,viewProps:t}):$.createElement(t.view,{onComponentLoaded:n,viewProps:e.props.viewProps})},reset:function(){this.setState({error:null})}}),Ue.contextType=Le,h(Ue,$.Component,{setActive:k,componentDidMount:function(){var e=this,t=Ve(e.context).children,n=W(Se.route,(function(){e.setActive(e.getViewComponent()===e.currentViewComponent)}));e.componentWillUnmount=function(){e.setActive(!1),i(t,e),n(),B((function(){e.unmountView&&!e.currentState.active&&e.unmountView()}))},t.push(e),e.setActive(!0)},render:function(){var e=this;return e.context.active&&e.updateView(),(e.onRender||k)(),$.createElement($.Fragment,null,e.prevView,e.currentView)},updateView:function(){var e=this,t=e.getViewComponent(),n=t!==e.currentViewComponent;if(t&&(n||!(e.children||"")[0])){var i=Ye(t,Se.route);if(i!==be(Se.path))return void Se.navigate(i,!0)}if(t&&n){(e.unmountView||k)(!0);var r,o=new De(t,Se.page,e.context),a=new Promise((function(e){r=e})),s=r,u=b((function(n){o.container=n,a.then((function(){e.currentState===o&&(s=function(){e.prevView=e.currentView,Se.emit("pageleave",n,{pathname:o.page.path,view:t},!0),Oe(n,"show").then((function(){e.prevView=void 0,e.forceUpdate()}))},Ae(n,"show","[brew-view]",!0),Se.emit("pageenter",n,{pathname:o.page.path,view:t},!0))})),ae(n,a)})),c=S({navigationType:Ie.navigationType,viewContext:o,viewData:Ie.data||{}}),l=$.createElement(Le.Provider,{key:Re.get(t).id,value:o},$.createElement(mt,null,$.createElement("div",x({},e.props.rootProps,{ref:u,"brew-view":""}),$.createElement(ze,{onComponentLoaded:r,viewProps:c}))));x(e,Ve(o),{currentState:o,currentView:l,currentViewComponent:t,unmountView:b((function(){e.setActive(!1),Re.get(t).rendered--,s()}))}),Re.get(t).rendered++,(Ie.waitFor||k)(a)}(e.setPage||k)(Se.page)},getViewComponent:function(){var e=this.props;return n(e.views,We)||e.defaultView}});var nt=new ge;function it(){return Se.historyStorage.current}function rt(e,t){this.key=e,this.store=it(),this.dispose=t}function ot(e,t,n,i){return e.get(t)!==n&&(i&&e.has(t)&&(Se.snapshot(),e=it()),e.set(t,n)),e}function at(e,t,n){var i=e.get();(t!==e.key||n!==e.store&&n.has(t))&&(i=n.get(t),nt.emit("popstate",e,{newValue:i})),e.key=t,e.store=n,n.set(t,i)}function st(e,t){var n=He();return(0,$.useEffect)((function(){return Se.on("beforepageload popstate",(function(){n.active&&e(it())}))}),t),n}function ut(){return ct().ready}function ct(){var e=(0,de.useObservableProperty)(Se,"readyState");return{ready:"ready"===e,error:"error"===e}}function lt(e,t){var n=He(),i=n.page.params,r=i[e]||"",o=(0,$.useRef)(r),a=(0,de.useUpdateTrigger)();return(0,$.useEffect)((function(){var t=function(){(n.page.params[e]||"")!==o.current&&a()};return t(),n.on("pagechange",t)}),[e]),o.current=r,t&&n.active&&(!r||"remainingSegments"===e&&"/"===r)&&Se.navigate(Se.route.getPath(x({},i,R(e,t))),!0),r}function ft(e,t,n){var i=it(),r=(0,$.useState)(i&&i.has(e)?i.get(e):t),o=st((function(t){r[1]((function(n){return t.has(e)?t.get(e):(t.set(e,n),n)}))}),[e]);return i?o.active&&ot(i,e,r[0],n):Se.beforeInit(d(1)),r}function pt(e,t,n){A(e)&&(n=t,t=e,e=!1);var i=He(),o=function(){return F(!1===e?t:R(e,t),(function(e,t){return ve(t,Se.path)||e||""}))},a=(0,$.useState)([]);(0,$.useMemo)((function(){a[0].splice(0,2,o())}),[e]);var s=a[0][0],u=function(e){w(e,s)||(x(s,e),a[1]([s]))},c=(0,de.useMemoizedFunction)((function(t){if(!1!==e?t=R(e,M(t)?t(s[e]):t):M(t)&&(t=t(x({},s))),i.active){var a=ye(Se.path),c=N(t).reduce((function(e,n){return t[n]!==s[n]?we(n,t[n]||null,e):e}),a.search);c!==a.search&&(n&&Se.snapshot(),r(Se.navigate(c+a.hash,!0)),u(o()))}}));return(0,$.useEffect)((function(){return Se.watch("path",(function(){i.active&&u(o())}))}),[e]),[!1!==e?s[e]:a[0][1]||(a[0][1]=S(x({},s))),c]}function mt(e){var t=(0,$.useState)({})[0],n=st((function(e){g(t,(function(t,n){at(n,n.key,e)}))}),[]),i=(0,$.useState)((function(){return{getState:function(e,i){var r=t[e];return r&&n.active&&at(r,i,it()),r||(t[e]=new rt(i,(function(){delete t[e]})))}}}))[0];return(0,$.createElement)(de.ViewStateProvider,{value:i},e.children)}h(rt,{get:function(){return this.store.get(this.key)},set:function(e,t){this.store=ot(this.store,this.key,e,t)},onPopState:function(e){return H(e),nt.add(this,"popstate",(function(t){e.call(this,t.newValue)}))}});var ht=c(87),dt=Object.create(null),gt="function"==typeof Symbol&&Symbol.toPrimitive;function vt(e){this.toString=e}function wt(e){return x((function(t,n,i){var r=e(t,n,i,!0);return void 0!==r?r:t}),{html:function(t,n,i){return{__html:e(t,n,i)}},lazy:function(t,n,i){return new vt(e.bind(0,t,n,i,!0))}})}function yt(){return(0,de.useObservableProperty)(Se,"language")}function bt(e,t){var n=new RegExp("^("+Object.keys(e[t]).join("|")+")\\."),i={};function r(n,i,o,a,s){var u=((e[s]||dt)[n]||dt)[i];return"string"==typeof u?!u||a&&void 0===o?u:ht(u,o,{noEncode:a}):s!==t?r(n,i,o,a,t):void 0}function o(e,t,i,o){var a=n.test(e)?RegExp.$1:"";return r(a,a?e.slice(RegExp.lastMatch.length):e,t,o,i||Se.language)}function a(){var e=String(this),t=j(arguments),n=e+" "+t.join(" ");return i[n]||(i[n]=t[0]?wt((function(n,i,o,a){return o=o||e||Se.language,_(t,(function(e){return r(e,n,i,a,o)}))})):wt((function(t,n,i,r){return o(t,n,i||e,r)})))}return{translate:wt(o),getTranslation:a.bind(""),useTranslation:function(){var e=yt();return{language:e,t:a.apply(e,arguments)}},keys:function(n){return N(e[t][n]||dt)}}}function xt(e,t){Ct.call(this),this.attributes=A(e)||R(e,t||"")}function Ct(){}gt&&(vt.prototype[gt]=function(){return this.toString()}),h(xt,Ct,{getCustomAttributes:function(){return x({},this.attributes)}}),h(Ct,{reset:function(){return this},next:function(){},getRef:function(){return k},getClassNames:function(){return[]},getCustomAttributes:function(){return{}},dispose:function(){}}),G(Ct.prototype),s(Ct,{get scrollableTarget(){return new xt("scrollable-target")},get tabRoot(){return new xt("tab-root")},use:function(){var e=j(arguments),t=e[0],n={},i=e.filter((function(e){return e instanceof Ct})),r=i.map((function(e){return e.getRef()}));return!t||t instanceof Ct?t||e.shift():("function"!=typeof t?r.push((function(e){t.current=e})):r.push(t),e.shift()),g(i,(function(e,t){x(n,t.getCustomAttributes())})),x(n,{ref:o(r),className:de.classNames.apply(null,e)}),g(i,(function(e,t){t.next()})),n}});var St=e.dom,Et=St.watchElements,Pt=St.watchOwnAttributes,Mt=a();function At(e){this.mixin=e}function Ot(){Ct.call(this),Mt(this,{elements:new Set,states:new WeakMap,flush:W(this,!1),dispose:[]})}function Vt(e,t,n,i){var r=n.classNames,o=x({},r);g(r,(function(e){r[e]=t.classList.contains(e)})),i&&!w(n.prev||o,r)&&(n.prev=o,e.onClassNameUpdated(t,o,x({},r)))}function Nt(e){Ot.call(this),this.classNames=e||[]}h(At,{getMixin:function(){return this.mixin}}),h(Ot,Ct,{get ref(){var e=Mt(this);return e.ref||(e.ref=new At(this))},get state(){return Mt(this).pending},reset:function(){return Mt(this).pending={},this},next:function(){return Mt(this).pending={},this},getRef:function(){var e,t=this,n=Mt(t),i=n.pending;return function(r){if(r)(e=n.states.get(r)||x(t.initState(),i)).element!==r?(e.element=r,t.initElement(r,e),n.states.set(r,e)):N(i)[0]&&t.mergeState(r,e,i),t.onLayoutEffect(r,e),n.elements.add(r);else if(e){var o=e.element;t.onBeforeUpdate(o,e),n.elements.delete(o)}}},elements:function(){return q(Mt(this).elements,I)},onDispose:function(e){Mt(this).dispose.push(e)},initState:function(){return{element:null}},initElement:function(e,t){},mergeState:function(e,t,n){x(t,n)},onLayoutEffect:function(e,t){},onBeforeUpdate:function(e,t){},clone:function(){return this},dispose:function(){var e=Mt(this);o(e.dispose.splice(0))(),e.flush(),e.states={},e.pending={}}}),h(Nt,Ot,{initState:function(){return{element:null,classNames:C(this.classNames,!1)}},initElement:function(e,t){var n=this;Vt(n,e,t),Pt(e,"class",(function(){Vt(n,e,t,!0)}))},onLayoutEffect:function(e,t){ne(e,t.classNames)},onBeforeUpdate:function(e,t){Vt(this,e,t)},onClassNameUpdated:function(e,t,n){}});var Rt=Nt.prototype;function jt(){Nt.call(this,["tweening-in","tweening-out"])}h(jt,Nt,{next:function(){var e=this;return e.effects=void 0,e.trigger=void 0,Rt.next.call(e)},with:function(e){var t=this;return t.effects=e.effects,t.trigger=e.trigger,t},withEffects:function(){return this.effects=j(arguments),this},getCustomAttributes:function(){var e=this;return x(Rt.getCustomAttributes.call(e),{"animate-in":(e.effects||[]).join(" "),"animate-on":e.trigger||"show"})}});var Tt=Nt.prototype;function qt(e){Nt.call(this,["tweening-in","tweening-out"]),this.className=e}h(qt,Nt,{getCustomAttributes:function(){return x(Tt.getCustomAttributes.call(this),{"is-animate-sequence":""})},getClassNames:function(){return[this.className].concat(Tt.getClassNames.call(this))}});var Ft=c(942),kt=jt.prototype,Lt=0;function It(){var e=this;jt.call(e),e.className="brew-anim-"+ ++Lt,e.item=new qt(e.className)}function Dt(){Ot.call(this)}h(It,jt,{withOptions:function(e){return this.selector=e,this},getCustomAttributes:function(){var e=this;return x(kt.getCustomAttributes.call(e),{"animate-in":null,"animate-sequence-type":(e.effects||[]).join(" "),"animate-sequence":e.selector||"."+e.className})},initElement:function(e,t){var n=this;kt.initElement.call(n,e,t),n.selector&&n.onDispose(Et(e,n.selector,(function(e){Ft(e).attr("is-animate-sequence","")})))}}),h(Dt,Ot,{withOptions:function(e){this.classes=x({},e)},getClassNames:function(){return this.classes},set:function(e,t){t=A(e)||R(e,t),g(this.elements(),(function(e,n){ne(n,t)})),x(this.classes,t)}});var zt=Nt.prototype;function Ut(e){Nt.call(this,["target-opened"]),this.flyoutMixin=e}h(Ut,Nt,{open:function(e,t){return this.flyoutMixin.open(e,t)},close:function(e){return this.flyoutMixin.close(e)},initElement:function(e,t){var n=this;zt.initElement.call(n,e,t),n.onDispose(ie.on(e,"click",(function(){pe(n.flyoutMixin.elements()[0],e,n.flyoutMixin.getOptions())})))}});var Bt=Nt.prototype,Qt=new WeakMap;function _t(){var e=this;Nt.call(e,["open","closing","visible","tweening-in","tweening-out"]),e.modal=!1,e.tabThrough=!1,e.isFlyoutOpened=!1,e.animating=!1,e.visible=!1,e.initialFocus=void 0,e.toggle=new Ut(e),e.onDispose((function(){e.isFlyoutOpened=!1,e.visible=!1,e.toggle.dispose()}))}h(_t,Nt,{getOptions:function(){var e=this,t=L(e,["closeOnBlur"]);return void 0!==e.initialFocus&&(t.focus=e.initialFocus),t},next:function(){return this.effects=void 0,Bt.next.call(this)},withEffects:function(){return this.effects=j(arguments),this},getCustomAttributes:function(){var e=this;return x(Bt.getCustomAttributes.call(e),{"is-flyout":"","swipe-dismiss":e.swipeToDismiss},e.modal&&{"is-modal":""},e.tabThrough&&{"tab-through":""},e.effects&&{"animate-on":"open","animate-in":e.effects.join(" "),"animate-out":""})},open:function(e,t){return fe(this.elements()[0],e,t,this.getOptions())},close:function(e){return le(this.elements()[0],e)},onOpen:function(e){var t=this.elements()[0];return this.onToggleState((function(n){if(n)return e(Qt.get(t))}))},onToggleState:function(e){return this.watch("isFlyoutOpened",e)},onVisibilityChanged:function(e){return this.watch("visible",e)},initElement:function(e,t){var n=this;Bt.initElement.call(n,e,t),n.onDispose(Se.on(e,{flyoutshow:function(t){Qt.set(e,t.data),n.isFlyoutOpened=!0,n.visible=!0},flyoutclose:function(){n.isFlyoutOpened=!1},flyouthide:function(){n.visible=!1},animationstart:function(){n.animating=!0},animationcomplete:function(){n.animating=!1}},!0))}});var Ht=Ot.prototype;function Wt(){Ot.call(this)}h(Wt,Ot,{for:function(e){return this.state.ref=e,this},initElement:function(e,t){Ht.initElement.call(this,e,t);var n=function(n,i){var r=t.ref,o=r&&("string"==typeof r?e.querySelector(r):r.current);o&&!ie.focused(o)&&n(i||o)};this.onDispose(ie.on(e,{focusin:function(i){t.focused=i.source,ne(e,"focused",i.source),n(ie.focus)},focusout:function(){t.focused=!1,ne(e,"focused",!1)},focuschange:function(){n(ie.blur,e)}}))},onLayoutEffect:function(e,t){ne(e,"focused",t.focused)}});var Gt=ce.getDirectiveComponent,$t=Nt.prototype;function Jt(){Nt.call(this,["loading","loading-complete"]),this.loading=!1}h(Jt,Nt,{initElement:function(e,t){var i=this;$t.initElement.call(i,e,t),Gt(e).enableLoadingClass=!0,i.onDispose(ue(e,(function(t){i.loading=t||!!n(i.elements(),(function(t){return t!==e&&!0===Z(t,"loading")}))})))}});var Kt=Nt.prototype;function Xt(){var e=this;Nt.call(e,["scrollable-x","scrollable-x-l","scrollable-x-r","scrollable-y","scrollable-y-d","scrollable-y-u"]),e.target=Ct.scrollableTarget,e.pageIndex=0,e.scrolling=!1}function Yt(){Ot.call(this)}function Zt(){Nt.call(this)}function en(e){x(this,e)}function tn(e){return function(){var t=pn(e);return(t.withOptions||en).apply(t,arguments),t}}h(Xt,Nt,{withOptions:function(e){return this.options=e,this},getCustomAttributes:function(){var e=this.options||{};return x(Kt.getCustomAttributes.call(this),{scrollable:[e.direction||"both",e.handle||"auto"].join(" ")},e.pagedItemSelector&&{"scroller-snap-page":e.paged,"scroller-page":e.pagedItemSelector},e.persistScroll&&{"persist-scroll":""})},onPageIndexChanged:function(e){return this.watch("pageIndex",e)},initElement:function(e,t){var n=this;Kt.initElement.call(n,e,t),n.onDispose(Se.on(e,{scrollIndexChange:function(e){n.pageIndex=e.newIndex},scrollStart:function(){n.scrolling=!0},scrollStop:function(){n.scrolling=!1}},!0))}}),g("destroy enable disable setOptions setStickyPosition refresh scrollPadding stop scrollLeft scrollTop scrollBy scrollTo scrollByPage scrollToPage scrollToElement",(function(e,t){f(Xt.prototype,t,(function(){return Gt(this.elements()[0]).scrollable[t].apply(null,arguments)}))})),h(Yt,Ot,{when:function(e){return this.state.deps=e,this},initElement:function(e,t){t.callback=function(){te(e)}},mergeState:function(e,t,n){n.deps&&!w(n.deps,t.deps)&&Q(t.callback),x(t,n)}}),h(Zt,Nt,{memorize:function(){return this.classNames=j(arguments),this}});var nn=tn(jt),rn=tn(It),on=tn(Dt),an=tn(_t),sn=tn(Wt),un=tn(Jt),cn=tn(Xt),ln=tn(Yt),fn=tn(Zt);function pn(e){return(0,de.useSingleton)((function(){return new e})).reset()}function mn(e){return e&&e.getMixin().reset()}u(window,"brew-js-react",(function(){return console.warn('window["brew-js-react"] is deprecated, access brew.react instead.'),brew.react}))})(),l})()));
3
3
  //# sourceMappingURL=brew-js-react.min.js.map