@ozdao/prometheus-framework 0.1.16 → 0.1.18
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/Breadcrumbs.vue_vue_type_style_index_0_lang-2426cb6f.mjs +1945 -0
- package/dist/Breadcrumbs.vue_vue_type_style_index_0_lang-579e2c7a.mjs +1945 -0
- package/dist/Breadcrumbs.vue_vue_type_style_index_0_lang-c6aba800.js +1 -0
- package/dist/Breadcrumbs.vue_vue_type_style_index_0_lang-cab2bcd2.js +1 -0
- package/dist/ButtonFollow-23c4d9fc.mjs +132 -0
- package/dist/ButtonFollow-351486b0.js +1 -0
- package/dist/ButtonFollow-3a05d29f.mjs +132 -0
- package/dist/ButtonFollow-bf5e6d42.js +1 -0
- package/dist/CardOrganization-4d22037e.js +1 -0
- package/dist/CardOrganization-63dcc83b.js +1 -0
- package/dist/CardOrganization-8c5b582b.mjs +230 -0
- package/dist/CardOrganization-e530c9d5.mjs +230 -0
- package/dist/Chips-3dac276c.js +1 -0
- package/dist/Feed-416d84b0.mjs +439 -0
- package/dist/Feed-44beaa4c.mjs +368 -0
- package/dist/Feed-4d9001aa.mjs +368 -0
- package/dist/Feed-51eef23f.js +1 -0
- package/dist/Feed-8a151970.js +1 -0
- package/dist/Feed-c9e6190e.js +1 -0
- package/dist/Feed-d78d4b91.mjs +439 -0
- package/dist/Feed-f4e9769e.js +1 -0
- package/dist/Gallery-1f82841a.mjs +357 -0
- package/dist/Gallery-9305f294.mjs +357 -0
- package/dist/Gallery-dd29c7f6.js +1 -0
- package/dist/Gallery-dea27e94.js +1 -0
- package/dist/Image-22e17cef.js +9 -0
- package/dist/Image-a2c2ab9c.js +9 -0
- package/dist/Image-ad6d4f0f.mjs +477 -0
- package/dist/Image-c0ae2c5f.mjs +477 -0
- package/dist/Popup-383abb2e.js +1 -0
- package/dist/Popup-ad5f59d0.js +1 -0
- package/dist/Popup-e7c9a43e.mjs +76 -0
- package/dist/Popup-f7a5e86b.mjs +76 -0
- package/dist/Product-2d05acc8.mjs +839 -0
- package/dist/Product-b32fb0e1.js +7 -0
- package/dist/Product-d01e3a0d.mjs +839 -0
- package/dist/Product-d9c3b9b9.js +7 -0
- package/dist/ProductEdit-2b4d1d88.js +1 -0
- package/dist/ProductEdit-5e479343.mjs +300 -0
- package/dist/ProductEdit-ab0530e8.js +1 -0
- package/dist/ProductEdit-aca44ef7.mjs +300 -0
- package/dist/ProfileBlogposts-070cb7e9.mjs +65 -0
- package/dist/ProfileBlogposts-2063c511.mjs +65 -0
- package/dist/ProfileBlogposts-b6bf0c42.js +1 -0
- package/dist/ProfileBlogposts-eaecd267.js +1 -0
- package/dist/ProfileComments-1ae70859.js +1 -0
- package/dist/ProfileComments-78231e6a.mjs +44 -0
- package/dist/ProfileComments-8a0c489c.mjs +44 -0
- package/dist/ProfileComments-f0000ea6.js +1 -0
- package/dist/ProfileEvents-4a2fa422.mjs +57 -0
- package/dist/ProfileEvents-8b88287a.js +1 -0
- package/dist/ProfileEvents-90448f97.js +1 -0
- package/dist/ProfileEvents-d978617d.mjs +57 -0
- package/dist/ProfileLikes-74c78a16.mjs +44 -0
- package/dist/ProfileLikes-b48ce0ef.js +1 -0
- package/dist/ProfileLikes-d5f9f058.js +1 -0
- package/dist/ProfileLikes-f5ad4497.mjs +44 -0
- package/dist/ProfileOrganizations-422d1fa5.js +1 -0
- package/dist/ProfileOrganizations-43710687.js +1 -0
- package/dist/ProfileOrganizations-6b1bc5b2.mjs +213 -0
- package/dist/ProfileOrganizations-cf8a12f5.mjs +213 -0
- package/dist/Publics-5472f70c.mjs +123 -0
- package/dist/Publics-640d32fc.mjs +123 -0
- package/dist/Publics-71b9efbe.js +1 -0
- package/dist/Publics-8595ab7e.js +1 -0
- package/dist/Socials-43293869.js +1 -0
- package/dist/Tab-dcd62005.js +1 -0
- package/dist/UploadImage-0f488170.js +1 -0
- package/dist/UploadImage-3c627d89.mjs +83 -0
- package/dist/UploadImage-dfb36cdb.js +1 -0
- package/dist/UploadImage-e4418b43.mjs +83 -0
- package/dist/UploadImageMultiple-c9a7b54f.js +1 -0
- package/dist/UploadImageMultiple-cb6c7188.mjs +58 -0
- package/dist/UploadImageMultiple-d2d48f39.mjs +58 -0
- package/dist/UploadImageMultiple-eddaac87.js +1 -0
- package/dist/auth-4415a97a.js +7 -0
- package/dist/auth-45a454f2.js +7 -0
- package/dist/auth-5cd34aae.mjs +905 -0
- package/dist/auth-afa25b86.mjs +905 -0
- package/dist/auth.client.cjs +8 -8
- package/dist/auth.client.js +16 -15
- package/dist/auth.validation-3e93dc23.mjs +20 -0
- package/dist/auth.validation-4b016fa5.js +1 -0
- package/dist/auth.validation-a17cd085.js +1 -0
- package/dist/auth.validation-a52304cf.mjs +20 -0
- package/dist/backoffice.client.cjs +1 -0
- package/dist/backoffice.client.js +69 -0
- package/dist/carousel.es-cdfb392c.js +5 -0
- package/dist/community.client.cjs +1 -1
- package/dist/community.client.js +23 -22
- package/dist/components/EditImages/EditImages.vue.d.ts +7 -0
- package/dist/components/FieldPhone/FieldPhone(script-setup).vue.d.ts +3 -3
- package/dist/components/FieldPhone/FieldPhone.vue.d.ts +1 -1
- package/dist/events.client.cjs +2 -2
- package/dist/events.client.js +17 -16
- package/dist/files.server.js +149 -112
- package/dist/files.server.mjs +149 -112
- package/dist/gallery.server.js +148 -0
- package/dist/gallery.server.mjs +149 -0
- package/dist/index-2059e444.js +2 -0
- package/dist/index-4e469a71.mjs +941 -0
- package/dist/index-a661083c.mjs +934 -0
- package/dist/index-b41aac19.js +2 -0
- package/dist/landing.client.cjs +1 -1
- package/dist/modules/gallery/components/sections/Gallery.vue.d.ts +2 -0
- package/dist/modules/icons/navigation/IconChevronRight.vue.d.ts +13 -1
- package/dist/modules/mobile/components/Menu/MenuItem.vue.d.ts +14 -2
- package/dist/organizations-65937ba4.js +1 -0
- package/dist/organizations-81e762e7.mjs +122 -0
- package/dist/organizations-af965fcf.mjs +122 -0
- package/dist/organizations-cf1ab766.js +1 -0
- package/dist/organizations.client-1e9361ec.js +3 -0
- package/dist/organizations.client-43816e25.mjs +3018 -0
- package/dist/organizations.client-b692a78a.mjs +3018 -0
- package/dist/organizations.client-bdc9b044.js +3 -0
- package/dist/organizations.client.cjs +1 -1
- package/dist/organizations.client.js +44 -43
- package/dist/style.css +1 -1
- package/dist/users.client.cjs +1 -1
- package/dist/users.client.js +224 -184
- package/dist/vue-draggable-next.esm-bundler-21a209c6.js +10 -0
- package/dist/vuex.esm-bundler-685cf29f.js +5 -0
- package/package.json +10 -1
- package/src/components/EditImages/EditImages.vue +55 -0
- package/src/configurator/components/layouts/layoutConfigurator.vue +0 -40
- package/src/modules/backoffice/backoffice.client.js +15 -0
- package/src/modules/backoffice/components/layouts/Account.vue +48 -58
- package/src/modules/backoffice/router/backoffice.js +20 -0
- package/src/modules/files/controllers/files.controller.js +27 -131
- package/src/modules/files/middlewares/server/index.js +10 -0
- package/src/modules/files/middlewares/server/md.js +151 -0
- package/src/modules/files/middlewares/server/middlewareMulter.js +121 -0
- package/src/modules/files/routes/files.routes.js +20 -6
- package/src/modules/gallery/components/sections/Gallery.vue +414 -0
- package/src/modules/gallery/controllers/gallery.controller.js +87 -73
- package/src/modules/gallery/gallery.client.js +17 -0
- package/src/modules/gallery/gallery.server.js +13 -0
- package/src/modules/gallery/models/photo.model.js +20 -14
- package/src/modules/gallery/routes/gallery.routes.js +18 -9
- package/src/modules/gallery/store/gallery.js +25 -19
- package/src/modules/icons/navigation/IconChevronRight.vue +14 -2
- package/src/modules/mobile/components/Menu/Menu.vue +1 -1
- package/src/modules/mobile/components/Menu/MenuItem.vue +8 -2
- package/src/modules/users/components/pages/Profile.vue +22 -1
- package/src/modules/backoffice/components/pages/Profile.vue +0 -109
- package/src/modules/backoffice/components/pages/profile/ProfileEdit.vue +0 -132
@@ -0,0 +1,7 @@
|
|
1
|
+
"use strict";const a=require("vue"),de=require("./_plugin-vue_export-helper-f246444f.js"),W=require("./index-b41aac19.js"),L=require("./globals-928eb13c.js");const ue={key:0,class:"t-transp mn-r-small"},fe={class:"w-100"},pe=["type","value","placeholder"],me=["value","placeholder"],ge={key:0,class:"mn-t-thin mn-thin mn-b-thin invalid-feedback"},he={__name:"Field",props:{label:null,type:"text",placeholder:"Enter something here",field:null,validation:!1,disabled:!1},emits:["update:field","focus","blur"],setup(t,{emit:e}){const n=t,s=a.ref(n.field);return(o,r)=>(a.openBlock(),a.createElementBlock(a.Fragment,null,[a.createElementVNode("div",{class:a.normalizeClass([[o.$attrs.class,{"bg-fourth-nano":t.validation}],"flex-center flex-nowrap flex"])},[t.label?(a.openBlock(),a.createElementBlock("div",ue,[a.createElementVNode("span",null,a.toDisplayString(t.label),1)])):a.createCommentVNode("",!0),a.createElementVNode("div",fe,[t.type!=="textarea"?(a.openBlock(),a.createElementBlock("input",{key:0,onInput:r[0]||(r[0]=i=>s.value=e("update:field",i.target.value)),onFocus:r[1]||(r[1]=i=>e("focus",i)),onBlur:r[2]||(r[2]=i=>e("blur",i)),type:t.type,class:"w-100",value:t.field,placeholder:t.placeholder},null,40,pe)):(a.openBlock(),a.createElementBlock("textarea",{key:1,onInput:r[3]||(r[3]=i=>s.value=e("update:field",i.target.value)),onFocus:r[4]||(r[4]=i=>e("focus",i)),onBlur:r[5]||(r[5]=i=>e("blur",i)),class:"w-100",value:t.field,placeholder:t.placeholder},null,40,me))])],2),a.createVNode(a.Transition,{name:"fade"},{default:a.withCtx(()=>[t.validation?(a.openBlock(),a.createElementBlock("div",ge," * "+a.toDisplayString(t.validation.message),1)):a.createCommentVNode("",!0)]),_:1})],64))}},ve=de._export_sfc(he,[["__scopeId","data-v-e4056b41"]]);const we=["onClick","disabled"],be={key:0},ye={key:0,class:"loading"},Pe=a.createElementVNode("span",null,[a.createElementVNode("svg",{class:"i-small",width:"135",height:"140",viewBox:"0 0 135 140",xmlns:"http://www.w3.org/2000/svg",fill:"#fff"},[a.createElementVNode("rect",{y:"10",width:"15",height:"120",rx:"6"},[a.createElementVNode("animate",{attributeName:"height",begin:"0.5s",dur:"1s",values:"120;110;100;90;80;70;60;50;40;140;120",calcMode:"linear",repeatCount:"indefinite"}),a.createTextVNode(),a.createElementVNode("animate",{attributeName:"y",begin:"0.5s",dur:"1s",values:"10;15;20;25;30;35;40;45;50;0;10",calcMode:"linear",repeatCount:"indefinite"})]),a.createElementVNode("rect",{x:"30",y:"10",width:"15",height:"120",rx:"6"},[a.createElementVNode("animate",{attributeName:"height",begin:"0.25s",dur:"1s",values:"120;110;100;90;80;70;60;50;40;140;120",calcMode:"linear",repeatCount:"indefinite"}),a.createTextVNode(),a.createElementVNode("animate",{attributeName:"y",begin:"0.25s",dur:"1s",values:"10;15;20;25;30;35;40;45;50;0;10",calcMode:"linear",repeatCount:"indefinite"})]),a.createElementVNode("rect",{x:"60",width:"15",height:"140",rx:"6"},[a.createElementVNode("animate",{attributeName:"height",begin:"0s",dur:"1s",values:"120;110;100;90;80;70;60;50;40;140;120",calcMode:"linear",repeatCount:"indefinite"}),a.createTextVNode(),a.createElementVNode("animate",{attributeName:"y",begin:"0s",dur:"1s",values:"10;15;20;25;30;35;40;45;50;0;10",calcMode:"linear",repeatCount:"indefinite"})]),a.createElementVNode("rect",{x:"90",y:"10",width:"15",height:"120",rx:"6"},[a.createElementVNode("animate",{attributeName:"height",begin:"0.25s",dur:"1s",values:"120;110;100;90;80;70;60;50;40;140;120",calcMode:"linear",repeatCount:"indefinite"}),a.createTextVNode(),a.createElementVNode("animate",{attributeName:"y",begin:"0.25s",dur:"1s",values:"10;15;20;25;30;35;40;45;50;0;10",calcMode:"linear",repeatCount:"indefinite"})]),a.createElementVNode("rect",{x:"120",y:"10",width:"15",height:"120",rx:"6"},[a.createElementVNode("animate",{attributeName:"height",begin:"0.5s",dur:"1s",values:"120;110;100;90;80;70;60;50;40;140;120",calcMode:"linear",repeatCount:"indefinite"}),a.createTextVNode(),a.createElementVNode("animate",{attributeName:"y",begin:"0.5s",dur:"1s",values:"10;15;20;25;30;35;40;45;50;0;10",calcMode:"linear",repeatCount:"indefinite"})])])],-1),Ce=[Pe],ke={key:0,class:"h4 loading"},Ee=a.createElementVNode("span",{class:"p-small t-white"},"✔",-1),xe=[Ee],_e={key:0,class:"error"},Oe={__name:"Button",props:{submit:{type:Function,default:async()=>{console.log("Button click.")}},callback:{type:Function,default:async()=>{console.log("Button callback.")}},callbackDelay:{type:Number,default:750},validation:{type:Boolean,default:!1}},setup(t){const e=t,n=a.ref(null),s=a.ref(null),o=a.ref(!1),r=a.ref(!1);async function i(){n.value.style["pointer-events"]="none",s.value=null,o.value=!0;try{await e.submit(),n.value.classList.replace("bg-main","bg-light-main"),o.value=!1,r.value=!0,setTimeout(()=>{n.value&&(n.value.classList.replace("bg-light-main","bg-main"),n.value.style.pointerEvents="auto",o.value=!1,r.value=!1,s.value=null)},500),e.callback&&setTimeout(()=>e.callback(),e.callbackDelay)}catch{n.value.classList.replace("bg-main","bg-fourth-nano"),s.value="❌",setTimeout(()=>{n.value.classList.replace("bg-fourth-nano","bg-main"),n.value.style.pointerEvents="auto",o.value=!1,r.value=!1,s.value=null},1330)}}return(l,u)=>(a.openBlock(),a.createElementBlock("button",{onClick:a.withModifiers(i,["stop"]),disabled:t.validation,ref_key:"button",ref:n,class:"w-100 bg-main button"},[a.createVNode(a.Transition,{mode:"out-in",name:"fadeIn"},{default:a.withCtx(()=>[!o.value&&!s.value&&!r.value?(a.openBlock(),a.createElementBlock("span",be,[a.renderSlot(l.$slots,"default")])):a.createCommentVNode("",!0)]),_:3}),a.createVNode(a.Transition,{mode:"out-in",name:"fadeIn"},{default:a.withCtx(()=>[o.value&&!s.value?(a.openBlock(),a.createElementBlock("div",ye,Ce)):a.createCommentVNode("",!0)]),_:1}),a.createVNode(a.Transition,{mode:"out-in",name:"fadeIn"},{default:a.withCtx(()=>[r.value?(a.openBlock(),a.createElementBlock("div",ke,xe)):a.createCommentVNode("",!0)]),_:1}),a.createVNode(a.Transition,{mode:"out-in",name:"fadeIn"},{default:a.withCtx(()=>[s.value?(a.openBlock(),a.createElementBlock("div",_e,[a.createElementVNode("span",null,a.toDisplayString(s.value),1)])):a.createCommentVNode("",!0)]),_:1})],8,we))}};var Z={exports:{}};/*!
|
2
|
+
* JavaScript Cookie v2.2.1
|
3
|
+
* https://github.com/js-cookie/js-cookie
|
4
|
+
*
|
5
|
+
* Copyright 2006, 2015 Klaus Hartl & Fagner Brack
|
6
|
+
* Released under the MIT license
|
7
|
+
*/(function(t,e){(function(n){var s;if(t.exports=n(),s=!0,!s){var o=window.Cookies,r=window.Cookies=n();r.noConflict=function(){return window.Cookies=o,r}}})(function(){function n(){for(var r=0,i={};r<arguments.length;r++){var l=arguments[r];for(var u in l)i[u]=l[u]}return i}function s(r){return r.replace(/(%[0-9A-Z]{2})+/g,decodeURIComponent)}function o(r){function i(){}function l(c,m,d){if(!(typeof document>"u")){d=n({path:"/"},i.defaults,d),typeof d.expires=="number"&&(d.expires=new Date(new Date*1+d.expires*864e5)),d.expires=d.expires?d.expires.toUTCString():"";try{var P=JSON.stringify(m);/^[\{\[]/.test(P)&&(m=P)}catch{}m=r.write?r.write(m,c):encodeURIComponent(String(m)).replace(/%(23|24|26|2B|3A|3C|3E|3D|2F|3F|40|5B|5D|5E|60|7B|7D|7C)/g,decodeURIComponent),c=encodeURIComponent(String(c)).replace(/%(23|24|26|2B|5E|60|7C)/g,decodeURIComponent).replace(/[\(\)]/g,escape);var C="";for(var k in d)d[k]&&(C+="; "+k,d[k]!==!0&&(C+="="+d[k].split(";")[0]));return document.cookie=c+"="+m+C}}function u(c,m){if(!(typeof document>"u")){for(var d={},P=document.cookie?document.cookie.split("; "):[],C=0;C<P.length;C++){var k=P[C].split("="),w=k.slice(1).join("=");!m&&w.charAt(0)==='"'&&(w=w.slice(1,-1));try{var $=s(k[0]);if(w=(r.read||r)(w,$)||s(w),m)try{w=JSON.parse(w)}catch{}if(d[$]=w,c===$)break}catch{}}return c?d[c]:d}}return i.set=l,i.get=function(c){return u(c,!1)},i.getJSON=function(c){return u(c,!0)},i.remove=function(c,m){l(c,"",n(m,{expires:-1}))},i.defaults={},i.withConverter=o,i}return o(function(){})})})(Z);var Le=Z.exports;const T=W.getDefaultExportFromCjs(Le);/*! Capacitor: https://capacitorjs.com/ - MIT License */const Ne=t=>{const e=new Map;e.set("web",{name:"web"});const n=t.CapacitorPlatforms||{currentPlatform:{name:"web"},platforms:e},s=(r,i)=>{n.platforms.set(r,i)},o=r=>{n.platforms.has(r)&&(n.currentPlatform=n.platforms.get(r))};return n.addPlatform=s,n.setPlatform=o,n},je=t=>t.CapacitorPlatforms=Ne(t),Q=je(typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{});Q.addPlatform;Q.setPlatform;var S;(function(t){t.Unimplemented="UNIMPLEMENTED",t.Unavailable="UNAVAILABLE"})(S||(S={}));class H extends Error{constructor(e,n,s){super(e),this.message=e,this.code=n,this.data=s}}const Se=t=>{var e,n;return t!=null&&t.androidBridge?"android":!((n=(e=t==null?void 0:t.webkit)===null||e===void 0?void 0:e.messageHandlers)===null||n===void 0)&&n.bridge?"ios":"web"},Ve=t=>{var e,n,s,o,r;const i=t.CapacitorCustomPlatform||null,l=t.Capacitor||{},u=l.Plugins=l.Plugins||{},c=t.CapacitorPlatforms,m=()=>i!==null?i.name:Se(t),d=((e=c==null?void 0:c.currentPlatform)===null||e===void 0?void 0:e.getPlatform)||m,P=()=>d()!=="web",C=((n=c==null?void 0:c.currentPlatform)===null||n===void 0?void 0:n.isNativePlatform)||P,k=f=>{const p=M.get(f);return!!(p!=null&&p.platforms.has(d())||U(f))},w=((s=c==null?void 0:c.currentPlatform)===null||s===void 0?void 0:s.isPluginAvailable)||k,$=f=>{var p;return(p=l.PluginHeaders)===null||p===void 0?void 0:p.find(N=>N.name===f)},U=((o=c==null?void 0:c.currentPlatform)===null||o===void 0?void 0:o.getPluginHeader)||$,re=f=>t.console.error(f),ae=(f,p,N)=>Promise.reject(`${N} does not have an implementation of "${p}".`),M=new Map,oe=(f,p={})=>{const N=M.get(f);if(N)return console.warn(`Capacitor plugin "${f}" already registered. Cannot register plugins twice.`),N.proxy;const O=d(),j=U(f);let E;const ie=async()=>(!E&&O in p?E=typeof p[O]=="function"?E=await p[O]():E=p[O]:i!==null&&!E&&"web"in p&&(E=typeof p.web=="function"?E=await p.web():E=p.web),E),le=(g,v)=>{var y,x;if(j){const _=j==null?void 0:j.methods.find(b=>v===b.name);if(_)return _.rtype==="promise"?b=>l.nativePromise(f,v.toString(),b):(b,A)=>l.nativeCallback(f,v.toString(),b,A);if(g)return(y=g[v])===null||y===void 0?void 0:y.bind(g)}else{if(g)return(x=g[v])===null||x===void 0?void 0:x.bind(g);throw new H(`"${f}" plugin is not implemented on ${O}`,S.Unimplemented)}},D=g=>{let v;const y=(...x)=>{const _=ie().then(b=>{const A=le(b,g);if(A){const R=A(...x);return v=R==null?void 0:R.remove,R}else throw new H(`"${f}.${g}()" is not implemented on ${O}`,S.Unimplemented)});return g==="addListener"&&(_.remove=async()=>v()),_};return y.toString=()=>`${g.toString()}() { [capacitor code] }`,Object.defineProperty(y,"name",{value:g,writable:!1,configurable:!1}),y},J=D("addListener"),G=D("removeListener"),ce=(g,v)=>{const y=J({eventName:g},v),x=async()=>{const b=await y;G({eventName:g,callbackId:b},v)},_=new Promise(b=>y.then(()=>b({remove:x})));return _.remove=async()=>{console.warn("Using addListener() without 'await' is deprecated."),await x()},_},F=new Proxy({},{get(g,v){switch(v){case"$$typeof":return;case"toJSON":return()=>({});case"addListener":return j?ce:J;case"removeListener":return G;default:return D(v)}}});return u[f]=F,M.set(f,{name:f,proxy:F,platforms:new Set([...Object.keys(p),...j?[O]:[]])}),F},se=((r=c==null?void 0:c.currentPlatform)===null||r===void 0?void 0:r.registerPlugin)||oe;return l.convertFileSrc||(l.convertFileSrc=f=>f),l.getPlatform=d,l.handleError=re,l.isNativePlatform=C,l.isPluginAvailable=w,l.pluginMethodNoop=ae,l.registerPlugin=se,l.Exception=H,l.DEBUG=!!l.DEBUG,l.isLoggingEnabled=!!l.isLoggingEnabled,l.platform=l.getPlatform(),l.isNative=l.isNativePlatform(),l},$e=t=>t.Capacitor=Ve(t),I=$e(typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{}),X=I.registerPlugin;I.Plugins;class Y{constructor(e){this.listeners={},this.windowListeners={},e&&(console.warn(`Capacitor WebPlugin "${e.name}" config object was deprecated in v3 and will be removed in v4.`),this.config=e)}addListener(e,n){this.listeners[e]||(this.listeners[e]=[]),this.listeners[e].push(n);const o=this.windowListeners[e];o&&!o.registered&&this.addWindowListener(o);const r=async()=>this.removeListener(e,n),i=Promise.resolve({remove:r});return Object.defineProperty(i,"remove",{value:async()=>{console.warn("Using addListener() without 'await' is deprecated."),await r()}}),i}async removeAllListeners(){this.listeners={};for(const e in this.windowListeners)this.removeWindowListener(this.windowListeners[e]);this.windowListeners={}}notifyListeners(e,n){const s=this.listeners[e];s&&s.forEach(o=>o(n))}hasListeners(e){return!!this.listeners[e].length}registerWindowListener(e,n){this.windowListeners[n]={registered:!1,windowEventName:e,pluginEventName:n,handler:s=>{this.notifyListeners(n,s)}}}unimplemented(e="not implemented"){return new I.Exception(e,S.Unimplemented)}unavailable(e="not available"){return new I.Exception(e,S.Unavailable)}async removeListener(e,n){const s=this.listeners[e];if(!s)return;const o=s.indexOf(n);this.listeners[e].splice(o,1),this.listeners[e].length||this.removeWindowListener(this.windowListeners[e])}addWindowListener(e){window.addEventListener(e.windowEventName,e.handler),e.registered=!0}removeWindowListener(e){e&&(window.removeEventListener(e.windowEventName,e.handler),e.registered=!1)}}const z=t=>encodeURIComponent(t).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape),K=t=>t.replace(/(%[\dA-F]{2})+/gi,decodeURIComponent);class Be extends Y{async getCookies(){const e=document.cookie,n={};return e.split(";").forEach(s=>{if(s.length<=0)return;let[o,r]=s.replace(/=/,"CAP_COOKIE").split("CAP_COOKIE");o=K(o).trim(),r=K(r).trim(),n[o]=r}),n}async setCookie(e){try{const n=z(e.key),s=z(e.value),o=`; expires=${(e.expires||"").replace("expires=","")}`,r=(e.path||"/").replace("path=",""),i=e.url!=null&&e.url.length>0?`domain=${e.url}`:"";document.cookie=`${n}=${s||""}${o}; path=${r}; ${i};`}catch(n){return Promise.reject(n)}}async deleteCookie(e){try{document.cookie=`${e.key}=; Max-Age=0`}catch(n){return Promise.reject(n)}}async clearCookies(){try{const e=document.cookie.split(";")||[];for(const n of e)document.cookie=n.replace(/^ +/,"").replace(/=.*/,`=;expires=${new Date().toUTCString()};path=/`)}catch(e){return Promise.reject(e)}}async clearAllCookies(){try{await this.clearCookies()}catch(e){return Promise.reject(e)}}}const ee=X("CapacitorCookies",{web:()=>new Be}),Te=async t=>new Promise((e,n)=>{const s=new FileReader;s.onload=()=>{const o=s.result;e(o.indexOf(",")>=0?o.split(",")[1]:o)},s.onerror=o=>n(o),s.readAsDataURL(t)}),Ue=(t={})=>{const e=Object.keys(t);return Object.keys(t).map(o=>o.toLocaleLowerCase()).reduce((o,r,i)=>(o[r]=t[e[i]],o),{})},Ae=(t,e=!0)=>t?Object.entries(t).reduce((s,o)=>{const[r,i]=o;let l,u;return Array.isArray(i)?(u="",i.forEach(c=>{l=e?encodeURIComponent(c):c,u+=`${r}=${l}&`}),u.slice(0,-1)):(l=e?encodeURIComponent(i):i,u=`${r}=${l}`),`${s}&${u}`},"").substr(1):null,Re=(t,e={})=>{const n=Object.assign({method:t.method||"GET",headers:t.headers},e),o=Ue(t.headers)["content-type"]||"";if(typeof t.data=="string")n.body=t.data;else if(o.includes("application/x-www-form-urlencoded")){const r=new URLSearchParams;for(const[i,l]of Object.entries(t.data||{}))r.set(i,l);n.body=r.toString()}else if(o.includes("multipart/form-data")){const r=new FormData;if(t.data instanceof FormData)t.data.forEach((l,u)=>{r.append(u,l)});else for(const l of Object.keys(t.data))r.append(l,t.data[l]);n.body=r;const i=new Headers(n.headers);i.delete("content-type"),n.headers=i}else(o.includes("application/json")||typeof t.data=="object")&&(n.body=JSON.stringify(t.data));return n};class Ie extends Y{async request(e){const n=Re(e,e.webFetchExtra),s=Ae(e.params,e.shouldEncodeUrlParams),o=s?`${e.url}?${s}`:e.url,r=await fetch(o,n),i=r.headers.get("content-type")||"";let{responseType:l="text"}=r.ok?e:{};i.includes("application/json")&&(l="json");let u,c;switch(l){case"arraybuffer":case"blob":c=await r.blob(),u=await Te(c);break;case"json":u=await r.json();break;case"document":case"text":default:u=await r.text()}const m={};return r.headers.forEach((d,P)=>{m[P]=d}),{data:u,headers:m,status:r.status,url:r.url}}async get(e){return this.request(Object.assign(Object.assign({},e),{method:"GET"}))}async post(e){return this.request(Object.assign(Object.assign({},e),{method:"POST"}))}async put(e){return this.request(Object.assign(Object.assign({},e),{method:"PUT"}))}async patch(e){return this.request(Object.assign(Object.assign({},e),{method:"PATCH"}))}async delete(e){return this.request(Object.assign(Object.assign({},e),{method:"DELETE"}))}}X("CapacitorHttp",{web:()=>new Ie});const Me=W.axios.create({baseURL:process.env.API_URL,withCredentials:!0}),V=a.reactive({code:{value:"",type:"",method:"",isSended:!1,isValid:!1}});async function te(t,e,n){return await Me.post("/api/twofa/sendcode",{phone:t.phone.number,email:t.email,method:e,type:n}).then(s=>(V.code=s.data,V.code.isSended=!0,Promise.resolve(s.data)),s=>(console.log(s),L.setError(s),Promise.reject(s)))}a.watch(V,(t,e)=>{});const De=Object.freeze(Object.defineProperty({__proto__:null,sendCode:te,state:V},Symbol.toStringTag,{value:"Module"})),B=W.axios.create({baseURL:process.env.API_URL,withCredentials:!0}),h=a.reactive({user:{_id:"",username:"",email:"",phone:"",password:"",passwordRepeat:""},access:{roles:null,token:null,status:!1}});if(T.get("user")){const{_id:t,email:e,phone:n,roles:s,accessToken:o}=JSON.parse(T.get("user"));Object.assign(h.user,{_id:t,email:e,phone:n}),Object.assign(h.access,{token:o,roles:s,status:!!o}),B.interceptors.request.use(r=>(o&&(r.headers["x-access-token"]=o),r),r=>Promise.reject(r))}const ne={async login(t,e){try{const n=await B.post("/api/auth/signin",{...t,type:e});return q("user",n.data),Object.assign(h.user,{...n.data}),Object.assign(h.access,{token:n.data.accessToken,status:!0,roles:n.data.roles}),n.data}catch(n){return Object.assign(h.access,{token:null,status:!1,roles:null}),L.setError(n),Promise.reject(n)}},async signup(t,e,n){const{password:s,passwordRepeat:o}=h.user;if(s!==o){const r={response:{data:{errorCode:"PASSWORDS_DO_NOT_MATCH"}}};throw L.setError(r),new Error(r.response.status)}try{t.phone=t.phone.number;const r=await B.post("/api/auth/signup",{...t,type:e,inviteCode:n});return r.data.accessToken&&q("user",r.data),Object.assign(h.user,{...r.data}),Object.assign(h.access,{token:r.data.accessToken,status:!0,roles:r.data.roles}),r.data}catch(r){throw L.setError(r),console.log("Sign up falied"),r}},logout(){He("user"),Object.assign(h.user,{email:"",phone:"",password:"",passwordRepeat:""}),Object.assign(h.access,{token:null,status:!1})},async resetPassword(t,e){try{const n=await B.post("/api/auth/reset-password",{email:t.email,phone:t.phone.number,type:e});return Object.assign(V.code,{...n.data,isSended:!0}),n.data}catch(n){return L.setError(n),Promise.reject(n)}},async updatePassword(t,e){const{password:n,passwordRepeat:s}=h.user;if(n!==s){const o={response:{data:{errorCode:"PASSWORDS_DO_NOT_MATCH"}}};throw L.setError(o),new Error(o.response.status)}try{const o=await B.post("/api/auth/update-password",{email:t.email,phone:t.phone.number,password:t.password,passwordRepeat:t.passwordRepeat,type:e});return o.data.accessToken&&q("user",o.data),Object.assign(h.user,{...o.data}),Object.assign(h.access,{token:o.data.accessToken,status:!0}),o.data}catch(o){return L.setError(o),Promise.reject(o)}}},Fe={development:{secure:!1,expires:1},production:{expires:1,domain:process.env.API_URL,sameSite:"none",secure:!0}};function q(t,e,n=process.env.NODE_ENV){process.env.MOBILE_APP?ee.setCookie({url:process.env.API_URL,key:t,value:JSON.stringify(e)}):T.set(t,JSON.stringify(e),Fe[n])}function He(t,e=process.env.NODE_ENV){if(process.env.MOBILE_APP)ee.deleteCookie({url:process.env.API_URL,key:t});else{const n=e==="production"?{domain:process.env.API_URL}:{};T.remove(t,n)}}a.watch(h,(t,e)=>{});const qe=Object.freeze(Object.defineProperty({__proto__:null,actions:ne,state:h},Symbol.toStringTag,{value:"Module"}));exports.Cookies=T;exports.Field=ve;exports._sfc_main=Oe;exports.actions=ne;exports.auth=qe;exports.sendCode=te;exports.state=h;exports.state$1=V;exports.twofa=De;
|
@@ -0,0 +1,7 @@
|
|
1
|
+
"use strict";const a=require("vue"),de=require("./_plugin-vue_export-helper-f246444f.js"),W=require("./index-2059e444.js"),L=require("./globals-928eb13c.js");const ue={key:0,class:"t-transp mn-r-small"},fe={class:"w-100"},pe=["type","value","placeholder"],me=["value","placeholder"],ge={key:0,class:"mn-t-thin mn-thin mn-b-thin invalid-feedback"},he={__name:"Field",props:{label:null,type:"text",placeholder:"Enter something here",field:null,validation:!1,disabled:!1},emits:["update:field","focus","blur"],setup(t,{emit:e}){const n=t,s=a.ref(n.field);return(o,r)=>(a.openBlock(),a.createElementBlock(a.Fragment,null,[a.createElementVNode("div",{class:a.normalizeClass([[o.$attrs.class,{"bg-fourth-nano":t.validation}],"flex-center flex-nowrap flex"])},[t.label?(a.openBlock(),a.createElementBlock("div",ue,[a.createElementVNode("span",null,a.toDisplayString(t.label),1)])):a.createCommentVNode("",!0),a.createElementVNode("div",fe,[t.type!=="textarea"?(a.openBlock(),a.createElementBlock("input",{key:0,onInput:r[0]||(r[0]=i=>s.value=e("update:field",i.target.value)),onFocus:r[1]||(r[1]=i=>e("focus",i)),onBlur:r[2]||(r[2]=i=>e("blur",i)),type:t.type,class:"w-100",value:t.field,placeholder:t.placeholder},null,40,pe)):(a.openBlock(),a.createElementBlock("textarea",{key:1,onInput:r[3]||(r[3]=i=>s.value=e("update:field",i.target.value)),onFocus:r[4]||(r[4]=i=>e("focus",i)),onBlur:r[5]||(r[5]=i=>e("blur",i)),class:"w-100",value:t.field,placeholder:t.placeholder},null,40,me))])],2),a.createVNode(a.Transition,{name:"fade"},{default:a.withCtx(()=>[t.validation?(a.openBlock(),a.createElementBlock("div",ge," * "+a.toDisplayString(t.validation.message),1)):a.createCommentVNode("",!0)]),_:1})],64))}},ve=de._export_sfc(he,[["__scopeId","data-v-e4056b41"]]);const we=["onClick","disabled"],be={key:0},ye={key:0,class:"loading"},Pe=a.createElementVNode("span",null,[a.createElementVNode("svg",{class:"i-small",width:"135",height:"140",viewBox:"0 0 135 140",xmlns:"http://www.w3.org/2000/svg",fill:"#fff"},[a.createElementVNode("rect",{y:"10",width:"15",height:"120",rx:"6"},[a.createElementVNode("animate",{attributeName:"height",begin:"0.5s",dur:"1s",values:"120;110;100;90;80;70;60;50;40;140;120",calcMode:"linear",repeatCount:"indefinite"}),a.createTextVNode(),a.createElementVNode("animate",{attributeName:"y",begin:"0.5s",dur:"1s",values:"10;15;20;25;30;35;40;45;50;0;10",calcMode:"linear",repeatCount:"indefinite"})]),a.createElementVNode("rect",{x:"30",y:"10",width:"15",height:"120",rx:"6"},[a.createElementVNode("animate",{attributeName:"height",begin:"0.25s",dur:"1s",values:"120;110;100;90;80;70;60;50;40;140;120",calcMode:"linear",repeatCount:"indefinite"}),a.createTextVNode(),a.createElementVNode("animate",{attributeName:"y",begin:"0.25s",dur:"1s",values:"10;15;20;25;30;35;40;45;50;0;10",calcMode:"linear",repeatCount:"indefinite"})]),a.createElementVNode("rect",{x:"60",width:"15",height:"140",rx:"6"},[a.createElementVNode("animate",{attributeName:"height",begin:"0s",dur:"1s",values:"120;110;100;90;80;70;60;50;40;140;120",calcMode:"linear",repeatCount:"indefinite"}),a.createTextVNode(),a.createElementVNode("animate",{attributeName:"y",begin:"0s",dur:"1s",values:"10;15;20;25;30;35;40;45;50;0;10",calcMode:"linear",repeatCount:"indefinite"})]),a.createElementVNode("rect",{x:"90",y:"10",width:"15",height:"120",rx:"6"},[a.createElementVNode("animate",{attributeName:"height",begin:"0.25s",dur:"1s",values:"120;110;100;90;80;70;60;50;40;140;120",calcMode:"linear",repeatCount:"indefinite"}),a.createTextVNode(),a.createElementVNode("animate",{attributeName:"y",begin:"0.25s",dur:"1s",values:"10;15;20;25;30;35;40;45;50;0;10",calcMode:"linear",repeatCount:"indefinite"})]),a.createElementVNode("rect",{x:"120",y:"10",width:"15",height:"120",rx:"6"},[a.createElementVNode("animate",{attributeName:"height",begin:"0.5s",dur:"1s",values:"120;110;100;90;80;70;60;50;40;140;120",calcMode:"linear",repeatCount:"indefinite"}),a.createTextVNode(),a.createElementVNode("animate",{attributeName:"y",begin:"0.5s",dur:"1s",values:"10;15;20;25;30;35;40;45;50;0;10",calcMode:"linear",repeatCount:"indefinite"})])])],-1),Ce=[Pe],ke={key:0,class:"h4 loading"},Ee=a.createElementVNode("span",{class:"p-small t-white"},"✔",-1),xe=[Ee],_e={key:0,class:"error"},Oe={__name:"Button",props:{submit:{type:Function,default:async()=>{console.log("Button click.")}},callback:{type:Function,default:async()=>{console.log("Button callback.")}},callbackDelay:{type:Number,default:750},validation:{type:Boolean,default:!1}},setup(t){const e=t,n=a.ref(null),s=a.ref(null),o=a.ref(!1),r=a.ref(!1);async function i(){n.value.style["pointer-events"]="none",s.value=null,o.value=!0;try{await e.submit(),n.value.classList.replace("bg-main","bg-light-main"),o.value=!1,r.value=!0,setTimeout(()=>{n.value&&(n.value.classList.replace("bg-light-main","bg-main"),n.value.style.pointerEvents="auto",o.value=!1,r.value=!1,s.value=null)},500),e.callback&&setTimeout(()=>e.callback(),e.callbackDelay)}catch{n.value.classList.replace("bg-main","bg-fourth-nano"),s.value="❌",setTimeout(()=>{n.value.classList.replace("bg-fourth-nano","bg-main"),n.value.style.pointerEvents="auto",o.value=!1,r.value=!1,s.value=null},1330)}}return(l,u)=>(a.openBlock(),a.createElementBlock("button",{onClick:a.withModifiers(i,["stop"]),disabled:t.validation,ref_key:"button",ref:n,class:"w-100 bg-main button"},[a.createVNode(a.Transition,{mode:"out-in",name:"fadeIn"},{default:a.withCtx(()=>[!o.value&&!s.value&&!r.value?(a.openBlock(),a.createElementBlock("span",be,[a.renderSlot(l.$slots,"default")])):a.createCommentVNode("",!0)]),_:3}),a.createVNode(a.Transition,{mode:"out-in",name:"fadeIn"},{default:a.withCtx(()=>[o.value&&!s.value?(a.openBlock(),a.createElementBlock("div",ye,Ce)):a.createCommentVNode("",!0)]),_:1}),a.createVNode(a.Transition,{mode:"out-in",name:"fadeIn"},{default:a.withCtx(()=>[r.value?(a.openBlock(),a.createElementBlock("div",ke,xe)):a.createCommentVNode("",!0)]),_:1}),a.createVNode(a.Transition,{mode:"out-in",name:"fadeIn"},{default:a.withCtx(()=>[s.value?(a.openBlock(),a.createElementBlock("div",_e,[a.createElementVNode("span",null,a.toDisplayString(s.value),1)])):a.createCommentVNode("",!0)]),_:1})],8,we))}};var Z={exports:{}};/*!
|
2
|
+
* JavaScript Cookie v2.2.1
|
3
|
+
* https://github.com/js-cookie/js-cookie
|
4
|
+
*
|
5
|
+
* Copyright 2006, 2015 Klaus Hartl & Fagner Brack
|
6
|
+
* Released under the MIT license
|
7
|
+
*/(function(t,e){(function(n){var s;if(t.exports=n(),s=!0,!s){var o=window.Cookies,r=window.Cookies=n();r.noConflict=function(){return window.Cookies=o,r}}})(function(){function n(){for(var r=0,i={};r<arguments.length;r++){var l=arguments[r];for(var u in l)i[u]=l[u]}return i}function s(r){return r.replace(/(%[0-9A-Z]{2})+/g,decodeURIComponent)}function o(r){function i(){}function l(c,m,d){if(!(typeof document>"u")){d=n({path:"/"},i.defaults,d),typeof d.expires=="number"&&(d.expires=new Date(new Date*1+d.expires*864e5)),d.expires=d.expires?d.expires.toUTCString():"";try{var P=JSON.stringify(m);/^[\{\[]/.test(P)&&(m=P)}catch{}m=r.write?r.write(m,c):encodeURIComponent(String(m)).replace(/%(23|24|26|2B|3A|3C|3E|3D|2F|3F|40|5B|5D|5E|60|7B|7D|7C)/g,decodeURIComponent),c=encodeURIComponent(String(c)).replace(/%(23|24|26|2B|5E|60|7C)/g,decodeURIComponent).replace(/[\(\)]/g,escape);var C="";for(var k in d)d[k]&&(C+="; "+k,d[k]!==!0&&(C+="="+d[k].split(";")[0]));return document.cookie=c+"="+m+C}}function u(c,m){if(!(typeof document>"u")){for(var d={},P=document.cookie?document.cookie.split("; "):[],C=0;C<P.length;C++){var k=P[C].split("="),w=k.slice(1).join("=");!m&&w.charAt(0)==='"'&&(w=w.slice(1,-1));try{var $=s(k[0]);if(w=(r.read||r)(w,$)||s(w),m)try{w=JSON.parse(w)}catch{}if(d[$]=w,c===$)break}catch{}}return c?d[c]:d}}return i.set=l,i.get=function(c){return u(c,!1)},i.getJSON=function(c){return u(c,!0)},i.remove=function(c,m){l(c,"",n(m,{expires:-1}))},i.defaults={},i.withConverter=o,i}return o(function(){})})})(Z);var Le=Z.exports;const T=W.getDefaultExportFromCjs(Le);/*! Capacitor: https://capacitorjs.com/ - MIT License */const Ne=t=>{const e=new Map;e.set("web",{name:"web"});const n=t.CapacitorPlatforms||{currentPlatform:{name:"web"},platforms:e},s=(r,i)=>{n.platforms.set(r,i)},o=r=>{n.platforms.has(r)&&(n.currentPlatform=n.platforms.get(r))};return n.addPlatform=s,n.setPlatform=o,n},je=t=>t.CapacitorPlatforms=Ne(t),Q=je(typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{});Q.addPlatform;Q.setPlatform;var S;(function(t){t.Unimplemented="UNIMPLEMENTED",t.Unavailable="UNAVAILABLE"})(S||(S={}));class H extends Error{constructor(e,n,s){super(e),this.message=e,this.code=n,this.data=s}}const Se=t=>{var e,n;return t!=null&&t.androidBridge?"android":!((n=(e=t==null?void 0:t.webkit)===null||e===void 0?void 0:e.messageHandlers)===null||n===void 0)&&n.bridge?"ios":"web"},Ve=t=>{var e,n,s,o,r;const i=t.CapacitorCustomPlatform||null,l=t.Capacitor||{},u=l.Plugins=l.Plugins||{},c=t.CapacitorPlatforms,m=()=>i!==null?i.name:Se(t),d=((e=c==null?void 0:c.currentPlatform)===null||e===void 0?void 0:e.getPlatform)||m,P=()=>d()!=="web",C=((n=c==null?void 0:c.currentPlatform)===null||n===void 0?void 0:n.isNativePlatform)||P,k=f=>{const p=M.get(f);return!!(p!=null&&p.platforms.has(d())||U(f))},w=((s=c==null?void 0:c.currentPlatform)===null||s===void 0?void 0:s.isPluginAvailable)||k,$=f=>{var p;return(p=l.PluginHeaders)===null||p===void 0?void 0:p.find(N=>N.name===f)},U=((o=c==null?void 0:c.currentPlatform)===null||o===void 0?void 0:o.getPluginHeader)||$,re=f=>t.console.error(f),ae=(f,p,N)=>Promise.reject(`${N} does not have an implementation of "${p}".`),M=new Map,oe=(f,p={})=>{const N=M.get(f);if(N)return console.warn(`Capacitor plugin "${f}" already registered. Cannot register plugins twice.`),N.proxy;const O=d(),j=U(f);let E;const ie=async()=>(!E&&O in p?E=typeof p[O]=="function"?E=await p[O]():E=p[O]:i!==null&&!E&&"web"in p&&(E=typeof p.web=="function"?E=await p.web():E=p.web),E),le=(g,v)=>{var y,x;if(j){const _=j==null?void 0:j.methods.find(b=>v===b.name);if(_)return _.rtype==="promise"?b=>l.nativePromise(f,v.toString(),b):(b,A)=>l.nativeCallback(f,v.toString(),b,A);if(g)return(y=g[v])===null||y===void 0?void 0:y.bind(g)}else{if(g)return(x=g[v])===null||x===void 0?void 0:x.bind(g);throw new H(`"${f}" plugin is not implemented on ${O}`,S.Unimplemented)}},D=g=>{let v;const y=(...x)=>{const _=ie().then(b=>{const A=le(b,g);if(A){const R=A(...x);return v=R==null?void 0:R.remove,R}else throw new H(`"${f}.${g}()" is not implemented on ${O}`,S.Unimplemented)});return g==="addListener"&&(_.remove=async()=>v()),_};return y.toString=()=>`${g.toString()}() { [capacitor code] }`,Object.defineProperty(y,"name",{value:g,writable:!1,configurable:!1}),y},J=D("addListener"),G=D("removeListener"),ce=(g,v)=>{const y=J({eventName:g},v),x=async()=>{const b=await y;G({eventName:g,callbackId:b},v)},_=new Promise(b=>y.then(()=>b({remove:x})));return _.remove=async()=>{console.warn("Using addListener() without 'await' is deprecated."),await x()},_},F=new Proxy({},{get(g,v){switch(v){case"$$typeof":return;case"toJSON":return()=>({});case"addListener":return j?ce:J;case"removeListener":return G;default:return D(v)}}});return u[f]=F,M.set(f,{name:f,proxy:F,platforms:new Set([...Object.keys(p),...j?[O]:[]])}),F},se=((r=c==null?void 0:c.currentPlatform)===null||r===void 0?void 0:r.registerPlugin)||oe;return l.convertFileSrc||(l.convertFileSrc=f=>f),l.getPlatform=d,l.handleError=re,l.isNativePlatform=C,l.isPluginAvailable=w,l.pluginMethodNoop=ae,l.registerPlugin=se,l.Exception=H,l.DEBUG=!!l.DEBUG,l.isLoggingEnabled=!!l.isLoggingEnabled,l.platform=l.getPlatform(),l.isNative=l.isNativePlatform(),l},$e=t=>t.Capacitor=Ve(t),I=$e(typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{}),X=I.registerPlugin;I.Plugins;class Y{constructor(e){this.listeners={},this.windowListeners={},e&&(console.warn(`Capacitor WebPlugin "${e.name}" config object was deprecated in v3 and will be removed in v4.`),this.config=e)}addListener(e,n){this.listeners[e]||(this.listeners[e]=[]),this.listeners[e].push(n);const o=this.windowListeners[e];o&&!o.registered&&this.addWindowListener(o);const r=async()=>this.removeListener(e,n),i=Promise.resolve({remove:r});return Object.defineProperty(i,"remove",{value:async()=>{console.warn("Using addListener() without 'await' is deprecated."),await r()}}),i}async removeAllListeners(){this.listeners={};for(const e in this.windowListeners)this.removeWindowListener(this.windowListeners[e]);this.windowListeners={}}notifyListeners(e,n){const s=this.listeners[e];s&&s.forEach(o=>o(n))}hasListeners(e){return!!this.listeners[e].length}registerWindowListener(e,n){this.windowListeners[n]={registered:!1,windowEventName:e,pluginEventName:n,handler:s=>{this.notifyListeners(n,s)}}}unimplemented(e="not implemented"){return new I.Exception(e,S.Unimplemented)}unavailable(e="not available"){return new I.Exception(e,S.Unavailable)}async removeListener(e,n){const s=this.listeners[e];if(!s)return;const o=s.indexOf(n);this.listeners[e].splice(o,1),this.listeners[e].length||this.removeWindowListener(this.windowListeners[e])}addWindowListener(e){window.addEventListener(e.windowEventName,e.handler),e.registered=!0}removeWindowListener(e){e&&(window.removeEventListener(e.windowEventName,e.handler),e.registered=!1)}}const z=t=>encodeURIComponent(t).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape),K=t=>t.replace(/(%[\dA-F]{2})+/gi,decodeURIComponent);class Be extends Y{async getCookies(){const e=document.cookie,n={};return e.split(";").forEach(s=>{if(s.length<=0)return;let[o,r]=s.replace(/=/,"CAP_COOKIE").split("CAP_COOKIE");o=K(o).trim(),r=K(r).trim(),n[o]=r}),n}async setCookie(e){try{const n=z(e.key),s=z(e.value),o=`; expires=${(e.expires||"").replace("expires=","")}`,r=(e.path||"/").replace("path=",""),i=e.url!=null&&e.url.length>0?`domain=${e.url}`:"";document.cookie=`${n}=${s||""}${o}; path=${r}; ${i};`}catch(n){return Promise.reject(n)}}async deleteCookie(e){try{document.cookie=`${e.key}=; Max-Age=0`}catch(n){return Promise.reject(n)}}async clearCookies(){try{const e=document.cookie.split(";")||[];for(const n of e)document.cookie=n.replace(/^ +/,"").replace(/=.*/,`=;expires=${new Date().toUTCString()};path=/`)}catch(e){return Promise.reject(e)}}async clearAllCookies(){try{await this.clearCookies()}catch(e){return Promise.reject(e)}}}const ee=X("CapacitorCookies",{web:()=>new Be}),Te=async t=>new Promise((e,n)=>{const s=new FileReader;s.onload=()=>{const o=s.result;e(o.indexOf(",")>=0?o.split(",")[1]:o)},s.onerror=o=>n(o),s.readAsDataURL(t)}),Ue=(t={})=>{const e=Object.keys(t);return Object.keys(t).map(o=>o.toLocaleLowerCase()).reduce((o,r,i)=>(o[r]=t[e[i]],o),{})},Ae=(t,e=!0)=>t?Object.entries(t).reduce((s,o)=>{const[r,i]=o;let l,u;return Array.isArray(i)?(u="",i.forEach(c=>{l=e?encodeURIComponent(c):c,u+=`${r}=${l}&`}),u.slice(0,-1)):(l=e?encodeURIComponent(i):i,u=`${r}=${l}`),`${s}&${u}`},"").substr(1):null,Re=(t,e={})=>{const n=Object.assign({method:t.method||"GET",headers:t.headers},e),o=Ue(t.headers)["content-type"]||"";if(typeof t.data=="string")n.body=t.data;else if(o.includes("application/x-www-form-urlencoded")){const r=new URLSearchParams;for(const[i,l]of Object.entries(t.data||{}))r.set(i,l);n.body=r.toString()}else if(o.includes("multipart/form-data")){const r=new FormData;if(t.data instanceof FormData)t.data.forEach((l,u)=>{r.append(u,l)});else for(const l of Object.keys(t.data))r.append(l,t.data[l]);n.body=r;const i=new Headers(n.headers);i.delete("content-type"),n.headers=i}else(o.includes("application/json")||typeof t.data=="object")&&(n.body=JSON.stringify(t.data));return n};class Ie extends Y{async request(e){const n=Re(e,e.webFetchExtra),s=Ae(e.params,e.shouldEncodeUrlParams),o=s?`${e.url}?${s}`:e.url,r=await fetch(o,n),i=r.headers.get("content-type")||"";let{responseType:l="text"}=r.ok?e:{};i.includes("application/json")&&(l="json");let u,c;switch(l){case"arraybuffer":case"blob":c=await r.blob(),u=await Te(c);break;case"json":u=await r.json();break;case"document":case"text":default:u=await r.text()}const m={};return r.headers.forEach((d,P)=>{m[P]=d}),{data:u,headers:m,status:r.status,url:r.url}}async get(e){return this.request(Object.assign(Object.assign({},e),{method:"GET"}))}async post(e){return this.request(Object.assign(Object.assign({},e),{method:"POST"}))}async put(e){return this.request(Object.assign(Object.assign({},e),{method:"PUT"}))}async patch(e){return this.request(Object.assign(Object.assign({},e),{method:"PATCH"}))}async delete(e){return this.request(Object.assign(Object.assign({},e),{method:"DELETE"}))}}X("CapacitorHttp",{web:()=>new Ie});const Me=W.axios.create({baseURL:process.env.API_URL,withCredentials:!0}),V=a.reactive({code:{value:"",type:"",method:"",isSended:!1,isValid:!1}});async function te(t,e,n){return await Me.post("/api/twofa/sendcode",{phone:t.phone.number,email:t.email,method:e,type:n}).then(s=>(V.code=s.data,V.code.isSended=!0,Promise.resolve(s.data)),s=>(console.log(s),L.setError(s),Promise.reject(s)))}a.watch(V,(t,e)=>{});const De=Object.freeze(Object.defineProperty({__proto__:null,sendCode:te,state:V},Symbol.toStringTag,{value:"Module"})),B=W.axios.create({baseURL:process.env.API_URL,withCredentials:!0}),h=a.reactive({user:{_id:"",username:"",email:"",phone:"",password:"",passwordRepeat:""},access:{roles:null,token:null,status:!1}});if(T.get("user")){const{_id:t,email:e,phone:n,roles:s,accessToken:o}=JSON.parse(T.get("user"));Object.assign(h.user,{_id:t,email:e,phone:n}),Object.assign(h.access,{token:o,roles:s,status:!!o}),B.interceptors.request.use(r=>(o&&(r.headers["x-access-token"]=o),r),r=>Promise.reject(r))}const ne={async login(t,e){try{const n=await B.post("/api/auth/signin",{...t,type:e});return q("user",n.data),Object.assign(h.user,{...n.data}),Object.assign(h.access,{token:n.data.accessToken,status:!0,roles:n.data.roles}),n.data}catch(n){return Object.assign(h.access,{token:null,status:!1,roles:null}),L.setError(n),Promise.reject(n)}},async signup(t,e,n){const{password:s,passwordRepeat:o}=h.user;if(s!==o){const r={response:{data:{errorCode:"PASSWORDS_DO_NOT_MATCH"}}};throw L.setError(r),new Error(r.response.status)}try{t.phone=t.phone.number;const r=await B.post("/api/auth/signup",{...t,type:e,inviteCode:n});return r.data.accessToken&&q("user",r.data),Object.assign(h.user,{...r.data}),Object.assign(h.access,{token:r.data.accessToken,status:!0,roles:r.data.roles}),r.data}catch(r){throw L.setError(r),console.log("Sign up falied"),r}},logout(){He("user"),Object.assign(h.user,{email:"",phone:"",password:"",passwordRepeat:""}),Object.assign(h.access,{token:null,status:!1})},async resetPassword(t,e){try{const n=await B.post("/api/auth/reset-password",{email:t.email,phone:t.phone.number,type:e});return Object.assign(V.code,{...n.data,isSended:!0}),n.data}catch(n){return L.setError(n),Promise.reject(n)}},async updatePassword(t,e){const{password:n,passwordRepeat:s}=h.user;if(n!==s){const o={response:{data:{errorCode:"PASSWORDS_DO_NOT_MATCH"}}};throw L.setError(o),new Error(o.response.status)}try{const o=await B.post("/api/auth/update-password",{email:t.email,phone:t.phone.number,password:t.password,passwordRepeat:t.passwordRepeat,type:e});return o.data.accessToken&&q("user",o.data),Object.assign(h.user,{...o.data}),Object.assign(h.access,{token:o.data.accessToken,status:!0}),o.data}catch(o){return L.setError(o),Promise.reject(o)}}},Fe={development:{secure:!1,expires:1},production:{expires:1,domain:process.env.API_URL,sameSite:"none",secure:!0}};function q(t,e,n=process.env.NODE_ENV){process.env.MOBILE_APP?ee.setCookie({url:process.env.API_URL,key:t,value:JSON.stringify(e)}):T.set(t,JSON.stringify(e),Fe[n])}function He(t,e=process.env.NODE_ENV){if(process.env.MOBILE_APP)ee.deleteCookie({url:process.env.API_URL,key:t});else{const n=e==="production"?{domain:process.env.API_URL}:{};T.remove(t,n)}}a.watch(h,(t,e)=>{});const qe=Object.freeze(Object.defineProperty({__proto__:null,actions:ne,state:h},Symbol.toStringTag,{value:"Module"}));exports.Cookies=T;exports.Field=ve;exports._sfc_main=Oe;exports.actions=ne;exports.auth=qe;exports.sendCode=te;exports.state=h;exports.state$1=V;exports.twofa=De;
|