jenesius-vue-modal
Advanced tools
Comparing version 1.11.6 to 1.11.7
(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)}})(); | ||
"use strict";/*! | ||
* jenesius-vue-modal v1.11.6 | ||
* jenesius-vue-modal v1.11.7 | ||
* (c) 2024 Jenesius | ||
* @license MIT | ||
*/Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const m=require("vue");var D=function(n,e){return D=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,r){t.__proto__=r}||function(t,r){for(var a in r)Object.prototype.hasOwnProperty.call(r,a)&&(t[a]=r[a])},D(n,e)};function ne(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 S(n,e,t,r){function a(i){return i instanceof t?i:new t(function(l){l(i)})}return new(t||(t=Promise))(function(i,l){function f(o){try{s(r.next(o))}catch(u){l(u)}}function c(o){try{s(r.throw(o))}catch(u){l(u)}}function s(o){o.done?i(o.value):a(o.value).then(f,c)}s((r=r.apply(n,e||[])).next())})}function P(n,e){var t={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},r,a,i,l;return l={next:f(0),throw:f(1),return:f(2)},typeof Symbol=="function"&&(l[Symbol.iterator]=function(){return this}),l;function f(s){return function(o){return c([s,o])}}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,a&&(i=s[0]&2?a.return:s[0]?a.throw||((i=a.return)&&i.call(a),0):a.next)&&!(i=i.call(a,s[1])).done)return i;switch(a=0,i&&(s=[s[0]&2,i.value]),s[0]){case 0:case 1:i=s;break;case 4:return t.label++,{value:s[1],done:!1};case 5:t.label++,a=s[1],s=[0];continue;case 7:s=t.ops.pop(),t.trys.pop();continue;default:if(i=t.trys,!(i=i.length>0&&i[i.length-1])&&(s[0]===6||s[0]===2)){t=0;continue}if(s[0]===3&&(!i||s[1]>i[0]&&s[1]<i[3])){t.label=s[1];break}if(s[0]===6&&t.label<i[1]){t.label=i[1],i=s;break}if(i&&t.label<i[2]){t.label=i[2],t.ops.push(s);break}i[2]&&t.ops.pop(),t.trys.pop();continue}s=e.call(n,t)}catch(o){s=[6,o],a=0}finally{r=i=0}if(s[0]&5)throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}}var C=function(n){ne(e,n);function e(t,r){r===void 0&&(r=null);var a=n.call(this)||this;return a.isModalError=!0,a.message=t,a.details=r,a}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.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),k=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:m.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}(),X=function(){var n=new k,e={scrollLock:!0,animation:"modal-list",backgroundClose:!0,escClose:!0,store:{},skipInitCheck:!1,draggable:!1},t=n.getByName().queue;return m.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 y(n){return X.namespaceStore.getByName(n)}var _=X.configuration;function W(n){var e={backgroundClose:_.backgroundClose,isRoute:!1,namespace:k.DEFAULT_NAMESPACE,draggable:_.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 H(n){return n||(n={}),n}function T(n,e){e===void 0&&(e={});var t=I.STORE.get(n);if(!t)return Promise.reject(C.ModalNotFoundByID(n));var r=y(t.namespace),a=r.queue.findIndex(function(l){return l.id===n});if(a===-1)return Promise.reject(C.Undefined(n));var i=w.get(n,"close").map(function(l){return oe(l,n,G(e))});return Z(i).then(function(){r.queue.splice(a,1)}).then(function(){w.get(n,"destroy").forEach(function(l){return l(G(e))})}).then(function(){w.delete(n)})}var I=function(){function n(e,t,r){var a=this;this.events=m.reactive({}),this.backgroundClose=!0,this.isRoute=!1,this.id=n.modalId++,this.component=e,this.props=m.ref(t),this.closed=m.computed(function(){return!y(r.namespace).queue.includes(a)}),e.beforeModalClose&&w.add(this.id,"close",e.beforeModalClose);var i=W(r);this.backgroundClose=i.backgroundClose,this.isRoute=i.isRoute,this.namespace=i.namespace,this.draggable=i.draggable,n.STORE.set(this.id,this)}return n.prototype.close=function(){return T(this.id)},Object.defineProperty(n.prototype,"onclose",{set:function(e){w.add(this.id,"close",e)},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"ondestroy",{set:function(e){w.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 a=r.events[e].indexOf(t);a!==-1&&r.events[e].splice(a,1)}},n.STORE=new Map,n.modalId=0,n.EVENT_PROMPT="jenesius-vue-modal:____P____R____O____M____P____T",n}();function J(n){return I.STORE.get(n)}var re={store:{},add:function(n,e,t){var r,a;if(typeof t!="function")throw C.GuardDeclarationType(t);this.store[n]||(this.store[n]=(r={},r[e]=[],r)),this.store[n][e]||(this.store[n][e]=[]),(a=this.store[n][e])===null||a===void 0||a.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 w=re;function Z(n){return n.reduce(function(e,t){return e.then(function(){return t()})},Promise.resolve())}function oe(n,e,t){return function(){return new Promise(function(r,a){var i,l=function(f){f===void 0&&(f=!0),f===!1&&a(C.NextReject(e)),r()};Promise.resolve(n.call((i=J(e))===null||i===void 0?void 0:i.instance,t)).then(l).catch(function(f){return a(f)})})}}function V(n){return n=H(n),Z(y(n.namespace).queue.map(function(e){return function(){return e.close()}}))}function L(n){var e=y(n),t=e.queue;if(t.length!==0)return t[t.length-1]}function ie(n){n=H(n);var e=L(n.namespace);return e?e.close():Promise.resolve()}function ae(n,e,t){var r=W(t),a=y(r.namespace);if(r.namespace===k.DEFAULT_NAMESPACE&&!a.initialized&&!_.skipInitCheck)throw C.NotInitialized(r.namespace);if(typeof n=="string"){var i=ee(n);if(!i)throw C.ModalNotExistsInStore(n);n=i}if(!n)throw C.ModalComponentNotProvided();var l=new I(n,e,r);return a.queue.push(m.markRaw(l)),l}function B(n,e,t){return e===void 0&&(e={}),t===void 0&&(t={}),Promise.resolve().then(function(){return ae(n,e,t)})}function K(n,e,t){return e===void 0&&(e={}),t===void 0&&(t={}),V({namespace:t.namespace}).then(function(){var r=y(t.namespace);if(r.queue.length)throw C.QueueNoEmpty()}).then(function(){return B(n,e,t)})}function ue(n){if(typeof n!="object")throw C.ConfigurationType(n);Object.assign(_,n)}function se(n){var e,t,r,a=m.getCurrentInstance(),i=String(((e=a==null?void 0:a.props)===null||e===void 0?void 0:e.modalId)||((t=a==null?void 0:a.props)===null||t===void 0?void 0:t["modal-id"])||((r=a==null?void 0:a.attrs)===null||r===void 0?void 0:r.modalId)),l=i.replace(/[^0-9]/g,"");w.add(Number(l),"close",n)}function ce(n,e,t){return e===void 0&&(e={}),t===void 0&&(t={}),S(this,void 0,void 0,function(){var r,a,i=this;return P(this,function(l){switch(l.label){case 0:return[4,B(n,e,t)];case 1:return r=l.sent(),a=!1,[2,new Promise(function(f){r.on(I.EVENT_PROMPT,function(c){return S(i,void 0,void 0,function(){return P(this,function(s){return a=!0,[2,r.close().then(function(){return f(c)}).catch(function(){return a=!1})]})})}),r.ondestroy=function(){a||f(null)}})]}})})}function ee(n){return _.store[n]||void 0}function le(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var q={exports:{}},x,Q;function de(){if(Q)return x;Q=1;var n=1e3,e=n*60,t=e*60,r=t*24,a=r*7,i=r*365.25;x=function(o,u){u=u||{};var d=typeof o;if(d==="string"&&o.length>0)return l(o);if(d==="number"&&isFinite(o))return u.long?c(o):f(o);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(o))};function l(o){if(o=String(o),!(o.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(o);if(u){var d=parseFloat(u[1]),g=(u[2]||"ms").toLowerCase();switch(g){case"years":case"year":case"yrs":case"yr":case"y":return d*i;case"weeks":case"week":case"w":return d*a;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 f(o){var u=Math.abs(o);return u>=r?Math.round(o/r)+"d":u>=t?Math.round(o/t)+"h":u>=e?Math.round(o/e)+"m":u>=n?Math.round(o/n)+"s":o+"ms"}function c(o){var u=Math.abs(o);return u>=r?s(o,u,r,"day"):u>=t?s(o,u,t,"hour"):u>=e?s(o,u,e,"minute"):u>=n?s(o,u,n,"second"):o+" ms"}function s(o,u,d,g){var F=u>=d*1.5;return Math.round(o/d)+" "+g+(F?"s":"")}return x}function fe(n){t.debug=t,t.default=t,t.coerce=c,t.disable=i,t.enable=a,t.enabled=l,t.humanize=de(),t.destroy=s,Object.keys(n).forEach(o=>{t[o]=n[o]}),t.names=[],t.skips=[],t.formatters={};function e(o){let u=0;for(let d=0;d<o.length;d++)u=(u<<5)-u+o.charCodeAt(d),u|=0;return t.colors[Math.abs(u)%t.colors.length]}t.selectColor=e;function t(o){let u,d=null,g,F;function v(...h){if(!v.enabled)return;const p=v,M=Number(new Date),A=M-(u||M);p.diff=A,p.prev=u,p.curr=M,u=M,h[0]=t.coerce(h[0]),typeof h[0]!="string"&&h.unshift("%O");let b=0;h[0]=h[0].replace(/%([a-zA-Z%])/g,(E,N)=>{if(E==="%%")return"%";b++;const O=t.formatters[N];if(typeof O=="function"){const j=h[b];E=O.call(p,j),h.splice(b,1),b--}return E}),t.formatArgs.call(p,h),(p.log||t.log).apply(p,h)}return v.namespace=o,v.useColors=t.useColors(),v.color=t.selectColor(o),v.extend=r,v.destroy=t.destroy,Object.defineProperty(v,"enabled",{enumerable:!0,configurable:!1,get:()=>d!==null?d:(g!==t.namespaces&&(g=t.namespaces,F=t.enabled(o)),F),set:h=>{d=h}}),typeof t.init=="function"&&t.init(v),v}function r(o,u){const d=t(this.namespace+(typeof u>"u"?":":u)+o);return d.log=this.log,d}function a(o){t.save(o),t.namespaces=o,t.names=[],t.skips=[];let u;const d=(typeof o=="string"?o:"").split(/[\s,]+/),g=d.length;for(u=0;u<g;u++)d[u]&&(o=d[u].replace(/\*/g,".*?"),o[0]==="-"?t.skips.push(new RegExp("^"+o.slice(1)+"$")):t.names.push(new RegExp("^"+o+"$")))}function i(){const o=[...t.names.map(f),...t.skips.map(f).map(u=>"-"+u)].join(",");return t.enable(""),o}function l(o){if(o[o.length-1]==="*")return!0;let u,d;for(u=0,d=t.skips.length;u<d;u++)if(t.skips[u].test(o))return!1;for(u=0,d=t.names.length;u<d;u++)if(t.names[u].test(o))return!0;return!1}function f(o){return o.toString().substring(2,o.toString().length-2).replace(/\.\*\?$/,"*")}function c(o){return o instanceof Error?o.stack||o.message:o}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 me=fe;(function(n,e){e.formatArgs=r,e.save=a,e.load=i,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 o=0,u=0;c[0].replace(/%[a-zA-Z%]/g,d=>{d!=="%%"&&(o++,d==="%c"&&(u=o))}),c.splice(u,0,s)}e.log=console.debug||console.log||(()=>{});function a(c){try{c?e.storage.setItem("debug",c):e.storage.removeItem("debug")}catch{}}function i(){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=me(e);const{formatters:f}=n.exports;f.j=function(c){try{return JSON.stringify(c)}catch(s){return"[UnexpectedJSONParseError]: "+s.message}}})(q,q.exports);var he=q.exports;const ve=le(he);function ge(n){return ve("jenesius-vue-modal:".concat(n))}const Ce=["onPointerdown"],Y=m.defineComponent({__name:"WidgetModalContainerItem",props:{id:{}},setup(n){const e=ge("modal-item"),t=n,r=J(t.id),a=m.ref(),i=m.ref();function l(){if(r.backgroundClose)return T(r.id,{background:!0}).catch(()=>{})}m.watch(()=>i.value,c=>{var s;if(r.instance=c,e(`Modal(${r.id}) instance is saved.`),r.draggable){const o=`[modalid=_modal_${t.id}]`,u=typeof r.draggable=="string"?r.draggable:o;e(`The modal window is movable(${u}).`),a.value?(e("Finding an item to drag: %s",u),f((s=a.value)==null?void 0:s.querySelector(o),a.value.querySelector(u))):e("The modal container is not mounted. Modal id %d.",r.id)}}),m.onMounted(()=>{e(`Modal(${r.id}) is mounted`)});function f(c,s){if(!s){e("draggable item not found.");return}if(!c){e("HTML modal is not founded.");return}s.addEventListener("pointerdown",o=>{var E;const u=(E=c.getAttribute("style"))==null?void 0:E.match(/transform: translate\((.*)px,\s*(.*)px\)/),d=u==null?void 0:u[1],g=u==null?void 0:u[2];let F=typeof d=="string"?Number.parseInt(d):0,v=typeof g=="string"?Number.parseInt(g):0;const{clientX:h,clientY:p}=o,M=h,A=p;e(`movement started at (${A}, ${A})`),document.addEventListener("pointermove",b,{passive:!0}),document.addEventListener("pointerup",$,{once:!0});function b(N){const{clientX:O,clientY:j}=N,z=F+O-M,U=v+j-A;e(`move at (${z}, ${U})`),c.style.transform=`translate(${z}px,${U}px)`}function $(N){e("movement completed"),document.removeEventListener("pointermove",b),N.preventDefault()}})}return(c,s)=>(m.openBlock(),m.createElementBlock("div",{class:"widget__modal-container__item modal-container",onPointerdown:m.withModifiers(l,["self","stop"]),ref_key:"modalContainerRef",ref:a},[(m.openBlock(),m.createBlock(m.resolveDynamicComponent(m.unref(r).component),m.mergeProps(m.unref(r).props.value,{class:"modal-item widget__modal-wrap",modalId:`_modal_${c.id}`,ref_key:"modalRef",ref:i},m.toHandlers(m.unref(r).events)),null,16,["modalId"]))],40,Ce))}});function pe(n){n===void 0&&(n=k.DEFAULT_NAMESPACE);var e=k.instance.getByName(n);e.initialized=!0,n===k.DEFAULT_NAMESPACE&&document.addEventListener("keyup",function(t){if(_.escClose&&(t.key==="Escape"||t.code==="Escape")){var r=L(n);if(!r)return;T(r.id,{esc:!0}).catch(function(){})}})}const ye={props:{namespace:String},setup(n){return m.onMounted(()=>{pe(n.namespace)}),()=>{const e=y(n.namespace);return m.h(m.TransitionGroup,{name:_.animation,tag:"div"},{default:()=>e.queue.map(t=>m.h(Y,{key:t.id,id:t.id}))})}},components:{WidgetContainerModalItem:Y}};var R={router:null};function be(n){var e=this;if(R.router)throw C.DuplicatedRouterIntegration();R.router=n;function t(r){for(var a=r.matched.length-1;a>=0;a--){var i=r.matched[a].components,l=Object.values(i).find(function(f){return f._isModal});if(l)return l}return null}n.beforeEach(function(r,a){return S(e,void 0,void 0,function(){var i,l,f;return P(this,function(c){switch(c.label){case 0:return c.trys.push([0,3,,4]),i=t(a),i&&!(!((f=(l=i.getModalObject())===null||l===void 0?void 0:l.closed)===null||f===void 0)&&f.value)?[4,i.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 S(e,void 0,void 0,function(){var a;return P(this,function(i){switch(i.label){case 0:return a=t(r),a?[4,a.initialize()]:[3,2];case 1:i.sent(),i.label=2;case 2:return[2]}})})})}function te(n){var e=null,t=!1;function r(){return S(this,void 0,void 0,function(){return P(this,function(a){switch(a.label){case 0:if(!R.router)throw C.ModalRouterIntegrationNotInitialized();return t=!1,e=null,[4,K(n,m.computed(function(){var i;return(i=R.router)===null||i===void 0?void 0:i.currentRoute.value.params}),{isRoute:!0})];case 1:return e=a.sent(),e.onclose=function(){var i;t||(i=R.router)===null||i===void 0||i.back()},[2]}})})}return{getModalObject:function(){return e},_isModal:!0,close:function(a){return a===void 0&&(a=!1),S(this,void 0,void 0,function(){return P(this,function(i){switch(i.label){case 0:return t=a,e?[4,e.close()]:[3,2];case 1:return[2,i.sent()];case 2:return[2]}})})},initialize:r,setup:function(){return function(){return null}}}}te.init=be;var we=y().queue;function _e(n){return y(n).queue}exports.Modal=I;exports.closeById=T;exports.closeModal=V;exports.config=ue;exports.container=ye;exports.getComponentFromStore=ee;exports.getCurrentModal=L;exports.getQueueByNamespace=_e;exports.modalQueue=we;exports.onBeforeModalClose=se;exports.openModal=K;exports.popModal=ie;exports.promptModal=ce;exports.pushModal=B;exports.useModalRouter=te; | ||
*/Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const h=require("vue");var D=function(n,e){return D=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,r){t.__proto__=r}||function(t,r){for(var a in r)Object.prototype.hasOwnProperty.call(r,a)&&(t[a]=r[a])},D(n,e)};function ne(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 F(n,e,t,r){function a(o){return o instanceof t?o:new t(function(l){l(o)})}return new(t||(t=Promise))(function(o,l){function f(i){try{s(r.next(i))}catch(u){l(u)}}function c(i){try{s(r.throw(i))}catch(u){l(u)}}function s(i){i.done?o(i.value):a(i.value).then(f,c)}s((r=r.apply(n,e||[])).next())})}function M(n,e){var t={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},r,a,o,l;return l={next:f(0),throw:f(1),return:f(2)},typeof Symbol=="function"&&(l[Symbol.iterator]=function(){return this}),l;function f(s){return function(i){return c([s,i])}}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,a&&(o=s[0]&2?a.return:s[0]?a.throw||((o=a.return)&&o.call(a),0):a.next)&&!(o=o.call(a,s[1])).done)return o;switch(a=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++,a=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(i){s=[6,i],a=0}finally{r=o=0}if(s[0]&5)throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}}var g=function(n){ne(e,n);function e(t,r){r===void 0&&(r=null);var a=n.call(this)||this;return a.isModalError=!0,a.message=t,a.details=r,a}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),P=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:h.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}(),X=function(){var n=new P,e={scrollLock:!0,animation:"modal-list",backgroundClose:!0,escClose:!0,store:{},skipInitCheck:!1,draggable:!1,appear:!0,beforeEach:function(){}},t=n.getByName().queue;return h.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 X.namespaceStore.getByName(n)}var y=X.configuration;function W(n){var e={backgroundClose:y.backgroundClose,isRoute:!1,namespace:P.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 H(n){return n||(n={}),n}function T(n,e){e===void 0&&(e={});var t=I.STORE.get(n);if(!t)return Promise.reject(g.ModalNotFoundByID(n));var r=b(t.namespace),a=r.queue.findIndex(function(l){return l.id===n});if(a===-1)return Promise.reject(g.Undefined(n));var o=_.get(n,"close").map(function(l){return oe(l,n,G(e))});return Z(o).then(function(){r.queue.splice(a,1)}).then(function(){_.get(n,"destroy").forEach(function(l){return l(G(e))})}).then(function(){_.delete(n)})}var I=function(){function n(e,t,r){var a=this;this.events=h.reactive({}),this.backgroundClose=!0,this.isRoute=!1,this.id=n.modalId++,this.component=e,this.props=h.ref(t),this.closed=h.computed(function(){return!b(r.namespace).queue.includes(a)}),e.beforeModalClose&&_.add(this.id,"close",e.beforeModalClose);var o=W(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){_.add(this.id,"close",e)},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"ondestroy",{set:function(e){_.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 a=r.events[e].indexOf(t);a!==-1&&r.events[e].splice(a,1)}},n.STORE=new Map,n.modalId=0,n.EVENT_PROMPT="jenesius-vue-modal:____P____R____O____M____P____T",n}();function J(n){return I.STORE.get(n)}var re={store:{},add:function(n,e,t){var r,a;if(typeof t!="function")throw g.GuardDeclarationType(t);this.store[n]||(this.store[n]=(r={},r[e]=[],r)),this.store[n][e]||(this.store[n][e]=[]),(a=this.store[n][e])===null||a===void 0||a.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 _=re;function Z(n){return n.reduce(function(e,t){return e.then(function(){return t()})},Promise.resolve())}function oe(n,e,t){return function(){return new Promise(function(r,a){var o,l=function(f){f===void 0&&(f=!0),f===!1&&a(g.NextReject(e)),r()};Promise.resolve(n.call((o=J(e))===null||o===void 0?void 0:o.instance,t)).then(l).catch(function(f){return a(f)})})}}function V(n){return n=H(n),Z(b(n.namespace).queue.map(function(e){return function(){return e.close()}}))}function q(n){var e=b(n),t=e.queue;if(t.length!==0)return t[t.length-1]}function ie(n){n=H(n);var e=q(n.namespace);return e?e.close():Promise.resolve()}function ae(n,e,t){return F(this,void 0,void 0,function(){var r,a,o,l;return M(this,function(f){switch(f.label){case 0:if(r=W(t),a=b(r.namespace),r.namespace===P.DEFAULT_NAMESPACE&&!a.initialized&&!y.skipInitCheck)throw g.NotInitialized(r.namespace);return[4,y.beforeEach()];case 1:if(f.sent()===!1)throw g.RejectedByBeforeEach();if(typeof n=="string"){if(o=ee(n),!o)throw g.ModalNotExistsInStore(n);n=o}if(!n)throw g.ModalComponentNotProvided();return l=new I(n,e,r),a.queue.push(h.markRaw(l)),[2,l]}})})}function L(n,e,t){return e===void 0&&(e={}),t===void 0&&(t={}),Promise.resolve().then(function(){return ae(n,e,t)})}function K(n,e,t){return e===void 0&&(e={}),t===void 0&&(t={}),V({namespace:t.namespace}).then(function(){var r=b(t.namespace);if(r.queue.length)throw g.QueueNoEmpty()}).then(function(){return L(n,e,t)})}function ue(n){if(typeof n!="object")throw g.ConfigurationType(n);Object.assign(y,n)}function se(n){var e,t,r,a=h.getCurrentInstance(),o=String(((e=a==null?void 0:a.props)===null||e===void 0?void 0:e.modalId)||((t=a==null?void 0:a.props)===null||t===void 0?void 0:t["modal-id"])||((r=a==null?void 0:a.attrs)===null||r===void 0?void 0:r.modalId)),l=o.replace(/[^0-9]/g,"");_.add(Number(l),"close",n)}function ce(n,e,t){return e===void 0&&(e={}),t===void 0&&(t={}),F(this,void 0,void 0,function(){var r,a,o=this;return M(this,function(l){switch(l.label){case 0:return[4,L(n,e,t)];case 1:return r=l.sent(),a=!1,[2,new Promise(function(f){r.on(I.EVENT_PROMPT,function(c){return F(o,void 0,void 0,function(){return M(this,function(s){return a=!0,[2,r.close().then(function(){return f(c)}).catch(function(){return a=!1})]})})}),r.ondestroy=function(){a||f(null)}})]}})})}function ee(n){return y.store[n]||void 0}function le(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var B={exports:{}},x,Q;function de(){if(Q)return x;Q=1;var n=1e3,e=n*60,t=e*60,r=t*24,a=r*7,o=r*365.25;x=function(i,u){u=u||{};var d=typeof i;if(d==="string"&&i.length>0)return l(i);if(d==="number"&&isFinite(i))return u.long?c(i):f(i);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(i))};function l(i){if(i=String(i),!(i.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(i);if(u){var d=parseFloat(u[1]),p=(u[2]||"ms").toLowerCase();switch(p){case"years":case"year":case"yrs":case"yr":case"y":return d*o;case"weeks":case"week":case"w":return d*a;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 f(i){var u=Math.abs(i);return u>=r?Math.round(i/r)+"d":u>=t?Math.round(i/t)+"h":u>=e?Math.round(i/e)+"m":u>=n?Math.round(i/n)+"s":i+"ms"}function c(i){var u=Math.abs(i);return u>=r?s(i,u,r,"day"):u>=t?s(i,u,t,"hour"):u>=e?s(i,u,e,"minute"):u>=n?s(i,u,n,"second"):i+" ms"}function s(i,u,d,p){var E=u>=d*1.5;return Math.round(i/d)+" "+p+(E?"s":"")}return x}function fe(n){t.debug=t,t.default=t,t.coerce=c,t.disable=o,t.enable=a,t.enabled=l,t.humanize=de(),t.destroy=s,Object.keys(n).forEach(i=>{t[i]=n[i]}),t.names=[],t.skips=[],t.formatters={};function e(i){let u=0;for(let d=0;d<i.length;d++)u=(u<<5)-u+i.charCodeAt(d),u|=0;return t.colors[Math.abs(u)%t.colors.length]}t.selectColor=e;function t(i){let u,d=null,p,E;function v(...m){if(!v.enabled)return;const C=v,k=Number(new Date),R=k-(u||k);C.diff=R,C.prev=u,C.curr=k,u=k,m[0]=t.coerce(m[0]),typeof m[0]!="string"&&m.unshift("%O");let w=0;m[0]=m[0].replace(/%([a-zA-Z%])/g,(S,A)=>{if(S==="%%")return"%";w++;const O=t.formatters[A];if(typeof O=="function"){const j=m[w];S=O.call(C,j),m.splice(w,1),w--}return S}),t.formatArgs.call(C,m),(C.log||t.log).apply(C,m)}return v.namespace=i,v.useColors=t.useColors(),v.color=t.selectColor(i),v.extend=r,v.destroy=t.destroy,Object.defineProperty(v,"enabled",{enumerable:!0,configurable:!1,get:()=>d!==null?d:(p!==t.namespaces&&(p=t.namespaces,E=t.enabled(i)),E),set:m=>{d=m}}),typeof t.init=="function"&&t.init(v),v}function r(i,u){const d=t(this.namespace+(typeof u>"u"?":":u)+i);return d.log=this.log,d}function a(i){t.save(i),t.namespaces=i,t.names=[],t.skips=[];let u;const d=(typeof i=="string"?i:"").split(/[\s,]+/),p=d.length;for(u=0;u<p;u++)d[u]&&(i=d[u].replace(/\*/g,".*?"),i[0]==="-"?t.skips.push(new RegExp("^"+i.slice(1)+"$")):t.names.push(new RegExp("^"+i+"$")))}function o(){const i=[...t.names.map(f),...t.skips.map(f).map(u=>"-"+u)].join(",");return t.enable(""),i}function l(i){if(i[i.length-1]==="*")return!0;let u,d;for(u=0,d=t.skips.length;u<d;u++)if(t.skips[u].test(i))return!1;for(u=0,d=t.names.length;u<d;u++)if(t.names[u].test(i))return!0;return!1}function f(i){return i.toString().substring(2,i.toString().length-2).replace(/\.\*\?$/,"*")}function c(i){return i instanceof Error?i.stack||i.message:i}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 he=fe;(function(n,e){e.formatArgs=r,e.save=a,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 i=0,u=0;c[0].replace(/%[a-zA-Z%]/g,d=>{d!=="%%"&&(i++,d==="%c"&&(u=i))}),c.splice(u,0,s)}e.log=console.debug||console.log||(()=>{});function a(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=he(e);const{formatters:f}=n.exports;f.j=function(c){try{return JSON.stringify(c)}catch(s){return"[UnexpectedJSONParseError]: "+s.message}}})(B,B.exports);var me=B.exports;const ve=le(me);function ge(n){return ve("jenesius-vue-modal:".concat(n))}const pe=["onPointerdown"],Y=h.defineComponent({__name:"WidgetModalContainerItem",props:{id:{}},setup(n){const e=ge("modal-item"),t=n,r=J(t.id),a=h.ref(),o=h.ref();function l(){if(r.backgroundClose)return T(r.id,{background:!0}).catch(()=>{})}h.watch(()=>o.value,c=>{var s;if(r.instance=c,e(`Modal(${r.id}) instance is saved.`),r.draggable){const i=`[modalid=_modal_${t.id}]`,u=typeof r.draggable=="string"?r.draggable:i;e(`The modal window is movable(${u}).`),a.value?(e("Finding an item to drag: %s",u),f((s=a.value)==null?void 0:s.querySelector(i),a.value.querySelector(u))):e("The modal container is not mounted. Modal id %d.",r.id)}}),h.onMounted(()=>{e(`Modal(${r.id}) is mounted`)});function f(c,s){if(!s){e("draggable item not found.");return}if(!c){e("HTML modal is not founded.");return}s.addEventListener("pointerdown",i=>{var S;const u=(S=c.getAttribute("style"))==null?void 0:S.match(/transform: translate\((.*)px,\s*(.*)px\)/),d=u==null?void 0:u[1],p=u==null?void 0:u[2];let E=typeof d=="string"?Number.parseInt(d):0,v=typeof p=="string"?Number.parseInt(p):0;const{clientX:m,clientY:C}=i,k=m,R=C;e(`movement started at (${R}, ${R})`),document.addEventListener("pointermove",w,{passive:!0}),document.addEventListener("pointerup",$,{once:!0});function w(A){const{clientX:O,clientY:j}=A,z=E+O-k,U=v+j-R;e(`move at (${z}, ${U})`),c.style.transform=`translate(${z}px,${U}px)`}function $(A){e("movement completed"),document.removeEventListener("pointermove",w),A.preventDefault()}})}return(c,s)=>(h.openBlock(),h.createElementBlock("div",{class:"widget__modal-container__item modal-container",onPointerdown:h.withModifiers(l,["self","stop"]),ref_key:"modalContainerRef",ref:a},[(h.openBlock(),h.createBlock(h.resolveDynamicComponent(h.unref(r).component),h.mergeProps(h.unref(r).props.value,{class:"modal-item widget__modal-wrap",modalId:`_modal_${c.id}`,ref_key:"modalRef",ref:o},h.toHandlers(h.unref(r).events)),null,16,["modalId"]))],40,pe))}});function Ce(n){n===void 0&&(n=P.DEFAULT_NAMESPACE);var e=P.instance.getByName(n);e.initialized=!0,n===P.DEFAULT_NAMESPACE&&document.addEventListener("keyup",function(t){if(y.escClose&&(t.key==="Escape"||t.code==="Escape")){var r=q(n);if(!r)return;T(r.id,{esc:!0}).catch(function(){})}})}const ye={props:{namespace:String},setup(n){return h.onMounted(()=>{Ce(n.namespace)}),()=>{const e=b(n.namespace);return h.h(h.TransitionGroup,{name:y.animation,tag:"div",appear:y.appear},{default:()=>e.queue.map(t=>h.h(Y,{key:t.id,id:t.id}))})}},components:{WidgetContainerModalItem:Y}};var N={router:null};function be(n){var e=this;if(N.router)throw g.DuplicatedRouterIntegration();N.router=n;function t(r){for(var a=r.matched.length-1;a>=0;a--){var o=r.matched[a].components,l=Object.values(o).find(function(f){return f._isModal});if(l)return l}return null}n.beforeEach(function(r,a){return F(e,void 0,void 0,function(){var o,l,f;return M(this,function(c){switch(c.label){case 0:return c.trys.push([0,3,,4]),o=t(a),o&&!(!((f=(l=o.getModalObject())===null||l===void 0?void 0:l.closed)===null||f===void 0)&&f.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 F(e,void 0,void 0,function(){var a;return M(this,function(o){switch(o.label){case 0:return a=t(r),a?[4,a.initialize()]:[3,2];case 1:o.sent(),o.label=2;case 2:return[2]}})})})}function te(n){var e=null,t=!1;function r(){return F(this,void 0,void 0,function(){return M(this,function(a){switch(a.label){case 0:if(!N.router)throw g.ModalRouterIntegrationNotInitialized();return t=!1,e=null,[4,K(n,h.computed(function(){var o;return(o=N.router)===null||o===void 0?void 0:o.currentRoute.value.params}),{isRoute:!0})];case 1:return e=a.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(a){return a===void 0&&(a=!1),F(this,void 0,void 0,function(){return M(this,function(o){switch(o.label){case 0:return t=a,e?[4,e.close()]:[3,2];case 1:return[2,o.sent()];case 2:return[2]}})})},initialize:r,setup:function(){return function(){return null}}}}te.init=be;var we=b().queue;function _e(n){return b(n).queue}exports.Modal=I;exports.closeById=T;exports.closeModal=V;exports.config=ue;exports.container=ye;exports.getComponentFromStore=ee;exports.getCurrentModal=q;exports.getQueueByNamespace=_e;exports.modalQueue=we;exports.onBeforeModalClose=se;exports.openModal=K;exports.popModal=ie;exports.promptModal=ce;exports.pushModal=L;exports.useModalRouter=te; | ||
//# sourceMappingURL=jenesius-vue-modal.cjs.js.map |
(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)}})(); | ||
import { reactive as W, watch as H, ref as j, computed as J, markRaw as ie, getCurrentInstance as ae, defineComponent as ue, onMounted as Z, openBlock as U, createElementBlock as se, withModifiers as ce, createBlock as le, resolveDynamicComponent as de, unref as T, mergeProps as fe, toHandlers as he, h as G, TransitionGroup as me } from "vue"; | ||
import { reactive as W, watch as H, ref as x, computed as J, markRaw as ie, getCurrentInstance as ae, defineComponent as ue, onMounted as Z, openBlock as U, createElementBlock as se, withModifiers as ce, createBlock as le, resolveDynamicComponent as de, unref as T, mergeProps as fe, toHandlers as he, h as G, TransitionGroup as me } from "vue"; | ||
/*! | ||
* jenesius-vue-modal v1.11.6 | ||
* jenesius-vue-modal v1.11.7 | ||
* (c) 2024 Jenesius | ||
@@ -25,12 +25,12 @@ * @license MIT | ||
} | ||
function k(n, e, t, r) { | ||
function a(i) { | ||
return i instanceof t ? i : new t(function(l) { | ||
l(i); | ||
function _(n, e, t, r) { | ||
function a(o) { | ||
return o instanceof t ? o : new t(function(l) { | ||
l(o); | ||
}); | ||
} | ||
return new (t || (t = Promise))(function(i, l) { | ||
function f(o) { | ||
return new (t || (t = Promise))(function(o, l) { | ||
function f(i) { | ||
try { | ||
s(r.next(o)); | ||
s(r.next(i)); | ||
} catch (u) { | ||
@@ -40,5 +40,5 @@ l(u); | ||
} | ||
function c(o) { | ||
function c(i) { | ||
try { | ||
s(r.throw(o)); | ||
s(r.throw(i)); | ||
} catch (u) { | ||
@@ -48,4 +48,4 @@ l(u); | ||
} | ||
function s(o) { | ||
o.done ? i(o.value) : a(o.value).then(f, c); | ||
function s(i) { | ||
i.done ? o(i.value) : a(i.value).then(f, c); | ||
} | ||
@@ -55,8 +55,8 @@ s((r = r.apply(n, e || [])).next()); | ||
} | ||
function S(n, e) { | ||
function F(n, e) { | ||
var t = { label: 0, sent: function() { | ||
if (i[0] & 1) | ||
throw i[1]; | ||
return i[1]; | ||
}, trys: [], ops: [] }, r, a, i, l; | ||
if (o[0] & 1) | ||
throw o[1]; | ||
return o[1]; | ||
}, trys: [], ops: [] }, r, a, o, l; | ||
return l = { next: f(0), throw: f(1), return: f(2) }, typeof Symbol == "function" && (l[Symbol.iterator] = function() { | ||
@@ -66,4 +66,4 @@ return this; | ||
function f(s) { | ||
return function(o) { | ||
return c([s, o]); | ||
return function(i) { | ||
return c([s, i]); | ||
}; | ||
@@ -76,8 +76,8 @@ } | ||
try { | ||
if (r = 1, a && (i = s[0] & 2 ? a.return : s[0] ? a.throw || ((i = a.return) && i.call(a), 0) : a.next) && !(i = i.call(a, s[1])).done) | ||
return i; | ||
switch (a = 0, i && (s = [s[0] & 2, i.value]), s[0]) { | ||
if (r = 1, a && (o = s[0] & 2 ? a.return : s[0] ? a.throw || ((o = a.return) && o.call(a), 0) : a.next) && !(o = o.call(a, s[1])).done) | ||
return o; | ||
switch (a = 0, o && (s = [s[0] & 2, o.value]), s[0]) { | ||
case 0: | ||
case 1: | ||
i = s; | ||
o = s; | ||
break; | ||
@@ -93,26 +93,26 @@ case 4: | ||
default: | ||
if (i = t.trys, !(i = i.length > 0 && i[i.length - 1]) && (s[0] === 6 || s[0] === 2)) { | ||
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 && (!i || s[1] > i[0] && s[1] < i[3])) { | ||
if (s[0] === 3 && (!o || s[1] > o[0] && s[1] < o[3])) { | ||
t.label = s[1]; | ||
break; | ||
} | ||
if (s[0] === 6 && t.label < i[1]) { | ||
t.label = i[1], i = s; | ||
if (s[0] === 6 && t.label < o[1]) { | ||
t.label = o[1], o = s; | ||
break; | ||
} | ||
if (i && t.label < i[2]) { | ||
t.label = i[2], t.ops.push(s); | ||
if (o && t.label < o[2]) { | ||
t.label = o[2], t.ops.push(s); | ||
break; | ||
} | ||
i[2] && t.ops.pop(), t.trys.pop(); | ||
o[2] && t.ops.pop(), t.trys.pop(); | ||
continue; | ||
} | ||
s = e.call(n, t); | ||
} catch (o) { | ||
s = [6, o], a = 0; | ||
} catch (i) { | ||
s = [6, i], a = 0; | ||
} finally { | ||
r = i = 0; | ||
r = o = 0; | ||
} | ||
@@ -124,3 +124,3 @@ if (s[0] & 5) | ||
} | ||
var g = ( | ||
var v = ( | ||
/** @class */ | ||
@@ -142,2 +142,4 @@ function(n) { | ||
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) { | ||
@@ -167,3 +169,3 @@ return new e("Configuration type must be an Object. Provided", t); | ||
}(Error) | ||
), E = ( | ||
), S = ( | ||
/** @class */ | ||
@@ -186,3 +188,3 @@ function() { | ||
), V = function() { | ||
var n = new E(), e = { | ||
var n = new S(), e = { | ||
scrollLock: !0, | ||
@@ -194,3 +196,6 @@ animation: "modal-list", | ||
skipInitCheck: !1, | ||
draggable: !1 | ||
draggable: !1, | ||
appear: !0, | ||
beforeEach: function() { | ||
} | ||
}, t = n.getByName().queue; | ||
@@ -206,12 +211,12 @@ return H(function() { | ||
}(); | ||
function p(n) { | ||
function y(n) { | ||
return V.namespaceStore.getByName(n); | ||
} | ||
var w = V.configuration; | ||
var C = V.configuration; | ||
function K(n) { | ||
var e = { | ||
backgroundClose: w.backgroundClose, | ||
backgroundClose: C.backgroundClose, | ||
isRoute: !1, | ||
namespace: E.DEFAULT_NAMESPACE, | ||
draggable: w.draggable | ||
namespace: S.DEFAULT_NAMESPACE, | ||
draggable: C.draggable | ||
}; | ||
@@ -235,19 +240,19 @@ 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; | ||
if (!t) | ||
return Promise.reject(g.ModalNotFoundByID(n)); | ||
var r = p(t.namespace), a = r.queue.findIndex(function(l) { | ||
return Promise.reject(v.ModalNotFoundByID(n)); | ||
var r = y(t.namespace), a = r.queue.findIndex(function(l) { | ||
return l.id === n; | ||
}); | ||
if (a === -1) | ||
return Promise.reject(g.Undefined(n)); | ||
var i = b.get(n, "close").map(function(l) { | ||
return Ce(l, n, Y(e)); | ||
return Promise.reject(v.Undefined(n)); | ||
var o = w.get(n, "close").map(function(l) { | ||
return pe(l, n, Y(e)); | ||
}); | ||
return ne(i).then(function() { | ||
return ne(o).then(function() { | ||
r.queue.splice(a, 1); | ||
}).then(function() { | ||
b.get(n, "destroy").forEach(function(l) { | ||
w.get(n, "destroy").forEach(function(l) { | ||
return l(Y(e)); | ||
}); | ||
}).then(function() { | ||
b.delete(n); | ||
w.delete(n); | ||
}); | ||
@@ -260,7 +265,7 @@ } | ||
var a = this; | ||
this.events = W({}), this.backgroundClose = !0, this.isRoute = !1, this.id = n.modalId++, this.component = e, this.props = j(t), this.closed = J(function() { | ||
return !p(r.namespace).queue.includes(a); | ||
}), e.beforeModalClose && b.add(this.id, "close", e.beforeModalClose); | ||
var i = K(r); | ||
this.backgroundClose = i.backgroundClose, this.isRoute = i.isRoute, this.namespace = i.namespace, this.draggable = i.draggable, n.STORE.set(this.id, this); | ||
this.events = W({}), this.backgroundClose = !0, this.isRoute = !1, this.id = n.modalId++, this.component = e, this.props = x(t), this.closed = J(function() { | ||
return !y(r.namespace).queue.includes(a); | ||
}), e.beforeModalClose && w.add(this.id, "close", e.beforeModalClose); | ||
var o = K(r); | ||
this.backgroundClose = o.backgroundClose, this.isRoute = o.isRoute, this.namespace = o.namespace, this.draggable = o.draggable, n.STORE.set(this.id, this); | ||
} | ||
@@ -274,3 +279,3 @@ return n.prototype.close = function() { | ||
set: function(e) { | ||
b.add(this.id, "close", e); | ||
w.add(this.id, "close", e); | ||
}, | ||
@@ -284,3 +289,3 @@ enumerable: !1, | ||
set: function(e) { | ||
b.add(this.id, "destroy", e); | ||
w.add(this.id, "destroy", e); | ||
}, | ||
@@ -306,3 +311,3 @@ enumerable: !1, | ||
if (typeof t != "function") | ||
throw g.GuardDeclarationType(t); | ||
throw v.GuardDeclarationType(t); | ||
this.store[n] || (this.store[n] = (r = {}, r[e] = [], r)), this.store[n][e] || (this.store[n][e] = []), (a = this.store[n][e]) === null || a === void 0 || a.push(t); | ||
@@ -317,3 +322,3 @@ }, | ||
}; | ||
const b = ge; | ||
const w = ge; | ||
function ne(n) { | ||
@@ -326,9 +331,9 @@ return n.reduce(function(e, t) { | ||
} | ||
function Ce(n, e, t) { | ||
function pe(n, e, t) { | ||
return function() { | ||
return new Promise(function(r, a) { | ||
var i, l = function(f) { | ||
f === void 0 && (f = !0), f === !1 && a(g.NextReject(e)), r(); | ||
var o, l = function(f) { | ||
f === void 0 && (f = !0), f === !1 && a(v.NextReject(e)), r(); | ||
}; | ||
Promise.resolve(n.call((i = te(e)) === null || i === void 0 ? void 0 : i.instance, t)).then(l).catch(function(f) { | ||
Promise.resolve(n.call((o = te(e)) === null || o === void 0 ? void 0 : o.instance, t)).then(l).catch(function(f) { | ||
return a(f); | ||
@@ -339,4 +344,4 @@ }); | ||
} | ||
function pe(n) { | ||
return n = ee(n), ne(p(n.namespace).queue.map(function(e) { | ||
function Ce(n) { | ||
return n = ee(n), ne(y(n.namespace).queue.map(function(e) { | ||
return function() { | ||
@@ -348,3 +353,3 @@ return e.close(); | ||
function re(n) { | ||
var e = p(n), t = e.queue; | ||
var e = y(n), t = e.queue; | ||
if (t.length !== 0) | ||
@@ -359,15 +364,24 @@ return t[t.length - 1]; | ||
function ye(n, e, t) { | ||
var r = K(t), a = p(r.namespace); | ||
if (r.namespace === E.DEFAULT_NAMESPACE && !a.initialized && !w.skipInitCheck) | ||
throw g.NotInitialized(r.namespace); | ||
if (typeof n == "string") { | ||
var i = we(n); | ||
if (!i) | ||
throw g.ModalNotExistsInStore(n); | ||
n = i; | ||
} | ||
if (!n) | ||
throw g.ModalComponentNotProvided(); | ||
var l = new I(n, e, r); | ||
return a.queue.push(ie(l)), l; | ||
return _(this, void 0, void 0, function() { | ||
var r, a, o, l; | ||
return F(this, function(f) { | ||
switch (f.label) { | ||
case 0: | ||
if (r = K(t), a = y(r.namespace), r.namespace === S.DEFAULT_NAMESPACE && !a.initialized && !C.skipInitCheck) | ||
throw v.NotInitialized(r.namespace); | ||
return [4, C.beforeEach()]; | ||
case 1: | ||
if (f.sent() === !1) | ||
throw v.RejectedByBeforeEach(); | ||
if (typeof n == "string") { | ||
if (o = we(n), !o) | ||
throw v.ModalNotExistsInStore(n); | ||
n = o; | ||
} | ||
if (!n) | ||
throw v.ModalComponentNotProvided(); | ||
return l = new I(n, e, r), a.queue.push(ie(l)), [2, l]; | ||
} | ||
}); | ||
}); | ||
} | ||
@@ -380,8 +394,8 @@ function oe(n, e, t) { | ||
function be(n, e, t) { | ||
return e === void 0 && (e = {}), t === void 0 && (t = {}), pe({ | ||
return e === void 0 && (e = {}), t === void 0 && (t = {}), Ce({ | ||
namespace: t.namespace | ||
}).then(function() { | ||
var r = p(t.namespace); | ||
var r = y(t.namespace); | ||
if (r.queue.length) | ||
throw g.QueueNoEmpty(); | ||
throw v.QueueNoEmpty(); | ||
}).then(function() { | ||
@@ -391,15 +405,15 @@ return oe(n, e, t); | ||
} | ||
function xe(n) { | ||
function je(n) { | ||
if (typeof n != "object") | ||
throw g.ConfigurationType(n); | ||
Object.assign(w, n); | ||
throw v.ConfigurationType(n); | ||
Object.assign(C, n); | ||
} | ||
function je(n) { | ||
var e, t, r, a = ae(), i = String(((e = a == null ? void 0 : a.props) === null || e === void 0 ? void 0 : e.modalId) || ((t = a == null ? void 0 : a.props) === null || t === void 0 ? void 0 : t["modal-id"]) || ((r = a == null ? void 0 : a.attrs) === null || r === void 0 ? void 0 : r.modalId)), l = i.replace(/[^0-9]/g, ""); | ||
b.add(Number(l), "close", n); | ||
function xe(n) { | ||
var e, t, r, a = ae(), o = String(((e = a == null ? void 0 : a.props) === null || e === void 0 ? void 0 : e.modalId) || ((t = a == null ? void 0 : a.props) === null || t === void 0 ? void 0 : t["modal-id"]) || ((r = a == null ? void 0 : a.attrs) === null || r === void 0 ? void 0 : r.modalId)), l = o.replace(/[^0-9]/g, ""); | ||
w.add(Number(l), "close", n); | ||
} | ||
function De(n, e, t) { | ||
return e === void 0 && (e = {}), t === void 0 && (t = {}), k(this, void 0, void 0, function() { | ||
var r, a, i = this; | ||
return S(this, function(l) { | ||
return e === void 0 && (e = {}), t === void 0 && (t = {}), _(this, void 0, void 0, function() { | ||
var r, a, o = this; | ||
return F(this, function(l) { | ||
switch (l.label) { | ||
@@ -411,4 +425,4 @@ case 0: | ||
r.on(I.EVENT_PROMPT, function(c) { | ||
return k(i, void 0, void 0, function() { | ||
return S(this, function(s) { | ||
return _(o, void 0, void 0, function() { | ||
return F(this, function(s) { | ||
return a = !0, [2, r.close().then(function() { | ||
@@ -430,3 +444,3 @@ return f(c); | ||
function we(n) { | ||
return w.store[n] || void 0; | ||
return C.store[n] || void 0; | ||
} | ||
@@ -436,27 +450,27 @@ function _e(n) { | ||
} | ||
var q = { exports: {} }, x, Q; | ||
var q = { exports: {} }, j, Q; | ||
function Fe() { | ||
if (Q) | ||
return x; | ||
return j; | ||
Q = 1; | ||
var n = 1e3, e = n * 60, t = e * 60, r = t * 24, a = r * 7, i = r * 365.25; | ||
x = function(o, u) { | ||
var n = 1e3, e = n * 60, t = e * 60, r = t * 24, a = r * 7, o = r * 365.25; | ||
j = function(i, u) { | ||
u = u || {}; | ||
var d = typeof o; | ||
if (d === "string" && o.length > 0) | ||
return l(o); | ||
if (d === "number" && isFinite(o)) | ||
return u.long ? c(o) : f(o); | ||
var d = typeof i; | ||
if (d === "string" && i.length > 0) | ||
return l(i); | ||
if (d === "number" && isFinite(i)) | ||
return u.long ? c(i) : f(i); | ||
throw new Error( | ||
"val is not a non-empty string or a valid number. val=" + JSON.stringify(o) | ||
"val is not a non-empty string or a valid number. val=" + JSON.stringify(i) | ||
); | ||
}; | ||
function l(o) { | ||
if (o = String(o), !(o.length > 100)) { | ||
function l(i) { | ||
if (i = String(i), !(i.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( | ||
o | ||
i | ||
); | ||
if (u) { | ||
var d = parseFloat(u[1]), v = (u[2] || "ms").toLowerCase(); | ||
switch (v) { | ||
var d = parseFloat(u[1]), g = (u[2] || "ms").toLowerCase(); | ||
switch (g) { | ||
case "years": | ||
@@ -467,3 +481,3 @@ case "year": | ||
case "y": | ||
return d * i; | ||
return d * o; | ||
case "weeks": | ||
@@ -507,51 +521,51 @@ case "week": | ||
} | ||
function f(o) { | ||
var u = Math.abs(o); | ||
return u >= r ? Math.round(o / r) + "d" : u >= t ? Math.round(o / t) + "h" : u >= e ? Math.round(o / e) + "m" : u >= n ? Math.round(o / n) + "s" : o + "ms"; | ||
function f(i) { | ||
var u = Math.abs(i); | ||
return u >= r ? Math.round(i / r) + "d" : u >= t ? Math.round(i / t) + "h" : u >= e ? Math.round(i / e) + "m" : u >= n ? Math.round(i / n) + "s" : i + "ms"; | ||
} | ||
function c(o) { | ||
var u = Math.abs(o); | ||
return u >= r ? s(o, u, r, "day") : u >= t ? s(o, u, t, "hour") : u >= e ? s(o, u, e, "minute") : u >= n ? s(o, u, n, "second") : o + " ms"; | ||
function c(i) { | ||
var u = Math.abs(i); | ||
return u >= r ? s(i, u, r, "day") : u >= t ? s(i, u, t, "hour") : u >= e ? s(i, u, e, "minute") : u >= n ? s(i, u, n, "second") : i + " ms"; | ||
} | ||
function s(o, u, d, v) { | ||
var _ = u >= d * 1.5; | ||
return Math.round(o / d) + " " + v + (_ ? "s" : ""); | ||
function s(i, u, d, g) { | ||
var E = u >= d * 1.5; | ||
return Math.round(i / d) + " " + g + (E ? "s" : ""); | ||
} | ||
return x; | ||
return j; | ||
} | ||
function Me(n) { | ||
t.debug = t, t.default = t, t.coerce = c, t.disable = i, t.enable = a, t.enabled = l, t.humanize = Fe(), t.destroy = s, Object.keys(n).forEach((o) => { | ||
t[o] = n[o]; | ||
function Ee(n) { | ||
t.debug = t, t.default = t, t.coerce = c, t.disable = o, t.enable = a, t.enabled = l, t.humanize = Fe(), t.destroy = s, Object.keys(n).forEach((i) => { | ||
t[i] = n[i]; | ||
}), t.names = [], t.skips = [], t.formatters = {}; | ||
function e(o) { | ||
function e(i) { | ||
let u = 0; | ||
for (let d = 0; d < o.length; d++) | ||
u = (u << 5) - u + o.charCodeAt(d), u |= 0; | ||
for (let d = 0; d < i.length; d++) | ||
u = (u << 5) - u + i.charCodeAt(d), u |= 0; | ||
return t.colors[Math.abs(u) % t.colors.length]; | ||
} | ||
t.selectColor = e; | ||
function t(o) { | ||
let u, d = null, v, _; | ||
function t(i) { | ||
let u, d = null, g, E; | ||
function m(...h) { | ||
if (!m.enabled) | ||
return; | ||
const C = m, F = Number(/* @__PURE__ */ new Date()), P = F - (u || F); | ||
C.diff = P, C.prev = u, C.curr = F, u = F, h[0] = t.coerce(h[0]), typeof h[0] != "string" && h.unshift("%O"); | ||
let y = 0; | ||
h[0] = h[0].replace(/%([a-zA-Z%])/g, (M, A) => { | ||
if (M === "%%") | ||
const p = m, M = Number(/* @__PURE__ */ new Date()), P = M - (u || M); | ||
p.diff = P, p.prev = u, p.curr = M, u = M, h[0] = t.coerce(h[0]), typeof h[0] != "string" && h.unshift("%O"); | ||
let b = 0; | ||
h[0] = h[0].replace(/%([a-zA-Z%])/g, (k, A) => { | ||
if (k === "%%") | ||
return "%"; | ||
y++; | ||
const R = t.formatters[A]; | ||
if (typeof R == "function") { | ||
const O = h[y]; | ||
M = R.call(C, O), h.splice(y, 1), y--; | ||
b++; | ||
const N = t.formatters[A]; | ||
if (typeof N == "function") { | ||
const O = h[b]; | ||
k = N.call(p, O), h.splice(b, 1), b--; | ||
} | ||
return M; | ||
}), t.formatArgs.call(C, h), (C.log || t.log).apply(C, h); | ||
return k; | ||
}), t.formatArgs.call(p, h), (p.log || t.log).apply(p, h); | ||
} | ||
return m.namespace = o, m.useColors = t.useColors(), m.color = t.selectColor(o), m.extend = r, m.destroy = t.destroy, Object.defineProperty(m, "enabled", { | ||
return m.namespace = i, m.useColors = t.useColors(), m.color = t.selectColor(i), m.extend = r, m.destroy = t.destroy, Object.defineProperty(m, "enabled", { | ||
enumerable: !0, | ||
configurable: !1, | ||
get: () => d !== null ? d : (v !== t.namespaces && (v = t.namespaces, _ = t.enabled(o)), _), | ||
get: () => d !== null ? d : (g !== t.namespaces && (g = t.namespaces, E = t.enabled(i)), E), | ||
set: (h) => { | ||
@@ -562,37 +576,37 @@ d = h; | ||
} | ||
function r(o, u) { | ||
const d = t(this.namespace + (typeof u > "u" ? ":" : u) + o); | ||
function r(i, u) { | ||
const d = t(this.namespace + (typeof u > "u" ? ":" : u) + i); | ||
return d.log = this.log, d; | ||
} | ||
function a(o) { | ||
t.save(o), t.namespaces = o, t.names = [], t.skips = []; | ||
function a(i) { | ||
t.save(i), t.namespaces = i, t.names = [], t.skips = []; | ||
let u; | ||
const d = (typeof o == "string" ? o : "").split(/[\s,]+/), v = d.length; | ||
for (u = 0; u < v; u++) | ||
d[u] && (o = d[u].replace(/\*/g, ".*?"), o[0] === "-" ? t.skips.push(new RegExp("^" + o.slice(1) + "$")) : t.names.push(new RegExp("^" + o + "$"))); | ||
const d = (typeof i == "string" ? i : "").split(/[\s,]+/), g = d.length; | ||
for (u = 0; u < g; u++) | ||
d[u] && (i = d[u].replace(/\*/g, ".*?"), i[0] === "-" ? t.skips.push(new RegExp("^" + i.slice(1) + "$")) : t.names.push(new RegExp("^" + i + "$"))); | ||
} | ||
function i() { | ||
const o = [ | ||
function o() { | ||
const i = [ | ||
...t.names.map(f), | ||
...t.skips.map(f).map((u) => "-" + u) | ||
].join(","); | ||
return t.enable(""), o; | ||
return t.enable(""), i; | ||
} | ||
function l(o) { | ||
if (o[o.length - 1] === "*") | ||
function l(i) { | ||
if (i[i.length - 1] === "*") | ||
return !0; | ||
let u, d; | ||
for (u = 0, d = t.skips.length; u < d; u++) | ||
if (t.skips[u].test(o)) | ||
if (t.skips[u].test(i)) | ||
return !1; | ||
for (u = 0, d = t.names.length; u < d; u++) | ||
if (t.names[u].test(o)) | ||
if (t.names[u].test(i)) | ||
return !0; | ||
return !1; | ||
} | ||
function f(o) { | ||
return o.toString().substring(2, o.toString().length - 2).replace(/\.\*\?$/, "*"); | ||
function f(i) { | ||
return i.toString().substring(2, i.toString().length - 2).replace(/\.\*\?$/, "*"); | ||
} | ||
function c(o) { | ||
return o instanceof Error ? o.stack || o.message : o; | ||
function c(i) { | ||
return i instanceof Error ? i.stack || i.message : i; | ||
} | ||
@@ -604,5 +618,5 @@ function s() { | ||
} | ||
var Ee = Me; | ||
var Me = Ee; | ||
(function(n, e) { | ||
e.formatArgs = r, e.save = a, e.load = i, e.useColors = t, e.storage = l(), e.destroy = (() => { | ||
e.formatArgs = r, e.save = a, e.load = o, e.useColors = t, e.storage = l(), e.destroy = (() => { | ||
let c = !1; | ||
@@ -702,5 +716,5 @@ return () => { | ||
c.splice(1, 0, s, "color: inherit"); | ||
let o = 0, u = 0; | ||
let i = 0, u = 0; | ||
c[0].replace(/%[a-zA-Z%]/g, (d) => { | ||
d !== "%%" && (o++, d === "%c" && (u = o)); | ||
d !== "%%" && (i++, d === "%c" && (u = i)); | ||
}), c.splice(u, 0, s); | ||
@@ -716,3 +730,3 @@ } | ||
} | ||
function i() { | ||
function o() { | ||
let c; | ||
@@ -731,3 +745,3 @@ try { | ||
} | ||
n.exports = Ee(e); | ||
n.exports = Me(e); | ||
const { formatters: f } = n.exports; | ||
@@ -753,3 +767,3 @@ f.j = function(c) { | ||
setup(n) { | ||
const e = Pe("modal-item"), t = n, r = te(t.id), a = j(), i = j(); | ||
const e = Pe("modal-item"), t = n, r = te(t.id), a = x(), o = x(); | ||
function l() { | ||
@@ -760,8 +774,8 @@ if (r.backgroundClose) | ||
} | ||
H(() => i.value, (c) => { | ||
H(() => o.value, (c) => { | ||
var s; | ||
if (r.instance = c, e(`Modal(${r.id}) instance is saved.`), r.draggable) { | ||
const o = `[modalid=_modal_${t.id}]`, u = typeof r.draggable == "string" ? r.draggable : o; | ||
const i = `[modalid=_modal_${t.id}]`, u = typeof r.draggable == "string" ? r.draggable : i; | ||
e(`The modal window is movable(${u}).`), a.value ? (e("Finding an item to drag: %s", u), f( | ||
(s = a.value) == null ? void 0 : s.querySelector(o), | ||
(s = a.value) == null ? void 0 : s.querySelector(i), | ||
a.value.querySelector(u) | ||
@@ -782,14 +796,14 @@ )) : e("The modal container is not mounted. Modal id %d.", r.id); | ||
} | ||
s.addEventListener("pointerdown", (o) => { | ||
var M; | ||
const u = (M = c.getAttribute("style")) == null ? void 0 : M.match(/transform: translate\((.*)px,\s*(.*)px\)/), d = u == null ? void 0 : u[1], v = u == null ? void 0 : u[2]; | ||
let _ = typeof d == "string" ? Number.parseInt(d) : 0, m = typeof v == "string" ? Number.parseInt(v) : 0; | ||
const { clientX: h, clientY: C } = o, F = h, P = C; | ||
e(`movement started at (${P}, ${P})`), document.addEventListener("pointermove", y, { passive: !0 }), document.addEventListener("pointerup", $, { once: !0 }); | ||
function y(A) { | ||
const { clientX: R, clientY: O } = A, z = _ + R - F, B = m + O - P; | ||
e(`move at (${z}, ${B})`), c.style.transform = `translate(${z}px,${B}px)`; | ||
s.addEventListener("pointerdown", (i) => { | ||
var k; | ||
const u = (k = c.getAttribute("style")) == null ? void 0 : k.match(/transform: translate\((.*)px,\s*(.*)px\)/), d = u == null ? void 0 : u[1], g = u == null ? void 0 : u[2]; | ||
let E = typeof d == "string" ? Number.parseInt(d) : 0, m = typeof g == "string" ? Number.parseInt(g) : 0; | ||
const { clientX: h, clientY: p } = i, M = h, P = p; | ||
e(`movement started at (${P}, ${P})`), document.addEventListener("pointermove", b, { passive: !0 }), document.addEventListener("pointerup", B, { once: !0 }); | ||
function b(A) { | ||
const { clientX: N, clientY: O } = A, $ = E + N - M, z = m + O - P; | ||
e(`move at (${$}, ${z})`), c.style.transform = `translate(${$}px,${z}px)`; | ||
} | ||
function $(A) { | ||
e("movement completed"), document.removeEventListener("pointermove", y), A.preventDefault(); | ||
function B(A) { | ||
e("movement completed"), document.removeEventListener("pointermove", b), A.preventDefault(); | ||
} | ||
@@ -808,3 +822,3 @@ }); | ||
ref_key: "modalRef", | ||
ref: i | ||
ref: o | ||
}, he(T(r).events)), null, 16, ["modalId"])) | ||
@@ -814,7 +828,7 @@ ], 40, Ae)); | ||
}); | ||
function Ne(n) { | ||
n === void 0 && (n = E.DEFAULT_NAMESPACE); | ||
var e = E.instance.getByName(n); | ||
e.initialized = !0, n === E.DEFAULT_NAMESPACE && document.addEventListener("keyup", function(t) { | ||
if (w.escClose && (t.key === "Escape" || t.code === "Escape")) { | ||
function Re(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 (C.escClose && (t.key === "Escape" || t.code === "Escape")) { | ||
var r = re(n); | ||
@@ -834,6 +848,6 @@ if (!r) | ||
return Z(() => { | ||
Ne(n.namespace); | ||
Re(n.namespace); | ||
}), () => { | ||
const e = p(n.namespace); | ||
return G(me, { name: w.animation, tag: "div" }, { | ||
const e = y(n.namespace); | ||
return G(me, { name: C.animation, tag: "div", appear: C.appear }, { | ||
default: () => e.queue.map((t) => G(X, { | ||
@@ -848,13 +862,13 @@ key: t.id, | ||
}; | ||
var N = { | ||
var R = { | ||
router: null | ||
}; | ||
function Re(n) { | ||
function Ne(n) { | ||
var e = this; | ||
if (N.router) | ||
throw g.DuplicatedRouterIntegration(); | ||
N.router = n; | ||
if (R.router) | ||
throw v.DuplicatedRouterIntegration(); | ||
R.router = n; | ||
function t(r) { | ||
for (var a = r.matched.length - 1; a >= 0; a--) { | ||
var i = r.matched[a].components, l = Object.values(i).find(function(f) { | ||
var o = r.matched[a].components, l = Object.values(o).find(function(f) { | ||
return f._isModal; | ||
@@ -868,8 +882,8 @@ }); | ||
n.beforeEach(function(r, a) { | ||
return k(e, void 0, void 0, function() { | ||
var i, l, f; | ||
return S(this, function(c) { | ||
return _(e, void 0, void 0, function() { | ||
var o, l, f; | ||
return F(this, function(c) { | ||
switch (c.label) { | ||
case 0: | ||
return c.trys.push([0, 3, , 4]), i = t(a), i && !(!((f = (l = i.getModalObject()) === null || l === void 0 ? void 0 : l.closed) === null || f === void 0) && f.value) ? [4, i.close(!0)] : [3, 2]; | ||
return c.trys.push([0, 3, , 4]), o = t(a), o && !(!((f = (l = o.getModalObject()) === null || l === void 0 ? void 0 : l.closed) === null || f === void 0) && f.value) ? [4, o.close(!0)] : [3, 2]; | ||
case 1: | ||
@@ -890,10 +904,10 @@ c.sent(), c.label = 2; | ||
}), n.afterEach(function(r) { | ||
return k(e, void 0, void 0, function() { | ||
return _(e, void 0, void 0, function() { | ||
var a; | ||
return S(this, function(i) { | ||
switch (i.label) { | ||
return F(this, function(o) { | ||
switch (o.label) { | ||
case 0: | ||
return a = t(r), a ? [4, a.initialize()] : [3, 2]; | ||
case 1: | ||
i.sent(), i.label = 2; | ||
o.sent(), o.label = 2; | ||
case 2: | ||
@@ -912,16 +926,16 @@ return [ | ||
function r() { | ||
return k(this, void 0, void 0, function() { | ||
return S(this, function(a) { | ||
return _(this, void 0, void 0, function() { | ||
return F(this, function(a) { | ||
switch (a.label) { | ||
case 0: | ||
if (!N.router) | ||
throw g.ModalRouterIntegrationNotInitialized(); | ||
if (!R.router) | ||
throw v.ModalRouterIntegrationNotInitialized(); | ||
return t = !1, e = null, [4, be(n, J(function() { | ||
var i; | ||
return (i = N.router) === null || i === void 0 ? void 0 : i.currentRoute.value.params; | ||
var o; | ||
return (o = R.router) === null || o === void 0 ? void 0 : o.currentRoute.value.params; | ||
}), { isRoute: !0 })]; | ||
case 1: | ||
return e = a.sent(), e.onclose = function() { | ||
var i; | ||
t || (i = N.router) === null || i === void 0 || i.back(); | ||
var o; | ||
t || (o = R.router) === null || o === void 0 || o.back(); | ||
}, [ | ||
@@ -945,9 +959,9 @@ 2 | ||
close: function(a) { | ||
return a === void 0 && (a = !1), k(this, void 0, void 0, function() { | ||
return S(this, function(i) { | ||
switch (i.label) { | ||
return a === void 0 && (a = !1), _(this, void 0, void 0, function() { | ||
return F(this, function(o) { | ||
switch (o.label) { | ||
case 0: | ||
return t = a, e ? [4, e.close()] : [3, 2]; | ||
case 1: | ||
return [2, i.sent()]; | ||
return [2, o.sent()]; | ||
case 2: | ||
@@ -977,6 +991,6 @@ return [ | ||
} | ||
Ie.init = Re; | ||
var Le = p().queue; | ||
function $e(n) { | ||
return p(n).queue; | ||
Ie.init = Ne; | ||
var Le = y().queue; | ||
function Be(n) { | ||
return y(n).queue; | ||
} | ||
@@ -986,10 +1000,10 @@ export { | ||
L as closeById, | ||
pe as closeModal, | ||
xe as config, | ||
Ce as closeModal, | ||
je as config, | ||
qe as container, | ||
we as getComponentFromStore, | ||
re as getCurrentModal, | ||
$e as getQueueByNamespace, | ||
Be as getQueueByNamespace, | ||
Le as modalQueue, | ||
je as onBeforeModalClose, | ||
xe as onBeforeModalClose, | ||
be as openModal, | ||
@@ -996,0 +1010,0 @@ Te as popModal, |
(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.6 | ||
* jenesius-vue-modal v1.11.7 | ||
* (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 a in r)Object.prototype.hasOwnProperty.call(r,a)&&(t[a]=r[a])},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 M(n,e,t,r){function a(i){return i instanceof t?i:new t(function(l){l(i)})}return new(t||(t=Promise))(function(i,l){function h(o){try{s(r.next(o))}catch(u){l(u)}}function c(o){try{s(r.throw(o))}catch(u){l(u)}}function s(o){o.done?i(o.value):a(o.value).then(h,c)}s((r=r.apply(n,e||[])).next())})}function E(n,e){var t={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},r,a,i,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(o){return c([s,o])}}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,a&&(i=s[0]&2?a.return:s[0]?a.throw||((i=a.return)&&i.call(a),0):a.next)&&!(i=i.call(a,s[1])).done)return i;switch(a=0,i&&(s=[s[0]&2,i.value]),s[0]){case 0:case 1:i=s;break;case 4:return t.label++,{value:s[1],done:!1};case 5:t.label++,a=s[1],s=[0];continue;case 7:s=t.ops.pop(),t.trys.pop();continue;default:if(i=t.trys,!(i=i.length>0&&i[i.length-1])&&(s[0]===6||s[0]===2)){t=0;continue}if(s[0]===3&&(!i||s[1]>i[0]&&s[1]<i[3])){t.label=s[1];break}if(s[0]===6&&t.label<i[1]){t.label=i[1],i=s;break}if(i&&t.label<i[2]){t.label=i[2],t.ops.push(s);break}i[2]&&t.ops.pop(),t.trys.pop();continue}s=e.call(n,t)}catch(o){s=[6,o],a=0}finally{r=i=0}if(s[0]&5)throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}}typeof SuppressedError=="function"&&SuppressedError;var v=function(n){re(e,n);function e(t,r){r===void 0&&(r=null);var a=n.call(this)||this;return a.isModalError=!0,a.message=t,a.details=r,a}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.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),k=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 k,e={scrollLock:!0,animation:"modal-list",backgroundClose:!0,escClose:!0,store:{},skipInitCheck:!1,draggable:!1},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 y(n){return z.namespaceStore.getByName(n)}var w=z.configuration;function U(n){var e={backgroundClose:w.backgroundClose,isRoute:!1,namespace:k.DEFAULT_NAMESPACE,draggable:w.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=N.STORE.get(n);if(!t)return Promise.reject(v.ModalNotFoundByID(n));var r=y(t.namespace),a=r.queue.findIndex(function(l){return l.id===n});if(a===-1)return Promise.reject(v.Undefined(n));var i=_.get(n,"close").map(function(l){return ie(l,n,G(e))});return X(i).then(function(){r.queue.splice(a,1)}).then(function(){_.get(n,"destroy").forEach(function(l){return l(G(e))})}).then(function(){_.delete(n)})}var N=function(){function n(e,t,r){var a=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!y(r.namespace).queue.includes(a)}),e.beforeModalClose&&_.add(this.id,"close",e.beforeModalClose);var i=U(r);this.backgroundClose=i.backgroundClose,this.isRoute=i.isRoute,this.namespace=i.namespace,this.draggable=i.draggable,n.STORE.set(this.id,this)}return n.prototype.close=function(){return T(this.id)},Object.defineProperty(n.prototype,"onclose",{set:function(e){_.add(this.id,"close",e)},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"ondestroy",{set:function(e){_.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 a=r.events[e].indexOf(t);a!==-1&&r.events[e].splice(a,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 N.STORE.get(n)}var oe={store:{},add:function(n,e,t){var r,a;if(typeof t!="function")throw v.GuardDeclarationType(t);this.store[n]||(this.store[n]=(r={},r[e]=[],r)),this.store[n][e]||(this.store[n][e]=[]),(a=this.store[n][e])===null||a===void 0||a.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 _=oe;function X(n){return n.reduce(function(e,t){return e.then(function(){return t()})},Promise.resolve())}function ie(n,e,t){return function(){return new Promise(function(r,a){var i,l=function(h){h===void 0&&(h=!0),h===!1&&a(v.NextReject(e)),r()};Promise.resolve(n.call((i=Y(e))===null||i===void 0?void 0:i.instance,t)).then(l).catch(function(h){return a(h)})})}}function W(n){return n=Q(n),X(y(n.namespace).queue.map(function(e){return function(){return e.close()}}))}function q(n){var e=y(n),t=e.queue;if(t.length!==0)return t[t.length-1]}function ae(n){n=Q(n);var e=q(n.namespace);return e?e.close():Promise.resolve()}function ue(n,e,t){var r=U(t),a=y(r.namespace);if(r.namespace===k.DEFAULT_NAMESPACE&&!a.initialized&&!w.skipInitCheck)throw v.NotInitialized(r.namespace);if(typeof n=="string"){var i=H(n);if(!i)throw v.ModalNotExistsInStore(n);n=i}if(!n)throw v.ModalComponentNotProvided();var l=new N(n,e,r);return a.queue.push(f.markRaw(l)),l}function L(n,e,t){return e===void 0&&(e={}),t===void 0&&(t={}),Promise.resolve().then(function(){return ue(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=y(t.namespace);if(r.queue.length)throw v.QueueNoEmpty()}).then(function(){return L(n,e,t)})}function se(n){if(typeof n!="object")throw v.ConfigurationType(n);Object.assign(w,n)}function ce(n){var e,t,r,a=f.getCurrentInstance(),i=String(((e=a==null?void 0:a.props)===null||e===void 0?void 0:e.modalId)||((t=a==null?void 0:a.props)===null||t===void 0?void 0:t["modal-id"])||((r=a==null?void 0:a.attrs)===null||r===void 0?void 0:r.modalId)),l=i.replace(/[^0-9]/g,"");_.add(Number(l),"close",n)}function le(n,e,t){return e===void 0&&(e={}),t===void 0&&(t={}),M(this,void 0,void 0,function(){var r,a,i=this;return E(this,function(l){switch(l.label){case 0:return[4,L(n,e,t)];case 1:return r=l.sent(),a=!1,[2,new Promise(function(h){r.on(N.EVENT_PROMPT,function(c){return M(i,void 0,void 0,function(){return E(this,function(s){return a=!0,[2,r.close().then(function(){return h(c)}).catch(function(){return a=!1})]})})}),r.ondestroy=function(){a||h(null)}})]}})})}function H(n){return w.store[n]||void 0}function de(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var B={exports:{}},$,V;function fe(){if(V)return $;V=1;var n=1e3,e=n*60,t=e*60,r=t*24,a=r*7,i=r*365.25;$=function(o,u){u=u||{};var d=typeof o;if(d==="string"&&o.length>0)return l(o);if(d==="number"&&isFinite(o))return u.long?c(o):h(o);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(o))};function l(o){if(o=String(o),!(o.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(o);if(u){var d=parseFloat(u[1]),p=(u[2]||"ms").toLowerCase();switch(p){case"years":case"year":case"yrs":case"yr":case"y":return d*i;case"weeks":case"week":case"w":return d*a;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(o){var u=Math.abs(o);return u>=r?Math.round(o/r)+"d":u>=t?Math.round(o/t)+"h":u>=e?Math.round(o/e)+"m":u>=n?Math.round(o/n)+"s":o+"ms"}function c(o){var u=Math.abs(o);return u>=r?s(o,u,r,"day"):u>=t?s(o,u,t,"hour"):u>=e?s(o,u,e,"minute"):u>=n?s(o,u,n,"second"):o+" ms"}function s(o,u,d,p){var S=u>=d*1.5;return Math.round(o/d)+" "+p+(S?"s":"")}return $}function he(n){t.debug=t,t.default=t,t.coerce=c,t.disable=i,t.enable=a,t.enabled=l,t.humanize=fe(),t.destroy=s,Object.keys(n).forEach(o=>{t[o]=n[o]}),t.names=[],t.skips=[],t.formatters={};function e(o){let u=0;for(let d=0;d<o.length;d++)u=(u<<5)-u+o.charCodeAt(d),u|=0;return t.colors[Math.abs(u)%t.colors.length]}t.selectColor=e;function t(o){let u,d=null,p,S;function C(...g){if(!C.enabled)return;const b=C,P=Number(new Date),I=P-(u||P);b.diff=I,b.prev=u,b.curr=P,u=P,g[0]=t.coerce(g[0]),typeof g[0]!="string"&&g.unshift("%O");let F=0;g[0]=g[0].replace(/%([a-zA-Z%])/g,(A,O)=>{if(A==="%%")return"%";F++;const j=t.formatters[O];if(typeof j=="function"){const x=g[F];A=j.call(b,x),g.splice(F,1),F--}return A}),t.formatArgs.call(b,g),(b.log||t.log).apply(b,g)}return C.namespace=o,C.useColors=t.useColors(),C.color=t.selectColor(o),C.extend=r,C.destroy=t.destroy,Object.defineProperty(C,"enabled",{enumerable:!0,configurable:!1,get:()=>d!==null?d:(p!==t.namespaces&&(p=t.namespaces,S=t.enabled(o)),S),set:g=>{d=g}}),typeof t.init=="function"&&t.init(C),C}function r(o,u){const d=t(this.namespace+(typeof u>"u"?":":u)+o);return d.log=this.log,d}function a(o){t.save(o),t.namespaces=o,t.names=[],t.skips=[];let u;const d=(typeof o=="string"?o:"").split(/[\s,]+/),p=d.length;for(u=0;u<p;u++)d[u]&&(o=d[u].replace(/\*/g,".*?"),o[0]==="-"?t.skips.push(new RegExp("^"+o.slice(1)+"$")):t.names.push(new RegExp("^"+o+"$")))}function i(){const o=[...t.names.map(h),...t.skips.map(h).map(u=>"-"+u)].join(",");return t.enable(""),o}function l(o){if(o[o.length-1]==="*")return!0;let u,d;for(u=0,d=t.skips.length;u<d;u++)if(t.skips[u].test(o))return!1;for(u=0,d=t.names.length;u<d;u++)if(t.names[u].test(o))return!0;return!1}function h(o){return o.toString().substring(2,o.toString().length-2).replace(/\.\*\?$/,"*")}function c(o){return o instanceof Error?o.stack||o.message:o}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 me=he;(function(n,e){e.formatArgs=r,e.save=a,e.load=i,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 o=0,u=0;c[0].replace(/%[a-zA-Z%]/g,d=>{d!=="%%"&&(o++,d==="%c"&&(u=o))}),c.splice(u,0,s)}e.log=console.debug||console.log||(()=>{});function a(c){try{c?e.storage.setItem("debug",c):e.storage.removeItem("debug")}catch{}}function i(){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=me(e);const{formatters:h}=n.exports;h.j=function(c){try{return JSON.stringify(c)}catch(s){return"[UnexpectedJSONParseError]: "+s.message}}})(B,B.exports);var ge=B.exports;const Ce=de(ge);function ve(n){return Ce("jenesius-vue-modal:".concat(n))}const pe=["onPointerdown"],Z=f.defineComponent({__name:"WidgetModalContainerItem",props:{id:{}},setup(n){const e=ve("modal-item"),t=n,r=Y(t.id),a=f.ref(),i=f.ref();function l(){if(r.backgroundClose)return T(r.id,{background:!0}).catch(()=>{})}f.watch(()=>i.value,c=>{var s;if(r.instance=c,e(`Modal(${r.id}) instance is saved.`),r.draggable){const o=`[modalid=_modal_${t.id}]`,u=typeof r.draggable=="string"?r.draggable:o;e(`The modal window is movable(${u}).`),a.value?(e("Finding an item to drag: %s",u),h((s=a.value)==null?void 0:s.querySelector(o),a.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",o=>{var A;const u=(A=c.getAttribute("style"))==null?void 0:A.match(/transform: translate\((.*)px,\s*(.*)px\)/),d=u==null?void 0:u[1],p=u==null?void 0:u[2];let S=typeof d=="string"?Number.parseInt(d):0,C=typeof p=="string"?Number.parseInt(p):0;const{clientX:g,clientY:b}=o,P=g,I=b;e(`movement started at (${I}, ${I})`),document.addEventListener("pointermove",F,{passive:!0}),document.addEventListener("pointerup",ee,{once:!0});function F(O){const{clientX:j,clientY:x}=O,te=S+j-P,ne=C+x-I;e(`move at (${te}, ${ne})`),c.style.transform=`translate(${te}px,${ne}px)`}function ee(O){e("movement completed"),document.removeEventListener("pointermove",F),O.preventDefault()}})}return(c,s)=>(f.openBlock(),f.createElementBlock("div",{class:"widget__modal-container__item modal-container",onPointerdown:f.withModifiers(l,["self","stop"]),ref_key:"modalContainerRef",ref:a},[(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:i},f.toHandlers(f.unref(r).events)),null,16,["modalId"]))],40,pe))}}),Me="";function ye(n){n===void 0&&(n=k.DEFAULT_NAMESPACE);var e=k.instance.getByName(n);e.initialized=!0,n===k.DEFAULT_NAMESPACE&&document.addEventListener("keyup",function(t){if(w.escClose&&(t.key==="Escape"||t.code==="Escape")){var r=q(n);if(!r)return;T(r.id,{esc:!0}).catch(function(){})}})}const Ee="",be={props:{namespace:String},setup(n){return f.onMounted(()=>{ye(n.namespace)}),()=>{const e=y(n.namespace);return f.h(f.TransitionGroup,{name:w.animation,tag:"div"},{default:()=>e.queue.map(t=>f.h(Z,{key:t.id,id:t.id}))})}},components:{WidgetContainerModalItem:Z}};var R={router:null};function we(n){var e=this;if(R.router)throw v.DuplicatedRouterIntegration();R.router=n;function t(r){for(var a=r.matched.length-1;a>=0;a--){var i=r.matched[a].components,l=Object.values(i).find(function(h){return h._isModal});if(l)return l}return null}n.beforeEach(function(r,a){return M(e,void 0,void 0,function(){var i,l,h;return E(this,function(c){switch(c.label){case 0:return c.trys.push([0,3,,4]),i=t(a),i&&!(!((h=(l=i.getModalObject())===null||l===void 0?void 0:l.closed)===null||h===void 0)&&h.value)?[4,i.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 M(e,void 0,void 0,function(){var a;return E(this,function(i){switch(i.label){case 0:return a=t(r),a?[4,a.initialize()]:[3,2];case 1:i.sent(),i.label=2;case 2:return[2]}})})})}function K(n){var e=null,t=!1;function r(){return M(this,void 0,void 0,function(){return E(this,function(a){switch(a.label){case 0:if(!R.router)throw v.ModalRouterIntegrationNotInitialized();return t=!1,e=null,[4,J(n,f.computed(function(){var i;return(i=R.router)===null||i===void 0?void 0:i.currentRoute.value.params}),{isRoute:!0})];case 1:return e=a.sent(),e.onclose=function(){var i;t||(i=R.router)===null||i===void 0||i.back()},[2]}})})}return{getModalObject:function(){return e},_isModal:!0,close:function(a){return a===void 0&&(a=!1),M(this,void 0,void 0,function(){return E(this,function(i){switch(i.label){case 0:return t=a,e?[4,e.close()]:[3,2];case 1:return[2,i.sent()];case 2:return[2]}})})},initialize:r,setup:function(){return function(){return null}}}}K.init=we;var _e=y().queue;function Fe(n){return y(n).queue}m.Modal=N,m.closeById=T,m.closeModal=W,m.config=se,m.container=be,m.getComponentFromStore=H,m.getCurrentModal=q,m.getQueueByNamespace=Fe,m.modalQueue=_e,m.onBeforeModalClose=ce,m.openModal=J,m.popModal=ae,m.promptModal=le,m.pushModal=L,m.useModalRouter=K,Object.defineProperty(m,Symbol.toStringTag,{value:"Module"})}); | ||
*/var D=function(n,e){return D=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,r){t.__proto__=r}||function(t,r){for(var a in r)Object.prototype.hasOwnProperty.call(r,a)&&(t[a]=r[a])},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 a(o){return o instanceof t?o:new t(function(l){l(o)})}return new(t||(t=Promise))(function(o,l){function h(i){try{s(r.next(i))}catch(u){l(u)}}function c(i){try{s(r.throw(i))}catch(u){l(u)}}function s(i){i.done?o(i.value):a(i.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,a,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(i){return c([s,i])}}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,a&&(o=s[0]&2?a.return:s[0]?a.throw||((o=a.return)&&o.call(a),0):a.next)&&!(o=o.call(a,s[1])).done)return o;switch(a=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++,a=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(i){s=[6,i],a=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 a=n.call(this)||this;return a.isModalError=!0,a.message=t,a.details=r,a}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),k=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 k,e={scrollLock:!0,animation:"modal-list",backgroundClose:!0,escClose:!0,store:{},skipInitCheck:!1,draggable:!1,appear:!0,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 y(n){return z.namespaceStore.getByName(n)}var b=z.configuration;function U(n){var e={backgroundClose:b.backgroundClose,isRoute:!1,namespace:k.DEFAULT_NAMESPACE,draggable:b.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=y(t.namespace),a=r.queue.findIndex(function(l){return l.id===n});if(a===-1)return Promise.reject(p.Undefined(n));var o=M.get(n,"close").map(function(l){return ie(l,n,G(e))});return X(o).then(function(){r.queue.splice(a,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 a=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!y(r.namespace).queue.includes(a)}),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 a=r.events[e].indexOf(t);a!==-1&&r.events[e].splice(a,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 oe={store:{},add:function(n,e,t){var r,a;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]=[]),(a=this.store[n][e])===null||a===void 0||a.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=oe;function X(n){return n.reduce(function(e,t){return e.then(function(){return t()})},Promise.resolve())}function ie(n,e,t){return function(){return new Promise(function(r,a){var o,l=function(h){h===void 0&&(h=!0),h===!1&&a(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 a(h)})})}}function W(n){return n=Q(n),X(y(n.namespace).queue.map(function(e){return function(){return e.close()}}))}function B(n){var e=y(n),t=e.queue;if(t.length!==0)return t[t.length-1]}function ae(n){n=Q(n);var e=B(n.namespace);return e?e.close():Promise.resolve()}function ue(n,e,t){return _(this,void 0,void 0,function(){var r,a,o,l;return F(this,function(h){switch(h.label){case 0:if(r=U(t),a=y(r.namespace),r.namespace===k.DEFAULT_NAMESPACE&&!a.initialized&&!b.skipInitCheck)throw p.NotInitialized(r.namespace);return[4,b.beforeEach()];case 1:if(h.sent()===!1)throw p.RejectedByBeforeEach();if(typeof n=="string"){if(o=H(n),!o)throw p.ModalNotExistsInStore(n);n=o}if(!n)throw p.ModalComponentNotProvided();return l=new A(n,e,r),a.queue.push(f.markRaw(l)),[2,l]}})})}function q(n,e,t){return e===void 0&&(e={}),t===void 0&&(t={}),Promise.resolve().then(function(){return ue(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=y(t.namespace);if(r.queue.length)throw p.QueueNoEmpty()}).then(function(){return q(n,e,t)})}function se(n){if(typeof n!="object")throw p.ConfigurationType(n);Object.assign(b,n)}function ce(n){var e,t,r,a=f.getCurrentInstance(),o=String(((e=a==null?void 0:a.props)===null||e===void 0?void 0:e.modalId)||((t=a==null?void 0:a.props)===null||t===void 0?void 0:t["modal-id"])||((r=a==null?void 0:a.attrs)===null||r===void 0?void 0:r.modalId)),l=o.replace(/[^0-9]/g,"");M.add(Number(l),"close",n)}function le(n,e,t){return e===void 0&&(e={}),t===void 0&&(t={}),_(this,void 0,void 0,function(){var r,a,o=this;return F(this,function(l){switch(l.label){case 0:return[4,q(n,e,t)];case 1:return r=l.sent(),a=!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 a=!0,[2,r.close().then(function(){return h(c)}).catch(function(){return a=!1})]})})}),r.ondestroy=function(){a||h(null)}})]}})})}function H(n){return b.store[n]||void 0}function de(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var L={exports:{}},$,V;function fe(){if(V)return $;V=1;var n=1e3,e=n*60,t=e*60,r=t*24,a=r*7,o=r*365.25;$=function(i,u){u=u||{};var d=typeof i;if(d==="string"&&i.length>0)return l(i);if(d==="number"&&isFinite(i))return u.long?c(i):h(i);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(i))};function l(i){if(i=String(i),!(i.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(i);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*a;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(i){var u=Math.abs(i);return u>=r?Math.round(i/r)+"d":u>=t?Math.round(i/t)+"h":u>=e?Math.round(i/e)+"m":u>=n?Math.round(i/n)+"s":i+"ms"}function c(i){var u=Math.abs(i);return u>=r?s(i,u,r,"day"):u>=t?s(i,u,t,"hour"):u>=e?s(i,u,e,"minute"):u>=n?s(i,u,n,"second"):i+" ms"}function s(i,u,d,v){var S=u>=d*1.5;return Math.round(i/d)+" "+v+(S?"s":"")}return $}function he(n){t.debug=t,t.default=t,t.coerce=c,t.disable=o,t.enable=a,t.enabled=l,t.humanize=fe(),t.destroy=s,Object.keys(n).forEach(i=>{t[i]=n[i]}),t.names=[],t.skips=[],t.formatters={};function e(i){let u=0;for(let d=0;d<i.length;d++)u=(u<<5)-u+i.charCodeAt(d),u|=0;return t.colors[Math.abs(u)%t.colors.length]}t.selectColor=e;function t(i){let u,d=null,v,S;function C(...g){if(!C.enabled)return;const w=C,P=Number(new Date),I=P-(u||P);w.diff=I,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,O)=>{if(R==="%%")return"%";E++;const j=t.formatters[O];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=i,C.useColors=t.useColors(),C.color=t.selectColor(i),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,S=t.enabled(i)),S),set:g=>{d=g}}),typeof t.init=="function"&&t.init(C),C}function r(i,u){const d=t(this.namespace+(typeof u>"u"?":":u)+i);return d.log=this.log,d}function a(i){t.save(i),t.namespaces=i,t.names=[],t.skips=[];let u;const d=(typeof i=="string"?i:"").split(/[\s,]+/),v=d.length;for(u=0;u<v;u++)d[u]&&(i=d[u].replace(/\*/g,".*?"),i[0]==="-"?t.skips.push(new RegExp("^"+i.slice(1)+"$")):t.names.push(new RegExp("^"+i+"$")))}function o(){const i=[...t.names.map(h),...t.skips.map(h).map(u=>"-"+u)].join(",");return t.enable(""),i}function l(i){if(i[i.length-1]==="*")return!0;let u,d;for(u=0,d=t.skips.length;u<d;u++)if(t.skips[u].test(i))return!1;for(u=0,d=t.names.length;u<d;u++)if(t.names[u].test(i))return!0;return!1}function h(i){return i.toString().substring(2,i.toString().length-2).replace(/\.\*\?$/,"*")}function c(i){return i instanceof Error?i.stack||i.message:i}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 me=he;(function(n,e){e.formatArgs=r,e.save=a,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 i=0,u=0;c[0].replace(/%[a-zA-Z%]/g,d=>{d!=="%%"&&(i++,d==="%c"&&(u=i))}),c.splice(u,0,s)}e.log=console.debug||console.log||(()=>{});function a(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=me(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 ge=L.exports;const pe=de(ge);function Ce(n){return pe("jenesius-vue-modal:".concat(n))}const ve=["onPointerdown"],Z=f.defineComponent({__name:"WidgetModalContainerItem",props:{id:{}},setup(n){const e=Ce("modal-item"),t=n,r=Y(t.id),a=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 i=`[modalid=_modal_${t.id}]`,u=typeof r.draggable=="string"?r.draggable:i;e(`The modal window is movable(${u}).`),a.value?(e("Finding an item to drag: %s",u),h((s=a.value)==null?void 0:s.querySelector(i),a.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",i=>{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 S=typeof d=="string"?Number.parseInt(d):0,C=typeof v=="string"?Number.parseInt(v):0;const{clientX:g,clientY:w}=i,P=g,I=w;e(`movement started at (${I}, ${I})`),document.addEventListener("pointermove",E,{passive:!0}),document.addEventListener("pointerup",ee,{once:!0});function E(O){const{clientX:j,clientY:x}=O,te=S+j-P,ne=C+x-I;e(`move at (${te}, ${ne})`),c.style.transform=`translate(${te}px,${ne}px)`}function ee(O){e("movement completed"),document.removeEventListener("pointermove",E),O.preventDefault()}})}return(c,s)=>(f.openBlock(),f.createElementBlock("div",{class:"widget__modal-container__item modal-container",onPointerdown:f.withModifiers(l,["self","stop"]),ref_key:"modalContainerRef",ref:a},[(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,ve))}}),Me="";function ye(n){n===void 0&&(n=k.DEFAULT_NAMESPACE);var e=k.instance.getByName(n);e.initialized=!0,n===k.DEFAULT_NAMESPACE&&document.addEventListener("keyup",function(t){if(b.escClose&&(t.key==="Escape"||t.code==="Escape")){var r=B(n);if(!r)return;T(r.id,{esc:!0}).catch(function(){})}})}const Ee="",be={props:{namespace:String},setup(n){return f.onMounted(()=>{ye(n.namespace)}),()=>{const e=y(n.namespace);return f.h(f.TransitionGroup,{name:b.animation,tag:"div",appear:b.appear},{default:()=>e.queue.map(t=>f.h(Z,{key:t.id,id:t.id}))})}},components:{WidgetContainerModalItem:Z}};var N={router:null};function we(n){var e=this;if(N.router)throw p.DuplicatedRouterIntegration();N.router=n;function t(r){for(var a=r.matched.length-1;a>=0;a--){var o=r.matched[a].components,l=Object.values(o).find(function(h){return h._isModal});if(l)return l}return null}n.beforeEach(function(r,a){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(a),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 a;return F(this,function(o){switch(o.label){case 0:return a=t(r),a?[4,a.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(a){switch(a.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=a.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(a){return a===void 0&&(a=!1),_(this,void 0,void 0,function(){return F(this,function(o){switch(o.label){case 0:return t=a,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=we;var _e=y().queue;function Fe(n){return y(n).queue}m.Modal=A,m.closeById=T,m.closeModal=W,m.config=se,m.container=be,m.getComponentFromStore=H,m.getCurrentModal=B,m.getQueueByNamespace=Fe,m.modalQueue=_e,m.onBeforeModalClose=ce,m.openModal=J,m.popModal=ae,m.promptModal=le,m.pushModal=q,m.useModalRouter=K,Object.defineProperty(m,Symbol.toStringTag,{value:"Module"})}); | ||
//# sourceMappingURL=jenesius-vue-modal.umd.js.map |
@@ -9,2 +9,2 @@ import Modal, { ModalOptions } from "../utils/Modal"; | ||
* */ | ||
export default function _addModal(component: string | Component, params: any, modalOptions: Partial<ModalOptions>): Modal; | ||
export default function _addModal(component: string | Component, params: any, modalOptions: Partial<ModalOptions>): Promise<Modal>; |
@@ -14,2 +14,3 @@ /** | ||
static GuardDeclarationType(func: Function): ModalError; | ||
static RejectedByBeforeEach(): ModalError; | ||
static ConfigurationType(config: object): ModalError; | ||
@@ -16,0 +17,0 @@ static ConfigurationUndefinedParam(param: string, availableParams: Array<string>): ModalError; |
@@ -44,3 +44,12 @@ /** | ||
draggable: boolean | string; | ||
/** | ||
* @description TransitionGroup appear prop. For more details https://vuejs.org/guide/built-ins/transition.html#transition-on-appear | ||
*/ | ||
appear: boolean; | ||
/** | ||
* @description A hook that will fire before opening each modal window. In this hook, you can cancel closing by | ||
* passing the value false. | ||
*/ | ||
beforeEach: () => any; | ||
store: Record<string, Component>; | ||
} |
{ | ||
"name": "jenesius-vue-modal", | ||
"version": "1.11.6", | ||
"version": "1.11.7", | ||
"private": false, | ||
@@ -5,0 +5,0 @@ "description": "The progressive and simple modal system for Vue.js v3", |
@@ -35,6 +35,8 @@ import {mount} from "@vue/test-utils"; | ||
const wrapper = await mount(App, {global: {plugins: [router]}}); | ||
const wrapper = await mount(App, { stubs: { | ||
transition: false | ||
}, global: {plugins: [router]}}); | ||
await nextTick(); | ||
await wait(1000) | ||
expect(wrapper.text()).toBe("Modal router"); | ||
@@ -48,8 +50,7 @@ }) | ||
const wrapper = await mount(App, {global: {plugins: [router]}}); | ||
await nextTick(); | ||
await wait(1000) | ||
expect(wrapper.text()).toBe("Modal router"); | ||
await router.push("/"); | ||
await wait() | ||
await wait(1000) | ||
expect(wrapper.text()).toBe("Test"); | ||
@@ -65,3 +66,3 @@ | ||
await nextTick(); | ||
await wait(1000) | ||
expect(wrapper.text()).toBe("user-3"); | ||
@@ -68,0 +69,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
346546
67
2947