jenesius-vue-modal
Advanced tools
Comparing version 1.11.3 to 1.11.4
(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.3 | ||
* jenesius-vue-modal v1.11.4 | ||
* (c) 2024 Jenesius | ||
* @license MIT | ||
*/Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const m=require("vue");var j=function(n,t){return j=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,a){e.__proto__=a}||function(e,a){for(var r in a)Object.prototype.hasOwnProperty.call(a,r)&&(e[r]=a[r])},j(n,t)};function ee(n,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");j(n,t);function e(){this.constructor=n}n.prototype=t===null?Object.create(t):(e.prototype=t.prototype,new e)}function k(n,t,e,a){function r(i){return i instanceof e?i:new e(function(c){c(i)})}return new(e||(e=Promise))(function(i,c){function f(o){try{s(a.next(o))}catch(u){c(u)}}function d(o){try{s(a.throw(o))}catch(u){c(u)}}function s(o){o.done?i(o.value):r(o.value).then(f,d)}s((a=a.apply(n,t||[])).next())})}function S(n,t){var e={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},a,r,i,c;return c={next:f(0),throw:f(1),return:f(2)},typeof Symbol=="function"&&(c[Symbol.iterator]=function(){return this}),c;function f(s){return function(o){return d([s,o])}}function d(s){if(a)throw new TypeError("Generator is already executing.");for(;c&&(c=0,s[0]&&(e=0)),e;)try{if(a=1,r&&(i=s[0]&2?r.return:s[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,s[1])).done)return i;switch(r=0,i&&(s=[s[0]&2,i.value]),s[0]){case 0:case 1:i=s;break;case 4:return e.label++,{value:s[1],done:!1};case 5:e.label++,r=s[1],s=[0];continue;case 7:s=e.ops.pop(),e.trys.pop();continue;default:if(i=e.trys,!(i=i.length>0&&i[i.length-1])&&(s[0]===6||s[0]===2)){e=0;continue}if(s[0]===3&&(!i||s[1]>i[0]&&s[1]<i[3])){e.label=s[1];break}if(s[0]===6&&e.label<i[1]){e.label=i[1],i=s;break}if(i&&e.label<i[2]){e.label=i[2],e.ops.push(s);break}i[2]&&e.ops.pop(),e.trys.pop();continue}s=t.call(n,e)}catch(o){s=[6,o],r=0}finally{a=i=0}if(s[0]&5)throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}}var g=function(n){ee(t,n);function t(e,a){a===void 0&&(a=null);var r=n.call(this)||this;return r.isModalError=!0,r.message=e,r.details=a,r}return t.Undefined=function(e){return new t("Modal with id: ".concat(e," not founded. The modal window may have been closed earlier."))},t.UndefinedGuardName=function(e){return new t("Guard's name ".concat(e," is not declaration."))},t.NextReject=function(e){return new t("Guard returned false. Modal navigation was stopped. Modal id ".concat(e))},t.GuardDeclarationType=function(e){return new t("Guard's type should be a function. Provided:",e)},t.ConfigurationType=function(e){return new t("Configuration type must be an Object. Provided",e)},t.ConfigurationUndefinedParam=function(e,a){return new t("In configuration founded unknown parameter: ".concat(e,". Available are ").concat(a.join(", ")," "))},t.QueueNoEmpty=function(){return new t("Modal's queue is not empty. Probably some modal reject closing by onClose hook.")},t.EmptyModalQueue=function(){return new t("Modal queue is empty.")},t.NotInitialized=function(e){return new t("Modal Container not found. Put container from jenesius-vue-modal in App's template. Namespace: ".concat(e,". Check documentation for more information https://modal.jenesius.com/docs.html/installation#getting-started."))},t.ModalComponentNotProvided=function(){return new t("The first parameter(VueComponent) was not specified.")},t.DuplicatedRouterIntegration=function(){return new t("useModalRouter.init should escaped only once.")},t.ModalRouterIntegrationNotInitialized=function(){return new t("The integration was not initialized. Please, use useModalRouter.init(router). For more information: https://modal.jenesius.com/docs.html/integration-vue-router#installation")},t.ModalEventNameMustBeString=function(e){return new t("Event name must be a string. Provided: ".concat(e))},t.ModalNotFoundByID=function(e){return new t("Modal with ID ".concat(e," was not found."))},t.ModalNotExistsInStore=function(e){return new t("Provided name(".concat(e,") don't exist in the store. Has the given name been added to the store?"))},t}(Error),E=function(){function n(){this.state=new Map,n.instance=this}return n.prototype.getByName=function(t){return t===void 0&&(t=n.DEFAULT_NAMESPACE),this.state.has(t)||this.state.set(t,{queue:m.reactive([]),initialized:!1}),this.state.get(t)},n.prototype.forceClean=function(){this.state.forEach(function(t){t.queue.splice(0,t.queue.length)})},n.DEFAULT_NAMESPACE="default",n}(),G=function(){var n=new E,t={scrollLock:!0,animation:"modal-list",backgroundClose:!0,escClose:!0,store:{},skipInitCheck:!1,draggable:!1},e=n.getByName().queue;return m.watch(function(){return e},function(){t.scrollLock&&(e.length?document.body.style.overflowY="hidden":document.body.style.overflowY="auto")},{deep:!0}),{namespaceStore:n,configuration:t}}();function y(n){return G.namespaceStore.getByName(n)}var _=G.configuration;function Q(n){var t={backgroundClose:_.backgroundClose,isRoute:!1,namespace:E.DEFAULT_NAMESPACE,draggable:_.draggable};return n.backgroundClose!==void 0&&(t.backgroundClose=n.backgroundClose),n.isRoute&&(t.isRoute=n.isRoute),n.namespace&&(t.namespace=n.namespace),n.draggable!==void 0&&(t.draggable=n.draggable),t}function $(n){n===void 0&&(n={});var t={background:!1,esc:!1};return Object.assign(t,n)}function Y(n){return n||(n={}),n}function T(n,t){t===void 0&&(t={});var e=I.STORE.get(n);if(!e)return Promise.reject(g.ModalNotFoundByID(n));var a=y(e.namespace),r=a.queue.findIndex(function(c){return c.id===n});if(r===-1)return Promise.reject(g.Undefined(n));var i=w.get(n,"close").map(function(c){return ne(c,n,$(t))});return X(i).then(function(){a.queue.splice(r,1)}).then(function(){w.get(n,"destroy").forEach(function(c){return c($(t))})}).then(function(){w.delete(n)})}var I=function(){function n(t,e,a){var r=this;this.events=m.reactive({}),this.backgroundClose=!0,this.isRoute=!1,this.id=n.modalId++,this.component=t,this.props=m.ref(e),this.closed=m.computed(function(){return!y(a.namespace).queue.includes(r)}),t.beforeModalClose&&w.add(this.id,"close",t.beforeModalClose);var i=Q(a);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(t){w.add(this.id,"close",t)},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"ondestroy",{set:function(t){w.add(this.id,"destroy",t)},enumerable:!1,configurable:!0}),n.prototype.on=function(t,e){var a=this;return Array.isArray(this.events[t])||(this.events[t]=[]),this.events[t].push(e),function(){var r=a.events[t].indexOf(e);r!==-1&&a.events[t].splice(r,1)}},n.STORE=new Map,n.modalId=0,n.EVENT_PROMPT="jenesius-vue-modal:____P____R____O____M____P____T",n}();function W(n){return I.STORE.get(n)}var te={store:{},add:function(n,t,e){var a,r;if(typeof e!="function")throw g.GuardDeclarationType(e);this.store[n]||(this.store[n]=(a={},a[t]=[],a)),this.store[n][t]||(this.store[n][t]=[]),(r=this.store[n][t])===null||r===void 0||r.push(e)},get:function(n,t){return n in this.store?t in this.store[n]?this.store[n][t]||[]:[]:[]},delete:function(n){n in this.store&&delete this.store[n]}};const w=te;function X(n){return n.reduce(function(t,e){return t.then(function(){return e()})},Promise.resolve())}function ne(n,t,e){return function(){return new Promise(function(a,r){var i,c=function(f){f===void 0&&(f=!0),f===!1&&r(g.NextReject(t)),a()};Promise.resolve(n.call((i=W(t))===null||i===void 0?void 0:i.instance,e)).then(c).catch(function(f){return r(f)})})}}function J(n){return n=Y(n),X(y(n.namespace).queue.map(function(t){return function(){return t.close()}}))}function q(n){var t=y(n),e=t.queue;if(e.length!==0)return e[e.length-1]}function re(n){n=Y(n);var t=q(n.namespace);return t?t.close():Promise.resolve()}function oe(n,t,e){var a=Q(e),r=y(a.namespace);if(a.namespace===E.DEFAULT_NAMESPACE&&!r.initialized&&!_.skipInitCheck)throw g.NotInitialized(a.namespace);if(typeof n=="string"){var i=Z(n);if(!i)throw g.ModalNotExistsInStore(n);n=i}if(!n)throw g.ModalComponentNotProvided();var c=new I(n,t,a);return r.queue.push(m.markRaw(c)),c}function B(n,t,e){return t===void 0&&(t={}),e===void 0&&(e={}),Promise.resolve().then(function(){return oe(n,t,e)})}function H(n,t,e){return t===void 0&&(t={}),e===void 0&&(e={}),J({namespace:e.namespace}).then(function(){var a=y(e.namespace);if(a.queue.length)throw g.QueueNoEmpty()}).then(function(){return B(n,t,e)})}function ie(n){if(typeof n!="object")throw g.ConfigurationType(n);Object.assign(_,n)}function ae(n){var t,e,a,r=m.getCurrentInstance(),i=String(((t=r==null?void 0:r.props)===null||t===void 0?void 0:t.modalId)||((e=r==null?void 0:r.props)===null||e===void 0?void 0:e["modal-id"])||((a=r==null?void 0:r.attrs)===null||a===void 0?void 0:a.modalId)),c=i.replace(/[^0-9]/g,"");w.add(Number(c),"close",n)}function ue(n,t,e){return t===void 0&&(t={}),e===void 0&&(e={}),k(this,void 0,void 0,function(){var a,r,i=this;return S(this,function(c){switch(c.label){case 0:return[4,B(n,t,e)];case 1:return a=c.sent(),r=!1,[2,new Promise(function(f){a.on(I.EVENT_PROMPT,function(d){return k(i,void 0,void 0,function(){return S(this,function(s){return r=!0,[2,a.close().then(function(){return f(d)}).catch(function(){return r=!1})]})})}),a.ondestroy=function(){r||f(null)}})]}})})}function Z(n){return _.store[n]||void 0}function se(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var D={exports:{}},x,z;function ce(){if(z)return x;z=1;var n=1e3,t=n*60,e=t*60,a=e*24,r=a*7,i=a*365.25;x=function(o,u){u=u||{};var l=typeof o;if(l==="string"&&o.length>0)return c(o);if(l==="number"&&isFinite(o))return u.long?d(o):f(o);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(o))};function c(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 l=parseFloat(u[1]),p=(u[2]||"ms").toLowerCase();switch(p){case"years":case"year":case"yrs":case"yr":case"y":return l*i;case"weeks":case"week":case"w":return l*r;case"days":case"day":case"d":return l*a;case"hours":case"hour":case"hrs":case"hr":case"h":return l*e;case"minutes":case"minute":case"mins":case"min":case"m":return l*t;case"seconds":case"second":case"secs":case"sec":case"s":return l*n;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return l;default:return}}}}function f(o){var u=Math.abs(o);return u>=a?Math.round(o/a)+"d":u>=e?Math.round(o/e)+"h":u>=t?Math.round(o/t)+"m":u>=n?Math.round(o/n)+"s":o+"ms"}function d(o){var u=Math.abs(o);return u>=a?s(o,u,a,"day"):u>=e?s(o,u,e,"hour"):u>=t?s(o,u,t,"minute"):u>=n?s(o,u,n,"second"):o+" ms"}function s(o,u,l,p){var F=u>=l*1.5;return Math.round(o/l)+" "+p+(F?"s":"")}return x}function le(n){e.debug=e,e.default=e,e.coerce=d,e.disable=i,e.enable=r,e.enabled=c,e.humanize=ce(),e.destroy=s,Object.keys(n).forEach(o=>{e[o]=n[o]}),e.names=[],e.skips=[],e.formatters={};function t(o){let u=0;for(let l=0;l<o.length;l++)u=(u<<5)-u+o.charCodeAt(l),u|=0;return e.colors[Math.abs(u)%e.colors.length]}e.selectColor=t;function e(o){let u,l=null,p,F;function v(...h){if(!v.enabled)return;const C=v,M=Number(new Date),O=M-(u||M);C.diff=O,C.prev=u,C.curr=M,u=M,h[0]=e.coerce(h[0]),typeof h[0]!="string"&&h.unshift("%O");let b=0;h[0]=h[0].replace(/%([a-zA-Z%])/g,(P,R)=>{if(P==="%%")return"%";b++;const N=e.formatters[R];if(typeof N=="function"){const K=h[b];P=N.call(C,K),h.splice(b,1),b--}return P}),e.formatArgs.call(C,h),(C.log||e.log).apply(C,h)}return v.namespace=o,v.useColors=e.useColors(),v.color=e.selectColor(o),v.extend=a,v.destroy=e.destroy,Object.defineProperty(v,"enabled",{enumerable:!0,configurable:!1,get:()=>l!==null?l:(p!==e.namespaces&&(p=e.namespaces,F=e.enabled(o)),F),set:h=>{l=h}}),typeof e.init=="function"&&e.init(v),v}function a(o,u){const l=e(this.namespace+(typeof u>"u"?":":u)+o);return l.log=this.log,l}function r(o){e.save(o),e.namespaces=o,e.names=[],e.skips=[];let u;const l=(typeof o=="string"?o:"").split(/[\s,]+/),p=l.length;for(u=0;u<p;u++)l[u]&&(o=l[u].replace(/\*/g,".*?"),o[0]==="-"?e.skips.push(new RegExp("^"+o.slice(1)+"$")):e.names.push(new RegExp("^"+o+"$")))}function i(){const o=[...e.names.map(f),...e.skips.map(f).map(u=>"-"+u)].join(",");return e.enable(""),o}function c(o){if(o[o.length-1]==="*")return!0;let u,l;for(u=0,l=e.skips.length;u<l;u++)if(e.skips[u].test(o))return!1;for(u=0,l=e.names.length;u<l;u++)if(e.names[u].test(o))return!0;return!1}function f(o){return o.toString().substring(2,o.toString().length-2).replace(/\.\*\?$/,"*")}function d(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 e.enable(e.load()),e}var de=le;(function(n,t){t.formatArgs=a,t.save=r,t.load=i,t.useColors=e,t.storage=c(),t.destroy=(()=>{let d=!1;return()=>{d||(d=!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`."))}})(),t.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 e(){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 a(d){if(d[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+d[0]+(this.useColors?"%c ":" ")+"+"+n.exports.humanize(this.diff),!this.useColors)return;const s="color: "+this.color;d.splice(1,0,s,"color: inherit");let o=0,u=0;d[0].replace(/%[a-zA-Z%]/g,l=>{l!=="%%"&&(o++,l==="%c"&&(u=o))}),d.splice(u,0,s)}t.log=console.debug||console.log||(()=>{});function r(d){try{d?t.storage.setItem("debug",d):t.storage.removeItem("debug")}catch{}}function i(){let d;try{d=t.storage.getItem("debug")}catch{}return!d&&typeof process<"u"&&"env"in process&&(d=process.env.DEBUG),d}function c(){try{return localStorage}catch{}}n.exports=de(t);const{formatters:f}=n.exports;f.j=function(d){try{return JSON.stringify(d)}catch(s){return"[UnexpectedJSONParseError]: "+s.message}}})(D,D.exports);var fe=D.exports;const me=se(fe);function he(n){return me("jenesius-vue-modal:".concat(n))}const ve=["onPointerdown"],U={__name:"WidgetModalContainerItem",props:{id:Number},setup(n){const t=m.ref(null),e=he("modal-item"),a=n,r=W(a.id);function i(){if(r.backgroundClose)return T(r.id,{background:!0}).catch(()=>{})}m.watch(()=>t.value,f=>{r.instance=f}),m.onMounted(()=>{r.draggable&&(e("The modal window is movable."),c(document.querySelector(typeof r.draggable=="string"?r.draggable:`[modalid=_modal_${a.id}]`)))});function c(f){if(!f){e("draggable item not found.");return}const d=document.querySelector(`[modalid=_modal_${a.id}]`);f.addEventListener("pointerdown",s=>{var O;const o=(O=d.getAttribute("style"))==null?void 0:O.match(/transform: translate\((.*)px,\s*(.*)px\)/);let u=o==null?void 0:o[1],l=o==null?void 0:o[2];u=typeof u=="string"?Number.parseInt(u):0,l=typeof l=="string"?Number.parseInt(l):0;const{clientX:p,clientY:F}=s,v=p,h=F;e(`movement started at (${h}, ${h})`),document.addEventListener("pointermove",C,{passive:!0}),document.addEventListener("pointerup",M,{once:!0});function C(b){const{clientX:L,clientY:P}=b,R=u+L-v,N=l+P-h;e(`move at (${R}, ${N})`),d.style.transform=`translate(${R}px,${N}px)`}function M(b){e("movement completed"),document.removeEventListener("pointermove",C),b.preventDefault()}})}return(f,d)=>(m.openBlock(),m.createElementBlock("div",{class:"widget__modal-container__item modal-container",onPointerdown:m.withModifiers(i,["self","stop"])},[(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_${n.id}`,ref_key:"modalRef",ref:t},m.toHandlers(m.unref(r).events)),null,16,["modalId"]))],40,ve))}};function ge(n){n===void 0&&(n=E.DEFAULT_NAMESPACE);var t=E.instance.getByName(n);t.initialized=!0,n===E.DEFAULT_NAMESPACE&&document.addEventListener("keyup",function(e){if(_.escClose&&(e.key==="Escape"||e.code==="Escape")){var a=q(n);if(!a)return;T(a.id,{esc:!0}).catch(function(){})}})}const pe={props:{namespace:String},setup(n){return m.onMounted(()=>{ge(n.namespace)}),()=>{const t=y(n.namespace);return m.h(m.TransitionGroup,{name:_.animation,tag:"div"},{default:()=>t.queue.map(e=>m.h(U,{key:e.id,id:e.id}))})}},components:{WidgetContainerModalItem:U}};var A={router:null};function Ce(n){var t=this;if(A.router)throw g.DuplicatedRouterIntegration();A.router=n;function e(a){for(var r=a.matched.length-1;r>=0;r--){var i=a.matched[r].components,c=Object.values(i).find(function(f){return f._isModal});if(c)return c}return null}n.beforeEach(function(a,r){return k(t,void 0,void 0,function(){var i,c,f;return S(this,function(d){switch(d.label){case 0:return d.trys.push([0,3,,4]),i=e(r),i&&!(!((f=(c=i.getModalObject())===null||c===void 0?void 0:c.closed)===null||f===void 0)&&f.value)?[4,i.close(!0)]:[3,2];case 1:d.sent(),d.label=2;case 2:return[3,4];case 3:return d.sent(),[2,!1];case 4:return[2]}})})}),n.afterEach(function(a){return k(t,void 0,void 0,function(){var r;return S(this,function(i){switch(i.label){case 0:return r=e(a),r?[4,r.initialize()]:[3,2];case 1:i.sent(),i.label=2;case 2:return[2]}})})})}function V(n){var t=null,e=!1;function a(){return k(this,void 0,void 0,function(){return S(this,function(r){switch(r.label){case 0:if(!A.router)throw g.ModalRouterIntegrationNotInitialized();return e=!1,t=null,[4,H(n,m.computed(function(){var i;return(i=A.router)===null||i===void 0?void 0:i.currentRoute.value.params}),{isRoute:!0})];case 1:return t=r.sent(),t.onclose=function(){var i;e||(i=A.router)===null||i===void 0||i.back()},[2]}})})}return{getModalObject:function(){return t},_isModal:!0,close:function(r){return r===void 0&&(r=!1),k(this,void 0,void 0,function(){return S(this,function(i){switch(i.label){case 0:return e=r,t?[4,t.close()]:[3,2];case 1:return[2,i.sent()];case 2:return[2]}})})},initialize:a,setup:function(){return function(){return null}}}}V.init=Ce;var ye=y().queue;function be(n){return y(n).queue}exports.Modal=I;exports.closeById=T;exports.closeModal=J;exports.config=ie;exports.container=pe;exports.getComponentFromStore=Z;exports.getCurrentModal=q;exports.getQueueByNamespace=be;exports.modalQueue=ye;exports.onBeforeModalClose=ae;exports.openModal=H;exports.popModal=re;exports.promptModal=ue;exports.pushModal=B;exports.useModalRouter=V; | ||
*/Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const m=require("vue");var j=function(n,t){return j=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,a){e.__proto__=a}||function(e,a){for(var r in a)Object.prototype.hasOwnProperty.call(a,r)&&(e[r]=a[r])},j(n,t)};function ee(n,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");j(n,t);function e(){this.constructor=n}n.prototype=t===null?Object.create(t):(e.prototype=t.prototype,new e)}function k(n,t,e,a){function r(i){return i instanceof e?i:new e(function(c){c(i)})}return new(e||(e=Promise))(function(i,c){function f(o){try{s(a.next(o))}catch(u){c(u)}}function d(o){try{s(a.throw(o))}catch(u){c(u)}}function s(o){o.done?i(o.value):r(o.value).then(f,d)}s((a=a.apply(n,t||[])).next())})}function S(n,t){var e={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},a,r,i,c;return c={next:f(0),throw:f(1),return:f(2)},typeof Symbol=="function"&&(c[Symbol.iterator]=function(){return this}),c;function f(s){return function(o){return d([s,o])}}function d(s){if(a)throw new TypeError("Generator is already executing.");for(;c&&(c=0,s[0]&&(e=0)),e;)try{if(a=1,r&&(i=s[0]&2?r.return:s[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,s[1])).done)return i;switch(r=0,i&&(s=[s[0]&2,i.value]),s[0]){case 0:case 1:i=s;break;case 4:return e.label++,{value:s[1],done:!1};case 5:e.label++,r=s[1],s=[0];continue;case 7:s=e.ops.pop(),e.trys.pop();continue;default:if(i=e.trys,!(i=i.length>0&&i[i.length-1])&&(s[0]===6||s[0]===2)){e=0;continue}if(s[0]===3&&(!i||s[1]>i[0]&&s[1]<i[3])){e.label=s[1];break}if(s[0]===6&&e.label<i[1]){e.label=i[1],i=s;break}if(i&&e.label<i[2]){e.label=i[2],e.ops.push(s);break}i[2]&&e.ops.pop(),e.trys.pop();continue}s=t.call(n,e)}catch(o){s=[6,o],r=0}finally{a=i=0}if(s[0]&5)throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}}var g=function(n){ee(t,n);function t(e,a){a===void 0&&(a=null);var r=n.call(this)||this;return r.isModalError=!0,r.message=e,r.details=a,r}return t.Undefined=function(e){return new t("Modal with id: ".concat(e," not founded. The modal window may have been closed earlier."))},t.UndefinedGuardName=function(e){return new t("Guard's name ".concat(e," is not declaration."))},t.NextReject=function(e){return new t("Guard returned false. Modal navigation was stopped. Modal id ".concat(e))},t.GuardDeclarationType=function(e){return new t("Guard's type should be a function. Provided:",e)},t.ConfigurationType=function(e){return new t("Configuration type must be an Object. Provided",e)},t.ConfigurationUndefinedParam=function(e,a){return new t("In configuration founded unknown parameter: ".concat(e,". Available are ").concat(a.join(", ")," "))},t.QueueNoEmpty=function(){return new t("Modal's queue is not empty. Probably some modal reject closing by onClose hook.")},t.EmptyModalQueue=function(){return new t("Modal queue is empty.")},t.NotInitialized=function(e){return new t("Modal Container not found. Put container from jenesius-vue-modal in App's template. Namespace: ".concat(e,". Check documentation for more information https://modal.jenesius.com/docs.html/installation#getting-started."))},t.ModalComponentNotProvided=function(){return new t("The first parameter(VueComponent) was not specified.")},t.DuplicatedRouterIntegration=function(){return new t("useModalRouter.init should escaped only once.")},t.ModalRouterIntegrationNotInitialized=function(){return new t("The integration was not initialized. Please, use useModalRouter.init(router). For more information: https://modal.jenesius.com/docs.html/integration-vue-router#installation")},t.ModalEventNameMustBeString=function(e){return new t("Event name must be a string. Provided: ".concat(e))},t.ModalNotFoundByID=function(e){return new t("Modal with ID ".concat(e," was not found."))},t.ModalNotExistsInStore=function(e){return new t("Provided name(".concat(e,") don't exist in the store. Has the given name been added to the store?"))},t}(Error),E=function(){function n(){this.state=new Map,n.instance=this}return n.prototype.getByName=function(t){return t===void 0&&(t=n.DEFAULT_NAMESPACE),this.state.has(t)||this.state.set(t,{queue:m.reactive([]),initialized:!1}),this.state.get(t)},n.prototype.forceClean=function(){this.state.forEach(function(t){t.queue.splice(0,t.queue.length)})},n.DEFAULT_NAMESPACE="default",n}(),G=function(){var n=new E,t={scrollLock:!0,animation:"modal-list",backgroundClose:!0,escClose:!0,store:{},skipInitCheck:!1,draggable:!1},e=n.getByName().queue;return m.watch(function(){return e},function(){t.scrollLock&&(e.length?document.body.style.overflowY="hidden":document.body.style.overflowY="auto")},{deep:!0}),{namespaceStore:n,configuration:t}}();function y(n){return G.namespaceStore.getByName(n)}var _=G.configuration;function Q(n){var t={backgroundClose:_.backgroundClose,isRoute:!1,namespace:E.DEFAULT_NAMESPACE,draggable:_.draggable};return n.backgroundClose!==void 0&&(t.backgroundClose=n.backgroundClose),n.isRoute&&(t.isRoute=n.isRoute),n.namespace&&(t.namespace=n.namespace),n.draggable!==void 0&&(t.draggable=n.draggable),t}function L(n){n===void 0&&(n={});var t={background:!1,esc:!1};return Object.assign(t,n)}function Y(n){return n||(n={}),n}function T(n,t){t===void 0&&(t={});var e=I.STORE.get(n);if(!e)return Promise.reject(g.ModalNotFoundByID(n));var a=y(e.namespace),r=a.queue.findIndex(function(c){return c.id===n});if(r===-1)return Promise.reject(g.Undefined(n));var i=w.get(n,"close").map(function(c){return ne(c,n,L(t))});return X(i).then(function(){a.queue.splice(r,1)}).then(function(){w.get(n,"destroy").forEach(function(c){return c(L(t))})}).then(function(){w.delete(n)})}var I=function(){function n(t,e,a){var r=this;this.events=m.reactive({}),this.backgroundClose=!0,this.isRoute=!1,this.id=n.modalId++,this.component=t,this.props=m.ref(e),this.closed=m.computed(function(){return!y(a.namespace).queue.includes(r)}),t.beforeModalClose&&w.add(this.id,"close",t.beforeModalClose);var i=Q(a);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(t){w.add(this.id,"close",t)},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"ondestroy",{set:function(t){w.add(this.id,"destroy",t)},enumerable:!1,configurable:!0}),n.prototype.on=function(t,e){var a=this;return Array.isArray(this.events[t])||(this.events[t]=[]),this.events[t].push(e),function(){var r=a.events[t].indexOf(e);r!==-1&&a.events[t].splice(r,1)}},n.STORE=new Map,n.modalId=0,n.EVENT_PROMPT="jenesius-vue-modal:____P____R____O____M____P____T",n}();function W(n){return I.STORE.get(n)}var te={store:{},add:function(n,t,e){var a,r;if(typeof e!="function")throw g.GuardDeclarationType(e);this.store[n]||(this.store[n]=(a={},a[t]=[],a)),this.store[n][t]||(this.store[n][t]=[]),(r=this.store[n][t])===null||r===void 0||r.push(e)},get:function(n,t){return n in this.store?t in this.store[n]?this.store[n][t]||[]:[]:[]},delete:function(n){n in this.store&&delete this.store[n]}};const w=te;function X(n){return n.reduce(function(t,e){return t.then(function(){return e()})},Promise.resolve())}function ne(n,t,e){return function(){return new Promise(function(a,r){var i,c=function(f){f===void 0&&(f=!0),f===!1&&r(g.NextReject(t)),a()};Promise.resolve(n.call((i=W(t))===null||i===void 0?void 0:i.instance,e)).then(c).catch(function(f){return r(f)})})}}function J(n){return n=Y(n),X(y(n.namespace).queue.map(function(t){return function(){return t.close()}}))}function q(n){var t=y(n),e=t.queue;if(e.length!==0)return e[e.length-1]}function re(n){n=Y(n);var t=q(n.namespace);return t?t.close():Promise.resolve()}function oe(n,t,e){var a=Q(e),r=y(a.namespace);if(a.namespace===E.DEFAULT_NAMESPACE&&!r.initialized&&!_.skipInitCheck)throw g.NotInitialized(a.namespace);if(typeof n=="string"){var i=Z(n);if(!i)throw g.ModalNotExistsInStore(n);n=i}if(!n)throw g.ModalComponentNotProvided();var c=new I(n,t,a);return r.queue.push(m.markRaw(c)),c}function B(n,t,e){return t===void 0&&(t={}),e===void 0&&(e={}),Promise.resolve().then(function(){return oe(n,t,e)})}function H(n,t,e){return t===void 0&&(t={}),e===void 0&&(e={}),J({namespace:e.namespace}).then(function(){var a=y(e.namespace);if(a.queue.length)throw g.QueueNoEmpty()}).then(function(){return B(n,t,e)})}function ie(n){if(typeof n!="object")throw g.ConfigurationType(n);Object.assign(_,n)}function ae(n){var t,e,a,r=m.getCurrentInstance(),i=String(((t=r==null?void 0:r.props)===null||t===void 0?void 0:t.modalId)||((e=r==null?void 0:r.props)===null||e===void 0?void 0:e["modal-id"])||((a=r==null?void 0:r.attrs)===null||a===void 0?void 0:a.modalId)),c=i.replace(/[^0-9]/g,"");w.add(Number(c),"close",n)}function ue(n,t,e){return t===void 0&&(t={}),e===void 0&&(e={}),k(this,void 0,void 0,function(){var a,r,i=this;return S(this,function(c){switch(c.label){case 0:return[4,B(n,t,e)];case 1:return a=c.sent(),r=!1,[2,new Promise(function(f){a.on(I.EVENT_PROMPT,function(d){return k(i,void 0,void 0,function(){return S(this,function(s){return r=!0,[2,a.close().then(function(){return f(d)}).catch(function(){return r=!1})]})})}),a.ondestroy=function(){r||f(null)}})]}})})}function Z(n){return _.store[n]||void 0}function se(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var D={exports:{}},x,z;function ce(){if(z)return x;z=1;var n=1e3,t=n*60,e=t*60,a=e*24,r=a*7,i=a*365.25;x=function(o,u){u=u||{};var l=typeof o;if(l==="string"&&o.length>0)return c(o);if(l==="number"&&isFinite(o))return u.long?d(o):f(o);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(o))};function c(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 l=parseFloat(u[1]),p=(u[2]||"ms").toLowerCase();switch(p){case"years":case"year":case"yrs":case"yr":case"y":return l*i;case"weeks":case"week":case"w":return l*r;case"days":case"day":case"d":return l*a;case"hours":case"hour":case"hrs":case"hr":case"h":return l*e;case"minutes":case"minute":case"mins":case"min":case"m":return l*t;case"seconds":case"second":case"secs":case"sec":case"s":return l*n;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return l;default:return}}}}function f(o){var u=Math.abs(o);return u>=a?Math.round(o/a)+"d":u>=e?Math.round(o/e)+"h":u>=t?Math.round(o/t)+"m":u>=n?Math.round(o/n)+"s":o+"ms"}function d(o){var u=Math.abs(o);return u>=a?s(o,u,a,"day"):u>=e?s(o,u,e,"hour"):u>=t?s(o,u,t,"minute"):u>=n?s(o,u,n,"second"):o+" ms"}function s(o,u,l,p){var F=u>=l*1.5;return Math.round(o/l)+" "+p+(F?"s":"")}return x}function le(n){e.debug=e,e.default=e,e.coerce=d,e.disable=i,e.enable=r,e.enabled=c,e.humanize=ce(),e.destroy=s,Object.keys(n).forEach(o=>{e[o]=n[o]}),e.names=[],e.skips=[],e.formatters={};function t(o){let u=0;for(let l=0;l<o.length;l++)u=(u<<5)-u+o.charCodeAt(l),u|=0;return e.colors[Math.abs(u)%e.colors.length]}e.selectColor=t;function e(o){let u,l=null,p,F;function v(...h){if(!v.enabled)return;const C=v,M=Number(new Date),O=M-(u||M);C.diff=O,C.prev=u,C.curr=M,u=M,h[0]=e.coerce(h[0]),typeof h[0]!="string"&&h.unshift("%O");let b=0;h[0]=h[0].replace(/%([a-zA-Z%])/g,(P,R)=>{if(P==="%%")return"%";b++;const N=e.formatters[R];if(typeof N=="function"){const K=h[b];P=N.call(C,K),h.splice(b,1),b--}return P}),e.formatArgs.call(C,h),(C.log||e.log).apply(C,h)}return v.namespace=o,v.useColors=e.useColors(),v.color=e.selectColor(o),v.extend=a,v.destroy=e.destroy,Object.defineProperty(v,"enabled",{enumerable:!0,configurable:!1,get:()=>l!==null?l:(p!==e.namespaces&&(p=e.namespaces,F=e.enabled(o)),F),set:h=>{l=h}}),typeof e.init=="function"&&e.init(v),v}function a(o,u){const l=e(this.namespace+(typeof u>"u"?":":u)+o);return l.log=this.log,l}function r(o){e.save(o),e.namespaces=o,e.names=[],e.skips=[];let u;const l=(typeof o=="string"?o:"").split(/[\s,]+/),p=l.length;for(u=0;u<p;u++)l[u]&&(o=l[u].replace(/\*/g,".*?"),o[0]==="-"?e.skips.push(new RegExp("^"+o.slice(1)+"$")):e.names.push(new RegExp("^"+o+"$")))}function i(){const o=[...e.names.map(f),...e.skips.map(f).map(u=>"-"+u)].join(",");return e.enable(""),o}function c(o){if(o[o.length-1]==="*")return!0;let u,l;for(u=0,l=e.skips.length;u<l;u++)if(e.skips[u].test(o))return!1;for(u=0,l=e.names.length;u<l;u++)if(e.names[u].test(o))return!0;return!1}function f(o){return o.toString().substring(2,o.toString().length-2).replace(/\.\*\?$/,"*")}function d(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 e.enable(e.load()),e}var de=le;(function(n,t){t.formatArgs=a,t.save=r,t.load=i,t.useColors=e,t.storage=c(),t.destroy=(()=>{let d=!1;return()=>{d||(d=!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`."))}})(),t.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 e(){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 a(d){if(d[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+d[0]+(this.useColors?"%c ":" ")+"+"+n.exports.humanize(this.diff),!this.useColors)return;const s="color: "+this.color;d.splice(1,0,s,"color: inherit");let o=0,u=0;d[0].replace(/%[a-zA-Z%]/g,l=>{l!=="%%"&&(o++,l==="%c"&&(u=o))}),d.splice(u,0,s)}t.log=console.debug||console.log||(()=>{});function r(d){try{d?t.storage.setItem("debug",d):t.storage.removeItem("debug")}catch{}}function i(){let d;try{d=t.storage.getItem("debug")}catch{}return!d&&typeof process<"u"&&"env"in process&&(d=process.env.DEBUG),d}function c(){try{return localStorage}catch{}}n.exports=de(t);const{formatters:f}=n.exports;f.j=function(d){try{return JSON.stringify(d)}catch(s){return"[UnexpectedJSONParseError]: "+s.message}}})(D,D.exports);var fe=D.exports;const me=se(fe);function he(n){return me("jenesius-vue-modal:".concat(n))}const ve=["onPointerdown"],U={__name:"WidgetModalContainerItem",props:{id:Number},setup(n){const t=m.ref(null),e=he("modal-item"),a=n,r=W(a.id);function i(){if(r.backgroundClose)return T(r.id,{background:!0}).catch(()=>{})}m.watch(()=>t.value,f=>{r.instance=f}),m.onMounted(()=>{if(e(`Modal(${r.id}) is mounted`),r.draggable){const f=typeof r.draggable=="string"?r.draggable:`[modalid=_modal_${a.id}]`;e(`The modal window is movable(${f}).`),setTimeout(()=>{c(document.querySelector(f))},0)}});function c(f){if(!f){e("draggable item not found.");return}const d=document.querySelector(`[modalid=_modal_${a.id}]`);f.addEventListener("pointerdown",s=>{var O;const o=(O=d.getAttribute("style"))==null?void 0:O.match(/transform: translate\((.*)px,\s*(.*)px\)/);let u=o==null?void 0:o[1],l=o==null?void 0:o[2];u=typeof u=="string"?Number.parseInt(u):0,l=typeof l=="string"?Number.parseInt(l):0;const{clientX:p,clientY:F}=s,v=p,h=F;e(`movement started at (${h}, ${h})`),document.addEventListener("pointermove",C,{passive:!0}),document.addEventListener("pointerup",M,{once:!0});function C(b){const{clientX:$,clientY:P}=b,R=u+$-v,N=l+P-h;e(`move at (${R}, ${N})`),d.style.transform=`translate(${R}px,${N}px)`}function M(b){e("movement completed"),document.removeEventListener("pointermove",C),b.preventDefault()}})}return(f,d)=>(m.openBlock(),m.createElementBlock("div",{class:"widget__modal-container__item modal-container",onPointerdown:m.withModifiers(i,["self","stop"])},[(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_${n.id}`,ref_key:"modalRef",ref:t},m.toHandlers(m.unref(r).events)),null,16,["modalId"]))],40,ve))}};function ge(n){n===void 0&&(n=E.DEFAULT_NAMESPACE);var t=E.instance.getByName(n);t.initialized=!0,n===E.DEFAULT_NAMESPACE&&document.addEventListener("keyup",function(e){if(_.escClose&&(e.key==="Escape"||e.code==="Escape")){var a=q(n);if(!a)return;T(a.id,{esc:!0}).catch(function(){})}})}const pe={props:{namespace:String},setup(n){return m.onMounted(()=>{ge(n.namespace)}),()=>{const t=y(n.namespace);return m.h(m.TransitionGroup,{name:_.animation,tag:"div"},{default:()=>t.queue.map(e=>m.h(U,{key:e.id,id:e.id}))})}},components:{WidgetContainerModalItem:U}};var A={router:null};function Ce(n){var t=this;if(A.router)throw g.DuplicatedRouterIntegration();A.router=n;function e(a){for(var r=a.matched.length-1;r>=0;r--){var i=a.matched[r].components,c=Object.values(i).find(function(f){return f._isModal});if(c)return c}return null}n.beforeEach(function(a,r){return k(t,void 0,void 0,function(){var i,c,f;return S(this,function(d){switch(d.label){case 0:return d.trys.push([0,3,,4]),i=e(r),i&&!(!((f=(c=i.getModalObject())===null||c===void 0?void 0:c.closed)===null||f===void 0)&&f.value)?[4,i.close(!0)]:[3,2];case 1:d.sent(),d.label=2;case 2:return[3,4];case 3:return d.sent(),[2,!1];case 4:return[2]}})})}),n.afterEach(function(a){return k(t,void 0,void 0,function(){var r;return S(this,function(i){switch(i.label){case 0:return r=e(a),r?[4,r.initialize()]:[3,2];case 1:i.sent(),i.label=2;case 2:return[2]}})})})}function V(n){var t=null,e=!1;function a(){return k(this,void 0,void 0,function(){return S(this,function(r){switch(r.label){case 0:if(!A.router)throw g.ModalRouterIntegrationNotInitialized();return e=!1,t=null,[4,H(n,m.computed(function(){var i;return(i=A.router)===null||i===void 0?void 0:i.currentRoute.value.params}),{isRoute:!0})];case 1:return t=r.sent(),t.onclose=function(){var i;e||(i=A.router)===null||i===void 0||i.back()},[2]}})})}return{getModalObject:function(){return t},_isModal:!0,close:function(r){return r===void 0&&(r=!1),k(this,void 0,void 0,function(){return S(this,function(i){switch(i.label){case 0:return e=r,t?[4,t.close()]:[3,2];case 1:return[2,i.sent()];case 2:return[2]}})})},initialize:a,setup:function(){return function(){return null}}}}V.init=Ce;var ye=y().queue;function be(n){return y(n).queue}exports.Modal=I;exports.closeById=T;exports.closeModal=J;exports.config=ie;exports.container=pe;exports.getComponentFromStore=Z;exports.getCurrentModal=q;exports.getQueueByNamespace=be;exports.modalQueue=ye;exports.onBeforeModalClose=ae;exports.openModal=H;exports.popModal=re;exports.promptModal=ue;exports.pushModal=B;exports.useModalRouter=V; | ||
//# 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 G, watch as Q, ref as Y, computed as W, markRaw as re, getCurrentInstance as oe, onMounted as X, openBlock as L, createElementBlock as ie, withModifiers as ae, createBlock as ue, resolveDynamicComponent as se, unref as R, mergeProps as ce, toHandlers as le, h as $, TransitionGroup as de } from "vue"; | ||
import { reactive as G, watch as Q, ref as Y, computed as W, markRaw as re, getCurrentInstance as oe, onMounted as X, openBlock as $, createElementBlock as ie, withModifiers as ae, createBlock as ue, resolveDynamicComponent as se, unref as R, mergeProps as ce, toHandlers as le, h as L, TransitionGroup as de } from "vue"; | ||
/*! | ||
* jenesius-vue-modal v1.11.3 | ||
* jenesius-vue-modal v1.11.4 | ||
* (c) 2024 Jenesius | ||
* @license MIT | ||
*/ | ||
var T = function(n, t) { | ||
return T = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(e, a) { | ||
var x = function(n, t) { | ||
return x = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(e, a) { | ||
e.__proto__ = a; | ||
@@ -14,3 +14,3 @@ } || function(e, a) { | ||
Object.prototype.hasOwnProperty.call(a, r) && (e[r] = a[r]); | ||
}, T(n, t); | ||
}, x(n, t); | ||
}; | ||
@@ -20,3 +20,3 @@ function fe(n, t) { | ||
throw new TypeError("Class extends value " + String(t) + " is not a constructor or null"); | ||
T(n, t); | ||
x(n, t); | ||
function e() { | ||
@@ -231,3 +231,3 @@ this.constructor = n; | ||
var i = b.get(n, "close").map(function(c) { | ||
return me(c, n, z(t)); | ||
return he(c, n, z(t)); | ||
}); | ||
@@ -287,3 +287,3 @@ return K(i).then(function() { | ||
} | ||
var he = { | ||
var me = { | ||
store: {}, | ||
@@ -303,3 +303,3 @@ add: function(n, t, e) { | ||
}; | ||
const b = he; | ||
const b = me; | ||
function K(n) { | ||
@@ -312,3 +312,3 @@ return n.reduce(function(t, e) { | ||
} | ||
function me(n, t, e) { | ||
function he(n, t, e) { | ||
return function() { | ||
@@ -382,3 +382,3 @@ return new Promise(function(a, r) { | ||
} | ||
function xe(n, t, e) { | ||
function Te(n, t, e) { | ||
return t === void 0 && (t = {}), e === void 0 && (e = {}), E(this, void 0, void 0, function() { | ||
@@ -416,9 +416,9 @@ var a, r, i = this; | ||
} | ||
var j = { exports: {} }, x, B; | ||
var j = { exports: {} }, T, B; | ||
function be() { | ||
if (B) | ||
return x; | ||
return T; | ||
B = 1; | ||
var n = 1e3, t = n * 60, e = t * 60, a = e * 24, r = a * 7, i = a * 365.25; | ||
x = function(o, u) { | ||
T = function(o, u) { | ||
u = u || {}; | ||
@@ -498,3 +498,3 @@ var l = typeof o; | ||
} | ||
return x; | ||
return T; | ||
} | ||
@@ -514,28 +514,28 @@ function we(n) { | ||
let u, l = null, g, _; | ||
function m(...h) { | ||
if (!m.enabled) | ||
function h(...m) { | ||
if (!h.enabled) | ||
return; | ||
const C = m, F = Number(/* @__PURE__ */ new Date()), N = F - (u || F); | ||
C.diff = N, C.prev = u, C.curr = F, u = F, h[0] = e.coerce(h[0]), typeof h[0] != "string" && h.unshift("%O"); | ||
const C = h, F = Number(/* @__PURE__ */ new Date()), N = F - (u || F); | ||
C.diff = N, C.prev = u, C.curr = F, u = F, m[0] = e.coerce(m[0]), typeof m[0] != "string" && m.unshift("%O"); | ||
let y = 0; | ||
h[0] = h[0].replace(/%([a-zA-Z%])/g, (P, I) => { | ||
if (P === "%%") | ||
m[0] = m[0].replace(/%([a-zA-Z%])/g, (S, I) => { | ||
if (S === "%%") | ||
return "%"; | ||
y++; | ||
const S = e.formatters[I]; | ||
if (typeof S == "function") { | ||
const ne = h[y]; | ||
P = S.call(C, ne), h.splice(y, 1), y--; | ||
const P = e.formatters[I]; | ||
if (typeof P == "function") { | ||
const ne = m[y]; | ||
S = P.call(C, ne), m.splice(y, 1), y--; | ||
} | ||
return P; | ||
}), e.formatArgs.call(C, h), (C.log || e.log).apply(C, h); | ||
return S; | ||
}), e.formatArgs.call(C, m), (C.log || e.log).apply(C, m); | ||
} | ||
return m.namespace = o, m.useColors = e.useColors(), m.color = e.selectColor(o), m.extend = a, m.destroy = e.destroy, Object.defineProperty(m, "enabled", { | ||
return h.namespace = o, h.useColors = e.useColors(), h.color = e.selectColor(o), h.extend = a, h.destroy = e.destroy, Object.defineProperty(h, "enabled", { | ||
enumerable: !0, | ||
configurable: !1, | ||
get: () => l !== null ? l : (g !== e.namespaces && (g = e.namespaces, _ = e.enabled(o)), _), | ||
set: (h) => { | ||
l = h; | ||
set: (m) => { | ||
l = m; | ||
} | ||
}), typeof e.init == "function" && e.init(m), m; | ||
}), typeof e.init == "function" && e.init(h), h; | ||
} | ||
@@ -737,7 +737,8 @@ function a(o, u) { | ||
}), X(() => { | ||
r.draggable && (e("The modal window is movable."), c( | ||
document.querySelector( | ||
typeof r.draggable == "string" ? r.draggable : `[modalid=_modal_${a.id}]` | ||
) | ||
)); | ||
if (e(`Modal(${r.id}) is mounted`), r.draggable) { | ||
const f = typeof r.draggable == "string" ? r.draggable : `[modalid=_modal_${a.id}]`; | ||
e(`The modal window is movable(${f}).`), setTimeout(() => { | ||
c(document.querySelector(f)); | ||
}, 0); | ||
} | ||
}); | ||
@@ -755,7 +756,7 @@ function c(f) { | ||
u = typeof u == "string" ? Number.parseInt(u) : 0, l = typeof l == "string" ? Number.parseInt(l) : 0; | ||
const { clientX: g, clientY: _ } = s, m = g, h = _; | ||
e(`movement started at (${h}, ${h})`), document.addEventListener("pointermove", C, { passive: !0 }), document.addEventListener("pointerup", F, { once: !0 }); | ||
const { clientX: g, clientY: _ } = s, h = g, m = _; | ||
e(`movement started at (${m}, ${m})`), document.addEventListener("pointermove", C, { passive: !0 }), document.addEventListener("pointerup", F, { once: !0 }); | ||
function C(y) { | ||
const { clientX: q, clientY: P } = y, I = u + q - m, S = l + P - h; | ||
e(`move at (${I}, ${S})`), d.style.transform = `translate(${I}px,${S}px)`; | ||
const { clientX: q, clientY: S } = y, I = u + q - h, P = l + S - m; | ||
e(`move at (${I}, ${P})`), d.style.transform = `translate(${I}px,${P}px)`; | ||
} | ||
@@ -767,7 +768,7 @@ function F(y) { | ||
} | ||
return (f, d) => (L(), ie("div", { | ||
return (f, d) => ($(), ie("div", { | ||
class: "widget__modal-container__item modal-container", | ||
onPointerdown: ae(i, ["self", "stop"]) | ||
}, [ | ||
(L(), ue(se(R(r).component), ce(R(r).props.value, { | ||
($(), ue(se(R(r).component), ce(R(r).props.value, { | ||
class: "modal-item widget__modal-wrap", | ||
@@ -781,3 +782,3 @@ modalId: `_modal_${n.id}`, | ||
}; | ||
function Pe(n) { | ||
function Se(n) { | ||
n === void 0 && (n = M.DEFAULT_NAMESPACE); | ||
@@ -795,3 +796,3 @@ var t = M.instance.getByName(n); | ||
} | ||
const Te = { | ||
const xe = { | ||
props: { | ||
@@ -802,7 +803,7 @@ namespace: String | ||
return X(() => { | ||
Pe(n.namespace); | ||
Se(n.namespace); | ||
}), () => { | ||
const t = p(n.namespace); | ||
return $(de, { name: w.animation, tag: "div" }, { | ||
default: () => t.queue.map((e) => $(U, { | ||
return L(de, { name: w.animation, tag: "div" }, { | ||
default: () => t.queue.map((e) => L(U, { | ||
key: e.id, | ||
@@ -819,3 +820,3 @@ id: e.id | ||
}; | ||
function Se(n) { | ||
function Pe(n) { | ||
var t = this; | ||
@@ -941,3 +942,3 @@ if (A.router) | ||
} | ||
Ae.init = Se; | ||
Ae.init = Pe; | ||
var je = p().queue; | ||
@@ -952,3 +953,3 @@ function De(n) { | ||
Oe as config, | ||
Te as container, | ||
xe as container, | ||
pe as getComponentFromStore, | ||
@@ -961,3 +962,3 @@ ee as getCurrentModal, | ||
Ie as popModal, | ||
xe as promptModal, | ||
Te as promptModal, | ||
te as pushModal, | ||
@@ -964,0 +965,0 @@ Ae as useModalRouter |
(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(h,m){typeof exports=="object"&&typeof module<"u"?m(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],m):(h=typeof globalThis<"u"?globalThis:h||self,m(h.JenesiusVueModal={},h.Vue))})(this,function(h,m){"use strict";/*! | ||
* jenesius-vue-modal v1.11.3 | ||
* jenesius-vue-modal v1.11.4 | ||
* (c) 2024 Jenesius | ||
* @license MIT | ||
*/var D=function(n,t){return D=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,i){e.__proto__=i}||function(e,i){for(var r in i)Object.prototype.hasOwnProperty.call(i,r)&&(e[r]=i[r])},D(n,t)};function ee(n,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");D(n,t);function e(){this.constructor=n}n.prototype=t===null?Object.create(t):(e.prototype=t.prototype,new e)}function M(n,t,e,i){function r(a){return a instanceof e?a:new e(function(c){c(a)})}return new(e||(e=Promise))(function(a,c){function f(o){try{s(i.next(o))}catch(u){c(u)}}function d(o){try{s(i.throw(o))}catch(u){c(u)}}function s(o){o.done?a(o.value):r(o.value).then(f,d)}s((i=i.apply(n,t||[])).next())})}function E(n,t){var e={label:0,sent:function(){if(a[0]&1)throw a[1];return a[1]},trys:[],ops:[]},i,r,a,c;return c={next:f(0),throw:f(1),return:f(2)},typeof Symbol=="function"&&(c[Symbol.iterator]=function(){return this}),c;function f(s){return function(o){return d([s,o])}}function d(s){if(i)throw new TypeError("Generator is already executing.");for(;c&&(c=0,s[0]&&(e=0)),e;)try{if(i=1,r&&(a=s[0]&2?r.return:s[0]?r.throw||((a=r.return)&&a.call(r),0):r.next)&&!(a=a.call(r,s[1])).done)return a;switch(r=0,a&&(s=[s[0]&2,a.value]),s[0]){case 0:case 1:a=s;break;case 4:return e.label++,{value:s[1],done:!1};case 5:e.label++,r=s[1],s=[0];continue;case 7:s=e.ops.pop(),e.trys.pop();continue;default:if(a=e.trys,!(a=a.length>0&&a[a.length-1])&&(s[0]===6||s[0]===2)){e=0;continue}if(s[0]===3&&(!a||s[1]>a[0]&&s[1]<a[3])){e.label=s[1];break}if(s[0]===6&&e.label<a[1]){e.label=a[1],a=s;break}if(a&&e.label<a[2]){e.label=a[2],e.ops.push(s);break}a[2]&&e.ops.pop(),e.trys.pop();continue}s=t.call(n,e)}catch(o){s=[6,o],r=0}finally{i=a=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){ee(t,n);function t(e,i){i===void 0&&(i=null);var r=n.call(this)||this;return r.isModalError=!0,r.message=e,r.details=i,r}return t.Undefined=function(e){return new t("Modal with id: ".concat(e," not founded. The modal window may have been closed earlier."))},t.UndefinedGuardName=function(e){return new t("Guard's name ".concat(e," is not declaration."))},t.NextReject=function(e){return new t("Guard returned false. Modal navigation was stopped. Modal id ".concat(e))},t.GuardDeclarationType=function(e){return new t("Guard's type should be a function. Provided:",e)},t.ConfigurationType=function(e){return new t("Configuration type must be an Object. Provided",e)},t.ConfigurationUndefinedParam=function(e,i){return new t("In configuration founded unknown parameter: ".concat(e,". Available are ").concat(i.join(", ")," "))},t.QueueNoEmpty=function(){return new t("Modal's queue is not empty. Probably some modal reject closing by onClose hook.")},t.EmptyModalQueue=function(){return new t("Modal queue is empty.")},t.NotInitialized=function(e){return new t("Modal Container not found. Put container from jenesius-vue-modal in App's template. Namespace: ".concat(e,". Check documentation for more information https://modal.jenesius.com/docs.html/installation#getting-started."))},t.ModalComponentNotProvided=function(){return new t("The first parameter(VueComponent) was not specified.")},t.DuplicatedRouterIntegration=function(){return new t("useModalRouter.init should escaped only once.")},t.ModalRouterIntegrationNotInitialized=function(){return new t("The integration was not initialized. Please, use useModalRouter.init(router). For more information: https://modal.jenesius.com/docs.html/integration-vue-router#installation")},t.ModalEventNameMustBeString=function(e){return new t("Event name must be a string. Provided: ".concat(e))},t.ModalNotFoundByID=function(e){return new t("Modal with ID ".concat(e," was not found."))},t.ModalNotExistsInStore=function(e){return new t("Provided name(".concat(e,") don't exist in the store. Has the given name been added to the store?"))},t}(Error),k=function(){function n(){this.state=new Map,n.instance=this}return n.prototype.getByName=function(t){return t===void 0&&(t=n.DEFAULT_NAMESPACE),this.state.has(t)||this.state.set(t,{queue:m.reactive([]),initialized:!1}),this.state.get(t)},n.prototype.forceClean=function(){this.state.forEach(function(t){t.queue.splice(0,t.queue.length)})},n.DEFAULT_NAMESPACE="default",n}(),$=function(){var n=new k,t={scrollLock:!0,animation:"modal-list",backgroundClose:!0,escClose:!0,store:{},skipInitCheck:!1,draggable:!1},e=n.getByName().queue;return m.watch(function(){return e},function(){t.scrollLock&&(e.length?document.body.style.overflowY="hidden":document.body.style.overflowY="auto")},{deep:!0}),{namespaceStore:n,configuration:t}}();function b(n){return $.namespaceStore.getByName(n)}var _=$.configuration;function z(n){var t={backgroundClose:_.backgroundClose,isRoute:!1,namespace:k.DEFAULT_NAMESPACE,draggable:_.draggable};return n.backgroundClose!==void 0&&(t.backgroundClose=n.backgroundClose),n.isRoute&&(t.isRoute=n.isRoute),n.namespace&&(t.namespace=n.namespace),n.draggable!==void 0&&(t.draggable=n.draggable),t}function U(n){n===void 0&&(n={});var t={background:!1,esc:!1};return Object.assign(t,n)}function G(n){return n||(n={}),n}function R(n,t){t===void 0&&(t={});var e=N.STORE.get(n);if(!e)return Promise.reject(v.ModalNotFoundByID(n));var i=b(e.namespace),r=i.queue.findIndex(function(c){return c.id===n});if(r===-1)return Promise.reject(v.Undefined(n));var a=F.get(n,"close").map(function(c){return ne(c,n,U(t))});return Y(a).then(function(){i.queue.splice(r,1)}).then(function(){F.get(n,"destroy").forEach(function(c){return c(U(t))})}).then(function(){F.delete(n)})}var N=function(){function n(t,e,i){var r=this;this.events=m.reactive({}),this.backgroundClose=!0,this.isRoute=!1,this.id=n.modalId++,this.component=t,this.props=m.ref(e),this.closed=m.computed(function(){return!b(i.namespace).queue.includes(r)}),t.beforeModalClose&&F.add(this.id,"close",t.beforeModalClose);var a=z(i);this.backgroundClose=a.backgroundClose,this.isRoute=a.isRoute,this.namespace=a.namespace,this.draggable=a.draggable,n.STORE.set(this.id,this)}return n.prototype.close=function(){return R(this.id)},Object.defineProperty(n.prototype,"onclose",{set:function(t){F.add(this.id,"close",t)},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"ondestroy",{set:function(t){F.add(this.id,"destroy",t)},enumerable:!1,configurable:!0}),n.prototype.on=function(t,e){var i=this;return Array.isArray(this.events[t])||(this.events[t]=[]),this.events[t].push(e),function(){var r=i.events[t].indexOf(e);r!==-1&&i.events[t].splice(r,1)}},n.STORE=new Map,n.modalId=0,n.EVENT_PROMPT="jenesius-vue-modal:____P____R____O____M____P____T",n}();function Q(n){return N.STORE.get(n)}var te={store:{},add:function(n,t,e){var i,r;if(typeof e!="function")throw v.GuardDeclarationType(e);this.store[n]||(this.store[n]=(i={},i[t]=[],i)),this.store[n][t]||(this.store[n][t]=[]),(r=this.store[n][t])===null||r===void 0||r.push(e)},get:function(n,t){return n in this.store?t in this.store[n]?this.store[n][t]||[]:[]:[]},delete:function(n){n in this.store&&delete this.store[n]}};const F=te;function Y(n){return n.reduce(function(t,e){return t.then(function(){return e()})},Promise.resolve())}function ne(n,t,e){return function(){return new Promise(function(i,r){var a,c=function(f){f===void 0&&(f=!0),f===!1&&r(v.NextReject(t)),i()};Promise.resolve(n.call((a=Q(t))===null||a===void 0?void 0:a.instance,e)).then(c).catch(function(f){return r(f)})})}}function W(n){return n=G(n),Y(b(n.namespace).queue.map(function(t){return function(){return t.close()}}))}function q(n){var t=b(n),e=t.queue;if(e.length!==0)return e[e.length-1]}function re(n){n=G(n);var t=q(n.namespace);return t?t.close():Promise.resolve()}function oe(n,t,e){var i=z(e),r=b(i.namespace);if(i.namespace===k.DEFAULT_NAMESPACE&&!r.initialized&&!_.skipInitCheck)throw v.NotInitialized(i.namespace);if(typeof n=="string"){var a=J(n);if(!a)throw v.ModalNotExistsInStore(n);n=a}if(!n)throw v.ModalComponentNotProvided();var c=new N(n,t,i);return r.queue.push(m.markRaw(c)),c}function B(n,t,e){return t===void 0&&(t={}),e===void 0&&(e={}),Promise.resolve().then(function(){return oe(n,t,e)})}function X(n,t,e){return t===void 0&&(t={}),e===void 0&&(e={}),W({namespace:e.namespace}).then(function(){var i=b(e.namespace);if(i.queue.length)throw v.QueueNoEmpty()}).then(function(){return B(n,t,e)})}function ie(n){if(typeof n!="object")throw v.ConfigurationType(n);Object.assign(_,n)}function ae(n){var t,e,i,r=m.getCurrentInstance(),a=String(((t=r==null?void 0:r.props)===null||t===void 0?void 0:t.modalId)||((e=r==null?void 0:r.props)===null||e===void 0?void 0:e["modal-id"])||((i=r==null?void 0:r.attrs)===null||i===void 0?void 0:i.modalId)),c=a.replace(/[^0-9]/g,"");F.add(Number(c),"close",n)}function ue(n,t,e){return t===void 0&&(t={}),e===void 0&&(e={}),M(this,void 0,void 0,function(){var i,r,a=this;return E(this,function(c){switch(c.label){case 0:return[4,B(n,t,e)];case 1:return i=c.sent(),r=!1,[2,new Promise(function(f){i.on(N.EVENT_PROMPT,function(d){return M(a,void 0,void 0,function(){return E(this,function(s){return r=!0,[2,i.close().then(function(){return f(d)}).catch(function(){return r=!1})]})})}),i.ondestroy=function(){r||f(null)}})]}})})}function J(n){return _.store[n]||void 0}function se(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var x={exports:{}},L,V;function ce(){if(V)return L;V=1;var n=1e3,t=n*60,e=t*60,i=e*24,r=i*7,a=i*365.25;L=function(o,u){u=u||{};var l=typeof o;if(l==="string"&&o.length>0)return c(o);if(l==="number"&&isFinite(o))return u.long?d(o):f(o);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(o))};function c(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 l=parseFloat(u[1]),p=(u[2]||"ms").toLowerCase();switch(p){case"years":case"year":case"yrs":case"yr":case"y":return l*a;case"weeks":case"week":case"w":return l*r;case"days":case"day":case"d":return l*i;case"hours":case"hour":case"hrs":case"hr":case"h":return l*e;case"minutes":case"minute":case"mins":case"min":case"m":return l*t;case"seconds":case"second":case"secs":case"sec":case"s":return l*n;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return l;default:return}}}}function f(o){var u=Math.abs(o);return u>=i?Math.round(o/i)+"d":u>=e?Math.round(o/e)+"h":u>=t?Math.round(o/t)+"m":u>=n?Math.round(o/n)+"s":o+"ms"}function d(o){var u=Math.abs(o);return u>=i?s(o,u,i,"day"):u>=e?s(o,u,e,"hour"):u>=t?s(o,u,t,"minute"):u>=n?s(o,u,n,"second"):o+" ms"}function s(o,u,l,p){var S=u>=l*1.5;return Math.round(o/l)+" "+p+(S?"s":"")}return L}function le(n){e.debug=e,e.default=e,e.coerce=d,e.disable=a,e.enable=r,e.enabled=c,e.humanize=ce(),e.destroy=s,Object.keys(n).forEach(o=>{e[o]=n[o]}),e.names=[],e.skips=[],e.formatters={};function t(o){let u=0;for(let l=0;l<o.length;l++)u=(u<<5)-u+o.charCodeAt(l),u|=0;return e.colors[Math.abs(u)%e.colors.length]}e.selectColor=t;function e(o){let u,l=null,p,S;function C(...g){if(!C.enabled)return;const y=C,P=Number(new Date),T=P-(u||P);y.diff=T,y.prev=u,y.curr=P,u=P,g[0]=e.coerce(g[0]),typeof g[0]!="string"&&g.unshift("%O");let w=0;g[0]=g[0].replace(/%([a-zA-Z%])/g,(I,j)=>{if(I==="%%")return"%";w++;const O=e.formatters[j];if(typeof O=="function"){const we=g[w];I=O.call(y,we),g.splice(w,1),w--}return I}),e.formatArgs.call(y,g),(y.log||e.log).apply(y,g)}return C.namespace=o,C.useColors=e.useColors(),C.color=e.selectColor(o),C.extend=i,C.destroy=e.destroy,Object.defineProperty(C,"enabled",{enumerable:!0,configurable:!1,get:()=>l!==null?l:(p!==e.namespaces&&(p=e.namespaces,S=e.enabled(o)),S),set:g=>{l=g}}),typeof e.init=="function"&&e.init(C),C}function i(o,u){const l=e(this.namespace+(typeof u>"u"?":":u)+o);return l.log=this.log,l}function r(o){e.save(o),e.namespaces=o,e.names=[],e.skips=[];let u;const l=(typeof o=="string"?o:"").split(/[\s,]+/),p=l.length;for(u=0;u<p;u++)l[u]&&(o=l[u].replace(/\*/g,".*?"),o[0]==="-"?e.skips.push(new RegExp("^"+o.slice(1)+"$")):e.names.push(new RegExp("^"+o+"$")))}function a(){const o=[...e.names.map(f),...e.skips.map(f).map(u=>"-"+u)].join(",");return e.enable(""),o}function c(o){if(o[o.length-1]==="*")return!0;let u,l;for(u=0,l=e.skips.length;u<l;u++)if(e.skips[u].test(o))return!1;for(u=0,l=e.names.length;u<l;u++)if(e.names[u].test(o))return!0;return!1}function f(o){return o.toString().substring(2,o.toString().length-2).replace(/\.\*\?$/,"*")}function d(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 e.enable(e.load()),e}var de=le;(function(n,t){t.formatArgs=i,t.save=r,t.load=a,t.useColors=e,t.storage=c(),t.destroy=(()=>{let d=!1;return()=>{d||(d=!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`."))}})(),t.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 e(){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 i(d){if(d[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+d[0]+(this.useColors?"%c ":" ")+"+"+n.exports.humanize(this.diff),!this.useColors)return;const s="color: "+this.color;d.splice(1,0,s,"color: inherit");let o=0,u=0;d[0].replace(/%[a-zA-Z%]/g,l=>{l!=="%%"&&(o++,l==="%c"&&(u=o))}),d.splice(u,0,s)}t.log=console.debug||console.log||(()=>{});function r(d){try{d?t.storage.setItem("debug",d):t.storage.removeItem("debug")}catch{}}function a(){let d;try{d=t.storage.getItem("debug")}catch{}return!d&&typeof process<"u"&&"env"in process&&(d=process.env.DEBUG),d}function c(){try{return localStorage}catch{}}n.exports=de(t);const{formatters:f}=n.exports;f.j=function(d){try{return JSON.stringify(d)}catch(s){return"[UnexpectedJSONParseError]: "+s.message}}})(x,x.exports);var fe=x.exports;const me=se(fe);function he(n){return me("jenesius-vue-modal:".concat(n))}const _e="",ge=["onPointerdown"],H={__name:"WidgetModalContainerItem",props:{id:Number},setup(n){const t=m.ref(null),e=he("modal-item"),i=n,r=Q(i.id);function a(){if(r.backgroundClose)return R(r.id,{background:!0}).catch(()=>{})}m.watch(()=>t.value,f=>{r.instance=f}),m.onMounted(()=>{r.draggable&&(e("The modal window is movable."),c(document.querySelector(typeof r.draggable=="string"?r.draggable:`[modalid=_modal_${i.id}]`)))});function c(f){if(!f){e("draggable item not found.");return}const d=document.querySelector(`[modalid=_modal_${i.id}]`);f.addEventListener("pointerdown",s=>{var T;const o=(T=d.getAttribute("style"))==null?void 0:T.match(/transform: translate\((.*)px,\s*(.*)px\)/);let u=o==null?void 0:o[1],l=o==null?void 0:o[2];u=typeof u=="string"?Number.parseInt(u):0,l=typeof l=="string"?Number.parseInt(l):0;const{clientX:p,clientY:S}=s,C=p,g=S;e(`movement started at (${g}, ${g})`),document.addEventListener("pointermove",y,{passive:!0}),document.addEventListener("pointerup",P,{once:!0});function y(w){const{clientX:K,clientY:I}=w,j=u+K-C,O=l+I-g;e(`move at (${j}, ${O})`),d.style.transform=`translate(${j}px,${O}px)`}function P(w){e("movement completed"),document.removeEventListener("pointermove",y),w.preventDefault()}})}return(f,d)=>(m.openBlock(),m.createElementBlock("div",{class:"widget__modal-container__item modal-container",onPointerdown:m.withModifiers(a,["self","stop"])},[(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_${n.id}`,ref_key:"modalRef",ref:t},m.toHandlers(m.unref(r).events)),null,16,["modalId"]))],40,ge))}};function Ce(n){n===void 0&&(n=k.DEFAULT_NAMESPACE);var t=k.instance.getByName(n);t.initialized=!0,n===k.DEFAULT_NAMESPACE&&document.addEventListener("keyup",function(e){if(_.escClose&&(e.key==="Escape"||e.code==="Escape")){var i=q(n);if(!i)return;R(i.id,{esc:!0}).catch(function(){})}})}const Fe="",ve={props:{namespace:String},setup(n){return m.onMounted(()=>{Ce(n.namespace)}),()=>{const t=b(n.namespace);return m.h(m.TransitionGroup,{name:_.animation,tag:"div"},{default:()=>t.queue.map(e=>m.h(H,{key:e.id,id:e.id}))})}},components:{WidgetContainerModalItem:H}};var A={router:null};function pe(n){var t=this;if(A.router)throw v.DuplicatedRouterIntegration();A.router=n;function e(i){for(var r=i.matched.length-1;r>=0;r--){var a=i.matched[r].components,c=Object.values(a).find(function(f){return f._isModal});if(c)return c}return null}n.beforeEach(function(i,r){return M(t,void 0,void 0,function(){var a,c,f;return E(this,function(d){switch(d.label){case 0:return d.trys.push([0,3,,4]),a=e(r),a&&!(!((f=(c=a.getModalObject())===null||c===void 0?void 0:c.closed)===null||f===void 0)&&f.value)?[4,a.close(!0)]:[3,2];case 1:d.sent(),d.label=2;case 2:return[3,4];case 3:return d.sent(),[2,!1];case 4:return[2]}})})}),n.afterEach(function(i){return M(t,void 0,void 0,function(){var r;return E(this,function(a){switch(a.label){case 0:return r=e(i),r?[4,r.initialize()]:[3,2];case 1:a.sent(),a.label=2;case 2:return[2]}})})})}function Z(n){var t=null,e=!1;function i(){return M(this,void 0,void 0,function(){return E(this,function(r){switch(r.label){case 0:if(!A.router)throw v.ModalRouterIntegrationNotInitialized();return e=!1,t=null,[4,X(n,m.computed(function(){var a;return(a=A.router)===null||a===void 0?void 0:a.currentRoute.value.params}),{isRoute:!0})];case 1:return t=r.sent(),t.onclose=function(){var a;e||(a=A.router)===null||a===void 0||a.back()},[2]}})})}return{getModalObject:function(){return t},_isModal:!0,close:function(r){return r===void 0&&(r=!1),M(this,void 0,void 0,function(){return E(this,function(a){switch(a.label){case 0:return e=r,t?[4,t.close()]:[3,2];case 1:return[2,a.sent()];case 2:return[2]}})})},initialize:i,setup:function(){return function(){return null}}}}Z.init=pe;var ye=b().queue;function be(n){return b(n).queue}h.Modal=N,h.closeById=R,h.closeModal=W,h.config=ie,h.container=ve,h.getComponentFromStore=J,h.getCurrentModal=q,h.getQueueByNamespace=be,h.modalQueue=ye,h.onBeforeModalClose=ae,h.openModal=X,h.popModal=re,h.promptModal=ue,h.pushModal=B,h.useModalRouter=Z,Object.defineProperty(h,Symbol.toStringTag,{value:"Module"})}); | ||
*/var D=function(n,t){return D=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,i){e.__proto__=i}||function(e,i){for(var r in i)Object.prototype.hasOwnProperty.call(i,r)&&(e[r]=i[r])},D(n,t)};function ee(n,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");D(n,t);function e(){this.constructor=n}n.prototype=t===null?Object.create(t):(e.prototype=t.prototype,new e)}function M(n,t,e,i){function r(a){return a instanceof e?a:new e(function(c){c(a)})}return new(e||(e=Promise))(function(a,c){function f(o){try{s(i.next(o))}catch(u){c(u)}}function d(o){try{s(i.throw(o))}catch(u){c(u)}}function s(o){o.done?a(o.value):r(o.value).then(f,d)}s((i=i.apply(n,t||[])).next())})}function E(n,t){var e={label:0,sent:function(){if(a[0]&1)throw a[1];return a[1]},trys:[],ops:[]},i,r,a,c;return c={next:f(0),throw:f(1),return:f(2)},typeof Symbol=="function"&&(c[Symbol.iterator]=function(){return this}),c;function f(s){return function(o){return d([s,o])}}function d(s){if(i)throw new TypeError("Generator is already executing.");for(;c&&(c=0,s[0]&&(e=0)),e;)try{if(i=1,r&&(a=s[0]&2?r.return:s[0]?r.throw||((a=r.return)&&a.call(r),0):r.next)&&!(a=a.call(r,s[1])).done)return a;switch(r=0,a&&(s=[s[0]&2,a.value]),s[0]){case 0:case 1:a=s;break;case 4:return e.label++,{value:s[1],done:!1};case 5:e.label++,r=s[1],s=[0];continue;case 7:s=e.ops.pop(),e.trys.pop();continue;default:if(a=e.trys,!(a=a.length>0&&a[a.length-1])&&(s[0]===6||s[0]===2)){e=0;continue}if(s[0]===3&&(!a||s[1]>a[0]&&s[1]<a[3])){e.label=s[1];break}if(s[0]===6&&e.label<a[1]){e.label=a[1],a=s;break}if(a&&e.label<a[2]){e.label=a[2],e.ops.push(s);break}a[2]&&e.ops.pop(),e.trys.pop();continue}s=t.call(n,e)}catch(o){s=[6,o],r=0}finally{i=a=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){ee(t,n);function t(e,i){i===void 0&&(i=null);var r=n.call(this)||this;return r.isModalError=!0,r.message=e,r.details=i,r}return t.Undefined=function(e){return new t("Modal with id: ".concat(e," not founded. The modal window may have been closed earlier."))},t.UndefinedGuardName=function(e){return new t("Guard's name ".concat(e," is not declaration."))},t.NextReject=function(e){return new t("Guard returned false. Modal navigation was stopped. Modal id ".concat(e))},t.GuardDeclarationType=function(e){return new t("Guard's type should be a function. Provided:",e)},t.ConfigurationType=function(e){return new t("Configuration type must be an Object. Provided",e)},t.ConfigurationUndefinedParam=function(e,i){return new t("In configuration founded unknown parameter: ".concat(e,". Available are ").concat(i.join(", ")," "))},t.QueueNoEmpty=function(){return new t("Modal's queue is not empty. Probably some modal reject closing by onClose hook.")},t.EmptyModalQueue=function(){return new t("Modal queue is empty.")},t.NotInitialized=function(e){return new t("Modal Container not found. Put container from jenesius-vue-modal in App's template. Namespace: ".concat(e,". Check documentation for more information https://modal.jenesius.com/docs.html/installation#getting-started."))},t.ModalComponentNotProvided=function(){return new t("The first parameter(VueComponent) was not specified.")},t.DuplicatedRouterIntegration=function(){return new t("useModalRouter.init should escaped only once.")},t.ModalRouterIntegrationNotInitialized=function(){return new t("The integration was not initialized. Please, use useModalRouter.init(router). For more information: https://modal.jenesius.com/docs.html/integration-vue-router#installation")},t.ModalEventNameMustBeString=function(e){return new t("Event name must be a string. Provided: ".concat(e))},t.ModalNotFoundByID=function(e){return new t("Modal with ID ".concat(e," was not found."))},t.ModalNotExistsInStore=function(e){return new t("Provided name(".concat(e,") don't exist in the store. Has the given name been added to the store?"))},t}(Error),k=function(){function n(){this.state=new Map,n.instance=this}return n.prototype.getByName=function(t){return t===void 0&&(t=n.DEFAULT_NAMESPACE),this.state.has(t)||this.state.set(t,{queue:m.reactive([]),initialized:!1}),this.state.get(t)},n.prototype.forceClean=function(){this.state.forEach(function(t){t.queue.splice(0,t.queue.length)})},n.DEFAULT_NAMESPACE="default",n}(),L=function(){var n=new k,t={scrollLock:!0,animation:"modal-list",backgroundClose:!0,escClose:!0,store:{},skipInitCheck:!1,draggable:!1},e=n.getByName().queue;return m.watch(function(){return e},function(){t.scrollLock&&(e.length?document.body.style.overflowY="hidden":document.body.style.overflowY="auto")},{deep:!0}),{namespaceStore:n,configuration:t}}();function b(n){return L.namespaceStore.getByName(n)}var _=L.configuration;function z(n){var t={backgroundClose:_.backgroundClose,isRoute:!1,namespace:k.DEFAULT_NAMESPACE,draggable:_.draggable};return n.backgroundClose!==void 0&&(t.backgroundClose=n.backgroundClose),n.isRoute&&(t.isRoute=n.isRoute),n.namespace&&(t.namespace=n.namespace),n.draggable!==void 0&&(t.draggable=n.draggable),t}function U(n){n===void 0&&(n={});var t={background:!1,esc:!1};return Object.assign(t,n)}function G(n){return n||(n={}),n}function R(n,t){t===void 0&&(t={});var e=N.STORE.get(n);if(!e)return Promise.reject(v.ModalNotFoundByID(n));var i=b(e.namespace),r=i.queue.findIndex(function(c){return c.id===n});if(r===-1)return Promise.reject(v.Undefined(n));var a=F.get(n,"close").map(function(c){return ne(c,n,U(t))});return Y(a).then(function(){i.queue.splice(r,1)}).then(function(){F.get(n,"destroy").forEach(function(c){return c(U(t))})}).then(function(){F.delete(n)})}var N=function(){function n(t,e,i){var r=this;this.events=m.reactive({}),this.backgroundClose=!0,this.isRoute=!1,this.id=n.modalId++,this.component=t,this.props=m.ref(e),this.closed=m.computed(function(){return!b(i.namespace).queue.includes(r)}),t.beforeModalClose&&F.add(this.id,"close",t.beforeModalClose);var a=z(i);this.backgroundClose=a.backgroundClose,this.isRoute=a.isRoute,this.namespace=a.namespace,this.draggable=a.draggable,n.STORE.set(this.id,this)}return n.prototype.close=function(){return R(this.id)},Object.defineProperty(n.prototype,"onclose",{set:function(t){F.add(this.id,"close",t)},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"ondestroy",{set:function(t){F.add(this.id,"destroy",t)},enumerable:!1,configurable:!0}),n.prototype.on=function(t,e){var i=this;return Array.isArray(this.events[t])||(this.events[t]=[]),this.events[t].push(e),function(){var r=i.events[t].indexOf(e);r!==-1&&i.events[t].splice(r,1)}},n.STORE=new Map,n.modalId=0,n.EVENT_PROMPT="jenesius-vue-modal:____P____R____O____M____P____T",n}();function Q(n){return N.STORE.get(n)}var te={store:{},add:function(n,t,e){var i,r;if(typeof e!="function")throw v.GuardDeclarationType(e);this.store[n]||(this.store[n]=(i={},i[t]=[],i)),this.store[n][t]||(this.store[n][t]=[]),(r=this.store[n][t])===null||r===void 0||r.push(e)},get:function(n,t){return n in this.store?t in this.store[n]?this.store[n][t]||[]:[]:[]},delete:function(n){n in this.store&&delete this.store[n]}};const F=te;function Y(n){return n.reduce(function(t,e){return t.then(function(){return e()})},Promise.resolve())}function ne(n,t,e){return function(){return new Promise(function(i,r){var a,c=function(f){f===void 0&&(f=!0),f===!1&&r(v.NextReject(t)),i()};Promise.resolve(n.call((a=Q(t))===null||a===void 0?void 0:a.instance,e)).then(c).catch(function(f){return r(f)})})}}function W(n){return n=G(n),Y(b(n.namespace).queue.map(function(t){return function(){return t.close()}}))}function q(n){var t=b(n),e=t.queue;if(e.length!==0)return e[e.length-1]}function re(n){n=G(n);var t=q(n.namespace);return t?t.close():Promise.resolve()}function oe(n,t,e){var i=z(e),r=b(i.namespace);if(i.namespace===k.DEFAULT_NAMESPACE&&!r.initialized&&!_.skipInitCheck)throw v.NotInitialized(i.namespace);if(typeof n=="string"){var a=J(n);if(!a)throw v.ModalNotExistsInStore(n);n=a}if(!n)throw v.ModalComponentNotProvided();var c=new N(n,t,i);return r.queue.push(m.markRaw(c)),c}function B(n,t,e){return t===void 0&&(t={}),e===void 0&&(e={}),Promise.resolve().then(function(){return oe(n,t,e)})}function X(n,t,e){return t===void 0&&(t={}),e===void 0&&(e={}),W({namespace:e.namespace}).then(function(){var i=b(e.namespace);if(i.queue.length)throw v.QueueNoEmpty()}).then(function(){return B(n,t,e)})}function ie(n){if(typeof n!="object")throw v.ConfigurationType(n);Object.assign(_,n)}function ae(n){var t,e,i,r=m.getCurrentInstance(),a=String(((t=r==null?void 0:r.props)===null||t===void 0?void 0:t.modalId)||((e=r==null?void 0:r.props)===null||e===void 0?void 0:e["modal-id"])||((i=r==null?void 0:r.attrs)===null||i===void 0?void 0:i.modalId)),c=a.replace(/[^0-9]/g,"");F.add(Number(c),"close",n)}function ue(n,t,e){return t===void 0&&(t={}),e===void 0&&(e={}),M(this,void 0,void 0,function(){var i,r,a=this;return E(this,function(c){switch(c.label){case 0:return[4,B(n,t,e)];case 1:return i=c.sent(),r=!1,[2,new Promise(function(f){i.on(N.EVENT_PROMPT,function(d){return M(a,void 0,void 0,function(){return E(this,function(s){return r=!0,[2,i.close().then(function(){return f(d)}).catch(function(){return r=!1})]})})}),i.ondestroy=function(){r||f(null)}})]}})})}function J(n){return _.store[n]||void 0}function se(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var x={exports:{}},$,V;function ce(){if(V)return $;V=1;var n=1e3,t=n*60,e=t*60,i=e*24,r=i*7,a=i*365.25;$=function(o,u){u=u||{};var l=typeof o;if(l==="string"&&o.length>0)return c(o);if(l==="number"&&isFinite(o))return u.long?d(o):f(o);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(o))};function c(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 l=parseFloat(u[1]),p=(u[2]||"ms").toLowerCase();switch(p){case"years":case"year":case"yrs":case"yr":case"y":return l*a;case"weeks":case"week":case"w":return l*r;case"days":case"day":case"d":return l*i;case"hours":case"hour":case"hrs":case"hr":case"h":return l*e;case"minutes":case"minute":case"mins":case"min":case"m":return l*t;case"seconds":case"second":case"secs":case"sec":case"s":return l*n;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return l;default:return}}}}function f(o){var u=Math.abs(o);return u>=i?Math.round(o/i)+"d":u>=e?Math.round(o/e)+"h":u>=t?Math.round(o/t)+"m":u>=n?Math.round(o/n)+"s":o+"ms"}function d(o){var u=Math.abs(o);return u>=i?s(o,u,i,"day"):u>=e?s(o,u,e,"hour"):u>=t?s(o,u,t,"minute"):u>=n?s(o,u,n,"second"):o+" ms"}function s(o,u,l,p){var S=u>=l*1.5;return Math.round(o/l)+" "+p+(S?"s":"")}return $}function le(n){e.debug=e,e.default=e,e.coerce=d,e.disable=a,e.enable=r,e.enabled=c,e.humanize=ce(),e.destroy=s,Object.keys(n).forEach(o=>{e[o]=n[o]}),e.names=[],e.skips=[],e.formatters={};function t(o){let u=0;for(let l=0;l<o.length;l++)u=(u<<5)-u+o.charCodeAt(l),u|=0;return e.colors[Math.abs(u)%e.colors.length]}e.selectColor=t;function e(o){let u,l=null,p,S;function C(...g){if(!C.enabled)return;const y=C,P=Number(new Date),T=P-(u||P);y.diff=T,y.prev=u,y.curr=P,u=P,g[0]=e.coerce(g[0]),typeof g[0]!="string"&&g.unshift("%O");let w=0;g[0]=g[0].replace(/%([a-zA-Z%])/g,(I,j)=>{if(I==="%%")return"%";w++;const O=e.formatters[j];if(typeof O=="function"){const we=g[w];I=O.call(y,we),g.splice(w,1),w--}return I}),e.formatArgs.call(y,g),(y.log||e.log).apply(y,g)}return C.namespace=o,C.useColors=e.useColors(),C.color=e.selectColor(o),C.extend=i,C.destroy=e.destroy,Object.defineProperty(C,"enabled",{enumerable:!0,configurable:!1,get:()=>l!==null?l:(p!==e.namespaces&&(p=e.namespaces,S=e.enabled(o)),S),set:g=>{l=g}}),typeof e.init=="function"&&e.init(C),C}function i(o,u){const l=e(this.namespace+(typeof u>"u"?":":u)+o);return l.log=this.log,l}function r(o){e.save(o),e.namespaces=o,e.names=[],e.skips=[];let u;const l=(typeof o=="string"?o:"").split(/[\s,]+/),p=l.length;for(u=0;u<p;u++)l[u]&&(o=l[u].replace(/\*/g,".*?"),o[0]==="-"?e.skips.push(new RegExp("^"+o.slice(1)+"$")):e.names.push(new RegExp("^"+o+"$")))}function a(){const o=[...e.names.map(f),...e.skips.map(f).map(u=>"-"+u)].join(",");return e.enable(""),o}function c(o){if(o[o.length-1]==="*")return!0;let u,l;for(u=0,l=e.skips.length;u<l;u++)if(e.skips[u].test(o))return!1;for(u=0,l=e.names.length;u<l;u++)if(e.names[u].test(o))return!0;return!1}function f(o){return o.toString().substring(2,o.toString().length-2).replace(/\.\*\?$/,"*")}function d(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 e.enable(e.load()),e}var de=le;(function(n,t){t.formatArgs=i,t.save=r,t.load=a,t.useColors=e,t.storage=c(),t.destroy=(()=>{let d=!1;return()=>{d||(d=!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`."))}})(),t.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 e(){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 i(d){if(d[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+d[0]+(this.useColors?"%c ":" ")+"+"+n.exports.humanize(this.diff),!this.useColors)return;const s="color: "+this.color;d.splice(1,0,s,"color: inherit");let o=0,u=0;d[0].replace(/%[a-zA-Z%]/g,l=>{l!=="%%"&&(o++,l==="%c"&&(u=o))}),d.splice(u,0,s)}t.log=console.debug||console.log||(()=>{});function r(d){try{d?t.storage.setItem("debug",d):t.storage.removeItem("debug")}catch{}}function a(){let d;try{d=t.storage.getItem("debug")}catch{}return!d&&typeof process<"u"&&"env"in process&&(d=process.env.DEBUG),d}function c(){try{return localStorage}catch{}}n.exports=de(t);const{formatters:f}=n.exports;f.j=function(d){try{return JSON.stringify(d)}catch(s){return"[UnexpectedJSONParseError]: "+s.message}}})(x,x.exports);var fe=x.exports;const me=se(fe);function he(n){return me("jenesius-vue-modal:".concat(n))}const _e="",ge=["onPointerdown"],H={__name:"WidgetModalContainerItem",props:{id:Number},setup(n){const t=m.ref(null),e=he("modal-item"),i=n,r=Q(i.id);function a(){if(r.backgroundClose)return R(r.id,{background:!0}).catch(()=>{})}m.watch(()=>t.value,f=>{r.instance=f}),m.onMounted(()=>{if(e(`Modal(${r.id}) is mounted`),r.draggable){const f=typeof r.draggable=="string"?r.draggable:`[modalid=_modal_${i.id}]`;e(`The modal window is movable(${f}).`),setTimeout(()=>{c(document.querySelector(f))},0)}});function c(f){if(!f){e("draggable item not found.");return}const d=document.querySelector(`[modalid=_modal_${i.id}]`);f.addEventListener("pointerdown",s=>{var T;const o=(T=d.getAttribute("style"))==null?void 0:T.match(/transform: translate\((.*)px,\s*(.*)px\)/);let u=o==null?void 0:o[1],l=o==null?void 0:o[2];u=typeof u=="string"?Number.parseInt(u):0,l=typeof l=="string"?Number.parseInt(l):0;const{clientX:p,clientY:S}=s,C=p,g=S;e(`movement started at (${g}, ${g})`),document.addEventListener("pointermove",y,{passive:!0}),document.addEventListener("pointerup",P,{once:!0});function y(w){const{clientX:K,clientY:I}=w,j=u+K-C,O=l+I-g;e(`move at (${j}, ${O})`),d.style.transform=`translate(${j}px,${O}px)`}function P(w){e("movement completed"),document.removeEventListener("pointermove",y),w.preventDefault()}})}return(f,d)=>(m.openBlock(),m.createElementBlock("div",{class:"widget__modal-container__item modal-container",onPointerdown:m.withModifiers(a,["self","stop"])},[(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_${n.id}`,ref_key:"modalRef",ref:t},m.toHandlers(m.unref(r).events)),null,16,["modalId"]))],40,ge))}};function Ce(n){n===void 0&&(n=k.DEFAULT_NAMESPACE);var t=k.instance.getByName(n);t.initialized=!0,n===k.DEFAULT_NAMESPACE&&document.addEventListener("keyup",function(e){if(_.escClose&&(e.key==="Escape"||e.code==="Escape")){var i=q(n);if(!i)return;R(i.id,{esc:!0}).catch(function(){})}})}const Fe="",ve={props:{namespace:String},setup(n){return m.onMounted(()=>{Ce(n.namespace)}),()=>{const t=b(n.namespace);return m.h(m.TransitionGroup,{name:_.animation,tag:"div"},{default:()=>t.queue.map(e=>m.h(H,{key:e.id,id:e.id}))})}},components:{WidgetContainerModalItem:H}};var A={router:null};function pe(n){var t=this;if(A.router)throw v.DuplicatedRouterIntegration();A.router=n;function e(i){for(var r=i.matched.length-1;r>=0;r--){var a=i.matched[r].components,c=Object.values(a).find(function(f){return f._isModal});if(c)return c}return null}n.beforeEach(function(i,r){return M(t,void 0,void 0,function(){var a,c,f;return E(this,function(d){switch(d.label){case 0:return d.trys.push([0,3,,4]),a=e(r),a&&!(!((f=(c=a.getModalObject())===null||c===void 0?void 0:c.closed)===null||f===void 0)&&f.value)?[4,a.close(!0)]:[3,2];case 1:d.sent(),d.label=2;case 2:return[3,4];case 3:return d.sent(),[2,!1];case 4:return[2]}})})}),n.afterEach(function(i){return M(t,void 0,void 0,function(){var r;return E(this,function(a){switch(a.label){case 0:return r=e(i),r?[4,r.initialize()]:[3,2];case 1:a.sent(),a.label=2;case 2:return[2]}})})})}function Z(n){var t=null,e=!1;function i(){return M(this,void 0,void 0,function(){return E(this,function(r){switch(r.label){case 0:if(!A.router)throw v.ModalRouterIntegrationNotInitialized();return e=!1,t=null,[4,X(n,m.computed(function(){var a;return(a=A.router)===null||a===void 0?void 0:a.currentRoute.value.params}),{isRoute:!0})];case 1:return t=r.sent(),t.onclose=function(){var a;e||(a=A.router)===null||a===void 0||a.back()},[2]}})})}return{getModalObject:function(){return t},_isModal:!0,close:function(r){return r===void 0&&(r=!1),M(this,void 0,void 0,function(){return E(this,function(a){switch(a.label){case 0:return e=r,t?[4,t.close()]:[3,2];case 1:return[2,a.sent()];case 2:return[2]}})})},initialize:i,setup:function(){return function(){return null}}}}Z.init=pe;var ye=b().queue;function be(n){return b(n).queue}h.Modal=N,h.closeById=R,h.closeModal=W,h.config=ie,h.container=ve,h.getComponentFromStore=J,h.getCurrentModal=q,h.getQueueByNamespace=be,h.modalQueue=ye,h.onBeforeModalClose=ae,h.openModal=X,h.popModal=re,h.promptModal=ue,h.pushModal=B,h.useModalRouter=Z,Object.defineProperty(h,Symbol.toStringTag,{value:"Module"})}); | ||
//# sourceMappingURL=jenesius-vue-modal.umd.js.map |
{ | ||
"name": "jenesius-vue-modal", | ||
"version": "1.11.3", | ||
"version": "1.11.4", | ||
"private": false, | ||
@@ -5,0 +5,0 @@ "description": "The progressive and simple modal system for Vue.js v3", |
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
320395
2866