brew-js-react 0.6.6 → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,3 +1,3 @@
1
- /*! brew-js-react v0.6.6 | (c) misonou | https://misonou.github.io */
2
- !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("zeta-dom"),require("brew-js"),require("react"),require("react-dom"),require("zeta-dom-react"),require("waterpipe"),require("jquery")):"function"==typeof define&&define.amd?define("brew-js-react",["zeta-dom","brew-js","react","react-dom","zeta-dom-react","waterpipe","jquery"],t):"object"==typeof exports?exports["brew-js-react"]=t(require("zeta-dom"),require("brew-js"),require("react"),require("react-dom"),require("zeta-dom-react"),require("waterpipe"),require("jquery")):(e.brew=e.brew||{},e.brew.react=t(e.zeta,e.brew,e.React,e.ReactDOM,e.zeta.react,e.waterpipe,e.jQuery))}(self,((e,t,n,r,i,o,s)=>(()=>{var a={87:e=>{"use strict";e.exports=o},760:e=>{"use strict";e.exports=t},914:e=>{"use strict";e.exports=s},12:e=>{"use strict";e.exports=n},33:e=>{"use strict";e.exports=r},231:t=>{"use strict";t.exports=e},402:e=>{"use strict";e.exports=i},621:(e,t,n)=>{var r,i=n(33);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 a[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:()=>sn,AnimateSequenceItemMixin:()=>un,AnimateSequenceMixin:()=>pn,ClassNameMixin:()=>rn,ClassNameToggleMixin:()=>dn,Dialog:()=>ze,FlyoutMixin:()=>bn,FlyoutToggleMixin:()=>mn,FocusStateMixin:()=>Cn,LoadingStateMixin:()=>En,Mixin:()=>Wt,ScrollIntoViewMixin:()=>Vn,ScrollableMixin:()=>An,StatefulMixin:()=>tn,UnmanagedClassNameMixin:()=>On,ViewContext:()=>ut,ViewStateContainer:()=>Dt,createDialog:()=>Ue,isViewMatched:()=>gt,isViewRendered:()=>vt,linkTo:()=>St,makeTranslation:()=>Qt,matchView:()=>wt,navigateTo:()=>Pt,redirectTo:()=>Et,registerErrorView:()=>bt,registerView:()=>yt,renderView:()=>xt,resolvePath:()=>Ct,useAnimateMixin:()=>Tn,useAnimateSequenceMixin:()=>jn,useAppReady:()=>Tt,useAppReadyState:()=>jt,useClassNameToggleMixin:()=>Fn,useFlyoutMixin:()=>qn,useFocusStateMixin:()=>kn,useLanguage:()=>Bt,useLoadingStateMixin:()=>Dn,useMixin:()=>zn,useMixinRef:()=>Hn,useQueryParam:()=>kt,useRouteParam:()=>Ft,useRouteState:()=>qt,useScrollIntoViewMixin:()=>In,useScrollableMixin:()=>Ln,useUnmanagedClassNameMixin:()=>Un,useViewContainerState:()=>mt,useViewContext:()=>mt});var e=c(231),t=e.util,n=t.always,r=t.any,i=t.arrRemove,o=t.catchAsync,s=t.combineFn,a=t.createPrivateStore,u=t.define,f=t.defineGetterProperty,p=t.defineHiddenProperty,d=t.defineObservableProperty,h=t.defineOwnProperty,m=t.definePrototype,g=t.delay,v=t.each,w=t.either,y=t.equal,b=t.exclude,x=t.executeOnce,C=t.extend,S=t.fill,P=t.freeze,E=t.grep,M=t.isArray,A=t.isFunction,V=t.isPlainObject,O=t.isThenable,N=t.isUndefinedOrNull,R=t.keys,T=t.kv,j=t.makeArray,F=t.map,q=t.mapObject,k=t.noop,D=t.pick,L=t.randomId,I=t.resolve,U=t.setImmediate,z=t.setImmediateOnce,H=t.single,B=t.throwNotFunction,Q=t.throws,_=t.watch,W=t.watchable,G=c(760);var $=G.addExtension,J=G.install;const K=G.defaults;var X,Y=[];J("react",$(!0,"react2",["?router","?i18n"],(function(e){X=e,s(Y)(X)}))),K.react=!0;var Z=c(12),ee=Z.Component,te=Z.StrictMode,ne=Z.createContext,re=Z.createElement,ie=Z.useContext,oe=Z.useEffect,se=Z.useLayoutEffect,ae=Z.useMemo,ue=Z.useRef,ce=Z.useState,le=c(33),fe=c(621),pe=c(402),de=pe.ViewStateProvider,he=pe.classNames,me=pe.createAsyncScope,ge=pe.useAsync,ve=pe.useEagerState,we=pe.useMemoizedFunction,ye=pe.useObservableProperty,be=pe.useSingleton,xe=pe.useValueTrigger,Ce=e.util,Se=Ce.containsOrEquals,Pe=Ce.getClass,Ee=Ce.removeNode,Me=Ce.scrollIntoView,Ae=Ce.setClass,Ve=e.dom;const Oe=Ve;var Ne=Ve.reportError,Re=e.dom,Te=Re.lock,je=Re.preventLeave,Fe=Re.runAsync,qe=Re.subscribeAsync,ke=G.closeFlyout,De=G.isFlyoutOpen,Le=G.openFlyout,Ie=G.toggleFlyout;function Ue(e){var t,n=document.createElement("div"),r=fe.createRoot(n),i=me(n),o=ke.bind(0,n);return Oe.on(n,{flyoutshow:function(){(e.onOpen||k)(n)},flyouthide:function(){t=null,Ee(n),(e.onClose||k)(n),e.onRender&&r.unmount()}}),n.setAttribute("loading-class",""),qe(n,!0),{root:n,close:o,open:function(){if(t)return t;if(n.className=e.className||"",document.body.appendChild(n),e.modal&&n.setAttribute("is-modal",""),e.onRender){var s=e.onCommit?function(t){return Fe(Oe.activeElement,e.onCommit.bind(this,t)).then(o)}:o,a=C({},e,{errorHandler:i.errorHandler,closeDialog:s,commitDialog:s,dismissDialog:o}),u=re(e.onRender,a);e.wrapper&&(u=re(e.wrapper,a,u)),r.render(re(te,null,re(i.Provider,null,u)))}return t=I().then((function(){return Oe.retainFocus(Oe.activeElement,n),Le(n,null,D(e,["focus"]))})),e.preventLeave?je(n,t):e.preventNavigation&&Te(n,t),t}}}function ze(e){var t=ce({})[0],n=ce((function(){return Ue(t)}))[0];return C(t,e),oe((function(){var e=Se(Oe.root,n.root);w(e,t.isOpen)&&(e?n.close():n.open())}),[t.isOpen]),oe((function(){return n.close}),[n]),le.createPortal(e.children,n.root)}var He,Be,Qe=e.EventContainer,_e=G.getQueryParam,We=G.setQueryParam,Ge=G.toQueryString,$e=G.parsePath,Je=G.removeQueryAndHash,Ke=G.animateIn,Xe=G.animateOut,Ye=a(),Ze=Oe.root,et=new Map,tt={},nt=[],rt=new Qe,it=P(C(new ut,{container:Ze})),ot=Ye(it),st=ne(it),at={waitFor:k};function ut(e,t,n){var r=this;h(r,"view",e||null,!0),h(r,"parent",n||null,!0),Ye(r,{children:[],setPage:d(r,"page",t||null,!0),setActive:d(r,"active",!!t,!0)}),_(r,"page",(function(e,t){rt.emit("pagechange",r,{page:e,previousPage:t,navigationType:at.navigationType,waitFor:at.waitFor})}))}function ct(e){ee.call(this,e),this.state={},Ye(e.context).wrapper=this}function lt(){ee.apply(this,arguments),this.views=[]}function ft(e,t){return N(e)||""===e||e===t?"":e[0]===t?e:t+e}function pt(e,t){return(et.get(t)||{}).matchCount-(et.get(e)||{}).matchCount}function dt(e,t){var n=et.get(e);return!!n&&!H(n.matchers,(function(e,n){var r=t[n]||"";return A(e)?!e(r):(e||"")!==r}))}function ht(e){var t;return B(e),e.prototype instanceof ee&&(e=re.bind(null,e)),function(n){var r=t||e(n.viewProps);if(!O(r))return se(n.onLoad,[]),r;o(t=r);var i=ge((function(){return t.then(null,(function(e){t=null,n.onError(e)}))}))[0];return i&&n.onLoad(),i?re(i.default,n.viewProps):n.self.currentContext===n.context&&n.loader||null}}function mt(){return ie(st)}function gt(e){var t=X.route;return dt(e,t)&&Ct(e,t)===t.toString()}function vt(e){return!!(et.get(e)||"").rendered}function wt(){var e=j(arguments),t=X.route;return"string"==typeof e[0]&&(t=t.parse(e.shift())),e=e[0]?(M(e[0])?j(e[0]):e).sort(pt):nt,r(e,(function(e){return dt(e,t)}))||void 0}function yt(e,t){var n=ht(e);return t=C({},t),v(t,(function(e,n){tt[e]=!0,n instanceof RegExp&&(t[e]=n.test.bind(n))})),et.set(n,{id:L(),rendered:0,matchCount:R(t).length,matchers:t,params:D(t,(function(e){return N(e)||"string"==typeof e}))}),nt.push(n),nt.sort(pt),n}function bt(e){He=B(e)}function xt(){var e=j(arguments),t=A(e[0])?{}:e.shift(),n=e[0];return v(e,(function(e,t){if(!et.has(t))throw new Error("Invalid argument to renderView: "+(A(t)?t.name:t))})),e.sort(pt),re(lt,{rootProps:t,views:e,defaultView:n})}function Ct(e,t){var n="";return M(t)&&(n=ft(V(t[1])?Ge(t[1]):t[1],"?")+ft(t[2],"#"),t=t[0]),(et.has(e)?X.route.getPath(function(e,t){var n=et.get(e);if(!n.maxParams){var i=b(n.matchers,["remainingSegments"]),o=F(X.routes,(function(e){var t=X.parseRoute(e),n=t.length&&!r(i,(function(e,n){var r=t.params[n];return(e?!(r>=0):r<t.minLength)||!A(e)&&!t.match(n,e)}));return n?t:null}));if(o[1]&&(o=E(o,(function(e){return!H(e.params,(function(e,t){return tt[t]&&!i[t]}))}))),o[0]){var s=o.slice(-1)[0];n.maxParams=R(C.apply(0,[{remainingSegments:!0}].concat(o.map((function(e){return e.params}))))),n.minParams=F(s.params,(function(e,t){return n.params[t]||e>=s.minLength?null:t}))}}return C(D(X.route,n.minParams),t&&D(t,n.maxParams),n.params)}(e,t)):"/")+n}function St(e,t){return X.toHref(Ct(e,t))}function Pt(e,t,n,r){return X.navigate(Ct(e,t),r,n&&P(C({},n)))}function Et(e,t,n){return Pt(e,t,n,!0)}Be=function(){X.on("beforepageload",(function(e){ot.setPage(X.page),ot.setActive(!0),at=e,function t(n){v(n.children,(function(n,r){e.waitFor(new Promise((function(e){r.onRender=e,r.forceUpdate()})).then((function(){t(r)})))}))}(ot)})),ot.setPage(X.page)},X?Be(X):Y.push(B(Be)),h(ut,"root",it,!0),m(ut,{getChildren:function(){return F(Ye(this).children,(function(e){return e.currentContext}))},setErrorView:function(e,t){var n=Ye(this).wrapper;return n&&e&&!n.setState({error:t,errorView:e})},on:function(e,t){return rt.add(this,e,t)}}),m(ct,ee,{componentDidMount:function(){var e=this;e.componentWillUnmount=_(e.props.context,"page",(function(){e.state.errorView=null,e.forceUpdate()}))},componentDidCatch:function(e){var t=this;He&&t.state.errorView!==He?t.setState({error:e,errorView:He}):(t.props.onLoad(),Ne(e,t.props.context.container))},render:function(){var e=this,t=e.props.context;if(!t.container)return U((function(){C(e,me(t.container)),Oe.on(t.container,"error",(function(e){return rt.emit(e,t,{error:e.error},!1)})),e.forceUpdate()})),null;if(e.state.errorView)return e.props.onLoad(),re(e.Provider,null,re(e.state.errorView,{view:t.view,error:e.state.error,reset:e.reset.bind(e)}));var n=e.componentDidCatch.bind(e),r={errorHandler:e.errorHandler,navigationType:at.navigationType,viewContext:t,viewData:t.page.data||{}};return re(e.Provider,null,re(t.view,C({viewProps:r,onError:n},e.props)))},reset:function(){this.setState({errorView:null})}}),lt.contextType=st,m(lt,ee,{componentDidMount:function(){var e=this,t=Ye(e.context).children,n=_(X.route,(function(){e.setActive(e.getViewComponent()===(e.currentContext||"").view)}));e.componentWillUnmount=function(){e.setActive(!1),i(t,e),n(),U((function(){e.currentContext&&!e.currentContext.active&&e.unmountView()}))},t.push(e),e.setActive(!0)},componentDidUpdate:function(e){(e.rootProps.ref||{}).current=null,this.setContext(this.currentContext)},setContext:function(e){this.currentContext=e,(this.props.rootProps.ref||{}).current=e},render:function(){var e=this;return e.context.active&&e.updateView(),e.onRender(),e.views},updateView:function(){var e=this,t=e.getViewComponent(),r=t!==(e.currentContext||"").view;if(t&&(r||!(e.children||"")[0])){var i=Ct(t,X.route);if(i!==Je(X.path))return void X.navigate(i,!0)}var o=et.get(t)||{};if((e.views[2]||"").key!==o.id){if(e.views[2]=null,e.abort(),!t||!r)return e.setActive(!0),void e.setPage(X.page);at.waitFor(new Promise((function(r){var i=new ut(t,X.page,e.context),s=e.props.rootProps,a=x((function(t){h(i,"container",t,!0),Oe.on(t,"error",(function(t){i!==e.currentContext&&t.handled()})),e.setContext(e.currentContext||i)})),u=x((function(){var s=i.container,a=e.unmountView();e.unmountView=x((function(){return o.rendered--,e.setActive(!1),X.emit("pageleave",s,{pathname:i.page.path,view:t},!0),Xe(s,"show").then((function(){e.views[0]=null,e.forceUpdate()}))})),n(a,g).then((function(){X.emit("pageenter",s,{pathname:i.page.path,view:t},!0)})),e.views.shift(),e.setContext(i),C(e,Ye(i)),o.rendered++,Ke(s,"show","[brew-view]",!0),r()}));i.on("error",(function(){return(e.props.rootProps.onError||k).apply(this,arguments)})),e.abort=r,e.views[2]=re(st.Provider,{key:o.id,value:i},re(Dt,null,re("div",C(b(s,["loader","onError"]),{ref:a,"brew-view":""}),re(ct,{onLoad:u,context:i,self:e,loader:s.loader}))))})))}},getViewComponent:function(){var e=this.props;return r(e.views,(function(e){return dt(e,X.route)}))||e.defaultView}}),S(lt.prototype,"abort onRender setActive setPage unmountView",k);var Mt=new Qe;function At(){return X.historyStorage.current}function Vt(e,t){this.key=e,this.store=At(),this.dispose=t}function Ot(e,t,n,r){return e.get(t)!==n&&(r&&e.has(t)&&(X.snapshot(),e=At()),e.set(t,n)),e}function Nt(e,t,n){var r=e.get();(t!==e.key||n!==e.store&&n.has(t))&&(r=n.get(t),Mt.emit("popstate",e,{newValue:r})),e.key=t,e.store=n,n.set(t,r)}function Rt(e,t){var n=mt();return oe((function(){return X.on("beforepageload popstate",(function(){n.active&&e(At())}))}),t),n}function Tt(){return jt().ready}function jt(){var e=ye(X,"readyState");return{ready:"ready"===e,error:"error"===e}}function Ft(e,t){var n=mt(),r=n.page.params,i=r[e]||"",o=xe(i);return oe((function(){var t=function(){o(n.page.params[e]||"")};return t(),n.on("pagechange",t)}),[e]),t&&n.active&&(!i||"remainingSegments"===e&&"/"===i)&&X.navigate(X.route.getPath(C({},r,T(e,t))),!0),i}function qt(e,t,n){var r=At(),i=ve(r&&r.has(e)?r.get(e):t),o=Rt((function(t){i[1]((function(n){return t.has(e)?t.get(e):(t.set(e,n),n)}))}),[e]);return r?o.active&&Ot(r,e,i[0],n):X.beforeInit(g(1)),i}function kt(e,t,n){V(e)&&(n=t,t=e,e=!1);var r=mt(),i=function(){return P(q(!1===e?t:T(e,t),(function(e,t){return _e(t,X.path)||e||""})))},s=ue({});ae((function(){s.current=i()}),[e]);var a=s.current,u=xe(a,(function(e,t){return y(e,t)||!(s.current=t)})),c=we((function(t){var a=s.current;if(!1!==e?t=T(e,A(t)?t(a[e]):t):A(t)&&(t=t(C({},a))),r.active){var c=$e(X.path),l=R(t).reduce((function(e,n){return t[n]!==a[n]?We(n,t[n]||null,e):e}),c.search);l!==c.search&&(n&&X.snapshot(),o(X.navigate((l||"?")+c.hash,!0)),u(i()))}}));return oe((function(){return X.watch("path",(function(){r.active&&u(i())}))}),[e]),[!1!==e?a[e]:a,c]}function Dt(e){var t=ce({})[0],n=Rt((function(e){v(t,(function(t,n){Nt(n,n.key,e)}))}),[]),r=ce((function(){return{getState:function(e,r){var i=t[e];return i&&n.active&&Nt(i,r,At()),i||(t[e]=new Vt(r,(function(){delete t[e]})))}}}))[0];return re(de,{value:r},e.children)}m(Vt,{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 B(e),Mt.add(this,"popstate",(function(t){e.call(this,t.newValue)}))}});var Lt=c(87),It=Object.create(null),Ut="function"==typeof Symbol&&Symbol.toPrimitive;function zt(e){this.toString=e}function Ht(e){return C((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 zt(e.bind(0,t,n,r,!0))}})}function Bt(){return ye(X,"language")}function Qt(e,t){var n=new RegExp("^("+Object.keys(e[t]).join("|")+")\\."),r={};function i(n,r,o,s,a){var u=((e[a]||It)[n]||It)[r];return"string"==typeof u?!u||s&&void 0===o?u:Lt(u,o,{noEncode:s}):a!==t?i(n,r,o,s,t):void 0}function o(e,t,r,o){var s=n.test(e)?RegExp.$1:"";return i(s,s?e.slice(RegExp.lastMatch.length):e,t,o,r||X.language)}function s(){var e=String(this),t=j(arguments),n=e+" "+t.join(" ");return r[n]||(r[n]=t[0]?Ht((function(n,r,o,s){return o=o||e||X.language,H(t,(function(e){return i(e,n,r,s,o)}))})):Ht((function(t,n,r,i){return o(t,n,r||e,i)})))}return{translate:Ht(o),getTranslation:s.bind(""),useTranslation:function(){var e=Bt();return{language:e,t:s.apply(e,arguments)}},keys:function(n){return R(e[t][n]||It)}}}function _t(e,t){Wt.call(this),this.attributes=V(e)||T(e,t||"")}function Wt(){}Ut&&(zt.prototype[Ut]=function(){return this.toString()}),m(_t,Wt,{getCustomAttributes:function(){return C({},this.attributes)}}),m(Wt,{reset:function(){return this},next:function(){},getRef:function(){return k},getClassNames:function(){return[]},getCustomAttributes:function(){return{}},dispose:function(){}}),W(Wt.prototype),u(Wt,{get scrollableTarget(){return new _t("scrollable-target")},get tabRoot(){return new _t("tab-root")},use:function(){var e=j(arguments),t=e[0],n={},r=e.filter((function(e){return e instanceof Wt})),i=r.map((function(e){return e.getRef()}));return!t||t instanceof Wt?t||e.shift():("function"!=typeof t?i.push((function(e){t.current=e})):i.push(t),e.shift()),v(r,(function(e,t){C(n,t.getCustomAttributes())})),C(n,{ref:s(i),className:he.apply(null,e)}),v(r,(function(e,t){t.next()})),n}});var Gt=e.dom,$t=Gt.watchElements,Jt=Gt.watchOwnAttributes,Kt=a(),Xt=new Set;function Yt(){v(Xt,(function(e,t){s(Kt(t).splice(0))()})),Xt.clear()}function Zt(e,t){Kt(this,[e.delete.bind(e,t)]),e.set(t,this)}function en(e){this.mixin=e}function tn(){Wt.call(this),Kt(this,{pending:{},elements:[],states:new Map,flush:_(this,!1),dispose:[]})}function nn(e,t,n,r){var i=n.classNames,o=C({},i);v(i,(function(e){i[e]=t.classList.contains(e)})),r&&!y(n.prev||o,i)&&(n.prev=o,e.onClassNameUpdated(t,o,C({},i)))}function rn(e){tn.call(this),this.classNames=e||[]}m(Zt,{onDispose:function(e){Kt(this).push(B(e))}}),m(en,{getMixin:function(){return this.mixin}}),m(tn,Wt,{get ref(){var e=Kt(this);return e.ref||(e.ref=new en(this))},get state(){return Kt(this).pending},reset:function(){return Kt(this).pending={},this},next:function(){return Kt(this).pending={},this},getRef:function(){var e,t,n=this,r=Kt(n),o=r.pending;return function(s){s?(e=s,t=r.states.get(e)||new Zt(r.states,e),r.elements.push(e),t.element?R(o)[0]&&n.mergeState(e,t,o):n.initElement(e,C(t,n.initState(),o,{element:e})),n.onLayoutEffect(e,t),Xt.delete(t)):t&&(Xt.add(t),n.onBeforeUpdate(e,t),i(r.elements,e)),z(Yt)}},elements:function(){return Kt(this).elements.slice()},onDispose:function(e){Kt(this).dispose.push(e)},initState:function(){return{}},initElement:function(e,t){},mergeState:function(e,t,n){C(t,n)},onLayoutEffect:function(e,t){},onBeforeUpdate:function(e,t){},clone:function(){return this},dispose:function(){var e=Kt(this);v(e.states,(function(e,t){Xt.add(t)})),z(Yt),s(e.dispose.splice(0))(),e.flush(),e.pending={}}}),m(rn,tn,{initElement:function(e,t){var n=this;t.classNames=S(n.classNames,!1),nn(n,e,t),t.onDispose(Jt(e,"class",(function(){nn(n,e,t,!0)})).dispose)},onLayoutEffect:function(e,t){Ae(e,t.classNames)},onBeforeUpdate:function(e,t){nn(this,e,t)},onClassNameUpdated:function(e,t,n){}});var on=rn.prototype;function sn(){rn.call(this,["tweening-in","tweening-out"])}m(sn,rn,{next:function(){var e=this;return e.effects=void 0,e.trigger=void 0,on.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 C(on.getCustomAttributes.call(e),{"animate-in":(e.effects||[]).join(" "),"animate-on":e.trigger||"show"})}});var an=rn.prototype;function un(e){rn.call(this,["tweening-in","tweening-out"]),this.className=e}m(un,rn,{getCustomAttributes:function(){return C(an.getCustomAttributes.call(this),{"is-animate-sequence":""})},getClassNames:function(){return[this.className].concat(an.getClassNames.call(this))}});var cn=c(914),ln=sn.prototype,fn=0;function pn(){var e=this;sn.call(e),e.className="brew-anim-"+ ++fn,e.item=new un(e.className)}function dn(){tn.call(this)}m(pn,sn,{withOptions:function(e){return this.selector=e,this},getCustomAttributes:function(){var e=this;return C(ln.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;ln.initElement.call(n,e,t),n.selector&&t.onDispose($t(e,n.selector,(function(e){cn(e).attr("is-animate-sequence","")})).dispose)}}),m(dn,tn,{withOptions:function(e){this.classes=C({},e)},getClassNames:function(){return this.classes},set:function(e,t){t=V(e)||T(e,t),v(this.elements(),(function(e,n){Ae(n,t)})),C(this.classes,t)}});var hn=rn.prototype;function mn(e){rn.call(this,["target-opened"]),this.flyoutMixin=e}function gn(e,t,n,r,i){(t.trigger||"click")===n&&r.apply(e,i)}m(mn,rn,{on:function(e){return this.state.trigger=e,this},open:function(e,t){return this.flyoutMixin.open(e,t)},close:function(e){return this.flyoutMixin.close(e)},toggle:function(e,t){return this.flyoutMixin.toggleSelf(e,t)},initElement:function(e,t){var n=this;hn.initElement.call(n,e,t),t.onDispose(Oe.on(e,{focusin:function(){gn(n,t,"focus",n.open,[null,Oe.activeElement])},focusout:function(){gn(n,t,"focus",n.close,[])},click:function(){gn(n,t,"click",n.toggle,[e])}}))}});var vn=rn.prototype,wn=new WeakMap;function yn(e,t,n,r){if(!t&&!De(e.element))return I();var i=e.getOptions();return t?Le(e.element,n,r,i):Ie(e.element,r,i)}function bn(){var e=this;rn.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 mn(e),e.onDispose((function(){e.isFlyoutOpened=!1,e.visible=!1,e.toggle.dispose()}))}m(bn,rn,{get element(){return this.elements()[0]||null},getOptions:function(){var e=this,t=D(e,["closeOnBlur","containment"]);return void 0!==e.initialFocus&&(t.focus=e.initialFocus),t},next:function(){return this.effects=void 0,vn.next.call(this)},withEffects:function(){return this.effects=j(arguments),this},getCustomAttributes:function(){var e=this;return C(vn.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 yn(this,!0,e,t)},close:function(e){return ke(this.element,e)},toggleSelf:function(e,t){return"boolean"!=typeof e&&(t=e,e=!De(this.element)),yn(this,e,void 0,t)},onOpen:function(e){return this.onToggleState((function(t){t&&e(wn.get(this.element))}))},onToggleState:function(e){return this.watch("isFlyoutOpened",e)},onVisibilityChanged:function(e){return this.watch("visible",e)},whenVisible:function(e){var t=[];return t[0]=this.watch("visible",(function(n){t[1]=(n?A(e()):t[1]&&void t[1]())||k}),!0),s(t)},initElement:function(e,t){var n=this;n.elements()[1]&&Q("FlyoutMixin only supports single element"),vn.initElement.call(n,e,t),t.onDispose(X.on(e,{flyoutshow:function(t){wn.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 xn=tn.prototype;function Cn(){tn.call(this)}m(Cn,tn,{for:function(e){return this.state.ref=e,this},initElement:function(e,t){xn.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&&!Oe.focused(o)&&n(r||o)};t.onDispose(Oe.on(e,{focusin:function(r){t.focused=r.source,Ae(e,"focused",r.source),n(Oe.focus)},focusout:function(){t.focused=!1,Ae(e,"focused",!1)},focuschange:function(){n(Oe.blur,e)}}))},onLayoutEffect:function(e,t){Ae(e,"focused",t.focused)}});var Sn=G.getDirectiveComponent,Pn=rn.prototype;function En(){rn.call(this,["loading","loading-complete"]),this.loading=!1}m(En,rn,{initElement:function(e,t){var n=this;Pn.initElement.call(n,e,t),Sn(e).enableLoadingClass=!0,t.onDispose(qe(e,(function(t){n.loading=t||!!r(n.elements(),(function(t){return t!==e&&!0===Pe(t,"loading")}))})))}});var Mn=rn.prototype;function An(){var e=this;rn.call(e,["scrollable-x","scrollable-x-l","scrollable-x-r","scrollable-y","scrollable-y-d","scrollable-y-u"]),e.target=Wt.scrollableTarget,e.pageIndex=0,e.scrolling=!1}function Vn(){tn.call(this)}function On(){rn.call(this)}function Nn(e){C(this,e)}function Rn(e){return function(){var t=zn(e);return(t.withOptions||Nn).apply(t,arguments),t}}m(An,rn,{get element(){return this.elements()[0]||null},get contentElement(){var e=this.element;return e&&Sn(e).scrollable.scrollTarget},withOptions:function(e){return this.options=e,this},getCustomAttributes:function(){var e=this.options||{};return C(Mn.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;n.elements()[1]&&Q("ScrollableMixin only supports single element"),Mn.initElement.call(n,e,t),t.onDispose(X.on(e,{scrollIndexChange:function(e){n.pageIndex=e.newIndex},scrollStart:function(){n.scrolling=!0},scrollStop:function(){n.scrolling=!1}},!0))}}),v("destroy enable disable setOptions setStickyPosition refresh scrollPadding stop scrollLeft scrollTop scrollBy scrollTo scrollByPage scrollToPage scrollToElement",(function(e,t){p(An.prototype,t,(function(){return Sn(this.element).scrollable[t].apply(null,arguments)}))})),m(Vn,tn,{when:function(e){return this.state.deps=e,this},initElement:function(e,t){t.callback=function(){Me(e)}},mergeState:function(e,t,n){n.deps&&!y(n.deps,t.deps)&&z(t.callback),C(t,n)}}),m(On,rn,{memorize:function(){return this.classNames=j(arguments),this}});var Tn=Rn(sn),jn=Rn(pn),Fn=Rn(dn),qn=Rn(bn),kn=Rn(Cn),Dn=Rn(En),Ln=Rn(An),In=Rn(Vn),Un=Rn(On);function zn(e){return be((function(){return new e})).reset()}function Hn(e){return e&&e.getMixin().reset()}f(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.7.0 | (c) misonou | https://misonou.github.io */
2
+ !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("zeta-dom"),require("brew-js"),require("react"),require("react-dom"),require("zeta-dom-react"),require("waterpipe"),require("jquery")):"function"==typeof define&&define.amd?define("brew-js-react",["zeta-dom","brew-js","react","react-dom","zeta-dom-react","waterpipe","jquery"],t):"object"==typeof exports?exports["brew-js-react"]=t(require("zeta-dom"),require("brew-js"),require("react"),require("react-dom"),require("zeta-dom-react"),require("waterpipe"),require("jquery")):(e.brew=e.brew||{},e.brew.react=t(e.zeta,e.brew,e.React,e.ReactDOM,e.zeta.react,e.waterpipe,e.jQuery))}(self,((e,t,n,r,i,o,s)=>(()=>{var u={87:e=>{"use strict";e.exports=o},760:e=>{"use strict";e.exports=t},914:e=>{"use strict";e.exports=s},12:e=>{"use strict";e.exports=n},33:e=>{"use strict";e.exports=r},231:t=>{"use strict";t.exports=e},402:e=>{"use strict";e.exports=i},621:(e,t,n)=>{var r,i=n(33);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}},a={};function c(e){var t=a[e];if(void 0!==t)return t.exports;var n=a[e]={exports:{}};return u[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:()=>cn,AnimateSequenceItemMixin:()=>fn,AnimateSequenceMixin:()=>mn,ClassNameMixin:()=>un,ClassNameToggleMixin:()=>gn,Dialog:()=>Qe,FlyoutMixin:()=>Sn,FlyoutToggleMixin:()=>wn,FocusStateMixin:()=>En,LoadingStateMixin:()=>On,Mixin:()=>Jt,ScrollIntoViewMixin:()=>Rn,ScrollableMixin:()=>Nn,StatefulMixin:()=>on,StaticAttributeMixin:()=>$t,UnmanagedClassNameMixin:()=>qn,ViewContext:()=>ft,ViewStateContainer:()=>Ut,createDialog:()=>Be,createDialogQueue:()=>He,isViewMatched:()=>yt,isViewRendered:()=>bt,linkTo:()=>Mt,makeTranslation:()=>Gt,matchView:()=>xt,navigateTo:()=>At,openDialog:()=>ze,redirectTo:()=>Ot,registerErrorView:()=>St,registerView:()=>Ct,renderView:()=>Pt,resolvePath:()=>Et,useAnimateMixin:()=>Fn,useAnimateSequenceMixin:()=>Dn,useAppReady:()=>Ft,useAppReadyState:()=>Dt,useClassNameToggleMixin:()=>kn,useFlyoutMixin:()=>Ln,useFocusStateMixin:()=>In,useLanguage:()=>Wt,useLoadingStateMixin:()=>Un,useMixin:()=>Qn,useMixinRef:()=>_n,useQueryParam:()=>It,useRouteParam:()=>kt,useRouteState:()=>Lt,useScrollIntoViewMixin:()=>Bn,useScrollableMixin:()=>zn,useUnmanagedClassNameMixin:()=>Hn,useViewContainerState:()=>wt,useViewContext:()=>wt});var e=c(231),t=e.util,n=t.always,r=t.any,i=t.arrRemove,o=t.catchAsync,s=t.combineFn,u=t.createPrivateStore,a=t.define,f=t.defineGetterProperty,p=t.defineHiddenProperty,h=t.defineObservableProperty,d=t.defineOwnProperty,m=t.definePrototype,g=t.delay,v=t.each,w=t.either,y=t.equal,b=t.exclude,x=t.executeOnce,C=t.extend,S=t.fill,P=t.freeze,E=t.grep,M=t.isArray,A=t.isFunction,O=t.isPlainObject,V=t.isThenable,N=t.isUndefinedOrNull,R=t.keys,q=t.kv,T=t.makeArray,j=t.map,F=t.mapObject,D=t.noop,k=t.pick,L=t.randomId,I=t.resolve,U=t.setImmediate,z=t.setImmediateOnce,B=t.single,H=t.throwNotFunction,Q=t.throws,_=t.watch,W=t.watchable,G=c(760);var $=G.addExtension,J=G.install;const K=G.defaults;var X,Y=[];J("react",$(!0,"react2",["?router","?i18n"],(function(e){X=e,s(Y)(X)}))),K.react=!0;var Z=c(12),ee=Z.Component,te=Z.StrictMode,ne=Z.createContext,re=Z.createElement,ie=Z.useContext,oe=Z.useEffect,se=Z.useLayoutEffect,ue=Z.useMemo,ae=Z.useRef,ce=Z.useState,le=c(33),fe=c(621),pe=c(402),he=pe.ViewStateProvider,de=pe.classNames,me=pe.createAsyncScope,ge=pe.useAsync,ve=pe.useEagerState,we=pe.useMemoizedFunction,ye=pe.useObservableProperty,be=pe.useSingleton,xe=pe.useValueTrigger,Ce=e.util,Se=Ce.containsOrEquals,Pe=Ce.getClass,Ee=Ce.removeNode,Me=Ce.scrollIntoView,Ae=Ce.setClass,Oe=e.dom;const Ve=Oe;var Ne=Oe.reportError,Re=e.dom,qe=Re.runAsync,Te=Re.subscribeAsync,je=G.closeFlyout,Fe=G.isFlyoutOpen,De=G.openFlyout,ke=G.toggleFlyout,Le=u();function Ie(e,t){var n=document.createElement("div");return Ve.on(n,{flyoutshow:function(){(e.onOpen||D)(n)},flyouthide:function(){Ee(n),(e.onClose||D)(n),(t||D)()}}),n.setAttribute("loading-class",""),Te(n,!0),n}function Ue(e,t,n){return Se(Ve.root,e)||(e.className=t.className||"",t.modal&&e.setAttribute("is-modal",""),(n||t.container||document.body).appendChild(e)),De(e,null,k(t,["focus","closeOnBlur","preventLeave","preventNavigation"]))}function ze(e){return Be(e).open()}function Be(e){var t,r,i=Le(e.controller)||{},o="shared"===i.mode,s=o?i:{},u=s.root||(s.root=Ie(e,(function(){a.unmount()}))),a=s.reactRoot||(s.reactRoot=fe.createRoot(u)),c=s.scope||(s.scope=me(u)),l=o?D:je.bind(0,u);function f(e,t,n){var r=t.onCommit?function(n){return qe(Ve.activeElement,t.onCommit.bind(this,n)).then(e)}:e,i=C({},t,{errorHandler:c.errorHandler,closeDialog:r,commitDialog:r,dismissDialog:e}),s=re(t.onRender,i);return t.wrapper&&(s=re(t.wrapper,i,s)),a.render(re(te,null,re(c.Provider,null,s))),o?{then:D}:Ue(u,t,n)}return{root:u,close:function(e){return l(e)},open:(t=function(){return i.enqueue?i.enqueue((function(t){f(l=o?t:l,C({},i.props,e),i.root).then(t)})):f(l,e)},function(){return r||(r=t.apply(this,arguments),n(r,(function(){r=null}))),r})}}function He(e){var t,n=e&&e.mode,r=n&&Ie(e),o="multiple"===n,u=[],a=[],c={},l=h(c,"pendingCount",0,!0);function f(){s(u.splice(0))(),l(0)}function p(e){s(a.splice(0))(o?void 0:e),f()}function d(e){return new Promise((function(t){a.push(t),l(u.length),e((function(e){return i(a,t)&&(t(e),U((function(){(u.shift()||D)(!0)}))),!r||u[0]||a[0]?I():je(r)}))}))}return o?e=C({},e,t={closeOnBlur:!1}):t=e&&b(e,["onCommit","onRender","onOpen","onClose"]),Le(c,{root:r,mode:n,props:t,enqueue:function(t){return r&&!Fe(r)&&Ue(r,e).then(p),u.length||a.length>=(o?e.concurrent||1/0:1)?new Promise((function(e){u.push((function(n){e(n&&d(t))})),l(u.length)})):d(t)}}),C(c,{dismissAll:p,dismissPending:f})}function Qe(e){var t=C(ce({})[0],e),n=ce((function(){return Ie(t)}))[0];return oe((function(){var e=Fe(n);w(e,t.isOpen)&&(e?je(n):Ue(n,t))}),[t.isOpen]),oe((function(){return je.bind(0,n)}),[]),le.createPortal(e.children,n)}var _e,We,Ge=e.EventContainer,$e=G.getQueryParam,Je=G.setQueryParam,Ke=G.toQueryString,Xe=G.parsePath,Ye=G.removeQueryAndHash,Ze=G.animateIn,et=G.animateOut,tt=u(),nt=Ve.root,rt=new Map,it={},ot=[],st=new Ge,ut=P(C(new ft,{container:nt})),at=tt(ut),ct=ne(ut),lt={waitFor:D};function ft(e,t,n){var r=this;d(r,"view",e||null,!0),d(r,"parent",n||null,!0),tt(r,{children:[],setPage:h(r,"page",t||null,!0),setActive:h(r,"active",!!t,!0)}),_(r,"page",(function(e,t){st.emit("pagechange",r,{page:e,previousPage:t,navigationType:lt.navigationType,waitFor:lt.waitFor})}))}function pt(e){ee.call(this,e),this.state={},tt(e.context).wrapper=this}function ht(){ee.apply(this,arguments),this.views=[]}function dt(e,t){return N(e)||""===e||e===t?"":e[0]===t?e:t+e}function mt(e,t){return(rt.get(t)||{}).matchCount-(rt.get(e)||{}).matchCount}function gt(e,t){var n=rt.get(e);return!!n&&!B(n.matchers,(function(e,n){var r=t[n]||"";return A(e)?!e(r):(e||"")!==r}))}function vt(e){var t;return H(e),e.prototype instanceof ee&&(e=re.bind(null,e)),function(n){var r=t||e(n.viewProps);if(!V(r))return se(n.onLoad,[]),r;o(t=r);var i=ge((function(){return t.then(null,(function(e){t=null,n.onError(e)}))}))[0];return i&&n.onLoad(),i?re(i.default,n.viewProps):n.self.currentContext===n.context&&n.loader||null}}function wt(){return ie(ct)}function yt(e){var t=X.route;return gt(e,t)&&Et(e,t)===t.toString()}function bt(e){return!!(rt.get(e)||"").rendered}function xt(){var e=T(arguments),t=X.route;return"string"==typeof e[0]&&(t=t.parse(e.shift())),e=e[0]?(M(e[0])?T(e[0]):e).sort(mt):ot,r(e,(function(e){return gt(e,t)}))||void 0}function Ct(e,t){var n=vt(e);return t=C({},t),v(t,(function(e,n){it[e]=!0,n instanceof RegExp&&(t[e]=n.test.bind(n))})),rt.set(n,{id:L(),rendered:0,matchCount:R(t).length,matchers:t,params:k(t,(function(e){return N(e)||"string"==typeof e}))}),ot.push(n),ot.sort(mt),n}function St(e){_e=H(e)}function Pt(){var e=T(arguments),t=A(e[0])?{}:e.shift(),n=e[0];return v(e,(function(e,t){if(!rt.has(t))throw new Error("Invalid argument to renderView: "+(A(t)?t.name:t))})),e.sort(mt),re(ht,{rootProps:t,views:e,defaultView:n})}function Et(e,t){var n="";return M(t)&&(n=dt(O(t[1])?Ke(t[1]):t[1],"?")+dt(t[2],"#"),t=t[0]),(rt.has(e)?X.route.getPath(function(e,t){var n=rt.get(e);if(!n.maxParams){var i=b(n.matchers,["remainingSegments"]),o=j(X.routes,(function(e){var t=X.parseRoute(e),n=t.length&&!r(i,(function(e,n){var r=t.params[n];return(e?!(r>=0):r<t.minLength)||!A(e)&&!t.match(n,e)}));return n?t:null}));if(o[1]&&(o=E(o,(function(e){return!B(e.params,(function(e,t){return it[t]&&!i[t]}))}))),o[0]){var s=o.slice(-1)[0];n.maxParams=R(C.apply(0,[{remainingSegments:!0}].concat(o.map((function(e){return e.params}))))),n.minParams=j(s.params,(function(e,t){return n.params[t]||e>=s.minLength?null:t}))}}return C(k(X.route,n.minParams),t&&k(t,n.maxParams),n.params)}(e,t)):"/")+n}function Mt(e,t){return X.toHref(Et(e,t))}function At(e,t,n,r){return X.navigate(Et(e,t),r,n&&P(C({},n)))}function Ot(e,t,n){return At(e,t,n,!0)}We=function(){X.on("beforepageload",(function(e){at.setPage(X.page),at.setActive(!0),lt=e,function t(n){v(n.children,(function(n,r){e.waitFor(new Promise((function(e){r.onRender=e,r.forceUpdate()})).then((function(){t(r)})))}))}(at)})),at.setPage(X.page)},X?We(X):Y.push(H(We)),d(ft,"root",ut,!0),m(ft,{getChildren:function(){return j(tt(this).children,(function(e){return e.currentContext}))},setErrorView:function(e,t){var n=tt(this).wrapper;return n&&e&&!n.setState({error:t,errorView:e})},on:function(e,t){return st.add(this,e,t)}}),m(pt,ee,{componentDidMount:function(){var e=this;e.componentWillUnmount=_(e.props.context,"page",(function(){e.state.errorView=null,e.forceUpdate()}))},componentDidCatch:function(e){var t=this;_e&&t.state.errorView!==_e?t.setState({error:e,errorView:_e}):(t.props.onLoad(),Ne(e,t.props.context.container))},render:function(){var e=this,t=e.props.context;if(!t.container)return U((function(){C(e,me(t.container)),Ve.on(t.container,"error",(function(e){return st.emit(e,t,{error:e.error},!1)})),e.forceUpdate()})),null;if(e.state.errorView)return e.props.onLoad(),re(e.Provider,null,re(e.state.errorView,{view:t.view,error:e.state.error,reset:e.reset.bind(e)}));var n=e.componentDidCatch.bind(e),r={errorHandler:e.errorHandler,navigationType:lt.navigationType,viewContext:t,viewData:t.page.data||{}};return re(e.Provider,null,re(t.view,C({viewProps:r,onError:n},e.props)))},reset:function(){this.setState({errorView:null})}}),ht.contextType=ct,m(ht,ee,{componentDidMount:function(){var e=this,t=tt(e.context).children,n=_(X.route,(function(){e.setActive(e.getViewComponent()===(e.currentContext||"").view)}));e.componentWillUnmount=function(){e.setActive(!1),i(t,e),n(),U((function(){e.currentContext&&!e.currentContext.active&&e.unmountView()}))},t.push(e),e.setActive(!0)},componentDidUpdate:function(e){(e.rootProps.ref||{}).current=null,this.setContext(this.currentContext)},setContext:function(e){this.currentContext=e,(this.props.rootProps.ref||{}).current=e},render:function(){var e=this;return e.context.active&&e.updateView(),e.onRender(),e.views},updateView:function(){var e=this,t=e.getViewComponent(),r=t!==(e.currentContext||"").view;if(t&&(r||!(e.children||"")[0])){var i=Et(t,X.route);if(i!==Ye(X.path))return void X.navigate(i,!0)}var o=rt.get(t)||{};if((e.views[2]||"").key!==o.id){if(e.views[2]=null,e.abort(),!t||!r)return e.setActive(!0),void e.setPage(X.page);lt.waitFor(new Promise((function(r){var i=new ft(t,X.page,e.context),s=e.props.rootProps,u=x((function(t){d(i,"container",t,!0),Ve.on(t,"error",(function(t){i!==e.currentContext&&t.handled()})),e.setContext(e.currentContext||i)})),a=x((function(){var s=i.container,u=e.unmountView();e.unmountView=x((function(){return o.rendered--,e.setActive(!1),X.emit("pageleave",s,{pathname:i.page.path,view:t},!0),et(s,"show").then((function(){e.views[0]=null,e.forceUpdate()}))})),n(u,g).then((function(){X.emit("pageenter",s,{pathname:i.page.path,view:t},!0)})),e.views.shift(),e.setContext(i),C(e,tt(i)),o.rendered++,Ze(s,"show","[brew-view]",!0),r()}));i.on("error",(function(){return(e.props.rootProps.onError||D).apply(this,arguments)})),e.abort=r,e.views[2]=re(ct.Provider,{key:o.id,value:i},re(Ut,null,re("div",C(b(s,["loader","onError"]),{ref:u,"brew-view":""}),re(pt,{onLoad:a,context:i,self:e,loader:s.loader}))))})))}},getViewComponent:function(){var e=this.props;return r(e.views,(function(e){return gt(e,X.route)}))||e.defaultView}}),S(ht.prototype,"abort onRender setActive setPage unmountView",D);var Vt=new Ge;function Nt(){return X.historyStorage.current}function Rt(e,t){this.key=e,this.store=Nt(),this.dispose=t}function qt(e,t,n,r){return e.get(t)!==n&&(r&&e.has(t)&&(X.snapshot(),e=Nt()),e.set(t,n)),e}function Tt(e,t,n){var r=e.get();(t!==e.key||n!==e.store&&n.has(t))&&(r=n.get(t),Vt.emit("popstate",e,{newValue:r})),e.key=t,e.store=n,n.set(t,r)}function jt(e,t){var n=wt();return oe((function(){return X.on("beforepageload popstate",(function(){n.active&&e(Nt())}))}),t),n}function Ft(){return Dt().ready}function Dt(){var e=ye(X,"readyState");return{ready:"ready"===e,error:"error"===e}}function kt(e,t){var n=wt(),r=n.page.params,i=r[e]||"",o=xe(i);return oe((function(){var t=function(){o(n.page.params[e]||"")};return t(),n.on("pagechange",t)}),[e]),t&&n.active&&(!i||"remainingSegments"===e&&"/"===i)&&X.navigate(X.route.getPath(C({},r,q(e,t))),!0),i}function Lt(e,t,n){var r=Nt(),i=ve(r&&r.has(e)?r.get(e):t),o=jt((function(t){i[1]((function(n){return t.has(e)?t.get(e):(t.set(e,n),n)}))}),[e]);return r?o.active&&qt(r,e,i[0],n):X.beforeInit(g(1)),i}function It(e,t,n){O(e)&&(n=t,t=e,e=!1);var r=wt(),i=function(){return P(F(!1===e?t:q(e,t),(function(e,t){return $e(t,X.path)||e||""})))},s=ae({});ue((function(){s.current=i()}),[e]);var u=s.current,a=xe(u,(function(e,t){return y(e,t)||!(s.current=t)})),c=we((function(t){var u=s.current;if(!1!==e?t=q(e,A(t)?t(u[e]):t):A(t)&&(t=t(C({},u))),r.active){var c=Xe(X.path),l=R(t).reduce((function(e,n){return t[n]!==u[n]?Je(n,t[n]||null,e):e}),c.search);l!==c.search&&(n&&X.snapshot(),o(X.navigate((l||"?")+c.hash,!0)),a(i()))}}));return oe((function(){return X.watch("path",(function(){r.active&&a(i())}))}),[e]),[!1!==e?u[e]:u,c]}function Ut(e){var t=ce({})[0],n=jt((function(e){v(t,(function(t,n){Tt(n,n.key,e)}))}),[]),r=ce((function(){return{getState:function(e,r){var i=t[e];return i&&n.active&&Tt(i,r,Nt()),i||(t[e]=new Rt(r,(function(){delete t[e]})))}}}))[0];return re(he,{value:r},e.children)}m(Rt,{get:function(){return this.store.get(this.key)},set:function(e,t){this.store=qt(this.store,this.key,e,t)},onPopState:function(e){return H(e),Vt.add(this,"popstate",(function(t){e.call(this,t.newValue)}))}});var zt=c(87),Bt=Object.create(null),Ht="function"==typeof Symbol&&Symbol.toPrimitive;function Qt(e){this.toString=e}function _t(e){return C((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 Qt(e.bind(0,t,n,r,!0))}})}function Wt(){return ye(X,"language")}function Gt(e,t){var n=new RegExp("^("+Object.keys(e[t]).join("|")+")\\."),r={};function i(n,r,o,s,u){var a=((e[u]||Bt)[n]||Bt)[r];return"string"==typeof a?!a||s&&void 0===o?a:zt(a,o,{noEncode:s}):u!==t?i(n,r,o,s,t):void 0}function o(e,t,r,o){var s=n.test(e)?RegExp.$1:"";return i(s,s?e.slice(RegExp.lastMatch.length):e,t,o,r||X.language)}function s(){var e=String(this),t=T(arguments),n=e+" "+t.join(" ");return r[n]||(r[n]=t[0]?_t((function(n,r,o,s){return o=o||e||X.language,B(t,(function(e){return i(e,n,r,s,o)}))})):_t((function(t,n,r,i){return o(t,n,r||e,i)})))}return{translate:_t(o),getTranslation:s.bind(""),useTranslation:function(){var e=Wt();return{language:e,t:s.apply(e,arguments)}},keys:function(n){return R(e[t][n]||Bt)}}}function $t(e,t){Jt.call(this),this.attributes=O(e)||q(e,t||"")}function Jt(){}Ht&&(Qt.prototype[Ht]=function(){return this.toString()}),m($t,Jt,{getCustomAttributes:function(){return C({},this.attributes)}}),m(Jt,{reset:function(){return this},next:function(){},getRef:function(){return D},getClassNames:function(){return[]},getCustomAttributes:function(){return{}},dispose:function(){}}),W(Jt.prototype),a(Jt,{get scrollableTarget(){return new $t("scrollable-target")},get tabRoot(){return new $t("tab-root")},use:function(){var e=T(arguments),t={},n=[],r=e[0];return r?"function"==typeof r?(n.push(r),e.shift()):"string"==typeof r||r instanceof Jt||(n.push((function(e){r.current=e})),e.shift()):e.shift(),v(e,(function(e,r){r instanceof Jt&&(n.push(r.getRef()),C(t,r.getCustomAttributes()),r.next())})),C(t,{ref:s(n),className:de.apply(null,e)})}});var Kt=e.dom,Xt=Kt.watchElements,Yt=Kt.watchOwnAttributes,Zt=u(),en=new Set;function tn(){v(en,(function(e,t){s(Zt(t).splice(0))()})),en.clear()}function nn(e,t){Zt(this,[e.delete.bind(e,t)]),e.set(t,this)}function rn(e){this.mixin=e}function on(){Jt.call(this),Zt(this,{pending:{},elements:[],states:new Map,flush:_(this,!1),dispose:[]})}function sn(e,t,n,r){var i=n.classNames,o=C({},i);v(i,(function(e){i[e]=t.classList.contains(e)})),r&&!y(n.prev||o,i)&&(n.prev=o,e.onClassNameUpdated(t,o,C({},i)))}function un(e){on.call(this),this.classNames=e||[]}m(nn,{onDispose:function(e){Zt(this).push(H(e))}}),m(rn,{getMixin:function(){return this.mixin}}),m(on,Jt,{get ref(){var e=Zt(this);return e.ref||(e.ref=new rn(this))},get state(){return Zt(this).pending},reset:function(){return Zt(this).pending={},this},next:function(){return Zt(this).pending={},this},getRef:function(){var e,t,n=this,r=Zt(n),o=r.pending;return function(s){s?(e=s,t=r.states.get(e)||new nn(r.states,e),r.elements.push(e),t.element?R(o)[0]&&n.mergeState(e,t,o):n.initElement(e,C(t,n.initState(),o,{element:e})),n.onLayoutEffect(e,t),en.delete(t)):t&&(en.add(t),n.onBeforeUpdate(e,t),i(r.elements,e)),z(tn)}},elements:function(){return Zt(this).elements.slice()},onDispose:function(e){Zt(this).dispose.push(e)},initState:function(){return{}},initElement:function(e,t){},mergeState:function(e,t,n){C(t,n)},onLayoutEffect:function(e,t){},onBeforeUpdate:function(e,t){},clone:function(){return this},dispose:function(){var e=Zt(this);v(e.states,(function(e,t){en.add(t)})),z(tn),s(e.dispose.splice(0))(),e.flush(),e.pending={}}}),m(un,on,{initElement:function(e,t){var n=this;t.classNames=S(n.classNames,!1),sn(n,e,t),t.onDispose(Yt(e,"class",(function(){sn(n,e,t,!0)})).dispose)},onLayoutEffect:function(e,t){Ae(e,t.classNames)},onBeforeUpdate:function(e,t){sn(this,e,t)},onClassNameUpdated:function(e,t,n){}});var an=un.prototype;function cn(){un.call(this,["tweening-in","tweening-out"])}m(cn,un,{next:function(){var e=this;return e.effects=void 0,e.trigger=void 0,an.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 C(an.getCustomAttributes.call(e),{"animate-in":(e.effects||[]).join(" "),"animate-on":e.trigger||"show"})}});var ln=un.prototype;function fn(e){un.call(this,["tweening-in","tweening-out"]),this.className=e}m(fn,un,{getCustomAttributes:function(){return C(ln.getCustomAttributes.call(this),{"is-animate-sequence":""})},getClassNames:function(){return[this.className].concat(ln.getClassNames.call(this))}});var pn=c(914),hn=cn.prototype,dn=0;function mn(){var e=this;cn.call(e),e.className="brew-anim-"+ ++dn,e.item=new fn(e.className)}function gn(){on.call(this)}m(mn,cn,{withOptions:function(e){return this.selector=e,this},getCustomAttributes:function(){var e=this;return C(hn.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;hn.initElement.call(n,e,t),n.selector&&t.onDispose(Xt(e,n.selector,(function(e){pn(e).attr("is-animate-sequence","")})).dispose)}}),m(gn,on,{withOptions:function(e){this.classes=C({},e)},getClassNames:function(){return this.classes},set:function(e,t){t=O(e)||q(e,t),v(this.elements(),(function(e,n){Ae(n,t)})),C(this.classes,t)}});var vn=un.prototype;function wn(e){un.call(this,["target-opened"]),this.flyoutMixin=e}function yn(e,t,n,r,i){(t.trigger||"click")===n&&r.apply(e,i)}m(wn,un,{on:function(e){return this.state.trigger=e,this},open:function(e,t){return this.flyoutMixin.open(e,t)},close:function(e){return this.flyoutMixin.close(e)},toggle:function(e,t){return this.flyoutMixin.toggleSelf(e,t)},initElement:function(e,t){var n=this;vn.initElement.call(n,e,t),t.onDispose(Ve.on(e,{focusin:function(){yn(n,t,"focus",n.open,[null,Ve.activeElement])},focusout:function(){yn(n,t,"focus",n.close,[])},click:function(){yn(n,t,"click",n.toggle,[e])}}))}});var bn=un.prototype,xn=new WeakMap;function Cn(e,t,n,r){if(!t&&!Fe(e.element))return I();var i=e.getOptions();return t?De(e.element,n,r,i):ke(e.element,r,i)}function Sn(){var e=this;un.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 wn(e),e.onDispose((function(){e.isFlyoutOpened=!1,e.visible=!1,e.toggle.dispose()}))}m(Sn,un,{get element(){return this.elements()[0]||null},getOptions:function(){var e=this,t=k(e,["closeOnBlur","containment"]);return void 0!==e.initialFocus&&(t.focus=e.initialFocus),t},next:function(){return this.effects=void 0,bn.next.call(this)},withEffects:function(){return this.effects=T(arguments),this},getCustomAttributes:function(){var e=this;return C(bn.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 Cn(this,!0,e,t)},close:function(e){return je(this.element,e)},toggleSelf:function(e,t){return"boolean"!=typeof e&&(t=e,e=!Fe(this.element)),Cn(this,e,void 0,t)},onOpen:function(e){return this.onToggleState((function(t){t&&e(xn.get(this.element))}))},onToggleState:function(e){return this.watch("isFlyoutOpened",e)},onVisibilityChanged:function(e){return this.watch("visible",e)},whenVisible:function(e){var t=[];return t[0]=this.watch("visible",(function(n){t[1]=(n?A(e()):t[1]&&void t[1]())||D}),!0),s(t)},initElement:function(e,t){var n=this;n.elements()[1]&&Q("FlyoutMixin only supports single element"),bn.initElement.call(n,e,t),t.onDispose(X.on(e,{flyoutshow:function(t){xn.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 Pn=on.prototype;function En(){on.call(this)}m(En,on,{for:function(e){return this.state.ref=e,this},initElement:function(e,t){Pn.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&&!Ve.focused(o)&&n(r||o)};t.onDispose(Ve.on(e,{focusin:function(r){t.focused=r.source,Ae(e,"focused",r.source),n(Ve.focus)},focusout:function(){t.focused=!1,Ae(e,"focused",!1)},focuschange:function(){n(Ve.blur,e)}}))},onLayoutEffect:function(e,t){Ae(e,"focused",t.focused)}});var Mn=G.getDirectiveComponent,An=un.prototype;function On(){un.call(this,["loading","loading-complete"]),this.loading=!1}m(On,un,{initElement:function(e,t){var n=this;An.initElement.call(n,e,t),Mn(e).enableLoadingClass=!0,t.onDispose(Te(e,(function(t){n.loading=t||!!r(n.elements(),(function(t){return t!==e&&!0===Pe(t,"loading")}))})))}});var Vn=un.prototype;function Nn(){var e=this;un.call(e,["scrollable-x","scrollable-x-l","scrollable-x-r","scrollable-y","scrollable-y-d","scrollable-y-u"]),e.target=Jt.scrollableTarget,e.pageIndex=0,e.scrolling=!1}function Rn(){on.call(this)}function qn(){un.call(this)}function Tn(e){C(this,e)}function jn(e){return Qn.bind(0,e)}m(Nn,un,{get element(){return this.elements()[0]||null},get contentElement(){var e=this.element;return e&&Mn(e).scrollable.scrollTarget},withOptions:function(e){return this.options=e,this},getCustomAttributes:function(){var e=this.options||{};return C(Vn.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;n.elements()[1]&&Q("ScrollableMixin only supports single element"),Vn.initElement.call(n,e,t),t.onDispose(X.on(e,{scrollIndexChange:function(e){n.pageIndex=e.newIndex},scrollStart:function(){n.scrolling=!0},scrollStop:function(){n.scrolling=!1}},!0))}}),v("destroy enable disable setOptions setStickyPosition refresh scrollPadding stop scrollLeft scrollTop scrollBy scrollTo scrollByPage scrollToPage scrollToElement",(function(e,t){p(Nn.prototype,t,(function(){return Mn(this.element).scrollable[t].apply(null,arguments)}))})),m(Rn,on,{when:function(e){return this.state.deps=e,this},initElement:function(e,t){t.callback=function(){Me(e)}},mergeState:function(e,t,n){n.deps&&!y(n.deps,t.deps)&&z(t.callback),C(t,n)}}),m(qn,un,{memorize:function(){return this.classNames=T(arguments),this}});var Fn=jn(cn),Dn=jn(mn),kn=jn(gn),Ln=jn(Sn),In=jn(En),Un=jn(On),zn=jn(Nn),Bn=jn(Rn),Hn=jn(qn);function Qn(e,t){var n=be((function(){return new e}),[]).reset();return(n.withOptions||Tn).call(n,t),n}function _n(e){return e&&e.getMixin().reset()}f(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