UNPKG

jenesius-vue-modal

Version:

The progressive and simple modal system for Vue.js v3

8 lines (7 loc) 21.9 kB
(function(){"use strict";try{if(typeof document<"u"){var e=document.createElement("style");e.appendChild(document.createTextNode(".modal-container{position:fixed;left:0;top:0;height:100%;width:100%;display:flex;align-items:center;justify-content:center;background-color:#3e3e3e21;cursor:pointer}.modal-item{cursor:default}.modal-list-enter-active,.modal-list-leave-active,.modal-list-enter-active .modal-item,.modal-list-leave-active .modal-item{transition:all .2s ease}.modal-list-enter-from,.modal-list-leave-to{opacity:0!important}.modal-list-enter-from .modal-item,.modal-list-leave-to .modal-item{transform:translateY(-60px)}")),document.head.appendChild(e)}}catch(t){console.error("vite-plugin-css-injected-by-js",t)}})(); (function(m,f){typeof exports=="object"&&typeof module<"u"?f(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],f):(m=typeof globalThis<"u"?globalThis:m||self,f(m.JenesiusVueModal={},m.Vue))})(this,function(m,f){"use strict";/*! * jenesius-vue-modal v1.11.9 * (c) 2024 Jenesius * @license MIT */var D=function(n,e){return D=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,r){t.__proto__=r}||function(t,r){for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(t[i]=r[i])},D(n,e)};function re(n,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");D(n,e);function t(){this.constructor=n}n.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}function _(n,e,t,r){function i(o){return o instanceof t?o:new t(function(l){l(o)})}return new(t||(t=Promise))(function(o,l){function h(a){try{s(r.next(a))}catch(u){l(u)}}function c(a){try{s(r.throw(a))}catch(u){l(u)}}function s(a){a.done?o(a.value):i(a.value).then(h,c)}s((r=r.apply(n,e||[])).next())})}function F(n,e){var t={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},r,i,o,l;return l={next:h(0),throw:h(1),return:h(2)},typeof Symbol=="function"&&(l[Symbol.iterator]=function(){return this}),l;function h(s){return function(a){return c([s,a])}}function c(s){if(r)throw new TypeError("Generator is already executing.");for(;l&&(l=0,s[0]&&(t=0)),t;)try{if(r=1,i&&(o=s[0]&2?i.return:s[0]?i.throw||((o=i.return)&&o.call(i),0):i.next)&&!(o=o.call(i,s[1])).done)return o;switch(i=0,o&&(s=[s[0]&2,o.value]),s[0]){case 0:case 1:o=s;break;case 4:return t.label++,{value:s[1],done:!1};case 5:t.label++,i=s[1],s=[0];continue;case 7:s=t.ops.pop(),t.trys.pop();continue;default:if(o=t.trys,!(o=o.length>0&&o[o.length-1])&&(s[0]===6||s[0]===2)){t=0;continue}if(s[0]===3&&(!o||s[1]>o[0]&&s[1]<o[3])){t.label=s[1];break}if(s[0]===6&&t.label<o[1]){t.label=o[1],o=s;break}if(o&&t.label<o[2]){t.label=o[2],t.ops.push(s);break}o[2]&&t.ops.pop(),t.trys.pop();continue}s=e.call(n,t)}catch(a){s=[6,a],i=0}finally{r=o=0}if(s[0]&5)throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}}typeof SuppressedError=="function"&&SuppressedError;var p=function(n){re(e,n);function e(t,r){r===void 0&&(r=null);var i=n.call(this)||this;return i.isModalError=!0,i.message=t,i.details=r,i}return e.Undefined=function(t){return new e("Modal with id: ".concat(t," not founded. The modal window may have been closed earlier."))},e.UndefinedGuardName=function(t){return new e("Guard's name ".concat(t," is not declaration."))},e.NextReject=function(t){return new e("Guard returned false. Modal navigation was stopped. Modal id ".concat(t))},e.GuardDeclarationType=function(t){return new e("Guard's type should be a function. Provided:",t)},e.RejectedByBeforeEach=function(){return new e("The opening of the modal was stopped in beforeEach")},e.ConfigurationType=function(t){return new e("Configuration type must be an Object. Provided",t)},e.ConfigurationUndefinedParam=function(t,r){return new e("In configuration founded unknown parameter: ".concat(t,". Available are ").concat(r.join(", ")," "))},e.QueueNoEmpty=function(){return new e("Modal's queue is not empty. Probably some modal reject closing by onClose hook.")},e.EmptyModalQueue=function(){return new e("Modal queue is empty.")},e.NotInitialized=function(t){return new e("Modal Container not found. Put container from jenesius-vue-modal in App's template. Namespace: ".concat(t,". Check documentation for more information https://modal.jenesius.com/docs.html/installation#getting-started."))},e.ModalComponentNotProvided=function(){return new e("The first parameter(VueComponent) was not specified.")},e.DuplicatedRouterIntegration=function(){return new e("useModalRouter.init should escaped only once.")},e.ModalRouterIntegrationNotInitialized=function(){return new e("The integration was not initialized. Please, use useModalRouter.init(router). For more information: https://modal.jenesius.com/docs.html/integration-vue-router#installation")},e.ModalEventNameMustBeString=function(t){return new e("Event name must be a string. Provided: ".concat(t))},e.ModalNotFoundByID=function(t){return new e("Modal with ID ".concat(t," was not found."))},e.ModalNotExistsInStore=function(t){return new e("Provided name(".concat(t,") don't exist in the store. Has the given name been added to the store?"))},e}(Error),S=function(){function n(){this.state=new Map,n.instance=this}return n.prototype.getByName=function(e){return e===void 0&&(e=n.DEFAULT_NAMESPACE),this.state.has(e)||this.state.set(e,{queue:f.reactive([]),initialized:!1}),this.state.get(e)},n.prototype.forceClean=function(){this.state.forEach(function(e){e.queue.splice(0,e.queue.length)})},n.DEFAULT_NAMESPACE="default",n}(),z=function(){var n=new S,e={scrollLock:!0,animation:"modal-list",backgroundClose:!0,escClose:!0,store:{},skipInitCheck:!1,draggable:!1,appear:!0,singleShow:!1,beforeEach:function(){}},t=n.getByName().queue;return f.watch(function(){return t},function(){e.scrollLock&&(t.length?document.body.style.overflowY="hidden":document.body.style.overflowY="auto")},{deep:!0}),{namespaceStore:n,configuration:e}}();function b(n){return z.namespaceStore.getByName(n)}var y=z.configuration;function oe(n){return!!n&&typeof n=="object"&&!!n.component}function U(n){var e={backgroundClose:y.backgroundClose,isRoute:!1,namespace:S.DEFAULT_NAMESPACE,draggable:y.draggable};return n.backgroundClose!==void 0&&(e.backgroundClose=n.backgroundClose),n.isRoute&&(e.isRoute=n.isRoute),n.namespace&&(e.namespace=n.namespace),n.draggable!==void 0&&(e.draggable=n.draggable),e}function G(n){n===void 0&&(n={});var e={background:!1,esc:!1};return Object.assign(e,n)}function Q(n){return n||(n={}),n}function T(n,e){e===void 0&&(e={});var t=A.STORE.get(n);if(!t)return Promise.reject(p.ModalNotFoundByID(n));var r=b(t.namespace),i=r.queue.findIndex(function(l){return l.id===n});if(i===-1)return Promise.reject(p.Undefined(n));var o=M.get(n,"close").map(function(l){return ae(l,n,G(e))});return X(o).then(function(){r.queue.splice(i,1)}).then(function(){M.get(n,"destroy").forEach(function(l){return l(G(e))})}).then(function(){M.delete(n)})}var A=function(){function n(e,t,r){var i=this;this.events=f.reactive({}),this.backgroundClose=!0,this.isRoute=!1,this.id=n.modalId++,this.component=e,this.props=f.ref(t),this.closed=f.computed(function(){return!b(r.namespace).queue.includes(i)}),e.beforeModalClose&&M.add(this.id,"close",e.beforeModalClose);var o=U(r);this.backgroundClose=o.backgroundClose,this.isRoute=o.isRoute,this.namespace=o.namespace,this.draggable=o.draggable,n.STORE.set(this.id,this)}return n.prototype.close=function(){return T(this.id)},Object.defineProperty(n.prototype,"onclose",{set:function(e){M.add(this.id,"close",e)},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"ondestroy",{set:function(e){M.add(this.id,"destroy",e)},enumerable:!1,configurable:!0}),n.prototype.on=function(e,t){var r=this;return Array.isArray(this.events[e])||(this.events[e]=[]),this.events[e].push(t),function(){var i=r.events[e].indexOf(t);i!==-1&&r.events[e].splice(i,1)}},n.STORE=new Map,n.modalId=0,n.EVENT_PROMPT="jenesius-vue-modal:____P____R____O____M____P____T",n}();function Y(n){return A.STORE.get(n)}var ie={store:{},add:function(n,e,t){var r,i;if(typeof t!="function")throw p.GuardDeclarationType(t);this.store[n]||(this.store[n]=(r={},r[e]=[],r)),this.store[n][e]||(this.store[n][e]=[]),(i=this.store[n][e])===null||i===void 0||i.push(t)},get:function(n,e){return n in this.store?e in this.store[n]?this.store[n][e]||[]:[]:[]},delete:function(n){n in this.store&&delete this.store[n]}};const M=ie;function X(n){return n.reduce(function(e,t){return e.then(function(){return t()})},Promise.resolve())}function ae(n,e,t){return function(){return new Promise(function(r,i){var o,l=function(h){h===void 0&&(h=!0),h===!1&&i(p.NextReject(e)),r()};Promise.resolve(n.call((o=Y(e))===null||o===void 0?void 0:o.instance,t)).then(l).catch(function(h){return i(h)})})}}function W(n){return n=Q(n),X(b(n.namespace).queue.map(function(e){return function(){return e.close()}}))}function B(n){var e=b(n),t=e.queue;if(t.length!==0)return t[t.length-1]}function ue(n){n=Q(n);var e=B(n.namespace);return e?e.close():Promise.resolve()}function se(n,e,t){return _(this,void 0,void 0,function(){var r,i,o,l,h;return F(this,function(c){switch(c.label){case 0:if(r=U(t),i=b(r.namespace),r.namespace===S.DEFAULT_NAMESPACE&&!i.initialized&&!y.skipInitCheck)throw p.NotInitialized(r.namespace);return[4,y.beforeEach()];case 1:if(c.sent()===!1)throw p.RejectedByBeforeEach();if(typeof n!="string")return[3,5];if(o=H(n),!o)throw p.ModalNotExistsInStore(n);return oe(o)?(n=o.component,Object.assign(r,o),l=o.beforeEach,l?[4,o.beforeEach()]:[3,3]):[3,4];case 2:l=c.sent()===!1,c.label=3;case 3:if(l)throw p.RejectedByBeforeEach();return[3,5];case 4:n=o,c.label=5;case 5:if(!n)throw p.ModalComponentNotProvided();return h=new A(n,e,r),i.queue.push(f.markRaw(h)),[2,h]}})})}function q(n,e,t){return e===void 0&&(e={}),t===void 0&&(t={}),Promise.resolve().then(function(){return se(n,e,t)})}function J(n,e,t){return e===void 0&&(e={}),t===void 0&&(t={}),W({namespace:t.namespace}).then(function(){var r=b(t.namespace);if(r.queue.length)throw p.QueueNoEmpty()}).then(function(){return q(n,e,t)})}function ce(n){if(typeof n!="object")throw p.ConfigurationType(n);Object.assign(y,n)}function le(n){var e,t,r,i=f.getCurrentInstance(),o=String(((e=i==null?void 0:i.props)===null||e===void 0?void 0:e.modalId)||((t=i==null?void 0:i.props)===null||t===void 0?void 0:t["modal-id"])||((r=i==null?void 0:i.attrs)===null||r===void 0?void 0:r.modalId)),l=o.replace(/[^0-9]/g,"");M.add(Number(l),"close",n)}function de(n,e,t){return e===void 0&&(e={}),t===void 0&&(t={}),_(this,void 0,void 0,function(){var r,i,o=this;return F(this,function(l){switch(l.label){case 0:return[4,q(n,e,t)];case 1:return r=l.sent(),i=!1,[2,new Promise(function(h){r.on(A.EVENT_PROMPT,function(c){return _(o,void 0,void 0,function(){return F(this,function(s){return i=!0,[2,r.close().then(function(){return h(c)}).catch(function(){return i=!1})]})})}),r.ondestroy=function(){i||h(null)}})]}})})}function H(n){return y.store[n]||void 0}function fe(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var L={exports:{}},$,V;function he(){if(V)return $;V=1;var n=1e3,e=n*60,t=e*60,r=t*24,i=r*7,o=r*365.25;$=function(a,u){u=u||{};var d=typeof a;if(d==="string"&&a.length>0)return l(a);if(d==="number"&&isFinite(a))return u.long?c(a):h(a);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(a))};function l(a){if(a=String(a),!(a.length>100)){var u=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(a);if(u){var d=parseFloat(u[1]),v=(u[2]||"ms").toLowerCase();switch(v){case"years":case"year":case"yrs":case"yr":case"y":return d*o;case"weeks":case"week":case"w":return d*i;case"days":case"day":case"d":return d*r;case"hours":case"hour":case"hrs":case"hr":case"h":return d*t;case"minutes":case"minute":case"mins":case"min":case"m":return d*e;case"seconds":case"second":case"secs":case"sec":case"s":return d*n;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return d;default:return}}}}function h(a){var u=Math.abs(a);return u>=r?Math.round(a/r)+"d":u>=t?Math.round(a/t)+"h":u>=e?Math.round(a/e)+"m":u>=n?Math.round(a/n)+"s":a+"ms"}function c(a){var u=Math.abs(a);return u>=r?s(a,u,r,"day"):u>=t?s(a,u,t,"hour"):u>=e?s(a,u,e,"minute"):u>=n?s(a,u,n,"second"):a+" ms"}function s(a,u,d,v){var k=u>=d*1.5;return Math.round(a/d)+" "+v+(k?"s":"")}return $}function me(n){t.debug=t,t.default=t,t.coerce=c,t.disable=o,t.enable=i,t.enabled=l,t.humanize=he(),t.destroy=s,Object.keys(n).forEach(a=>{t[a]=n[a]}),t.names=[],t.skips=[],t.formatters={};function e(a){let u=0;for(let d=0;d<a.length;d++)u=(u<<5)-u+a.charCodeAt(d),u|=0;return t.colors[Math.abs(u)%t.colors.length]}t.selectColor=e;function t(a){let u,d=null,v,k;function C(...g){if(!C.enabled)return;const w=C,P=Number(new Date),O=P-(u||P);w.diff=O,w.prev=u,w.curr=P,u=P,g[0]=t.coerce(g[0]),typeof g[0]!="string"&&g.unshift("%O");let E=0;g[0]=g[0].replace(/%([a-zA-Z%])/g,(R,I)=>{if(R==="%%")return"%";E++;const j=t.formatters[I];if(typeof j=="function"){const x=g[E];R=j.call(w,x),g.splice(E,1),E--}return R}),t.formatArgs.call(w,g),(w.log||t.log).apply(w,g)}return C.namespace=a,C.useColors=t.useColors(),C.color=t.selectColor(a),C.extend=r,C.destroy=t.destroy,Object.defineProperty(C,"enabled",{enumerable:!0,configurable:!1,get:()=>d!==null?d:(v!==t.namespaces&&(v=t.namespaces,k=t.enabled(a)),k),set:g=>{d=g}}),typeof t.init=="function"&&t.init(C),C}function r(a,u){const d=t(this.namespace+(typeof u>"u"?":":u)+a);return d.log=this.log,d}function i(a){t.save(a),t.namespaces=a,t.names=[],t.skips=[];let u;const d=(typeof a=="string"?a:"").split(/[\s,]+/),v=d.length;for(u=0;u<v;u++)d[u]&&(a=d[u].replace(/\*/g,".*?"),a[0]==="-"?t.skips.push(new RegExp("^"+a.slice(1)+"$")):t.names.push(new RegExp("^"+a+"$")))}function o(){const a=[...t.names.map(h),...t.skips.map(h).map(u=>"-"+u)].join(",");return t.enable(""),a}function l(a){if(a[a.length-1]==="*")return!0;let u,d;for(u=0,d=t.skips.length;u<d;u++)if(t.skips[u].test(a))return!1;for(u=0,d=t.names.length;u<d;u++)if(t.names[u].test(a))return!0;return!1}function h(a){return a.toString().substring(2,a.toString().length-2).replace(/\.\*\?$/,"*")}function c(a){return a instanceof Error?a.stack||a.message:a}function s(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}return t.enable(t.load()),t}var ge=me;(function(n,e){e.formatArgs=r,e.save=i,e.load=o,e.useColors=t,e.storage=l(),e.destroy=(()=>{let c=!1;return()=>{c||(c=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),e.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function t(){return typeof window<"u"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs)?!0:typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)?!1:typeof document<"u"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window<"u"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function r(c){if(c[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+c[0]+(this.useColors?"%c ":" ")+"+"+n.exports.humanize(this.diff),!this.useColors)return;const s="color: "+this.color;c.splice(1,0,s,"color: inherit");let a=0,u=0;c[0].replace(/%[a-zA-Z%]/g,d=>{d!=="%%"&&(a++,d==="%c"&&(u=a))}),c.splice(u,0,s)}e.log=console.debug||console.log||(()=>{});function i(c){try{c?e.storage.setItem("debug",c):e.storage.removeItem("debug")}catch{}}function o(){let c;try{c=e.storage.getItem("debug")}catch{}return!c&&typeof process<"u"&&"env"in process&&(c=process.env.DEBUG),c}function l(){try{return localStorage}catch{}}n.exports=ge(e);const{formatters:h}=n.exports;h.j=function(c){try{return JSON.stringify(c)}catch(s){return"[UnexpectedJSONParseError]: "+s.message}}})(L,L.exports);var pe=L.exports;const Ce=fe(pe);function ve(n){return Ce("jenesius-vue-modal:".concat(n))}const ye=["onPointerdown"],Z=f.defineComponent({__name:"WidgetModalContainerItem",props:{id:{},show:{type:Boolean}},setup(n){const e=ve("modal-item"),t=n,r=Y(t.id),i=f.ref(),o=f.ref();function l(){if(r.backgroundClose)return T(r.id,{background:!0}).catch(()=>{})}f.watch(()=>o.value,c=>{var s;if(r.instance=c,e(`Modal(${r.id}) instance is saved.`),r.draggable){const a=`[modalid=_modal_${t.id}]`,u=typeof r.draggable=="string"?r.draggable:a;e(`The modal window is movable(${u}).`),i.value?(e("Finding an item to drag: %s",u),h((s=i.value)==null?void 0:s.querySelector(a),i.value.querySelector(u))):e("The modal container is not mounted. Modal id %d.",r.id)}}),f.onMounted(()=>{e(`Modal(${r.id}) is mounted`)});function h(c,s){if(!s){e("draggable item not found.");return}if(!c){e("HTML modal is not founded.");return}s.addEventListener("pointerdown",a=>{var R;const u=(R=c.getAttribute("style"))==null?void 0:R.match(/transform: translate\((.*)px,\s*(.*)px\)/),d=u==null?void 0:u[1],v=u==null?void 0:u[2];let k=typeof d=="string"?Number.parseInt(d):0,C=typeof v=="string"?Number.parseInt(v):0;const{clientX:g,clientY:w}=a,P=g,O=w;e(`movement started at (${O}, ${O})`),document.addEventListener("pointermove",E,{passive:!0}),document.addEventListener("pointerup",ee,{once:!0});function E(I){const{clientX:j,clientY:x}=I,te=k+j-P,ne=C+x-O;e(`move at (${te}, ${ne})`),c.style.transform=`translate(${te}px,${ne}px)`}function ee(I){e("movement completed"),document.removeEventListener("pointermove",E),I.preventDefault()}})}return(c,s)=>f.withDirectives((f.openBlock(),f.createElementBlock("div",{class:"widget__modal-container__item modal-container",onPointerdown:f.withModifiers(l,["self","stop"]),ref_key:"modalContainerRef",ref:i},[(f.openBlock(),f.createBlock(f.resolveDynamicComponent(f.unref(r).component),f.mergeProps(f.unref(r).props.value,{class:"modal-item widget__modal-wrap",modalId:`_modal_${c.id}`,ref_key:"modalRef",ref:o},f.toHandlers(f.unref(r).events)),null,16,["modalId"]))],40,ye)),[[f.vShow,c.show]])}}),Ee="";function be(n){n===void 0&&(n=S.DEFAULT_NAMESPACE);var e=S.instance.getByName(n);e.initialized=!0,n===S.DEFAULT_NAMESPACE&&document.addEventListener("keyup",function(t){if(y.escClose&&(t.key==="Escape"||t.code==="Escape")){var r=B(n);if(!r)return;T(r.id,{esc:!0}).catch(function(){})}})}const Se="",we={props:{namespace:String},setup(n){return f.onMounted(()=>{be(n.namespace)}),()=>{const e=b(n.namespace);return f.h(f.TransitionGroup,{name:y.animation,tag:"div",appear:y.appear},{default:()=>e.queue.map((t,r,i)=>f.h(Z,{key:t.id,id:t.id,show:y.singleShow===!0?r===i.length-1:!0}))})}},components:{WidgetContainerModalItem:Z}};var N={router:null};function _e(n){var e=this;if(N.router)throw p.DuplicatedRouterIntegration();N.router=n;function t(r){for(var i=r.matched.length-1;i>=0;i--){var o=r.matched[i].components,l=Object.values(o).find(function(h){return h._isModal});if(l)return l}return null}n.beforeEach(function(r,i){return _(e,void 0,void 0,function(){var o,l,h;return F(this,function(c){switch(c.label){case 0:return c.trys.push([0,3,,4]),o=t(i),o&&!(!((h=(l=o.getModalObject())===null||l===void 0?void 0:l.closed)===null||h===void 0)&&h.value)?[4,o.close(!0)]:[3,2];case 1:c.sent(),c.label=2;case 2:return[3,4];case 3:return c.sent(),[2,!1];case 4:return[2]}})})}),n.afterEach(function(r){return _(e,void 0,void 0,function(){var i;return F(this,function(o){switch(o.label){case 0:return i=t(r),i?[4,i.initialize()]:[3,2];case 1:o.sent(),o.label=2;case 2:return[2]}})})})}function K(n){var e=null,t=!1;function r(){return _(this,void 0,void 0,function(){return F(this,function(i){switch(i.label){case 0:if(!N.router)throw p.ModalRouterIntegrationNotInitialized();return t=!1,e=null,[4,J(n,f.computed(function(){var o;return(o=N.router)===null||o===void 0?void 0:o.currentRoute.value.params}),{isRoute:!0})];case 1:return e=i.sent(),e.onclose=function(){var o;t||(o=N.router)===null||o===void 0||o.back()},[2]}})})}return{getModalObject:function(){return e},_isModal:!0,close:function(i){return i===void 0&&(i=!1),_(this,void 0,void 0,function(){return F(this,function(o){switch(o.label){case 0:return t=i,e?[4,e.close()]:[3,2];case 1:return[2,o.sent()];case 2:return[2]}})})},initialize:r,setup:function(){return function(){return null}}}}K.init=_e;var Fe=b().queue;function Me(n){return b(n).queue}m.Modal=A,m.closeById=T,m.closeModal=W,m.config=ce,m.container=we,m.getComponentFromStore=H,m.getCurrentModal=B,m.getQueueByNamespace=Me,m.modalQueue=Fe,m.onBeforeModalClose=le,m.openModal=J,m.popModal=ue,m.promptModal=de,m.pushModal=q,m.useModalRouter=K,Object.defineProperty(m,Symbol.toStringTag,{value:"Module"})}); //# sourceMappingURL=jenesius-vue-modal.umd.js.map