-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path2981-es2015.ce4838da9687c33ebe65.js
1 lines (1 loc) · 10.8 KB
/
2981-es2015.ce4838da9687c33ebe65.js
1
(self.webpackChunkv2x_frontend=self.webpackChunkv2x_frontend||[]).push([[2981],{2981:function(t,e,n){"use strict";n.r(e),n.d(e,{ion_route:function(){return a},ion_route_redirect:function(){return c},ion_router:function(){return L},ion_router_link:function(){return P}});var o=n(1429),r=n(1444),s=n(8931),i=n(4881);const a=class{constructor(t){(0,o.r)(this,t),this.ionRouteDataChanged=(0,o.e)(this,"ionRouteDataChanged",7),this.url=""}onUpdate(t){this.ionRouteDataChanged.emit(t)}onComponentProps(t,e){if(t===e)return;const n=t?Object.keys(t):[],o=e?Object.keys(e):[];if(n.length===o.length){for(const o of n)if(t[o]!==e[o])return void this.onUpdate(t)}else this.onUpdate(t)}connectedCallback(){this.ionRouteDataChanged.emit()}static get watchers(){return{url:["onUpdate"],component:["onUpdate"],componentProps:["onComponentProps"]}}},c=class{constructor(t){(0,o.r)(this,t),this.ionRouteRedirectChanged=(0,o.e)(this,"ionRouteRedirectChanged",7)}propDidChange(){this.ionRouteRedirectChanged.emit()}connectedCallback(){this.ionRouteRedirectChanged.emit()}static get watchers(){return{from:["propDidChange"],to:["propDidChange"]}}},h=t=>"/"+t.filter(t=>t.length>0).join("/"),l=t=>{let e,n=[""];if(null!=t){const o=t.indexOf("?");o>-1&&(e=t.substring(o+1),t=t.substring(0,o)),n=t.split("/").map(t=>t.trim()).filter(t=>t.length>0),0===n.length&&(n=[""])}return{segments:n,queryString:e}},u=async(t,e,n,o,s=!1,i)=>{try{const a=g(t);if(o>=e.length||!a)return s;await new Promise(t=>(0,r.c)(a,t));const c=e[o],h=await a.setRouteId(c.id,c.params,n,i);return h.changed&&(n="root",s=!0),s=await u(h.element,e,n,o+1,s,i),h.markVisible&&await h.markVisible(),s}catch(a){return console.error(a),!1}},f=":not([no-router]) ion-nav, :not([no-router]) ion-tabs, :not([no-router]) ion-router-outlet",g=t=>{if(!t)return;if(t.matches(f))return t;const e=t.querySelector(f);return null!=e?e:void 0},d=(t,e)=>e.find(e=>((t,e)=>{const{from:n,to:o}=e;if(void 0===o)return!1;if(n.length>t.length)return!1;for(let r=0;r<n.length;r++){const e=n[r];if("*"===e)return!0;if(e!==t[r])return!1}return n.length===t.length})(t,e)),m=(t,e)=>{const n=Math.min(t.length,e.length);let o=0;for(let r=0;r<n;r++){const n=t[r],s=e[r];if(n.id.toLowerCase()!==s.id)break;if(n.params){const t=Object.keys(n.params);if(t.length===s.segments.length){const e=t.map(t=>`:${t}`);for(let t=0;t<e.length&&e[t].toLowerCase()===s.segments[t];t++)o++}}o++}return o},p=(t,e)=>{const n=new y(t);let o,r=!1;for(let s=0;s<e.length;s++){const t=e[s].segments;if(""===t[0])r=!0;else{for(const e of t){const t=n.next();if(":"===e[0]){if(""===t)return null;o=o||[],(o[s]||(o[s]={}))[e.slice(1)]=t}else if(t!==e)return null}r=!1}}return r&&r!==(""===n.next())?null:o?e.map((t,e)=>({id:t.id,segments:t.segments,params:w(t.params,o[e]),beforeEnter:t.beforeEnter,beforeLeave:t.beforeLeave})):e},w=(t,e)=>t||e?Object.assign(Object.assign({},t),e):void 0,b=(t,e)=>{let n=null,o=0;for(const r of e){const e=p(t,r);if(null!==e){const t=v(e);t>o&&(o=t,n=e)}}return n},v=t=>{let e=1,n=1;for(const o of t)for(const t of o.segments)":"===t[0]?e+=Math.pow(1,n):""!==t&&(e+=Math.pow(2,n)),n++;return e};class y{constructor(t){this.segments=t.slice()}next(){return this.segments.length>0?this.segments.shift():""}}const R=(t,e)=>e in t?t[e]:t.hasAttribute(e)?t.getAttribute(e):null,C=t=>Array.from(t.children).filter(t=>"ION-ROUTE-REDIRECT"===t.tagName).map(t=>{const e=R(t,"to");return{from:l(R(t,"from")).segments,to:null==e?void 0:l(e)}}),S=t=>E(k(t)),k=t=>Array.from(t.children).filter(t=>"ION-ROUTE"===t.tagName&&t.component).map(t=>{const e=R(t,"component");return{segments:l(R(t,"url")).segments,id:e.toLowerCase(),params:t.componentProps,beforeLeave:t.beforeLeave,beforeEnter:t.beforeEnter,children:k(t)}}),E=t=>{const e=[];for(const n of t)D([],e,n);return e},D=(t,e,n)=>{if(t=[...t,{id:n.id,segments:n.segments,params:n.params,beforeLeave:n.beforeLeave,beforeEnter:n.beforeEnter}],0!==n.children.length)for(const o of n.children)D(t,e,o);else e.push(t)},L=class{constructor(t){(0,o.r)(this,t),this.ionRouteWillChange=(0,o.e)(this,"ionRouteWillChange",7),this.ionRouteDidChange=(0,o.e)(this,"ionRouteDidChange",7),this.previousPath=null,this.busy=!1,this.state=0,this.lastState=0,this.root="/",this.useHash=!0}async componentWillLoad(){await(g(document.body)?Promise.resolve():new Promise(t=>{window.addEventListener("ionNavWillLoad",()=>t(),{once:!0})}));const t=await this.runGuards(this.getSegments());if(!0!==t){if("object"==typeof t){const{redirect:e}=t,n=l(e);this.setSegments(n.segments,"root",n.queryString),await this.writeNavStateRoot(n.segments,"root")}}else await this.onRoutesChanged()}componentDidLoad(){window.addEventListener("ionRouteRedirectChanged",(0,r.q)(this.onRedirectChanged.bind(this),10)),window.addEventListener("ionRouteDataChanged",(0,r.q)(this.onRoutesChanged.bind(this),100))}async onPopState(){const t=this.historyDirection();let e=this.getSegments();const n=await this.runGuards(e);if(!0!==n){if("object"!=typeof n)return!1;e=l(n.redirect).segments}return this.writeNavStateRoot(e,t)}onBackButton(t){t.detail.register(0,t=>{this.back(),t()})}async canTransition(){const t=await this.runGuards();return!0===t||"object"==typeof t&&t.redirect}async push(t,e="forward",n){var o;if(t.startsWith(".")){const e=null!==(o=this.previousPath)&&void 0!==o?o:"/",n=new URL(t,`https://host/${e}`);t=n.pathname+n.search}let r=l(t);const s=await this.runGuards(r.segments);if(!0!==s){if("object"!=typeof s)return!1;r=l(s.redirect)}return this.setSegments(r.segments,e,r.queryString),this.writeNavStateRoot(r.segments,e,n)}back(){return window.history.back(),Promise.resolve(this.waitPromise)}async printDebug(){(t=>{console.group(`[ion-core] ROUTES[${t.length}]`);for(const e of t){const t=[];e.forEach(e=>t.push(...e.segments));const n=e.map(t=>t.id);console.debug(`%c ${h(t)}`,"font-weight: bold; padding-left: 20px","=>\t",`(${n.join(", ")})`)}console.groupEnd()})(S(this.el)),(t=>{console.group(`[ion-core] REDIRECTS[${t.length}]`);for(const e of t)e.to&&console.debug("FROM: ",`$c ${h(e.from)}`,"font-weight: bold"," TO: ",`$c ${h(e.to.segments)}`,"font-weight: bold");console.groupEnd()})(C(this.el))}async navChanged(t){if(this.busy)return console.warn("[ion-router] router is busy, navChanged was cancelled"),!1;const{ids:e,outlet:n}=await(async t=>{const e=[];let n,o=window.document.body;for(;n=g(o);){const t=await n.getRouteId();if(!t)break;o=t.element,t.element=void 0,e.push(t)}return{ids:e,outlet:n}})(),o=((t,e)=>{let n=null,o=0;for(const r of e){const e=m(t,r);e>o&&(n=r,o=e)}return n?n.map((e,n)=>{var o;return{id:e.id,segments:e.segments,params:w(e.params,null===(o=t[n])||void 0===o?void 0:o.params)}}):null})(e,S(this.el));if(!o)return console.warn("[ion-router] no matching URL for ",e.map(t=>t.id)),!1;const r=(t=>{const e=[];for(const n of t)for(const t of n.segments)if(":"===t[0]){const o=n.params&&n.params[t.slice(1)];if(!o)return null;e.push(o)}else""!==t&&e.push(t);return e})(o);return r?(this.setSegments(r,t),await this.safeWriteNavState(n,o,"root",r,null,e.length),!0):(console.warn("[ion-router] router could not match path because some required param is missing"),!1)}onRedirectChanged(){const t=this.getSegments();t&&d(t,C(this.el))&&this.writeNavStateRoot(t,"root")}onRoutesChanged(){return this.writeNavStateRoot(this.getSegments(),"root")}historyDirection(){var t;const e=window;null===e.history.state&&(this.state++,e.history.replaceState(this.state,e.document.title,null===(t=e.document.location)||void 0===t?void 0:t.href));const n=e.history.state,o=this.lastState;return this.lastState=n,n>o||n>=o&&o>0?"forward":n<o?"back":"root"}async writeNavStateRoot(t,e,n){if(!t)return console.error("[ion-router] URL is not part of the routing set"),!1;const o=C(this.el),r=d(t,o);let s=null;if(r){const{segments:n,queryString:o}=r.to;this.setSegments(n,e,o),s=r.from,t=n}const i=S(this.el),a=b(t,i);return a?this.safeWriteNavState(document.body,a,e,t,s,0,n):(console.error("[ion-router] the path does not match any route"),!1)}async safeWriteNavState(t,e,n,o,r,s=0,i){const a=await this.lock();let c=!1;try{c=await this.writeNavState(t,e,n,o,r,s,i)}catch(h){console.error(h)}return a(),c}async lock(){const t=this.waitPromise;let e;return this.waitPromise=new Promise(t=>e=t),void 0!==t&&await t,e}async runGuards(t=this.getSegments(),e){if(void 0===e&&(e=l(this.previousPath).segments),!t||!e)return!0;const n=S(this.el),o=b(e,n),r=o&&o[o.length-1].beforeLeave,s=!r||await r();if(!1===s||"object"==typeof s)return s;const i=b(t,n),a=i&&i[i.length-1].beforeEnter;return!a||a()}async writeNavState(t,e,n,o,r,s=0,i){if(this.busy)return console.warn("[ion-router] router is busy, transition was cancelled"),!1;this.busy=!0;const a=this.routeChangeEvent(o,r);a&&this.ionRouteWillChange.emit(a);const c=await u(t,e,n,s,!1,i);return this.busy=!1,a&&this.ionRouteDidChange.emit(a),c}setSegments(t,e,n){this.state++,((t,e,n,o,r,s,i)=>{const a=((t,e,n)=>{let o=h(t);return e&&(o="#"+o),void 0!==n&&(o+="?"+n),o})([...l(this.root).segments,...o],n,i);"forward"===r?t.pushState(s,"",a):t.replaceState(s,"",a)})(window.history,0,this.useHash,t,e,this.state,n)}getSegments(){return((t,e,n)=>{const o=l(this.root).segments,r=n?t.hash.slice(1):t.pathname;return((t,e)=>{if(t.length>e.length)return null;if(t.length<=1&&""===t[0])return e;for(let n=0;n<t.length;n++)if(t[n]!==e[n])return null;return e.length===t.length?[""]:e.slice(t.length)})(o,l(r).segments)})(window.location,0,this.useHash)}routeChangeEvent(t,e){const n=this.previousPath,o=h(t);return this.previousPath=o,o===n?null:{from:n,redirectedFrom:e?h(e):null,to:o}}get el(){return(0,o.i)(this)}},P=class{constructor(t){(0,o.r)(this,t),this.routerDirection="forward",this.onClick=t=>{(0,i.o)(this.href,t,this.routerDirection,this.routerAnimation)}}render(){const t=(0,s.b)(this),e={href:this.href,rel:this.rel,target:this.target};return(0,o.h)(o.H,{onClick:this.onClick,class:(0,i.c)(this.color,{[t]:!0,"ion-activatable":!0})},(0,o.h)("a",Object.assign({},e),(0,o.h)("slot",null)))}};P.style=":host{--background:transparent;--color:var(--ion-color-primary, #3880ff);background:var(--background);color:var(--color)}:host(.ion-color){color:var(--ion-color-base)}a{font-family:inherit;font-size:inherit;font-style:inherit;font-weight:inherit;letter-spacing:inherit;text-decoration:inherit;text-indent:inherit;text-overflow:inherit;text-transform:inherit;text-align:inherit;white-space:inherit;color:inherit}"},4881:function(t,e,n){"use strict";n.d(e,{c:function(){return r},g:function(){return s},h:function(){return o},o:function(){return a}});const o=(t,e)=>null!==e.closest(t),r=(t,e)=>"string"==typeof t&&t.length>0?Object.assign({"ion-color":!0,[`ion-color-${t}`]:!0},e):e,s=t=>{const e={};return(t=>void 0!==t?(Array.isArray(t)?t:t.split(" ")).filter(t=>null!=t).map(t=>t.trim()).filter(t=>""!==t):[])(t).forEach(t=>e[t]=!0),e},i=/^[a-z][a-z0-9+\-.]*:/,a=async(t,e,n,o)=>{if(null!=t&&"#"!==t[0]&&!i.test(t)){const r=document.querySelector("ion-router");if(r)return null!=e&&e.preventDefault(),r.push(t,n,o)}return!1}}}]);