@qwanyx/stack 0.2.13 → 0.2.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs.js CHANGED
@@ -1,4 +1,31 @@
1
- "use strict";var wt=Object.defineProperty;var Et=(h,t,r)=>t in h?wt(h,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):h[t]=r;var xe=(h,t,r)=>Et(h,typeof t!="symbol"?t+"":t,r);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const x=require("react");class _t{constructor(t){xe(this,"config");xe(this,"defaultUploadOptions",{maxSizeMB:10,maxImageDimension:0,imageQuality:.9});if(!t.system_id)throw new Error("GraphClient: system_id is REQUIRED. No system_id → No start.");this.config=t}async callGraph(t,r={}){const s={coprocessor:"graph",method:t,system_id:this.config.system_id,params:r};try{const i=await fetch(`${this.config.baseUrl}/spu/invoke`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.getToken()}`},body:JSON.stringify(s)});if(!i.ok){const o=await i.text();throw new Error(`API error (${i.status}): ${o}`)}const n=await i.json();if(!n.success&&n.error)throw new Error(n.error);return n}catch(i){throw console.error("Graph API call failed:",i),i}}getToken(){return typeof window<"u"&&window.localStorage&&localStorage.getItem("qwanyx_token")||""}async getChildren(t){return(await this.callGraph("get_children",{parent_id:t})).result||[]}async getNode(t){return(await this.callGraph("get_node",{node_id:t})).result||null}async addNode(t){const r={...t,created:t.created||new Date().toISOString(),modified:new Date().toISOString()},s=await this.callGraph("add_node",r);if(!s.result)throw new Error("Failed to add node");return s.result}async updateNode(t,r){const s={node_id:t,updates:{...r,modified:new Date().toISOString()}},i=await this.callGraph("update_node",s);if(!i.result)throw new Error("Failed to update node");return i.result}async deleteNode(t,r=!1){return(await this.callGraph("delete_node",{node_id:t,cascade:r})).success===!0}async getChildrenWithEdges(t,r="children",s,i){return(await this.callGraph("get_children_with_edges",{node_id:t,display_mode:r,edge_type:s,node_type:i})).result||[]}async addEdge(t,r,s="link",i){return await this.callGraph("add_edge",{source_id:t,target_id:r,edge_type:s,data:i})}async deleteEdge(t,r,s){return await this.callGraph("delete_edge",{source_id:t,target_id:r,edge_type:s})}async getEdges(t,r,s){return(await this.callGraph("get_edges",{source_id:t,edge_type:r,target_id:s})).result||[]}async getAncestors(t){return(await this.callGraph("get_ancestors",{node_id:t})).ancestors||[]}async getTree(t,r=10){return(await this.callGraph("get_tree",{root_id:t,max_depth:r})).tree||[]}async moveNode(t,r){const s=await this.callGraph("move",{node_id:t,new_parent_id:r});if(!s.node)throw new Error("Failed to move node");return s.node}async searchNodes(t,r){return(await this.callGraph("search",{query:t,type:r})).nodes||[]}async getNodesByType(t){return(await this.callGraph("get_nodes_by_type",{type:t})).result||[]}fileToBase64(t){return new Promise((r,s)=>{const i=new FileReader;i.onload=()=>{const o=i.result.split(",")[1];r(o)},i.onerror=()=>s(new Error("Failed to read file")),i.readAsDataURL(t)})}async resizeImage(t,r,s){return t.type.startsWith("image/")?new Promise(i=>{const n=new Image,o=URL.createObjectURL(t);n.onload=()=>{if(URL.revokeObjectURL(o),n.width<=r&&n.height<=r){i(t);return}let p,d;n.width>n.height?(p=r,d=Math.round(n.height/n.width*r)):(d=r,p=Math.round(n.width/n.height*r));const g=document.createElement("canvas");g.width=p,g.height=d;const c=g.getContext("2d");if(!c){i(t);return}c.drawImage(n,0,0,p,d);const j=t.type==="image/png"?"image/png":"image/jpeg";g.toBlob(v=>{if(v){const m=new File([v],t.name,{type:j});i(m)}else i(t)},j,s)},n.onerror=()=>{URL.revokeObjectURL(o),i(t)},n.src=o}):t}async uploadFile(t,r,s,i={}){const n={...this.defaultUploadOptions,...i};try{let o=s;n.maxImageDimension>0&&s.type.startsWith("image/")&&(o=await this.resizeImage(s,n.maxImageDimension,n.imageQuality));const p=n.maxSizeMB*1024*1024;if(o.size>p)return{success:!1,error:`File too large (${(o.size/1024/1024).toFixed(1)} MB). Max: ${n.maxSizeMB} MB`};const d=await this.fileToBase64(o),g=await this.callGraph("upload_file",{node_id:t,filename:r,content:d});return g.success?{success:!0,path:g.path}:{success:!1,error:g.error||"Upload failed"}}catch(o){return{success:!1,error:o instanceof Error?o.message:"Upload failed"}}}async listFiles(t){var i;return(((i=(await this.callGraph("list_files",{node_id:t})).result)==null?void 0:i.files)||[]).map(n=>({filename:n.name,path:n.path}))}async deleteFile(t,r){return{success:(await this.callGraph("delete_file",{node_id:t,filename:r})).success||!1}}getFileUrl(t,r){return`${this.config.baseUrl}/files/${this.config.system_id}/${t}/${r}`}}class et{constructor(t){xe(this,"config");if(!t.system_id)throw new Error("MailClient: system_id is REQUIRED");this.config=t}async callCoprocessor(t,r,s={}){const i={coprocessor:t,method:r,system_id:this.config.system_id,params:{user_id:this.config.system_id,...s}};try{const n=await fetch(`${this.config.baseUrl}/spu/invoke`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.getToken()}`},body:JSON.stringify(i)});if(!n.ok){const p=await n.text();throw new Error(`API error (${n.status}): ${p}`)}const o=await n.json();if(!o.success&&o.error)throw new Error(o.error);return o.result}catch(n){throw console.error("API call failed:",n),n}}async callMail(t,r={}){return this.callCoprocessor("mail",t,r)}async callEmail(t,r={}){return this.callCoprocessor("email",t,r)}getToken(){return typeof window<"u"&&window.localStorage&&localStorage.getItem("qwanyx_token")||""}async getSettings(){try{return await this.callMail("get_email_settings")||{accounts:[]}}catch{return{accounts:[]}}}async saveSettings(t){await this.callMail("save_email_settings",{accounts:t})}async listEmails(t,r=20,s){return this.callMail("list_emails",{account_id:t,limit:r,folder:s})}async deleteEmails(t,r,s=!0){return this.callMail("delete_emails",{account_id:t,uids:r,expunge:s})}async imapExec(t,r){return this.callMail("imap_exec",{account_id:t,commands:r})}async trashEmails(t,r){const s=["[Gmail]/Trash","[Gmail]/Corbeille","[Gmail]/Bin","Trash"];for(const i of s){const n=["SELECT INBOX",...r.map(d=>`UID MOVE ${d} ${i}`)],p=(await this.imapExec(t,n)).responses.filter(d=>d.ok&&d.command==="UID MOVE").length;if(p>0)return{success:!0,moved:p}}return{success:!1,moved:0}}async archiveEmails(t,r){const s=["SELECT INBOX",...r.map(o=>`UID STORE ${o} +FLAGS (\\Deleted)`),"EXPUNGE"],n=(await this.imapExec(t,s)).responses.filter(o=>o.ok&&o.command==="UID STORE").length;return{success:n>0,archived:n}}async listFolders(t){const s=(await this.imapExec(t,['LIST "" *'])).responses.find(i=>i.command==="LIST");return s!=null&&s.ok&&s.folders?{success:!0,folders:s.folders}:{success:!1,folders:[]}}async listEmailsSorted(t,r="INBOX",s=20){const i=await this.imapExec(t,[`SELECT ${r}`,"FETCH 1:* (UID INTERNALDATE)"]),n=i.responses.find(m=>m.command==="SELECT");if(!(n!=null&&n.ok))throw new Error(`Failed to select folder: ${(n==null?void 0:n.error)||"Unknown error"}`);const o=i.responses.find(m=>m.command==="FETCH");if(!(o!=null&&o.ok)||!o.messages)return{account:{id:t,label:"",email:""},mailbox:{name:r,total:n.exists||0},messages:[]};const d=[...o.messages].sort((m,k)=>{const C=m.internalDate?new Date(m.internalDate).getTime():0;return(k.internalDate?new Date(k.internalDate).getTime():0)-C}).slice(0,s).map(m=>m.uid).filter(Boolean);if(d.length===0)return{account:{id:t,label:"",email:""},mailbox:{name:r,total:n.exists||0},messages:[]};const c=(await this.imapExec(t,[`SELECT ${r}`,`UID FETCH ${d.join(",")} (UID FLAGS ENVELOPE)`])).responses.find(m=>m.command==="UID FETCH");if(!(c!=null&&c.ok)||!c.messages)throw new Error(`Failed to fetch details: ${(c==null?void 0:c.error)||"Unknown error"}`);const j=new Map;for(const m of c.messages)m.uid&&j.set(m.uid,m);const v=d.map(m=>{var W,E,M,y,N;const k=j.get(m);if(!k)return null;const C=((W=k.flags)==null?void 0:W.some(D=>D.includes("Seen")))||!1,V=((M=(E=k.envelope)==null?void 0:E.from)==null?void 0:M.email)||"Unknown",I=((y=k.envelope)==null?void 0:y.subject)||"(No subject)",F=((N=k.envelope)==null?void 0:N.date)||"";return{uid:m,from:V,subject:I,date:F,seen:C}}).filter(Boolean);return{account:{id:t,label:"",email:""},mailbox:{name:r,total:n.exists||0},messages:v}}async getEmail(t,r){return this.callMail("get_email",{account_id:t,uid:r})}async sendMail(t){const r={to:t.to,subject:t.subject,body:t.body};return t.html&&(r.html=t.html),t.from&&(r.from=t.from),t.smtpConfig&&(r.smtp_config=t.smtpConfig),this.callEmail("send",r)}}const Le="qwanyx_auth_token",ze="qwanyx_refresh_token";class tt{static setToken(t){typeof window<"u"&&localStorage.setItem(Le,t)}static getToken(){return typeof window<"u"?localStorage.getItem(Le):null}static clearToken(){typeof window<"u"&&(localStorage.removeItem(Le),localStorage.removeItem(ze))}static setRefreshToken(t){typeof window<"u"&&localStorage.setItem(ze,t)}static getRefreshToken(){return typeof window<"u"?localStorage.getItem(ze):null}static isAuthenticated(){return!!this.getToken()}static getAuthHeader(){const t=this.getToken();return t?{Authorization:`Bearer ${t}`}:{}}}class rt{constructor(t){xe(this,"config");this.config={timeout:3e4,headers:{"Content-Type":"application/json"},...t}}buildQueryString(t){if(!t||Object.keys(t).length===0)return"";const r=new URLSearchParams;Object.entries(t).forEach(([i,n])=>{n!=null&&r.append(i,String(n))});const s=r.toString();return s?`?${s}`:""}async request(t,r={}){const{method:s="GET",headers:i={},body:n,params:o}=r,p=`${this.config.baseUrl}/${t}${this.buildQueryString(o)}`,d={...this.config.headers,...tt.getAuthHeader(),...i},g={method:s,headers:d};n&&s!=="GET"&&(g.body=JSON.stringify(n));try{const c=new AbortController,j=setTimeout(()=>c.abort(),this.config.timeout),v=await fetch(p,{...g,signal:c.signal});if(clearTimeout(j),!v.ok){const m=await v.json().catch(()=>({message:v.statusText}));throw new Error(m.message||`HTTP ${v.status}`)}return await v.json()}catch(c){throw c instanceof Error?c:new Error("An unexpected error occurred")}}async get(t,r){return this.request(t,{method:"GET",params:r})}async post(t,r,s){return this.request(t,{method:"POST",body:r,params:s})}async put(t,r,s){return this.request(t,{method:"PUT",body:r,params:s})}async patch(t,r,s){return this.request(t,{method:"PATCH",body:r,params:s})}async delete(t,r){return this.request(t,{method:"DELETE",params:r})}setBaseUrl(t){this.config.baseUrl=t}getBaseUrl(){return this.config.baseUrl}}let Re=null;function jt(h){return Re=new rt(h),Re}function We(){if(!Re)throw new Error("API client not initialized. Call initializeApiClient() first.");return Re}function st(h,t,r={}){const{enabled:s=!0,refetchOnMount:i=!0,onSuccess:n,onError:o}=r,[p,d]=x.useState(null),[g,c]=x.useState(s),[j,v]=x.useState(null),m=x.useCallback(async()=>{if(s){c(!0),v(null);try{const C=await We().get(h,t);d(C),n==null||n(C)}catch(k){const C=k instanceof Error?k:new Error("Unknown error");v(C),o==null||o(C)}finally{c(!1)}}},[h,JSON.stringify(t),s,n,o]);return x.useEffect(()=>{i&&m()},[m,i]),{data:p,loading:g,error:j,refetch:m}}function St(h,t="POST",r={}){const{onSuccess:s,onError:i}=r,[n,o]=x.useState(null),[p,d]=x.useState(!1),[g,c]=x.useState(null),j=x.useCallback(async m=>{d(!0),c(null);try{const k=We();let C;switch(t){case"POST":C=await k.post(h,m);break;case"PUT":C=await k.put(h,m);break;case"PATCH":C=await k.patch(h,m);break;case"DELETE":C=await k.delete(h);break;default:throw new Error(`Unsupported method: ${t}`)}return o(C),s==null||s(C,m),C}catch(k){const C=k instanceof Error?k:new Error("Unknown error");return c(C),i==null||i(C,m),null}finally{d(!1)}},[h,t,s,i]),v=x.useCallback(()=>{o(null),c(null),d(!1)},[]);return{data:n,loading:p,error:g,mutate:j,reset:v}}var Ge={exports:{}},ve={};/**
1
+ "use strict";var Mt=Object.defineProperty;var zt=(o,e,r)=>e in o?Mt(o,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):o[e]=r;var ye=(o,e,r)=>zt(o,typeof e!="symbol"?e+"":e,r);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const v=require("react");class Gt{constructor(e){ye(this,"config");ye(this,"defaultUploadOptions",{maxSizeMB:10,maxImageDimension:0,imageQuality:.9});if(!e.system_id)throw new Error("GraphClient: system_id is REQUIRED. No system_id → No start.");this.config=e}async callGraph(e,r={}){const u={coprocessor:"graph",method:e,system_id:this.config.system_id,params:r};try{const a=await fetch(`${this.config.baseUrl}/spu/invoke`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.getToken()}`},body:JSON.stringify(u)});if(!a.ok){const t=await a.text();throw new Error(`API error (${a.status}): ${t}`)}const n=await a.json();if(!n.success&&n.error)throw new Error(n.error);return n}catch(a){throw console.error("Graph API call failed:",a),a}}getToken(){return typeof window<"u"&&window.localStorage&&localStorage.getItem("qwanyx_token")||""}async getChildren(e){return(await this.callGraph("get_children",{parent_id:e})).result||[]}async getNode(e){return(await this.callGraph("get_node",{node_id:e})).result||null}async addNode(e){const r={...e,created:e.created||new Date().toISOString(),modified:new Date().toISOString()},u=await this.callGraph("add_node",r);if(!u.result)throw new Error("Failed to add node");return u.result}async updateNode(e,r){const u={node_id:e,updates:{...r,modified:new Date().toISOString()}},a=await this.callGraph("update_node",u);if(!a.result)throw new Error("Failed to update node");return a.result}async deleteNode(e,r=!1){return(await this.callGraph("delete_node",{node_id:e,cascade:r})).success===!0}async getChildrenWithEdges(e,r="children",u,a){return(await this.callGraph("get_children_with_edges",{node_id:e,display_mode:r,edge_type:u,node_type:a})).result||[]}async addEdge(e,r,u="link",a){return await this.callGraph("add_edge",{source_id:e,target_id:r,edge_type:u,data:a})}async deleteEdge(e,r,u){return await this.callGraph("delete_edge",{source_id:e,target_id:r,edge_type:u})}async getEdges(e,r,u){return(await this.callGraph("get_edges",{source_id:e,edge_type:r,target_id:u})).result||[]}async getAncestors(e){return(await this.callGraph("get_ancestors",{node_id:e})).ancestors||[]}async getTree(e,r=10){return(await this.callGraph("get_tree",{root_id:e,max_depth:r})).tree||[]}async moveNode(e,r){const u=await this.callGraph("move",{node_id:e,new_parent_id:r});if(!u.node)throw new Error("Failed to move node");return u.node}async searchNodes(e,r){return(await this.callGraph("search",{query:e,type:r})).nodes||[]}async getNodesByType(e){return(await this.callGraph("get_nodes_by_type",{type:e})).result||[]}fileToBase64(e){return new Promise((r,u)=>{const a=new FileReader;a.onload=()=>{const t=a.result.split(",")[1];r(t)},a.onerror=()=>u(new Error("Failed to read file")),a.readAsDataURL(e)})}async resizeImage(e,r,u){return e.type.startsWith("image/")?new Promise(a=>{const n=new Image,t=URL.createObjectURL(e);n.onload=()=>{if(URL.revokeObjectURL(t),n.width<=r&&n.height<=r){a(e);return}let i,l;n.width>n.height?(i=r,l=Math.round(n.height/n.width*r)):(l=r,i=Math.round(n.width/n.height*r));const d=document.createElement("canvas");d.width=i,d.height=l;const c=d.getContext("2d");if(!c){a(e);return}c.drawImage(n,0,0,i,l);const h=e.type==="image/png"?"image/png":"image/jpeg";d.toBlob(m=>{if(m){const A=new File([m],e.name,{type:h});a(A)}else a(e)},h,u)},n.onerror=()=>{URL.revokeObjectURL(t),a(e)},n.src=t}):e}async uploadFile(e,r,u,a={}){const n={...this.defaultUploadOptions,...a};try{let t=u;n.maxImageDimension>0&&u.type.startsWith("image/")&&(t=await this.resizeImage(u,n.maxImageDimension,n.imageQuality));const i=n.maxSizeMB*1024*1024;if(t.size>i)return{success:!1,error:`File too large (${(t.size/1024/1024).toFixed(1)} MB). Max: ${n.maxSizeMB} MB`};const l=await this.fileToBase64(t),d=await this.callGraph("upload_file",{node_id:e,filename:r,content:l});return d.success?{success:!0,path:d.path}:{success:!1,error:d.error||"Upload failed"}}catch(t){return{success:!1,error:t instanceof Error?t.message:"Upload failed"}}}async listFiles(e){var a;return(((a=(await this.callGraph("list_files",{node_id:e})).result)==null?void 0:a.files)||[]).map(n=>({filename:n.name,path:n.path}))}async deleteFile(e,r){return{success:(await this.callGraph("delete_file",{node_id:e,filename:r})).success||!1}}getFileUrl(e,r){return`${this.config.baseUrl}/files/${this.config.system_id}/${e}/${r}`}}const fe=new TextEncoder,ct="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",xe=new Uint8Array(256);for(var Re=0;Re<ct.length;Re++)xe[ct.charCodeAt(Re)]=Re;function et(o){let e=Math.ceil(o.length/4)*3;const r=o.length;let u=0;o.length%4===3?e--:o.length%4===2?e-=2:o[o.length-1]==="="&&(e--,o[o.length-2]==="="&&e--);const a=new ArrayBuffer(e),n=new Uint8Array(a);for(let t=0;t<r;t+=4){let i=xe[o.charCodeAt(t)],l=xe[o.charCodeAt(t+1)],d=xe[o.charCodeAt(t+2)],c=xe[o.charCodeAt(t+3)];n[u++]=i<<2|l>>4,n[u++]=(l&15)<<4|d>>2,n[u++]=(d&3)<<6|c&63}return a}function Ce(o){o=o||"utf8";let e;try{e=new TextDecoder(o)}catch{e=new TextDecoder("windows-1252")}return e}async function Oe(o){if("arrayBuffer"in o)return await o.arrayBuffer();const e=new FileReader;return new Promise((r,u)=>{e.onload=function(a){r(a.target.result)},e.onerror=function(a){u(e.error)},e.readAsArrayBuffer(o)})}function dt(o){return o>=48&&o<=57||o>=97&&o<=102||o>=65&&o<=70?String.fromCharCode(o):!1}function Ht(o,e,r){let u=o.indexOf("*");u>=0&&(o=o.substr(0,u)),e=e.toUpperCase();let a;if(e==="Q"){r=r.replace(/=\s+([0-9a-fA-F])/g,"=$1").replace(/[_\s]/g," ");let n=fe.encode(r),t=[];for(let l=0,d=n.length;l<d;l++){let c=n[l];if(l<=d-2&&c===61){let h=dt(n[l+1]),m=dt(n[l+2]);if(h&&m){let A=parseInt(h+m,16);t.push(A),l+=2;continue}}t.push(c)}a=new ArrayBuffer(t.length);let i=new DataView(a);for(let l=0,d=t.length;l<d;l++)i.setUint8(l,t[l])}else e==="B"?a=et(r.replace(/[^a-zA-Z0-9\+\/=]+/g,"")):a=fe.encode(r);return Ce(o).decode(a)}function we(o){let e=!0;for(;;){let r=(o||"").toString().replace(/(=\?([^?]+)\?[Bb]\?([^?]*)\?=)\s*(?==\?([^?]+)\?[Bb]\?[^?]*\?=)/g,(u,a,n,t,i)=>e&&n===i&&t.length%4===0&&!/=$/.test(t)?a+"__\0JOIN\0__":u).replace(/(=\?([^?]+)\?[Qq]\?[^?]*\?=)\s*(?==\?([^?]+)\?[Qq]\?[^?]*\?=)/g,(u,a,n,t)=>e&&n===t?a+"__\0JOIN\0__":u).replace(/(\?=)?__\x00JOIN\x00__(=\?([^?]+)\?[QqBb]\?)?/g,"").replace(/(=\?[^?]+\?[QqBb]\?[^?]*\?=)\s+(?==\?[^?]+\?[QqBb]\?[^?]*\?=)/g,"$1").replace(/=\?([\w_\-*]+)\?([QqBb])\?([^?]*)\?=/g,(u,a,n,t)=>Ht(a,n,t));if(e&&r.indexOf("�")>=0)e=!1;else return r}}function Vt(o,e){e=e||"utf-8";let r=[];for(let n=0;n<o.length;n++){let t=o.charAt(n);if(t==="%"&&/^[a-f0-9]{2}/i.test(o.substr(n+1,2))){let i=o.substr(n+1,2);n+=2,r.push(parseInt(i,16))}else if(t.charCodeAt(0)>126){t=fe.encode(t);for(let i=0;i<t.length;i++)r.push(t[i])}else r.push(t.charCodeAt(0))}const u=new ArrayBuffer(r.length),a=new DataView(u);for(let n=0,t=r.length;n<t;n++)a.setUint8(n,r[n]);return Ce(e).decode(u)}function Wt(o){let e=new Map;Object.keys(o.params).forEach(r=>{let u=r.match(/\*((\d+)\*?)?$/);if(!u)return;let a=r.substr(0,u.index).toLowerCase(),n=Number(u[2])||0,t;e.has(a)?t=e.get(a):(t={charset:!1,values:[]},e.set(a,t));let i=o.params[r];n===0&&u[0].charAt(u[0].length-1)==="*"&&(u=i.match(/^([^']*)'[^']*'(.*)$/))&&(t.charset=u[1]||"utf-8",i=u[2]),t.values.push({nr:n,value:i}),delete o.params[r]}),e.forEach((r,u)=>{o.params[u]=Vt(r.values.sort((a,n)=>a.nr-n.nr).map(a=>a.value).join(""),r.charset)})}class Qt{constructor(){this.chunks=[]}update(e){this.chunks.push(e),this.chunks.push(`
2
+ `)}finalize(){return Oe(new Blob(this.chunks,{type:"application/octet-stream"}))}}class Yt{constructor(e){e=e||{},this.decoder=e.decoder||new TextDecoder,this.maxChunkSize=100*1024,this.chunks=[],this.remainder=""}update(e){let r=this.decoder.decode(e);if(/[^a-zA-Z0-9+\/]/.test(r)&&(r=r.replace(/[^a-zA-Z0-9+\/]+/g,"")),this.remainder+=r,this.remainder.length>=this.maxChunkSize){let u=Math.floor(this.remainder.length/4)*4,a;u===this.remainder.length?(a=this.remainder,this.remainder=""):(a=this.remainder.substr(0,u),this.remainder=this.remainder.substr(u)),a.length&&this.chunks.push(et(a))}}finalize(){return this.remainder&&!/^=+$/.test(this.remainder)&&this.chunks.push(et(this.remainder)),Oe(new Blob(this.chunks,{type:"application/octet-stream"}))}}const ft=/^=[a-f0-9]{2}$/i,Jt=/(?==[a-f0-9]{2})/i,Kt=/=\r?\n/g,Xt=/=[a-fA-F0-9]?$/;class Zt{constructor(e){e=e||{},this.decoder=e.decoder||new TextDecoder,this.maxChunkSize=100*1024,this.remainder="",this.chunks=[]}decodeQPBytes(e){let r=new ArrayBuffer(e.length),u=new DataView(r);for(let a=0,n=e.length;a<n;a++)u.setUint8(a,parseInt(e[a],16));return r}decodeChunks(e){e=e.replace(Kt,"");let r=e.split(Jt),u=[];for(let a of r){if(a.charAt(0)!=="="){u.length&&(this.chunks.push(this.decodeQPBytes(u)),u=[]),this.chunks.push(a);continue}if(a.length===3){ft.test(a)?u.push(a.substr(1)):(u.length&&(this.chunks.push(this.decodeQPBytes(u)),u=[]),this.chunks.push(a));continue}if(a.length>3){const n=a.substr(0,3);ft.test(n)?(u.push(a.substr(1,2)),this.chunks.push(this.decodeQPBytes(u)),u=[],a=a.substr(3),this.chunks.push(a)):(u.length&&(this.chunks.push(this.decodeQPBytes(u)),u=[]),this.chunks.push(a))}}u.length&&(this.chunks.push(this.decodeQPBytes(u)),u=[])}update(e){let r=this.decoder.decode(e)+`
3
+ `;if(r=this.remainder+r,r.length<this.maxChunkSize){this.remainder=r;return}this.remainder="";let u=r.match(Xt);if(u){if(u.index===0){this.remainder=r;return}this.remainder=r.substr(u.index),r=r.substr(0,u.index)}this.decodeChunks(r)}finalize(){return this.remainder.length&&(this.decodeChunks(this.remainder),this.remainder=""),Oe(new Blob(this.chunks,{type:"application/octet-stream"}))}}class pt{constructor(e){if(this.options=e||{},this.postalMime=this.options.postalMime,this.root=!!this.options.parentNode,this.childNodes=[],this.options.parentNode){if(this.parentNode=this.options.parentNode,this.depth=this.parentNode.depth+1,this.depth>this.options.maxNestingDepth)throw new Error(`Maximum MIME nesting depth of ${this.options.maxNestingDepth} levels exceeded`);this.options.parentNode.childNodes.push(this)}else this.depth=0;this.state="header",this.headerLines=[],this.headerSize=0,this.contentType={value:"text/plain",default:!0},this.contentTransferEncoding={value:"8bit"},this.contentDisposition={value:""},this.headers=[],this.contentDecoder=!1}setupContentDecoder(e){/base64/i.test(e)?this.contentDecoder=new Yt:/quoted-printable/i.test(e)?this.contentDecoder=new Zt({decoder:Ce(this.contentType.parsed.params.charset)}):this.contentDecoder=new Qt}async finalize(){if(this.state==="finished")return;this.state==="header"&&this.processHeaders();let e=this.postalMime.boundaries;for(let r=e.length-1;r>=0;r--)if(e[r].node===this){e.splice(r,1);break}await this.finalizeChildNodes(),this.content=this.contentDecoder?await this.contentDecoder.finalize():null,this.state="finished"}async finalizeChildNodes(){for(let e of this.childNodes)await e.finalize()}parseStructuredHeader(e){let r={value:!1,params:{}},u=!1,a="",n="value",t=!1,i=!1,l;for(let d=0,c=e.length;d<c;d++)switch(l=e.charAt(d),n){case"key":if(l==="="){u=a.trim().toLowerCase(),n="value",a="";break}a+=l;break;case"value":if(i)a+=l;else if(l==="\\"){i=!0;continue}else t&&l===t?t=!1:!t&&l==='"'?t=l:!t&&l===";"?(u===!1?r.value=a.trim():r.params[u]=a.trim(),n="key",a=""):a+=l;i=!1;break}return a=a.trim(),n==="value"?u===!1?r.value=a:r.params[u]=a:a&&(r.params[a.toLowerCase()]=""),r.value&&(r.value=r.value.toLowerCase()),Wt(r),r}decodeFlowedText(e,r){return e.split(/\r?\n/).reduce((u,a)=>/ $/.test(u)&&!/(^|\n)-- $/.test(u)?r?u.slice(0,-1)+a:u+a:u+`
4
+ `+a).replace(/^ /gm,"")}getTextContent(){if(!this.content)return"";let e=Ce(this.contentType.parsed.params.charset).decode(this.content);return/^flowed$/i.test(this.contentType.parsed.params.format)&&(e=this.decodeFlowedText(e,/^yes$/i.test(this.contentType.parsed.params.delsp))),e}processHeaders(){for(let e=this.headerLines.length-1;e>=0;e--){let r=this.headerLines[e];if(e&&/^\s/.test(r))this.headerLines[e-1]+=`
5
+ `+r,this.headerLines.splice(e,1);else{r=r.replace(/\s+/g," ");let u=r.indexOf(":"),a=u<0?r.trim():r.substr(0,u).trim(),n=u<0?"":r.substr(u+1).trim();switch(this.headers.push({key:a.toLowerCase(),originalKey:a,value:n}),a.toLowerCase()){case"content-type":this.contentType.default&&(this.contentType={value:n,parsed:{}});break;case"content-transfer-encoding":this.contentTransferEncoding={value:n,parsed:{}};break;case"content-disposition":this.contentDisposition={value:n,parsed:{}};break;case"content-id":this.contentId=n;break;case"content-description":this.contentDescription=n;break}}}this.contentType.parsed=this.parseStructuredHeader(this.contentType.value),this.contentType.multipart=/^multipart\//i.test(this.contentType.parsed.value)?this.contentType.parsed.value.substr(this.contentType.parsed.value.indexOf("/")+1):!1,this.contentType.multipart&&this.contentType.parsed.params.boundary&&this.postalMime.boundaries.push({value:fe.encode(this.contentType.parsed.params.boundary),node:this}),this.contentDisposition.parsed=this.parseStructuredHeader(this.contentDisposition.value),this.contentTransferEncoding.encoding=this.contentTransferEncoding.value.toLowerCase().split(/[^\w-]/).shift(),this.setupContentDecoder(this.contentTransferEncoding.encoding)}feed(e){switch(this.state){case"header":if(!e.length)return this.state="body",this.processHeaders();if(this.headerSize+=e.length,this.headerSize>this.options.maxHeadersSize)throw new Error(`Maximum header size of ${this.options.maxHeadersSize} bytes exceeded`);this.headerLines.push(Ce().decode(e));break;case"body":this.contentDecoder.update(e)}}}const ht={"&AElig":"Æ","&AElig;":"Æ","&AMP":"&","&AMP;":"&","&Aacute":"Á","&Aacute;":"Á","&Abreve;":"Ă","&Acirc":"Â","&Acirc;":"Â","&Acy;":"А","&Afr;":"𝔄","&Agrave":"À","&Agrave;":"À","&Alpha;":"Α","&Amacr;":"Ā","&And;":"⩓","&Aogon;":"Ą","&Aopf;":"𝔸","&ApplyFunction;":"⁡","&Aring":"Å","&Aring;":"Å","&Ascr;":"𝒜","&Assign;":"≔","&Atilde":"Ã","&Atilde;":"Ã","&Auml":"Ä","&Auml;":"Ä","&Backslash;":"∖","&Barv;":"⫧","&Barwed;":"⌆","&Bcy;":"Б","&Because;":"∵","&Bernoullis;":"ℬ","&Beta;":"Β","&Bfr;":"𝔅","&Bopf;":"𝔹","&Breve;":"˘","&Bscr;":"ℬ","&Bumpeq;":"≎","&CHcy;":"Ч","&COPY":"©","&COPY;":"©","&Cacute;":"Ć","&Cap;":"⋒","&CapitalDifferentialD;":"ⅅ","&Cayleys;":"ℭ","&Ccaron;":"Č","&Ccedil":"Ç","&Ccedil;":"Ç","&Ccirc;":"Ĉ","&Cconint;":"∰","&Cdot;":"Ċ","&Cedilla;":"¸","&CenterDot;":"·","&Cfr;":"ℭ","&Chi;":"Χ","&CircleDot;":"⊙","&CircleMinus;":"⊖","&CirclePlus;":"⊕","&CircleTimes;":"⊗","&ClockwiseContourIntegral;":"∲","&CloseCurlyDoubleQuote;":"”","&CloseCurlyQuote;":"’","&Colon;":"∷","&Colone;":"⩴","&Congruent;":"≡","&Conint;":"∯","&ContourIntegral;":"∮","&Copf;":"ℂ","&Coproduct;":"∐","&CounterClockwiseContourIntegral;":"∳","&Cross;":"⨯","&Cscr;":"𝒞","&Cup;":"⋓","&CupCap;":"≍","&DD;":"ⅅ","&DDotrahd;":"⤑","&DJcy;":"Ђ","&DScy;":"Ѕ","&DZcy;":"Џ","&Dagger;":"‡","&Darr;":"↡","&Dashv;":"⫤","&Dcaron;":"Ď","&Dcy;":"Д","&Del;":"∇","&Delta;":"Δ","&Dfr;":"𝔇","&DiacriticalAcute;":"´","&DiacriticalDot;":"˙","&DiacriticalDoubleAcute;":"˝","&DiacriticalGrave;":"`","&DiacriticalTilde;":"˜","&Diamond;":"⋄","&DifferentialD;":"ⅆ","&Dopf;":"𝔻","&Dot;":"¨","&DotDot;":"⃜","&DotEqual;":"≐","&DoubleContourIntegral;":"∯","&DoubleDot;":"¨","&DoubleDownArrow;":"⇓","&DoubleLeftArrow;":"⇐","&DoubleLeftRightArrow;":"⇔","&DoubleLeftTee;":"⫤","&DoubleLongLeftArrow;":"⟸","&DoubleLongLeftRightArrow;":"⟺","&DoubleLongRightArrow;":"⟹","&DoubleRightArrow;":"⇒","&DoubleRightTee;":"⊨","&DoubleUpArrow;":"⇑","&DoubleUpDownArrow;":"⇕","&DoubleVerticalBar;":"∥","&DownArrow;":"↓","&DownArrowBar;":"⤓","&DownArrowUpArrow;":"⇵","&DownBreve;":"̑","&DownLeftRightVector;":"⥐","&DownLeftTeeVector;":"⥞","&DownLeftVector;":"↽","&DownLeftVectorBar;":"⥖","&DownRightTeeVector;":"⥟","&DownRightVector;":"⇁","&DownRightVectorBar;":"⥗","&DownTee;":"⊤","&DownTeeArrow;":"↧","&Downarrow;":"⇓","&Dscr;":"𝒟","&Dstrok;":"Đ","&ENG;":"Ŋ","&ETH":"Ð","&ETH;":"Ð","&Eacute":"É","&Eacute;":"É","&Ecaron;":"Ě","&Ecirc":"Ê","&Ecirc;":"Ê","&Ecy;":"Э","&Edot;":"Ė","&Efr;":"𝔈","&Egrave":"È","&Egrave;":"È","&Element;":"∈","&Emacr;":"Ē","&EmptySmallSquare;":"◻","&EmptyVerySmallSquare;":"▫","&Eogon;":"Ę","&Eopf;":"𝔼","&Epsilon;":"Ε","&Equal;":"⩵","&EqualTilde;":"≂","&Equilibrium;":"⇌","&Escr;":"ℰ","&Esim;":"⩳","&Eta;":"Η","&Euml":"Ë","&Euml;":"Ë","&Exists;":"∃","&ExponentialE;":"ⅇ","&Fcy;":"Ф","&Ffr;":"𝔉","&FilledSmallSquare;":"◼","&FilledVerySmallSquare;":"▪","&Fopf;":"𝔽","&ForAll;":"∀","&Fouriertrf;":"ℱ","&Fscr;":"ℱ","&GJcy;":"Ѓ","&GT":">","&GT;":">","&Gamma;":"Γ","&Gammad;":"Ϝ","&Gbreve;":"Ğ","&Gcedil;":"Ģ","&Gcirc;":"Ĝ","&Gcy;":"Г","&Gdot;":"Ġ","&Gfr;":"𝔊","&Gg;":"⋙","&Gopf;":"𝔾","&GreaterEqual;":"≥","&GreaterEqualLess;":"⋛","&GreaterFullEqual;":"≧","&GreaterGreater;":"⪢","&GreaterLess;":"≷","&GreaterSlantEqual;":"⩾","&GreaterTilde;":"≳","&Gscr;":"𝒢","&Gt;":"≫","&HARDcy;":"Ъ","&Hacek;":"ˇ","&Hat;":"^","&Hcirc;":"Ĥ","&Hfr;":"ℌ","&HilbertSpace;":"ℋ","&Hopf;":"ℍ","&HorizontalLine;":"─","&Hscr;":"ℋ","&Hstrok;":"Ħ","&HumpDownHump;":"≎","&HumpEqual;":"≏","&IEcy;":"Е","&IJlig;":"IJ","&IOcy;":"Ё","&Iacute":"Í","&Iacute;":"Í","&Icirc":"Î","&Icirc;":"Î","&Icy;":"И","&Idot;":"İ","&Ifr;":"ℑ","&Igrave":"Ì","&Igrave;":"Ì","&Im;":"ℑ","&Imacr;":"Ī","&ImaginaryI;":"ⅈ","&Implies;":"⇒","&Int;":"∬","&Integral;":"∫","&Intersection;":"⋂","&InvisibleComma;":"⁣","&InvisibleTimes;":"⁢","&Iogon;":"Į","&Iopf;":"𝕀","&Iota;":"Ι","&Iscr;":"ℐ","&Itilde;":"Ĩ","&Iukcy;":"І","&Iuml":"Ï","&Iuml;":"Ï","&Jcirc;":"Ĵ","&Jcy;":"Й","&Jfr;":"𝔍","&Jopf;":"𝕁","&Jscr;":"𝒥","&Jsercy;":"Ј","&Jukcy;":"Є","&KHcy;":"Х","&KJcy;":"Ќ","&Kappa;":"Κ","&Kcedil;":"Ķ","&Kcy;":"К","&Kfr;":"𝔎","&Kopf;":"𝕂","&Kscr;":"𝒦","&LJcy;":"Љ","&LT":"<","&LT;":"<","&Lacute;":"Ĺ","&Lambda;":"Λ","&Lang;":"⟪","&Laplacetrf;":"ℒ","&Larr;":"↞","&Lcaron;":"Ľ","&Lcedil;":"Ļ","&Lcy;":"Л","&LeftAngleBracket;":"⟨","&LeftArrow;":"←","&LeftArrowBar;":"⇤","&LeftArrowRightArrow;":"⇆","&LeftCeiling;":"⌈","&LeftDoubleBracket;":"⟦","&LeftDownTeeVector;":"⥡","&LeftDownVector;":"⇃","&LeftDownVectorBar;":"⥙","&LeftFloor;":"⌊","&LeftRightArrow;":"↔","&LeftRightVector;":"⥎","&LeftTee;":"⊣","&LeftTeeArrow;":"↤","&LeftTeeVector;":"⥚","&LeftTriangle;":"⊲","&LeftTriangleBar;":"⧏","&LeftTriangleEqual;":"⊴","&LeftUpDownVector;":"⥑","&LeftUpTeeVector;":"⥠","&LeftUpVector;":"↿","&LeftUpVectorBar;":"⥘","&LeftVector;":"↼","&LeftVectorBar;":"⥒","&Leftarrow;":"⇐","&Leftrightarrow;":"⇔","&LessEqualGreater;":"⋚","&LessFullEqual;":"≦","&LessGreater;":"≶","&LessLess;":"⪡","&LessSlantEqual;":"⩽","&LessTilde;":"≲","&Lfr;":"𝔏","&Ll;":"⋘","&Lleftarrow;":"⇚","&Lmidot;":"Ŀ","&LongLeftArrow;":"⟵","&LongLeftRightArrow;":"⟷","&LongRightArrow;":"⟶","&Longleftarrow;":"⟸","&Longleftrightarrow;":"⟺","&Longrightarrow;":"⟹","&Lopf;":"𝕃","&LowerLeftArrow;":"↙","&LowerRightArrow;":"↘","&Lscr;":"ℒ","&Lsh;":"↰","&Lstrok;":"Ł","&Lt;":"≪","&Map;":"⤅","&Mcy;":"М","&MediumSpace;":" ","&Mellintrf;":"ℳ","&Mfr;":"𝔐","&MinusPlus;":"∓","&Mopf;":"𝕄","&Mscr;":"ℳ","&Mu;":"Μ","&NJcy;":"Њ","&Nacute;":"Ń","&Ncaron;":"Ň","&Ncedil;":"Ņ","&Ncy;":"Н","&NegativeMediumSpace;":"​","&NegativeThickSpace;":"​","&NegativeThinSpace;":"​","&NegativeVeryThinSpace;":"​","&NestedGreaterGreater;":"≫","&NestedLessLess;":"≪","&NewLine;":`
6
+ `,"&Nfr;":"𝔑","&NoBreak;":"⁠","&NonBreakingSpace;":" ","&Nopf;":"ℕ","&Not;":"⫬","&NotCongruent;":"≢","&NotCupCap;":"≭","&NotDoubleVerticalBar;":"∦","&NotElement;":"∉","&NotEqual;":"≠","&NotEqualTilde;":"≂̸","&NotExists;":"∄","&NotGreater;":"≯","&NotGreaterEqual;":"≱","&NotGreaterFullEqual;":"≧̸","&NotGreaterGreater;":"≫̸","&NotGreaterLess;":"≹","&NotGreaterSlantEqual;":"⩾̸","&NotGreaterTilde;":"≵","&NotHumpDownHump;":"≎̸","&NotHumpEqual;":"≏̸","&NotLeftTriangle;":"⋪","&NotLeftTriangleBar;":"⧏̸","&NotLeftTriangleEqual;":"⋬","&NotLess;":"≮","&NotLessEqual;":"≰","&NotLessGreater;":"≸","&NotLessLess;":"≪̸","&NotLessSlantEqual;":"⩽̸","&NotLessTilde;":"≴","&NotNestedGreaterGreater;":"⪢̸","&NotNestedLessLess;":"⪡̸","&NotPrecedes;":"⊀","&NotPrecedesEqual;":"⪯̸","&NotPrecedesSlantEqual;":"⋠","&NotReverseElement;":"∌","&NotRightTriangle;":"⋫","&NotRightTriangleBar;":"⧐̸","&NotRightTriangleEqual;":"⋭","&NotSquareSubset;":"⊏̸","&NotSquareSubsetEqual;":"⋢","&NotSquareSuperset;":"⊐̸","&NotSquareSupersetEqual;":"⋣","&NotSubset;":"⊂⃒","&NotSubsetEqual;":"⊈","&NotSucceeds;":"⊁","&NotSucceedsEqual;":"⪰̸","&NotSucceedsSlantEqual;":"⋡","&NotSucceedsTilde;":"≿̸","&NotSuperset;":"⊃⃒","&NotSupersetEqual;":"⊉","&NotTilde;":"≁","&NotTildeEqual;":"≄","&NotTildeFullEqual;":"≇","&NotTildeTilde;":"≉","&NotVerticalBar;":"∤","&Nscr;":"𝒩","&Ntilde":"Ñ","&Ntilde;":"Ñ","&Nu;":"Ν","&OElig;":"Œ","&Oacute":"Ó","&Oacute;":"Ó","&Ocirc":"Ô","&Ocirc;":"Ô","&Ocy;":"О","&Odblac;":"Ő","&Ofr;":"𝔒","&Ograve":"Ò","&Ograve;":"Ò","&Omacr;":"Ō","&Omega;":"Ω","&Omicron;":"Ο","&Oopf;":"𝕆","&OpenCurlyDoubleQuote;":"“","&OpenCurlyQuote;":"‘","&Or;":"⩔","&Oscr;":"𝒪","&Oslash":"Ø","&Oslash;":"Ø","&Otilde":"Õ","&Otilde;":"Õ","&Otimes;":"⨷","&Ouml":"Ö","&Ouml;":"Ö","&OverBar;":"‾","&OverBrace;":"⏞","&OverBracket;":"⎴","&OverParenthesis;":"⏜","&PartialD;":"∂","&Pcy;":"П","&Pfr;":"𝔓","&Phi;":"Φ","&Pi;":"Π","&PlusMinus;":"±","&Poincareplane;":"ℌ","&Popf;":"ℙ","&Pr;":"⪻","&Precedes;":"≺","&PrecedesEqual;":"⪯","&PrecedesSlantEqual;":"≼","&PrecedesTilde;":"≾","&Prime;":"″","&Product;":"∏","&Proportion;":"∷","&Proportional;":"∝","&Pscr;":"𝒫","&Psi;":"Ψ","&QUOT":'"',"&QUOT;":'"',"&Qfr;":"𝔔","&Qopf;":"ℚ","&Qscr;":"𝒬","&RBarr;":"⤐","&REG":"®","&REG;":"®","&Racute;":"Ŕ","&Rang;":"⟫","&Rarr;":"↠","&Rarrtl;":"⤖","&Rcaron;":"Ř","&Rcedil;":"Ŗ","&Rcy;":"Р","&Re;":"ℜ","&ReverseElement;":"∋","&ReverseEquilibrium;":"⇋","&ReverseUpEquilibrium;":"⥯","&Rfr;":"ℜ","&Rho;":"Ρ","&RightAngleBracket;":"⟩","&RightArrow;":"→","&RightArrowBar;":"⇥","&RightArrowLeftArrow;":"⇄","&RightCeiling;":"⌉","&RightDoubleBracket;":"⟧","&RightDownTeeVector;":"⥝","&RightDownVector;":"⇂","&RightDownVectorBar;":"⥕","&RightFloor;":"⌋","&RightTee;":"⊢","&RightTeeArrow;":"↦","&RightTeeVector;":"⥛","&RightTriangle;":"⊳","&RightTriangleBar;":"⧐","&RightTriangleEqual;":"⊵","&RightUpDownVector;":"⥏","&RightUpTeeVector;":"⥜","&RightUpVector;":"↾","&RightUpVectorBar;":"⥔","&RightVector;":"⇀","&RightVectorBar;":"⥓","&Rightarrow;":"⇒","&Ropf;":"ℝ","&RoundImplies;":"⥰","&Rrightarrow;":"⇛","&Rscr;":"ℛ","&Rsh;":"↱","&RuleDelayed;":"⧴","&SHCHcy;":"Щ","&SHcy;":"Ш","&SOFTcy;":"Ь","&Sacute;":"Ś","&Sc;":"⪼","&Scaron;":"Š","&Scedil;":"Ş","&Scirc;":"Ŝ","&Scy;":"С","&Sfr;":"𝔖","&ShortDownArrow;":"↓","&ShortLeftArrow;":"←","&ShortRightArrow;":"→","&ShortUpArrow;":"↑","&Sigma;":"Σ","&SmallCircle;":"∘","&Sopf;":"𝕊","&Sqrt;":"√","&Square;":"□","&SquareIntersection;":"⊓","&SquareSubset;":"⊏","&SquareSubsetEqual;":"⊑","&SquareSuperset;":"⊐","&SquareSupersetEqual;":"⊒","&SquareUnion;":"⊔","&Sscr;":"𝒮","&Star;":"⋆","&Sub;":"⋐","&Subset;":"⋐","&SubsetEqual;":"⊆","&Succeeds;":"≻","&SucceedsEqual;":"⪰","&SucceedsSlantEqual;":"≽","&SucceedsTilde;":"≿","&SuchThat;":"∋","&Sum;":"∑","&Sup;":"⋑","&Superset;":"⊃","&SupersetEqual;":"⊇","&Supset;":"⋑","&THORN":"Þ","&THORN;":"Þ","&TRADE;":"™","&TSHcy;":"Ћ","&TScy;":"Ц","&Tab;":" ","&Tau;":"Τ","&Tcaron;":"Ť","&Tcedil;":"Ţ","&Tcy;":"Т","&Tfr;":"𝔗","&Therefore;":"∴","&Theta;":"Θ","&ThickSpace;":"  ","&ThinSpace;":" ","&Tilde;":"∼","&TildeEqual;":"≃","&TildeFullEqual;":"≅","&TildeTilde;":"≈","&Topf;":"𝕋","&TripleDot;":"⃛","&Tscr;":"𝒯","&Tstrok;":"Ŧ","&Uacute":"Ú","&Uacute;":"Ú","&Uarr;":"↟","&Uarrocir;":"⥉","&Ubrcy;":"Ў","&Ubreve;":"Ŭ","&Ucirc":"Û","&Ucirc;":"Û","&Ucy;":"У","&Udblac;":"Ű","&Ufr;":"𝔘","&Ugrave":"Ù","&Ugrave;":"Ù","&Umacr;":"Ū","&UnderBar;":"_","&UnderBrace;":"⏟","&UnderBracket;":"⎵","&UnderParenthesis;":"⏝","&Union;":"⋃","&UnionPlus;":"⊎","&Uogon;":"Ų","&Uopf;":"𝕌","&UpArrow;":"↑","&UpArrowBar;":"⤒","&UpArrowDownArrow;":"⇅","&UpDownArrow;":"↕","&UpEquilibrium;":"⥮","&UpTee;":"⊥","&UpTeeArrow;":"↥","&Uparrow;":"⇑","&Updownarrow;":"⇕","&UpperLeftArrow;":"↖","&UpperRightArrow;":"↗","&Upsi;":"ϒ","&Upsilon;":"Υ","&Uring;":"Ů","&Uscr;":"𝒰","&Utilde;":"Ũ","&Uuml":"Ü","&Uuml;":"Ü","&VDash;":"⊫","&Vbar;":"⫫","&Vcy;":"В","&Vdash;":"⊩","&Vdashl;":"⫦","&Vee;":"⋁","&Verbar;":"‖","&Vert;":"‖","&VerticalBar;":"∣","&VerticalLine;":"|","&VerticalSeparator;":"❘","&VerticalTilde;":"≀","&VeryThinSpace;":" ","&Vfr;":"𝔙","&Vopf;":"𝕍","&Vscr;":"𝒱","&Vvdash;":"⊪","&Wcirc;":"Ŵ","&Wedge;":"⋀","&Wfr;":"𝔚","&Wopf;":"𝕎","&Wscr;":"𝒲","&Xfr;":"𝔛","&Xi;":"Ξ","&Xopf;":"𝕏","&Xscr;":"𝒳","&YAcy;":"Я","&YIcy;":"Ї","&YUcy;":"Ю","&Yacute":"Ý","&Yacute;":"Ý","&Ycirc;":"Ŷ","&Ycy;":"Ы","&Yfr;":"𝔜","&Yopf;":"𝕐","&Yscr;":"𝒴","&Yuml;":"Ÿ","&ZHcy;":"Ж","&Zacute;":"Ź","&Zcaron;":"Ž","&Zcy;":"З","&Zdot;":"Ż","&ZeroWidthSpace;":"​","&Zeta;":"Ζ","&Zfr;":"ℨ","&Zopf;":"ℤ","&Zscr;":"𝒵","&aacute":"á","&aacute;":"á","&abreve;":"ă","&ac;":"∾","&acE;":"∾̳","&acd;":"∿","&acirc":"â","&acirc;":"â","&acute":"´","&acute;":"´","&acy;":"а","&aelig":"æ","&aelig;":"æ","&af;":"⁡","&afr;":"𝔞","&agrave":"à","&agrave;":"à","&alefsym;":"ℵ","&aleph;":"ℵ","&alpha;":"α","&amacr;":"ā","&amalg;":"⨿","&amp":"&","&amp;":"&","&and;":"∧","&andand;":"⩕","&andd;":"⩜","&andslope;":"⩘","&andv;":"⩚","&ang;":"∠","&ange;":"⦤","&angle;":"∠","&angmsd;":"∡","&angmsdaa;":"⦨","&angmsdab;":"⦩","&angmsdac;":"⦪","&angmsdad;":"⦫","&angmsdae;":"⦬","&angmsdaf;":"⦭","&angmsdag;":"⦮","&angmsdah;":"⦯","&angrt;":"∟","&angrtvb;":"⊾","&angrtvbd;":"⦝","&angsph;":"∢","&angst;":"Å","&angzarr;":"⍼","&aogon;":"ą","&aopf;":"𝕒","&ap;":"≈","&apE;":"⩰","&apacir;":"⩯","&ape;":"≊","&apid;":"≋","&apos;":"'","&approx;":"≈","&approxeq;":"≊","&aring":"å","&aring;":"å","&ascr;":"𝒶","&ast;":"*","&asymp;":"≈","&asympeq;":"≍","&atilde":"ã","&atilde;":"ã","&auml":"ä","&auml;":"ä","&awconint;":"∳","&awint;":"⨑","&bNot;":"⫭","&backcong;":"≌","&backepsilon;":"϶","&backprime;":"‵","&backsim;":"∽","&backsimeq;":"⋍","&barvee;":"⊽","&barwed;":"⌅","&barwedge;":"⌅","&bbrk;":"⎵","&bbrktbrk;":"⎶","&bcong;":"≌","&bcy;":"б","&bdquo;":"„","&becaus;":"∵","&because;":"∵","&bemptyv;":"⦰","&bepsi;":"϶","&bernou;":"ℬ","&beta;":"β","&beth;":"ℶ","&between;":"≬","&bfr;":"𝔟","&bigcap;":"⋂","&bigcirc;":"◯","&bigcup;":"⋃","&bigodot;":"⨀","&bigoplus;":"⨁","&bigotimes;":"⨂","&bigsqcup;":"⨆","&bigstar;":"★","&bigtriangledown;":"▽","&bigtriangleup;":"△","&biguplus;":"⨄","&bigvee;":"⋁","&bigwedge;":"⋀","&bkarow;":"⤍","&blacklozenge;":"⧫","&blacksquare;":"▪","&blacktriangle;":"▴","&blacktriangledown;":"▾","&blacktriangleleft;":"◂","&blacktriangleright;":"▸","&blank;":"␣","&blk12;":"▒","&blk14;":"░","&blk34;":"▓","&block;":"█","&bne;":"=⃥","&bnequiv;":"≡⃥","&bnot;":"⌐","&bopf;":"𝕓","&bot;":"⊥","&bottom;":"⊥","&bowtie;":"⋈","&boxDL;":"╗","&boxDR;":"╔","&boxDl;":"╖","&boxDr;":"╓","&boxH;":"═","&boxHD;":"╦","&boxHU;":"╩","&boxHd;":"╤","&boxHu;":"╧","&boxUL;":"╝","&boxUR;":"╚","&boxUl;":"╜","&boxUr;":"╙","&boxV;":"║","&boxVH;":"╬","&boxVL;":"╣","&boxVR;":"╠","&boxVh;":"╫","&boxVl;":"╢","&boxVr;":"╟","&boxbox;":"⧉","&boxdL;":"╕","&boxdR;":"╒","&boxdl;":"┐","&boxdr;":"┌","&boxh;":"─","&boxhD;":"╥","&boxhU;":"╨","&boxhd;":"┬","&boxhu;":"┴","&boxminus;":"⊟","&boxplus;":"⊞","&boxtimes;":"⊠","&boxuL;":"╛","&boxuR;":"╘","&boxul;":"┘","&boxur;":"└","&boxv;":"│","&boxvH;":"╪","&boxvL;":"╡","&boxvR;":"╞","&boxvh;":"┼","&boxvl;":"┤","&boxvr;":"├","&bprime;":"‵","&breve;":"˘","&brvbar":"¦","&brvbar;":"¦","&bscr;":"𝒷","&bsemi;":"⁏","&bsim;":"∽","&bsime;":"⋍","&bsol;":"\\","&bsolb;":"⧅","&bsolhsub;":"⟈","&bull;":"•","&bullet;":"•","&bump;":"≎","&bumpE;":"⪮","&bumpe;":"≏","&bumpeq;":"≏","&cacute;":"ć","&cap;":"∩","&capand;":"⩄","&capbrcup;":"⩉","&capcap;":"⩋","&capcup;":"⩇","&capdot;":"⩀","&caps;":"∩︀","&caret;":"⁁","&caron;":"ˇ","&ccaps;":"⩍","&ccaron;":"č","&ccedil":"ç","&ccedil;":"ç","&ccirc;":"ĉ","&ccups;":"⩌","&ccupssm;":"⩐","&cdot;":"ċ","&cedil":"¸","&cedil;":"¸","&cemptyv;":"⦲","&cent":"¢","&cent;":"¢","&centerdot;":"·","&cfr;":"𝔠","&chcy;":"ч","&check;":"✓","&checkmark;":"✓","&chi;":"χ","&cir;":"○","&cirE;":"⧃","&circ;":"ˆ","&circeq;":"≗","&circlearrowleft;":"↺","&circlearrowright;":"↻","&circledR;":"®","&circledS;":"Ⓢ","&circledast;":"⊛","&circledcirc;":"⊚","&circleddash;":"⊝","&cire;":"≗","&cirfnint;":"⨐","&cirmid;":"⫯","&cirscir;":"⧂","&clubs;":"♣","&clubsuit;":"♣","&colon;":":","&colone;":"≔","&coloneq;":"≔","&comma;":",","&commat;":"@","&comp;":"∁","&compfn;":"∘","&complement;":"∁","&complexes;":"ℂ","&cong;":"≅","&congdot;":"⩭","&conint;":"∮","&copf;":"𝕔","&coprod;":"∐","&copy":"©","&copy;":"©","&copysr;":"℗","&crarr;":"↵","&cross;":"✗","&cscr;":"𝒸","&csub;":"⫏","&csube;":"⫑","&csup;":"⫐","&csupe;":"⫒","&ctdot;":"⋯","&cudarrl;":"⤸","&cudarrr;":"⤵","&cuepr;":"⋞","&cuesc;":"⋟","&cularr;":"↶","&cularrp;":"⤽","&cup;":"∪","&cupbrcap;":"⩈","&cupcap;":"⩆","&cupcup;":"⩊","&cupdot;":"⊍","&cupor;":"⩅","&cups;":"∪︀","&curarr;":"↷","&curarrm;":"⤼","&curlyeqprec;":"⋞","&curlyeqsucc;":"⋟","&curlyvee;":"⋎","&curlywedge;":"⋏","&curren":"¤","&curren;":"¤","&curvearrowleft;":"↶","&curvearrowright;":"↷","&cuvee;":"⋎","&cuwed;":"⋏","&cwconint;":"∲","&cwint;":"∱","&cylcty;":"⌭","&dArr;":"⇓","&dHar;":"⥥","&dagger;":"†","&daleth;":"ℸ","&darr;":"↓","&dash;":"‐","&dashv;":"⊣","&dbkarow;":"⤏","&dblac;":"˝","&dcaron;":"ď","&dcy;":"д","&dd;":"ⅆ","&ddagger;":"‡","&ddarr;":"⇊","&ddotseq;":"⩷","&deg":"°","&deg;":"°","&delta;":"δ","&demptyv;":"⦱","&dfisht;":"⥿","&dfr;":"𝔡","&dharl;":"⇃","&dharr;":"⇂","&diam;":"⋄","&diamond;":"⋄","&diamondsuit;":"♦","&diams;":"♦","&die;":"¨","&digamma;":"ϝ","&disin;":"⋲","&div;":"÷","&divide":"÷","&divide;":"÷","&divideontimes;":"⋇","&divonx;":"⋇","&djcy;":"ђ","&dlcorn;":"⌞","&dlcrop;":"⌍","&dollar;":"$","&dopf;":"𝕕","&dot;":"˙","&doteq;":"≐","&doteqdot;":"≑","&dotminus;":"∸","&dotplus;":"∔","&dotsquare;":"⊡","&doublebarwedge;":"⌆","&downarrow;":"↓","&downdownarrows;":"⇊","&downharpoonleft;":"⇃","&downharpoonright;":"⇂","&drbkarow;":"⤐","&drcorn;":"⌟","&drcrop;":"⌌","&dscr;":"𝒹","&dscy;":"ѕ","&dsol;":"⧶","&dstrok;":"đ","&dtdot;":"⋱","&dtri;":"▿","&dtrif;":"▾","&duarr;":"⇵","&duhar;":"⥯","&dwangle;":"⦦","&dzcy;":"џ","&dzigrarr;":"⟿","&eDDot;":"⩷","&eDot;":"≑","&eacute":"é","&eacute;":"é","&easter;":"⩮","&ecaron;":"ě","&ecir;":"≖","&ecirc":"ê","&ecirc;":"ê","&ecolon;":"≕","&ecy;":"э","&edot;":"ė","&ee;":"ⅇ","&efDot;":"≒","&efr;":"𝔢","&eg;":"⪚","&egrave":"è","&egrave;":"è","&egs;":"⪖","&egsdot;":"⪘","&el;":"⪙","&elinters;":"⏧","&ell;":"ℓ","&els;":"⪕","&elsdot;":"⪗","&emacr;":"ē","&empty;":"∅","&emptyset;":"∅","&emptyv;":"∅","&emsp13;":" ","&emsp14;":" ","&emsp;":" ","&eng;":"ŋ","&ensp;":" ","&eogon;":"ę","&eopf;":"𝕖","&epar;":"⋕","&eparsl;":"⧣","&eplus;":"⩱","&epsi;":"ε","&epsilon;":"ε","&epsiv;":"ϵ","&eqcirc;":"≖","&eqcolon;":"≕","&eqsim;":"≂","&eqslantgtr;":"⪖","&eqslantless;":"⪕","&equals;":"=","&equest;":"≟","&equiv;":"≡","&equivDD;":"⩸","&eqvparsl;":"⧥","&erDot;":"≓","&erarr;":"⥱","&escr;":"ℯ","&esdot;":"≐","&esim;":"≂","&eta;":"η","&eth":"ð","&eth;":"ð","&euml":"ë","&euml;":"ë","&euro;":"€","&excl;":"!","&exist;":"∃","&expectation;":"ℰ","&exponentiale;":"ⅇ","&fallingdotseq;":"≒","&fcy;":"ф","&female;":"♀","&ffilig;":"ffi","&fflig;":"ff","&ffllig;":"ffl","&ffr;":"𝔣","&filig;":"fi","&fjlig;":"fj","&flat;":"♭","&fllig;":"fl","&fltns;":"▱","&fnof;":"ƒ","&fopf;":"𝕗","&forall;":"∀","&fork;":"⋔","&forkv;":"⫙","&fpartint;":"⨍","&frac12":"½","&frac12;":"½","&frac13;":"⅓","&frac14":"¼","&frac14;":"¼","&frac15;":"⅕","&frac16;":"⅙","&frac18;":"⅛","&frac23;":"⅔","&frac25;":"⅖","&frac34":"¾","&frac34;":"¾","&frac35;":"⅗","&frac38;":"⅜","&frac45;":"⅘","&frac56;":"⅚","&frac58;":"⅝","&frac78;":"⅞","&frasl;":"⁄","&frown;":"⌢","&fscr;":"𝒻","&gE;":"≧","&gEl;":"⪌","&gacute;":"ǵ","&gamma;":"γ","&gammad;":"ϝ","&gap;":"⪆","&gbreve;":"ğ","&gcirc;":"ĝ","&gcy;":"г","&gdot;":"ġ","&ge;":"≥","&gel;":"⋛","&geq;":"≥","&geqq;":"≧","&geqslant;":"⩾","&ges;":"⩾","&gescc;":"⪩","&gesdot;":"⪀","&gesdoto;":"⪂","&gesdotol;":"⪄","&gesl;":"⋛︀","&gesles;":"⪔","&gfr;":"𝔤","&gg;":"≫","&ggg;":"⋙","&gimel;":"ℷ","&gjcy;":"ѓ","&gl;":"≷","&glE;":"⪒","&gla;":"⪥","&glj;":"⪤","&gnE;":"≩","&gnap;":"⪊","&gnapprox;":"⪊","&gne;":"⪈","&gneq;":"⪈","&gneqq;":"≩","&gnsim;":"⋧","&gopf;":"𝕘","&grave;":"`","&gscr;":"ℊ","&gsim;":"≳","&gsime;":"⪎","&gsiml;":"⪐","&gt":">","&gt;":">","&gtcc;":"⪧","&gtcir;":"⩺","&gtdot;":"⋗","&gtlPar;":"⦕","&gtquest;":"⩼","&gtrapprox;":"⪆","&gtrarr;":"⥸","&gtrdot;":"⋗","&gtreqless;":"⋛","&gtreqqless;":"⪌","&gtrless;":"≷","&gtrsim;":"≳","&gvertneqq;":"≩︀","&gvnE;":"≩︀","&hArr;":"⇔","&hairsp;":" ","&half;":"½","&hamilt;":"ℋ","&hardcy;":"ъ","&harr;":"↔","&harrcir;":"⥈","&harrw;":"↭","&hbar;":"ℏ","&hcirc;":"ĥ","&hearts;":"♥","&heartsuit;":"♥","&hellip;":"…","&hercon;":"⊹","&hfr;":"𝔥","&hksearow;":"⤥","&hkswarow;":"⤦","&hoarr;":"⇿","&homtht;":"∻","&hookleftarrow;":"↩","&hookrightarrow;":"↪","&hopf;":"𝕙","&horbar;":"―","&hscr;":"𝒽","&hslash;":"ℏ","&hstrok;":"ħ","&hybull;":"⁃","&hyphen;":"‐","&iacute":"í","&iacute;":"í","&ic;":"⁣","&icirc":"î","&icirc;":"î","&icy;":"и","&iecy;":"е","&iexcl":"¡","&iexcl;":"¡","&iff;":"⇔","&ifr;":"𝔦","&igrave":"ì","&igrave;":"ì","&ii;":"ⅈ","&iiiint;":"⨌","&iiint;":"∭","&iinfin;":"⧜","&iiota;":"℩","&ijlig;":"ij","&imacr;":"ī","&image;":"ℑ","&imagline;":"ℐ","&imagpart;":"ℑ","&imath;":"ı","&imof;":"⊷","&imped;":"Ƶ","&in;":"∈","&incare;":"℅","&infin;":"∞","&infintie;":"⧝","&inodot;":"ı","&int;":"∫","&intcal;":"⊺","&integers;":"ℤ","&intercal;":"⊺","&intlarhk;":"⨗","&intprod;":"⨼","&iocy;":"ё","&iogon;":"į","&iopf;":"𝕚","&iota;":"ι","&iprod;":"⨼","&iquest":"¿","&iquest;":"¿","&iscr;":"𝒾","&isin;":"∈","&isinE;":"⋹","&isindot;":"⋵","&isins;":"⋴","&isinsv;":"⋳","&isinv;":"∈","&it;":"⁢","&itilde;":"ĩ","&iukcy;":"і","&iuml":"ï","&iuml;":"ï","&jcirc;":"ĵ","&jcy;":"й","&jfr;":"𝔧","&jmath;":"ȷ","&jopf;":"𝕛","&jscr;":"𝒿","&jsercy;":"ј","&jukcy;":"є","&kappa;":"κ","&kappav;":"ϰ","&kcedil;":"ķ","&kcy;":"к","&kfr;":"𝔨","&kgreen;":"ĸ","&khcy;":"х","&kjcy;":"ќ","&kopf;":"𝕜","&kscr;":"𝓀","&lAarr;":"⇚","&lArr;":"⇐","&lAtail;":"⤛","&lBarr;":"⤎","&lE;":"≦","&lEg;":"⪋","&lHar;":"⥢","&lacute;":"ĺ","&laemptyv;":"⦴","&lagran;":"ℒ","&lambda;":"λ","&lang;":"⟨","&langd;":"⦑","&langle;":"⟨","&lap;":"⪅","&laquo":"«","&laquo;":"«","&larr;":"←","&larrb;":"⇤","&larrbfs;":"⤟","&larrfs;":"⤝","&larrhk;":"↩","&larrlp;":"↫","&larrpl;":"⤹","&larrsim;":"⥳","&larrtl;":"↢","&lat;":"⪫","&latail;":"⤙","&late;":"⪭","&lates;":"⪭︀","&lbarr;":"⤌","&lbbrk;":"❲","&lbrace;":"{","&lbrack;":"[","&lbrke;":"⦋","&lbrksld;":"⦏","&lbrkslu;":"⦍","&lcaron;":"ľ","&lcedil;":"ļ","&lceil;":"⌈","&lcub;":"{","&lcy;":"л","&ldca;":"⤶","&ldquo;":"“","&ldquor;":"„","&ldrdhar;":"⥧","&ldrushar;":"⥋","&ldsh;":"↲","&le;":"≤","&leftarrow;":"←","&leftarrowtail;":"↢","&leftharpoondown;":"↽","&leftharpoonup;":"↼","&leftleftarrows;":"⇇","&leftrightarrow;":"↔","&leftrightarrows;":"⇆","&leftrightharpoons;":"⇋","&leftrightsquigarrow;":"↭","&leftthreetimes;":"⋋","&leg;":"⋚","&leq;":"≤","&leqq;":"≦","&leqslant;":"⩽","&les;":"⩽","&lescc;":"⪨","&lesdot;":"⩿","&lesdoto;":"⪁","&lesdotor;":"⪃","&lesg;":"⋚︀","&lesges;":"⪓","&lessapprox;":"⪅","&lessdot;":"⋖","&lesseqgtr;":"⋚","&lesseqqgtr;":"⪋","&lessgtr;":"≶","&lesssim;":"≲","&lfisht;":"⥼","&lfloor;":"⌊","&lfr;":"𝔩","&lg;":"≶","&lgE;":"⪑","&lhard;":"↽","&lharu;":"↼","&lharul;":"⥪","&lhblk;":"▄","&ljcy;":"љ","&ll;":"≪","&llarr;":"⇇","&llcorner;":"⌞","&llhard;":"⥫","&lltri;":"◺","&lmidot;":"ŀ","&lmoust;":"⎰","&lmoustache;":"⎰","&lnE;":"≨","&lnap;":"⪉","&lnapprox;":"⪉","&lne;":"⪇","&lneq;":"⪇","&lneqq;":"≨","&lnsim;":"⋦","&loang;":"⟬","&loarr;":"⇽","&lobrk;":"⟦","&longleftarrow;":"⟵","&longleftrightarrow;":"⟷","&longmapsto;":"⟼","&longrightarrow;":"⟶","&looparrowleft;":"↫","&looparrowright;":"↬","&lopar;":"⦅","&lopf;":"𝕝","&loplus;":"⨭","&lotimes;":"⨴","&lowast;":"∗","&lowbar;":"_","&loz;":"◊","&lozenge;":"◊","&lozf;":"⧫","&lpar;":"(","&lparlt;":"⦓","&lrarr;":"⇆","&lrcorner;":"⌟","&lrhar;":"⇋","&lrhard;":"⥭","&lrm;":"‎","&lrtri;":"⊿","&lsaquo;":"‹","&lscr;":"𝓁","&lsh;":"↰","&lsim;":"≲","&lsime;":"⪍","&lsimg;":"⪏","&lsqb;":"[","&lsquo;":"‘","&lsquor;":"‚","&lstrok;":"ł","&lt":"<","&lt;":"<","&ltcc;":"⪦","&ltcir;":"⩹","&ltdot;":"⋖","&lthree;":"⋋","&ltimes;":"⋉","&ltlarr;":"⥶","&ltquest;":"⩻","&ltrPar;":"⦖","&ltri;":"◃","&ltrie;":"⊴","&ltrif;":"◂","&lurdshar;":"⥊","&luruhar;":"⥦","&lvertneqq;":"≨︀","&lvnE;":"≨︀","&mDDot;":"∺","&macr":"¯","&macr;":"¯","&male;":"♂","&malt;":"✠","&maltese;":"✠","&map;":"↦","&mapsto;":"↦","&mapstodown;":"↧","&mapstoleft;":"↤","&mapstoup;":"↥","&marker;":"▮","&mcomma;":"⨩","&mcy;":"м","&mdash;":"—","&measuredangle;":"∡","&mfr;":"𝔪","&mho;":"℧","&micro":"µ","&micro;":"µ","&mid;":"∣","&midast;":"*","&midcir;":"⫰","&middot":"·","&middot;":"·","&minus;":"−","&minusb;":"⊟","&minusd;":"∸","&minusdu;":"⨪","&mlcp;":"⫛","&mldr;":"…","&mnplus;":"∓","&models;":"⊧","&mopf;":"𝕞","&mp;":"∓","&mscr;":"𝓂","&mstpos;":"∾","&mu;":"μ","&multimap;":"⊸","&mumap;":"⊸","&nGg;":"⋙̸","&nGt;":"≫⃒","&nGtv;":"≫̸","&nLeftarrow;":"⇍","&nLeftrightarrow;":"⇎","&nLl;":"⋘̸","&nLt;":"≪⃒","&nLtv;":"≪̸","&nRightarrow;":"⇏","&nVDash;":"⊯","&nVdash;":"⊮","&nabla;":"∇","&nacute;":"ń","&nang;":"∠⃒","&nap;":"≉","&napE;":"⩰̸","&napid;":"≋̸","&napos;":"ʼn","&napprox;":"≉","&natur;":"♮","&natural;":"♮","&naturals;":"ℕ","&nbsp":" ","&nbsp;":" ","&nbump;":"≎̸","&nbumpe;":"≏̸","&ncap;":"⩃","&ncaron;":"ň","&ncedil;":"ņ","&ncong;":"≇","&ncongdot;":"⩭̸","&ncup;":"⩂","&ncy;":"н","&ndash;":"–","&ne;":"≠","&neArr;":"⇗","&nearhk;":"⤤","&nearr;":"↗","&nearrow;":"↗","&nedot;":"≐̸","&nequiv;":"≢","&nesear;":"⤨","&nesim;":"≂̸","&nexist;":"∄","&nexists;":"∄","&nfr;":"𝔫","&ngE;":"≧̸","&nge;":"≱","&ngeq;":"≱","&ngeqq;":"≧̸","&ngeqslant;":"⩾̸","&nges;":"⩾̸","&ngsim;":"≵","&ngt;":"≯","&ngtr;":"≯","&nhArr;":"⇎","&nharr;":"↮","&nhpar;":"⫲","&ni;":"∋","&nis;":"⋼","&nisd;":"⋺","&niv;":"∋","&njcy;":"њ","&nlArr;":"⇍","&nlE;":"≦̸","&nlarr;":"↚","&nldr;":"‥","&nle;":"≰","&nleftarrow;":"↚","&nleftrightarrow;":"↮","&nleq;":"≰","&nleqq;":"≦̸","&nleqslant;":"⩽̸","&nles;":"⩽̸","&nless;":"≮","&nlsim;":"≴","&nlt;":"≮","&nltri;":"⋪","&nltrie;":"⋬","&nmid;":"∤","&nopf;":"𝕟","&not":"¬","&not;":"¬","&notin;":"∉","&notinE;":"⋹̸","&notindot;":"⋵̸","&notinva;":"∉","&notinvb;":"⋷","&notinvc;":"⋶","&notni;":"∌","&notniva;":"∌","&notnivb;":"⋾","&notnivc;":"⋽","&npar;":"∦","&nparallel;":"∦","&nparsl;":"⫽⃥","&npart;":"∂̸","&npolint;":"⨔","&npr;":"⊀","&nprcue;":"⋠","&npre;":"⪯̸","&nprec;":"⊀","&npreceq;":"⪯̸","&nrArr;":"⇏","&nrarr;":"↛","&nrarrc;":"⤳̸","&nrarrw;":"↝̸","&nrightarrow;":"↛","&nrtri;":"⋫","&nrtrie;":"⋭","&nsc;":"⊁","&nsccue;":"⋡","&nsce;":"⪰̸","&nscr;":"𝓃","&nshortmid;":"∤","&nshortparallel;":"∦","&nsim;":"≁","&nsime;":"≄","&nsimeq;":"≄","&nsmid;":"∤","&nspar;":"∦","&nsqsube;":"⋢","&nsqsupe;":"⋣","&nsub;":"⊄","&nsubE;":"⫅̸","&nsube;":"⊈","&nsubset;":"⊂⃒","&nsubseteq;":"⊈","&nsubseteqq;":"⫅̸","&nsucc;":"⊁","&nsucceq;":"⪰̸","&nsup;":"⊅","&nsupE;":"⫆̸","&nsupe;":"⊉","&nsupset;":"⊃⃒","&nsupseteq;":"⊉","&nsupseteqq;":"⫆̸","&ntgl;":"≹","&ntilde":"ñ","&ntilde;":"ñ","&ntlg;":"≸","&ntriangleleft;":"⋪","&ntrianglelefteq;":"⋬","&ntriangleright;":"⋫","&ntrianglerighteq;":"⋭","&nu;":"ν","&num;":"#","&numero;":"№","&numsp;":" ","&nvDash;":"⊭","&nvHarr;":"⤄","&nvap;":"≍⃒","&nvdash;":"⊬","&nvge;":"≥⃒","&nvgt;":">⃒","&nvinfin;":"⧞","&nvlArr;":"⤂","&nvle;":"≤⃒","&nvlt;":"<⃒","&nvltrie;":"⊴⃒","&nvrArr;":"⤃","&nvrtrie;":"⊵⃒","&nvsim;":"∼⃒","&nwArr;":"⇖","&nwarhk;":"⤣","&nwarr;":"↖","&nwarrow;":"↖","&nwnear;":"⤧","&oS;":"Ⓢ","&oacute":"ó","&oacute;":"ó","&oast;":"⊛","&ocir;":"⊚","&ocirc":"ô","&ocirc;":"ô","&ocy;":"о","&odash;":"⊝","&odblac;":"ő","&odiv;":"⨸","&odot;":"⊙","&odsold;":"⦼","&oelig;":"œ","&ofcir;":"⦿","&ofr;":"𝔬","&ogon;":"˛","&ograve":"ò","&ograve;":"ò","&ogt;":"⧁","&ohbar;":"⦵","&ohm;":"Ω","&oint;":"∮","&olarr;":"↺","&olcir;":"⦾","&olcross;":"⦻","&oline;":"‾","&olt;":"⧀","&omacr;":"ō","&omega;":"ω","&omicron;":"ο","&omid;":"⦶","&ominus;":"⊖","&oopf;":"𝕠","&opar;":"⦷","&operp;":"⦹","&oplus;":"⊕","&or;":"∨","&orarr;":"↻","&ord;":"⩝","&order;":"ℴ","&orderof;":"ℴ","&ordf":"ª","&ordf;":"ª","&ordm":"º","&ordm;":"º","&origof;":"⊶","&oror;":"⩖","&orslope;":"⩗","&orv;":"⩛","&oscr;":"ℴ","&oslash":"ø","&oslash;":"ø","&osol;":"⊘","&otilde":"õ","&otilde;":"õ","&otimes;":"⊗","&otimesas;":"⨶","&ouml":"ö","&ouml;":"ö","&ovbar;":"⌽","&par;":"∥","&para":"¶","&para;":"¶","&parallel;":"∥","&parsim;":"⫳","&parsl;":"⫽","&part;":"∂","&pcy;":"п","&percnt;":"%","&period;":".","&permil;":"‰","&perp;":"⊥","&pertenk;":"‱","&pfr;":"𝔭","&phi;":"φ","&phiv;":"ϕ","&phmmat;":"ℳ","&phone;":"☎","&pi;":"π","&pitchfork;":"⋔","&piv;":"ϖ","&planck;":"ℏ","&planckh;":"ℎ","&plankv;":"ℏ","&plus;":"+","&plusacir;":"⨣","&plusb;":"⊞","&pluscir;":"⨢","&plusdo;":"∔","&plusdu;":"⨥","&pluse;":"⩲","&plusmn":"±","&plusmn;":"±","&plussim;":"⨦","&plustwo;":"⨧","&pm;":"±","&pointint;":"⨕","&popf;":"𝕡","&pound":"£","&pound;":"£","&pr;":"≺","&prE;":"⪳","&prap;":"⪷","&prcue;":"≼","&pre;":"⪯","&prec;":"≺","&precapprox;":"⪷","&preccurlyeq;":"≼","&preceq;":"⪯","&precnapprox;":"⪹","&precneqq;":"⪵","&precnsim;":"⋨","&precsim;":"≾","&prime;":"′","&primes;":"ℙ","&prnE;":"⪵","&prnap;":"⪹","&prnsim;":"⋨","&prod;":"∏","&profalar;":"⌮","&profline;":"⌒","&profsurf;":"⌓","&prop;":"∝","&propto;":"∝","&prsim;":"≾","&prurel;":"⊰","&pscr;":"𝓅","&psi;":"ψ","&puncsp;":" ","&qfr;":"𝔮","&qint;":"⨌","&qopf;":"𝕢","&qprime;":"⁗","&qscr;":"𝓆","&quaternions;":"ℍ","&quatint;":"⨖","&quest;":"?","&questeq;":"≟","&quot":'"',"&quot;":'"',"&rAarr;":"⇛","&rArr;":"⇒","&rAtail;":"⤜","&rBarr;":"⤏","&rHar;":"⥤","&race;":"∽̱","&racute;":"ŕ","&radic;":"√","&raemptyv;":"⦳","&rang;":"⟩","&rangd;":"⦒","&range;":"⦥","&rangle;":"⟩","&raquo":"»","&raquo;":"»","&rarr;":"→","&rarrap;":"⥵","&rarrb;":"⇥","&rarrbfs;":"⤠","&rarrc;":"⤳","&rarrfs;":"⤞","&rarrhk;":"↪","&rarrlp;":"↬","&rarrpl;":"⥅","&rarrsim;":"⥴","&rarrtl;":"↣","&rarrw;":"↝","&ratail;":"⤚","&ratio;":"∶","&rationals;":"ℚ","&rbarr;":"⤍","&rbbrk;":"❳","&rbrace;":"}","&rbrack;":"]","&rbrke;":"⦌","&rbrksld;":"⦎","&rbrkslu;":"⦐","&rcaron;":"ř","&rcedil;":"ŗ","&rceil;":"⌉","&rcub;":"}","&rcy;":"р","&rdca;":"⤷","&rdldhar;":"⥩","&rdquo;":"”","&rdquor;":"”","&rdsh;":"↳","&real;":"ℜ","&realine;":"ℛ","&realpart;":"ℜ","&reals;":"ℝ","&rect;":"▭","&reg":"®","&reg;":"®","&rfisht;":"⥽","&rfloor;":"⌋","&rfr;":"𝔯","&rhard;":"⇁","&rharu;":"⇀","&rharul;":"⥬","&rho;":"ρ","&rhov;":"ϱ","&rightarrow;":"→","&rightarrowtail;":"↣","&rightharpoondown;":"⇁","&rightharpoonup;":"⇀","&rightleftarrows;":"⇄","&rightleftharpoons;":"⇌","&rightrightarrows;":"⇉","&rightsquigarrow;":"↝","&rightthreetimes;":"⋌","&ring;":"˚","&risingdotseq;":"≓","&rlarr;":"⇄","&rlhar;":"⇌","&rlm;":"‏","&rmoust;":"⎱","&rmoustache;":"⎱","&rnmid;":"⫮","&roang;":"⟭","&roarr;":"⇾","&robrk;":"⟧","&ropar;":"⦆","&ropf;":"𝕣","&roplus;":"⨮","&rotimes;":"⨵","&rpar;":")","&rpargt;":"⦔","&rppolint;":"⨒","&rrarr;":"⇉","&rsaquo;":"›","&rscr;":"𝓇","&rsh;":"↱","&rsqb;":"]","&rsquo;":"’","&rsquor;":"’","&rthree;":"⋌","&rtimes;":"⋊","&rtri;":"▹","&rtrie;":"⊵","&rtrif;":"▸","&rtriltri;":"⧎","&ruluhar;":"⥨","&rx;":"℞","&sacute;":"ś","&sbquo;":"‚","&sc;":"≻","&scE;":"⪴","&scap;":"⪸","&scaron;":"š","&sccue;":"≽","&sce;":"⪰","&scedil;":"ş","&scirc;":"ŝ","&scnE;":"⪶","&scnap;":"⪺","&scnsim;":"⋩","&scpolint;":"⨓","&scsim;":"≿","&scy;":"с","&sdot;":"⋅","&sdotb;":"⊡","&sdote;":"⩦","&seArr;":"⇘","&searhk;":"⤥","&searr;":"↘","&searrow;":"↘","&sect":"§","&sect;":"§","&semi;":";","&seswar;":"⤩","&setminus;":"∖","&setmn;":"∖","&sext;":"✶","&sfr;":"𝔰","&sfrown;":"⌢","&sharp;":"♯","&shchcy;":"щ","&shcy;":"ш","&shortmid;":"∣","&shortparallel;":"∥","&shy":"­","&shy;":"­","&sigma;":"σ","&sigmaf;":"ς","&sigmav;":"ς","&sim;":"∼","&simdot;":"⩪","&sime;":"≃","&simeq;":"≃","&simg;":"⪞","&simgE;":"⪠","&siml;":"⪝","&simlE;":"⪟","&simne;":"≆","&simplus;":"⨤","&simrarr;":"⥲","&slarr;":"←","&smallsetminus;":"∖","&smashp;":"⨳","&smeparsl;":"⧤","&smid;":"∣","&smile;":"⌣","&smt;":"⪪","&smte;":"⪬","&smtes;":"⪬︀","&softcy;":"ь","&sol;":"/","&solb;":"⧄","&solbar;":"⌿","&sopf;":"𝕤","&spades;":"♠","&spadesuit;":"♠","&spar;":"∥","&sqcap;":"⊓","&sqcaps;":"⊓︀","&sqcup;":"⊔","&sqcups;":"⊔︀","&sqsub;":"⊏","&sqsube;":"⊑","&sqsubset;":"⊏","&sqsubseteq;":"⊑","&sqsup;":"⊐","&sqsupe;":"⊒","&sqsupset;":"⊐","&sqsupseteq;":"⊒","&squ;":"□","&square;":"□","&squarf;":"▪","&squf;":"▪","&srarr;":"→","&sscr;":"𝓈","&ssetmn;":"∖","&ssmile;":"⌣","&sstarf;":"⋆","&star;":"☆","&starf;":"★","&straightepsilon;":"ϵ","&straightphi;":"ϕ","&strns;":"¯","&sub;":"⊂","&subE;":"⫅","&subdot;":"⪽","&sube;":"⊆","&subedot;":"⫃","&submult;":"⫁","&subnE;":"⫋","&subne;":"⊊","&subplus;":"⪿","&subrarr;":"⥹","&subset;":"⊂","&subseteq;":"⊆","&subseteqq;":"⫅","&subsetneq;":"⊊","&subsetneqq;":"⫋","&subsim;":"⫇","&subsub;":"⫕","&subsup;":"⫓","&succ;":"≻","&succapprox;":"⪸","&succcurlyeq;":"≽","&succeq;":"⪰","&succnapprox;":"⪺","&succneqq;":"⪶","&succnsim;":"⋩","&succsim;":"≿","&sum;":"∑","&sung;":"♪","&sup1":"¹","&sup1;":"¹","&sup2":"²","&sup2;":"²","&sup3":"³","&sup3;":"³","&sup;":"⊃","&supE;":"⫆","&supdot;":"⪾","&supdsub;":"⫘","&supe;":"⊇","&supedot;":"⫄","&suphsol;":"⟉","&suphsub;":"⫗","&suplarr;":"⥻","&supmult;":"⫂","&supnE;":"⫌","&supne;":"⊋","&supplus;":"⫀","&supset;":"⊃","&supseteq;":"⊇","&supseteqq;":"⫆","&supsetneq;":"⊋","&supsetneqq;":"⫌","&supsim;":"⫈","&supsub;":"⫔","&supsup;":"⫖","&swArr;":"⇙","&swarhk;":"⤦","&swarr;":"↙","&swarrow;":"↙","&swnwar;":"⤪","&szlig":"ß","&szlig;":"ß","&target;":"⌖","&tau;":"τ","&tbrk;":"⎴","&tcaron;":"ť","&tcedil;":"ţ","&tcy;":"т","&tdot;":"⃛","&telrec;":"⌕","&tfr;":"𝔱","&there4;":"∴","&therefore;":"∴","&theta;":"θ","&thetasym;":"ϑ","&thetav;":"ϑ","&thickapprox;":"≈","&thicksim;":"∼","&thinsp;":" ","&thkap;":"≈","&thksim;":"∼","&thorn":"þ","&thorn;":"þ","&tilde;":"˜","&times":"×","&times;":"×","&timesb;":"⊠","&timesbar;":"⨱","&timesd;":"⨰","&tint;":"∭","&toea;":"⤨","&top;":"⊤","&topbot;":"⌶","&topcir;":"⫱","&topf;":"𝕥","&topfork;":"⫚","&tosa;":"⤩","&tprime;":"‴","&trade;":"™","&triangle;":"▵","&triangledown;":"▿","&triangleleft;":"◃","&trianglelefteq;":"⊴","&triangleq;":"≜","&triangleright;":"▹","&trianglerighteq;":"⊵","&tridot;":"◬","&trie;":"≜","&triminus;":"⨺","&triplus;":"⨹","&trisb;":"⧍","&tritime;":"⨻","&trpezium;":"⏢","&tscr;":"𝓉","&tscy;":"ц","&tshcy;":"ћ","&tstrok;":"ŧ","&twixt;":"≬","&twoheadleftarrow;":"↞","&twoheadrightarrow;":"↠","&uArr;":"⇑","&uHar;":"⥣","&uacute":"ú","&uacute;":"ú","&uarr;":"↑","&ubrcy;":"ў","&ubreve;":"ŭ","&ucirc":"û","&ucirc;":"û","&ucy;":"у","&udarr;":"⇅","&udblac;":"ű","&udhar;":"⥮","&ufisht;":"⥾","&ufr;":"𝔲","&ugrave":"ù","&ugrave;":"ù","&uharl;":"↿","&uharr;":"↾","&uhblk;":"▀","&ulcorn;":"⌜","&ulcorner;":"⌜","&ulcrop;":"⌏","&ultri;":"◸","&umacr;":"ū","&uml":"¨","&uml;":"¨","&uogon;":"ų","&uopf;":"𝕦","&uparrow;":"↑","&updownarrow;":"↕","&upharpoonleft;":"↿","&upharpoonright;":"↾","&uplus;":"⊎","&upsi;":"υ","&upsih;":"ϒ","&upsilon;":"υ","&upuparrows;":"⇈","&urcorn;":"⌝","&urcorner;":"⌝","&urcrop;":"⌎","&uring;":"ů","&urtri;":"◹","&uscr;":"𝓊","&utdot;":"⋰","&utilde;":"ũ","&utri;":"▵","&utrif;":"▴","&uuarr;":"⇈","&uuml":"ü","&uuml;":"ü","&uwangle;":"⦧","&vArr;":"⇕","&vBar;":"⫨","&vBarv;":"⫩","&vDash;":"⊨","&vangrt;":"⦜","&varepsilon;":"ϵ","&varkappa;":"ϰ","&varnothing;":"∅","&varphi;":"ϕ","&varpi;":"ϖ","&varpropto;":"∝","&varr;":"↕","&varrho;":"ϱ","&varsigma;":"ς","&varsubsetneq;":"⊊︀","&varsubsetneqq;":"⫋︀","&varsupsetneq;":"⊋︀","&varsupsetneqq;":"⫌︀","&vartheta;":"ϑ","&vartriangleleft;":"⊲","&vartriangleright;":"⊳","&vcy;":"в","&vdash;":"⊢","&vee;":"∨","&veebar;":"⊻","&veeeq;":"≚","&vellip;":"⋮","&verbar;":"|","&vert;":"|","&vfr;":"𝔳","&vltri;":"⊲","&vnsub;":"⊂⃒","&vnsup;":"⊃⃒","&vopf;":"𝕧","&vprop;":"∝","&vrtri;":"⊳","&vscr;":"𝓋","&vsubnE;":"⫋︀","&vsubne;":"⊊︀","&vsupnE;":"⫌︀","&vsupne;":"⊋︀","&vzigzag;":"⦚","&wcirc;":"ŵ","&wedbar;":"⩟","&wedge;":"∧","&wedgeq;":"≙","&weierp;":"℘","&wfr;":"𝔴","&wopf;":"𝕨","&wp;":"℘","&wr;":"≀","&wreath;":"≀","&wscr;":"𝓌","&xcap;":"⋂","&xcirc;":"◯","&xcup;":"⋃","&xdtri;":"▽","&xfr;":"𝔵","&xhArr;":"⟺","&xharr;":"⟷","&xi;":"ξ","&xlArr;":"⟸","&xlarr;":"⟵","&xmap;":"⟼","&xnis;":"⋻","&xodot;":"⨀","&xopf;":"𝕩","&xoplus;":"⨁","&xotime;":"⨂","&xrArr;":"⟹","&xrarr;":"⟶","&xscr;":"𝓍","&xsqcup;":"⨆","&xuplus;":"⨄","&xutri;":"△","&xvee;":"⋁","&xwedge;":"⋀","&yacute":"ý","&yacute;":"ý","&yacy;":"я","&ycirc;":"ŷ","&ycy;":"ы","&yen":"¥","&yen;":"¥","&yfr;":"𝔶","&yicy;":"ї","&yopf;":"𝕪","&yscr;":"𝓎","&yucy;":"ю","&yuml":"ÿ","&yuml;":"ÿ","&zacute;":"ź","&zcaron;":"ž","&zcy;":"з","&zdot;":"ż","&zeetrf;":"ℨ","&zeta;":"ζ","&zfr;":"𝔷","&zhcy;":"ж","&zigrarr;":"⇝","&zopf;":"𝕫","&zscr;":"𝓏","&zwj;":"‍","&zwnj;":"‌"};function er(o){return o.replace(/&(#\d+|#x[a-f0-9]+|[a-z]+\d*);?/gi,(e,r)=>{if(typeof ht[e]=="string")return ht[e];if(r.charAt(0)!=="#"||e.charAt(e.length-1)!==";")return e;let u;r.charAt(1)==="x"?u=parseInt(r.substr(2),16):u=parseInt(r.substr(1),10);var a="";return u>=55296&&u<=57343||u>1114111?"�":(u>65535&&(u-=65536,a+=String.fromCharCode(u>>>10&1023|55296),u=56320|u&1023),a+=String.fromCharCode(u),a)})}function ae(o){return o.trim().replace(/[<>"'?&]/g,e=>{let r=e.charCodeAt(0).toString(16);return r.length<2&&(r="0"+r),"&#x"+r.toUpperCase()+";"})}function tr(o){return"<div>"+ae(o).replace(/\n/g,"<br />")+"</div>"}function rr(o){return o=o.replace(/\r?\n/g,"").replace(/<\!\-\-.*?\-\->/gi," ").replace(/<br\b[^>]*>/gi,`
7
+ `).replace(/<\/?(p|div|table|tr|td|th)\b[^>]*>/gi,`
8
+
9
+ `).replace(/<script\b[^>]*>.*?<\/script\b[^>]*>/gi," ").replace(/^.*<body\b[^>]*>/i,"").replace(/^.*<\/head\b[^>]*>/i,"").replace(/^.*<\!doctype\b[^>]*>/i,"").replace(/<\/body\b[^>]*>.*$/i,"").replace(/<\/html\b[^>]*>.*$/i,"").replace(/<a\b[^>]*href\s*=\s*["']?([^\s"']+)[^>]*>/gi," ($1) ").replace(/<\/?(span|em|i|strong|b|u|a)\b[^>]*>/gi,"").replace(/<li\b[^>]*>[\n\u0001\s]*/gi,"* ").replace(/<hr\b[^>]*>/g,`
10
+ -------------
11
+ `).replace(/<[^>]*>/g," ").replace(/\u0001/g,`
12
+ `).replace(/[ \t]+/g," ").replace(/^\s+$/gm,"").replace(/\n\n+/g,`
13
+
14
+ `).replace(/^\n+/,`
15
+ `).replace(/\n+$/,`
16
+ `),o=er(o),o}function bt(o){return[].concat(o.name||[]).concat(o.name?`<${o.address}>`:o.address).join(" ")}function Je(o){let e=[],r=(u,a)=>{if(a&&e.push(", "),u.group){let n=`${u.name}:`,t=";";e.push(n),u.group.forEach(r),e.push(t)}else e.push(bt(u))};return o.forEach(r),e.join("")}function yt(o){return`<a href="mailto:${ae(o.address)}" class="postal-email-address">${ae(o.name||`<${o.address}>`)}</a>`}function Ke(o){let e=[],r=(u,a)=>{if(a&&e.push('<span class="postal-email-address-separator">, </span>'),u.group){let n=`<span class="postal-email-address-group">${ae(u.name)}:</span>`,t='<span class="postal-email-address-group">;</span>';e.push(n),u.group.forEach(r),e.push(t)}else e.push(yt(u))};return o.forEach(r),e.join(" ")}function ur(o,e,r){o=(o||"").toString(),e=e||76;let u=0,a=o.length,n="",t,i;for(;u<a;){if(t=o.substr(u,e),t.length<e){n+=t;break}if(i=t.match(/^[^\n\r]*(\r?\n|\r)/)){t=i[0],n+=t,u+=t.length;continue}else(i=t.match(/(\s+)[^\s]*$/))&&i[0].length-(i[1]||"").length<t.length?t=t.substr(0,t.length-(i[0].length-(i[1]||"").length)):(i=o.substr(u+t.length).match(/^[^\s]+(\s*)/))&&(t=t+i[0].substr(0,i[0].length-0));n+=t,u+=t.length,u<a&&(n+=`\r
17
+ `)}return n}function gt(o){let e=[];if(o.from&&e.push({key:"From",val:bt(o.from)}),o.subject&&e.push({key:"Subject",val:o.subject}),o.date){let t={year:"numeric",month:"numeric",day:"numeric",hour:"numeric",minute:"numeric",second:"numeric",hour12:!1},i=typeof Intl>"u"?o.date:new Intl.DateTimeFormat("default",t).format(new Date(o.date));e.push({key:"Date",val:i})}o.to&&o.to.length&&e.push({key:"To",val:Je(o.to)}),o.cc&&o.cc.length&&e.push({key:"Cc",val:Je(o.cc)}),o.bcc&&o.bcc.length&&e.push({key:"Bcc",val:Je(o.bcc)});let r=e.map(t=>t.key.length).reduce((t,i)=>i>t?i:t,0);e=e.flatMap(t=>{let i=r-t.key.length,l=`${t.key}: ${" ".repeat(i)}`,d=`${" ".repeat(t.key.length+1)} ${" ".repeat(i)}`;return ur(t.val,80).split(/\r?\n/).map(h=>h.trim()).map((h,m)=>`${m?d:l}${h}`)});let u=e.map(t=>t.length).reduce((t,i)=>i>t?i:t,0),a="-".repeat(u);return`
18
+ ${a}
19
+ ${e.join(`
20
+ `)}
21
+ ${a}
22
+ `}function mt(o){let e=[];if(o.from&&e.push(`<div class="postal-email-header-key">From</div><div class="postal-email-header-value">${yt(o.from)}</div>`),o.subject&&e.push(`<div class="postal-email-header-key">Subject</div><div class="postal-email-header-value postal-email-header-subject">${ae(o.subject)}</div>`),o.date){let u={year:"numeric",month:"numeric",day:"numeric",hour:"numeric",minute:"numeric",second:"numeric",hour12:!1},a=typeof Intl>"u"?o.date:new Intl.DateTimeFormat("default",u).format(new Date(o.date));e.push(`<div class="postal-email-header-key">Date</div><div class="postal-email-header-value postal-email-header-date" data-date="${ae(o.date)}">${ae(a)}</div>`)}return o.to&&o.to.length&&e.push(`<div class="postal-email-header-key">To</div><div class="postal-email-header-value">${Ke(o.to)}</div>`),o.cc&&o.cc.length&&e.push(`<div class="postal-email-header-key">Cc</div><div class="postal-email-header-value">${Ke(o.cc)}</div>`),o.bcc&&o.bcc.length&&e.push(`<div class="postal-email-header-key">Bcc</div><div class="postal-email-header-value">${Ke(o.bcc)}</div>`),`<div class="postal-email-header">${e.length?'<div class="postal-email-header-row">':""}${e.join(`</div>
23
+ <div class="postal-email-header-row">`)}${e.length?"</div>":""}</div>`}function ar(o,e){let r=!1,u="text",a,n=[],t={address:[],comment:[],group:[],text:[],textWasQuoted:[]},i,l,d=!1;for(i=0,l=o.length;i<l;i++){let c=o[i],h=i?o[i-1]:null;if(c.type==="operator")switch(c.value){case"<":u="address",d=!1;break;case"(":u="comment",d=!1;break;case":":u="group",r=!0,d=!1;break;case'"':d=!d,u="text";break;default:u="text",d=!1;break}else c.value&&(u==="address"&&(c.value=c.value.replace(/^[^<]*<\s*/,"")),h&&h.noBreak&&t[u].length?(t[u][t[u].length-1]+=c.value,u==="text"&&d&&(t.textWasQuoted[t.textWasQuoted.length-1]=!0)):(t[u].push(c.value),u==="text"&&t.textWasQuoted.push(d)))}if(!t.text.length&&t.comment.length&&(t.text=t.comment,t.comment=[]),r){t.text=t.text.join(" ");let c=[];t.group.length&&Be(t.group.join(","),{_depth:e+1}).forEach(m=>{m.group?c=c.concat(m.group):c.push(m)}),n.push({name:we(t.text||a&&a.name),group:c})}else{if(!t.address.length&&t.text.length){for(i=t.text.length-1;i>=0;i--)if(!t.textWasQuoted[i]&&t.text[i].match(/^[^@\s]+@[^@\s]+$/)){t.address=t.text.splice(i,1),t.textWasQuoted.splice(i,1);break}let c=function(h){return t.address.length?h:(t.address=[h.trim()]," ")};if(!t.address.length)for(i=t.text.length-1;i>=0&&!(!t.textWasQuoted[i]&&(t.text[i]=t.text[i].replace(/\s*\b[^@\s]+@[^\s]+\b\s*/,c).trim(),t.address.length));i--);}if(!t.text.length&&t.comment.length&&(t.text=t.comment,t.comment=[]),t.address.length>1&&(t.text=t.text.concat(t.address.splice(1))),t.text=t.text.join(" "),t.address=t.address.join(" "),!t.address&&/^=\?[^=]+?=$/.test(t.text.trim())){const c=Be(we(t.text));if(c&&c.length)return c}if(!t.address&&r)return[];a={address:t.address||t.text||"",name:we(t.text||t.address||"")},a.address===a.name&&((a.address||"").match(/@/)?a.name="":a.address=""),n.push(a)}return n}class sr{constructor(e){this.str=(e||"").toString(),this.operatorCurrent="",this.operatorExpecting="",this.node=null,this.escaped=!1,this.list=[],this.operators={'"':'"',"(":")","<":">",",":"",":":";",";":""}}tokenize(){let e=[];for(let r=0,u=this.str.length;r<u;r++){let a=this.str.charAt(r),n=r<u-1?this.str.charAt(r+1):null;this.checkChar(a,n)}return this.list.forEach(r=>{r.value=(r.value||"").toString().trim(),r.value&&e.push(r)}),e}checkChar(e,r){if(!this.escaped){if(e===this.operatorExpecting){this.node={type:"operator",value:e},r&&![" "," ","\r",`
24
+ `,",",";"].includes(r)&&(this.node.noBreak=!0),this.list.push(this.node),this.node=null,this.operatorExpecting="",this.escaped=!1;return}else if(!this.operatorExpecting&&e in this.operators){this.node={type:"operator",value:e},this.list.push(this.node),this.node=null,this.operatorExpecting=this.operators[e],this.escaped=!1;return}else if(['"',"'"].includes(this.operatorExpecting)&&e==="\\"){this.escaped=!0;return}}this.node||(this.node={type:"text",value:""},this.list.push(this.node)),e===`
25
+ `&&(e=" "),(e.charCodeAt(0)>=33||[" "," "].includes(e))&&(this.node.value+=e),this.escaped=!1}}const nr=50;function Be(o,e){e=e||{};let r=e._depth||0;if(r>nr)return[];let a=new sr(o).tokenize(),n=[],t=[],i=[];if(a.forEach(l=>{l.type==="operator"&&(l.value===","||l.value===";")?(t.length&&n.push(t),t=[]):t.push(l)}),t.length&&n.push(t),n.forEach(l=>{l=ar(l,r),l.length&&(i=i.concat(l))}),e.flatten){let l=[],d=c=>{c.forEach(h=>{if(h.group)return d(h.group);l.push(h)})};return d(i),l}return i}function ir(o){for(var e="",r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",u=new Uint8Array(o),a=u.byteLength,n=a%3,t=a-n,i,l,d,c,h,m=0;m<t;m=m+3)h=u[m]<<16|u[m+1]<<8|u[m+2],i=(h&16515072)>>18,l=(h&258048)>>12,d=(h&4032)>>6,c=h&63,e+=r[i]+r[l]+r[d]+r[c];return n==1?(h=u[t],i=(h&252)>>2,l=(h&3)<<4,e+=r[i]+r[l]+"=="):n==2&&(h=u[t]<<8|u[t+1],i=(h&64512)>>10,l=(h&1008)>>4,d=(h&15)<<2,e+=r[i]+r[l]+r[d]+"="),e}const or=256,lr=2*1024*1024;class Ne{static parse(e,r){return new Ne(r).parse(e)}constructor(e){this.options=e||{},this.mimeOptions={maxNestingDepth:this.options.maxNestingDepth||or,maxHeadersSize:this.options.maxHeadersSize||lr},this.root=this.currentNode=new pt({postalMime:this,...this.mimeOptions}),this.boundaries=[],this.textContent={},this.attachments=[],this.attachmentEncoding=(this.options.attachmentEncoding||"").toString().replace(/[-_\s]/g,"").trim().toLowerCase()||"arraybuffer",this.started=!1}async finalize(){await this.root.finalize()}async processLine(e,r){let u=this.boundaries;if(u.length&&e.length>2&&e[0]===45&&e[1]===45)for(let a=u.length-1;a>=0;a--){let n=u[a];if(e.length!==n.value.length+2&&e.length!==n.value.length+4)continue;let t=e.length===n.value.length+4;if(t&&(e[e.length-2]!==45||e[e.length-1]!==45))continue;let i=!0;for(let l=0;l<n.value.length;l++)if(e[l+2]!==n.value[l]){i=!1;break}if(i)return t?(await n.node.finalize(),this.currentNode=n.node.parentNode||this.root):(await n.node.finalizeChildNodes(),this.currentNode=new pt({postalMime:this,parentNode:n.node,...this.mimeOptions})),r?this.finalize():void 0}if(this.currentNode.feed(e),r)return this.finalize()}readLine(){let e=this.readPos,r=this.readPos,u=()=>({bytes:new Uint8Array(this.buf,e,r-e),done:this.readPos>=this.av.length});for(;this.readPos<this.av.length;){const a=this.av[this.readPos++];if(a!==13&&a!==10&&(r=this.readPos),a===10)return u()}return u()}async processNodeTree(){let e={},r=new Set,u=this.textMap=new Map,a=this.forceRfc822Attachments(),n=async(t,i,l)=>{if(i=i||!1,l=l||!1,t.contentType.multipart)t.contentType.multipart==="alternative"?i=t:t.contentType.multipart==="related"&&(l=t);else if(this.isInlineMessageRfc822(t)&&!a){const d=new Ne;t.subMessage=await d.parse(t.content),u.has(t)||u.set(t,{});let c=u.get(t);(t.subMessage.text||!t.subMessage.html)&&(c.plain=c.plain||[],c.plain.push({type:"subMessage",value:t.subMessage}),r.add("plain")),t.subMessage.html&&(c.html=c.html||[],c.html.push({type:"subMessage",value:t.subMessage}),r.add("html")),d.textMap&&d.textMap.forEach((h,m)=>{u.set(m,h)});for(let h of t.subMessage.attachments||[])this.attachments.push(h)}else if(this.isInlineTextNode(t)){let d=t.contentType.parsed.value.substr(t.contentType.parsed.value.indexOf("/")+1),c=i||t;u.has(c)||u.set(c,{});let h=u.get(c);h[d]=h[d]||[],h[d].push({type:"text",value:t.getTextContent()}),r.add(d)}else if(t.content){const d=t.contentDisposition.parsed.params.filename||t.contentType.parsed.params.name||null,c={filename:d?we(d):null,mimeType:t.contentType.parsed.value,disposition:t.contentDisposition.parsed.value||null};switch(l&&t.contentId&&(c.related=!0),t.contentDescription&&(c.description=t.contentDescription),t.contentId&&(c.contentId=t.contentId),t.contentType.parsed.value){case"text/calendar":case"application/ics":{t.contentType.parsed.params.method&&(c.method=t.contentType.parsed.params.method.toString().toUpperCase().trim());const h=t.getTextContent().replace(/\r?\n/g,`
26
+ `).replace(/\n*$/,`
27
+ `);c.content=fe.encode(h);break}default:c.content=t.content}this.attachments.push(c)}for(let d of t.childNodes)await n(d,i,l)};await n(this.root,!1,[]),u.forEach(t=>{r.forEach(i=>{if(e[i]||(e[i]=[]),t[i])t[i].forEach(l=>{switch(l.type){case"text":e[i].push(l.value);break;case"subMessage":switch(i){case"html":e[i].push(mt(l.value));break;case"plain":e[i].push(gt(l.value));break}break}});else{let l;switch(i){case"html":l="plain";break;case"plain":l="html";break}(t[l]||[]).forEach(d=>{switch(d.type){case"text":switch(i){case"html":e[i].push(tr(d.value));break;case"plain":e[i].push(rr(d.value));break}break;case"subMessage":switch(i){case"html":e[i].push(mt(d.value));break;case"plain":e[i].push(gt(d.value));break}break}})}})}),Object.keys(e).forEach(t=>{e[t]=e[t].join(`
28
+ `)}),this.textContent=e}isInlineTextNode(e){if(e.contentDisposition.parsed.value==="attachment")return!1;switch(e.contentType.parsed.value){case"text/html":case"text/plain":return!0;case"text/calendar":case"text/csv":default:return!1}}isInlineMessageRfc822(e){return e.contentType.parsed.value!=="message/rfc822"?!1:(e.contentDisposition.parsed.value||(this.options.rfc822Attachments?"attachment":"inline"))==="inline"}forceRfc822Attachments(){if(this.options.forceRfc822Attachments)return!0;let e=!1,r=u=>{u.contentType.multipart||["message/delivery-status","message/feedback-report"].includes(u.contentType.parsed.value)&&(e=!0);for(let a of u.childNodes)r(a)};return r(this.root),e}async resolveStream(e){let r=0,u=[];const a=e.getReader();for(;;){const{done:i,value:l}=await a.read();if(i)break;u.push(l),r+=l.length}const n=new Uint8Array(r);let t=0;for(let i of u)n.set(i,t),t+=i.length;return n}async parse(e){var a,n;if(this.started)throw new Error("Can not reuse parser, create a new PostalMime object");for(this.started=!0,e&&typeof e.getReader=="function"&&(e=await this.resolveStream(e)),e=e||new ArrayBuffer(0),typeof e=="string"&&(e=fe.encode(e)),(e instanceof Blob||Object.prototype.toString.call(e)==="[object Blob]")&&(e=await Oe(e)),e.buffer instanceof ArrayBuffer&&(e=new Uint8Array(e).buffer),this.buf=e,this.av=new Uint8Array(e),this.readPos=0;this.readPos<this.av.length;){const t=this.readLine();await this.processLine(t.bytes,t.done)}await this.processNodeTree();const r={headers:this.root.headers.map(t=>({key:t.key,value:t.value})).reverse()};for(const t of["from","sender"]){const i=this.root.headers.find(l=>l.key===t);if(i&&i.value){const l=Be(i.value);l&&l.length&&(r[t]=l[0])}}for(const t of["delivered-to","return-path"]){const i=this.root.headers.find(l=>l.key===t);if(i&&i.value){const l=Be(i.value);if(l&&l.length&&l[0].address){const d=t.replace(/\-(.)/g,(c,h)=>h.toUpperCase());r[d]=l[0].address}}}for(const t of["to","cc","bcc","reply-to"]){const i=this.root.headers.filter(d=>d.key===t);let l=[];if(i.filter(d=>d&&d.value).map(d=>Be(d.value)).forEach(d=>l=l.concat(d||[])),l&&l.length){const d=t.replace(/\-(.)/g,(c,h)=>h.toUpperCase());r[d]=l}}for(const t of["subject","message-id","in-reply-to","references"]){const i=this.root.headers.find(l=>l.key===t);if(i&&i.value){const l=t.replace(/\-(.)/g,(d,c)=>c.toUpperCase());r[l]=we(i.value)}}let u=this.root.headers.find(t=>t.key==="date");if(u){let t=new Date(u.value);!t||t.toString()==="Invalid Date"?t=u.value:t=t.toISOString(),r.date=t}switch((a=this.textContent)!=null&&a.html&&(r.html=this.textContent.html),(n=this.textContent)!=null&&n.plain&&(r.text=this.textContent.plain),r.attachments=this.attachments,this.attachmentEncoding){case"arraybuffer":break;case"base64":for(let i of r.attachments||[])i!=null&&i.content&&(i.content=ir(i.content),i.encoding="base64");break;case"utf8":let t=new TextDecoder("utf8");for(let i of r.attachments||[])i!=null&&i.content&&(i.content=t.decode(i.content),i.encoding="utf8");break;default:throw new Error("Unknwon attachment encoding")}return r}}class vt{constructor(e){ye(this,"config");if(!e.system_id)throw new Error("MailClient: system_id is REQUIRED");this.config=e}async callCoprocessor(e,r,u={}){const a={coprocessor:e,method:r,system_id:this.config.system_id,params:{user_id:this.config.system_id,...u}};try{const n=await fetch(`${this.config.baseUrl}/spu/invoke`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.getToken()}`},body:JSON.stringify(a)});if(!n.ok){const i=await n.text();throw new Error(`API error (${n.status}): ${i}`)}const t=await n.json();if(!t.success&&t.error)throw new Error(t.error);return t.result}catch(n){throw console.error("API call failed:",n),n}}async callMail(e,r={}){return this.callCoprocessor("mail",e,r)}async callEmail(e,r={}){return this.callCoprocessor("email",e,r)}getToken(){return typeof window<"u"&&window.localStorage&&localStorage.getItem("qwanyx_token")||""}async getSettings(){try{return await this.callMail("get_email_settings")||{accounts:[]}}catch{return{accounts:[]}}}async saveSettings(e){await this.callMail("save_email_settings",{accounts:e})}async listEmails(e,r=20,u){return this.callMail("list_emails",{account_id:e,limit:r,folder:u})}async deleteEmails(e,r,u=!0){return this.callMail("delete_emails",{account_id:e,uids:r,expunge:u})}async imapExec(e,r){return this.callMail("imap_exec",{account_id:e,commands:r})}async trashEmails(e,r){const u=["[Gmail]/Trash","[Gmail]/Corbeille","[Gmail]/Bin","Trash"];for(const a of u){const n=["SELECT INBOX",...r.map(l=>`UID MOVE ${l} ${a}`)],i=(await this.imapExec(e,n)).responses.filter(l=>l.ok&&l.command==="UID MOVE").length;if(i>0)return{success:!0,moved:i}}return{success:!1,moved:0}}async archiveEmails(e,r){const u=["SELECT INBOX",...r.map(t=>`UID STORE ${t} +FLAGS (\\Deleted)`),"EXPUNGE"],n=(await this.imapExec(e,u)).responses.filter(t=>t.ok&&t.command==="UID STORE").length;return{success:n>0,archived:n}}async listFolders(e){const u=(await this.imapExec(e,['LIST "" *'])).responses.find(a=>a.command==="LIST");return u!=null&&u.ok&&u.folders?{success:!0,folders:u.folders}:{success:!1,folders:[]}}async listEmailsSorted(e,r="INBOX",u=20){const a=await this.imapExec(e,[`SELECT ${r}`,"FETCH 1:* (UID INTERNALDATE)"]),n=a.responses.find(A=>A.command==="SELECT");if(!(n!=null&&n.ok))throw new Error(`Failed to select folder: ${(n==null?void 0:n.error)||"Unknown error"}`);const t=a.responses.find(A=>A.command==="FETCH");if(!(t!=null&&t.ok)||!t.messages)return{account:{id:e,label:"",email:""},mailbox:{name:r,total:n.exists||0},messages:[]};const l=[...t.messages].sort((A,w)=>{const k=A.internalDate?new Date(A.internalDate).getTime():0;return(w.internalDate?new Date(w.internalDate).getTime():0)-k}).slice(0,u).map(A=>A.uid).filter(Boolean);if(l.length===0)return{account:{id:e,label:"",email:""},mailbox:{name:r,total:n.exists||0},messages:[]};const c=(await this.imapExec(e,[`SELECT ${r}`,`UID FETCH ${l.join(",")} (UID FLAGS ENVELOPE)`])).responses.find(A=>A.command==="UID FETCH");if(!(c!=null&&c.ok)||!c.messages)throw new Error(`Failed to fetch details: ${(c==null?void 0:c.error)||"Unknown error"}`);const h=new Map;for(const A of c.messages)A.uid&&h.set(A.uid,A);const m=l.map(A=>{var I,b,L,y,R;const w=h.get(A);if(!w)return null;const k=((I=w.flags)==null?void 0:I.some(O=>O.includes("Seen")))||!1,G=((L=(b=w.envelope)==null?void 0:b.from)==null?void 0:L.email)||"Unknown",P=((y=w.envelope)==null?void 0:y.subject)||"(No subject)",B=((R=w.envelope)==null?void 0:R.date)||"";return{uid:A,from:G,subject:P,date:B,seen:k}}).filter(Boolean);return{account:{id:e,label:"",email:""},mailbox:{name:r,total:n.exists||0},messages:m}}async getEmail(e,r,u="INBOX"){return this.callMail("get_email",{account_id:e,uid:r,folder:u})}async getEmailParsed(e,r,u="INBOX"){var w,k,G,P;const n=(await this.imapExec(e,[`SELECT "${u}"`,`UID FETCH ${r} (FLAGS BODY[])`])).responses.find(B=>B.command==="UID FETCH");if(!(n!=null&&n.ok)||!((w=n.messages)!=null&&w[0]))return console.error("Failed to fetch raw email:",n==null?void 0:n.error),null;const t=n.messages[0],i=t.body||t.raw;if(!i)return console.error("No raw email content in response"),null;const d=await new Ne().parse(i),c=new Map;for(const B of d.attachments||[])if(B.contentId){const I=this.contentToBase64(B.content),b=`data:${B.mimeType};base64,${I}`,L=B.contentId.replace(/^<|>$/g,"");c.set(L,b),c.set(`<${L}>`,b)}let h=d.html||"";h&&c.size>0&&(h=h.replace(/src=["']cid:([^"']+)["']/gi,(B,I)=>{const b=c.get(I)||c.get(`<${I}>`);return b?`src="${b}"`:B}));const m=((k=t.flags)==null?void 0:k.some(B=>B.toLowerCase().includes("seen")))||!1,A=((G=d.from)==null?void 0:G.address)||((P=d.from)==null?void 0:P.name)||"Unknown";return{uid:r,from:A,subject:d.subject||"(No subject)",date:d.date||"",body:h||d.text||"",html:h,text:d.text||"",seen:m,attachments:(d.attachments||[]).map(B=>({filename:B.filename||"attachment",mimeType:B.mimeType||"application/octet-stream",size:this.getContentSize(B.content)}))}}contentToBase64(e){if(typeof e=="string")try{return btoa(e)}catch{return e}const r=e instanceof Uint8Array?e:new Uint8Array(e);let u="";for(let a=0;a<r.byteLength;a++)u+=String.fromCharCode(r[a]);return btoa(u)}getContentSize(e){return e?typeof e=="string"?e.length:(e instanceof Uint8Array,e.byteLength):0}async sendMail(e){const r={to:e.to,subject:e.subject,body:e.body};return e.html&&(r.html=e.html),e.from&&(r.from=e.from),e.smtpConfig&&(r.smtp_config=e.smtpConfig),this.callEmail("send",r)}}const Xe="qwanyx_auth_token",Ze="qwanyx_refresh_token";class Et{static setToken(e){typeof window<"u"&&localStorage.setItem(Xe,e)}static getToken(){return typeof window<"u"?localStorage.getItem(Xe):null}static clearToken(){typeof window<"u"&&(localStorage.removeItem(Xe),localStorage.removeItem(Ze))}static setRefreshToken(e){typeof window<"u"&&localStorage.setItem(Ze,e)}static getRefreshToken(){return typeof window<"u"?localStorage.getItem(Ze):null}static isAuthenticated(){return!!this.getToken()}static getAuthHeader(){const e=this.getToken();return e?{Authorization:`Bearer ${e}`}:{}}}class xt{constructor(e){ye(this,"config");this.config={timeout:3e4,headers:{"Content-Type":"application/json"},...e}}buildQueryString(e){if(!e||Object.keys(e).length===0)return"";const r=new URLSearchParams;Object.entries(e).forEach(([a,n])=>{n!=null&&r.append(a,String(n))});const u=r.toString();return u?`?${u}`:""}async request(e,r={}){const{method:u="GET",headers:a={},body:n,params:t}=r,i=`${this.config.baseUrl}/${e}${this.buildQueryString(t)}`,l={...this.config.headers,...Et.getAuthHeader(),...a},d={method:u,headers:l};n&&u!=="GET"&&(d.body=JSON.stringify(n));try{const c=new AbortController,h=setTimeout(()=>c.abort(),this.config.timeout),m=await fetch(i,{...d,signal:c.signal});if(clearTimeout(h),!m.ok){const A=await m.json().catch(()=>({message:m.statusText}));throw new Error(A.message||`HTTP ${m.status}`)}return await m.json()}catch(c){throw c instanceof Error?c:new Error("An unexpected error occurred")}}async get(e,r){return this.request(e,{method:"GET",params:r})}async post(e,r,u){return this.request(e,{method:"POST",body:r,params:u})}async put(e,r,u){return this.request(e,{method:"PUT",body:r,params:u})}async patch(e,r,u){return this.request(e,{method:"PATCH",body:r,params:u})}async delete(e,r){return this.request(e,{method:"DELETE",params:r})}setBaseUrl(e){this.config.baseUrl=e}getBaseUrl(){return this.config.baseUrl}}let Le=null;function cr(o){return Le=new xt(o),Le}function rt(){if(!Le)throw new Error("API client not initialized. Call initializeApiClient() first.");return Le}function Ct(o,e,r={}){const{enabled:u=!0,refetchOnMount:a=!0,onSuccess:n,onError:t}=r,[i,l]=v.useState(null),[d,c]=v.useState(u),[h,m]=v.useState(null),A=v.useCallback(async()=>{if(u){c(!0),m(null);try{const k=await rt().get(o,e);l(k),n==null||n(k)}catch(w){const k=w instanceof Error?w:new Error("Unknown error");m(k),t==null||t(k)}finally{c(!1)}}},[o,JSON.stringify(e),u,n,t]);return v.useEffect(()=>{a&&A()},[A,a]),{data:i,loading:d,error:h,refetch:A}}function dr(o,e="POST",r={}){const{onSuccess:u,onError:a}=r,[n,t]=v.useState(null),[i,l]=v.useState(!1),[d,c]=v.useState(null),h=v.useCallback(async A=>{l(!0),c(null);try{const w=rt();let k;switch(e){case"POST":k=await w.post(o,A);break;case"PUT":k=await w.put(o,A);break;case"PATCH":k=await w.patch(o,A);break;case"DELETE":k=await w.delete(o);break;default:throw new Error(`Unsupported method: ${e}`)}return t(k),u==null||u(k,A),k}catch(w){const k=w instanceof Error?w:new Error("Unknown error");return c(k),a==null||a(k,A),null}finally{l(!1)}},[o,e,u,a]),m=v.useCallback(()=>{t(null),c(null),l(!1)},[]);return{data:n,loading:i,error:d,mutate:h,reset:m}}var tt={exports:{}},ve={};/**
2
29
  * @license React
3
30
  * react-jsx-runtime.production.min.js
4
31
  *
@@ -6,7 +33,7 @@
6
33
  *
7
34
  * This source code is licensed under the MIT license found in the
8
35
  * LICENSE file in the root directory of this source tree.
9
- */var Xe;function kt(){if(Xe)return ve;Xe=1;var h=x,t=Symbol.for("react.element"),r=Symbol.for("react.fragment"),s=Object.prototype.hasOwnProperty,i=h.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,n={key:!0,ref:!0,__self:!0,__source:!0};function o(p,d,g){var c,j={},v=null,m=null;g!==void 0&&(v=""+g),d.key!==void 0&&(v=""+d.key),d.ref!==void 0&&(m=d.ref);for(c in d)s.call(d,c)&&!n.hasOwnProperty(c)&&(j[c]=d[c]);if(p&&p.defaultProps)for(c in d=p.defaultProps,d)j[c]===void 0&&(j[c]=d[c]);return{$$typeof:t,type:p,key:v,ref:m,props:j,_owner:i.current}}return ve.Fragment=r,ve.jsx=o,ve.jsxs=o,ve}var be={};/**
36
+ */var Dt;function fr(){if(Dt)return ve;Dt=1;var o=v,e=Symbol.for("react.element"),r=Symbol.for("react.fragment"),u=Object.prototype.hasOwnProperty,a=o.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,n={key:!0,ref:!0,__self:!0,__source:!0};function t(i,l,d){var c,h={},m=null,A=null;d!==void 0&&(m=""+d),l.key!==void 0&&(m=""+l.key),l.ref!==void 0&&(A=l.ref);for(c in l)u.call(l,c)&&!n.hasOwnProperty(c)&&(h[c]=l[c]);if(i&&i.defaultProps)for(c in l=i.defaultProps,l)h[c]===void 0&&(h[c]=l[c]);return{$$typeof:e,type:i,key:m,ref:A,props:h,_owner:a.current}}return ve.Fragment=r,ve.jsx=t,ve.jsxs=t,ve}var Ee={};/**
10
37
  * @license React
11
38
  * react-jsx-runtime.development.js
12
39
  *
@@ -14,21 +41,21 @@
14
41
  *
15
42
  * This source code is licensed under the MIT license found in the
16
43
  * LICENSE file in the root directory of this source tree.
17
- */var Ze;function Tt(){return Ze||(Ze=1,process.env.NODE_ENV!=="production"&&function(){var h=x,t=Symbol.for("react.element"),r=Symbol.for("react.portal"),s=Symbol.for("react.fragment"),i=Symbol.for("react.strict_mode"),n=Symbol.for("react.profiler"),o=Symbol.for("react.provider"),p=Symbol.for("react.context"),d=Symbol.for("react.forward_ref"),g=Symbol.for("react.suspense"),c=Symbol.for("react.suspense_list"),j=Symbol.for("react.memo"),v=Symbol.for("react.lazy"),m=Symbol.for("react.offscreen"),k=Symbol.iterator,C="@@iterator";function V(e){if(e===null||typeof e!="object")return null;var l=k&&e[k]||e[C];return typeof l=="function"?l:null}var I=h.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function F(e){{for(var l=arguments.length,u=new Array(l>1?l-1:0),w=1;w<l;w++)u[w-1]=arguments[w];W("error",e,u)}}function W(e,l,u){{var w=I.ReactDebugCurrentFrame,P=w.getStackAddendum();P!==""&&(l+="%s",u=u.concat([P]));var $=u.map(function(O){return String(O)});$.unshift("Warning: "+l),Function.prototype.apply.call(console[e],console,$)}}var E=!1,M=!1,y=!1,N=!1,D=!1,S;S=Symbol.for("react.module.reference");function A(e){return!!(typeof e=="string"||typeof e=="function"||e===s||e===n||D||e===i||e===g||e===c||N||e===m||E||M||y||typeof e=="object"&&e!==null&&(e.$$typeof===v||e.$$typeof===j||e.$$typeof===o||e.$$typeof===p||e.$$typeof===d||e.$$typeof===S||e.getModuleId!==void 0))}function b(e,l,u){var w=e.displayName;if(w)return w;var P=l.displayName||l.name||"";return P!==""?u+"("+P+")":u}function G(e){return e.displayName||"Context"}function L(e){if(e==null)return null;if(typeof e.tag=="number"&&F("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case s:return"Fragment";case r:return"Portal";case n:return"Profiler";case i:return"StrictMode";case g:return"Suspense";case c:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case p:var l=e;return G(l)+".Consumer";case o:var u=e;return G(u._context)+".Provider";case d:return b(e,e.render,"ForwardRef");case j:var w=e.displayName||null;return w!==null?w:L(e.type)||"Memo";case v:{var P=e,$=P._payload,O=P._init;try{return L(O($))}catch{return null}}}return null}var R=Object.assign,z=0,K,de,fe,we,pe,Y,te;function ne(){}ne.__reactDisabledLog=!0;function Ce(){{if(z===0){K=console.log,de=console.info,fe=console.warn,we=console.error,pe=console.group,Y=console.groupCollapsed,te=console.groupEnd;var e={configurable:!0,enumerable:!0,value:ne,writable:!0};Object.defineProperties(console,{info:e,log:e,warn:e,error:e,group:e,groupCollapsed:e,groupEnd:e})}z++}}function Oe(){{if(z--,z===0){var e={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:R({},e,{value:K}),info:R({},e,{value:de}),warn:R({},e,{value:fe}),error:R({},e,{value:we}),group:R({},e,{value:pe}),groupCollapsed:R({},e,{value:Y}),groupEnd:R({},e,{value:te})})}z<0&&F("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var he=I.ReactCurrentDispatcher,ge;function ae(e,l,u){{if(ge===void 0)try{throw Error()}catch(P){var w=P.stack.trim().match(/\n( *(at )?)/);ge=w&&w[1]||""}return`
18
- `+ge+e}}var me=!1,ie;{var Ne=typeof WeakMap=="function"?WeakMap:Map;ie=new Ne}function Ee(e,l){if(!e||me)return"";{var u=ie.get(e);if(u!==void 0)return u}var w;me=!0;var P=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var $;$=he.current,he.current=null,Ce();try{if(l){var O=function(){throw Error()};if(Object.defineProperty(O.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(O,[])}catch(H){w=H}Reflect.construct(e,[],O)}else{try{O.call()}catch(H){w=H}e.call(O.prototype)}}else{try{throw Error()}catch(H){w=H}e()}}catch(H){if(H&&w&&typeof H.stack=="string"){for(var T=H.stack.split(`
19
- `),q=w.stack.split(`
20
- `),U=T.length-1,B=q.length-1;U>=1&&B>=0&&T[U]!==q[B];)B--;for(;U>=1&&B>=0;U--,B--)if(T[U]!==q[B]){if(U!==1||B!==1)do if(U--,B--,B<0||T[U]!==q[B]){var X=`
21
- `+T[U].replace(" at new "," at ");return e.displayName&&X.includes("<anonymous>")&&(X=X.replace("<anonymous>",e.displayName)),typeof e=="function"&&ie.set(e,X),X}while(U>=1&&B>=0);break}}}finally{me=!1,he.current=$,Oe(),Error.prepareStackTrace=P}var ue=e?e.displayName||e.name:"",se=ue?ae(ue):"";return typeof e=="function"&&ie.set(e,se),se}function Ae(e,l,u){return Ee(e,!1)}function Pe(e){var l=e.prototype;return!!(l&&l.isReactComponent)}function oe(e,l,u){if(e==null)return"";if(typeof e=="function")return Ee(e,Pe(e));if(typeof e=="string")return ae(e);switch(e){case g:return ae("Suspense");case c:return ae("SuspenseList")}if(typeof e=="object")switch(e.$$typeof){case d:return Ae(e.render);case j:return oe(e.type,l,u);case v:{var w=e,P=w._payload,$=w._init;try{return oe($(P),l,u)}catch{}}}return""}var re=Object.prototype.hasOwnProperty,_e={},je=I.ReactDebugCurrentFrame;function le(e){if(e){var l=e._owner,u=oe(e.type,e._source,l?l.type:null);je.setExtraStackFrame(u)}else je.setExtraStackFrame(null)}function $e(e,l,u,w,P){{var $=Function.call.bind(re);for(var O in e)if($(e,O)){var T=void 0;try{if(typeof e[O]!="function"){var q=Error((w||"React class")+": "+u+" type `"+O+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof e[O]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw q.name="Invariant Violation",q}T=e[O](l,O,w,u,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(U){T=U}T&&!(T instanceof Error)&&(le(P),F("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",w||"React class",u,O,typeof T),le(null)),T instanceof Error&&!(T.message in _e)&&(_e[T.message]=!0,le(P),F("Failed %s type: %s",u,T.message),le(null))}}}var Fe=Array.isArray;function f(e){return Fe(e)}function _(e){{var l=typeof Symbol=="function"&&Symbol.toStringTag,u=l&&e[Symbol.toStringTag]||e.constructor.name||"Object";return u}}function J(e){try{return Q(e),!1}catch{return!0}}function Q(e){return""+e}function ee(e){if(J(e))return F("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",_(e)),Q(e)}var Z=I.ReactCurrentOwner,De={key:!0,ref:!0,__self:!0,__source:!0},ye,Se;function nt(e){if(re.call(e,"ref")){var l=Object.getOwnPropertyDescriptor(e,"ref").get;if(l&&l.isReactWarning)return!1}return e.ref!==void 0}function at(e){if(re.call(e,"key")){var l=Object.getOwnPropertyDescriptor(e,"key").get;if(l&&l.isReactWarning)return!1}return e.key!==void 0}function it(e,l){typeof e.ref=="string"&&Z.current}function ot(e,l){{var u=function(){ye||(ye=!0,F("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",l))};u.isReactWarning=!0,Object.defineProperty(e,"key",{get:u,configurable:!0})}}function lt(e,l){{var u=function(){Se||(Se=!0,F("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",l))};u.isReactWarning=!0,Object.defineProperty(e,"ref",{get:u,configurable:!0})}}var ct=function(e,l,u,w,P,$,O){var T={$$typeof:t,type:e,key:l,ref:u,props:O,_owner:$};return T._store={},Object.defineProperty(T._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(T,"_self",{configurable:!1,enumerable:!1,writable:!1,value:w}),Object.defineProperty(T,"_source",{configurable:!1,enumerable:!1,writable:!1,value:P}),Object.freeze&&(Object.freeze(T.props),Object.freeze(T)),T};function ut(e,l,u,w,P){{var $,O={},T=null,q=null;u!==void 0&&(ee(u),T=""+u),at(l)&&(ee(l.key),T=""+l.key),nt(l)&&(q=l.ref,it(l,P));for($ in l)re.call(l,$)&&!De.hasOwnProperty($)&&(O[$]=l[$]);if(e&&e.defaultProps){var U=e.defaultProps;for($ in U)O[$]===void 0&&(O[$]=U[$])}if(T||q){var B=typeof e=="function"?e.displayName||e.name||"Unknown":e;T&&ot(O,B),q&&lt(O,B)}return ct(e,T,q,P,w,Z.current,O)}}var Me=I.ReactCurrentOwner,Ye=I.ReactDebugCurrentFrame;function ce(e){if(e){var l=e._owner,u=oe(e.type,e._source,l?l.type:null);Ye.setExtraStackFrame(u)}else Ye.setExtraStackFrame(null)}var Ue;Ue=!1;function Be(e){return typeof e=="object"&&e!==null&&e.$$typeof===t}function qe(){{if(Me.current){var e=L(Me.current.type);if(e)return`
44
+ */var At;function pr(){return At||(At=1,process.env.NODE_ENV!=="production"&&function(){var o=v,e=Symbol.for("react.element"),r=Symbol.for("react.portal"),u=Symbol.for("react.fragment"),a=Symbol.for("react.strict_mode"),n=Symbol.for("react.profiler"),t=Symbol.for("react.provider"),i=Symbol.for("react.context"),l=Symbol.for("react.forward_ref"),d=Symbol.for("react.suspense"),c=Symbol.for("react.suspense_list"),h=Symbol.for("react.memo"),m=Symbol.for("react.lazy"),A=Symbol.for("react.offscreen"),w=Symbol.iterator,k="@@iterator";function G(s){if(s===null||typeof s!="object")return null;var p=w&&s[w]||s[k];return typeof p=="function"?p:null}var P=o.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function B(s){{for(var p=arguments.length,g=new Array(p>1?p-1:0),x=1;x<p;x++)g[x-1]=arguments[x];I("error",s,g)}}function I(s,p,g){{var x=P.ReactDebugCurrentFrame,_=x.getStackAddendum();_!==""&&(p+="%s",g=g.concat([_]));var N=g.map(function(q){return String(q)});N.unshift("Warning: "+p),Function.prototype.apply.call(console[s],console,N)}}var b=!1,L=!1,y=!1,R=!1,O=!1,F;F=Symbol.for("react.module.reference");function j(s){return!!(typeof s=="string"||typeof s=="function"||s===u||s===n||O||s===a||s===d||s===c||R||s===A||b||L||y||typeof s=="object"&&s!==null&&(s.$$typeof===m||s.$$typeof===h||s.$$typeof===t||s.$$typeof===i||s.$$typeof===l||s.$$typeof===F||s.getModuleId!==void 0))}function E(s,p,g){var x=s.displayName;if(x)return x;var _=p.displayName||p.name||"";return _!==""?g+"("+_+")":g}function H(s){return s.displayName||"Context"}function M(s){if(s==null)return null;if(typeof s.tag=="number"&&B("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof s=="function")return s.displayName||s.name||null;if(typeof s=="string")return s;switch(s){case u:return"Fragment";case r:return"Portal";case n:return"Profiler";case a:return"StrictMode";case d:return"Suspense";case c:return"SuspenseList"}if(typeof s=="object")switch(s.$$typeof){case i:var p=s;return H(p)+".Consumer";case t:var g=s;return H(g._context)+".Provider";case l:return E(s,s.render,"ForwardRef");case h:var x=s.displayName||null;return x!==null?x:M(s.type)||"Memo";case m:{var _=s,N=_._payload,q=_._init;try{return M(q(N))}catch{return null}}}return null}var T=Object.assign,z=0,J,pe,he,ke,ge,V,te;function se(){}se.__reactDisabledLog=!0;function Pe(){{if(z===0){J=console.log,pe=console.info,he=console.warn,ke=console.error,ge=console.group,V=console.groupCollapsed,te=console.groupEnd;var s={configurable:!0,enumerable:!0,value:se,writable:!0};Object.defineProperties(console,{info:s,log:s,warn:s,error:s,group:s,groupCollapsed:s,groupEnd:s})}z++}}function Ue(){{if(z--,z===0){var s={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:T({},s,{value:J}),info:T({},s,{value:pe}),warn:T({},s,{value:he}),error:T({},s,{value:ke}),group:T({},s,{value:ge}),groupCollapsed:T({},s,{value:V}),groupEnd:T({},s,{value:te})})}z<0&&B("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var me=P.ReactCurrentDispatcher,De;function ne(s,p,g){{if(De===void 0)try{throw Error()}catch(_){var x=_.stack.trim().match(/\n( *(at )?)/);De=x&&x[1]||""}return`
45
+ `+De+s}}var Ae=!1,ie;{var Ie=typeof WeakMap=="function"?WeakMap:Map;ie=new Ie}function Fe(s,p){if(!s||Ae)return"";{var g=ie.get(s);if(g!==void 0)return g}var x;Ae=!0;var _=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var N;N=me.current,me.current=null,Pe();try{if(p){var q=function(){throw Error()};if(Object.defineProperty(q.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(q,[])}catch(Q){x=Q}Reflect.construct(s,[],q)}else{try{q.call()}catch(Q){x=Q}s.call(q.prototype)}}else{try{throw Error()}catch(Q){x=Q}s()}}catch(Q){if(Q&&x&&typeof Q.stack=="string"){for(var S=Q.stack.split(`
46
+ `),W=x.stack.split(`
47
+ `),U=S.length-1,$=W.length-1;U>=1&&$>=0&&S[U]!==W[$];)$--;for(;U>=1&&$>=0;U--,$--)if(S[U]!==W[$]){if(U!==1||$!==1)do if(U--,$--,$<0||S[U]!==W[$]){var X=`
48
+ `+S[U].replace(" at new "," at ");return s.displayName&&X.includes("<anonymous>")&&(X=X.replace("<anonymous>",s.displayName)),typeof s=="function"&&ie.set(s,X),X}while(U>=1&&$>=0);break}}}finally{Ae=!1,me.current=N,Ue(),Error.prepareStackTrace=_}var de=s?s.displayName||s.name:"",ue=de?ne(de):"";return typeof s=="function"&&ie.set(s,ue),ue}function $e(s,p,g){return Fe(s,!1)}function Me(s){var p=s.prototype;return!!(p&&p.isReactComponent)}function oe(s,p,g){if(s==null)return"";if(typeof s=="function")return Fe(s,Me(s));if(typeof s=="string")return ne(s);switch(s){case d:return ne("Suspense");case c:return ne("SuspenseList")}if(typeof s=="object")switch(s.$$typeof){case l:return $e(s.render);case h:return oe(s.type,p,g);case m:{var x=s,_=x._payload,N=x._init;try{return oe(N(_),p,g)}catch{}}}return""}var re=Object.prototype.hasOwnProperty,Se={},Te=P.ReactDebugCurrentFrame;function le(s){if(s){var p=s._owner,g=oe(s.type,s._source,p?p.type:null);Te.setExtraStackFrame(g)}else Te.setExtraStackFrame(null)}function ze(s,p,g,x,_){{var N=Function.call.bind(re);for(var q in s)if(N(s,q)){var S=void 0;try{if(typeof s[q]!="function"){var W=Error((x||"React class")+": "+g+" type `"+q+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof s[q]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw W.name="Invariant Violation",W}S=s[q](p,q,x,g,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(U){S=U}S&&!(S instanceof Error)&&(le(_),B("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",x||"React class",g,q,typeof S),le(null)),S instanceof Error&&!(S.message in Se)&&(Se[S.message]=!0,le(_),B("Failed %s type: %s",g,S.message),le(null))}}}var Ge=Array.isArray;function D(s){return Ge(s)}function C(s){{var p=typeof Symbol=="function"&&Symbol.toStringTag,g=p&&s[Symbol.toStringTag]||s.constructor.name||"Object";return g}}function Y(s){try{return K(s),!1}catch{return!0}}function K(s){return""+s}function ee(s){if(Y(s))return B("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",C(s)),K(s)}var Z=P.ReactCurrentOwner,He={key:!0,ref:!0,__self:!0,__source:!0},be,qe;function wt(s){if(re.call(s,"ref")){var p=Object.getOwnPropertyDescriptor(s,"ref").get;if(p&&p.isReactWarning)return!1}return s.ref!==void 0}function Bt(s){if(re.call(s,"key")){var p=Object.getOwnPropertyDescriptor(s,"key").get;if(p&&p.isReactWarning)return!1}return s.key!==void 0}function kt(s,p){typeof s.ref=="string"&&Z.current}function Ft(s,p){{var g=function(){be||(be=!0,B("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",p))};g.isReactWarning=!0,Object.defineProperty(s,"key",{get:g,configurable:!0})}}function St(s,p){{var g=function(){qe||(qe=!0,B("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",p))};g.isReactWarning=!0,Object.defineProperty(s,"ref",{get:g,configurable:!0})}}var Tt=function(s,p,g,x,_,N,q){var S={$$typeof:e,type:s,key:p,ref:g,props:q,_owner:N};return S._store={},Object.defineProperty(S._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(S,"_self",{configurable:!1,enumerable:!1,writable:!1,value:x}),Object.defineProperty(S,"_source",{configurable:!1,enumerable:!1,writable:!1,value:_}),Object.freeze&&(Object.freeze(S.props),Object.freeze(S)),S};function qt(s,p,g,x,_){{var N,q={},S=null,W=null;g!==void 0&&(ee(g),S=""+g),Bt(p)&&(ee(p.key),S=""+p.key),wt(p)&&(W=p.ref,kt(p,_));for(N in p)re.call(p,N)&&!He.hasOwnProperty(N)&&(q[N]=p[N]);if(s&&s.defaultProps){var U=s.defaultProps;for(N in U)q[N]===void 0&&(q[N]=U[N])}if(S||W){var $=typeof s=="function"?s.displayName||s.name||"Unknown":s;S&&Ft(q,$),W&&St(q,$)}return Tt(s,S,W,_,x,Z.current,q)}}var Ve=P.ReactCurrentOwner,ut=P.ReactDebugCurrentFrame;function ce(s){if(s){var p=s._owner,g=oe(s.type,s._source,p?p.type:null);ut.setExtraStackFrame(g)}else ut.setExtraStackFrame(null)}var We;We=!1;function Qe(s){return typeof s=="object"&&s!==null&&s.$$typeof===e}function at(){{if(Ve.current){var s=M(Ve.current.type);if(s)return`
22
49
 
23
- Check the render method of \``+e+"`."}return""}}function dt(e){return""}var Ve={};function ft(e){{var l=qe();if(!l){var u=typeof e=="string"?e:e.displayName||e.name;u&&(l=`
50
+ Check the render method of \``+s+"`."}return""}}function Rt(s){return""}var st={};function jt(s){{var p=at();if(!p){var g=typeof s=="string"?s:s.displayName||s.name;g&&(p=`
24
51
 
25
- Check the top-level render call using <`+u+">.")}return l}}function He(e,l){{if(!e._store||e._store.validated||e.key!=null)return;e._store.validated=!0;var u=ft(l);if(Ve[u])return;Ve[u]=!0;var w="";e&&e._owner&&e._owner!==Me.current&&(w=" It was passed a child from "+L(e._owner.type)+"."),ce(e),F('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',u,w),ce(null)}}function Je(e,l){{if(typeof e!="object")return;if(f(e))for(var u=0;u<e.length;u++){var w=e[u];Be(w)&&He(w,l)}else if(Be(e))e._store&&(e._store.validated=!0);else if(e){var P=V(e);if(typeof P=="function"&&P!==e.entries)for(var $=P.call(e),O;!(O=$.next()).done;)Be(O.value)&&He(O.value,l)}}}function pt(e){{var l=e.type;if(l==null||typeof l=="string")return;var u;if(typeof l=="function")u=l.propTypes;else if(typeof l=="object"&&(l.$$typeof===d||l.$$typeof===j))u=l.propTypes;else return;if(u){var w=L(l);$e(u,e.props,"prop",w,e)}else if(l.PropTypes!==void 0&&!Ue){Ue=!0;var P=L(l);F("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",P||"Unknown")}typeof l.getDefaultProps=="function"&&!l.getDefaultProps.isReactClassApproved&&F("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function ht(e){{for(var l=Object.keys(e.props),u=0;u<l.length;u++){var w=l[u];if(w!=="children"&&w!=="key"){ce(e),F("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",w),ce(null);break}}e.ref!==null&&(ce(e),F("Invalid attribute `ref` supplied to `React.Fragment`."),ce(null))}}var Ke={};function Qe(e,l,u,w,P,$){{var O=A(e);if(!O){var T="";(e===void 0||typeof e=="object"&&e!==null&&Object.keys(e).length===0)&&(T+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");var q=dt();q?T+=q:T+=qe();var U;e===null?U="null":f(e)?U="array":e!==void 0&&e.$$typeof===t?(U="<"+(L(e.type)||"Unknown")+" />",T=" Did you accidentally export a JSX literal instead of a component?"):U=typeof e,F("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",U,T)}var B=ut(e,l,u,P,$);if(B==null)return B;if(O){var X=l.children;if(X!==void 0)if(w)if(f(X)){for(var ue=0;ue<X.length;ue++)Je(X[ue],e);Object.freeze&&Object.freeze(X)}else F("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else Je(X,e)}if(re.call(l,"key")){var se=L(e),H=Object.keys(l).filter(function(bt){return bt!=="key"}),Ie=H.length>0?"{key: someKey, "+H.join(": ..., ")+": ...}":"{key: someKey}";if(!Ke[se+Ie]){var vt=H.length>0?"{"+H.join(": ..., ")+": ...}":"{}";F(`A props object containing a "key" prop is being spread into JSX:
52
+ Check the top-level render call using <`+g+">.")}return p}}function nt(s,p){{if(!s._store||s._store.validated||s.key!=null)return;s._store.validated=!0;var g=jt(p);if(st[g])return;st[g]=!0;var x="";s&&s._owner&&s._owner!==Ve.current&&(x=" It was passed a child from "+M(s._owner.type)+"."),ce(s),B('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',g,x),ce(null)}}function it(s,p){{if(typeof s!="object")return;if(D(s))for(var g=0;g<s.length;g++){var x=s[g];Qe(x)&&nt(x,p)}else if(Qe(s))s._store&&(s._store.validated=!0);else if(s){var _=G(s);if(typeof _=="function"&&_!==s.entries)for(var N=_.call(s),q;!(q=N.next()).done;)Qe(q.value)&&nt(q.value,p)}}}function _t(s){{var p=s.type;if(p==null||typeof p=="string")return;var g;if(typeof p=="function")g=p.propTypes;else if(typeof p=="object"&&(p.$$typeof===l||p.$$typeof===h))g=p.propTypes;else return;if(g){var x=M(p);ze(g,s.props,"prop",x,s)}else if(p.PropTypes!==void 0&&!We){We=!0;var _=M(p);B("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",_||"Unknown")}typeof p.getDefaultProps=="function"&&!p.getDefaultProps.isReactClassApproved&&B("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function Nt(s){{for(var p=Object.keys(s.props),g=0;g<p.length;g++){var x=p[g];if(x!=="children"&&x!=="key"){ce(s),B("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",x),ce(null);break}}s.ref!==null&&(ce(s),B("Invalid attribute `ref` supplied to `React.Fragment`."),ce(null))}}var ot={};function lt(s,p,g,x,_,N){{var q=j(s);if(!q){var S="";(s===void 0||typeof s=="object"&&s!==null&&Object.keys(s).length===0)&&(S+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");var W=Rt();W?S+=W:S+=at();var U;s===null?U="null":D(s)?U="array":s!==void 0&&s.$$typeof===e?(U="<"+(M(s.type)||"Unknown")+" />",S=" Did you accidentally export a JSX literal instead of a component?"):U=typeof s,B("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",U,S)}var $=qt(s,p,g,_,N);if($==null)return $;if(q){var X=p.children;if(X!==void 0)if(x)if(D(X)){for(var de=0;de<X.length;de++)it(X[de],s);Object.freeze&&Object.freeze(X)}else B("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else it(X,s)}if(re.call(p,"key")){var ue=M(s),Q=Object.keys(p).filter(function($t){return $t!=="key"}),Ye=Q.length>0?"{key: someKey, "+Q.join(": ..., ")+": ...}":"{key: someKey}";if(!ot[ue+Ye]){var It=Q.length>0?"{"+Q.join(": ..., ")+": ...}":"{}";B(`A props object containing a "key" prop is being spread into JSX:
26
53
  let props = %s;
27
54
  <%s {...props} />
28
55
  React keys must be passed directly to JSX without using spread:
29
56
  let props = %s;
30
- <%s key={someKey} {...props} />`,Ie,se,vt,se),Ke[se+Ie]=!0}}return e===s?ht(B):pt(B),B}}function gt(e,l,u){return Qe(e,l,u,!0)}function mt(e,l,u){return Qe(e,l,u,!1)}var yt=mt,xt=gt;be.Fragment=s,be.jsx=yt,be.jsxs=xt}()),be}process.env.NODE_ENV==="production"?Ge.exports=kt():Ge.exports=Tt();var a=Ge.exports;class Te{static filter(t,r){return t.filter(r)}static filterBy(t,r,s){return t.filter(i=>i[r]===s)}static filterByFields(t,r){return t.filter(s=>Object.entries(r).every(([i,n])=>s[i]===n))}static sort(t,r,s="asc"){return[...t].sort((i,n)=>{const o=i[r],p=n[r];if(o===p)return 0;let d=0;return o>p&&(d=1),o<p&&(d=-1),s==="asc"?d:-d})}static search(t,r,s){if(!r.trim())return t;const i=r.toLowerCase();return t.filter(n=>s.some(o=>{const p=n[o];return p==null?!1:String(p).toLowerCase().includes(i)}))}static paginate(t,r,s){const i=(r-1)*s,n=i+s;return{data:t.slice(i,n),total:t.length,page:r,totalPages:Math.ceil(t.length/s)}}static groupBy(t,r){return t.reduce((s,i)=>{const n=String(i[r]);return s[n]||(s[n]=[]),s[n].push(i),s},{})}static unique(t,r){const s=t.map(i=>i[r]);return[...new Set(s)]}static countBy(t,r){return t.reduce((s,i)=>{const n=String(i[r]);return s[n]=(s[n]||0)+1,s},{})}static pipe(t,r){return r.reduce((s,i)=>i(s),t)}}function Rt({endpoint:h,params:t,layout:r="list",title:s,emptyMessage:i="No items found",renderItem:n,keyExtractor:o=(C,V)=>C.id||C._id||String(V),searchable:p=!1,searchFields:d=[],searchPlaceholder:g="Search...",filters:c=[],pageSize:j=20,onItemClick:v,onRefresh:m,theme:k={}}){const{data:C,loading:V,error:I,refetch:F}=st(h,t),[W,E]=x.useState(""),[M,y]=x.useState({}),[N,D]=x.useState(1),S=x.useMemo(()=>{if(!C)return{data:[],total:0,totalPages:0};let R=C;return p&&W&&d.length>0&&(R=Te.search(R,W,d)),Object.keys(M).length>0&&(R=Te.filterByFields(R,M)),Te.paginate(R,N,j)},[C,W,M,N,j,p,d]);x.useEffect(()=>{D(1)},[W,M]);const A=()=>{E(""),y({}),D(1),F(),m==null||m()},b={background:k.background||"#ffffff",cardBackground:k.cardBackground||"#f9fafb",text:k.text||"#111827",textSecondary:k.textSecondary||"#6b7280",border:k.border||"#e5e7eb",primary:k.primary||"#3b82f6"},L=n||(R=>a.jsxs("div",{style:{padding:"16px",cursor:v?"pointer":"default"},children:[a.jsx("div",{style:{fontSize:"14px",fontWeight:500,color:b.text},children:R.title||R.name||R.label||"Untitled"}),R.description&&a.jsx("div",{style:{fontSize:"13px",color:b.textSecondary,marginTop:"4px"},children:R.description})]}));return V&&!C?a.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",padding:"48px",color:b.textSecondary},children:"Loading..."}):I?a.jsxs("div",{style:{padding:"24px",textAlign:"center",color:"#ef4444"},children:[a.jsx("div",{style:{fontWeight:500,marginBottom:"8px"},children:"Error"}),a.jsx("div",{style:{fontSize:"14px"},children:I.message}),a.jsx("button",{onClick:A,style:{marginTop:"16px",padding:"8px 16px",background:b.primary,color:"white",border:"none",borderRadius:"6px",cursor:"pointer"},children:"Retry"})]}):a.jsxs("div",{style:{background:b.background,borderRadius:"12px",overflow:"hidden"},children:[(s||p||c.length>0)&&a.jsxs("div",{style:{padding:"16px",borderBottom:`1px solid ${b.border}`},children:[a.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:p||c.length>0?"12px":"0"},children:[s&&a.jsx("h2",{style:{margin:0,fontSize:"18px",fontWeight:600,color:b.text},children:s}),a.jsx("button",{onClick:A,style:{padding:"6px 12px",background:"transparent",border:`1px solid ${b.border}`,borderRadius:"6px",color:b.textSecondary,cursor:"pointer",fontSize:"13px"},children:"Refresh"})]}),p&&a.jsx("input",{type:"text",placeholder:g,value:W,onChange:R=>E(R.target.value),style:{width:"100%",padding:"8px 12px",border:`1px solid ${b.border}`,borderRadius:"8px",fontSize:"14px",outline:"none"}})]}),a.jsx("div",{style:{display:r==="grid"?"grid":"flex",flexDirection:r==="list"?"column":void 0,gridTemplateColumns:r==="grid"?"repeat(auto-fill, minmax(250px, 1fr))":void 0,gap:r==="list"?"0":"16px",padding:r==="list"?"0":"16px"},children:S.data.length===0?a.jsx("div",{style:{padding:"48px",textAlign:"center",color:b.textSecondary},children:i}):S.data.map((R,z)=>a.jsx("div",{onClick:()=>v==null?void 0:v(R),style:{background:b.cardBackground,borderRadius:r==="list"?"0":"8px",borderBottom:r==="list"?`1px solid ${b.border}`:"none",transition:"all 0.15s ease"},onMouseEnter:K=>{v&&(K.currentTarget.style.background=b.border)},onMouseLeave:K=>{K.currentTarget.style.background=b.cardBackground},children:L(R,z)},o(R,z)))}),S.totalPages>1&&a.jsxs("div",{style:{padding:"16px",borderTop:`1px solid ${b.border}`,display:"flex",alignItems:"center",justifyContent:"space-between"},children:[a.jsxs("div",{style:{fontSize:"13px",color:b.textSecondary},children:["Page ",N," of ",S.totalPages]}),a.jsxs("div",{style:{display:"flex",gap:"8px"},children:[a.jsx("button",{onClick:()=>D(R=>Math.max(1,R-1)),disabled:N===1,style:{padding:"6px 12px",border:`1px solid ${b.border}`,borderRadius:"6px",background:"white",cursor:N===1?"not-allowed":"pointer",opacity:N===1?.5:1},children:"Previous"}),a.jsx("button",{onClick:()=>D(R=>Math.min(S.totalPages,R+1)),disabled:N===S.totalPages,style:{padding:"6px 12px",border:`1px solid ${b.border}`,borderRadius:"6px",background:"white",cursor:N===S.totalPages?"not-allowed":"pointer",opacity:N===S.totalPages?.5:1},children:"Next"})]})]})]})}function Ct({item:h,onClick:t,title:r=o=>o.title||o.name||o.label||"Untitled",subtitle:s=o=>o.description||o.subtitle||"",image:i=o=>o.image||o.thumbnail||o.photo,badge:n=o=>o.badge||o.tag||o.type}){const o=r(h),p=s(h),d=i(h),g=n(h);return a.jsxs("div",{onClick:t,className:`
57
+ <%s key={someKey} {...props} />`,Ye,ue,It,ue),ot[ue+Ye]=!0}}return s===u?Nt($):_t($),$}}function Lt(s,p,g){return lt(s,p,g,!0)}function Ot(s,p,g){return lt(s,p,g,!1)}var Pt=Ot,Ut=Lt;Ee.Fragment=u,Ee.jsx=Pt,Ee.jsxs=Ut}()),Ee}process.env.NODE_ENV==="production"?tt.exports=fr():tt.exports=pr();var f=tt.exports;class _e{static filter(e,r){return e.filter(r)}static filterBy(e,r,u){return e.filter(a=>a[r]===u)}static filterByFields(e,r){return e.filter(u=>Object.entries(r).every(([a,n])=>u[a]===n))}static sort(e,r,u="asc"){return[...e].sort((a,n)=>{const t=a[r],i=n[r];if(t===i)return 0;let l=0;return t>i&&(l=1),t<i&&(l=-1),u==="asc"?l:-l})}static search(e,r,u){if(!r.trim())return e;const a=r.toLowerCase();return e.filter(n=>u.some(t=>{const i=n[t];return i==null?!1:String(i).toLowerCase().includes(a)}))}static paginate(e,r,u){const a=(r-1)*u,n=a+u;return{data:e.slice(a,n),total:e.length,page:r,totalPages:Math.ceil(e.length/u)}}static groupBy(e,r){return e.reduce((u,a)=>{const n=String(a[r]);return u[n]||(u[n]=[]),u[n].push(a),u},{})}static unique(e,r){const u=e.map(a=>a[r]);return[...new Set(u)]}static countBy(e,r){return e.reduce((u,a)=>{const n=String(a[r]);return u[n]=(u[n]||0)+1,u},{})}static pipe(e,r){return r.reduce((u,a)=>a(u),e)}}function hr({endpoint:o,params:e,layout:r="list",title:u,emptyMessage:a="No items found",renderItem:n,keyExtractor:t=(k,G)=>k.id||k._id||String(G),searchable:i=!1,searchFields:l=[],searchPlaceholder:d="Search...",filters:c=[],pageSize:h=20,onItemClick:m,onRefresh:A,theme:w={}}){const{data:k,loading:G,error:P,refetch:B}=Ct(o,e),[I,b]=v.useState(""),[L,y]=v.useState({}),[R,O]=v.useState(1),F=v.useMemo(()=>{if(!k)return{data:[],total:0,totalPages:0};let T=k;return i&&I&&l.length>0&&(T=_e.search(T,I,l)),Object.keys(L).length>0&&(T=_e.filterByFields(T,L)),_e.paginate(T,R,h)},[k,I,L,R,h,i,l]);v.useEffect(()=>{O(1)},[I,L]);const j=()=>{b(""),y({}),O(1),B(),A==null||A()},E={background:w.background||"#ffffff",cardBackground:w.cardBackground||"#f9fafb",text:w.text||"#111827",textSecondary:w.textSecondary||"#6b7280",border:w.border||"#e5e7eb",primary:w.primary||"#3b82f6"},M=n||(T=>f.jsxs("div",{style:{padding:"16px",cursor:m?"pointer":"default"},children:[f.jsx("div",{style:{fontSize:"14px",fontWeight:500,color:E.text},children:T.title||T.name||T.label||"Untitled"}),T.description&&f.jsx("div",{style:{fontSize:"13px",color:E.textSecondary,marginTop:"4px"},children:T.description})]}));return G&&!k?f.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",padding:"48px",color:E.textSecondary},children:"Loading..."}):P?f.jsxs("div",{style:{padding:"24px",textAlign:"center",color:"#ef4444"},children:[f.jsx("div",{style:{fontWeight:500,marginBottom:"8px"},children:"Error"}),f.jsx("div",{style:{fontSize:"14px"},children:P.message}),f.jsx("button",{onClick:j,style:{marginTop:"16px",padding:"8px 16px",background:E.primary,color:"white",border:"none",borderRadius:"6px",cursor:"pointer"},children:"Retry"})]}):f.jsxs("div",{style:{background:E.background,borderRadius:"12px",overflow:"hidden"},children:[(u||i||c.length>0)&&f.jsxs("div",{style:{padding:"16px",borderBottom:`1px solid ${E.border}`},children:[f.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:i||c.length>0?"12px":"0"},children:[u&&f.jsx("h2",{style:{margin:0,fontSize:"18px",fontWeight:600,color:E.text},children:u}),f.jsx("button",{onClick:j,style:{padding:"6px 12px",background:"transparent",border:`1px solid ${E.border}`,borderRadius:"6px",color:E.textSecondary,cursor:"pointer",fontSize:"13px"},children:"Refresh"})]}),i&&f.jsx("input",{type:"text",placeholder:d,value:I,onChange:T=>b(T.target.value),style:{width:"100%",padding:"8px 12px",border:`1px solid ${E.border}`,borderRadius:"8px",fontSize:"14px",outline:"none"}})]}),f.jsx("div",{style:{display:r==="grid"?"grid":"flex",flexDirection:r==="list"?"column":void 0,gridTemplateColumns:r==="grid"?"repeat(auto-fill, minmax(250px, 1fr))":void 0,gap:r==="list"?"0":"16px",padding:r==="list"?"0":"16px"},children:F.data.length===0?f.jsx("div",{style:{padding:"48px",textAlign:"center",color:E.textSecondary},children:a}):F.data.map((T,z)=>f.jsx("div",{onClick:()=>m==null?void 0:m(T),style:{background:E.cardBackground,borderRadius:r==="list"?"0":"8px",borderBottom:r==="list"?`1px solid ${E.border}`:"none",transition:"all 0.15s ease"},onMouseEnter:J=>{m&&(J.currentTarget.style.background=E.border)},onMouseLeave:J=>{J.currentTarget.style.background=E.cardBackground},children:M(T,z)},t(T,z)))}),F.totalPages>1&&f.jsxs("div",{style:{padding:"16px",borderTop:`1px solid ${E.border}`,display:"flex",alignItems:"center",justifyContent:"space-between"},children:[f.jsxs("div",{style:{fontSize:"13px",color:E.textSecondary},children:["Page ",R," of ",F.totalPages]}),f.jsxs("div",{style:{display:"flex",gap:"8px"},children:[f.jsx("button",{onClick:()=>O(T=>Math.max(1,T-1)),disabled:R===1,style:{padding:"6px 12px",border:`1px solid ${E.border}`,borderRadius:"6px",background:"white",cursor:R===1?"not-allowed":"pointer",opacity:R===1?.5:1},children:"Previous"}),f.jsx("button",{onClick:()=>O(T=>Math.min(F.totalPages,T+1)),disabled:R===F.totalPages,style:{padding:"6px 12px",border:`1px solid ${E.border}`,borderRadius:"6px",background:"white",cursor:R===F.totalPages?"not-allowed":"pointer",opacity:R===F.totalPages?.5:1},children:"Next"})]})]})]})}function gr({item:o,onClick:e,title:r=t=>t.title||t.name||t.label||"Untitled",subtitle:u=t=>t.description||t.subtitle||"",image:a=t=>t.image||t.thumbnail||t.photo,badge:n=t=>t.badge||t.tag||t.type}){const t=r(o),i=u(o),l=a(o),d=n(o);return f.jsxs("div",{onClick:e,className:`
31
58
  flex items-center gap-4 p-4 border-b border-gray-200
32
59
  hover:bg-gray-50 transition-colors
33
- ${t?"cursor-pointer":""}
34
- `,children:[d&&a.jsx("div",{className:"flex-shrink-0",children:a.jsx("img",{src:d,alt:o,className:"w-16 h-16 object-cover rounded-lg"})}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("h3",{className:"font-medium text-gray-900 truncate",children:o}),g&&a.jsx("span",{className:"px-2 py-0.5 text-xs font-medium bg-blue-100 text-blue-800 rounded-full",children:g})]}),p&&a.jsx("p",{className:"text-sm text-gray-600 truncate mt-0.5",children:p})]}),t&&a.jsx("div",{className:"flex-shrink-0 text-gray-400",children:a.jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})})})]})}function Ot({item:h,onClose:t,title:r=n=>n.title||n.name||n.label||"Detail",image:s=n=>n.image||n.thumbnail||n.photo,fields:i=[]}){if(!h)return null;const n=r(h),o=s(h);return a.jsx("div",{className:"fixed inset-0 bg-black/50 z-50 flex items-center justify-center p-4",children:a.jsxs("div",{className:"bg-white rounded-xl max-w-2xl w-full max-h-[90vh] overflow-y-auto shadow-2xl",children:[a.jsxs("div",{className:"sticky top-0 bg-white border-b border-gray-200 px-6 py-4 flex items-center justify-between",children:[a.jsx("h2",{className:"text-xl font-semibold text-gray-900",children:n}),t&&a.jsx("button",{onClick:t,className:"p-2 hover:bg-gray-100 rounded-lg transition-colors",children:a.jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),a.jsxs("div",{className:"p-6",children:[o&&a.jsx("div",{className:"mb-6",children:a.jsx("img",{src:o,alt:n,className:"w-full h-64 object-cover rounded-lg"})}),i.length>0&&a.jsx("div",{className:"space-y-4",children:i.map((p,d)=>{const g=p.value(h);return g==null||g===""?null:a.jsxs("div",{children:[a.jsx("div",{className:"text-sm font-medium text-gray-500 mb-1",children:p.label}),a.jsx("div",{className:"text-base text-gray-900",children:typeof g=="object"?JSON.stringify(g,null,2):String(g)})]},d)})}),i.length===0&&a.jsx("pre",{className:"bg-gray-50 p-4 rounded-lg text-sm overflow-x-auto",children:JSON.stringify(h,null,2)})]}),t&&a.jsx("div",{className:"sticky bottom-0 bg-gray-50 border-t border-gray-200 px-6 py-4",children:a.jsx("button",{onClick:t,className:"w-full px-4 py-2 bg-gray-900 text-white rounded-lg hover:bg-gray-800 transition-colors font-medium",children:"Close"})})]})})}const Nt={small:"w-32 h-32",medium:"w-48 h-48",large:"w-64 h-64"};function At({nodes:h,cardCount:t=2,minInterval:r=1e3,maxInterval:s=3e3,onCardClick:i,cardSize:n="medium",className:o=""}){const p=Math.min(Math.max(t,1),5),[d,g]=x.useState([]),[c,j]=x.useState([]),[v,m]=x.useState(Array(p).fill(!1)),[k,C]=x.useState(Array(p).fill(!1)),V=x.useRef([]),I=x.useCallback(y=>{const N=h.filter(S=>!y.includes(S._id));if(N.length===0)return null;const D=Math.floor(Math.random()*N.length);return N[D]},[h]),F=x.useCallback(()=>Math.random()*(s-r)+r,[r,s]);x.useEffect(()=>{if(h.length===0){g([]),j([]);return}const y=[],N=[],D=[];for(let S=0;S<p&&S<h.length;S++){const A=I(D);A&&(y.push(A),D.push(A._id))}for(let S=0;S<y.length;S++){const A=[y[S]._id,...y.filter((G,L)=>L!==S).map(G=>G._id)],b=I(A);b?N.push(b):N.push(y[S])}g(y),j(N)},[h,p,I]);const W=x.useCallback(y=>{const N=F(),D=setTimeout(()=>{m(S=>{const A=[...S];return A[y]=!A[y],A}),setTimeout(()=>{C(S=>{const A=[...S];return A[y]=!A[y],A}),setTimeout(()=>{const S=!k[y];S&&g(A=>{const b=[...A];return b[y]=c[y],b}),j(A=>{const b=[...A],L=[(S?c[y]:d[y])._id,...d.filter((z,K)=>K!==y).map(z=>z._id),...A.filter((z,K)=>K!==y).map(z=>z._id)],R=I(L);return R&&(b[y]=R),b}),setTimeout(()=>{W(y)},150)},200)},150)},N);V.current[y]=D},[F,I,d,c,k]),E=x.useRef(!1);x.useEffect(()=>{if(!(d.length===0||h.length<=1)&&!E.current){E.current=!0;for(let y=0;y<d.length;y++)W(y);return()=>{V.current.forEach(y=>clearTimeout(y)),V.current=[],E.current=!1}}},[d.length,h.length]);const M=y=>{i&&i(y)};return h.length===0?a.jsx("div",{className:`flex items-center justify-center p-8 ${o}`,children:a.jsx("p",{className:"text-gray-500",children:"No nodes available"})}):d.length===0?a.jsx("div",{className:`flex items-center justify-center p-8 ${o}`,children:a.jsx("p",{className:"text-gray-500",children:"Loading..."})}):a.jsx("div",{className:`flex gap-4 justify-center items-center flex-wrap ${o}`,children:d.map((y,N)=>{const D=c[N],S=k[N];return a.jsx("div",{className:`relative ${Nt[n]}`,style:{perspective:"1000px"},onClick:()=>M(S?D:y),children:a.jsxs("div",{className:"w-full h-full rounded-lg shadow-lg overflow-hidden cursor-pointer hover:shadow-xl",style:{transform:`rotateY(${v[N]?180:0}deg)`,transition:"transform 0.5s",transformStyle:"preserve-3d"},children:[a.jsx("div",{className:"absolute inset-0 transition-opacity duration-200",style:{opacity:S?0:1},children:a.jsxs("div",{style:{transform:v[N]?"scaleX(-1)":"scaleX(1)",width:"100%",height:"100%"},children:[a.jsx("img",{src:y.data.image,alt:y.title,className:"w-full h-full object-cover"}),a.jsx("div",{className:"absolute bottom-0 left-0 right-0 bg-gradient-to-t from-black/70 to-transparent p-2",children:a.jsx("p",{className:"text-white text-sm font-medium truncate",children:y.title})})]})}),D&&a.jsx("div",{className:"absolute inset-0 transition-opacity duration-200",style:{opacity:S?1:0},children:a.jsxs("div",{style:{transform:v[N]?"scaleX(-1)":"scaleX(1)",width:"100%",height:"100%"},children:[a.jsx("img",{src:D.data.image,alt:D.title,className:"w-full h-full object-cover"}),a.jsx("div",{className:"absolute bottom-0 left-0 right-0 bg-gradient-to-t from-black/70 to-transparent p-2",children:a.jsx("p",{className:"text-white text-sm font-medium truncate",children:D.title})})]})})]})},`slot-${N}`)})})}function ke(h){if(!h)return"";const t=/=\?([^?]+)\?([BQbq])\?([^?]*)\?=/g;return h.replace(t,(r,s,i,n)=>{try{if(i.toUpperCase()==="B"){const o=atob(n);return decodeURIComponent(escape(o))}else if(i.toUpperCase()==="Q"){const o=n.replace(/_/g," ").replace(/=([0-9A-Fa-f]{2})/g,(p,d)=>String.fromCharCode(parseInt(d,16)));return decodeURIComponent(escape(o))}}catch(o){console.warn("MIME decode error:",o)}return r}).replace(/\s+/g," ").trim()}const Pt={background:"#ffffff",cardBackground:"#ffffff",selectedBackground:"#f5f5f5",unreadBackground:"#ffffff",text:"#111827",textSecondary:"#6b7280",border:"#e5e7eb",primary:"#3b82f6",danger:"#ef4444"};function $t({baseUrl:h,systemId:t,accountId:r,limit:s=30,folder:i,selectable:n=!0,showDetail:o=!1,emptyMessage:p="No emails",autoLoad:d=!0,onSelect:g,onSelectionChange:c,onDelete:j,onError:v,onLoad:m,renderItem:k,renderDetail:C,renderActions:V,renderEmpty:I,renderLoading:F,theme:W={}}){const E={...Pt,...W},[M,y]=x.useState([]),[N,D]=x.useState(!1),[S,A]=x.useState(null),[b,G]=x.useState(new Set),[L,R]=x.useState(null),[z,K]=x.useState(null),[de,fe]=x.useState(null),[we,pe]=x.useState(!1),Y=x.useMemo(()=>t?new et({baseUrl:h,system_id:t}):null,[h,t]),te=x.useCallback(async()=>{if(Y){D(!0),A(null);try{const f=await Y.listEmails(r,s,i);f!=null&&f.messages&&(y(f.messages),m==null||m(f.messages))}catch(f){const _=f instanceof Error?f:new Error("Failed to fetch emails");A(_.message),v==null||v(_)}D(!1)}},[Y,r,s,i,v,m]);x.useEffect(()=>{d&&te()},[d,te]),x.useEffect(()=>{te()},[i]);const ne=x.useCallback(async f=>{if(Y){K(f),fe(null),pe(!0);try{const _=await Y.getEmail(r,f.uid);_!=null&&_.body&&fe(_.body)}catch(_){console.error("Failed to fetch email body:",_)}pe(!1)}},[Y,r]),Ce=x.useCallback(f=>{g==null||g(f),o&&ne(f)},[g,o,ne]),Oe=x.useCallback((f,_,J)=>{if(!n){g==null||g(f),o&&ne(f);return}const Q=f.uid;if(J.shiftKey&&L!==null){const ee=Math.min(L,_),Z=Math.max(L,_),De=M.slice(ee,Z+1).map(Se=>Se.uid),ye=new Set(De);G(ye),c==null||c(Array.from(ye))}else if(J.ctrlKey||J.metaKey)G(ee=>{const Z=new Set(ee);return Z.has(Q)?Z.delete(Q):Z.add(Q),c==null||c(Array.from(Z)),Z}),R(_);else{const ee=new Set([Q]);G(ee),R(_),c==null||c(Array.from(ee))}},[n,L,M,b,g,c,o]),he=x.useCallback(async()=>{if(!(!Y||b.size===0))try{const f=await Y.trashEmails(r,Array.from(b));if(console.log("Trash result:",f),f.success&&f.moved>0){y(J=>J.filter(Q=>!b.has(Q.uid)));const _=Array.from(b);G(new Set),j==null||j(_)}else A("Failed to move emails to trash")}catch(f){const _=f instanceof Error?f:new Error("Trash failed");console.error("Trash error:",_),A(_.message),v==null||v(_)}},[Y,r,b,j,v]),ge=x.useCallback(async()=>{if(!(!Y||b.size===0))try{const f=await Y.archiveEmails(r,Array.from(b));if(console.log("Archive result:",f),f.success&&f.archived>0){y(J=>J.filter(Q=>!b.has(Q.uid)));const _=Array.from(b);G(new Set),j==null||j(_)}else A("Failed to archive emails")}catch(f){const _=f instanceof Error?f:new Error("Archive failed");console.error("Archive error:",_),A(_.message),v==null||v(_)}},[Y,r,b,j,v]),ae=x.useCallback(()=>{if(b.size===M.length)G(new Set),c==null||c([]);else{const f=new Set(M.map(_=>_.uid));G(f),c==null||c(Array.from(f))}},[M,b.size,c]),me=x.useCallback(()=>{G(new Set),c==null||c([])},[c]),ie={delete:he,archive:ge,refresh:te,selectAll:ae,clearSelection:me},Ne=f=>{if(!f)return"";const _=new Date(f),J=new Date;return _.toDateString()===J.toDateString()?_.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"}):_.toLocaleDateString([],{month:"short",day:"numeric"})},Ee=(f,_)=>a.jsx("div",{style:{padding:"12px 16px",background:_?E.selectedBackground:f.seen?E.cardBackground:E.unreadBackground,borderBottom:`1px solid ${E.border}`,cursor:"pointer",transition:"background 0.15s ease"},children:a.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"flex-start",gap:"12px"},children:[a.jsxs("div",{style:{flex:1,minWidth:0},children:[a.jsx("div",{style:{fontSize:"14px",fontWeight:f.seen?400:600,color:E.text,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:ke(f.from).split("@")[0]}),a.jsx("div",{style:{fontSize:"14px",fontWeight:f.seen?400:500,color:f.seen?E.textSecondary:E.text,marginTop:"2px",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:ke(f.subject)||"(No subject)"})]}),a.jsx("div",{style:{fontSize:"12px",color:E.textSecondary,flexShrink:0},children:Ne(f.date)})]})}),Ae=f=>a.jsxs("div",{style:{padding:"24px"},children:[a.jsx("h2",{style:{margin:"0 0 8px",fontSize:"20px",color:E.text},children:ke(f.subject)||"(No subject)"}),a.jsxs("div",{style:{fontSize:"14px",color:E.textSecondary,marginBottom:"16px"},children:["From: ",ke(f.from)," • ",new Date(f.date).toLocaleString()]}),we?a.jsx("div",{style:{fontSize:"14px",color:E.textSecondary},children:"Loading..."}):de?a.jsx("div",{style:{fontSize:"14px",color:E.text},dangerouslySetInnerHTML:{__html:de}}):a.jsx("div",{style:{fontSize:"14px",color:E.textSecondary},children:"No content available"})]}),Pe=(f,_)=>a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px",padding:"8px 16px",background:E.cardBackground,borderBottom:`1px solid ${E.border}`},children:[a.jsx("button",{onClick:_.selectAll,style:{padding:"6px 12px",background:"transparent",border:`1px solid ${E.border}`,borderRadius:"6px",fontSize:"13px",cursor:"pointer",color:E.text},children:f.length===M.length?"Deselect All":"Select All"}),f.length>0&&a.jsxs(a.Fragment,{children:[a.jsxs("span",{style:{fontSize:"13px",color:E.textSecondary},children:[f.length," selected"]}),a.jsx("button",{onClick:_.archive,title:"Archive",style:{display:"flex",alignItems:"center",justifyContent:"center",width:"32px",height:"32px",background:"transparent",border:`1px solid ${E.border}`,borderRadius:"6px",cursor:"pointer",color:E.textSecondary},children:a.jsx("span",{className:"material-icons",style:{fontSize:"18px"},children:"archive"})}),a.jsx("button",{onClick:_.delete,title:"Delete",style:{display:"flex",alignItems:"center",justifyContent:"center",width:"32px",height:"32px",background:"transparent",border:`1px solid ${E.border}`,borderRadius:"6px",cursor:"pointer",color:E.textSecondary},children:a.jsx("span",{className:"material-icons",style:{fontSize:"18px"},children:"delete"})})]}),a.jsx("div",{style:{flex:1}}),a.jsx("button",{onClick:_.refresh,title:"Refresh",style:{display:"flex",alignItems:"center",justifyContent:"center",width:"32px",height:"32px",background:"transparent",border:`1px solid ${E.border}`,borderRadius:"6px",cursor:"pointer",color:E.textSecondary},children:a.jsx("span",{className:"material-icons",style:{fontSize:"18px"},children:"refresh"})})]}),oe=()=>a.jsx("div",{style:{padding:"48px",textAlign:"center",color:E.textSecondary},children:p}),re=()=>a.jsx("div",{style:{padding:"48px",textAlign:"center",color:E.textSecondary},children:"Loading..."}),_e=k||Ee,je=C||Ae,le=V||Pe,$e=I||oe,Fe=F||re;return N&&M.length===0?a.jsx("div",{style:{background:E.background,width:"100%",height:"100%"},children:Fe()}):a.jsxs("div",{style:{display:"flex",background:E.background,width:"100%",height:"100%"},children:[a.jsxs("div",{style:{flex:o&&z?"0 0 50%":"1",display:"flex",flexDirection:"column",borderRight:o&&z?`1px solid ${E.border}`:"none",overflow:"hidden"},children:[n&&le(Array.from(b),ie),S&&a.jsx("div",{style:{padding:"12px 16px",background:"#fef2f2",color:E.danger,fontSize:"14px",borderBottom:`1px solid ${E.border}`},children:S}),a.jsx("div",{style:{flex:1,overflowY:"auto"},children:M.length===0?$e():M.map((f,_)=>a.jsx("div",{onClick:J=>Oe(f,_,J),onDoubleClick:()=>Ce(f),children:_e(f,b.has(f.uid))},f.uid))})]}),o&&z&&a.jsx("div",{style:{flex:1,overflowY:"auto"},children:je(z)})]})}exports.AnimatedCardFlip=At;exports.ApiClient=rt;exports.AuthManager=tt;exports.Card=Ct;exports.DataOperations=Te;exports.Detail=Ot;exports.GraphClient=_t;exports.Mail=$t;exports.MailClient=et;exports.Stack=Rt;exports.getApiClient=We;exports.initializeApiClient=jt;exports.useMutation=St;exports.useQuery=st;
60
+ ${e?"cursor-pointer":""}
61
+ `,children:[l&&f.jsx("div",{className:"flex-shrink-0",children:f.jsx("img",{src:l,alt:t,className:"w-16 h-16 object-cover rounded-lg"})}),f.jsxs("div",{className:"flex-1 min-w-0",children:[f.jsxs("div",{className:"flex items-center gap-2",children:[f.jsx("h3",{className:"font-medium text-gray-900 truncate",children:t}),d&&f.jsx("span",{className:"px-2 py-0.5 text-xs font-medium bg-blue-100 text-blue-800 rounded-full",children:d})]}),i&&f.jsx("p",{className:"text-sm text-gray-600 truncate mt-0.5",children:i})]}),e&&f.jsx("div",{className:"flex-shrink-0 text-gray-400",children:f.jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:f.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})})})]})}function mr({item:o,onClose:e,title:r=n=>n.title||n.name||n.label||"Detail",image:u=n=>n.image||n.thumbnail||n.photo,fields:a=[]}){if(!o)return null;const n=r(o),t=u(o);return f.jsx("div",{className:"fixed inset-0 bg-black/50 z-50 flex items-center justify-center p-4",children:f.jsxs("div",{className:"bg-white rounded-xl max-w-2xl w-full max-h-[90vh] overflow-y-auto shadow-2xl",children:[f.jsxs("div",{className:"sticky top-0 bg-white border-b border-gray-200 px-6 py-4 flex items-center justify-between",children:[f.jsx("h2",{className:"text-xl font-semibold text-gray-900",children:n}),e&&f.jsx("button",{onClick:e,className:"p-2 hover:bg-gray-100 rounded-lg transition-colors",children:f.jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:f.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),f.jsxs("div",{className:"p-6",children:[t&&f.jsx("div",{className:"mb-6",children:f.jsx("img",{src:t,alt:n,className:"w-full h-64 object-cover rounded-lg"})}),a.length>0&&f.jsx("div",{className:"space-y-4",children:a.map((i,l)=>{const d=i.value(o);return d==null||d===""?null:f.jsxs("div",{children:[f.jsx("div",{className:"text-sm font-medium text-gray-500 mb-1",children:i.label}),f.jsx("div",{className:"text-base text-gray-900",children:typeof d=="object"?JSON.stringify(d,null,2):String(d)})]},l)})}),a.length===0&&f.jsx("pre",{className:"bg-gray-50 p-4 rounded-lg text-sm overflow-x-auto",children:JSON.stringify(o,null,2)})]}),e&&f.jsx("div",{className:"sticky bottom-0 bg-gray-50 border-t border-gray-200 px-6 py-4",children:f.jsx("button",{onClick:e,className:"w-full px-4 py-2 bg-gray-900 text-white rounded-lg hover:bg-gray-800 transition-colors font-medium",children:"Close"})})]})})}const Dr={small:"w-32 h-32",medium:"w-48 h-48",large:"w-64 h-64"};function Ar({nodes:o,cardCount:e=2,minInterval:r=1e3,maxInterval:u=3e3,onCardClick:a,cardSize:n="medium",className:t=""}){const i=Math.min(Math.max(e,1),5),[l,d]=v.useState([]),[c,h]=v.useState([]),[m,A]=v.useState(Array(i).fill(!1)),[w,k]=v.useState(Array(i).fill(!1)),G=v.useRef([]),P=v.useCallback(y=>{const R=o.filter(F=>!y.includes(F._id));if(R.length===0)return null;const O=Math.floor(Math.random()*R.length);return R[O]},[o]),B=v.useCallback(()=>Math.random()*(u-r)+r,[r,u]);v.useEffect(()=>{if(o.length===0){d([]),h([]);return}const y=[],R=[],O=[];for(let F=0;F<i&&F<o.length;F++){const j=P(O);j&&(y.push(j),O.push(j._id))}for(let F=0;F<y.length;F++){const j=[y[F]._id,...y.filter((H,M)=>M!==F).map(H=>H._id)],E=P(j);E?R.push(E):R.push(y[F])}d(y),h(R)},[o,i,P]);const I=v.useCallback(y=>{const R=B(),O=setTimeout(()=>{A(F=>{const j=[...F];return j[y]=!j[y],j}),setTimeout(()=>{k(F=>{const j=[...F];return j[y]=!j[y],j}),setTimeout(()=>{const F=!w[y];F&&d(j=>{const E=[...j];return E[y]=c[y],E}),h(j=>{const E=[...j],M=[(F?c[y]:l[y])._id,...l.filter((z,J)=>J!==y).map(z=>z._id),...j.filter((z,J)=>J!==y).map(z=>z._id)],T=P(M);return T&&(E[y]=T),E}),setTimeout(()=>{I(y)},150)},200)},150)},R);G.current[y]=O},[B,P,l,c,w]),b=v.useRef(!1);v.useEffect(()=>{if(!(l.length===0||o.length<=1)&&!b.current){b.current=!0;for(let y=0;y<l.length;y++)I(y);return()=>{G.current.forEach(y=>clearTimeout(y)),G.current=[],b.current=!1}}},[l.length,o.length]);const L=y=>{a&&a(y)};return o.length===0?f.jsx("div",{className:`flex items-center justify-center p-8 ${t}`,children:f.jsx("p",{className:"text-gray-500",children:"No nodes available"})}):l.length===0?f.jsx("div",{className:`flex items-center justify-center p-8 ${t}`,children:f.jsx("p",{className:"text-gray-500",children:"Loading..."})}):f.jsx("div",{className:`flex gap-4 justify-center items-center flex-wrap ${t}`,children:l.map((y,R)=>{const O=c[R],F=w[R];return f.jsx("div",{className:`relative ${Dr[n]}`,style:{perspective:"1000px"},onClick:()=>L(F?O:y),children:f.jsxs("div",{className:"w-full h-full rounded-lg shadow-lg overflow-hidden cursor-pointer hover:shadow-xl",style:{transform:`rotateY(${m[R]?180:0}deg)`,transition:"transform 0.5s",transformStyle:"preserve-3d"},children:[f.jsx("div",{className:"absolute inset-0 transition-opacity duration-200",style:{opacity:F?0:1},children:f.jsxs("div",{style:{transform:m[R]?"scaleX(-1)":"scaleX(1)",width:"100%",height:"100%"},children:[f.jsx("img",{src:y.data.image,alt:y.title,className:"w-full h-full object-cover"}),f.jsx("div",{className:"absolute bottom-0 left-0 right-0 bg-gradient-to-t from-black/70 to-transparent p-2",children:f.jsx("p",{className:"text-white text-sm font-medium truncate",children:y.title})})]})}),O&&f.jsx("div",{className:"absolute inset-0 transition-opacity duration-200",style:{opacity:F?1:0},children:f.jsxs("div",{style:{transform:m[R]?"scaleX(-1)":"scaleX(1)",width:"100%",height:"100%"},children:[f.jsx("img",{src:O.data.image,alt:O.title,className:"w-full h-full object-cover"}),f.jsx("div",{className:"absolute bottom-0 left-0 right-0 bg-gradient-to-t from-black/70 to-transparent p-2",children:f.jsx("p",{className:"text-white text-sm font-medium truncate",children:O.title})})]})})]})},`slot-${R}`)})})}function je(o){if(!o)return"";const e=/=\?([^?]+)\?([BQbq])\?([^?]*)\?=/g;return o.replace(e,(r,u,a,n)=>{try{if(a.toUpperCase()==="B"){const t=atob(n);return decodeURIComponent(escape(t))}else if(a.toUpperCase()==="Q"){const t=n.replace(/_/g," ").replace(/=([0-9A-Fa-f]{2})/g,(i,l)=>String.fromCharCode(parseInt(l,16)));return decodeURIComponent(escape(t))}}catch(t){console.warn("MIME decode error:",t)}return r}).replace(/\s+/g," ").trim()}const br={background:"#ffffff",cardBackground:"#ffffff",selectedBackground:"#f5f5f5",unreadBackground:"#ffffff",text:"#111827",textSecondary:"#6b7280",border:"#e5e7eb",primary:"#3b82f6",danger:"#ef4444"};function yr({baseUrl:o,systemId:e,accountId:r,limit:u=30,folder:a,selectable:n=!0,showDetail:t=!1,emptyMessage:i="No emails",autoLoad:l=!0,onSelect:d,onSelectionChange:c,onDelete:h,onError:m,onLoad:A,renderItem:w,renderDetail:k,renderActions:G,renderEmpty:P,renderLoading:B,theme:I={}}){const b={...br,...I},[L,y]=v.useState([]),[R,O]=v.useState(!1),[F,j]=v.useState(null),[E,H]=v.useState(new Set),[M,T]=v.useState(null),[z,J]=v.useState(null),[pe,he]=v.useState(null),[ke,ge]=v.useState(!1),V=v.useMemo(()=>e?new vt({baseUrl:o,system_id:e}):null,[o,e]),te=v.useCallback(async()=>{if(V){O(!0),j(null);try{const D=await V.listEmails(r,u,a);D!=null&&D.messages&&(y(D.messages),A==null||A(D.messages))}catch(D){const C=D instanceof Error?D:new Error("Failed to fetch emails");j(C.message),m==null||m(C)}O(!1)}},[V,r,u,a,m,A]);v.useEffect(()=>{l&&te()},[l,te]),v.useEffect(()=>{te()},[a]);const se=v.useCallback(async D=>{if(V){J(D),he(null),ge(!0);try{const C=await V.getEmailParsed(r,D.uid,a||"INBOX");C!=null&&C.body&&he(C.body)}catch(C){console.error("Failed to fetch email body:",C)}ge(!1)}},[V,r,a]),Pe=v.useCallback(D=>{d==null||d(D),t&&se(D)},[d,t,se]),Ue=v.useCallback((D,C,Y)=>{if(!n){d==null||d(D),t&&se(D);return}const K=D.uid;if(Y.shiftKey&&M!==null){const ee=Math.min(M,C),Z=Math.max(M,C),He=L.slice(ee,Z+1).map(qe=>qe.uid),be=new Set(He);H(be),c==null||c(Array.from(be))}else if(Y.ctrlKey||Y.metaKey)H(ee=>{const Z=new Set(ee);return Z.has(K)?Z.delete(K):Z.add(K),c==null||c(Array.from(Z)),Z}),T(C);else{const ee=new Set([K]);H(ee),T(C),c==null||c(Array.from(ee))}},[n,M,L,E,d,c,t]),me=v.useCallback(async()=>{if(!(!V||E.size===0))try{const D=await V.trashEmails(r,Array.from(E));if(console.log("Trash result:",D),D.success&&D.moved>0){y(Y=>Y.filter(K=>!E.has(K.uid)));const C=Array.from(E);H(new Set),h==null||h(C)}else j("Failed to move emails to trash")}catch(D){const C=D instanceof Error?D:new Error("Trash failed");console.error("Trash error:",C),j(C.message),m==null||m(C)}},[V,r,E,h,m]),De=v.useCallback(async()=>{if(!(!V||E.size===0))try{const D=await V.archiveEmails(r,Array.from(E));if(console.log("Archive result:",D),D.success&&D.archived>0){y(Y=>Y.filter(K=>!E.has(K.uid)));const C=Array.from(E);H(new Set),h==null||h(C)}else j("Failed to archive emails")}catch(D){const C=D instanceof Error?D:new Error("Archive failed");console.error("Archive error:",C),j(C.message),m==null||m(C)}},[V,r,E,h,m]),ne=v.useCallback(()=>{if(E.size===L.length)H(new Set),c==null||c([]);else{const D=new Set(L.map(C=>C.uid));H(D),c==null||c(Array.from(D))}},[L,E.size,c]),Ae=v.useCallback(()=>{H(new Set),c==null||c([])},[c]),ie={delete:me,archive:De,refresh:te,selectAll:ne,clearSelection:Ae},Ie=D=>{if(!D)return"";const C=new Date(D),Y=new Date;return C.toDateString()===Y.toDateString()?C.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"}):C.toLocaleDateString([],{month:"short",day:"numeric"})},Fe=(D,C)=>f.jsx("div",{style:{padding:"12px 16px",background:C?b.selectedBackground:D.seen?b.cardBackground:b.unreadBackground,borderBottom:`1px solid ${b.border}`,cursor:"pointer",transition:"background 0.15s ease"},children:f.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"flex-start",gap:"12px"},children:[f.jsxs("div",{style:{flex:1,minWidth:0},children:[f.jsx("div",{style:{fontSize:"14px",fontWeight:D.seen?400:600,color:b.text,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:je(D.from).split("@")[0]}),f.jsx("div",{style:{fontSize:"14px",fontWeight:D.seen?400:500,color:D.seen?b.textSecondary:b.text,marginTop:"2px",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:je(D.subject)||"(No subject)"})]}),f.jsx("div",{style:{fontSize:"12px",color:b.textSecondary,flexShrink:0},children:Ie(D.date)})]})}),$e=D=>f.jsxs("div",{style:{padding:"24px"},children:[f.jsx("h2",{style:{margin:"0 0 8px",fontSize:"20px",color:b.text},children:je(D.subject)||"(No subject)"}),f.jsxs("div",{style:{fontSize:"14px",color:b.textSecondary,marginBottom:"16px"},children:["From: ",je(D.from)," • ",new Date(D.date).toLocaleString()]}),ke?f.jsx("div",{style:{fontSize:"14px",color:b.textSecondary},children:"Loading..."}):pe?f.jsx("div",{style:{fontSize:"14px",color:b.text},dangerouslySetInnerHTML:{__html:pe}}):f.jsx("div",{style:{fontSize:"14px",color:b.textSecondary},children:"No content available"})]}),Me=(D,C)=>f.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px",padding:"8px 16px",background:b.cardBackground,borderBottom:`1px solid ${b.border}`},children:[f.jsx("button",{onClick:C.selectAll,style:{padding:"6px 12px",background:"transparent",border:`1px solid ${b.border}`,borderRadius:"6px",fontSize:"13px",cursor:"pointer",color:b.text},children:D.length===L.length?"Deselect All":"Select All"}),D.length>0&&f.jsxs(f.Fragment,{children:[f.jsxs("span",{style:{fontSize:"13px",color:b.textSecondary},children:[D.length," selected"]}),f.jsx("button",{onClick:C.archive,title:"Archive",style:{display:"flex",alignItems:"center",justifyContent:"center",width:"32px",height:"32px",background:"transparent",border:`1px solid ${b.border}`,borderRadius:"6px",cursor:"pointer",color:b.textSecondary},children:f.jsx("span",{className:"material-icons",style:{fontSize:"18px"},children:"archive"})}),f.jsx("button",{onClick:C.delete,title:"Delete",style:{display:"flex",alignItems:"center",justifyContent:"center",width:"32px",height:"32px",background:"transparent",border:`1px solid ${b.border}`,borderRadius:"6px",cursor:"pointer",color:b.textSecondary},children:f.jsx("span",{className:"material-icons",style:{fontSize:"18px"},children:"delete"})})]}),f.jsx("div",{style:{flex:1}}),f.jsx("button",{onClick:C.refresh,title:"Refresh",style:{display:"flex",alignItems:"center",justifyContent:"center",width:"32px",height:"32px",background:"transparent",border:`1px solid ${b.border}`,borderRadius:"6px",cursor:"pointer",color:b.textSecondary},children:f.jsx("span",{className:"material-icons",style:{fontSize:"18px"},children:"refresh"})})]}),oe=()=>f.jsx("div",{style:{padding:"48px",textAlign:"center",color:b.textSecondary},children:i}),re=()=>f.jsx("div",{style:{padding:"48px",textAlign:"center",color:b.textSecondary},children:"Loading..."}),Se=w||Fe,Te=k||$e,le=G||Me,ze=P||oe,Ge=B||re;return R&&L.length===0?f.jsx("div",{style:{background:b.background,width:"100%",height:"100%"},children:Ge()}):f.jsxs("div",{style:{display:"flex",background:b.background,width:"100%",height:"100%"},children:[f.jsxs("div",{style:{flex:t&&z?"0 0 50%":"1",display:"flex",flexDirection:"column",borderRight:t&&z?`1px solid ${b.border}`:"none",overflow:"hidden"},children:[n&&le(Array.from(E),ie),F&&f.jsx("div",{style:{padding:"12px 16px",background:"#fef2f2",color:b.danger,fontSize:"14px",borderBottom:`1px solid ${b.border}`},children:F}),f.jsx("div",{style:{flex:1,overflowY:"auto"},children:L.length===0?ze():L.map((D,C)=>f.jsx("div",{onClick:Y=>Ue(D,C,Y),onDoubleClick:()=>Pe(D),children:Se(D,E.has(D.uid))},D.uid))})]}),t&&z&&f.jsx("div",{style:{flex:1,overflowY:"auto"},children:Te(z)})]})}exports.AnimatedCardFlip=Ar;exports.ApiClient=xt;exports.AuthManager=Et;exports.Card=gr;exports.DataOperations=_e;exports.Detail=mr;exports.GraphClient=Gt;exports.Mail=yr;exports.MailClient=vt;exports.Stack=hr;exports.getApiClient=rt;exports.initializeApiClient=cr;exports.useMutation=dr;exports.useQuery=Ct;