Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More โ†’
Socket
Sign inDemoInstall
Socket

atomic-router

Package Overview
Dependencies
Maintainers
3
Versions
60
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

atomic-router - npm Package Compare versions

Comparing version 0.8.0 to 0.9.0

2

dist/atomic-router.cjs.js

@@ -1,2 +0,2 @@

function e(e){void 0===e&&(e={});var r=effector.createEffect((e=>{var r=e.replace;return{params:e.params||{},query:e.query||{},replace:void 0!==r&&r}}),{name:"navigateFx",sid:"c2qlao"}),a=effector.attach({and:{effect:r,mapParams:e=>({params:e||{},query:{}})},or:{name:"openFx",sid:"am04as"}}),t=effector.createStore(!1,{name:"$isOpened",sid:"-8u29di"}),o=effector.createStore({},{name:"$params",sid:"6sxdf"}),n=effector.createStore({},{name:"$query",sid:"tylje5"}),s=effector.createEvent({name:"opened",sid:"fafqk0"}),i=effector.createEvent({name:"updated",sid:"66vs1s"}),c=effector.createEvent({name:"closed",sid:"-wbq1n3"});return t.on(s,(()=>!0)).on(c,(()=>!1)),o.on(s,((e,r)=>r.params)).on(i,((e,r)=>r.params)),n.on(s,((e,r)=>r.query)).on(i,((e,r)=>r.query)),effector.split({and:[{source:r.doneData,match:t.map((e=>e?'updated':'opened')),cases:{opened:s,updated:i}}],or:{sid:"3j56hf"}}),{$isOpened:t,$params:o,$query:n,opened:s,updated:i,closed:c,navigate:r,open:a,kind:m.ROUTE,settings:{derived:Boolean(e.filter)}}}function r(e,r){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(e);r&&(t=t.filter((r=>Object.getOwnPropertyDescriptor(e,r).enumerable))),a.push.apply(a,t)}return a}function a(e){for(var a=1;a<arguments.length;a++){var o=null!=arguments[a]?arguments[a]:{};a%2?r(Object(o),!0).forEach((r=>{t(e,r,o[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(o)):r(Object(o)).forEach((r=>{Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(o,r))}))}return e}function t(e,r,a){return r in e?Object.defineProperty(e,r,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[r]=a,e}function o(e,r){(null==r||r>e.length)&&(r=e.length);for(var a=0,t=new Array(r);a<r;a++)t[a]=e[a];return t}function n(e,r){var it="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(it)return(it=it.call(e)).next.bind(it);if(Array.isArray(e)||(it=((e,r)=>{if(e){if("string"==typeof e)return o(e,r);var a={}.toString.call(e).slice(8,-1);return"Object"===a&&e.constructor&&(a=e.constructor.name),"Map"===a||"Set"===a?Array.from(e):"Arguments"===a||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a)?o(e,r):void 0}})(e))||r&&e&&"number"==typeof e.length){it&&(e=it);var a=0;return()=>a>=e.length?{done:!0}:{done:!1,value:e[a++]}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function s(e,r){if(Object.keys(e).length!==Object.keys(r).length)return!1;for(var a in e)if(""+e[a]!=""+r[a])return!1;return!0}function i(e){var r,a=e.params,t=e.query,o=e.serialize,n=p.compile(e.pathCreator)(a),s=null!==(r=null==o?void 0:o.write(t))&&void 0!==r?r:new URLSearchParams(t);return n+(Object.keys(t).length?"?"+s:'')}function c(e){var r=e.actualPath,a=p.match(e.pathCreator.replace('://','\\://'))((e=>{if(e.match(/^[a-z0-9]+\:\/\//i))return e;var r=new URL("http://_"+e);return[r.pathname,r.hash].join('')})(r));return a?{matches:!0,params:a.params}:{matches:!1}}function d(e){if(!e)throw new Error('[Routing] No history provided')}function l(e){return e.map((e=>!e))}function u(e){return effector.is.store(e,{sid:"b1hcct"})?e:effector.createStore(e,{sid:"-cvms36"})}Object.defineProperty(exports,'__esModule',{value:!0});var effector=require('effector'),p=require('path-to-regexp'),m={ROUTE:Symbol()},f=()=>({$query:effector.createStore({},{and:{updateFilter:(e,r)=>!s(r,e)},name:"$query",sid:"z22f3o"}),back:effector.createEvent({name:"back",sid:"lqciue"}),forward:effector.createEvent({name:"forward",sid:"-5dfdts"})}),v=e=>'object'==typeof e&&null!==e&&'kind'in e&&e.kind===m.ROUTE,h=effector.createEffect((e=>(d(e.history),e.history[e.method](e.path,{}),e)),{name:"historyPushFx",sid:"-w0no5y"}),y=effector.createEffect((e=>(d(e),e.back(),e)),{name:"historyBackFx",sid:"-ny8vwp"}),g=effector.createEffect((e=>(d(e),e.forward(),e)),{name:"historyForwardFx",sid:"88oqi4"}),b=e=>r=>{var a=r.find((r=>r.routeObj.route===e.route));if(a)return{params:a.params,query:a.query}},O={all:{irrelevant:!0,empty:!0,preserve:[]},default:{irrelevant:!1,empty:!0,preserve:[]},none:{irrelevant:!1,empty:!1,preserve:[]}};exports.Kind=m,exports.buildPath=i,exports.chainRoute=r=>{var a=(r=>{var a={};if(effector.withFactory({sid:"-vuorye",fn:()=>v(r),name:"none",method:"isRoute"}))return Object.assign(a,{route:r,chainedRoute:effector.withFactory({sid:"-x3jlk0",fn:()=>e(),name:"chainedRoute",method:"createRoute"}),beforeOpen:effector.createEvent({name:"beforeOpen",sid:"2i9mdy"}),openOn:effector.merge([r.opened,r.closed],{name:"openOn",sid:"-n9uh0c"}),cancelOn:effector.merge([effector.createEvent({name:"cancelOn",sid:"r6ceph"})],{name:"cancelOn",sid:"r6ce1d"})}),a;var t=r;if(Object.assign(a,{route:t.route,chainedRoute:t.chainedRoute||effector.withFactory({sid:"-if59ok",fn:()=>e(),name:"chainedRoute",method:"createRoute"}),beforeOpen:effector.is.unit(t.beforeOpen)?t.beforeOpen:effector.attach({and:t.beforeOpen,or:{name:"beforeOpen",sid:"-xdumjk"}})}),effector.is.effect(a.beforeOpen,{sid:"-qylloz"}))return Object.assign(a,{openOn:t.openOn||a.beforeOpen.doneData,cancelOn:t.cancelOn||a.beforeOpen.failData}),a;var o=r;return Object.assign(a,{openOn:effector.sample({and:[{clock:o.openOn}],or:{name:"openOn",sid:"-92mmrn"}}),cancelOn:effector.sample({and:[{clock:o.cancelOn||effector.createEvent({name:"clock",sid:"-53qs2n"})}],or:{name:"cancelOn",sid:"-m0jt12"}})}),a})(r),t=a.route,o=a.chainedRoute,n=a.beforeOpen,s=a.openOn,i=a.cancelOn,c=effector.createStore({},{name:"$params",sid:"ahwukb"}),d=effector.createStore({},{name:"$query",sid:"-urele3"}),l=effector.combine({and:[effector.combine({and:[[t.$params,t.$query]],or:{name:"and",sid:"3v6jcf"}}),effector.combine({and:[[c,d]],or:{name:"and",sid:"3vqbxs"}}),(e,r)=>e[0]===r[0]&&e[1]===r[1]],or:{name:"$hasSameParams",sid:"-xzy23v"}}),u=effector.sample({and:[{clock:[t.opened,t.updated]}],or:{name:"routeOpened",sid:"-gtwxmc"}});effector.sample({and:[{clock:u,target:n}],or:{sid:"-noxmt5"}}),c.on(u,((e,r)=>r.params)),d.on(u,((e,r)=>r.query));var p=effector.guard({and:[{clock:s,source:{params:c,query:d},filter:l}],or:{name:"chainedRouteResolved",sid:"-mwemeb"}});effector.sample({and:[{clock:p,target:o.navigate}],or:{sid:"-n6sf88"}});var m=effector.merge([t.closed,i],{name:"aborted",sid:"utn0jm"});return c.reset(m),d.reset(m),effector.sample({and:[{clock:m,target:o.closed}],or:{sid:"-mqalfe"}}),o},exports.createHistoryRouter=e=>{var r=e.base,t=e.routes,o=e.notFoundRoute,d=e.hydrate,u=e.serialize,p=e.controls,m=void 0===p?effector.withFactory({sid:"d2qzob",fn:()=>f(),name:"controls",method:"createRouterControls"}):p,O=((e,r)=>{void 0===r&&(r='');for(var t,o=[],s=()=>{var e,r=t.value;Array.isArray(r.route)?(e=o).push.apply(e,r.route.map((e=>a(a({},r),{},{route:e})))):o.push(r)},i=n(e);!(t=i()).done;)s();o=o.map((e=>a(a({},e),{},{path:""+r+e.path})));for(var c,d=[],l=[],u=n(o);!(c=u()).done;){var p=c.value;p.route.settings.derived?d.push(p):l.push(p)}if(d.length)for(var m,f=n(d);!(m=f()).done;)console.error("createHistoryRouter: "+m.value.path+" uses derived route. This won't work");return l})(t,r),k=effector.createEvent({name:"setHistory",sid:"9zwyxu"}),q=effector.createEvent({name:"navigateFromRouteTriggered",sid:"soge6d"}),j=effector.createEvent({name:"historyUpdated",sid:"-x4474u"}),w=effector.createEvent({name:"recalculateTriggered",sid:"-ykrhlj"}),$=effector.createEvent({name:"recalculated",sid:"aeh4sf"}),x=effector.createEvent({name:"routesMatched",sid:"2rfqt6"}),R=effector.createEvent({name:"routesMismatched",sid:"71hypl"}),E=effector.createEvent({name:"routeNotFound",sid:"avqxzu"}),S=effector.createEvent({name:"initialized",sid:"du6f0f"}),P=effector.createStore('',{name:"$path",sid:"wz8cwv"}),F=effector.createStore({},{and:{name:'historyRouter.$query',updateFilter:(e,r)=>!s(e,r)},name:"$query",sid:"tkdilp"}),z=effector.createStore([],{and:{serialize:'ignore'},name:"$activeRoutes",sid:"9ljm7u"}),U=effector.createStore(null,{and:{serialize:'ignore'},name:"$history",sid:"g4i7nj"}),A=effector.createStore(!1,{name:"$isFirstCheckPassed",sid:"9r108x"}),C=effector.createStore(!1,{name:"$isRouteNavigateInProgress",sid:"a1vtrl"}),D=effector.attach({and:{source:U,effect:(e,r)=>h(a({history:e},r))},or:{name:"pushFx",sid:"qm76ov"}}),H=effector.attach({and:{source:U,effect:e=>{var r=j;try{r=effector.scopeBind(j)}catch(e){}return e.listen((()=>{r()})),!0}},or:{name:"subscribeHistoryFx",sid:"-b12mlt"}}),T=effector.sample({and:[{clock:d?[j]:[j,H.done],source:U,filter:Boolean,fn:e=>{var r;return{path:e.location.pathname,query:null!==(r=null==u?void 0:u.read(e.location.search))&&void 0!==r?r:Object.fromEntries(new URLSearchParams(e.location.search))}}}],or:{name:"historyUpdatedParsed",sid:"-rhkauu"}}),Q=effector.sample({and:[{clock:T,source:{path:P,query:F},filter:(e,r)=>r.path!==e.path||!s(r.query,e.query),fn:(e,r)=>r}],or:{name:"historyUpdateTriggered",sid:"-pbyg2j"}});U.on(k,((e,r)=>r)),effector.sample({and:[{clock:U,target:H}],or:{sid:"-pwl7u3"}}),effector.sample({and:[{clock:Q,source:U,filter:Boolean,fn:e=>{var r,a=null==e?void 0:e.location.hash;return{path:null==e?void 0:e.location.pathname,query:null!==(r=null==u?void 0:u.read(null==e?void 0:e.location.search))&&void 0!==r?r:Object.fromEntries(new URLSearchParams(null==e?void 0:e.location.search)),hash:a}},target:w}],or:{sid:"-ptu8va"}});for(var B,I=n(O);!(B=I()).done;){var L=B.value,M=x.filterMap(b(L)),N=R.filterMap(b(L)),_={opened:effector.sample({and:[{clock:M,filter:l(L.route.$isOpened)}],or:{name:"opened",sid:"-vfmdab"}}),updated:effector.sample({and:[{clock:M,filter:L.route.$isOpened}],or:{name:"updated",sid:"-2uhvx2"}}),closed:effector.sample({and:[{clock:N,filter:L.route.$isOpened}],or:{name:"closed",sid:"jc9588"}})};effector.sample({and:[{clock:_.updated,source:[L.route.$params,L.route.$query],filter:(e,r)=>{var a=e[1];return!s(e[0],r.params)||!s(a,r.query)},fn:(e,r)=>r,target:L.route.updated}],or:{sid:"-ny7ju5"}}),effector.sample({and:[{clock:_.opened,filter:l(C),target:L.route.opened}],or:{sid:"-ngm4ul"}}),effector.sample({and:[{clock:_.closed,target:L.route.closed}],or:{sid:"-d2q1d1"}})}for(var K,G=()=>{var e=K.value;effector.sample({and:[{clock:e.route.navigate.doneData,fn:r=>{var a=r.replace;return{route:e,params:r.params,query:r.query,replace:null!=a&&a}},target:q}],or:{sid:"-cm87k7"}})},J=n(O);!(K=J()).done;)G();C.on(q,(()=>!0)),effector.sample({and:[{clock:q,fn:e=>{var r=e.params,a=e.query,t=e.replace;return{path:i({pathCreator:e.route.path,params:r,query:a,serialize:u}),params:r,query:a,method:t?'replace':'push'}},target:D}],or:{sid:"-c2zeua"}}),C.reset([x,R]),effector.sample({and:[{clock:w,fn:e=>{for(var r,a=e.path,t=e.query,o=e.hash,s=[],i=[],d=n(O);!(r=d()).done;){var l=r.value,u=l.path.includes('#')?""+a+o:""+a,p=c({pathCreator:l.path,actualPath:u});(p.matches?s:i).push({routeObj:l,params:p.params,query:t})}return i.forEach(((e,r)=>{s.some((r=>r.routeObj.route===e.routeObj.route))&&i.splice(r,1)})),{matching:s,mismatching:i.filter(Boolean),path:a,query:t}},target:$}],or:{sid:"-ar5b7v"}}),P.on(Q,((e,r)=>r.path)),F.on(Q,((e,r)=>r.query));var V=$.map((e=>e.matching));return effector.sample({and:[{clock:V,filter:e=>e.length>0,target:x}],or:{sid:"1l4g7x"}}),effector.sample({and:[{clock:$.map((e=>e.mismatching)),filter:e=>e.length>0,target:R}],or:{sid:"1zyw8o"}}),z.on($,((e,r)=>r.matching.map((e=>e.routeObj.route)))),effector.sample({and:[{clock:V,filter:e=>0===e.length,target:E}],or:{sid:"2hkb88"}}),effector.withFactory({sid:"2kv2vu",fn:()=>v(o),name:"none",method:"isRoute"})&&(effector.sample({and:[{clock:E,source:F,filter:o.$isOpened,fn:e=>({query:e,params:{}}),target:o.updated}],or:{sid:"2levfh"}}),effector.sample({and:[{clock:E,source:{query:F,isOpened:o.$isOpened},filter:e=>!e.isOpened,fn:e=>({query:e.query,params:{}}),target:o.opened}],or:{sid:"31cwmy"}}),effector.sample({and:[{clock:V,source:o.$isOpened,filter:(e,r)=>e&&r.length>0,target:o.closed}],or:{sid:"3haxuf"}})),effector.sample({and:[{clock:m.back,source:U,target:y}],or:{sid:"3xsrlj"}}),effector.sample({and:[{clock:m.forward,source:U,target:g}],or:{sid:"413j5p"}}),effector.sample({and:[{clock:F,source:{controlsQuery:m.$query,localQuery:F},filter:e=>!s(e.controlsQuery,e.localQuery),fn:e=>e.localQuery,target:m.$query}],or:{sid:"4ghrrt"}}),effector.sample({and:[{clock:m.$query,source:{path:P,localQuery:F,isNavigateInProgress:C,realHistory:U},filter:(e,r)=>{var a,t,o,n=e.localQuery,i=e.isNavigateInProgress,c=e.realHistory,d=null!==(a=null==u?void 0:u.read(null!==(t=null==c?void 0:c.location.search)&&void 0!==t?t:''))&&void 0!==a?a:Object.fromEntries(new URLSearchParams(null!==(o=null==c?void 0:c.location.search)&&void 0!==o?o:''));return i||!s(r,d)||!s(n,r)},fn:(e,r)=>{var a,t=e.path,o=null!==(a=null==u?void 0:u.write(r))&&void 0!==a?a:new URLSearchParams(r);return{path:t+(o?"?"+o:''),params:{},query:r,method:'push'}},target:D}],or:{sid:"4wzlkn"}}),effector.sample({and:[{clock:$,source:{activeRoutes:z,path:P,query:F},filter:A.map((e=>!e)),target:S}],or:{sid:"gbpwte"}}),A.on(S,(()=>!0)).reset(U),{$path:P,$activeRoutes:z,$history:U,setHistory:k,$query:F,back:m.back,forward:m.forward,push:D,routes:O,initialized:S,routeNotFound:E}},exports.createRoute=e,exports.createRouterControls=f,exports.isRoute=v,exports.matchPath=c,exports.querySync=e=>{var r,t,o,s=null!==(r=null===(t=e.route)||void 0===t?void 0:t.$isOpened)&&void 0!==r?r:effector.createStore(!0,{name:"$isOpened",sid:"-ubx3p"}),i=effector.combine({and:[e.source],or:{name:"$source",sid:"-3rrhte"}}),c=null!==(o=e.clock)&&void 0!==o?o:i,d='cleanup'in e?'boolean'==typeof e.cleanup?O[e.cleanup?'all':'none']:a(a({},O.default),e.cleanup):O.default,l=effector.sample({and:[{clock:e.controls.$query,filter:s}],or:{name:"queryUpdatedFromHistory",sid:"8lf3wv"}});effector.sample({and:[{clock:c,source:effector.combine({and:[[i,e.controls.$query]],or:{name:"source",sid:"-3pgs50"}}),filter:s,fn:e=>{var r=e[0],t=e[1],o={};if(d.irrelevant)for(var s,i=n(d.preserve);!(s=i()).done;){var c=s.value;c in t&&(o[c]=t[c])}else o=a({},t);for(var l in r)o[l]=r[l];if(d.empty)for(var u in r)d.preserve.includes(u)||o[u]||delete o[u];return o},target:e.controls.$query}],or:{sid:"fuzb5g"}});var u=r=>{var a=e.source[r];a.on(l,((e,t)=>{var o;return null!==(o=t[r])&&void 0!==o?o:a.defaultState}))};for(var p in e.source)u(p)},exports.redirect=e=>{var r=e.clock?effector.sample({and:[{clock:e.clock}],or:{name:"clock",sid:"-ek44ri"}}):effector.createEvent({name:"clock",sid:"-ejkc65"}),a=u(e.params||{}),t=u(e.query||{}),o=u(e.replace||!1);return effector.sample({and:[{clock:r,source:{params:a,query:t,replace:o},fn:(e,r)=>{var a=e.params,t=e.query,o=e.replace;return{params:'function'==typeof a?a(r):a,query:'function'==typeof t?t(r):t,replace:'function'==typeof o?o(r):o}},target:e.route.navigate}],or:{sid:"ai8jf5"}}),r};
function e(e){void 0===e&&(e={});var r=effector.createEffect((e=>{var r=e.replace;return{params:e.params||{},query:e.query||{},replace:void 0!==r&&r}}),{name:"navigateFx",sid:"c2qlao"}),a=effector.attach({and:{effect:r,mapParams:e=>({params:e||{},query:{}})},or:{name:"openFx",sid:"am04as"}}),t=effector.createStore(!1,{name:"$isOpened",sid:"-8u29di"}),o=effector.createStore({},{name:"$params",sid:"6sxdf"}),n=effector.createStore({},{name:"$query",sid:"tylje5"}),s=effector.createEvent({name:"opened",sid:"fafqk0"}),i=effector.createEvent({name:"updated",sid:"66vs1s"}),c=effector.createEvent({name:"closed",sid:"-wbq1n3"});return t.on(s,(()=>!0)).on(c,(()=>!1)),o.on(s,((e,r)=>r.params)).on(i,((e,r)=>r.params)),n.on(s,((e,r)=>r.query)).on(i,((e,r)=>r.query)),effector.split({and:[{source:r.doneData,match:t.map((e=>e?'updated':'opened')),cases:{opened:s,updated:i}}],or:{sid:"3j56hf"}}),{$isOpened:t,$params:o,$query:n,opened:s,updated:i,closed:c,navigate:r,open:a,kind:m.ROUTE,settings:{derived:Boolean(e.filter)}}}function r(e,r){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(e);r&&(t=t.filter((r=>Object.getOwnPropertyDescriptor(e,r).enumerable))),a.push.apply(a,t)}return a}function a(e){for(var a=1;a<arguments.length;a++){var o=null!=arguments[a]?arguments[a]:{};a%2?r(Object(o),!0).forEach((r=>{t(e,r,o[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(o)):r(Object(o)).forEach((r=>{Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(o,r))}))}return e}function t(e,r,a){return r in e?Object.defineProperty(e,r,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[r]=a,e}function o(e,r){(null==r||r>e.length)&&(r=e.length);for(var a=0,t=new Array(r);a<r;a++)t[a]=e[a];return t}function n(e,r){var it="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(it)return(it=it.call(e)).next.bind(it);if(Array.isArray(e)||(it=((e,r)=>{if(e){if("string"==typeof e)return o(e,r);var a={}.toString.call(e).slice(8,-1);return"Object"===a&&e.constructor&&(a=e.constructor.name),"Map"===a||"Set"===a?Array.from(e):"Arguments"===a||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a)?o(e,r):void 0}})(e))||r&&e&&"number"==typeof e.length){it&&(e=it);var a=0;return()=>a>=e.length?{done:!0}:{done:!1,value:e[a++]}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function s(e,r){if(Object.keys(e).length!==Object.keys(r).length)return!1;for(var a in e)if(""+e[a]!=""+r[a])return!1;return!0}function i(e){var r,a=e.params,t=e.query,o=e.serialize,n=p.compile(e.pathCreator)(a),s=null!==(r=null==o?void 0:o.write(t))&&void 0!==r?r:new URLSearchParams(t);return n+(Object.keys(t).length?"?"+s:'')}function c(e){var r=e.actualPath,a=p.match(e.pathCreator.replace('://','\\://'))((e=>{if(e.match(/^[a-z0-9]+\:\/\//i))return e;var r=new URL("http://_"+e);return[r.pathname,r.hash].join('')})(r));return a?{matches:!0,params:a.params}:{matches:!1}}function d(e){if(!e)throw new Error('[Routing] No history provided')}function l(e){return e.map((e=>!e))}function u(e){return effector.is.store(e,{sid:"b0xjrg"})?e:effector.createStore(e,{sid:"-dcoehd"})}Object.defineProperty(exports,'__esModule',{value:!0});var effector=require('effector'),p=require('path-to-regexp'),m={ROUTE:Symbol()},f=()=>({$query:effector.createStore({},{and:{updateFilter:(e,r)=>!s(r,e)},name:"$query",sid:"z22f3o"}),back:effector.createEvent({name:"back",sid:"lqciue"}),forward:effector.createEvent({name:"forward",sid:"-5dfdts"})}),v=e=>'object'==typeof e&&null!==e&&'kind'in e&&e.kind===m.ROUTE,h=effector.createEffect((e=>(d(e.history),e.history[e.method](e.path,{}),e)),{name:"historyPushFx",sid:"-w0no5y"}),y=effector.createEffect((e=>(d(e),e.back(),e)),{name:"historyBackFx",sid:"-ny8vwp"}),g=effector.createEffect((e=>(d(e),e.forward(),e)),{name:"historyForwardFx",sid:"88oqi4"}),b=e=>r=>{var a=r.find((r=>r.routeObj.route===e.route));if(a)return{params:a.params,query:a.query}},O={all:{irrelevant:!0,empty:!0,preserve:[]},default:{irrelevant:!1,empty:!0,preserve:[]},none:{irrelevant:!1,empty:!1,preserve:[]}};exports.Kind=m,exports.buildPath=i,exports.chainRoute=r=>{var a=(r=>{var a={};if(effector.withFactory({sid:"-vu4zd1",fn:()=>v(r),name:"none",method:"isRoute"}))return Object.assign(a,{route:r,chainedRoute:effector.withFactory({sid:"-wmhz5t",fn:()=>e(),name:"chainedRoute",method:"createRoute"}),beforeOpen:effector.createEvent({name:"beforeOpen",sid:"cx9b28"}),openOn:effector.merge([r.opened,r.closed],{name:"openOn",sid:"-mssum5"}),cancelOn:effector.merge([effector.createEvent({name:"cancelOn",sid:"rne13o"})],{name:"cancelOn",sid:"rne0fk"})}),a;var t=r;if(Object.assign(a,{route:t.route,chainedRoute:t.chainedRoute||effector.withFactory({sid:"-hy3nad",fn:()=>e(),name:"chainedRoute",method:"createRoute"}),beforeOpen:effector.is.unit(t.beforeOpen)?t.beforeOpen:effector.attach({and:t.beforeOpen,or:{name:"beforeOpen",sid:"-xdaty7"}})}),effector.is.effect(a.beforeOpen,{sid:"-qy1t3m"}))return Object.assign(a,{openOn:t.openOn||a.beforeOpen.doneData,cancelOn:t.cancelOn||a.beforeOpen.failData}),a;var o=r;return Object.assign(a,{openOn:effector.sample({and:[{clock:o.openOn}],or:{name:"openOn",sid:"-8ll0dg"}}),cancelOn:effector.sample({and:[{clock:o.cancelOn||effector.createEvent({name:"clock",sid:"-4mp5og"})}],or:{name:"cancelOn",sid:"-lji6mv"}})}),a})(r),t=a.route,o=a.chainedRoute,n=a.beforeOpen,s=a.openOn,i=a.cancelOn,c=effector.createStore({},{name:"$params",sid:"ayygyi"}),d=effector.createStore({},{name:"$query",sid:"-uacyzw"}),l=effector.combine({and:[effector.combine({and:[[t.$params,t.$query]],or:{name:"and",sid:"3vqbxs"}}),effector.combine({and:[[c,d]],or:{name:"and",sid:"3wa4j5"}}),(e,r)=>e[0]===r[0]&&e[1]===r[1]],or:{name:"$hasSameParams",sid:"-nkydfl"}}),u=effector.sample({and:[{clock:[t.opened,t.updated]}],or:{name:"routeOpened",sid:"-gcvb85"}});effector.sample({and:[{clock:u,target:n}],or:{sid:"-nodu7s"}}),c.on(u,((e,r)=>r.params)),d.on(u,((e,r)=>r.query));var p=effector.guard({and:[{clock:s,source:{params:c,query:d},filter:l}],or:{name:"chainedRouteResolved",sid:"-mfd004"}});effector.sample({and:[{clock:p,target:o.navigate}],or:{sid:"-n68mmv"}});var m=effector.merge([t.closed,i],{name:"aborted",sid:"vaomxt"});return c.reset(m),d.reset(m),effector.sample({and:[{clock:m,target:o.closed}],or:{sid:"-mpqsu1"}}),o},exports.createHistoryRouter=e=>{var r=e.base,t=e.routes,o=e.notFoundRoute,d=e.hydrate,u=e.serialize,p=e.controls,m=void 0===p?effector.withFactory({sid:"d2qzob",fn:()=>f(),name:"controls",method:"createRouterControls"}):p,O=((e,r)=>{void 0===r&&(r='');for(var t,o=[],s=()=>{var e,r=t.value;Array.isArray(r.route)?(e=o).push.apply(e,r.route.map((e=>a(a({},r),{},{route:e})))):o.push(r)},i=n(e);!(t=i()).done;)s();o=o.map((e=>a(a({},e),{},{path:""+r+e.path})));for(var c,d=[],l=[],u=n(o);!(c=u()).done;){var p=c.value;p.route.settings.derived?d.push(p):l.push(p)}if(d.length)for(var m,f=n(d);!(m=f()).done;)console.error("createHistoryRouter: "+m.value.path+" uses derived route. This won't work");return l})(t,r),k=effector.createEvent({name:"setHistory",sid:"9zwyxu"}),q=effector.createEvent({name:"navigateFromRouteTriggered",sid:"soge6d"}),w=effector.createEvent({name:"historyUpdated",sid:"-x4474u"}),j=effector.createEvent({name:"recalculateTriggered",sid:"-ykrhlj"}),$=effector.createEvent({name:"recalculated",sid:"aeh4sf"}),R=effector.createEvent({name:"routesMatched",sid:"2rfqt6"}),x=effector.createEvent({name:"routesMismatched",sid:"71hypl"}),E=effector.createEvent({name:"routeNotFound",sid:"avqxzu"}),S=effector.createEvent({name:"initialized",sid:"du6f0f"}),P=effector.createStore('',{name:"$path",sid:"wz8cwv"}),F=effector.createStore({},{and:{name:'historyRouter.$query',updateFilter:(e,r)=>!s(e,r)},name:"$query",sid:"tkdilp"}),z=effector.createStore([],{and:{serialize:'ignore'},name:"$activeRoutes",sid:"9ljm7u"}),U=effector.createStore(null,{and:{serialize:'ignore'},name:"$history",sid:"g4i7nj"}),A=effector.createStore(!1,{name:"$isFirstCheckPassed",sid:"9r108x"}),C=effector.createStore(!1,{name:"$isRouteNavigateInProgress",sid:"a1vtrl"}),D=effector.attach({and:{source:U,effect:(e,r)=>h(a({history:e},r))},or:{name:"pushFx",sid:"qm76ov"}}),H=effector.attach({and:{source:U,effect:e=>{var r=w;try{r=effector.scopeBind(w)}catch(e){}return e.listen((()=>{r()})),!0}},or:{name:"subscribeHistoryFx",sid:"-b12mlt"}}),T=effector.sample({and:[{clock:d?[w]:[w,H.done],source:U,filter:Boolean,fn:e=>{var r;return{path:e.location.pathname,query:null!==(r=null==u?void 0:u.read(e.location.search))&&void 0!==r?r:Object.fromEntries(new URLSearchParams(e.location.search))}}}],or:{name:"historyUpdatedParsed",sid:"-rhkauu"}}),Q=effector.sample({and:[{clock:T,source:{path:P,query:F},filter:(e,r)=>r.path!==e.path||!s(r.query,e.query),fn:(e,r)=>r}],or:{name:"historyUpdateTriggered",sid:"-pbyg2j"}});U.on(k,((e,r)=>r)),effector.sample({and:[{clock:U,target:H}],or:{sid:"-pwl7u3"}}),effector.sample({and:[{clock:Q,source:U,filter:Boolean,fn:e=>{var r,a=null==e?void 0:e.location.hash;return{path:null==e?void 0:e.location.pathname,query:null!==(r=null==u?void 0:u.read(null==e?void 0:e.location.search))&&void 0!==r?r:Object.fromEntries(new URLSearchParams(null==e?void 0:e.location.search)),hash:a}},target:j}],or:{sid:"-ptu8va"}});for(var B,I=n(O);!(B=I()).done;){var L=B.value,M=R.filterMap(b(L)),N=x.filterMap(b(L)),_={opened:effector.sample({and:[{clock:M,filter:l(L.route.$isOpened)}],or:{name:"opened",sid:"-vfmdab"}}),updated:effector.sample({and:[{clock:M,filter:L.route.$isOpened}],or:{name:"updated",sid:"-2uhvx2"}}),closed:effector.sample({and:[{clock:N,filter:L.route.$isOpened}],or:{name:"closed",sid:"jc9588"}})};effector.sample({and:[{clock:_.updated,source:[L.route.$params,L.route.$query],filter:(e,r)=>{var a=e[1];return!s(e[0],r.params)||!s(a,r.query)},fn:(e,r)=>r,target:L.route.updated}],or:{sid:"-ny7ju5"}}),effector.sample({and:[{clock:_.opened,filter:l(C),target:L.route.opened}],or:{sid:"-ngm4ul"}}),effector.sample({and:[{clock:_.closed,target:L.route.closed}],or:{sid:"-d2q1d1"}})}for(var K,G=()=>{var e=K.value;effector.sample({and:[{clock:e.route.navigate.doneData,fn:r=>{var a=r.replace;return{route:e,params:r.params,query:r.query,replace:null!=a&&a}},target:q}],or:{sid:"-cm87k7"}})},J=n(O);!(K=J()).done;)G();C.on(q,(()=>!0)),effector.sample({and:[{clock:q,fn:e=>{var r=e.params,a=e.query,t=e.replace;return{path:i({pathCreator:e.route.path,params:r,query:a,serialize:u}),params:r,query:a,method:t?'replace':'push'}},target:D}],or:{sid:"-c2zeua"}}),C.reset([R,x]),effector.sample({and:[{clock:j,fn:e=>{for(var r,a=e.path,t=e.query,o=e.hash,s=[],i=[],d=n(O);!(r=d()).done;){var l=r.value,u=l.path.includes('#')?""+a+o:""+a,p=c({pathCreator:l.path,actualPath:u});(p.matches?s:i).push({routeObj:l,params:p.params,query:t})}return i.forEach(((e,r)=>{s.some((r=>r.routeObj.route===e.routeObj.route))&&i.splice(r,1)})),{matching:s,mismatching:i.filter(Boolean),path:a,query:t}},target:$}],or:{sid:"-ar5b7v"}}),P.on(Q,((e,r)=>r.path)),F.on(Q,((e,r)=>r.query));var V=$.map((e=>e.matching));return effector.sample({and:[{clock:V,filter:e=>e.length>0,target:R}],or:{sid:"1l4g7x"}}),effector.sample({and:[{clock:$.map((e=>e.mismatching)),filter:e=>e.length>0,target:x}],or:{sid:"1zyw8o"}}),z.on($,((e,r)=>r.matching.map((e=>e.routeObj.route)))),effector.sample({and:[{clock:V,filter:e=>0===e.length,target:E}],or:{sid:"2hkb88"}}),effector.withFactory({sid:"2kv2vu",fn:()=>v(o),name:"none",method:"isRoute"})&&(effector.sample({and:[{clock:E,source:F,filter:o.$isOpened,fn:e=>({query:e,params:{}}),target:o.updated}],or:{sid:"2levfh"}}),effector.sample({and:[{clock:E,source:{query:F,isOpened:o.$isOpened},filter:e=>!e.isOpened,fn:e=>({query:e.query,params:{}}),target:o.opened}],or:{sid:"31cwmy"}}),effector.sample({and:[{clock:V,source:o.$isOpened,filter:(e,r)=>e&&r.length>0,target:o.closed}],or:{sid:"3haxuf"}})),effector.sample({and:[{clock:m.back,source:U,target:y}],or:{sid:"3xsrlj"}}),effector.sample({and:[{clock:m.forward,source:U,target:g}],or:{sid:"413j5p"}}),effector.sample({and:[{clock:F,source:{controlsQuery:m.$query,localQuery:F},filter:e=>!s(e.controlsQuery,e.localQuery),fn:e=>e.localQuery,target:m.$query}],or:{sid:"4ghrrt"}}),effector.sample({and:[{clock:m.$query,source:{path:P,localQuery:F,isNavigateInProgress:C,realHistory:U},filter:(e,r)=>{var a,t,o,n=e.localQuery,i=e.isNavigateInProgress,c=e.realHistory,d=null!==(a=null==u?void 0:u.read(null!==(t=null==c?void 0:c.location.search)&&void 0!==t?t:''))&&void 0!==a?a:Object.fromEntries(new URLSearchParams(null!==(o=null==c?void 0:c.location.search)&&void 0!==o?o:''));return i||!s(r,d)||!s(n,r)},fn:(e,r)=>{var a,t=e.path,o=null!==(a=null==u?void 0:u.write(r))&&void 0!==a?a:new URLSearchParams(r);return{path:t+(o?"?"+o:''),params:{},query:r,method:'push'}},target:D}],or:{sid:"4wzlkn"}}),effector.sample({and:[{clock:$,source:{activeRoutes:z,path:P,query:F},filter:A.map((e=>!e)),target:S}],or:{sid:"gbpwte"}}),A.on(S,(()=>!0)).reset(U),{$path:P,$activeRoutes:z,$history:U,setHistory:k,$query:F,back:m.back,forward:m.forward,push:D,routes:O,initialized:S,routeNotFound:E}},exports.createRoute=e,exports.createRouterControls=f,exports.isRoute=v,exports.matchPath=c,exports.querySync=e=>{var r,t,o,s=null!==(r=null===(t=e.route)||void 0===t?void 0:t.$isOpened)&&void 0!==r?r:effector.createStore(!0,{name:"$isOpened",sid:"-ubx3p"}),i=effector.combine({and:[e.source],or:{name:"$source",sid:"-3rrhte"}}),c=null!==(o=e.clock)&&void 0!==o?o:i,d='cleanup'in e?'boolean'==typeof e.cleanup?O[e.cleanup?'all':'none']:a(a({},O.default),e.cleanup):O.default,l=effector.sample({and:[{clock:e.controls.$query,filter:s}],or:{name:"queryUpdatedFromHistory",sid:"8lf3wv"}});effector.sample({and:[{clock:c,source:effector.combine({and:[[i,e.controls.$query]],or:{name:"source",sid:"-3pgs50"}}),filter:s,fn:e=>{var r=e[0],t=e[1],o={};if(d.irrelevant)for(var s,i=n(d.preserve);!(s=i()).done;){var c=s.value;c in t&&(o[c]=t[c])}else o=a({},t);for(var l in r)o[l]=r[l];if(d.empty)for(var u in r)d.preserve.includes(u)||o[u]||delete o[u];return o},target:e.controls.$query}],or:{sid:"fuzb5g"}});var u=r=>{var a=e.source[r];a.on(l,((e,t)=>{var o;return null!==(o=t[r])&&void 0!==o?o:a.defaultState}))};for(var p in e.source)u(p)},exports.redirect=e=>{var r=e.clock?effector.sample({and:[{clock:e.clock}],or:{name:"clock",sid:"-ek44ri"}}):effector.createEvent({name:"clock",sid:"-ejkc65"}),a=u(e.params||{}),t=u(e.query||{}),o=u(e.replace||!1);return effector.sample({and:[{clock:r,source:{params:a,query:t,replace:o},fn:(e,r)=>{var a=e.params,t=e.query,o=e.replace;return{params:'function'==typeof a?a(r):a,query:'function'==typeof t?t(r):t,replace:'function'==typeof o?o(r):o}},target:e.route.navigate}],or:{sid:"ahoqts"}}),r};
//# sourceMappingURL=atomic-router.cjs.js.map
import * as effector from 'effector';
import { Store, Event, Effect, Clock, NoInfer, EffectParams } from 'effector';
import { Store, EventCallable, Effect, Event, Clock, NoInfer, EffectParams } from 'effector';
import { History } from 'history';

@@ -18,5 +18,5 @@

$query: Store<RouteQuery>;
opened: Event<RouteParamsAndQuery<Params>>;
updated: Event<RouteParamsAndQuery<Params>>;
closed: Event<void>;
opened: EventCallable<RouteParamsAndQuery<Params>>;
updated: EventCallable<RouteParamsAndQuery<Params>>;
closed: EventCallable<void>;
navigate: Effect<NavigateParams<Params>, NavigateParams<Params>>;

@@ -60,5 +60,5 @@ open: Effect<Params extends EmptyObject ? void : Params, RouteParamsAndQuery<Params>>;

declare const createRouterControls: () => {
$query: effector.Store<RouteQuery>;
back: effector.Event<void>;
forward: effector.Event<void>;
$query: effector.StoreWritable<RouteQuery>;
back: effector.EventCallable<void>;
forward: effector.EventCallable<void>;
};

@@ -74,12 +74,12 @@

}): {
$path: effector.Store<string>;
$activeRoutes: effector.Store<RouteInstance<any>[]>;
$history: effector.Store<History>;
setHistory: effector.Event<History>;
$query: effector.Store<RouteQuery>;
back: effector.Event<void>;
forward: effector.Event<void>;
$path: effector.StoreWritable<string>;
$activeRoutes: effector.StoreWritable<RouteInstance<any>[]>;
$history: effector.StoreWritable<History>;
setHistory: effector.EventCallable<History>;
$query: effector.StoreWritable<RouteQuery>;
back: effector.EventCallable<void>;
forward: effector.EventCallable<void>;
push: effector.Effect<Omit<HistoryPushParams, "history">, HistoryPushParams, Error>;
routes: RouteObject<any>[];
initialized: effector.Event<{
initialized: effector.EventCallable<{
activeRoutes: RouteInstance<any>[];

@@ -89,3 +89,3 @@ path: string;

}>;
routeNotFound: effector.Event<void>;
routeNotFound: effector.EventCallable<void>;
};

@@ -92,0 +92,0 @@

@@ -1,2 +0,2 @@

function e(e){void 0===e&&(e={});var r=v((e=>{var r=e.replace;return{params:e.params||{},query:e.query||{},replace:void 0!==r&&r}}),{name:"navigateFx",sid:"c2qlao"}),a=y({and:{effect:r,mapParams:e=>({params:e||{},query:{}})},or:{name:"openFx",sid:"am04as"}}),n=g(!1,{name:"$isOpened",sid:"-8u29di"}),t=g({},{name:"$params",sid:"6sxdf"}),o=g({},{name:"$query",sid:"tylje5"}),i=b({name:"opened",sid:"fafqk0"}),s=b({name:"updated",sid:"66vs1s"}),d=b({name:"closed",sid:"-wbq1n3"});return n.on(i,(()=>!0)).on(d,(()=>!1)),t.on(i,((e,r)=>r.params)).on(s,((e,r)=>r.params)),o.on(i,((e,r)=>r.query)).on(s,((e,r)=>r.query)),O({and:[{source:r.doneData,match:n.map((e=>e?'updated':'opened')),cases:{opened:i,updated:s}}],or:{sid:"3j56hf"}}),{$isOpened:n,$params:t,$query:o,opened:i,updated:s,closed:d,navigate:r,open:a,kind:F.ROUTE,settings:{derived:Boolean(e.filter)}}}function r(e,r){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r&&(n=n.filter((r=>Object.getOwnPropertyDescriptor(e,r).enumerable))),a.push.apply(a,n)}return a}function a(e){for(var a=1;a<arguments.length;a++){var t=null!=arguments[a]?arguments[a]:{};a%2?r(Object(t),!0).forEach((r=>{n(e,r,t[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):r(Object(t)).forEach((r=>{Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}))}return e}function n(e,r,a){return r in e?Object.defineProperty(e,r,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[r]=a,e}function t(e,r){(null==r||r>e.length)&&(r=e.length);for(var a=0,n=new Array(r);a<r;a++)n[a]=e[a];return n}function o(e,r){var it="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(it)return(it=it.call(e)).next.bind(it);if(Array.isArray(e)||(it=((e,r)=>{if(e){if("string"==typeof e)return t(e,r);var a={}.toString.call(e).slice(8,-1);return"Object"===a&&e.constructor&&(a=e.constructor.name),"Map"===a||"Set"===a?Array.from(e):"Arguments"===a||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a)?t(e,r):void 0}})(e))||r&&e&&"number"==typeof e.length){it&&(e=it);var a=0;return()=>a>=e.length?{done:!0}:{done:!1,value:e[a++]}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function i(e,r){if(Object.keys(e).length!==Object.keys(r).length)return!1;for(var a in e)if(""+e[a]!=""+r[a])return!1;return!0}function s(e){var r,a=e.params,n=e.query,t=e.serialize,o=P(e.pathCreator)(a),i=null!==(r=null==t?void 0:t.write(n))&&void 0!==r?r:new URLSearchParams(n);return o+(Object.keys(n).length?"?"+i:'')}function d(e){var r=e.actualPath,a=z(e.pathCreator.replace('://','\\://'))((e=>{if(e.match(/^[a-z0-9]+\:\/\//i))return e;var r=new URL("http://_"+e);return[r.pathname,r.hash].join('')})(r));return a?{matches:!0,params:a.params}:{matches:!1}}function u(e){if(!e)throw new Error('[Routing] No history provided')}function c(e){return e.map((e=>!e))}function l(e){var r=e.base,n=e.routes,t=e.notFoundRoute,u=e.hydrate,l=e.serialize,p=e.controls,m=void 0===p?k({sid:"d2qzob",fn:()=>S(),name:"controls",method:"createRouterControls"}):p,f=((e,r)=>{void 0===r&&(r='');for(var n,t=[],i=()=>{var e,r=n.value;Array.isArray(r.route)?(e=t).push.apply(e,r.route.map((e=>a(a({},r),{},{route:e})))):t.push(r)},s=o(e);!(n=s()).done;)i();t=t.map((e=>a(a({},e),{},{path:""+r+e.path})));for(var d,u=[],c=[],l=o(t);!(d=l()).done;){var p=d.value;p.route.settings.derived?u.push(p):c.push(p)}if(u.length)for(var m,f=o(u);!(m=f()).done;)console.error("createHistoryRouter: "+m.value.path+" uses derived route. This won't work");return c})(n,r),h=b({name:"setHistory",sid:"9zwyxu"}),v=b({name:"navigateFromRouteTriggered",sid:"soge6d"}),O=b({name:"historyUpdated",sid:"-x4474u"}),w=b({name:"recalculateTriggered",sid:"-ykrhlj"}),$=b({name:"recalculated",sid:"aeh4sf"}),R=b({name:"routesMatched",sid:"2rfqt6"}),x=b({name:"routesMismatched",sid:"71hypl"}),P=b({name:"routeNotFound",sid:"avqxzu"}),z=b({name:"initialized",sid:"du6f0f"}),F=g('',{name:"$path",sid:"wz8cwv"}),C=g({},{and:{name:'historyRouter.$query',updateFilter:(e,r)=>!i(e,r)},name:"$query",sid:"tkdilp"}),H=g([],{and:{serialize:'ignore'},name:"$activeRoutes",sid:"9ljm7u"}),Q=g(null,{and:{serialize:'ignore'},name:"$history",sid:"g4i7nj"}),I=g(!1,{name:"$isFirstCheckPassed",sid:"9r108x"}),L=g(!1,{name:"$isRouteNavigateInProgress",sid:"a1vtrl"}),N=y({and:{source:Q,effect:(e,r)=>E(a({history:e},r))},or:{name:"pushFx",sid:"qm76ov"}}),B=y({and:{source:Q,effect:e=>{var r=O;try{r=q(O)}catch(e){}return e.listen((()=>{r()})),!0}},or:{name:"subscribeHistoryFx",sid:"-b12mlt"}}),M=j({and:[{clock:u?[O]:[O,B.done],source:Q,filter:Boolean,fn:e=>{var r;return{path:e.location.pathname,query:null!==(r=null==l?void 0:l.read(e.location.search))&&void 0!==r?r:Object.fromEntries(new URLSearchParams(e.location.search))}}}],or:{name:"historyUpdatedParsed",sid:"-rhkauu"}}),_=j({and:[{clock:M,source:{path:F,query:C},filter:(e,r)=>r.path!==e.path||!i(r.query,e.query),fn:(e,r)=>r}],or:{name:"historyUpdateTriggered",sid:"-pbyg2j"}});Q.on(h,((e,r)=>r)),j({and:[{clock:Q,target:B}],or:{sid:"-pwl7u3"}}),j({and:[{clock:_,source:Q,filter:Boolean,fn:e=>{var r,a=null==e?void 0:e.location.hash;return{path:null==e?void 0:e.location.pathname,query:null!==(r=null==l?void 0:l.read(null==e?void 0:e.location.search))&&void 0!==r?r:Object.fromEntries(new URLSearchParams(null==e?void 0:e.location.search)),hash:a}},target:w}],or:{sid:"-ptu8va"}});for(var G,J=o(f);!(G=J()).done;){var K=G.value,V=R.filterMap(T(K)),W=x.filterMap(T(K)),X={opened:j({and:[{clock:V,filter:c(K.route.$isOpened)}],or:{name:"opened",sid:"-vfmdab"}}),updated:j({and:[{clock:V,filter:K.route.$isOpened}],or:{name:"updated",sid:"-2uhvx2"}}),closed:j({and:[{clock:W,filter:K.route.$isOpened}],or:{name:"closed",sid:"jc9588"}})};j({and:[{clock:X.updated,source:[K.route.$params,K.route.$query],filter:(e,r)=>{var a=e[1];return!i(e[0],r.params)||!i(a,r.query)},fn:(e,r)=>r,target:K.route.updated}],or:{sid:"-ny7ju5"}}),j({and:[{clock:X.opened,filter:c(L),target:K.route.opened}],or:{sid:"-ngm4ul"}}),j({and:[{clock:X.closed,target:K.route.closed}],or:{sid:"-d2q1d1"}})}for(var Y,Z=()=>{var e=Y.value;j({and:[{clock:e.route.navigate.doneData,fn:r=>{var a=r.replace;return{route:e,params:r.params,query:r.query,replace:null!=a&&a}},target:v}],or:{sid:"-cm87k7"}})},ee=o(f);!(Y=ee()).done;)Z();L.on(v,(()=>!0)),j({and:[{clock:v,fn:e=>{var r=e.params,a=e.query,n=e.replace;return{path:s({pathCreator:e.route.path,params:r,query:a,serialize:l}),params:r,query:a,method:n?'replace':'push'}},target:N}],or:{sid:"-c2zeua"}}),L.reset([R,x]),j({and:[{clock:w,fn:e=>{for(var r,a=e.path,n=e.query,t=e.hash,i=[],s=[],u=o(f);!(r=u()).done;){var c=r.value,l=c.path.includes('#')?""+a+t:""+a,p=d({pathCreator:c.path,actualPath:l});(p.matches?i:s).push({routeObj:c,params:p.params,query:n})}return s.forEach(((e,r)=>{i.some((r=>r.routeObj.route===e.routeObj.route))&&s.splice(r,1)})),{matching:i,mismatching:s.filter(Boolean),path:a,query:n}},target:$}],or:{sid:"-ar5b7v"}}),F.on(_,((e,r)=>r.path)),C.on(_,((e,r)=>r.query));var re=$.map((e=>e.matching));return j({and:[{clock:re,filter:e=>e.length>0,target:R}],or:{sid:"1l4g7x"}}),j({and:[{clock:$.map((e=>e.mismatching)),filter:e=>e.length>0,target:x}],or:{sid:"1zyw8o"}}),H.on($,((e,r)=>r.matching.map((e=>e.routeObj.route)))),j({and:[{clock:re,filter:e=>0===e.length,target:P}],or:{sid:"2hkb88"}}),k({sid:"2kv2vu",fn:()=>U(t),name:"none",method:"isRoute"})&&(j({and:[{clock:P,source:C,filter:t.$isOpened,fn:e=>({query:e,params:{}}),target:t.updated}],or:{sid:"2levfh"}}),j({and:[{clock:P,source:{query:C,isOpened:t.$isOpened},filter:e=>!e.isOpened,fn:e=>({query:e.query,params:{}}),target:t.opened}],or:{sid:"31cwmy"}}),j({and:[{clock:re,source:t.$isOpened,filter:(e,r)=>e&&r.length>0,target:t.closed}],or:{sid:"3haxuf"}})),j({and:[{clock:m.back,source:Q,target:A}],or:{sid:"3xsrlj"}}),j({and:[{clock:m.forward,source:Q,target:D}],or:{sid:"413j5p"}}),j({and:[{clock:C,source:{controlsQuery:m.$query,localQuery:C},filter:e=>!i(e.controlsQuery,e.localQuery),fn:e=>e.localQuery,target:m.$query}],or:{sid:"4ghrrt"}}),j({and:[{clock:m.$query,source:{path:F,localQuery:C,isNavigateInProgress:L,realHistory:Q},filter:(e,r)=>{var a,n,t,o=e.localQuery,s=e.isNavigateInProgress,d=e.realHistory,u=null!==(a=null==l?void 0:l.read(null!==(n=null==d?void 0:d.location.search)&&void 0!==n?n:''))&&void 0!==a?a:Object.fromEntries(new URLSearchParams(null!==(t=null==d?void 0:d.location.search)&&void 0!==t?t:''));return s||!i(r,u)||!i(o,r)},fn:(e,r)=>{var a,n=e.path,t=null!==(a=null==l?void 0:l.write(r))&&void 0!==a?a:new URLSearchParams(r);return{path:n+(t?"?"+t:''),params:{},query:r,method:'push'}},target:N}],or:{sid:"4wzlkn"}}),j({and:[{clock:$,source:{activeRoutes:H,path:F,query:C},filter:I.map((e=>!e)),target:z}],or:{sid:"gbpwte"}}),I.on(z,(()=>!0)).reset(Q),{$path:F,$activeRoutes:H,$history:Q,setHistory:h,$query:C,back:m.back,forward:m.forward,push:N,routes:f,initialized:z,routeNotFound:P}}function p(e){var r=e.clock?j({and:[{clock:e.clock}],or:{name:"clock",sid:"-ek44ri"}}):b({name:"clock",sid:"-ejkc65"}),a=m(e.params||{}),n=m(e.query||{}),t=m(e.replace||!1);return j({and:[{clock:r,source:{params:a,query:n,replace:t},fn:(e,r)=>{var a=e.params,n=e.query,t=e.replace;return{params:'function'==typeof a?a(r):a,query:'function'==typeof n?n(r):n,replace:'function'==typeof t?t(r):t}},target:e.route.navigate}],or:{sid:"ai8jf5"}}),r}function m(e){return w.store(e,{sid:"b1hcct"})?e:g(e,{sid:"-cvms36"})}function f(r){var a=(r=>{var a={};if(k({sid:"-vuorye",fn:()=>U(r),name:"none",method:"isRoute"}))return Object.assign(a,{route:r,chainedRoute:k({sid:"-x3jlk0",fn:()=>e(),name:"chainedRoute",method:"createRoute"}),beforeOpen:b({name:"beforeOpen",sid:"2i9mdy"}),openOn:x([r.opened,r.closed],{name:"openOn",sid:"-n9uh0c"}),cancelOn:x([b({name:"cancelOn",sid:"r6ceph"})],{name:"cancelOn",sid:"r6ce1d"})}),a;var n=r;if(Object.assign(a,{route:n.route,chainedRoute:n.chainedRoute||k({sid:"-if59ok",fn:()=>e(),name:"chainedRoute",method:"createRoute"}),beforeOpen:w.unit(n.beforeOpen)?n.beforeOpen:y({and:n.beforeOpen,or:{name:"beforeOpen",sid:"-xdumjk"}})}),w.effect(a.beforeOpen,{sid:"-qylloz"}))return Object.assign(a,{openOn:n.openOn||a.beforeOpen.doneData,cancelOn:n.cancelOn||a.beforeOpen.failData}),a;var t=r;return Object.assign(a,{openOn:j({and:[{clock:t.openOn}],or:{name:"openOn",sid:"-92mmrn"}}),cancelOn:j({and:[{clock:t.cancelOn||b({name:"clock",sid:"-53qs2n"})}],or:{name:"cancelOn",sid:"-m0jt12"}})}),a})(r),n=a.route,t=a.chainedRoute,o=a.beforeOpen,i=a.openOn,s=a.cancelOn,d=g({},{name:"$params",sid:"ahwukb"}),u=g({},{name:"$query",sid:"-urele3"}),c=$({and:[$({and:[[n.$params,n.$query]],or:{name:"and",sid:"3v6jcf"}}),$({and:[[d,u]],or:{name:"and",sid:"3vqbxs"}}),(e,r)=>e[0]===r[0]&&e[1]===r[1]],or:{name:"$hasSameParams",sid:"-xzy23v"}}),l=j({and:[{clock:[n.opened,n.updated]}],or:{name:"routeOpened",sid:"-gtwxmc"}});j({and:[{clock:l,target:o}],or:{sid:"-noxmt5"}}),d.on(l,((e,r)=>r.params)),u.on(l,((e,r)=>r.query));var p=R({and:[{clock:i,source:{params:d,query:u},filter:c}],or:{name:"chainedRouteResolved",sid:"-mwemeb"}});j({and:[{clock:p,target:t.navigate}],or:{sid:"-n6sf88"}});var m=x([n.closed,s],{name:"aborted",sid:"utn0jm"});return d.reset(m),u.reset(m),j({and:[{clock:m,target:t.closed}],or:{sid:"-mqalfe"}}),t}function h(e){var r,n,t,i=null!==(r=null===(n=e.route)||void 0===n?void 0:n.$isOpened)&&void 0!==r?r:g(!0,{name:"$isOpened",sid:"-ubx3p"}),s=$({and:[e.source],or:{name:"$source",sid:"-3rrhte"}}),d=null!==(t=e.clock)&&void 0!==t?t:s,u='cleanup'in e?'boolean'==typeof e.cleanup?C[e.cleanup?'all':'none']:a(a({},C.default),e.cleanup):C.default,c=j({and:[{clock:e.controls.$query,filter:i}],or:{name:"queryUpdatedFromHistory",sid:"8lf3wv"}});j({and:[{clock:d,source:$({and:[[s,e.controls.$query]],or:{name:"source",sid:"-3pgs50"}}),filter:i,fn:e=>{var r=e[0],n=e[1],t={};if(u.irrelevant)for(var i,s=o(u.preserve);!(i=s()).done;){var d=i.value;d in n&&(t[d]=n[d])}else t=a({},n);for(var c in r)t[c]=r[c];if(u.empty)for(var l in r)u.preserve.includes(l)||t[l]||delete t[l];return t},target:e.controls.$query}],or:{sid:"fuzb5g"}});var l=r=>{var a=e.source[r];a.on(c,((e,n)=>{var t;return null!==(t=n[r])&&void 0!==t?t:a.defaultState}))};for(var p in e.source)l(p)}import{createEffect as v,attach as y,createStore as g,createEvent as b,split as O,withFactory as k,scopeBind as q,sample as j,is as w,combine as $,guard as R,merge as x}from'effector';import{compile as P,match as z}from'path-to-regexp';var F={ROUTE:Symbol()},S=()=>({$query:g({},{and:{updateFilter:(e,r)=>!i(r,e)},name:"$query",sid:"z22f3o"}),back:b({name:"back",sid:"lqciue"}),forward:b({name:"forward",sid:"-5dfdts"})}),U=e=>'object'==typeof e&&null!==e&&'kind'in e&&e.kind===F.ROUTE,E=v((e=>(u(e.history),e.history[e.method](e.path,{}),e)),{name:"historyPushFx",sid:"-w0no5y"}),A=v((e=>(u(e),e.back(),e)),{name:"historyBackFx",sid:"-ny8vwp"}),D=v((e=>(u(e),e.forward(),e)),{name:"historyForwardFx",sid:"88oqi4"}),T=e=>r=>{var a=r.find((r=>r.routeObj.route===e.route));if(a)return{params:a.params,query:a.query}},C={all:{irrelevant:!0,empty:!0,preserve:[]},default:{irrelevant:!1,empty:!0,preserve:[]},none:{irrelevant:!1,empty:!1,preserve:[]}};export{F as Kind,s as buildPath,f as chainRoute,l as createHistoryRouter,e as createRoute,S as createRouterControls,U as isRoute,d as matchPath,h as querySync,p as redirect};
function e(e){void 0===e&&(e={});var r=v((e=>{var r=e.replace;return{params:e.params||{},query:e.query||{},replace:void 0!==r&&r}}),{name:"navigateFx",sid:"c2qlao"}),a=y({and:{effect:r,mapParams:e=>({params:e||{},query:{}})},or:{name:"openFx",sid:"am04as"}}),n=g(!1,{name:"$isOpened",sid:"-8u29di"}),t=g({},{name:"$params",sid:"6sxdf"}),o=g({},{name:"$query",sid:"tylje5"}),i=b({name:"opened",sid:"fafqk0"}),s=b({name:"updated",sid:"66vs1s"}),d=b({name:"closed",sid:"-wbq1n3"});return n.on(i,(()=>!0)).on(d,(()=>!1)),t.on(i,((e,r)=>r.params)).on(s,((e,r)=>r.params)),o.on(i,((e,r)=>r.query)).on(s,((e,r)=>r.query)),O({and:[{source:r.doneData,match:n.map((e=>e?'updated':'opened')),cases:{opened:i,updated:s}}],or:{sid:"3j56hf"}}),{$isOpened:n,$params:t,$query:o,opened:i,updated:s,closed:d,navigate:r,open:a,kind:F.ROUTE,settings:{derived:Boolean(e.filter)}}}function r(e,r){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r&&(n=n.filter((r=>Object.getOwnPropertyDescriptor(e,r).enumerable))),a.push.apply(a,n)}return a}function a(e){for(var a=1;a<arguments.length;a++){var t=null!=arguments[a]?arguments[a]:{};a%2?r(Object(t),!0).forEach((r=>{n(e,r,t[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):r(Object(t)).forEach((r=>{Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}))}return e}function n(e,r,a){return r in e?Object.defineProperty(e,r,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[r]=a,e}function t(e,r){(null==r||r>e.length)&&(r=e.length);for(var a=0,n=new Array(r);a<r;a++)n[a]=e[a];return n}function o(e,r){var it="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(it)return(it=it.call(e)).next.bind(it);if(Array.isArray(e)||(it=((e,r)=>{if(e){if("string"==typeof e)return t(e,r);var a={}.toString.call(e).slice(8,-1);return"Object"===a&&e.constructor&&(a=e.constructor.name),"Map"===a||"Set"===a?Array.from(e):"Arguments"===a||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a)?t(e,r):void 0}})(e))||r&&e&&"number"==typeof e.length){it&&(e=it);var a=0;return()=>a>=e.length?{done:!0}:{done:!1,value:e[a++]}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function i(e,r){if(Object.keys(e).length!==Object.keys(r).length)return!1;for(var a in e)if(""+e[a]!=""+r[a])return!1;return!0}function s(e){var r,a=e.params,n=e.query,t=e.serialize,o=P(e.pathCreator)(a),i=null!==(r=null==t?void 0:t.write(n))&&void 0!==r?r:new URLSearchParams(n);return o+(Object.keys(n).length?"?"+i:'')}function d(e){var r=e.actualPath,a=z(e.pathCreator.replace('://','\\://'))((e=>{if(e.match(/^[a-z0-9]+\:\/\//i))return e;var r=new URL("http://_"+e);return[r.pathname,r.hash].join('')})(r));return a?{matches:!0,params:a.params}:{matches:!1}}function u(e){if(!e)throw new Error('[Routing] No history provided')}function c(e){return e.map((e=>!e))}function l(e){var r=e.base,n=e.routes,t=e.notFoundRoute,u=e.hydrate,l=e.serialize,p=e.controls,m=void 0===p?k({sid:"d2qzob",fn:()=>S(),name:"controls",method:"createRouterControls"}):p,f=((e,r)=>{void 0===r&&(r='');for(var n,t=[],i=()=>{var e,r=n.value;Array.isArray(r.route)?(e=t).push.apply(e,r.route.map((e=>a(a({},r),{},{route:e})))):t.push(r)},s=o(e);!(n=s()).done;)i();t=t.map((e=>a(a({},e),{},{path:""+r+e.path})));for(var d,u=[],c=[],l=o(t);!(d=l()).done;){var p=d.value;p.route.settings.derived?u.push(p):c.push(p)}if(u.length)for(var m,f=o(u);!(m=f()).done;)console.error("createHistoryRouter: "+m.value.path+" uses derived route. This won't work");return c})(n,r),h=b({name:"setHistory",sid:"9zwyxu"}),v=b({name:"navigateFromRouteTriggered",sid:"soge6d"}),O=b({name:"historyUpdated",sid:"-x4474u"}),w=b({name:"recalculateTriggered",sid:"-ykrhlj"}),$=b({name:"recalculated",sid:"aeh4sf"}),R=b({name:"routesMatched",sid:"2rfqt6"}),x=b({name:"routesMismatched",sid:"71hypl"}),P=b({name:"routeNotFound",sid:"avqxzu"}),z=b({name:"initialized",sid:"du6f0f"}),F=g('',{name:"$path",sid:"wz8cwv"}),C=g({},{and:{name:'historyRouter.$query',updateFilter:(e,r)=>!i(e,r)},name:"$query",sid:"tkdilp"}),H=g([],{and:{serialize:'ignore'},name:"$activeRoutes",sid:"9ljm7u"}),Q=g(null,{and:{serialize:'ignore'},name:"$history",sid:"g4i7nj"}),I=g(!1,{name:"$isFirstCheckPassed",sid:"9r108x"}),L=g(!1,{name:"$isRouteNavigateInProgress",sid:"a1vtrl"}),N=y({and:{source:Q,effect:(e,r)=>E(a({history:e},r))},or:{name:"pushFx",sid:"qm76ov"}}),B=y({and:{source:Q,effect:e=>{var r=O;try{r=q(O)}catch(e){}return e.listen((()=>{r()})),!0}},or:{name:"subscribeHistoryFx",sid:"-b12mlt"}}),M=j({and:[{clock:u?[O]:[O,B.done],source:Q,filter:Boolean,fn:e=>{var r;return{path:e.location.pathname,query:null!==(r=null==l?void 0:l.read(e.location.search))&&void 0!==r?r:Object.fromEntries(new URLSearchParams(e.location.search))}}}],or:{name:"historyUpdatedParsed",sid:"-rhkauu"}}),_=j({and:[{clock:M,source:{path:F,query:C},filter:(e,r)=>r.path!==e.path||!i(r.query,e.query),fn:(e,r)=>r}],or:{name:"historyUpdateTriggered",sid:"-pbyg2j"}});Q.on(h,((e,r)=>r)),j({and:[{clock:Q,target:B}],or:{sid:"-pwl7u3"}}),j({and:[{clock:_,source:Q,filter:Boolean,fn:e=>{var r,a=null==e?void 0:e.location.hash;return{path:null==e?void 0:e.location.pathname,query:null!==(r=null==l?void 0:l.read(null==e?void 0:e.location.search))&&void 0!==r?r:Object.fromEntries(new URLSearchParams(null==e?void 0:e.location.search)),hash:a}},target:w}],or:{sid:"-ptu8va"}});for(var G,J=o(f);!(G=J()).done;){var K=G.value,V=R.filterMap(T(K)),W=x.filterMap(T(K)),X={opened:j({and:[{clock:V,filter:c(K.route.$isOpened)}],or:{name:"opened",sid:"-vfmdab"}}),updated:j({and:[{clock:V,filter:K.route.$isOpened}],or:{name:"updated",sid:"-2uhvx2"}}),closed:j({and:[{clock:W,filter:K.route.$isOpened}],or:{name:"closed",sid:"jc9588"}})};j({and:[{clock:X.updated,source:[K.route.$params,K.route.$query],filter:(e,r)=>{var a=e[1];return!i(e[0],r.params)||!i(a,r.query)},fn:(e,r)=>r,target:K.route.updated}],or:{sid:"-ny7ju5"}}),j({and:[{clock:X.opened,filter:c(L),target:K.route.opened}],or:{sid:"-ngm4ul"}}),j({and:[{clock:X.closed,target:K.route.closed}],or:{sid:"-d2q1d1"}})}for(var Y,Z=()=>{var e=Y.value;j({and:[{clock:e.route.navigate.doneData,fn:r=>{var a=r.replace;return{route:e,params:r.params,query:r.query,replace:null!=a&&a}},target:v}],or:{sid:"-cm87k7"}})},ee=o(f);!(Y=ee()).done;)Z();L.on(v,(()=>!0)),j({and:[{clock:v,fn:e=>{var r=e.params,a=e.query,n=e.replace;return{path:s({pathCreator:e.route.path,params:r,query:a,serialize:l}),params:r,query:a,method:n?'replace':'push'}},target:N}],or:{sid:"-c2zeua"}}),L.reset([R,x]),j({and:[{clock:w,fn:e=>{for(var r,a=e.path,n=e.query,t=e.hash,i=[],s=[],u=o(f);!(r=u()).done;){var c=r.value,l=c.path.includes('#')?""+a+t:""+a,p=d({pathCreator:c.path,actualPath:l});(p.matches?i:s).push({routeObj:c,params:p.params,query:n})}return s.forEach(((e,r)=>{i.some((r=>r.routeObj.route===e.routeObj.route))&&s.splice(r,1)})),{matching:i,mismatching:s.filter(Boolean),path:a,query:n}},target:$}],or:{sid:"-ar5b7v"}}),F.on(_,((e,r)=>r.path)),C.on(_,((e,r)=>r.query));var re=$.map((e=>e.matching));return j({and:[{clock:re,filter:e=>e.length>0,target:R}],or:{sid:"1l4g7x"}}),j({and:[{clock:$.map((e=>e.mismatching)),filter:e=>e.length>0,target:x}],or:{sid:"1zyw8o"}}),H.on($,((e,r)=>r.matching.map((e=>e.routeObj.route)))),j({and:[{clock:re,filter:e=>0===e.length,target:P}],or:{sid:"2hkb88"}}),k({sid:"2kv2vu",fn:()=>U(t),name:"none",method:"isRoute"})&&(j({and:[{clock:P,source:C,filter:t.$isOpened,fn:e=>({query:e,params:{}}),target:t.updated}],or:{sid:"2levfh"}}),j({and:[{clock:P,source:{query:C,isOpened:t.$isOpened},filter:e=>!e.isOpened,fn:e=>({query:e.query,params:{}}),target:t.opened}],or:{sid:"31cwmy"}}),j({and:[{clock:re,source:t.$isOpened,filter:(e,r)=>e&&r.length>0,target:t.closed}],or:{sid:"3haxuf"}})),j({and:[{clock:m.back,source:Q,target:A}],or:{sid:"3xsrlj"}}),j({and:[{clock:m.forward,source:Q,target:D}],or:{sid:"413j5p"}}),j({and:[{clock:C,source:{controlsQuery:m.$query,localQuery:C},filter:e=>!i(e.controlsQuery,e.localQuery),fn:e=>e.localQuery,target:m.$query}],or:{sid:"4ghrrt"}}),j({and:[{clock:m.$query,source:{path:F,localQuery:C,isNavigateInProgress:L,realHistory:Q},filter:(e,r)=>{var a,n,t,o=e.localQuery,s=e.isNavigateInProgress,d=e.realHistory,u=null!==(a=null==l?void 0:l.read(null!==(n=null==d?void 0:d.location.search)&&void 0!==n?n:''))&&void 0!==a?a:Object.fromEntries(new URLSearchParams(null!==(t=null==d?void 0:d.location.search)&&void 0!==t?t:''));return s||!i(r,u)||!i(o,r)},fn:(e,r)=>{var a,n=e.path,t=null!==(a=null==l?void 0:l.write(r))&&void 0!==a?a:new URLSearchParams(r);return{path:n+(t?"?"+t:''),params:{},query:r,method:'push'}},target:N}],or:{sid:"4wzlkn"}}),j({and:[{clock:$,source:{activeRoutes:H,path:F,query:C},filter:I.map((e=>!e)),target:z}],or:{sid:"gbpwte"}}),I.on(z,(()=>!0)).reset(Q),{$path:F,$activeRoutes:H,$history:Q,setHistory:h,$query:C,back:m.back,forward:m.forward,push:N,routes:f,initialized:z,routeNotFound:P}}function p(e){var r=e.clock?j({and:[{clock:e.clock}],or:{name:"clock",sid:"-ek44ri"}}):b({name:"clock",sid:"-ejkc65"}),a=m(e.params||{}),n=m(e.query||{}),t=m(e.replace||!1);return j({and:[{clock:r,source:{params:a,query:n,replace:t},fn:(e,r)=>{var a=e.params,n=e.query,t=e.replace;return{params:'function'==typeof a?a(r):a,query:'function'==typeof n?n(r):n,replace:'function'==typeof t?t(r):t}},target:e.route.navigate}],or:{sid:"ahoqts"}}),r}function m(e){return w.store(e,{sid:"b0xjrg"})?e:g(e,{sid:"-dcoehd"})}function f(r){var a=(r=>{var a={};if(k({sid:"-vu4zd1",fn:()=>U(r),name:"none",method:"isRoute"}))return Object.assign(a,{route:r,chainedRoute:k({sid:"-wmhz5t",fn:()=>e(),name:"chainedRoute",method:"createRoute"}),beforeOpen:b({name:"beforeOpen",sid:"cx9b28"}),openOn:x([r.opened,r.closed],{name:"openOn",sid:"-mssum5"}),cancelOn:x([b({name:"cancelOn",sid:"rne13o"})],{name:"cancelOn",sid:"rne0fk"})}),a;var n=r;if(Object.assign(a,{route:n.route,chainedRoute:n.chainedRoute||k({sid:"-hy3nad",fn:()=>e(),name:"chainedRoute",method:"createRoute"}),beforeOpen:w.unit(n.beforeOpen)?n.beforeOpen:y({and:n.beforeOpen,or:{name:"beforeOpen",sid:"-xdaty7"}})}),w.effect(a.beforeOpen,{sid:"-qy1t3m"}))return Object.assign(a,{openOn:n.openOn||a.beforeOpen.doneData,cancelOn:n.cancelOn||a.beforeOpen.failData}),a;var t=r;return Object.assign(a,{openOn:j({and:[{clock:t.openOn}],or:{name:"openOn",sid:"-8ll0dg"}}),cancelOn:j({and:[{clock:t.cancelOn||b({name:"clock",sid:"-4mp5og"})}],or:{name:"cancelOn",sid:"-lji6mv"}})}),a})(r),n=a.route,t=a.chainedRoute,o=a.beforeOpen,i=a.openOn,s=a.cancelOn,d=g({},{name:"$params",sid:"ayygyi"}),u=g({},{name:"$query",sid:"-uacyzw"}),c=$({and:[$({and:[[n.$params,n.$query]],or:{name:"and",sid:"3vqbxs"}}),$({and:[[d,u]],or:{name:"and",sid:"3wa4j5"}}),(e,r)=>e[0]===r[0]&&e[1]===r[1]],or:{name:"$hasSameParams",sid:"-nkydfl"}}),l=j({and:[{clock:[n.opened,n.updated]}],or:{name:"routeOpened",sid:"-gcvb85"}});j({and:[{clock:l,target:o}],or:{sid:"-nodu7s"}}),d.on(l,((e,r)=>r.params)),u.on(l,((e,r)=>r.query));var p=R({and:[{clock:i,source:{params:d,query:u},filter:c}],or:{name:"chainedRouteResolved",sid:"-mfd004"}});j({and:[{clock:p,target:t.navigate}],or:{sid:"-n68mmv"}});var m=x([n.closed,s],{name:"aborted",sid:"vaomxt"});return d.reset(m),u.reset(m),j({and:[{clock:m,target:t.closed}],or:{sid:"-mpqsu1"}}),t}function h(e){var r,n,t,i=null!==(r=null===(n=e.route)||void 0===n?void 0:n.$isOpened)&&void 0!==r?r:g(!0,{name:"$isOpened",sid:"-ubx3p"}),s=$({and:[e.source],or:{name:"$source",sid:"-3rrhte"}}),d=null!==(t=e.clock)&&void 0!==t?t:s,u='cleanup'in e?'boolean'==typeof e.cleanup?C[e.cleanup?'all':'none']:a(a({},C.default),e.cleanup):C.default,c=j({and:[{clock:e.controls.$query,filter:i}],or:{name:"queryUpdatedFromHistory",sid:"8lf3wv"}});j({and:[{clock:d,source:$({and:[[s,e.controls.$query]],or:{name:"source",sid:"-3pgs50"}}),filter:i,fn:e=>{var r=e[0],n=e[1],t={};if(u.irrelevant)for(var i,s=o(u.preserve);!(i=s()).done;){var d=i.value;d in n&&(t[d]=n[d])}else t=a({},n);for(var c in r)t[c]=r[c];if(u.empty)for(var l in r)u.preserve.includes(l)||t[l]||delete t[l];return t},target:e.controls.$query}],or:{sid:"fuzb5g"}});var l=r=>{var a=e.source[r];a.on(c,((e,n)=>{var t;return null!==(t=n[r])&&void 0!==t?t:a.defaultState}))};for(var p in e.source)l(p)}import{createEffect as v,attach as y,createStore as g,createEvent as b,split as O,withFactory as k,scopeBind as q,sample as j,is as w,combine as $,guard as R,merge as x}from'effector';import{compile as P,match as z}from'path-to-regexp';var F={ROUTE:Symbol()},S=()=>({$query:g({},{and:{updateFilter:(e,r)=>!i(r,e)},name:"$query",sid:"z22f3o"}),back:b({name:"back",sid:"lqciue"}),forward:b({name:"forward",sid:"-5dfdts"})}),U=e=>'object'==typeof e&&null!==e&&'kind'in e&&e.kind===F.ROUTE,E=v((e=>(u(e.history),e.history[e.method](e.path,{}),e)),{name:"historyPushFx",sid:"-w0no5y"}),A=v((e=>(u(e),e.back(),e)),{name:"historyBackFx",sid:"-ny8vwp"}),D=v((e=>(u(e),e.forward(),e)),{name:"historyForwardFx",sid:"88oqi4"}),T=e=>r=>{var a=r.find((r=>r.routeObj.route===e.route));if(a)return{params:a.params,query:a.query}},C={all:{irrelevant:!0,empty:!0,preserve:[]},default:{irrelevant:!1,empty:!0,preserve:[]},none:{irrelevant:!1,empty:!1,preserve:[]}};export{F as Kind,s as buildPath,f as chainRoute,l as createHistoryRouter,e as createRoute,S as createRouterControls,U as isRoute,d as matchPath,h as querySync,p as redirect};
//# sourceMappingURL=atomic-router.esm.js.map

@@ -1,2 +0,2 @@

((e,r)=>{'object'==typeof exports&&'undefined'!=typeof module?r(exports,require('effector')):'function'==typeof define&&define.amd?define(['exports','effector'],r):r((e='undefined'!=typeof globalThis?globalThis:e||self).atomicRouter={},e.effector)})(this,((e,effector)=>{function r(e){void 0===e&&(e={});var r=effector.createEffect((e=>{var r=e.replace;return{params:e.params||{},query:e.query||{},replace:void 0!==r&&r}}),{name:"navigateFx",sid:"c2qlao"}),a=effector.attach({and:{effect:r,mapParams:e=>({params:e||{},query:{}})},or:{name:"openFx",sid:"am04as"}}),t=effector.createStore(!1,{name:"$isOpened",sid:"-8u29di"}),n=effector.createStore({},{name:"$params",sid:"6sxdf"}),o=effector.createStore({},{name:"$query",sid:"tylje5"}),i=effector.createEvent({name:"opened",sid:"fafqk0"}),c=effector.createEvent({name:"updated",sid:"66vs1s"}),s=effector.createEvent({name:"closed",sid:"-wbq1n3"});return t.on(i,(()=>!0)).on(s,(()=>!1)),n.on(i,((e,r)=>r.params)).on(c,((e,r)=>r.params)),o.on(i,((e,r)=>r.query)).on(c,((e,r)=>r.query)),effector.split({and:[{source:r.doneData,match:t.map((e=>e?'updated':'opened')),cases:{opened:i,updated:c}}],or:{sid:"3j56hf"}}),{$isOpened:t,$params:n,$query:o,opened:i,updated:c,closed:s,navigate:r,open:a,kind:g.ROUTE,settings:{derived:Boolean(e.filter)}}}function a(e,r){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(e);r&&(t=t.filter((r=>Object.getOwnPropertyDescriptor(e,r).enumerable))),a.push.apply(a,t)}return a}function t(e){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{};r%2?a(Object(t),!0).forEach((r=>{n(e,r,t[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):a(Object(t)).forEach((r=>{Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}))}return e}function n(e,r,a){return r in e?Object.defineProperty(e,r,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[r]=a,e}function o(e,r){(null==r||r>e.length)&&(r=e.length);for(var a=0,t=new Array(r);a<r;a++)t[a]=e[a];return t}function i(e,r){var it="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(it)return(it=it.call(e)).next.bind(it);if(Array.isArray(e)||(it=((e,r)=>{if(e){if("string"==typeof e)return o(e,r);var a={}.toString.call(e).slice(8,-1);return"Object"===a&&e.constructor&&(a=e.constructor.name),"Map"===a||"Set"===a?Array.from(e):"Arguments"===a||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a)?o(e,r):void 0}})(e))||r&&e&&"number"==typeof e.length){it&&(e=it);var a=0;return()=>a>=e.length?{done:!0}:{done:!1,value:e[a++]}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function c(e,r){if(Object.keys(e).length!==Object.keys(r).length)return!1;for(var a in e)if(""+e[a]!=""+r[a])return!1;return!0}function s(e,r){void 0===r&&(r={});for(var a=(e=>{for(var r=[],a=0;a<e.length;){var t=e[a];if("*"!==t&&"+"!==t&&"?"!==t)if("\\"!==t)if("{"!==t)if("}"!==t)if(":"!==t)if("("!==t)r.push({type:"CHAR",index:a,value:e[a++]});else{var n=1,o="";if("?"===e[c=a+1])throw new TypeError("Pattern cannot start with \"?\" at ".concat(c));for(;c<e.length;)if("\\"!==e[c]){if(")"===e[c]){if(0==--n){c++;break}}else if("("===e[c]&&(n++,"?"!==e[c+1]))throw new TypeError("Capturing groups are not allowed at ".concat(c));o+=e[c++]}else o+=e[c++]+e[c++];if(n)throw new TypeError("Unbalanced pattern at ".concat(a));if(!o)throw new TypeError("Missing pattern at ".concat(a));r.push({type:"PATTERN",index:a,value:o}),a=c}else{for(var i="",c=a+1;c<e.length;){var s=e.charCodeAt(c);if(!(s>=48&&s<=57||s>=65&&s<=90||s>=97&&s<=122||95===s))break;i+=e[c++]}if(!i)throw new TypeError("Missing parameter name at ".concat(a));r.push({type:"NAME",index:a,value:i}),a=c}else r.push({type:"CLOSE",index:a,value:e[a++]});else r.push({type:"OPEN",index:a,value:e[a++]});else r.push({type:"ESCAPED_CHAR",index:a++,value:e[a++]});else r.push({type:"MODIFIER",index:a,value:e[a++]})}return r.push({type:"END",index:a,value:""}),r})(e),t=r.prefixes,n=void 0===t?"./":t,o="[^".concat(u(r.delimiter||"/#?"),"]+?"),i=[],c=0,s=0,d="",l=e=>{if(s<a.length&&a[s].type===e)return a[s++].value},p=e=>{var r=l(e);if(void 0!==r)return r;var t=a[s],n=t.index;throw new TypeError("Unexpected ".concat(t.type," at ").concat(n,", expected ").concat(e))},f=()=>{for(var e,r="";e=l("CHAR")||l("ESCAPED_CHAR");)r+=e;return r};s<a.length;){var m=l("CHAR"),v=l("NAME"),h=l("PATTERN");if(v||h)-1===n.indexOf(g=m||"")&&(d+=g,g=""),d&&(i.push(d),d=""),i.push({name:v||c++,prefix:g,suffix:"",pattern:h||o,modifier:l("MODIFIER")||""});else{var y=m||l("ESCAPED_CHAR");if(y)d+=y;else if(d&&(i.push(d),d=""),l("OPEN")){var g=f(),b=l("NAME")||"",O=l("PATTERN")||"",w=f();p("CLOSE"),i.push({name:b||(O?c++:""),pattern:b&&!O?o:O,prefix:g,suffix:w,modifier:l("MODIFIER")||""})}else p("END")}}return i}function d(e,r){var a=[];return((e,r,a)=>{void 0===a&&(a={});var t=a.decode,n=void 0===t?e=>e:t;return a=>{var t=e.exec(a);if(!t)return!1;for(var o=t[0],i=t.index,c=Object.create(null),s=e=>{if(void 0===t[e])return"continue";var a=r[e-1];c[a.name]="*"===a.modifier||"+"===a.modifier?t[e].split(a.prefix+a.suffix).map((e=>n(e,a))):n(t[e],a)},d=1;d<t.length;d++)s(d);return{path:o,index:i,params:c}}})(p(e,a,r),a,r)}function u(e){return e.replace(/([.+*?=^!:${}()[\]|/\\])/g,"\\$1")}function l(e){return e&&e.sensitive?"":"i"}function p(e,r,a){return e instanceof RegExp?((e,r)=>{if(!r)return e;for(var a=/\((?:\?<(.*?)>)?(?!\?)/g,t=0,n=a.exec(e.source);n;)r.push({name:n[1]||t++,prefix:"",suffix:"",modifier:"",pattern:""}),n=a.exec(e.source);return e})(e,r):Array.isArray(e)?((e,r,a)=>{var t=e.map((e=>p(e,r,a).source));return new RegExp("(?:".concat(t.join("|"),")"),l(a))})(e,r,a):((e,r,a)=>((e,r,a)=>{void 0===a&&(a={});for(var t=a.strict,n=void 0!==t&&t,o=a.start,i=void 0===o||o,c=a.end,s=void 0===c||c,d=a.encode,p=void 0===d?e=>e:d,f=a.delimiter,m=void 0===f?"/#?":f,v=a.endsWith,h="[".concat(u(void 0===v?"":v),"]|$"),y="[".concat(u(m),"]"),g=i?"^":"",b=0,O=e;b<O.length;b++){var w=O[b];if("string"==typeof w)g+=u(p(w));else{var E=u(p(w.prefix)),k=u(p(w.suffix));if(w.pattern)if(r&&r.push(w),E||k)if("+"===w.modifier||"*"===w.modifier){var x="*"===w.modifier?"?":"";g+="(?:".concat(E,"((?:").concat(w.pattern,")(?:").concat(k).concat(E,"(?:").concat(w.pattern,"))*)").concat(k,")").concat(x)}else g+="(?:".concat(E,"(").concat(w.pattern,")").concat(k,")").concat(w.modifier);else g+="+"===w.modifier||"*"===w.modifier?"((?:".concat(w.pattern,")").concat(w.modifier,")"):"(".concat(w.pattern,")").concat(w.modifier);else g+="(?:".concat(E).concat(k,")").concat(w.modifier)}}if(s)n||(g+="".concat(y,"?")),g+=a.endsWith?"(?=".concat(h,")"):"$";else{var q=e[e.length-1],j="string"==typeof q?y.indexOf(q[q.length-1])>-1:void 0===q;n||(g+="(?:".concat(y,"(?=").concat(h,"))?")),j||(g+="(?=".concat(y,"|").concat(h,")"))}return new RegExp(g,l(a))})(s(e,a),r,a))(e,r,a)}function f(e){var r,a=e.params,t=e.query,n=e.serialize,o=((e,r)=>((e,r)=>{void 0===r&&(r={});var a=l(r),t=r.encode,n=void 0===t?e=>e:t,o=r.validate,i=void 0===o||o,c=e.map((e=>{if("object"==typeof e)return new RegExp("^(?:".concat(e.pattern,")$"),a)}));return r=>{for(var a="",t=0;t<e.length;t++){var o=e[t];if("string"!=typeof o){var s=r?r[o.name]:void 0,d="?"===o.modifier||"*"===o.modifier,u="*"===o.modifier||"+"===o.modifier;if(Array.isArray(s)){if(!u)throw new TypeError("Expected \"".concat(o.name,"\" to not repeat, but got an array"));if(0===s.length){if(d)continue;throw new TypeError("Expected \"".concat(o.name,"\" to not be empty"))}for(var l=0;l<s.length;l++){var p=n(s[l],o);if(i&&!c[t].test(p))throw new TypeError("Expected all \"".concat(o.name,"\" to match \"").concat(o.pattern,"\", but got \"").concat(p,"\""));a+=o.prefix+p+o.suffix}}else if("string"!=typeof s&&"number"!=typeof s){if(!d){var f=u?"an array":"a string";throw new TypeError("Expected \"".concat(o.name,"\" to be ").concat(f))}}else{if(p=n(String(s),o),i&&!c[t].test(p))throw new TypeError("Expected \"".concat(o.name,"\" to match \"").concat(o.pattern,"\", but got \"").concat(p,"\""));a+=o.prefix+p+o.suffix}}else a+=o}return a}})(s(e,r),r))(e.pathCreator)(a),i=null!==(r=null==n?void 0:n.write(t))&&void 0!==r?r:new URLSearchParams(t);return o+(Object.keys(t).length?"?"+i:'')}function m(e){var r=e.actualPath,a=d((e=>e.replace('://','\\://'))(e.pathCreator))((e=>{if(e.match(/^[a-z0-9]+\:\/\//i))return e;var r=new URL("http://_"+e);return[r.pathname,r.hash].join('')})(r));return a?{matches:!0,params:a.params}:{matches:!1}}function v(e){if(!e)throw new Error('[Routing] No history provided')}function h(e){return e.map((e=>!e))}function y(e){return effector.is.store(e,{sid:"b1hcct"})?e:effector.createStore(e,{sid:"-cvms36"})}var g={ROUTE:Symbol()},b=()=>({$query:effector.createStore({},{and:{updateFilter:(e,r)=>!c(r,e)},name:"$query",sid:"z22f3o"}),back:effector.createEvent({name:"back",sid:"lqciue"}),forward:effector.createEvent({name:"forward",sid:"-5dfdts"})}),O=e=>'object'==typeof e&&null!==e&&'kind'in e&&e.kind===g.ROUTE,w=effector.createEffect((e=>(v(e.history),e.history[e.method](e.path,{}),e)),{name:"historyPushFx",sid:"-w0no5y"}),E=effector.createEffect((e=>(v(e),e.back(),e)),{name:"historyBackFx",sid:"-ny8vwp"}),k=effector.createEffect((e=>(v(e),e.forward(),e)),{name:"historyForwardFx",sid:"88oqi4"}),x=e=>r=>{var a=r.find((r=>r.routeObj.route===e.route));if(a)return{params:a.params,query:a.query}},q={all:{irrelevant:!0,empty:!0,preserve:[]},default:{irrelevant:!1,empty:!0,preserve:[]},none:{irrelevant:!1,empty:!1,preserve:[]}};e.Kind=g,e.buildPath=f,e.chainRoute=e=>{var a=(e=>{var a={};if(effector.withFactory({sid:"-vuorye",fn:()=>O(e),name:"none",method:"isRoute"}))return Object.assign(a,{route:e,chainedRoute:effector.withFactory({sid:"-x3jlk0",fn:()=>r(),name:"chainedRoute",method:"createRoute"}),beforeOpen:effector.createEvent({name:"beforeOpen",sid:"2i9mdy"}),openOn:effector.merge([e.opened,e.closed],{name:"openOn",sid:"-n9uh0c"}),cancelOn:effector.merge([effector.createEvent({name:"cancelOn",sid:"r6ceph"})],{name:"cancelOn",sid:"r6ce1d"})}),a;var t=e;if(Object.assign(a,{route:t.route,chainedRoute:t.chainedRoute||effector.withFactory({sid:"-if59ok",fn:()=>r(),name:"chainedRoute",method:"createRoute"}),beforeOpen:effector.is.unit(t.beforeOpen)?t.beforeOpen:effector.attach({and:t.beforeOpen,or:{name:"beforeOpen",sid:"-xdumjk"}})}),effector.is.effect(a.beforeOpen,{sid:"-qylloz"}))return Object.assign(a,{openOn:t.openOn||a.beforeOpen.doneData,cancelOn:t.cancelOn||a.beforeOpen.failData}),a;var n=e;return Object.assign(a,{openOn:effector.sample({and:[{clock:n.openOn}],or:{name:"openOn",sid:"-92mmrn"}}),cancelOn:effector.sample({and:[{clock:n.cancelOn||effector.createEvent({name:"clock",sid:"-53qs2n"})}],or:{name:"cancelOn",sid:"-m0jt12"}})}),a})(e),t=a.route,n=a.chainedRoute,o=a.beforeOpen,i=a.openOn,c=a.cancelOn,s=effector.createStore({},{name:"$params",sid:"ahwukb"}),d=effector.createStore({},{name:"$query",sid:"-urele3"}),u=effector.combine({and:[effector.combine({and:[[t.$params,t.$query]],or:{name:"and",sid:"3v6jcf"}}),effector.combine({and:[[s,d]],or:{name:"and",sid:"3vqbxs"}}),(e,r)=>e[0]===r[0]&&e[1]===r[1]],or:{name:"$hasSameParams",sid:"-xzy23v"}}),l=effector.sample({and:[{clock:[t.opened,t.updated]}],or:{name:"routeOpened",sid:"-gtwxmc"}});effector.sample({and:[{clock:l,target:o}],or:{sid:"-noxmt5"}}),s.on(l,((e,r)=>r.params)),d.on(l,((e,r)=>r.query));var p=effector.guard({and:[{clock:i,source:{params:s,query:d},filter:u}],or:{name:"chainedRouteResolved",sid:"-mwemeb"}});effector.sample({and:[{clock:p,target:n.navigate}],or:{sid:"-n6sf88"}});var f=effector.merge([t.closed,c],{name:"aborted",sid:"utn0jm"});return s.reset(f),d.reset(f),effector.sample({and:[{clock:f,target:n.closed}],or:{sid:"-mqalfe"}}),n},e.createHistoryRouter=e=>{var r=e.base,a=e.routes,n=e.notFoundRoute,o=e.hydrate,s=e.serialize,d=e.controls,u=void 0===d?effector.withFactory({sid:"d2qzob",fn:()=>b(),name:"controls",method:"createRouterControls"}):d,l=((e,r)=>{void 0===r&&(r='');for(var a,n=[],o=()=>{var e,r=a.value;Array.isArray(r.route)?(e=n).push.apply(e,r.route.map((e=>t(t({},r),{},{route:e})))):n.push(r)},c=i(e);!(a=c()).done;)o();n=n.map((e=>t(t({},e),{},{path:""+r+e.path})));for(var s,d=[],u=[],l=i(n);!(s=l()).done;){var p=s.value;p.route.settings.derived?d.push(p):u.push(p)}if(d.length)for(var f,m=i(d);!(f=m()).done;)console.error("createHistoryRouter: "+f.value.path+" uses derived route. This won't work");return u})(a,r),p=effector.createEvent({name:"setHistory",sid:"9zwyxu"}),v=effector.createEvent({name:"navigateFromRouteTriggered",sid:"soge6d"}),y=effector.createEvent({name:"historyUpdated",sid:"-x4474u"}),g=effector.createEvent({name:"recalculateTriggered",sid:"-ykrhlj"}),q=effector.createEvent({name:"recalculated",sid:"aeh4sf"}),j=effector.createEvent({name:"routesMatched",sid:"2rfqt6"}),R=effector.createEvent({name:"routesMismatched",sid:"71hypl"}),$=effector.createEvent({name:"routeNotFound",sid:"avqxzu"}),P=effector.createEvent({name:"initialized",sid:"du6f0f"}),S=effector.createStore('',{name:"$path",sid:"wz8cwv"}),A=effector.createStore({},{and:{name:'historyRouter.$query',updateFilter:(e,r)=>!c(e,r)},name:"$query",sid:"tkdilp"}),T=effector.createStore([],{and:{serialize:'ignore'},name:"$activeRoutes",sid:"9ljm7u"}),F=effector.createStore(null,{and:{serialize:'ignore'},name:"$history",sid:"g4i7nj"}),C=effector.createStore(!1,{name:"$isFirstCheckPassed",sid:"9r108x"}),z=effector.createStore(!1,{name:"$isRouteNavigateInProgress",sid:"a1vtrl"}),D=effector.attach({and:{source:F,effect:(e,r)=>w(t({history:e},r))},or:{name:"pushFx",sid:"qm76ov"}}),N=effector.attach({and:{source:F,effect:e=>{var r=y;try{r=effector.scopeBind(y)}catch(e){}return e.listen((()=>{r()})),!0}},or:{name:"subscribeHistoryFx",sid:"-b12mlt"}}),U=effector.sample({and:[{clock:o?[y]:[y,N.done],source:F,filter:Boolean,fn:e=>{var r;return{path:e.location.pathname,query:null!==(r=null==s?void 0:s.read(e.location.search))&&void 0!==r?r:Object.fromEntries(new URLSearchParams(e.location.search))}}}],or:{name:"historyUpdatedParsed",sid:"-rhkauu"}}),H=effector.sample({and:[{clock:U,source:{path:S,query:A},filter:(e,r)=>r.path!==e.path||!c(r.query,e.query),fn:(e,r)=>r}],or:{name:"historyUpdateTriggered",sid:"-pbyg2j"}});F.on(p,((e,r)=>r)),effector.sample({and:[{clock:F,target:N}],or:{sid:"-pwl7u3"}}),effector.sample({and:[{clock:H,source:F,filter:Boolean,fn:e=>{var r,a=null==e?void 0:e.location.hash;return{path:null==e?void 0:e.location.pathname,query:null!==(r=null==s?void 0:s.read(null==e?void 0:e.location.search))&&void 0!==r?r:Object.fromEntries(new URLSearchParams(null==e?void 0:e.location.search)),hash:a}},target:g}],or:{sid:"-ptu8va"}});for(var M,I=i(l);!(M=I()).done;){var L=M.value,Q=j.filterMap(x(L)),B=R.filterMap(x(L)),_={opened:effector.sample({and:[{clock:Q,filter:h(L.route.$isOpened)}],or:{name:"opened",sid:"-vfmdab"}}),updated:effector.sample({and:[{clock:Q,filter:L.route.$isOpened}],or:{name:"updated",sid:"-2uhvx2"}}),closed:effector.sample({and:[{clock:B,filter:L.route.$isOpened}],or:{name:"closed",sid:"jc9588"}})};effector.sample({and:[{clock:_.updated,source:[L.route.$params,L.route.$query],filter:(e,r)=>{var a=e[1];return!c(e[0],r.params)||!c(a,r.query)},fn:(e,r)=>r,target:L.route.updated}],or:{sid:"-ny7ju5"}}),effector.sample({and:[{clock:_.opened,filter:h(z),target:L.route.opened}],or:{sid:"-ngm4ul"}}),effector.sample({and:[{clock:_.closed,target:L.route.closed}],or:{sid:"-d2q1d1"}})}for(var W,K=()=>{var e=W.value;effector.sample({and:[{clock:e.route.navigate.doneData,fn:r=>{var a=r.replace;return{route:e,params:r.params,query:r.query,replace:null!=a&&a}},target:v}],or:{sid:"-cm87k7"}})},G=i(l);!(W=G()).done;)K();z.on(v,(()=>!0)),effector.sample({and:[{clock:v,fn:e=>{var r=e.params,a=e.query,t=e.replace;return{path:f({pathCreator:e.route.path,params:r,query:a,serialize:s}),params:r,query:a,method:t?'replace':'push'}},target:D}],or:{sid:"-c2zeua"}}),z.reset([j,R]),effector.sample({and:[{clock:g,fn:e=>{for(var r,a=e.path,t=e.query,n=e.hash,o=[],c=[],s=i(l);!(r=s()).done;){var d=r.value,u=d.path.includes('#')?""+a+n:""+a,p=m({pathCreator:d.path,actualPath:u});(p.matches?o:c).push({routeObj:d,params:p.params,query:t})}return c.forEach(((e,r)=>{o.some((r=>r.routeObj.route===e.routeObj.route))&&c.splice(r,1)})),{matching:o,mismatching:c.filter(Boolean),path:a,query:t}},target:q}],or:{sid:"-ar5b7v"}}),S.on(H,((e,r)=>r.path)),A.on(H,((e,r)=>r.query));var J=q.map((e=>e.matching));return effector.sample({and:[{clock:J,filter:e=>e.length>0,target:j}],or:{sid:"1l4g7x"}}),effector.sample({and:[{clock:q.map((e=>e.mismatching)),filter:e=>e.length>0,target:R}],or:{sid:"1zyw8o"}}),T.on(q,((e,r)=>r.matching.map((e=>e.routeObj.route)))),effector.sample({and:[{clock:J,filter:e=>0===e.length,target:$}],or:{sid:"2hkb88"}}),effector.withFactory({sid:"2kv2vu",fn:()=>O(n),name:"none",method:"isRoute"})&&(effector.sample({and:[{clock:$,source:A,filter:n.$isOpened,fn:e=>({query:e,params:{}}),target:n.updated}],or:{sid:"2levfh"}}),effector.sample({and:[{clock:$,source:{query:A,isOpened:n.$isOpened},filter:e=>!e.isOpened,fn:e=>({query:e.query,params:{}}),target:n.opened}],or:{sid:"31cwmy"}}),effector.sample({and:[{clock:J,source:n.$isOpened,filter:(e,r)=>e&&r.length>0,target:n.closed}],or:{sid:"3haxuf"}})),effector.sample({and:[{clock:u.back,source:F,target:E}],or:{sid:"3xsrlj"}}),effector.sample({and:[{clock:u.forward,source:F,target:k}],or:{sid:"413j5p"}}),effector.sample({and:[{clock:A,source:{controlsQuery:u.$query,localQuery:A},filter:e=>!c(e.controlsQuery,e.localQuery),fn:e=>e.localQuery,target:u.$query}],or:{sid:"4ghrrt"}}),effector.sample({and:[{clock:u.$query,source:{path:S,localQuery:A,isNavigateInProgress:z,realHistory:F},filter:(e,r)=>{var a,t,n,o=e.localQuery,i=e.isNavigateInProgress,d=e.realHistory,u=null!==(a=null==s?void 0:s.read(null!==(t=null==d?void 0:d.location.search)&&void 0!==t?t:''))&&void 0!==a?a:Object.fromEntries(new URLSearchParams(null!==(n=null==d?void 0:d.location.search)&&void 0!==n?n:''));return i||!c(r,u)||!c(o,r)},fn:(e,r)=>{var a,t=e.path,n=null!==(a=null==s?void 0:s.write(r))&&void 0!==a?a:new URLSearchParams(r);return{path:t+(n?"?"+n:''),params:{},query:r,method:'push'}},target:D}],or:{sid:"4wzlkn"}}),effector.sample({and:[{clock:q,source:{activeRoutes:T,path:S,query:A},filter:C.map((e=>!e)),target:P}],or:{sid:"gbpwte"}}),C.on(P,(()=>!0)).reset(F),{$path:S,$activeRoutes:T,$history:F,setHistory:p,$query:A,back:u.back,forward:u.forward,push:D,routes:l,initialized:P,routeNotFound:$}},e.createRoute=r,e.createRouterControls=b,e.isRoute=O,e.matchPath=m,e.querySync=e=>{var r,a,n,o=null!==(r=null===(a=e.route)||void 0===a?void 0:a.$isOpened)&&void 0!==r?r:effector.createStore(!0,{name:"$isOpened",sid:"-ubx3p"}),c=effector.combine({and:[e.source],or:{name:"$source",sid:"-3rrhte"}}),s=null!==(n=e.clock)&&void 0!==n?n:c,d='cleanup'in e?'boolean'==typeof e.cleanup?q[e.cleanup?'all':'none']:t(t({},q.default),e.cleanup):q.default,u=effector.sample({and:[{clock:e.controls.$query,filter:o}],or:{name:"queryUpdatedFromHistory",sid:"8lf3wv"}});effector.sample({and:[{clock:s,source:effector.combine({and:[[c,e.controls.$query]],or:{name:"source",sid:"-3pgs50"}}),filter:o,fn:e=>{var r=e[0],a=e[1],n={};if(d.irrelevant)for(var o,c=i(d.preserve);!(o=c()).done;){var s=o.value;s in a&&(n[s]=a[s])}else n=t({},a);for(var u in r)n[u]=r[u];if(d.empty)for(var l in r)d.preserve.includes(l)||n[l]||delete n[l];return n},target:e.controls.$query}],or:{sid:"fuzb5g"}});var l=r=>{var a=e.source[r];a.on(u,((e,t)=>{var n;return null!==(n=t[r])&&void 0!==n?n:a.defaultState}))};for(var p in e.source)l(p)},e.redirect=e=>{var r=e.clock?effector.sample({and:[{clock:e.clock}],or:{name:"clock",sid:"-ek44ri"}}):effector.createEvent({name:"clock",sid:"-ejkc65"}),a=y(e.params||{}),t=y(e.query||{}),n=y(e.replace||!1);return effector.sample({and:[{clock:r,source:{params:a,query:t,replace:n},fn:(e,r)=>{var a=e.params,t=e.query,n=e.replace;return{params:'function'==typeof a?a(r):a,query:'function'==typeof t?t(r):t,replace:'function'==typeof n?n(r):n}},target:e.route.navigate}],or:{sid:"ai8jf5"}}),r},Object.defineProperty(e,'__esModule',{value:!0})}));
((e,r)=>{'object'==typeof exports&&'undefined'!=typeof module?r(exports,require('effector')):'function'==typeof define&&define.amd?define(['exports','effector'],r):r((e='undefined'!=typeof globalThis?globalThis:e||self).atomicRouter={},e.effector)})(this,((e,effector)=>{function r(e){void 0===e&&(e={});var r=effector.createEffect((e=>{var r=e.replace;return{params:e.params||{},query:e.query||{},replace:void 0!==r&&r}}),{name:"navigateFx",sid:"c2qlao"}),a=effector.attach({and:{effect:r,mapParams:e=>({params:e||{},query:{}})},or:{name:"openFx",sid:"am04as"}}),t=effector.createStore(!1,{name:"$isOpened",sid:"-8u29di"}),n=effector.createStore({},{name:"$params",sid:"6sxdf"}),o=effector.createStore({},{name:"$query",sid:"tylje5"}),i=effector.createEvent({name:"opened",sid:"fafqk0"}),c=effector.createEvent({name:"updated",sid:"66vs1s"}),s=effector.createEvent({name:"closed",sid:"-wbq1n3"});return t.on(i,(()=>!0)).on(s,(()=>!1)),n.on(i,((e,r)=>r.params)).on(c,((e,r)=>r.params)),o.on(i,((e,r)=>r.query)).on(c,((e,r)=>r.query)),effector.split({and:[{source:r.doneData,match:t.map((e=>e?'updated':'opened')),cases:{opened:i,updated:c}}],or:{sid:"3j56hf"}}),{$isOpened:t,$params:n,$query:o,opened:i,updated:c,closed:s,navigate:r,open:a,kind:g.ROUTE,settings:{derived:Boolean(e.filter)}}}function a(e,r){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(e);r&&(t=t.filter((r=>Object.getOwnPropertyDescriptor(e,r).enumerable))),a.push.apply(a,t)}return a}function t(e){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{};r%2?a(Object(t),!0).forEach((r=>{n(e,r,t[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):a(Object(t)).forEach((r=>{Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}))}return e}function n(e,r,a){return r in e?Object.defineProperty(e,r,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[r]=a,e}function o(e,r){(null==r||r>e.length)&&(r=e.length);for(var a=0,t=new Array(r);a<r;a++)t[a]=e[a];return t}function i(e,r){var it="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(it)return(it=it.call(e)).next.bind(it);if(Array.isArray(e)||(it=((e,r)=>{if(e){if("string"==typeof e)return o(e,r);var a={}.toString.call(e).slice(8,-1);return"Object"===a&&e.constructor&&(a=e.constructor.name),"Map"===a||"Set"===a?Array.from(e):"Arguments"===a||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a)?o(e,r):void 0}})(e))||r&&e&&"number"==typeof e.length){it&&(e=it);var a=0;return()=>a>=e.length?{done:!0}:{done:!1,value:e[a++]}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function c(e,r){if(Object.keys(e).length!==Object.keys(r).length)return!1;for(var a in e)if(""+e[a]!=""+r[a])return!1;return!0}function s(e,r){void 0===r&&(r={});for(var a=(e=>{for(var r=[],a=0;a<e.length;){var t=e[a];if("*"!==t&&"+"!==t&&"?"!==t)if("\\"!==t)if("{"!==t)if("}"!==t)if(":"!==t)if("("!==t)r.push({type:"CHAR",index:a,value:e[a++]});else{var n=1,o="";if("?"===e[c=a+1])throw new TypeError("Pattern cannot start with \"?\" at ".concat(c));for(;c<e.length;)if("\\"!==e[c]){if(")"===e[c]){if(0==--n){c++;break}}else if("("===e[c]&&(n++,"?"!==e[c+1]))throw new TypeError("Capturing groups are not allowed at ".concat(c));o+=e[c++]}else o+=e[c++]+e[c++];if(n)throw new TypeError("Unbalanced pattern at ".concat(a));if(!o)throw new TypeError("Missing pattern at ".concat(a));r.push({type:"PATTERN",index:a,value:o}),a=c}else{for(var i="",c=a+1;c<e.length;){var s=e.charCodeAt(c);if(!(s>=48&&s<=57||s>=65&&s<=90||s>=97&&s<=122||95===s))break;i+=e[c++]}if(!i)throw new TypeError("Missing parameter name at ".concat(a));r.push({type:"NAME",index:a,value:i}),a=c}else r.push({type:"CLOSE",index:a,value:e[a++]});else r.push({type:"OPEN",index:a,value:e[a++]});else r.push({type:"ESCAPED_CHAR",index:a++,value:e[a++]});else r.push({type:"MODIFIER",index:a,value:e[a++]})}return r.push({type:"END",index:a,value:""}),r})(e),t=r.prefixes,n=void 0===t?"./":t,o="[^".concat(u(r.delimiter||"/#?"),"]+?"),i=[],c=0,s=0,d="",l=e=>{if(s<a.length&&a[s].type===e)return a[s++].value},p=e=>{var r=l(e);if(void 0!==r)return r;var t=a[s],n=t.index;throw new TypeError("Unexpected ".concat(t.type," at ").concat(n,", expected ").concat(e))},f=()=>{for(var e,r="";e=l("CHAR")||l("ESCAPED_CHAR");)r+=e;return r};s<a.length;){var m=l("CHAR"),v=l("NAME"),h=l("PATTERN");if(v||h)-1===n.indexOf(g=m||"")&&(d+=g,g=""),d&&(i.push(d),d=""),i.push({name:v||c++,prefix:g,suffix:"",pattern:h||o,modifier:l("MODIFIER")||""});else{var y=m||l("ESCAPED_CHAR");if(y)d+=y;else if(d&&(i.push(d),d=""),l("OPEN")){var g=f(),b=l("NAME")||"",O=l("PATTERN")||"",w=f();p("CLOSE"),i.push({name:b||(O?c++:""),pattern:b&&!O?o:O,prefix:g,suffix:w,modifier:l("MODIFIER")||""})}else p("END")}}return i}function d(e,r){var a=[];return((e,r,a)=>{void 0===a&&(a={});var t=a.decode,n=void 0===t?e=>e:t;return a=>{var t=e.exec(a);if(!t)return!1;for(var o=t[0],i=t.index,c=Object.create(null),s=e=>{if(void 0===t[e])return"continue";var a=r[e-1];c[a.name]="*"===a.modifier||"+"===a.modifier?t[e].split(a.prefix+a.suffix).map((e=>n(e,a))):n(t[e],a)},d=1;d<t.length;d++)s(d);return{path:o,index:i,params:c}}})(p(e,a,r),a,r)}function u(e){return e.replace(/([.+*?=^!:${}()[\]|/\\])/g,"\\$1")}function l(e){return e&&e.sensitive?"":"i"}function p(e,r,a){return e instanceof RegExp?((e,r)=>{if(!r)return e;for(var a=/\((?:\?<(.*?)>)?(?!\?)/g,t=0,n=a.exec(e.source);n;)r.push({name:n[1]||t++,prefix:"",suffix:"",modifier:"",pattern:""}),n=a.exec(e.source);return e})(e,r):Array.isArray(e)?((e,r,a)=>{var t=e.map((e=>p(e,r,a).source));return new RegExp("(?:".concat(t.join("|"),")"),l(a))})(e,r,a):((e,r,a)=>((e,r,a)=>{void 0===a&&(a={});for(var t=a.strict,n=void 0!==t&&t,o=a.start,i=void 0===o||o,c=a.end,s=void 0===c||c,d=a.encode,p=void 0===d?e=>e:d,f=a.delimiter,m=void 0===f?"/#?":f,v=a.endsWith,h="[".concat(u(void 0===v?"":v),"]|$"),y="[".concat(u(m),"]"),g=i?"^":"",b=0,O=e;b<O.length;b++){var w=O[b];if("string"==typeof w)g+=u(p(w));else{var E=u(p(w.prefix)),k=u(p(w.suffix));if(w.pattern)if(r&&r.push(w),E||k)if("+"===w.modifier||"*"===w.modifier){var q="*"===w.modifier?"?":"";g+="(?:".concat(E,"((?:").concat(w.pattern,")(?:").concat(k).concat(E,"(?:").concat(w.pattern,"))*)").concat(k,")").concat(q)}else g+="(?:".concat(E,"(").concat(w.pattern,")").concat(k,")").concat(w.modifier);else g+="+"===w.modifier||"*"===w.modifier?"((?:".concat(w.pattern,")").concat(w.modifier,")"):"(".concat(w.pattern,")").concat(w.modifier);else g+="(?:".concat(E).concat(k,")").concat(w.modifier)}}if(s)n||(g+="".concat(y,"?")),g+=a.endsWith?"(?=".concat(h,")"):"$";else{var x=e[e.length-1],R="string"==typeof x?y.indexOf(x[x.length-1])>-1:void 0===x;n||(g+="(?:".concat(y,"(?=").concat(h,"))?")),R||(g+="(?=".concat(y,"|").concat(h,")"))}return new RegExp(g,l(a))})(s(e,a),r,a))(e,r,a)}function f(e){var r,a=e.params,t=e.query,n=e.serialize,o=((e,r)=>((e,r)=>{void 0===r&&(r={});var a=l(r),t=r.encode,n=void 0===t?e=>e:t,o=r.validate,i=void 0===o||o,c=e.map((e=>{if("object"==typeof e)return new RegExp("^(?:".concat(e.pattern,")$"),a)}));return r=>{for(var a="",t=0;t<e.length;t++){var o=e[t];if("string"!=typeof o){var s=r?r[o.name]:void 0,d="?"===o.modifier||"*"===o.modifier,u="*"===o.modifier||"+"===o.modifier;if(Array.isArray(s)){if(!u)throw new TypeError("Expected \"".concat(o.name,"\" to not repeat, but got an array"));if(0===s.length){if(d)continue;throw new TypeError("Expected \"".concat(o.name,"\" to not be empty"))}for(var l=0;l<s.length;l++){var p=n(s[l],o);if(i&&!c[t].test(p))throw new TypeError("Expected all \"".concat(o.name,"\" to match \"").concat(o.pattern,"\", but got \"").concat(p,"\""));a+=o.prefix+p+o.suffix}}else if("string"!=typeof s&&"number"!=typeof s){if(!d){var f=u?"an array":"a string";throw new TypeError("Expected \"".concat(o.name,"\" to be ").concat(f))}}else{if(p=n(String(s),o),i&&!c[t].test(p))throw new TypeError("Expected \"".concat(o.name,"\" to match \"").concat(o.pattern,"\", but got \"").concat(p,"\""));a+=o.prefix+p+o.suffix}}else a+=o}return a}})(s(e,r),r))(e.pathCreator)(a),i=null!==(r=null==n?void 0:n.write(t))&&void 0!==r?r:new URLSearchParams(t);return o+(Object.keys(t).length?"?"+i:'')}function m(e){var r=e.actualPath,a=d((e=>e.replace('://','\\://'))(e.pathCreator))((e=>{if(e.match(/^[a-z0-9]+\:\/\//i))return e;var r=new URL("http://_"+e);return[r.pathname,r.hash].join('')})(r));return a?{matches:!0,params:a.params}:{matches:!1}}function v(e){if(!e)throw new Error('[Routing] No history provided')}function h(e){return e.map((e=>!e))}function y(e){return effector.is.store(e,{sid:"b0xjrg"})?e:effector.createStore(e,{sid:"-dcoehd"})}var g={ROUTE:Symbol()},b=()=>({$query:effector.createStore({},{and:{updateFilter:(e,r)=>!c(r,e)},name:"$query",sid:"z22f3o"}),back:effector.createEvent({name:"back",sid:"lqciue"}),forward:effector.createEvent({name:"forward",sid:"-5dfdts"})}),O=e=>'object'==typeof e&&null!==e&&'kind'in e&&e.kind===g.ROUTE,w=effector.createEffect((e=>(v(e.history),e.history[e.method](e.path,{}),e)),{name:"historyPushFx",sid:"-w0no5y"}),E=effector.createEffect((e=>(v(e),e.back(),e)),{name:"historyBackFx",sid:"-ny8vwp"}),k=effector.createEffect((e=>(v(e),e.forward(),e)),{name:"historyForwardFx",sid:"88oqi4"}),q=e=>r=>{var a=r.find((r=>r.routeObj.route===e.route));if(a)return{params:a.params,query:a.query}},x={all:{irrelevant:!0,empty:!0,preserve:[]},default:{irrelevant:!1,empty:!0,preserve:[]},none:{irrelevant:!1,empty:!1,preserve:[]}};e.Kind=g,e.buildPath=f,e.chainRoute=e=>{var a=(e=>{var a={};if(effector.withFactory({sid:"-vu4zd1",fn:()=>O(e),name:"none",method:"isRoute"}))return Object.assign(a,{route:e,chainedRoute:effector.withFactory({sid:"-wmhz5t",fn:()=>r(),name:"chainedRoute",method:"createRoute"}),beforeOpen:effector.createEvent({name:"beforeOpen",sid:"cx9b28"}),openOn:effector.merge([e.opened,e.closed],{name:"openOn",sid:"-mssum5"}),cancelOn:effector.merge([effector.createEvent({name:"cancelOn",sid:"rne13o"})],{name:"cancelOn",sid:"rne0fk"})}),a;var t=e;if(Object.assign(a,{route:t.route,chainedRoute:t.chainedRoute||effector.withFactory({sid:"-hy3nad",fn:()=>r(),name:"chainedRoute",method:"createRoute"}),beforeOpen:effector.is.unit(t.beforeOpen)?t.beforeOpen:effector.attach({and:t.beforeOpen,or:{name:"beforeOpen",sid:"-xdaty7"}})}),effector.is.effect(a.beforeOpen,{sid:"-qy1t3m"}))return Object.assign(a,{openOn:t.openOn||a.beforeOpen.doneData,cancelOn:t.cancelOn||a.beforeOpen.failData}),a;var n=e;return Object.assign(a,{openOn:effector.sample({and:[{clock:n.openOn}],or:{name:"openOn",sid:"-8ll0dg"}}),cancelOn:effector.sample({and:[{clock:n.cancelOn||effector.createEvent({name:"clock",sid:"-4mp5og"})}],or:{name:"cancelOn",sid:"-lji6mv"}})}),a})(e),t=a.route,n=a.chainedRoute,o=a.beforeOpen,i=a.openOn,c=a.cancelOn,s=effector.createStore({},{name:"$params",sid:"ayygyi"}),d=effector.createStore({},{name:"$query",sid:"-uacyzw"}),u=effector.combine({and:[effector.combine({and:[[t.$params,t.$query]],or:{name:"and",sid:"3vqbxs"}}),effector.combine({and:[[s,d]],or:{name:"and",sid:"3wa4j5"}}),(e,r)=>e[0]===r[0]&&e[1]===r[1]],or:{name:"$hasSameParams",sid:"-nkydfl"}}),l=effector.sample({and:[{clock:[t.opened,t.updated]}],or:{name:"routeOpened",sid:"-gcvb85"}});effector.sample({and:[{clock:l,target:o}],or:{sid:"-nodu7s"}}),s.on(l,((e,r)=>r.params)),d.on(l,((e,r)=>r.query));var p=effector.guard({and:[{clock:i,source:{params:s,query:d},filter:u}],or:{name:"chainedRouteResolved",sid:"-mfd004"}});effector.sample({and:[{clock:p,target:n.navigate}],or:{sid:"-n68mmv"}});var f=effector.merge([t.closed,c],{name:"aborted",sid:"vaomxt"});return s.reset(f),d.reset(f),effector.sample({and:[{clock:f,target:n.closed}],or:{sid:"-mpqsu1"}}),n},e.createHistoryRouter=e=>{var r=e.base,a=e.routes,n=e.notFoundRoute,o=e.hydrate,s=e.serialize,d=e.controls,u=void 0===d?effector.withFactory({sid:"d2qzob",fn:()=>b(),name:"controls",method:"createRouterControls"}):d,l=((e,r)=>{void 0===r&&(r='');for(var a,n=[],o=()=>{var e,r=a.value;Array.isArray(r.route)?(e=n).push.apply(e,r.route.map((e=>t(t({},r),{},{route:e})))):n.push(r)},c=i(e);!(a=c()).done;)o();n=n.map((e=>t(t({},e),{},{path:""+r+e.path})));for(var s,d=[],u=[],l=i(n);!(s=l()).done;){var p=s.value;p.route.settings.derived?d.push(p):u.push(p)}if(d.length)for(var f,m=i(d);!(f=m()).done;)console.error("createHistoryRouter: "+f.value.path+" uses derived route. This won't work");return u})(a,r),p=effector.createEvent({name:"setHistory",sid:"9zwyxu"}),v=effector.createEvent({name:"navigateFromRouteTriggered",sid:"soge6d"}),y=effector.createEvent({name:"historyUpdated",sid:"-x4474u"}),g=effector.createEvent({name:"recalculateTriggered",sid:"-ykrhlj"}),x=effector.createEvent({name:"recalculated",sid:"aeh4sf"}),R=effector.createEvent({name:"routesMatched",sid:"2rfqt6"}),j=effector.createEvent({name:"routesMismatched",sid:"71hypl"}),$=effector.createEvent({name:"routeNotFound",sid:"avqxzu"}),P=effector.createEvent({name:"initialized",sid:"du6f0f"}),S=effector.createStore('',{name:"$path",sid:"wz8cwv"}),A=effector.createStore({},{and:{name:'historyRouter.$query',updateFilter:(e,r)=>!c(e,r)},name:"$query",sid:"tkdilp"}),T=effector.createStore([],{and:{serialize:'ignore'},name:"$activeRoutes",sid:"9ljm7u"}),F=effector.createStore(null,{and:{serialize:'ignore'},name:"$history",sid:"g4i7nj"}),C=effector.createStore(!1,{name:"$isFirstCheckPassed",sid:"9r108x"}),z=effector.createStore(!1,{name:"$isRouteNavigateInProgress",sid:"a1vtrl"}),D=effector.attach({and:{source:F,effect:(e,r)=>w(t({history:e},r))},or:{name:"pushFx",sid:"qm76ov"}}),N=effector.attach({and:{source:F,effect:e=>{var r=y;try{r=effector.scopeBind(y)}catch(e){}return e.listen((()=>{r()})),!0}},or:{name:"subscribeHistoryFx",sid:"-b12mlt"}}),U=effector.sample({and:[{clock:o?[y]:[y,N.done],source:F,filter:Boolean,fn:e=>{var r;return{path:e.location.pathname,query:null!==(r=null==s?void 0:s.read(e.location.search))&&void 0!==r?r:Object.fromEntries(new URLSearchParams(e.location.search))}}}],or:{name:"historyUpdatedParsed",sid:"-rhkauu"}}),H=effector.sample({and:[{clock:U,source:{path:S,query:A},filter:(e,r)=>r.path!==e.path||!c(r.query,e.query),fn:(e,r)=>r}],or:{name:"historyUpdateTriggered",sid:"-pbyg2j"}});F.on(p,((e,r)=>r)),effector.sample({and:[{clock:F,target:N}],or:{sid:"-pwl7u3"}}),effector.sample({and:[{clock:H,source:F,filter:Boolean,fn:e=>{var r,a=null==e?void 0:e.location.hash;return{path:null==e?void 0:e.location.pathname,query:null!==(r=null==s?void 0:s.read(null==e?void 0:e.location.search))&&void 0!==r?r:Object.fromEntries(new URLSearchParams(null==e?void 0:e.location.search)),hash:a}},target:g}],or:{sid:"-ptu8va"}});for(var M,I=i(l);!(M=I()).done;){var L=M.value,Q=R.filterMap(q(L)),B=j.filterMap(q(L)),_={opened:effector.sample({and:[{clock:Q,filter:h(L.route.$isOpened)}],or:{name:"opened",sid:"-vfmdab"}}),updated:effector.sample({and:[{clock:Q,filter:L.route.$isOpened}],or:{name:"updated",sid:"-2uhvx2"}}),closed:effector.sample({and:[{clock:B,filter:L.route.$isOpened}],or:{name:"closed",sid:"jc9588"}})};effector.sample({and:[{clock:_.updated,source:[L.route.$params,L.route.$query],filter:(e,r)=>{var a=e[1];return!c(e[0],r.params)||!c(a,r.query)},fn:(e,r)=>r,target:L.route.updated}],or:{sid:"-ny7ju5"}}),effector.sample({and:[{clock:_.opened,filter:h(z),target:L.route.opened}],or:{sid:"-ngm4ul"}}),effector.sample({and:[{clock:_.closed,target:L.route.closed}],or:{sid:"-d2q1d1"}})}for(var W,K=()=>{var e=W.value;effector.sample({and:[{clock:e.route.navigate.doneData,fn:r=>{var a=r.replace;return{route:e,params:r.params,query:r.query,replace:null!=a&&a}},target:v}],or:{sid:"-cm87k7"}})},G=i(l);!(W=G()).done;)K();z.on(v,(()=>!0)),effector.sample({and:[{clock:v,fn:e=>{var r=e.params,a=e.query,t=e.replace;return{path:f({pathCreator:e.route.path,params:r,query:a,serialize:s}),params:r,query:a,method:t?'replace':'push'}},target:D}],or:{sid:"-c2zeua"}}),z.reset([R,j]),effector.sample({and:[{clock:g,fn:e=>{for(var r,a=e.path,t=e.query,n=e.hash,o=[],c=[],s=i(l);!(r=s()).done;){var d=r.value,u=d.path.includes('#')?""+a+n:""+a,p=m({pathCreator:d.path,actualPath:u});(p.matches?o:c).push({routeObj:d,params:p.params,query:t})}return c.forEach(((e,r)=>{o.some((r=>r.routeObj.route===e.routeObj.route))&&c.splice(r,1)})),{matching:o,mismatching:c.filter(Boolean),path:a,query:t}},target:x}],or:{sid:"-ar5b7v"}}),S.on(H,((e,r)=>r.path)),A.on(H,((e,r)=>r.query));var J=x.map((e=>e.matching));return effector.sample({and:[{clock:J,filter:e=>e.length>0,target:R}],or:{sid:"1l4g7x"}}),effector.sample({and:[{clock:x.map((e=>e.mismatching)),filter:e=>e.length>0,target:j}],or:{sid:"1zyw8o"}}),T.on(x,((e,r)=>r.matching.map((e=>e.routeObj.route)))),effector.sample({and:[{clock:J,filter:e=>0===e.length,target:$}],or:{sid:"2hkb88"}}),effector.withFactory({sid:"2kv2vu",fn:()=>O(n),name:"none",method:"isRoute"})&&(effector.sample({and:[{clock:$,source:A,filter:n.$isOpened,fn:e=>({query:e,params:{}}),target:n.updated}],or:{sid:"2levfh"}}),effector.sample({and:[{clock:$,source:{query:A,isOpened:n.$isOpened},filter:e=>!e.isOpened,fn:e=>({query:e.query,params:{}}),target:n.opened}],or:{sid:"31cwmy"}}),effector.sample({and:[{clock:J,source:n.$isOpened,filter:(e,r)=>e&&r.length>0,target:n.closed}],or:{sid:"3haxuf"}})),effector.sample({and:[{clock:u.back,source:F,target:E}],or:{sid:"3xsrlj"}}),effector.sample({and:[{clock:u.forward,source:F,target:k}],or:{sid:"413j5p"}}),effector.sample({and:[{clock:A,source:{controlsQuery:u.$query,localQuery:A},filter:e=>!c(e.controlsQuery,e.localQuery),fn:e=>e.localQuery,target:u.$query}],or:{sid:"4ghrrt"}}),effector.sample({and:[{clock:u.$query,source:{path:S,localQuery:A,isNavigateInProgress:z,realHistory:F},filter:(e,r)=>{var a,t,n,o=e.localQuery,i=e.isNavigateInProgress,d=e.realHistory,u=null!==(a=null==s?void 0:s.read(null!==(t=null==d?void 0:d.location.search)&&void 0!==t?t:''))&&void 0!==a?a:Object.fromEntries(new URLSearchParams(null!==(n=null==d?void 0:d.location.search)&&void 0!==n?n:''));return i||!c(r,u)||!c(o,r)},fn:(e,r)=>{var a,t=e.path,n=null!==(a=null==s?void 0:s.write(r))&&void 0!==a?a:new URLSearchParams(r);return{path:t+(n?"?"+n:''),params:{},query:r,method:'push'}},target:D}],or:{sid:"4wzlkn"}}),effector.sample({and:[{clock:x,source:{activeRoutes:T,path:S,query:A},filter:C.map((e=>!e)),target:P}],or:{sid:"gbpwte"}}),C.on(P,(()=>!0)).reset(F),{$path:S,$activeRoutes:T,$history:F,setHistory:p,$query:A,back:u.back,forward:u.forward,push:D,routes:l,initialized:P,routeNotFound:$}},e.createRoute=r,e.createRouterControls=b,e.isRoute=O,e.matchPath=m,e.querySync=e=>{var r,a,n,o=null!==(r=null===(a=e.route)||void 0===a?void 0:a.$isOpened)&&void 0!==r?r:effector.createStore(!0,{name:"$isOpened",sid:"-ubx3p"}),c=effector.combine({and:[e.source],or:{name:"$source",sid:"-3rrhte"}}),s=null!==(n=e.clock)&&void 0!==n?n:c,d='cleanup'in e?'boolean'==typeof e.cleanup?x[e.cleanup?'all':'none']:t(t({},x.default),e.cleanup):x.default,u=effector.sample({and:[{clock:e.controls.$query,filter:o}],or:{name:"queryUpdatedFromHistory",sid:"8lf3wv"}});effector.sample({and:[{clock:s,source:effector.combine({and:[[c,e.controls.$query]],or:{name:"source",sid:"-3pgs50"}}),filter:o,fn:e=>{var r=e[0],a=e[1],n={};if(d.irrelevant)for(var o,c=i(d.preserve);!(o=c()).done;){var s=o.value;s in a&&(n[s]=a[s])}else n=t({},a);for(var u in r)n[u]=r[u];if(d.empty)for(var l in r)d.preserve.includes(l)||n[l]||delete n[l];return n},target:e.controls.$query}],or:{sid:"fuzb5g"}});var l=r=>{var a=e.source[r];a.on(u,((e,t)=>{var n;return null!==(n=t[r])&&void 0!==n?n:a.defaultState}))};for(var p in e.source)l(p)},e.redirect=e=>{var r=e.clock?effector.sample({and:[{clock:e.clock}],or:{name:"clock",sid:"-ek44ri"}}):effector.createEvent({name:"clock",sid:"-ejkc65"}),a=y(e.params||{}),t=y(e.query||{}),n=y(e.replace||!1);return effector.sample({and:[{clock:r,source:{params:a,query:t,replace:n},fn:(e,r)=>{var a=e.params,t=e.query,n=e.replace;return{params:'function'==typeof a?a(r):a,query:'function'==typeof t?t(r):t,replace:'function'==typeof n?n(r):n}},target:e.route.navigate}],or:{sid:"ahoqts"}}),r},Object.defineProperty(e,'__esModule',{value:!0})}));
//# sourceMappingURL=atomic-router.umd.js.map
{
"version": "0.8.0",
"version": "0.9.0",
"license": "MIT",

@@ -25,3 +25,3 @@ "main": "dist/atomic-router.cjs.js",

"peerDependencies": {
"effector": "^22",
"effector": "^22.8.8 || ^23",
"history": "^5.3.0"

@@ -46,6 +46,5 @@ },

"c8": "^7.12.0",
"effector": "^22",
"effector": "^23.0.0-rc.6",
"history": "^5.3.0",
"jsdom": "^20.0.0",
"patronum": "^1.12.2",
"prettier": "^2.7.1",

@@ -86,3 +85,3 @@ "query-string": "^7.1.1",

],
"packageManager": "pnpm@7.9.3"
"packageManager": "pnpm@8.11.0"
}

@@ -14,2 +14,4 @@ # Atomic Router

> โ—๏ธ **Attention**: At the moment atomic-router team collecting issues and feature requests to redesign and release update. Use current version of atomic-router on your own risk. We are going to write migration guide when/if the release will contain breaking changes. Thank you for reporting issues ๐Ÿงก
### Get view-library bindings

@@ -16,0 +18,0 @@

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with โšก๏ธ by Socket Inc