Publish the verified user build output. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 line
8.3 KiB
JavaScript
1 line
8.3 KiB
JavaScript
import{$ as e,C as t,E as n,J as r,Q as i,U as a,X as o,Y as s,Z as c,c as l,ct as u,et as d,nt as f,ot as p,st as m,w as h}from"./_plugin-vue_export-helper-1xMDlcEE.js";var g=typeof window<`u`,_,v=e=>_=e,y=Symbol();function b(e){return e&&typeof e==`object`&&Object.prototype.toString.call(e)===`[object Object]`&&typeof e.toJSON!=`function`}var x=typeof window==`object`&&window.window===window?window:typeof self==`object`&&self.self===self?self:typeof global==`object`&&global.global===global?global:typeof globalThis==`object`?globalThis:{HTMLElement:null};function S(e,{autoBom:t=!1}={}){return t&&/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(e.type)?new Blob([``,e],{type:e.type}):e}function C(e,t,n){let r=new XMLHttpRequest;r.open(`GET`,e),r.responseType=`blob`,r.onload=function(){O(r.response,t,n)},r.onerror=function(){console.error(`could not download file`)},r.send()}function w(e){let t=new XMLHttpRequest;t.open(`HEAD`,e,!1);try{t.send()}catch{}return t.status>=200&&t.status<=299}function T(e){try{e.dispatchEvent(new MouseEvent(`click`))}catch{let t=new MouseEvent(`click`,{bubbles:!0,cancelable:!0,view:window,detail:0,screenX:80,screenY:20,clientX:80,clientY:20,ctrlKey:!1,altKey:!1,shiftKey:!1,metaKey:!1,button:0,relatedTarget:null});e.dispatchEvent(t)}}var E=typeof navigator==`object`?navigator:{userAgent:``},D=/Macintosh/.test(E.userAgent)&&/AppleWebKit/.test(E.userAgent)&&!/Safari/.test(E.userAgent),O=g?typeof HTMLAnchorElement<`u`&&`download`in HTMLAnchorElement.prototype&&!D?k:`msSaveOrOpenBlob`in E?A:j:()=>{};function k(e,t=`download`,n){let r=document.createElement(`a`);r.download=t,r.rel=`noopener`,typeof e==`string`?(r.href=e,r.origin===location.origin?T(r):w(r.href)?C(e,t,n):(r.target=`_blank`,T(r))):(r.href=URL.createObjectURL(e),setTimeout(function(){URL.revokeObjectURL(r.href)},4e4),setTimeout(function(){T(r)},0))}function A(e,t=`download`,n){if(typeof e==`string`)if(w(e))C(e,t,n);else{let t=document.createElement(`a`);t.href=e,t.target=`_blank`,setTimeout(function(){T(t)})}else navigator.msSaveOrOpenBlob(S(e,n),t)}function j(e,t,n,r){if(r||=open(``,`_blank`),r&&(r.document.title=r.document.body.innerText=`downloading...`),typeof e==`string`)return C(e,t,n);let i=e.type===`application/octet-stream`,a=/constructor/i.test(String(x.HTMLElement))||`safari`in x,o=/CriOS\/[\d]+/.test(navigator.userAgent);if((o||i&&a||D)&&typeof FileReader<`u`){let t=new FileReader;t.onloadend=function(){let e=t.result;if(typeof e!=`string`)throw r=null,Error(`Wrong reader.result type`);e=o?e:e.replace(/^data:[^;]*;/,`data:attachment/file;`),r?r.location.href=e:location.assign(e),r=null},t.readAsDataURL(e)}else{let t=URL.createObjectURL(e);r?r.location.assign(t):location.href=t,r=null,setTimeout(function(){URL.revokeObjectURL(t)},4e4)}}var{assign:ee}=Object;function M(){let e=r(!0),t=e.run(()=>f({})),n=[],a=[],o=i({install(e){v(o),o._a=e,e.provide(y,o),e.config.globalProperties.$pinia=o,a.forEach(e=>n.push(e)),a=[]},use(e){return this._a?n.push(e):a.push(e),this},_p:n,_a:null,_e:e,_s:new Map,state:t});return o}var N=()=>{};function P(t,n,r,i=N){t.add(n);let a=()=>{t.delete(n)&&i()};return!r&&s()&&e(a),a}function F(e,...t){e.forEach(e=>{e(...t)})}var I=e=>e(),L=Symbol(),R=Symbol();function z(e,t){e instanceof Map&&t instanceof Map?t.forEach((t,n)=>e.set(n,t)):e instanceof Set&&t instanceof Set&&t.forEach(e.add,e);for(let n in t){if(!Object.hasOwn(t,n))continue;let r=t[n],i=e[n];e[n]=b(i)&&b(r)&&Object.hasOwn(e,n)&&!c(r)&&!o(r)?z(i,r):r}return e}var B=Symbol();function V(e){return!e||typeof e!=`object`||!Object.hasOwn(e,B)}var{assign:H}=Object;function U(e){return!!(c(e)&&e.effect)}function W(e,t,n,r){let{state:a,actions:o,getters:s}=t,c=n.state.value[e],d;function f(){return c||(n.state.value[e]=a?a():{}),H(u(n.state.value[e]),o,Object.keys(s||{}).reduce((t,r)=>(t[r]=i(l(()=>{v(n);let t=n._s.get(e);return s[r].call(t,t)})),t),{}))}return d=G(e,f,t,n,r,!0),d}function G(e,t,i={},s,l,u){let f,m=H({actions:{}},i),h={deep:!0},g,_,y=new Set,b=new Set,x,S=s.state.value[e];!u&&!S&&(s.state.value[e]={});let C;function w(t){let r;g=_=!1,typeof t==`function`?(t(s.state.value[e]),r={type:`patch function`,storeId:e,events:x}):(z(s.state.value[e],t),r={type:`patch object`,payload:t,storeId:e,events:x});let i=C=Symbol();n().then(()=>{C===i&&(g=!0)}),_=!0,F(y,r,s.state.value[e])}let T=u?function(){let{state:e}=i,t=e?e():{};this.$patch(e=>{H(e,t)})}:N;function E(){f.stop(),y.clear(),b.clear(),s._s.delete(e)}let D=(t,n=``)=>{if(L in t)return t[R]=n,t;let r=function(){v(s);let n=Array.from(arguments),i=new Set,a=new Set;function o(e){i.add(e)}function c(e){a.add(e)}F(b,{args:n,name:r[R],store:k,after:o,onError:c});let l;try{l=t.apply(this&&this.$id===e?this:k,n)}catch(e){throw F(a,e),e}return l instanceof Promise?l.then(e=>(F(i,e),e)).catch(e=>(F(a,e),Promise.reject(e))):(F(i,l),l)};return r[L]=!0,r[R]=n,r},O={_p:s,$id:e,$onAction:P.bind(null,b),$patch:w,$reset:T,$subscribe(t,n={}){if(y.has(t))return N;let r=P(y,t,n.detached,()=>i()),i=f.run(()=>a(()=>s.state.value[e],r=>{(n.flush===`sync`?_:g)&&t({storeId:e,type:`direct`,events:x},r)},H({},h,n)));return r},$dispose:E},k=d(O);s._s.set(e,k);let A=(s._a&&s._a.runWithContext||I)(()=>s._e.run(()=>(f=r()).run(()=>t({action:D}))));for(let t in A){let n=A[t];c(n)&&!U(n)||o(n)?u||(S&&V(n)&&(c(n)?n.value=S[t]:z(n,S[t])),s.state.value[e][t]=n):typeof n==`function`&&(A[t]=D(n,t),m.actions[t]=n)}return H(k,A),H(p(k),A),Object.defineProperty(k,"$state",{get:()=>s.state.value[e],set:e=>{w(t=>{H(t,e)})}}),s._p.forEach(e=>{let t=f.run(()=>e({store:k,app:s._a,pinia:s,options:m}));H(k,t)}),S&&u&&i.hydrate&&i.hydrate(k.$state,S),g=!0,_=!0,k}function K(e,n,r){let i,a=typeof n==`function`;i=a?r:n;function o(r,o){let s=t();return r||=s?h(y,null):null,r&&v(r),r=_,r._s.has(e)||(a?G(e,n,i,r):W(e,i,r)),r._s.get(e)}return o.$id=e,o}function q(e){let t=p(e),n={};for(let r in t){let i=t[r];i?.effect?n[r]=l({get:()=>e[r],set(t){e[r]=t}}):(c(i)||o(i))&&(n[r]=m(e,r))}return n}var J=`ft_access_token`;function Y(){return`https://nademitex.montest.ir/server/api`.replace(/\/$/,``)||`https://nademitex.montest.ir/server/api`}function X(){return localStorage.getItem(J)}function Z(e){e?localStorage.setItem(J,e):localStorage.removeItem(J)}var Q=class extends Error{status;constructor(e,t){super(t),this.status=e}};function $(e,t){let n=Y(),r=e.startsWith(`http`)?e:`${n.replace(/\/$/,``)}/${e.replace(/^\//,``)}`,i=r.startsWith(`http`)?new URL(r):new URL(r,typeof window<`u`?window.location.origin:`http://127.0.0.1`);if(t)for(let[e,n]of Object.entries(t))n!=null&&n!==``&&i.searchParams.set(e,String(n));return i.toString()}function te(e,t){if(typeof e==`object`&&e){if(`message`in e){let t=e.message;if(Array.isArray(t))return t.join(`، `);if(t!=null&&String(t).trim())return String(t)}if(`error`in e){let n=e.error;if(typeof n==`string`&&n.trim())return`${n} (${t})`}}if(typeof e==`string`){if(/upstream error/i.test(e))return`سرور API در دسترس نیست. کمی بعد دوباره تلاش کنید.`;if(e.trim()&&!e.trimStart().startsWith(`<`))return e.trim().slice(0,200)}return t===400?`درخواست نامعتبر است. اطلاعات سفارش را بررسی کنید.`:t===401?`نشست شما منقضی شده است. دوباره وارد شوید.`:`خطای سرور (${t})`}async function ne(e,t={}){let n={Accept:`application/json`};if(t.body!==void 0&&(n[`Content-Type`]=`application/json`),t.auth!==!1){let e=X();e&&(n.Authorization=`Bearer ${e}`)}let r;try{r=await fetch($(e,t.query),{method:t.method??(t.body===void 0?`GET`:`POST`),headers:n,body:t.body===void 0?void 0:JSON.stringify(t.body),signal:AbortSignal.timeout(2e4)})}catch(e){throw new Q(0,e instanceof DOMException&&e.name===`TimeoutError`||e instanceof Error&&e.name===`TimeoutError`?`پاسخ سرور طول کشید. دوباره تلاش کنید.`:`اتصال به سرور برقرار نشد. اینترنت یا آدرس API را بررسی کنید.`)}let i=await r.text(),a=null;if(i)try{a=JSON.parse(i)}catch{a=i}if(!r.ok){if(r.status===401&&t.auth!==!1){Z(null);try{localStorage.removeItem(`ft_user`)}catch{}let e=`/login`;if(typeof window<`u`&&!window.location.pathname.startsWith(e)){let t=encodeURIComponent(`${window.location.pathname}${window.location.search}`);window.location.assign(`${e}?redirect=${t}`)}}throw new Q(r.status,te(a,r.status))}return a}export{M as a,Z as i,ne as n,K as o,X as r,q as s,Q as t}; |