jenesius-vue-modal
Advanced tools
Comparing version 1.11.2 to 1.11.3
(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.2 | ||
* jenesius-vue-modal v1.11.3 | ||
* (c) 2024 Jenesius | ||
* @license MIT | ||
*/Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("vue");var C=function(t,e){return C=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var o in i)Object.prototype.hasOwnProperty.call(i,o)&&(n[o]=i[o])},C(t,e)};function H(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");C(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}function _(t,e,n,i){function o(r){return r instanceof n?r:new n(function(u){u(r)})}return new(n||(n=Promise))(function(r,u){function c(l){try{a(i.next(l))}catch(h){u(h)}}function d(l){try{a(i.throw(l))}catch(h){u(h)}}function a(l){l.done?r(l.value):o(l.value).then(c,d)}a((i=i.apply(t,e||[])).next())})}function y(t,e){var n={label:0,sent:function(){if(r[0]&1)throw r[1];return r[1]},trys:[],ops:[]},i,o,r,u;return u={next:c(0),throw:c(1),return:c(2)},typeof Symbol=="function"&&(u[Symbol.iterator]=function(){return this}),u;function c(a){return function(l){return d([a,l])}}function d(a){if(i)throw new TypeError("Generator is already executing.");for(;u&&(u=0,a[0]&&(n=0)),n;)try{if(i=1,o&&(r=a[0]&2?o.return:a[0]?o.throw||((r=o.return)&&r.call(o),0):o.next)&&!(r=r.call(o,a[1])).done)return r;switch(o=0,r&&(a=[a[0]&2,r.value]),a[0]){case 0:case 1:r=a;break;case 4:return n.label++,{value:a[1],done:!1};case 5:n.label++,o=a[1],a=[0];continue;case 7:a=n.ops.pop(),n.trys.pop();continue;default:if(r=n.trys,!(r=r.length>0&&r[r.length-1])&&(a[0]===6||a[0]===2)){n=0;continue}if(a[0]===3&&(!r||a[1]>r[0]&&a[1]<r[3])){n.label=a[1];break}if(a[0]===6&&n.label<r[1]){n.label=r[1],r=a;break}if(r&&n.label<r[2]){n.label=r[2],n.ops.push(a);break}r[2]&&n.ops.pop(),n.trys.pop();continue}a=e.call(t,n)}catch(l){a=[6,l],o=0}finally{i=r=0}if(a[0]&5)throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}}var f=function(t){H(e,t);function e(n,i){i===void 0&&(i=null);var o=t.call(this)||this;return o.isModalError=!0,o.message=n,o.details=i,o}return e.Undefined=function(n){return new e("Modal with id: ".concat(n," not founded. The modal window may have been closed earlier."))},e.UndefinedGuardName=function(n){return new e("Guard's name ".concat(n," is not declaration."))},e.NextReject=function(n){return new e("Guard returned false. Modal navigation was stopped. Modal id ".concat(n))},e.GuardDeclarationType=function(n){return new e("Guard's type should be a function. Provided:",n)},e.ConfigurationType=function(n){return new e("Configuration type must be an Object. Provided",n)},e.ConfigurationUndefinedParam=function(n,i){return new e("In configuration founded unknown parameter: ".concat(n,". Available are ").concat(i.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(n){return new e("Modal Container not found. Put container from jenesius-vue-modal in App's template. Namespace: ".concat(n,". 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(n){return new e("Event name must be a string. Provided: ".concat(n))},e.ModalNotFoundByID=function(n){return new e("Modal with ID ".concat(n," was not found."))},e.ModalNotExistsInStore=function(n){return new e("Provided name(".concat(n,") don't exist in the store. Has the given name been added to the store?"))},e}(Error),p=function(){function t(){this.state=new Map,t.instance=this}return t.prototype.getByName=function(e){return e===void 0&&(e=t.DEFAULT_NAMESPACE),this.state.has(e)||this.state.set(e,{queue:s.reactive([]),initialized:!1}),this.state.get(e)},t.prototype.forceClean=function(){this.state.forEach(function(e){e.queue.splice(0,e.queue.length)})},t.DEFAULT_NAMESPACE="default",t}(),T=function(){var t=new p,e={scrollLock:!0,animation:"modal-list",backgroundClose:!0,escClose:!0,store:{},skipInitCheck:!1,draggable:!1},n=t.getByName().queue;return s.watch(function(){return n},function(){e.scrollLock&&(n.length?document.body.style.overflowY="hidden":document.body.style.overflowY="auto")},{deep:!0}),{namespaceStore:t,configuration:e}}();function v(t){return T.namespaceStore.getByName(t)}var g=T.configuration;function O(t){var e={backgroundClose:g.backgroundClose,isRoute:!1,namespace:p.DEFAULT_NAMESPACE,draggable:g.draggable};return t.backgroundClose!==void 0&&(e.backgroundClose=t.backgroundClose),t.isRoute&&(e.isRoute=t.isRoute),t.namespace&&(e.namespace=t.namespace),t.draggable!==void 0&&(e.draggable=t.draggable),e}function R(t){t===void 0&&(t={});var e={background:!1,esc:!1};return Object.assign(e,t)}function x(t){return t||(t={}),t}function w(t,e){e===void 0&&(e={});var n=M.STORE.get(t);if(!n)return Promise.reject(f.ModalNotFoundByID(t));var i=v(n.namespace),o=i.queue.findIndex(function(u){return u.id===t});if(o===-1)return Promise.reject(f.Undefined(t));var r=m.get(t,"close").map(function(u){return J(u,t,R(e))});return D(r).then(function(){i.queue.splice(o,1)}).then(function(){m.get(t,"destroy").forEach(function(u){return u(R(e))})}).then(function(){m.delete(t)})}var M=function(){function t(e,n,i){var o=this;this.events=s.reactive({}),this.backgroundClose=!0,this.isRoute=!1,this.id=t.modalId++,this.component=e,this.props=s.ref(n),this.closed=s.computed(function(){return!v(i.namespace).queue.includes(o)}),e.beforeModalClose&&m.add(this.id,"close",e.beforeModalClose);var r=O(i);this.backgroundClose=r.backgroundClose,this.isRoute=r.isRoute,this.namespace=r.namespace,this.draggable=r.draggable,t.STORE.set(this.id,this)}return t.prototype.close=function(){return w(this.id)},Object.defineProperty(t.prototype,"onclose",{set:function(e){m.add(this.id,"close",e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"ondestroy",{set:function(e){m.add(this.id,"destroy",e)},enumerable:!1,configurable:!0}),t.prototype.on=function(e,n){var i=this;return Array.isArray(this.events[e])||(this.events[e]=[]),this.events[e].push(n),function(){var o=i.events[e].indexOf(n);o!==-1&&i.events[e].splice(o,1)}},t.STORE=new Map,t.modalId=0,t.EVENT_PROMPT="jenesius-vue-modal:____P____R____O____M____P____T",t}();function A(t){return M.STORE.get(t)}var V={store:{},add:function(t,e,n){var i,o;if(typeof n!="function")throw f.GuardDeclarationType(n);this.store[t]||(this.store[t]=(i={},i[e]=[],i)),this.store[t][e]||(this.store[t][e]=[]),(o=this.store[t][e])===null||o===void 0||o.push(n)},get:function(t,e){return t in this.store?e in this.store[t]?this.store[t][e]||[]:[]:[]},delete:function(t){t in this.store&&delete this.store[t]}};const m=V;function D(t){return t.reduce(function(e,n){return e.then(function(){return n()})},Promise.resolve())}function J(t,e,n){return function(){return new Promise(function(i,o){var r,u=function(c){c===void 0&&(c=!0),c===!1&&o(f.NextReject(e)),i()};Promise.resolve(t.call((r=A(e))===null||r===void 0?void 0:r.instance,n)).then(u).catch(function(c){return o(c)})})}}function j(t){return t=x(t),D(v(t.namespace).queue.map(function(e){return function(){return e.close()}}))}function P(t){var e=v(t),n=e.queue;if(n.length!==0)return n[n.length-1]}function K(t){t=x(t);var e=P(t.namespace);return e?e.close():Promise.resolve()}function Z(t,e,n){var i=O(n),o=v(i.namespace);if(i.namespace===p.DEFAULT_NAMESPACE&&!o.initialized&&!g.skipInitCheck)throw f.NotInitialized(i.namespace);if(typeof t=="string"){var r=B(t);if(!r)throw f.ModalNotExistsInStore(t);t=r}if(!t)throw f.ModalComponentNotProvided();var u=new M(t,e,i);return o.queue.push(s.markRaw(u)),u}function S(t,e,n){return e===void 0&&(e={}),n===void 0&&(n={}),Promise.resolve().then(function(){return Z(t,e,n)})}function q(t,e,n){return e===void 0&&(e={}),n===void 0&&(n={}),j({namespace:n.namespace}).then(function(){var i=v(n.namespace);if(i.queue.length)throw f.QueueNoEmpty()}).then(function(){return S(t,e,n)})}function ee(t){if(typeof t!="object")throw f.ConfigurationType(t);Object.assign(g,t)}function te(t){var e,n,i,o=s.getCurrentInstance(),r=String(((e=o==null?void 0:o.props)===null||e===void 0?void 0:e.modalId)||((n=o==null?void 0:o.props)===null||n===void 0?void 0:n["modal-id"])||((i=o==null?void 0:o.attrs)===null||i===void 0?void 0:i.modalId)),u=r.replace(/[^0-9]/g,"");m.add(Number(u),"close",t)}function ne(t,e,n){return e===void 0&&(e={}),n===void 0&&(n={}),_(this,void 0,void 0,function(){var i,o,r=this;return y(this,function(u){switch(u.label){case 0:return[4,S(t,e,n)];case 1:return i=u.sent(),o=!1,[2,new Promise(function(c){i.on(M.EVENT_PROMPT,function(d){return _(r,void 0,void 0,function(){return y(this,function(a){return o=!0,[2,i.close().then(function(){return c(d)}).catch(function(){return o=!1})]})})}),i.ondestroy=function(){o||c(null)}})]}})})}function B(t){return g.store[t]||void 0}const re=["onPointerdown"],I={__name:"WidgetModalContainerItem",props:{id:Number},setup(t){const e=s.ref(null),n=t,i=A(n.id);function o(){if(i.backgroundClose)return w(i.id,{background:!0}).catch(()=>{})}s.watch(()=>e.value,u=>{i.instance=u}),s.onMounted(()=>{i.draggable&&r(document.querySelector(typeof i.draggable=="string"?i.draggable:`[modalid=_modal_${n.id}]`))});function r(u){if(!u)return;const c=document.querySelector(`[modalid=_modal_${n.id}]`);u.addEventListener("pointerdown",d=>{var N;const a=(N=c.getAttribute("style"))==null?void 0:N.match(/transform: translate\((.*)px,\s*(.*)px\)/);let l=a==null?void 0:a[1],h=a==null?void 0:a[2];l=typeof l=="string"?Number.parseInt(l):0,h=typeof h=="string"?Number.parseInt(h):0;const{clientX:L,clientY:z}=d,G=L,Q=z;document.addEventListener("pointermove",k,{passive:!0}),document.addEventListener("pointerup",U,{once:!0});function k(E){const{clientX:Y,clientY:$}=E,X=l+Y-G,W=h+$-Q;c.style.transform=`translate(${X}px,${W}px)`}function U(E){document.removeEventListener("pointermove",k),E.preventDefault()}})}return(u,c)=>(s.openBlock(),s.createElementBlock("div",{class:"widget__modal-container__item modal-container",onPointerdown:s.withModifiers(o,["self","stop"])},[(s.openBlock(),s.createBlock(s.resolveDynamicComponent(s.unref(i).component),s.mergeProps(s.unref(i).props.value,{class:"modal-item widget__modal-wrap",modalId:`_modal_${t.id}`,ref_key:"modalRef",ref:e},s.toHandlers(s.unref(i).events)),null,16,["modalId"]))],40,re))}};function oe(t){t===void 0&&(t=p.DEFAULT_NAMESPACE);var e=p.instance.getByName(t);e.initialized=!0,t===p.DEFAULT_NAMESPACE&&document.addEventListener("keyup",function(n){if(g.escClose&&(n.key==="Escape"||n.code==="Escape")){var i=P(t);if(!i)return;w(i.id,{esc:!0}).catch(function(){})}})}const ie={props:{namespace:String},setup(t){return s.onMounted(()=>{oe(t.namespace)}),()=>{const e=v(t.namespace);return s.h(s.TransitionGroup,{name:g.animation,tag:"div"},{default:()=>e.queue.map(n=>s.h(I,{key:n.id,id:n.id}))})}},components:{WidgetContainerModalItem:I}};var b={router:null};function ae(t){var e=this;if(b.router)throw f.DuplicatedRouterIntegration();b.router=t;function n(i){for(var o=i.matched.length-1;o>=0;o--){var r=i.matched[o].components,u=Object.values(r).find(function(c){return c._isModal});if(u)return u}return null}t.beforeEach(function(i,o){return _(e,void 0,void 0,function(){var r,u,c;return y(this,function(d){switch(d.label){case 0:return d.trys.push([0,3,,4]),r=n(o),r&&!(!((c=(u=r.getModalObject())===null||u===void 0?void 0:u.closed)===null||c===void 0)&&c.value)?[4,r.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]}})})}),t.afterEach(function(i){return _(e,void 0,void 0,function(){var o;return y(this,function(r){switch(r.label){case 0:return o=n(i),o?[4,o.initialize()]:[3,2];case 1:r.sent(),r.label=2;case 2:return[2]}})})})}function F(t){var e=null,n=!1;function i(){return _(this,void 0,void 0,function(){return y(this,function(o){switch(o.label){case 0:if(!b.router)throw f.ModalRouterIntegrationNotInitialized();return n=!1,e=null,[4,q(t,s.computed(function(){var r;return(r=b.router)===null||r===void 0?void 0:r.currentRoute.value.params}),{isRoute:!0})];case 1:return e=o.sent(),e.onclose=function(){var r;n||(r=b.router)===null||r===void 0||r.back()},[2]}})})}return{getModalObject:function(){return e},_isModal:!0,close:function(o){return o===void 0&&(o=!1),_(this,void 0,void 0,function(){return y(this,function(r){switch(r.label){case 0:return n=o,e?[4,e.close()]:[3,2];case 1:return[2,r.sent()];case 2:return[2]}})})},initialize:i,setup:function(){return function(){return null}}}}F.init=ae;var ue=v().queue;function se(t){return v(t).queue}exports.Modal=M;exports.closeById=w;exports.closeModal=j;exports.config=ee;exports.container=ie;exports.getComponentFromStore=B;exports.getCurrentModal=P;exports.getQueueByNamespace=se;exports.modalQueue=ue;exports.onBeforeModalClose=te;exports.openModal=q;exports.popModal=K;exports.promptModal=ne;exports.pushModal=S;exports.useModalRouter=F; | ||
*/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; | ||
//# 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 T, watch as x, ref as O, computed as A, markRaw as K, getCurrentInstance as Z, onMounted as D, openBlock as N, createElementBlock as ee, withModifiers as te, createBlock as ne, resolveDynamicComponent as re, unref as M, mergeProps as oe, toHandlers as ie, h as S, TransitionGroup as ae } 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 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"; | ||
/*! | ||
* jenesius-vue-modal v1.11.2 | ||
* jenesius-vue-modal v1.11.3 | ||
* (c) 2024 Jenesius | ||
* @license MIT | ||
*/ | ||
var E = function(t, e) { | ||
return E = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(n, i) { | ||
n.__proto__ = i; | ||
} || function(n, i) { | ||
for (var o in i) | ||
Object.prototype.hasOwnProperty.call(i, o) && (n[o] = i[o]); | ||
}, E(t, e); | ||
var T = function(n, t) { | ||
return T = 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]); | ||
}, T(n, t); | ||
}; | ||
function ue(t, e) { | ||
if (typeof e != "function" && e !== null) | ||
throw new TypeError("Class extends value " + String(e) + " is not a constructor or null"); | ||
E(t, e); | ||
function n() { | ||
this.constructor = t; | ||
function fe(n, t) { | ||
if (typeof t != "function" && t !== null) | ||
throw new TypeError("Class extends value " + String(t) + " is not a constructor or null"); | ||
T(n, t); | ||
function e() { | ||
this.constructor = n; | ||
} | ||
t.prototype = e === null ? Object.create(e) : (n.prototype = e.prototype, new n()); | ||
n.prototype = t === null ? Object.create(t) : (e.prototype = t.prototype, new e()); | ||
} | ||
function p(t, e, n, i) { | ||
function o(r) { | ||
return r instanceof n ? r : new n(function(u) { | ||
u(r); | ||
function E(n, t, e, a) { | ||
function r(i) { | ||
return i instanceof e ? i : new e(function(c) { | ||
c(i); | ||
}); | ||
} | ||
return new (n || (n = Promise))(function(r, u) { | ||
function s(c) { | ||
return new (e || (e = Promise))(function(i, c) { | ||
function f(o) { | ||
try { | ||
a(i.next(c)); | ||
} catch (v) { | ||
u(v); | ||
s(a.next(o)); | ||
} catch (u) { | ||
c(u); | ||
} | ||
} | ||
function l(c) { | ||
function d(o) { | ||
try { | ||
a(i.throw(c)); | ||
} catch (v) { | ||
u(v); | ||
s(a.throw(o)); | ||
} catch (u) { | ||
c(u); | ||
} | ||
} | ||
function a(c) { | ||
c.done ? r(c.value) : o(c.value).then(s, l); | ||
function s(o) { | ||
o.done ? i(o.value) : r(o.value).then(f, d); | ||
} | ||
a((i = i.apply(t, e || [])).next()); | ||
s((a = a.apply(n, t || [])).next()); | ||
}); | ||
} | ||
function _(t, e) { | ||
var n = { label: 0, sent: function() { | ||
if (r[0] & 1) | ||
throw r[1]; | ||
return r[1]; | ||
}, trys: [], ops: [] }, i, o, r, u; | ||
return u = { next: s(0), throw: s(1), return: s(2) }, typeof Symbol == "function" && (u[Symbol.iterator] = function() { | ||
function k(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; | ||
}), u; | ||
function s(a) { | ||
return function(c) { | ||
return l([a, c]); | ||
}), c; | ||
function f(s) { | ||
return function(o) { | ||
return d([s, o]); | ||
}; | ||
} | ||
function l(a) { | ||
if (i) | ||
function d(s) { | ||
if (a) | ||
throw new TypeError("Generator is already executing."); | ||
for (; u && (u = 0, a[0] && (n = 0)), n; ) | ||
for (; c && (c = 0, s[0] && (e = 0)), e; ) | ||
try { | ||
if (i = 1, o && (r = a[0] & 2 ? o.return : a[0] ? o.throw || ((r = o.return) && r.call(o), 0) : o.next) && !(r = r.call(o, a[1])).done) | ||
return r; | ||
switch (o = 0, r && (a = [a[0] & 2, r.value]), a[0]) { | ||
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: | ||
r = a; | ||
i = s; | ||
break; | ||
case 4: | ||
return n.label++, { value: a[1], done: !1 }; | ||
return e.label++, { value: s[1], done: !1 }; | ||
case 5: | ||
n.label++, o = a[1], a = [0]; | ||
e.label++, r = s[1], s = [0]; | ||
continue; | ||
case 7: | ||
a = n.ops.pop(), n.trys.pop(); | ||
s = e.ops.pop(), e.trys.pop(); | ||
continue; | ||
default: | ||
if (r = n.trys, !(r = r.length > 0 && r[r.length - 1]) && (a[0] === 6 || a[0] === 2)) { | ||
n = 0; | ||
if (i = e.trys, !(i = i.length > 0 && i[i.length - 1]) && (s[0] === 6 || s[0] === 2)) { | ||
e = 0; | ||
continue; | ||
} | ||
if (a[0] === 3 && (!r || a[1] > r[0] && a[1] < r[3])) { | ||
n.label = a[1]; | ||
if (s[0] === 3 && (!i || s[1] > i[0] && s[1] < i[3])) { | ||
e.label = s[1]; | ||
break; | ||
} | ||
if (a[0] === 6 && n.label < r[1]) { | ||
n.label = r[1], r = a; | ||
if (s[0] === 6 && e.label < i[1]) { | ||
e.label = i[1], i = s; | ||
break; | ||
} | ||
if (r && n.label < r[2]) { | ||
n.label = r[2], n.ops.push(a); | ||
if (i && e.label < i[2]) { | ||
e.label = i[2], e.ops.push(s); | ||
break; | ||
} | ||
r[2] && n.ops.pop(), n.trys.pop(); | ||
i[2] && e.ops.pop(), e.trys.pop(); | ||
continue; | ||
} | ||
a = e.call(t, n); | ||
} catch (c) { | ||
a = [6, c], o = 0; | ||
s = t.call(n, e); | ||
} catch (o) { | ||
s = [6, o], r = 0; | ||
} finally { | ||
i = r = 0; | ||
a = i = 0; | ||
} | ||
if (a[0] & 5) | ||
throw a[1]; | ||
return { value: a[0] ? a[1] : void 0, done: !0 }; | ||
if (s[0] & 5) | ||
throw s[1]; | ||
return { value: s[0] ? s[1] : void 0, done: !0 }; | ||
} | ||
} | ||
var d = ( | ||
var v = ( | ||
/** @class */ | ||
function(t) { | ||
ue(e, t); | ||
function e(n, i) { | ||
i === void 0 && (i = null); | ||
var o = t.call(this) || this; | ||
return o.isModalError = !0, o.message = n, o.details = i, o; | ||
function(n) { | ||
fe(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 e.Undefined = function(n) { | ||
return new e("Modal with id: ".concat(n, " not founded. The modal window may have been closed earlier.")); | ||
}, e.UndefinedGuardName = function(n) { | ||
return new e("Guard's name ".concat(n, " is not declaration.")); | ||
}, e.NextReject = function(n) { | ||
return new e("Guard returned false. Modal navigation was stopped. Modal id ".concat(n)); | ||
}, e.GuardDeclarationType = function(n) { | ||
return new e("Guard's type should be a function. Provided:", n); | ||
}, e.ConfigurationType = function(n) { | ||
return new e("Configuration type must be an Object. Provided", n); | ||
}, e.ConfigurationUndefinedParam = function(n, i) { | ||
return new e("In configuration founded unknown parameter: ".concat(n, ". Available are ").concat(i.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(n) { | ||
return new e("Modal Container not found. Put container from jenesius-vue-modal in App's template. Namespace: ".concat(n, ". 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(n) { | ||
return new e("Event name must be a string. Provided: ".concat(n)); | ||
}, e.ModalNotFoundByID = function(n) { | ||
return new e("Modal with ID ".concat(n, " was not found.")); | ||
}, e.ModalNotExistsInStore = function(n) { | ||
return new e("Provided name(".concat(n, ") don't exist in the store. Has the given name been added to the store?")); | ||
}, e; | ||
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) | ||
), g = ( | ||
), M = ( | ||
/** @class */ | ||
function() { | ||
function t() { | ||
this.state = /* @__PURE__ */ new Map(), t.instance = this; | ||
function n() { | ||
this.state = /* @__PURE__ */ new Map(), n.instance = this; | ||
} | ||
return t.prototype.getByName = function(e) { | ||
return e === void 0 && (e = t.DEFAULT_NAMESPACE), this.state.has(e) || this.state.set(e, { | ||
queue: T([]), | ||
return n.prototype.getByName = function(t) { | ||
return t === void 0 && (t = n.DEFAULT_NAMESPACE), this.state.has(t) || this.state.set(t, { | ||
queue: G([]), | ||
initialized: !1 | ||
}), this.state.get(e); | ||
}, t.prototype.forceClean = function() { | ||
this.state.forEach(function(e) { | ||
e.queue.splice(0, e.queue.length); | ||
}), this.state.get(t); | ||
}, n.prototype.forceClean = function() { | ||
this.state.forEach(function(t) { | ||
t.queue.splice(0, t.queue.length); | ||
}); | ||
}, t.DEFAULT_NAMESPACE = "default", t; | ||
}, n.DEFAULT_NAMESPACE = "default", n; | ||
}() | ||
), j = function() { | ||
var t = new g(), e = { | ||
), J = function() { | ||
var n = new M(), t = { | ||
scrollLock: !0, | ||
@@ -184,133 +184,133 @@ animation: "modal-list", | ||
draggable: !1 | ||
}, n = t.getByName().queue; | ||
return x(function() { | ||
return n; | ||
}, e = n.getByName().queue; | ||
return Q(function() { | ||
return e; | ||
}, function() { | ||
e.scrollLock && (n.length ? document.body.style.overflowY = "hidden" : document.body.style.overflowY = "auto"); | ||
t.scrollLock && (e.length ? document.body.style.overflowY = "hidden" : document.body.style.overflowY = "auto"); | ||
}, { deep: !0 }), { | ||
namespaceStore: t, | ||
configuration: e | ||
namespaceStore: n, | ||
configuration: t | ||
}; | ||
}(); | ||
function f(t) { | ||
return j.namespaceStore.getByName(t); | ||
function p(n) { | ||
return J.namespaceStore.getByName(n); | ||
} | ||
var m = j.configuration; | ||
function q(t) { | ||
var e = { | ||
backgroundClose: m.backgroundClose, | ||
var w = J.configuration; | ||
function H(n) { | ||
var t = { | ||
backgroundClose: w.backgroundClose, | ||
isRoute: !1, | ||
namespace: g.DEFAULT_NAMESPACE, | ||
draggable: m.draggable | ||
namespace: M.DEFAULT_NAMESPACE, | ||
draggable: w.draggable | ||
}; | ||
return t.backgroundClose !== void 0 && (e.backgroundClose = t.backgroundClose), t.isRoute && (e.isRoute = t.isRoute), t.namespace && (e.namespace = t.namespace), t.draggable !== void 0 && (e.draggable = t.draggable), e; | ||
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 R(t) { | ||
t === void 0 && (t = {}); | ||
var e = { | ||
function z(n) { | ||
n === void 0 && (n = {}); | ||
var t = { | ||
background: !1, | ||
esc: !1 | ||
}; | ||
return Object.assign(e, t); | ||
return Object.assign(t, n); | ||
} | ||
function B(t) { | ||
return t || (t = {}), t; | ||
function Z(n) { | ||
return n || (n = {}), n; | ||
} | ||
function C(t, e) { | ||
e === void 0 && (e = {}); | ||
var n = b.STORE.get(t); | ||
if (!n) | ||
return Promise.reject(d.ModalNotFoundByID(t)); | ||
var i = f(n.namespace), o = i.queue.findIndex(function(u) { | ||
return u.id === t; | ||
function D(n, t) { | ||
t === void 0 && (t = {}); | ||
var e = O.STORE.get(n); | ||
if (!e) | ||
return Promise.reject(v.ModalNotFoundByID(n)); | ||
var a = p(e.namespace), r = a.queue.findIndex(function(c) { | ||
return c.id === n; | ||
}); | ||
if (o === -1) | ||
return Promise.reject(d.Undefined(t)); | ||
var r = h.get(t, "close").map(function(u) { | ||
return ce(u, t, R(e)); | ||
if (r === -1) | ||
return Promise.reject(v.Undefined(n)); | ||
var i = b.get(n, "close").map(function(c) { | ||
return me(c, n, z(t)); | ||
}); | ||
return z(r).then(function() { | ||
i.queue.splice(o, 1); | ||
return K(i).then(function() { | ||
a.queue.splice(r, 1); | ||
}).then(function() { | ||
h.get(t, "destroy").forEach(function(u) { | ||
return u(R(e)); | ||
b.get(n, "destroy").forEach(function(c) { | ||
return c(z(t)); | ||
}); | ||
}).then(function() { | ||
h.delete(t); | ||
b.delete(n); | ||
}); | ||
} | ||
var b = ( | ||
var O = ( | ||
/** @class */ | ||
function() { | ||
function t(e, n, i) { | ||
var o = this; | ||
this.events = T({}), this.backgroundClose = !0, this.isRoute = !1, this.id = t.modalId++, this.component = e, this.props = O(n), this.closed = A(function() { | ||
return !f(i.namespace).queue.includes(o); | ||
}), e.beforeModalClose && h.add(this.id, "close", e.beforeModalClose); | ||
var r = q(i); | ||
this.backgroundClose = r.backgroundClose, this.isRoute = r.isRoute, this.namespace = r.namespace, this.draggable = r.draggable, t.STORE.set(this.id, this); | ||
function n(t, e, a) { | ||
var r = this; | ||
this.events = G({}), this.backgroundClose = !0, this.isRoute = !1, this.id = n.modalId++, this.component = t, this.props = Y(e), this.closed = W(function() { | ||
return !p(a.namespace).queue.includes(r); | ||
}), t.beforeModalClose && b.add(this.id, "close", t.beforeModalClose); | ||
var i = H(a); | ||
this.backgroundClose = i.backgroundClose, this.isRoute = i.isRoute, this.namespace = i.namespace, this.draggable = i.draggable, n.STORE.set(this.id, this); | ||
} | ||
return t.prototype.close = function() { | ||
return C(this.id); | ||
}, Object.defineProperty(t.prototype, "onclose", { | ||
return n.prototype.close = function() { | ||
return D(this.id); | ||
}, Object.defineProperty(n.prototype, "onclose", { | ||
/** | ||
* @description Hook for handling modal closing | ||
* */ | ||
set: function(e) { | ||
h.add(this.id, "close", e); | ||
set: function(t) { | ||
b.add(this.id, "close", t); | ||
}, | ||
enumerable: !1, | ||
configurable: !0 | ||
}), Object.defineProperty(t.prototype, "ondestroy", { | ||
}), Object.defineProperty(n.prototype, "ondestroy", { | ||
/** | ||
* @description Hook for handling modal closing | ||
* */ | ||
set: function(e) { | ||
h.add(this.id, "destroy", e); | ||
set: function(t) { | ||
b.add(this.id, "destroy", t); | ||
}, | ||
enumerable: !1, | ||
configurable: !0 | ||
}), t.prototype.on = function(e, n) { | ||
var i = this; | ||
return Array.isArray(this.events[e]) || (this.events[e] = []), this.events[e].push(n), function() { | ||
var o = i.events[e].indexOf(n); | ||
o !== -1 && i.events[e].splice(o, 1); | ||
}), 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); | ||
}; | ||
}, t.STORE = /* @__PURE__ */ new Map(), t.modalId = 0, t.EVENT_PROMPT = "jenesius-vue-modal:____P____R____O____M____P____T", t; | ||
}, n.STORE = /* @__PURE__ */ new Map(), n.modalId = 0, n.EVENT_PROMPT = "jenesius-vue-modal:____P____R____O____M____P____T", n; | ||
}() | ||
); | ||
function L(t) { | ||
return b.STORE.get(t); | ||
function V(n) { | ||
return O.STORE.get(n); | ||
} | ||
var se = { | ||
var he = { | ||
store: {}, | ||
add: function(t, e, n) { | ||
var i, o; | ||
if (typeof n != "function") | ||
throw d.GuardDeclarationType(n); | ||
this.store[t] || (this.store[t] = (i = {}, i[e] = [], i)), this.store[t][e] || (this.store[t][e] = []), (o = this.store[t][e]) === null || o === void 0 || o.push(n); | ||
add: function(n, t, e) { | ||
var a, r; | ||
if (typeof e != "function") | ||
throw v.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(t, e) { | ||
return t in this.store ? e in this.store[t] ? this.store[t][e] || [] : [] : []; | ||
get: function(n, t) { | ||
return n in this.store ? t in this.store[n] ? this.store[n][t] || [] : [] : []; | ||
}, | ||
delete: function(t) { | ||
t in this.store && delete this.store[t]; | ||
delete: function(n) { | ||
n in this.store && delete this.store[n]; | ||
} | ||
}; | ||
const h = se; | ||
function z(t) { | ||
return t.reduce(function(e, n) { | ||
return e.then(function() { | ||
return n(); | ||
const b = he; | ||
function K(n) { | ||
return n.reduce(function(t, e) { | ||
return t.then(function() { | ||
return e(); | ||
}); | ||
}, Promise.resolve()); | ||
} | ||
function ce(t, e, n) { | ||
function me(n, t, e) { | ||
return function() { | ||
return new Promise(function(i, o) { | ||
var r, u = function(s) { | ||
s === void 0 && (s = !0), s === !1 && o(d.NextReject(e)), i(); | ||
return new Promise(function(a, r) { | ||
var i, c = function(f) { | ||
f === void 0 && (f = !0), f === !1 && r(v.NextReject(t)), a(); | ||
}; | ||
Promise.resolve(t.call((r = L(e)) === null || r === void 0 ? void 0 : r.instance, n)).then(u).catch(function(s) { | ||
return o(s); | ||
Promise.resolve(n.call((i = V(t)) === null || i === void 0 ? void 0 : i.instance, e)).then(c).catch(function(f) { | ||
return r(f); | ||
}); | ||
@@ -320,80 +320,80 @@ }); | ||
} | ||
function le(t) { | ||
return t = B(t), z(f(t.namespace).queue.map(function(e) { | ||
function ve(n) { | ||
return n = Z(n), K(p(n.namespace).queue.map(function(t) { | ||
return function() { | ||
return e.close(); | ||
return t.close(); | ||
}; | ||
})); | ||
} | ||
function F(t) { | ||
var e = f(t), n = e.queue; | ||
if (n.length !== 0) | ||
return n[n.length - 1]; | ||
function ee(n) { | ||
var t = p(n), e = t.queue; | ||
if (e.length !== 0) | ||
return e[e.length - 1]; | ||
} | ||
function ye(t) { | ||
t = B(t); | ||
var e = F(t.namespace); | ||
return e ? e.close() : Promise.resolve(); | ||
function Ie(n) { | ||
n = Z(n); | ||
var t = ee(n.namespace); | ||
return t ? t.close() : Promise.resolve(); | ||
} | ||
function de(t, e, n) { | ||
var i = q(n), o = f(i.namespace); | ||
if (i.namespace === g.DEFAULT_NAMESPACE && !o.initialized && !m.skipInitCheck) | ||
throw d.NotInitialized(i.namespace); | ||
if (typeof t == "string") { | ||
var r = ve(t); | ||
if (!r) | ||
throw d.ModalNotExistsInStore(t); | ||
t = r; | ||
function ge(n, t, e) { | ||
var a = H(e), r = p(a.namespace); | ||
if (a.namespace === M.DEFAULT_NAMESPACE && !r.initialized && !w.skipInitCheck) | ||
throw v.NotInitialized(a.namespace); | ||
if (typeof n == "string") { | ||
var i = pe(n); | ||
if (!i) | ||
throw v.ModalNotExistsInStore(n); | ||
n = i; | ||
} | ||
if (!t) | ||
throw d.ModalComponentNotProvided(); | ||
var u = new b(t, e, i); | ||
return o.queue.push(K(u)), u; | ||
if (!n) | ||
throw v.ModalComponentNotProvided(); | ||
var c = new O(n, t, a); | ||
return r.queue.push(re(c)), c; | ||
} | ||
function G(t, e, n) { | ||
return e === void 0 && (e = {}), n === void 0 && (n = {}), Promise.resolve().then(function() { | ||
return de(t, e, n); | ||
function te(n, t, e) { | ||
return t === void 0 && (t = {}), e === void 0 && (e = {}), Promise.resolve().then(function() { | ||
return ge(n, t, e); | ||
}); | ||
} | ||
function fe(t, e, n) { | ||
return e === void 0 && (e = {}), n === void 0 && (n = {}), le({ | ||
namespace: n.namespace | ||
function Ce(n, t, e) { | ||
return t === void 0 && (t = {}), e === void 0 && (e = {}), ve({ | ||
namespace: e.namespace | ||
}).then(function() { | ||
var i = f(n.namespace); | ||
if (i.queue.length) | ||
throw d.QueueNoEmpty(); | ||
var a = p(e.namespace); | ||
if (a.queue.length) | ||
throw v.QueueNoEmpty(); | ||
}).then(function() { | ||
return G(t, e, n); | ||
return te(n, t, e); | ||
}); | ||
} | ||
function be(t) { | ||
if (typeof t != "object") | ||
throw d.ConfigurationType(t); | ||
Object.assign(m, t); | ||
function Oe(n) { | ||
if (typeof n != "object") | ||
throw v.ConfigurationType(n); | ||
Object.assign(w, n); | ||
} | ||
function we(t) { | ||
var e, n, i, o = Z(), r = String(((e = o == null ? void 0 : o.props) === null || e === void 0 ? void 0 : e.modalId) || ((n = o == null ? void 0 : o.props) === null || n === void 0 ? void 0 : n["modal-id"]) || ((i = o == null ? void 0 : o.attrs) === null || i === void 0 ? void 0 : i.modalId)), u = r.replace(/[^0-9]/g, ""); | ||
h.add(Number(u), "close", t); | ||
function Re(n) { | ||
var t, e, a, r = oe(), 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, ""); | ||
b.add(Number(c), "close", n); | ||
} | ||
function Me(t, e, n) { | ||
return e === void 0 && (e = {}), n === void 0 && (n = {}), p(this, void 0, void 0, function() { | ||
var i, o, r = this; | ||
return _(this, function(u) { | ||
switch (u.label) { | ||
function xe(n, t, e) { | ||
return t === void 0 && (t = {}), e === void 0 && (e = {}), E(this, void 0, void 0, function() { | ||
var a, r, i = this; | ||
return k(this, function(c) { | ||
switch (c.label) { | ||
case 0: | ||
return [4, G(t, e, n)]; | ||
return [4, te(n, t, e)]; | ||
case 1: | ||
return i = u.sent(), o = !1, [2, new Promise(function(s) { | ||
i.on(b.EVENT_PROMPT, function(l) { | ||
return p(r, void 0, void 0, function() { | ||
return _(this, function(a) { | ||
return o = !0, [2, i.close().then(function() { | ||
return s(l); | ||
return a = c.sent(), r = !1, [2, new Promise(function(f) { | ||
a.on(O.EVENT_PROMPT, function(d) { | ||
return E(i, void 0, void 0, function() { | ||
return k(this, function(s) { | ||
return r = !0, [2, a.close().then(function() { | ||
return f(d); | ||
}).catch(function() { | ||
return o = !1; | ||
return r = !1; | ||
})]; | ||
}); | ||
}); | ||
}), i.ondestroy = function() { | ||
o || s(null); | ||
}), a.ondestroy = function() { | ||
r || f(null); | ||
}; | ||
@@ -405,6 +405,312 @@ })]; | ||
} | ||
function ve(t) { | ||
return m.store[t] || void 0; | ||
function pe(n) { | ||
return w.store[n] || void 0; | ||
} | ||
const he = ["onPointerdown"], I = { | ||
function ye(n) { | ||
return n && n.__esModule && Object.prototype.hasOwnProperty.call(n, "default") ? n.default : n; | ||
} | ||
var j = { exports: {} }, x, B; | ||
function be() { | ||
if (B) | ||
return x; | ||
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) { | ||
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]), g = (u[2] || "ms").toLowerCase(); | ||
switch (g) { | ||
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, g) { | ||
var _ = u >= l * 1.5; | ||
return Math.round(o / l) + " " + g + (_ ? "s" : ""); | ||
} | ||
return x; | ||
} | ||
function we(n) { | ||
e.debug = e, e.default = e, e.coerce = d, e.disable = i, e.enable = r, e.enabled = c, e.humanize = be(), 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, g, _; | ||
function m(...h) { | ||
if (!m.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"); | ||
let y = 0; | ||
h[0] = h[0].replace(/%([a-zA-Z%])/g, (P, I) => { | ||
if (P === "%%") | ||
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--; | ||
} | ||
return P; | ||
}), e.formatArgs.call(C, h), (C.log || e.log).apply(C, h); | ||
} | ||
return m.namespace = o, m.useColors = e.useColors(), m.color = e.selectColor(o), m.extend = a, m.destroy = e.destroy, Object.defineProperty(m, "enabled", { | ||
enumerable: !0, | ||
configurable: !1, | ||
get: () => l !== null ? l : (g !== e.namespaces && (g = e.namespaces, _ = e.enabled(o)), _), | ||
set: (h) => { | ||
l = h; | ||
} | ||
}), typeof e.init == "function" && e.init(m), m; | ||
} | ||
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,]+/), g = l.length; | ||
for (u = 0; u < g; 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 _e = we; | ||
(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 || // Is firebug? http://stackoverflow.com/a/398120/376773 | ||
typeof window < "u" && window.console && (window.console.firebug || window.console.exception && window.console.table) || // Is firefox >= v31? | ||
// https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages | ||
typeof navigator < "u" && navigator.userAgent && navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$1, 10) >= 31 || // Double check webkit in userAgent just in case we are in a worker | ||
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 = _e(t); | ||
const { formatters: f } = n.exports; | ||
f.j = function(d) { | ||
try { | ||
return JSON.stringify(d); | ||
} catch (s) { | ||
return "[UnexpectedJSONParseError]: " + s.message; | ||
} | ||
}; | ||
})(j, j.exports); | ||
var Fe = j.exports; | ||
const Me = /* @__PURE__ */ ye(Fe); | ||
function Ee(n) { | ||
return Me("jenesius-vue-modal:".concat(n)); | ||
} | ||
const ke = ["onPointerdown"], U = { | ||
__name: "WidgetModalContainerItem", | ||
@@ -414,60 +720,62 @@ props: { | ||
}, | ||
setup(t) { | ||
const e = O(null), n = t, i = L(n.id); | ||
function o() { | ||
if (i.backgroundClose) | ||
return C(i.id, { background: !0 }).catch(() => { | ||
setup(n) { | ||
const t = Y(null), e = Ee("modal-item"), a = n, r = V(a.id); | ||
function i() { | ||
if (r.backgroundClose) | ||
return D(r.id, { background: !0 }).catch(() => { | ||
}); | ||
} | ||
x(() => e.value, (u) => { | ||
i.instance = u; | ||
}), D(() => { | ||
i.draggable && r( | ||
Q(() => t.value, (f) => { | ||
r.instance = f; | ||
}), X(() => { | ||
r.draggable && (e("The modal window is movable."), c( | ||
document.querySelector( | ||
typeof i.draggable == "string" ? i.draggable : `[modalid=_modal_${n.id}]` | ||
typeof r.draggable == "string" ? r.draggable : `[modalid=_modal_${a.id}]` | ||
) | ||
); | ||
)); | ||
}); | ||
function r(u) { | ||
if (!u) | ||
function c(f) { | ||
if (!f) { | ||
e("draggable item not found."); | ||
return; | ||
const s = document.querySelector(`[modalid=_modal_${n.id}]`); | ||
u.addEventListener("pointerdown", (l) => { | ||
var k; | ||
const a = (k = s.getAttribute("style")) == null ? void 0 : k.match(/transform: translate\((.*)px,\s*(.*)px\)/); | ||
let c = a == null ? void 0 : a[1], v = a == null ? void 0 : a[2]; | ||
c = typeof c == "string" ? Number.parseInt(c) : 0, v = typeof v == "string" ? Number.parseInt(v) : 0; | ||
const { clientX: U, clientY: Q } = l, Y = U, $ = Q; | ||
document.addEventListener("pointermove", P, { passive: !0 }), document.addEventListener("pointerup", X, { once: !0 }); | ||
function P(w) { | ||
const { clientX: W, clientY: H } = w, V = c + W - Y, J = v + H - $; | ||
s.style.transform = `translate(${V}px,${J}px)`; | ||
} | ||
const d = document.querySelector(`[modalid=_modal_${a.id}]`); | ||
f.addEventListener("pointerdown", (s) => { | ||
var N; | ||
const o = (N = d.getAttribute("style")) == null ? void 0 : N.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: g, clientY: _ } = s, m = g, h = _; | ||
e(`movement started at (${h}, ${h})`), 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)`; | ||
} | ||
function X(w) { | ||
document.removeEventListener("pointermove", P), w.preventDefault(); | ||
function F(y) { | ||
e("movement completed"), document.removeEventListener("pointermove", C), y.preventDefault(); | ||
} | ||
}); | ||
} | ||
return (u, s) => (N(), ee("div", { | ||
return (f, d) => (L(), ie("div", { | ||
class: "widget__modal-container__item modal-container", | ||
onPointerdown: te(o, ["self", "stop"]) | ||
onPointerdown: ae(i, ["self", "stop"]) | ||
}, [ | ||
(N(), ne(re(M(i).component), oe(M(i).props.value, { | ||
(L(), ue(se(R(r).component), ce(R(r).props.value, { | ||
class: "modal-item widget__modal-wrap", | ||
modalId: `_modal_${t.id}`, | ||
modalId: `_modal_${n.id}`, | ||
ref_key: "modalRef", | ||
ref: e | ||
}, ie(M(i).events)), null, 16, ["modalId"])) | ||
], 40, he)); | ||
ref: t | ||
}, le(R(r).events)), null, 16, ["modalId"])) | ||
], 40, ke)); | ||
} | ||
}; | ||
function me(t) { | ||
t === void 0 && (t = g.DEFAULT_NAMESPACE); | ||
var e = g.instance.getByName(t); | ||
e.initialized = !0, t === g.DEFAULT_NAMESPACE && document.addEventListener("keyup", function(n) { | ||
if (m.escClose && (n.key === "Escape" || n.code === "Escape")) { | ||
var i = F(t); | ||
if (!i) | ||
function Pe(n) { | ||
n === void 0 && (n = M.DEFAULT_NAMESPACE); | ||
var t = M.instance.getByName(n); | ||
t.initialized = !0, n === M.DEFAULT_NAMESPACE && document.addEventListener("keyup", function(e) { | ||
if (w.escClose && (e.key === "Escape" || e.code === "Escape")) { | ||
var a = ee(n); | ||
if (!a) | ||
return; | ||
C(i.id, { esc: !0 }).catch(function() { | ||
D(a.id, { esc: !0 }).catch(function() { | ||
}); | ||
@@ -477,15 +785,15 @@ } | ||
} | ||
const Ee = { | ||
const Te = { | ||
props: { | ||
namespace: String | ||
}, | ||
setup(t) { | ||
return D(() => { | ||
me(t.namespace); | ||
setup(n) { | ||
return X(() => { | ||
Pe(n.namespace); | ||
}), () => { | ||
const e = f(t.namespace); | ||
return S(ae, { name: m.animation, tag: "div" }, { | ||
default: () => e.queue.map((n) => S(I, { | ||
key: n.id, | ||
id: n.id | ||
const t = p(n.namespace); | ||
return $(de, { name: w.animation, tag: "div" }, { | ||
default: () => t.queue.map((e) => $(U, { | ||
key: e.id, | ||
id: e.id | ||
})) | ||
@@ -495,35 +803,35 @@ }); | ||
}, | ||
components: { WidgetContainerModalItem: I } | ||
components: { WidgetContainerModalItem: U } | ||
}; | ||
var y = { | ||
var A = { | ||
router: null | ||
}; | ||
function ge(t) { | ||
var e = this; | ||
if (y.router) | ||
throw d.DuplicatedRouterIntegration(); | ||
y.router = t; | ||
function n(i) { | ||
for (var o = i.matched.length - 1; o >= 0; o--) { | ||
var r = i.matched[o].components, u = Object.values(r).find(function(s) { | ||
return s._isModal; | ||
function Se(n) { | ||
var t = this; | ||
if (A.router) | ||
throw v.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 (u) | ||
return u; | ||
if (c) | ||
return c; | ||
} | ||
return null; | ||
} | ||
t.beforeEach(function(i, o) { | ||
return p(e, void 0, void 0, function() { | ||
var r, u, s; | ||
return _(this, function(l) { | ||
switch (l.label) { | ||
n.beforeEach(function(a, r) { | ||
return E(t, void 0, void 0, function() { | ||
var i, c, f; | ||
return k(this, function(d) { | ||
switch (d.label) { | ||
case 0: | ||
return l.trys.push([0, 3, , 4]), r = n(o), r && !(!((s = (u = r.getModalObject()) === null || u === void 0 ? void 0 : u.closed) === null || s === void 0) && s.value) ? [4, r.close(!0)] : [3, 2]; | ||
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: | ||
l.sent(), l.label = 2; | ||
d.sent(), d.label = 2; | ||
case 2: | ||
return [3, 4]; | ||
case 3: | ||
return l.sent(), [2, !1]; | ||
return d.sent(), [2, !1]; | ||
case 4: | ||
@@ -537,11 +845,11 @@ return [ | ||
}); | ||
}), t.afterEach(function(i) { | ||
return p(e, void 0, void 0, function() { | ||
var o; | ||
return _(this, function(r) { | ||
switch (r.label) { | ||
}), n.afterEach(function(a) { | ||
return E(t, void 0, void 0, function() { | ||
var r; | ||
return k(this, function(i) { | ||
switch (i.label) { | ||
case 0: | ||
return o = n(i), o ? [4, o.initialize()] : [3, 2]; | ||
return r = e(a), r ? [4, r.initialize()] : [3, 2]; | ||
case 1: | ||
r.sent(), r.label = 2; | ||
i.sent(), i.label = 2; | ||
case 2: | ||
@@ -557,19 +865,19 @@ return [ | ||
} | ||
function pe(t) { | ||
var e = null, n = !1; | ||
function i() { | ||
return p(this, void 0, void 0, function() { | ||
return _(this, function(o) { | ||
switch (o.label) { | ||
function Ae(n) { | ||
var t = null, e = !1; | ||
function a() { | ||
return E(this, void 0, void 0, function() { | ||
return k(this, function(r) { | ||
switch (r.label) { | ||
case 0: | ||
if (!y.router) | ||
throw d.ModalRouterIntegrationNotInitialized(); | ||
return n = !1, e = null, [4, fe(t, A(function() { | ||
var r; | ||
return (r = y.router) === null || r === void 0 ? void 0 : r.currentRoute.value.params; | ||
if (!A.router) | ||
throw v.ModalRouterIntegrationNotInitialized(); | ||
return e = !1, t = null, [4, Ce(n, W(function() { | ||
var i; | ||
return (i = A.router) === null || i === void 0 ? void 0 : i.currentRoute.value.params; | ||
}), { isRoute: !0 })]; | ||
case 1: | ||
return e = o.sent(), e.onclose = function() { | ||
var r; | ||
n || (r = y.router) === null || r === void 0 || r.back(); | ||
return t = r.sent(), t.onclose = function() { | ||
var i; | ||
e || (i = A.router) === null || i === void 0 || i.back(); | ||
}, [ | ||
@@ -585,3 +893,3 @@ 2 | ||
getModalObject: function() { | ||
return e; | ||
return t; | ||
}, | ||
@@ -593,10 +901,10 @@ /** | ||
_isModal: !0, | ||
close: function(o) { | ||
return o === void 0 && (o = !1), p(this, void 0, void 0, function() { | ||
return _(this, function(r) { | ||
switch (r.label) { | ||
close: function(r) { | ||
return r === void 0 && (r = !1), E(this, void 0, void 0, function() { | ||
return k(this, function(i) { | ||
switch (i.label) { | ||
case 0: | ||
return n = o, e ? [4, e.close()] : [3, 2]; | ||
return e = r, t ? [4, t.close()] : [3, 2]; | ||
case 1: | ||
return [2, r.sent()]; | ||
return [2, i.sent()]; | ||
case 2: | ||
@@ -611,3 +919,3 @@ return [ | ||
}, | ||
initialize: i, | ||
initialize: a, | ||
/** | ||
@@ -627,24 +935,24 @@ * Мнимая обёртка. Для того, чтобы рендеринг запускался. | ||
} | ||
pe.init = ge; | ||
var Ce = f().queue; | ||
function Pe(t) { | ||
return f(t).queue; | ||
Ae.init = Se; | ||
var je = p().queue; | ||
function De(n) { | ||
return p(n).queue; | ||
} | ||
export { | ||
b as Modal, | ||
C as closeById, | ||
le as closeModal, | ||
be as config, | ||
Ee as container, | ||
ve as getComponentFromStore, | ||
F as getCurrentModal, | ||
Pe as getQueueByNamespace, | ||
Ce as modalQueue, | ||
we as onBeforeModalClose, | ||
fe as openModal, | ||
ye as popModal, | ||
Me as promptModal, | ||
G as pushModal, | ||
pe as useModalRouter | ||
O as Modal, | ||
D as closeById, | ||
ve as closeModal, | ||
Oe as config, | ||
Te as container, | ||
pe as getComponentFromStore, | ||
ee as getCurrentModal, | ||
De as getQueueByNamespace, | ||
je as modalQueue, | ||
Re as onBeforeModalClose, | ||
Ce as openModal, | ||
Ie as popModal, | ||
xe as promptModal, | ||
te as pushModal, | ||
Ae as useModalRouter | ||
}; | ||
//# sourceMappingURL=jenesius-vue-modal.es.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)}})(); | ||
(function(l,s){typeof exports=="object"&&typeof module<"u"?s(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],s):(l=typeof globalThis<"u"?globalThis:l||self,s(l.JenesiusVueModal={},l.Vue))})(this,function(l,s){"use strict";/*! | ||
* jenesius-vue-modal v1.11.2 | ||
(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 | ||
* (c) 2024 Jenesius | ||
* @license MIT | ||
*/var C=function(t,e){return C=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,r){n.__proto__=r}||function(n,r){for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(n[i]=r[i])},C(t,e)};function z(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");C(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}function _(t,e,n,r){function i(o){return o instanceof n?o:new n(function(u){u(o)})}return new(n||(n=Promise))(function(o,u){function c(d){try{a(r.next(d))}catch(v){u(v)}}function f(d){try{a(r.throw(d))}catch(v){u(v)}}function a(d){d.done?o(d.value):i(d.value).then(c,f)}a((r=r.apply(t,e||[])).next())})}function y(t,e){var n={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},r,i,o,u;return u={next:c(0),throw:c(1),return:c(2)},typeof Symbol=="function"&&(u[Symbol.iterator]=function(){return this}),u;function c(a){return function(d){return f([a,d])}}function f(a){if(r)throw new TypeError("Generator is already executing.");for(;u&&(u=0,a[0]&&(n=0)),n;)try{if(r=1,i&&(o=a[0]&2?i.return:a[0]?i.throw||((o=i.return)&&o.call(i),0):i.next)&&!(o=o.call(i,a[1])).done)return o;switch(i=0,o&&(a=[a[0]&2,o.value]),a[0]){case 0:case 1:o=a;break;case 4:return n.label++,{value:a[1],done:!1};case 5:n.label++,i=a[1],a=[0];continue;case 7:a=n.ops.pop(),n.trys.pop();continue;default:if(o=n.trys,!(o=o.length>0&&o[o.length-1])&&(a[0]===6||a[0]===2)){n=0;continue}if(a[0]===3&&(!o||a[1]>o[0]&&a[1]<o[3])){n.label=a[1];break}if(a[0]===6&&n.label<o[1]){n.label=o[1],o=a;break}if(o&&n.label<o[2]){n.label=o[2],n.ops.push(a);break}o[2]&&n.ops.pop(),n.trys.pop();continue}a=e.call(t,n)}catch(d){a=[6,d],i=0}finally{r=o=0}if(a[0]&5)throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}}typeof SuppressedError=="function"&&SuppressedError;var h=function(t){z(e,t);function e(n,r){r===void 0&&(r=null);var i=t.call(this)||this;return i.isModalError=!0,i.message=n,i.details=r,i}return e.Undefined=function(n){return new e("Modal with id: ".concat(n," not founded. The modal window may have been closed earlier."))},e.UndefinedGuardName=function(n){return new e("Guard's name ".concat(n," is not declaration."))},e.NextReject=function(n){return new e("Guard returned false. Modal navigation was stopped. Modal id ".concat(n))},e.GuardDeclarationType=function(n){return new e("Guard's type should be a function. Provided:",n)},e.ConfigurationType=function(n){return new e("Configuration type must be an Object. Provided",n)},e.ConfigurationUndefinedParam=function(n,r){return new e("In configuration founded unknown parameter: ".concat(n,". 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(n){return new e("Modal Container not found. Put container from jenesius-vue-modal in App's template. Namespace: ".concat(n,". 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(n){return new e("Event name must be a string. Provided: ".concat(n))},e.ModalNotFoundByID=function(n){return new e("Modal with ID ".concat(n," was not found."))},e.ModalNotExistsInStore=function(n){return new e("Provided name(".concat(n,") don't exist in the store. Has the given name been added to the store?"))},e}(Error),b=function(){function t(){this.state=new Map,t.instance=this}return t.prototype.getByName=function(e){return e===void 0&&(e=t.DEFAULT_NAMESPACE),this.state.has(e)||this.state.set(e,{queue:s.reactive([]),initialized:!1}),this.state.get(e)},t.prototype.forceClean=function(){this.state.forEach(function(e){e.queue.splice(0,e.queue.length)})},t.DEFAULT_NAMESPACE="default",t}(),N=function(){var t=new b,e={scrollLock:!0,animation:"modal-list",backgroundClose:!0,escClose:!0,store:{},skipInitCheck:!1,draggable:!1},n=t.getByName().queue;return s.watch(function(){return n},function(){e.scrollLock&&(n.length?document.body.style.overflowY="hidden":document.body.style.overflowY="auto")},{deep:!0}),{namespaceStore:t,configuration:e}}();function m(t){return N.namespaceStore.getByName(t)}var g=N.configuration;function T(t){var e={backgroundClose:g.backgroundClose,isRoute:!1,namespace:b.DEFAULT_NAMESPACE,draggable:g.draggable};return t.backgroundClose!==void 0&&(e.backgroundClose=t.backgroundClose),t.isRoute&&(e.isRoute=t.isRoute),t.namespace&&(e.namespace=t.namespace),t.draggable!==void 0&&(e.draggable=t.draggable),e}function R(t){t===void 0&&(t={});var e={background:!1,esc:!1};return Object.assign(e,t)}function I(t){return t||(t={}),t}function E(t,e){e===void 0&&(e={});var n=M.STORE.get(t);if(!n)return Promise.reject(h.ModalNotFoundByID(t));var r=m(n.namespace),i=r.queue.findIndex(function(u){return u.id===t});if(i===-1)return Promise.reject(h.Undefined(t));var o=p.get(t,"close").map(function(u){return Q(u,t,R(e))});return A(o).then(function(){r.queue.splice(i,1)}).then(function(){p.get(t,"destroy").forEach(function(u){return u(R(e))})}).then(function(){p.delete(t)})}var M=function(){function t(e,n,r){var i=this;this.events=s.reactive({}),this.backgroundClose=!0,this.isRoute=!1,this.id=t.modalId++,this.component=e,this.props=s.ref(n),this.closed=s.computed(function(){return!m(r.namespace).queue.includes(i)}),e.beforeModalClose&&p.add(this.id,"close",e.beforeModalClose);var o=T(r);this.backgroundClose=o.backgroundClose,this.isRoute=o.isRoute,this.namespace=o.namespace,this.draggable=o.draggable,t.STORE.set(this.id,this)}return t.prototype.close=function(){return E(this.id)},Object.defineProperty(t.prototype,"onclose",{set:function(e){p.add(this.id,"close",e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"ondestroy",{set:function(e){p.add(this.id,"destroy",e)},enumerable:!1,configurable:!0}),t.prototype.on=function(e,n){var r=this;return Array.isArray(this.events[e])||(this.events[e]=[]),this.events[e].push(n),function(){var i=r.events[e].indexOf(n);i!==-1&&r.events[e].splice(i,1)}},t.STORE=new Map,t.modalId=0,t.EVENT_PROMPT="jenesius-vue-modal:____P____R____O____M____P____T",t}();function O(t){return M.STORE.get(t)}var G={store:{},add:function(t,e,n){var r,i;if(typeof n!="function")throw h.GuardDeclarationType(n);this.store[t]||(this.store[t]=(r={},r[e]=[],r)),this.store[t][e]||(this.store[t][e]=[]),(i=this.store[t][e])===null||i===void 0||i.push(n)},get:function(t,e){return t in this.store?e in this.store[t]?this.store[t][e]||[]:[]:[]},delete:function(t){t in this.store&&delete this.store[t]}};const p=G;function A(t){return t.reduce(function(e,n){return e.then(function(){return n()})},Promise.resolve())}function Q(t,e,n){return function(){return new Promise(function(r,i){var o,u=function(c){c===void 0&&(c=!0),c===!1&&i(h.NextReject(e)),r()};Promise.resolve(t.call((o=O(e))===null||o===void 0?void 0:o.instance,n)).then(u).catch(function(c){return i(c)})})}}function j(t){return t=I(t),A(m(t.namespace).queue.map(function(e){return function(){return e.close()}}))}function P(t){var e=m(t),n=e.queue;if(n.length!==0)return n[n.length-1]}function U(t){t=I(t);var e=P(t.namespace);return e?e.close():Promise.resolve()}function Y(t,e,n){var r=T(n),i=m(r.namespace);if(r.namespace===b.DEFAULT_NAMESPACE&&!i.initialized&&!g.skipInitCheck)throw h.NotInitialized(r.namespace);if(typeof t=="string"){var o=q(t);if(!o)throw h.ModalNotExistsInStore(t);t=o}if(!t)throw h.ModalComponentNotProvided();var u=new M(t,e,r);return i.queue.push(s.markRaw(u)),u}function S(t,e,n){return e===void 0&&(e={}),n===void 0&&(n={}),Promise.resolve().then(function(){return Y(t,e,n)})}function D(t,e,n){return e===void 0&&(e={}),n===void 0&&(n={}),j({namespace:n.namespace}).then(function(){var r=m(n.namespace);if(r.queue.length)throw h.QueueNoEmpty()}).then(function(){return S(t,e,n)})}function $(t){if(typeof t!="object")throw h.ConfigurationType(t);Object.assign(g,t)}function X(t){var e,n,r,i=s.getCurrentInstance(),o=String(((e=i==null?void 0:i.props)===null||e===void 0?void 0:e.modalId)||((n=i==null?void 0:i.props)===null||n===void 0?void 0:n["modal-id"])||((r=i==null?void 0:i.attrs)===null||r===void 0?void 0:r.modalId)),u=o.replace(/[^0-9]/g,"");p.add(Number(u),"close",t)}function W(t,e,n){return e===void 0&&(e={}),n===void 0&&(n={}),_(this,void 0,void 0,function(){var r,i,o=this;return y(this,function(u){switch(u.label){case 0:return[4,S(t,e,n)];case 1:return r=u.sent(),i=!1,[2,new Promise(function(c){r.on(M.EVENT_PROMPT,function(f){return _(o,void 0,void 0,function(){return y(this,function(a){return i=!0,[2,r.close().then(function(){return c(f)}).catch(function(){return i=!1})]})})}),r.ondestroy=function(){i||c(null)}})]}})})}function q(t){return g.store[t]||void 0}const le="",V=["onPointerdown"],B={__name:"WidgetModalContainerItem",props:{id:Number},setup(t){const e=s.ref(null),n=t,r=O(n.id);function i(){if(r.backgroundClose)return E(r.id,{background:!0}).catch(()=>{})}s.watch(()=>e.value,u=>{r.instance=u}),s.onMounted(()=>{r.draggable&&o(document.querySelector(typeof r.draggable=="string"?r.draggable:`[modalid=_modal_${n.id}]`))});function o(u){if(!u)return;const c=document.querySelector(`[modalid=_modal_${n.id}]`);u.addEventListener("pointerdown",f=>{var L;const a=(L=c.getAttribute("style"))==null?void 0:L.match(/transform: translate\((.*)px,\s*(.*)px\)/);let d=a==null?void 0:a[1],v=a==null?void 0:a[2];d=typeof d=="string"?Number.parseInt(d):0,v=typeof v=="string"?Number.parseInt(v):0;const{clientX:te,clientY:ne}=f,re=te,oe=ne;document.addEventListener("pointermove",F,{passive:!0}),document.addEventListener("pointerup",ie,{once:!0});function F(k){const{clientX:ae,clientY:ue}=k,se=d+ae-re,ce=v+ue-oe;c.style.transform=`translate(${se}px,${ce}px)`}function ie(k){document.removeEventListener("pointermove",F),k.preventDefault()}})}return(u,c)=>(s.openBlock(),s.createElementBlock("div",{class:"widget__modal-container__item modal-container",onPointerdown:s.withModifiers(i,["self","stop"])},[(s.openBlock(),s.createBlock(s.resolveDynamicComponent(s.unref(r).component),s.mergeProps(s.unref(r).props.value,{class:"modal-item widget__modal-wrap",modalId:`_modal_${t.id}`,ref_key:"modalRef",ref:e},s.toHandlers(s.unref(r).events)),null,16,["modalId"]))],40,V))}};function H(t){t===void 0&&(t=b.DEFAULT_NAMESPACE);var e=b.instance.getByName(t);e.initialized=!0,t===b.DEFAULT_NAMESPACE&&document.addEventListener("keyup",function(n){if(g.escClose&&(n.key==="Escape"||n.code==="Escape")){var r=P(t);if(!r)return;E(r.id,{esc:!0}).catch(function(){})}})}const de="",J={props:{namespace:String},setup(t){return s.onMounted(()=>{H(t.namespace)}),()=>{const e=m(t.namespace);return s.h(s.TransitionGroup,{name:g.animation,tag:"div"},{default:()=>e.queue.map(n=>s.h(B,{key:n.id,id:n.id}))})}},components:{WidgetContainerModalItem:B}};var w={router:null};function K(t){var e=this;if(w.router)throw h.DuplicatedRouterIntegration();w.router=t;function n(r){for(var i=r.matched.length-1;i>=0;i--){var o=r.matched[i].components,u=Object.values(o).find(function(c){return c._isModal});if(u)return u}return null}t.beforeEach(function(r,i){return _(e,void 0,void 0,function(){var o,u,c;return y(this,function(f){switch(f.label){case 0:return f.trys.push([0,3,,4]),o=n(i),o&&!(!((c=(u=o.getModalObject())===null||u===void 0?void 0:u.closed)===null||c===void 0)&&c.value)?[4,o.close(!0)]:[3,2];case 1:f.sent(),f.label=2;case 2:return[3,4];case 3:return f.sent(),[2,!1];case 4:return[2]}})})}),t.afterEach(function(r){return _(e,void 0,void 0,function(){var i;return y(this,function(o){switch(o.label){case 0:return i=n(r),i?[4,i.initialize()]:[3,2];case 1:o.sent(),o.label=2;case 2:return[2]}})})})}function x(t){var e=null,n=!1;function r(){return _(this,void 0,void 0,function(){return y(this,function(i){switch(i.label){case 0:if(!w.router)throw h.ModalRouterIntegrationNotInitialized();return n=!1,e=null,[4,D(t,s.computed(function(){var o;return(o=w.router)===null||o===void 0?void 0:o.currentRoute.value.params}),{isRoute:!0})];case 1:return e=i.sent(),e.onclose=function(){var o;n||(o=w.router)===null||o===void 0||o.back()},[2]}})})}return{getModalObject:function(){return e},_isModal:!0,close:function(i){return i===void 0&&(i=!1),_(this,void 0,void 0,function(){return y(this,function(o){switch(o.label){case 0:return n=i,e?[4,e.close()]:[3,2];case 1:return[2,o.sent()];case 2:return[2]}})})},initialize:r,setup:function(){return function(){return null}}}}x.init=K;var Z=m().queue;function ee(t){return m(t).queue}l.Modal=M,l.closeById=E,l.closeModal=j,l.config=$,l.container=J,l.getComponentFromStore=q,l.getCurrentModal=P,l.getQueueByNamespace=ee,l.modalQueue=Z,l.onBeforeModalClose=X,l.openModal=D,l.popModal=U,l.promptModal=W,l.pushModal=S,l.useModalRouter=x,Object.defineProperty(l,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}(),$=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"})}); | ||
//# sourceMappingURL=jenesius-vue-modal.umd.js.map |
{ | ||
"name": "jenesius-vue-modal", | ||
"version": "1.11.2", | ||
"version": "1.11.3", | ||
"private": false, | ||
@@ -15,3 +15,4 @@ "description": "The progressive and simple modal system for Vue.js v3", | ||
"docs:build": "vitepress build docs", | ||
"docs:serve": "vitepress serve docs" | ||
"docs:serve": "vitepress serve docs", | ||
"serve-with-debug-windows": "set DEBUG=jenesius-vue-modal*& vue-cli-service serve --mode development" | ||
}, | ||
@@ -40,2 +41,3 @@ "main": "dist/jenesius-vue-modal.cjs.js", | ||
"@testing-library/vue": "8.0.0", | ||
"@types/debug": "^4.1.12", | ||
"@types/jest": "^29.2.6", | ||
@@ -79,3 +81,6 @@ "@vitejs/plugin-vue": "4.3.1", | ||
}, | ||
"url": "https://github.com/Jenesius/vue-modal/issues" | ||
"url": "https://github.com/Jenesius/vue-modal/issues", | ||
"dependencies": { | ||
"debug": "^4.3.4" | ||
} | ||
} |
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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
320171
66
2863
2
26
3
+ Addeddebug@^4.3.4
+ Addeddebug@4.4.0(transitive)
+ Addedms@2.1.3(transitive)