tevrocsdk 0.1.40 → 0.1.41

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tevrocsdk",
3
- "version": "0.1.40",
3
+ "version": "0.1.41",
4
4
  "description": "JavaScript SDK for the Tevroc API.",
5
5
  "main": "./tevroc-sdk.umd.js",
6
6
  "module": "./tevroc-sdk.esm.js",
package/tevroc-sdk.esm.js CHANGED
@@ -41321,6 +41321,7 @@ var TevrocClient = class {
41321
41321
  this.baseUrl = normalizeBaseUrl(baseUrl);
41322
41322
  this.serviceUrl = normalizeBaseUrl(serviceUrl);
41323
41323
  this.appId = options.appId;
41324
+ this.userId = options.userId ?? options.user_id ?? "default";
41324
41325
  this.appName = options.appName;
41325
41326
  this.payAccount = options.payAccount ?? "default";
41326
41327
  this.isNative = options.isNative ?? false;
@@ -41384,6 +41385,9 @@ var TevrocClient = class {
41384
41385
  if (this.appId) {
41385
41386
  headers.set("x-app-id", this.appId);
41386
41387
  }
41388
+ if (this.userId) {
41389
+ headers.set("x-user-id", this.userId);
41390
+ }
41387
41391
  let body = options.body;
41388
41392
  if (body !== void 0 && body !== null && isJsonBody(body)) {
41389
41393
  headers.set("content-type", "application/json");
@@ -41712,7 +41716,10 @@ function createFunctionRegistry(client) {
41712
41716
  function createIntegrationApi(client) {
41713
41717
  return {
41714
41718
  Core: {
41715
- InvokeLLM: (payload) => client.request("/integrations/core/invoke-llm", { method: "POST", body: payload }),
41719
+ InvokeLLM: (payload) => {
41720
+ const body = payload && typeof payload === "object" ? { ...payload, appId: payload.appId ?? client.appId, userId: payload.userId ?? client.userId ?? "default" } : { appId: client.appId, userId: client.userId ?? "default" };
41721
+ return client.request("/integrations/core/invoke-llm", { method: "POST", body });
41722
+ },
41716
41723
  GenerateImage: (payload) => client.request("/integrations/core/generate-image", { method: "POST", body: payload }),
41717
41724
  UploadFile: (file, options = {}) => upload(client, "/integrations/core/upload-file", file, options),
41718
41725
  UploadPrivateFile: (file, options = {}) => upload(client, "/integrations/core/upload-private-file", file, options),
@@ -41735,12 +41742,17 @@ function createAgentRegistry(client) {
41735
41742
  }
41736
41743
  function createAgentApi(client, agentName) {
41737
41744
  const base = `/agents/${encodeURIComponent(agentName)}/conversations`;
41745
+ const withContext = (payload = {}) => ({
41746
+ ...payload,
41747
+ appId: payload.appId ?? client.appId,
41748
+ userId: payload.userId ?? client.userId ?? "default"
41749
+ });
41738
41750
  return {
41739
- createConversation: (input = {}) => client.request(base, { method: "POST", body: input }),
41751
+ createConversation: (input = {}) => client.request(base, { method: "POST", body: withContext(input) }),
41740
41752
  listConversations: () => client.request(base),
41741
41753
  getConversation: (conversationId) => client.request(`${base}/${encodeURIComponent(conversationId)}`),
41742
41754
  deleteConversation: (conversationId) => client.request(`${base}/${encodeURIComponent(conversationId)}`, { method: "DELETE" }),
41743
- addMessage: (conversationId, input) => client.request(`${base}/${encodeURIComponent(conversationId)}/messages`, { method: "POST", body: input }),
41755
+ addMessage: (conversationId, input) => client.request(`${base}/${encodeURIComponent(conversationId)}/messages`, { method: "POST", body: withContext(input) }),
41744
41756
  listMessages: (conversationId) => client.request(`${base}/${encodeURIComponent(conversationId)}/messages`)
41745
41757
  };
41746
41758
  }
package/tevroc-sdk.min.js CHANGED
@@ -85,7 +85,7 @@ endbfchar
85
85
  CMapName currentdict /CMap defineresource pop
86
86
  end
87
87
  end`};e.events.push(["putFont",function(i){(function(s){var a=s.font,o=s.out,c=s.newObject,g=s.putStream;if(a.metadata instanceof t.API.TTFFont&&a.encoding==="Identity-H"){for(var m=a.metadata.Unicode.widths,B=a.metadata.subset.encode(a.metadata.glyIdsUsed,1),w="",x=0;x<B.length;x++)w+=String.fromCharCode(B[x]);var U=c();g({data:w,addLength1:!0,objectId:U}),o("endobj");var _=c();g({data:r(a.metadata.toUnicode),addLength1:!0,objectId:_}),o("endobj");var E=c();o("<<"),o("/Type /FontDescriptor"),o("/FontName /"+Pu(a.fontName)),o("/FontFile2 "+U+" 0 R"),o("/FontBBox "+t.API.PDFObject.convert(a.metadata.bbox)),o("/Flags "+a.metadata.flags),o("/StemV "+a.metadata.stemV),o("/ItalicAngle "+a.metadata.italicAngle),o("/Ascent "+a.metadata.ascender),o("/Descent "+a.metadata.decender),o("/CapHeight "+a.metadata.capHeight),o(">>"),o("endobj");var q=c();o("<<"),o("/Type /Font"),o("/BaseFont /"+Pu(a.fontName)),o("/FontDescriptor "+E+" 0 R"),o("/W "+t.API.PDFObject.convert(m)),o("/CIDToGIDMap /Identity"),o("/DW 1000"),o("/Subtype /CIDFontType2"),o("/CIDSystemInfo"),o("<<"),o("/Supplement 0"),o("/Registry (Adobe)"),o("/Ordering ("+a.encoding+")"),o(">>"),o(">>"),o("endobj"),a.objectNumber=c(),o("<<"),o("/Type /Font"),o("/Subtype /Type0"),o("/ToUnicode "+_+" 0 R"),o("/BaseFont /"+Pu(a.fontName)),o("/Encoding /"+a.encoding),o("/DescendantFonts ["+q+" 0 R]"),o(">>"),o("endobj"),a.isAlreadyPutted=!0}})(i)}]),e.events.push(["putFont",function(i){(function(s){var a=s.font,o=s.out,c=s.newObject,g=s.putStream;if(a.metadata instanceof t.API.TTFFont&&a.encoding==="WinAnsiEncoding"){for(var m=a.metadata.rawData,B="",w=0;w<m.length;w++)B+=String.fromCharCode(m[w]);var x=c();g({data:B,addLength1:!0,objectId:x}),o("endobj");var U=c();g({data:r(a.metadata.toUnicode),addLength1:!0,objectId:U}),o("endobj");var _=c();o("<<"),o("/Descent "+a.metadata.decender),o("/CapHeight "+a.metadata.capHeight),o("/StemV "+a.metadata.stemV),o("/Type /FontDescriptor"),o("/FontFile2 "+x+" 0 R"),o("/Flags 96"),o("/FontBBox "+t.API.PDFObject.convert(a.metadata.bbox)),o("/FontName /"+Pu(a.fontName)),o("/ItalicAngle "+a.metadata.italicAngle),o("/Ascent "+a.metadata.ascender),o(">>"),o("endobj"),a.objectNumber=c();for(var E=0;E<a.metadata.hmtx.widths.length;E++)a.metadata.hmtx.widths[E]=parseInt(a.metadata.hmtx.widths[E]*(1e3/a.metadata.head.unitsPerEm));o("<</Subtype/TrueType/Type/Font/ToUnicode "+U+" 0 R/BaseFont/"+Pu(a.fontName)+"/FontDescriptor "+_+" 0 R/Encoding/"+a.encoding+" /FirstChar 29 /LastChar 255 /Widths "+t.API.PDFObject.convert(a.metadata.hmtx.widths)+">>"),o("endobj"),a.isAlreadyPutted=!0}})(i)}]);var n=function(i){var s,a=i.text||"",o=i.x,c=i.y,g=i.options||{},m=i.mutex||{},B=m.pdfEscape,w=m.activeFontKey,x=m.fonts,U=w,_="",E=0,q="",R=x[U].encoding;if(x[U].encoding!=="Identity-H")return{text:a,x:o,y:c,options:g,mutex:m};for(q=a,U=w,Array.isArray(a)&&(q=a[0]),E=0;E<q.length;E+=1)x[U].metadata.hasOwnProperty("cmap")&&(s=x[U].metadata.cmap.unicode.codeMap[q[E].charCodeAt(0)]),s||q[E].charCodeAt(0)<256&&x[U].metadata.hasOwnProperty("Unicode")?_+=q[E]:_+="";var P="";return parseInt(U.slice(1))<14||R==="WinAnsiEncoding"?P=B(_,U).split("").map(function(re){return re.charCodeAt(0).toString(16)}).join(""):R==="Identity-H"&&(P=A(_,x[U])),m.isHex=!0,{text:P,x:o,y:c,options:g,mutex:m}};e.events.push(["postProcessText",function(i){var s=i.text||"",a=[],o={text:s,x:i.x,y:i.y,options:i.options,mutex:i.mutex};if(Array.isArray(s)){var c=0;for(c=0;c<s.length;c+=1)Array.isArray(s[c])&&s[c].length===3?a.push([n(Object.assign({},o,{text:s[c][0]})).text,s[c][1],s[c][2]]):a.push(n(Object.assign({},o,{text:s[c]})).text);i.text=a}else i.text=n(Object.assign({},o,{text:s})).text}])})(Ct),(function(t){var e=function(){return this.internal.vFS===void 0&&(this.internal.vFS={}),!0};t.existsFileInVFS=function(A){return e.call(this),this.internal.vFS[A]!==void 0},t.addFileToVFS=function(A,r){return e.call(this),this.internal.vFS[A]=r,this},t.getFileFromVFS=function(A){return e.call(this),this.internal.vFS[A]!==void 0?this.internal.vFS[A]:null}})(Ct.API),(function(t){t.__bidiEngine__=t.prototype.__bidiEngine__=function(r){var n,i,s,a,o,c,g,m=e,B=[[0,3,0,1,0,0,0],[0,3,0,1,2,2,0],[0,3,0,17,2,0,1],[0,3,5,5,4,1,0],[0,3,21,21,4,0,1],[0,3,5,5,4,2,0]],w=[[2,0,1,1,0,1,0],[2,0,1,1,0,2,0],[2,0,2,1,3,2,0],[2,0,2,33,3,1,1]],x={L:0,R:1,EN:2,AN:3,N:4,B:5,S:6},U={0:0,5:1,6:2,7:3,32:4,251:5,254:6,255:7},_=["(",")","(","<",">","<","[","]","[","{","}","{","\xAB","\xBB","\xAB","\u2039","\u203A","\u2039","\u2045","\u2046","\u2045","\u207D","\u207E","\u207D","\u208D","\u208E","\u208D","\u2264","\u2265","\u2264","\u2329","\u232A","\u2329","\uFE59","\uFE5A","\uFE59","\uFE5B","\uFE5C","\uFE5B","\uFE5D","\uFE5E","\uFE5D","\uFE64","\uFE65","\uFE64"],E=new RegExp(/^([1-4|9]|1[0-9]|2[0-9]|3[0168]|4[04589]|5[012]|7[78]|159|16[0-9]|17[0-2]|21[569]|22[03489]|250)$/),q=!1,R=0;this.__bidiEngine__={};var P=function(O){var H=O.charCodeAt(),J=H>>8,Z=U[J];return Z!==void 0?m[256*Z+(255&H)]:J===252||J===253?"AL":E.test(J)?"L":J===8?"R":"N"},re=function(O){for(var H,J=0;J<O.length;J++){if((H=P(O.charAt(J)))==="L")return!1;if(H==="R")return!0}return!1},fe=function(O,H,J,Z){var ge,Ce,Ee,de,be=H[Z];switch(be){case"L":case"R":case"LRE":case"RLE":case"LRO":case"RLO":case"PDF":q=!1;break;case"N":case"AN":break;case"EN":q&&(be="AN");break;case"AL":q=!0,be="R";break;case"WS":case"BN":be="N";break;case"CS":Z<1||Z+1>=H.length||(ge=J[Z-1])!=="EN"&&ge!=="AN"||(Ce=H[Z+1])!=="EN"&&Ce!=="AN"?be="N":q&&(Ce="AN"),be=Ce===ge?Ce:"N";break;case"ES":be=(ge=Z>0?J[Z-1]:"B")==="EN"&&Z+1<H.length&&H[Z+1]==="EN"?"EN":"N";break;case"ET":if(Z>0&&J[Z-1]==="EN"){be="EN";break}if(q){be="N";break}for(Ee=Z+1,de=H.length;Ee<de&&H[Ee]==="ET";)Ee++;be=Ee<de&&H[Ee]==="EN"?"EN":"N";break;case"NSM":if(s&&!a){for(de=H.length,Ee=Z+1;Ee<de&&H[Ee]==="NSM";)Ee++;if(Ee<de){var Pe=O[Z],Fe=Pe>=1425&&Pe<=2303||Pe===64286;if(ge=H[Ee],Fe&&(ge==="R"||ge==="AL")){be="R";break}}}be=Z<1||(ge=H[Z-1])==="B"?"N":J[Z-1];break;case"B":q=!1,n=!0,be=R;break;case"S":i=!0,be="N"}return be},ne=function(O,H,J){var Z=O.split("");return J&&ee(Z,J,{hiLevel:R}),Z.reverse(),H&&H.reverse(),Z.join("")},ee=function(O,H,J){var Z,ge,Ce,Ee,de,be=-1,Pe=O.length,Fe=0,T=[],$=R?w:B,Y=[];for(q=!1,n=!1,i=!1,ge=0;ge<Pe;ge++)Y[ge]=P(O[ge]);for(Ce=0;Ce<Pe;Ce++){if(de=Fe,T[Ce]=fe(O,Y,T,Ce),Z=240&(Fe=$[de][x[T[Ce]]]),Fe&=15,H[Ce]=Ee=$[Fe][5],Z>0)if(Z===16){for(ge=be;ge<Ce;ge++)H[ge]=1;be=-1}else be=-1;if($[Fe][6])be===-1&&(be=Ce);else if(be>-1){for(ge=be;ge<Ce;ge++)H[ge]=Ee;be=-1}Y[Ce]==="B"&&(H[Ce]=0),J.hiLevel|=Ee}i&&(function(Ae,oe,we){for(var Ue=0;Ue<we;Ue++)if(Ae[Ue]==="S"){oe[Ue]=R;for(var _e=Ue-1;_e>=0&&Ae[_e]==="WS";_e--)oe[_e]=R}})(Y,H,Pe)},V=function(O,H,J,Z,ge){if(!(ge.hiLevel<O)){if(O===1&&R===1&&!n)return H.reverse(),void(J&&J.reverse());for(var Ce,Ee,de,be,Pe=H.length,Fe=0;Fe<Pe;){if(Z[Fe]>=O){for(de=Fe+1;de<Pe&&Z[de]>=O;)de++;for(be=Fe,Ee=de-1;be<Ee;be++,Ee--)Ce=H[be],H[be]=H[Ee],H[Ee]=Ce,J&&(Ce=J[be],J[be]=J[Ee],J[Ee]=Ce);Fe=de}Fe++}}},ie=function(O,H,J){var Z=O.split(""),ge={hiLevel:R};return J||(J=[]),ee(Z,J,ge),(function(Ce,Ee,de){if(de.hiLevel!==0&&g)for(var be,Pe=0;Pe<Ce.length;Pe++)Ee[Pe]===1&&(be=_.indexOf(Ce[Pe]))>=0&&(Ce[Pe]=_[be+1])})(Z,J,ge),V(2,Z,H,J,ge),V(1,Z,H,J,ge),Z.join("")};return this.__bidiEngine__.doBidiReorder=function(O,H,J){if((function(ge,Ce){if(Ce)for(var Ee=0;Ee<ge.length;Ee++)Ce[Ee]=Ee;a===void 0&&(a=re(ge)),c===void 0&&(c=re(ge))})(O,H),s||!o||c)if(s&&o&&a^c)R=a?1:0,O=ne(O,H,J);else if(!s&&o&&c)R=a?1:0,O=ie(O,H,J),O=ne(O,H);else if(!s||a||o||c){if(s&&!o&&a^c)O=ne(O,H),a?(R=0,O=ie(O,H,J)):(R=1,O=ie(O,H,J),O=ne(O,H));else if(s&&a&&!o&&c)R=1,O=ie(O,H,J),O=ne(O,H);else if(!s&&!o&&a^c){var Z=g;a?(R=1,O=ie(O,H,J),R=0,g=!1,O=ie(O,H,J),g=Z):(R=0,O=ie(O,H,J),O=ne(O,H),R=1,g=!1,O=ie(O,H,J),g=Z,O=ne(O,H))}}else R=0,O=ie(O,H,J);else R=a?1:0,O=ie(O,H,J);return O},this.__bidiEngine__.setOptions=function(O){O&&(s=O.isInputVisual,o=O.isOutputVisual,a=O.isInputRtl,c=O.isOutputRtl,g=O.isSymmetricSwapping)},this.__bidiEngine__.setOptions(r),this.__bidiEngine__};var e=["BN","BN","BN","BN","BN","BN","BN","BN","BN","S","B","S","WS","B","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","B","B","B","S","WS","N","N","ET","ET","ET","N","N","N","N","N","ES","CS","ES","CS","CS","EN","EN","EN","EN","EN","EN","EN","EN","EN","EN","CS","N","N","N","N","N","N","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","N","N","N","N","N","N","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","N","N","N","N","BN","BN","BN","BN","BN","BN","B","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","CS","N","ET","ET","ET","ET","N","N","N","N","L","N","N","BN","N","N","ET","ET","EN","EN","N","L","N","N","N","EN","L","N","N","N","N","N","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","N","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","N","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","N","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","N","N","L","L","L","L","L","L","L","N","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","N","L","N","N","N","N","N","ET","N","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","R","NSM","R","NSM","NSM","R","NSM","NSM","R","NSM","N","N","N","N","N","N","N","N","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","N","N","N","N","N","R","R","R","R","R","N","N","N","N","N","N","N","N","N","N","N","AN","AN","AN","AN","AN","AN","N","N","AL","ET","ET","AL","CS","AL","N","N","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","AL","AL","N","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","AN","AN","AN","AN","AN","AN","AN","AN","AN","AN","ET","AN","AN","AL","AL","AL","NSM","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","NSM","NSM","NSM","NSM","NSM","NSM","NSM","AN","N","NSM","NSM","NSM","NSM","NSM","NSM","AL","AL","NSM","NSM","N","NSM","NSM","NSM","NSM","AL","AL","EN","EN","EN","EN","EN","EN","EN","EN","EN","EN","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","N","AL","AL","NSM","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","N","N","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","AL","N","N","N","N","N","N","N","N","N","N","N","N","N","N","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","R","R","N","N","N","N","R","N","N","N","N","N","WS","WS","WS","WS","WS","WS","WS","WS","WS","WS","WS","BN","BN","BN","L","R","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","WS","B","LRE","RLE","PDF","LRO","RLO","CS","ET","ET","ET","ET","ET","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","CS","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","WS","BN","BN","BN","BN","BN","N","LRI","RLI","FSI","PDI","BN","BN","BN","BN","BN","BN","EN","L","N","N","EN","EN","EN","EN","EN","EN","ES","ES","N","N","N","L","EN","EN","EN","EN","EN","EN","EN","EN","EN","EN","ES","ES","N","N","N","N","L","L","L","L","L","L","L","L","L","L","L","L","L","N","N","N","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","L","L","L","L","L","L","L","N","N","N","N","N","N","N","N","N","N","N","N","L","L","L","L","L","N","N","N","N","N","R","NSM","R","R","R","R","R","R","R","R","R","R","ES","R","R","R","R","R","R","R","R","R","R","R","R","R","N","R","R","R","R","R","N","R","N","R","R","N","R","R","N","R","R","R","R","R","R","R","R","R","R","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","CS","N","CS","N","N","CS","N","N","N","N","N","N","N","N","N","ET","N","N","ES","ES","N","N","N","N","N","ET","ET","N","N","N","N","N","AL","AL","AL","AL","AL","N","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","N","N","BN","N","N","N","ET","ET","ET","N","N","N","N","N","ES","CS","ES","CS","CS","EN","EN","EN","EN","EN","EN","EN","EN","EN","EN","CS","N","N","N","N","N","N","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","N","N","N","N","N","N","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","N","N","N","N","N","N","N","N","N","N","N","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","N","N","N","L","L","L","L","L","L","N","N","L","L","L","L","L","L","N","N","L","L","L","L","L","L","N","N","L","L","L","N","N","N","ET","ET","N","N","N","ET","ET","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N"],A=new t.__bidiEngine__({isInputVisual:!0});t.API.events.push(["postProcessText",function(r){var n=r.text;r.x,r.y;var i=r.options||{};r.mutex,i.lang;var s=[];if(i.isInputVisual=typeof i.isInputVisual!="boolean"||i.isInputVisual,A.setOptions(i),Object.prototype.toString.call(n)==="[object Array]"){var a=0;for(s=[],a=0;a<n.length;a+=1)Object.prototype.toString.call(n[a])==="[object Array]"?s.push([A.doBidiReorder(n[a][0]),n[a][1],n[a][2]]):s.push([A.doBidiReorder(n[a])]);r.text=s}else r.text=A.doBidiReorder(n);A.setOptions({isInputVisual:!0})}])})(Ct),Ct.API.TTFFont=(function(){function t(e){var A;if(this.rawData=e,A=this.contents=new go(e),this.contents.pos=4,A.readString(4)==="ttcf")throw new Error("TTCF not supported.");A.pos=0,this.parse(),this.subset=new t9(this),this.registerTTF()}return t.open=function(e){return new t(e)},t.prototype.parse=function(){return this.directory=new Mq(this.contents),this.head=new Kq(this),this.name=new Wq(this),this.cmap=new M_(this),this.toUnicode={},this.hhea=new jq(this),this.maxp=new Xq(this),this.hmtx=new $q(this),this.post=new Gq(this),this.os2=new Vq(this),this.loca=new e9(this),this.glyf=new Yq(this),this.ascender=this.os2.exists&&this.os2.ascender||this.hhea.ascender,this.decender=this.os2.exists&&this.os2.decender||this.hhea.decender,this.lineGap=this.os2.exists&&this.os2.lineGap||this.hhea.lineGap,this.bbox=[this.head.xMin,this.head.yMin,this.head.xMax,this.head.yMax]},t.prototype.registerTTF=function(){var e,A,r,n,i;if(this.scaleFactor=1e3/this.head.unitsPerEm,this.bbox=function(){var s,a,o,c;for(c=[],s=0,a=(o=this.bbox).length;s<a;s++)e=o[s],c.push(Math.round(e*this.scaleFactor));return c}.call(this),this.stemV=0,this.post.exists?(r=255&(n=this.post.italic_angle),32768&(A=n>>16)&&(A=-(1+(65535^A))),this.italicAngle=+(A+"."+r)):this.italicAngle=0,this.ascender=Math.round(this.ascender*this.scaleFactor),this.decender=Math.round(this.decender*this.scaleFactor),this.lineGap=Math.round(this.lineGap*this.scaleFactor),this.capHeight=this.os2.exists&&this.os2.capHeight||this.ascender,this.xHeight=this.os2.exists&&this.os2.xHeight||0,this.familyClass=(this.os2.exists&&this.os2.familyClass||0)>>8,this.isSerif=(i=this.familyClass)===1||i===2||i===3||i===4||i===5||i===7,this.isScript=this.familyClass===10,this.flags=0,this.post.isFixedPitch&&(this.flags|=1),this.isSerif&&(this.flags|=2),this.isScript&&(this.flags|=8),this.italicAngle!==0&&(this.flags|=64),this.flags|=32,!this.cmap.unicode)throw new Error("No unicode cmap for font")},t.prototype.characterToGlyph=function(e){var A;return((A=this.cmap.unicode)!=null?A.codeMap[e]:void 0)||0},t.prototype.widthOfGlyph=function(e){var A;return A=1e3/this.head.unitsPerEm,this.hmtx.forGlyph(e).advance*A},t.prototype.widthOfString=function(e,A,r){var n,i,s,a;for(s=0,i=0,a=(e=""+e).length;0<=a?i<a:i>a;i=0<=a?++i:--i)n=e.charCodeAt(i),s+=this.widthOfGlyph(this.characterToGlyph(n))+r*(1e3/A)||0;return s*(A/1e3)},t.prototype.lineHeight=function(e,A){var r;return A==null&&(A=!1),r=A?this.lineGap:0,(this.ascender+r-this.decender)/1e3*e},t})();var ya,go=(function(){function t(e){this.data=e??[],this.pos=0,this.length=this.data.length}return t.prototype.readByte=function(){return this.data[this.pos++]},t.prototype.writeByte=function(e){return this.data[this.pos++]=e},t.prototype.readUInt32=function(){return 16777216*this.readByte()+(this.readByte()<<16)+(this.readByte()<<8)+this.readByte()},t.prototype.writeUInt32=function(e){return this.writeByte(e>>>24&255),this.writeByte(e>>16&255),this.writeByte(e>>8&255),this.writeByte(255&e)},t.prototype.readInt32=function(){var e;return(e=this.readUInt32())>=2147483648?e-4294967296:e},t.prototype.writeInt32=function(e){return e<0&&(e+=4294967296),this.writeUInt32(e)},t.prototype.readUInt16=function(){return this.readByte()<<8|this.readByte()},t.prototype.writeUInt16=function(e){return this.writeByte(e>>8&255),this.writeByte(255&e)},t.prototype.readInt16=function(){var e;return(e=this.readUInt16())>=32768?e-65536:e},t.prototype.writeInt16=function(e){return e<0&&(e+=65536),this.writeUInt16(e)},t.prototype.readString=function(e){var A,r;for(r=[],A=0;0<=e?A<e:A>e;A=0<=e?++A:--A)r[A]=String.fromCharCode(this.readByte());return r.join("")},t.prototype.writeString=function(e){var A,r,n;for(n=[],A=0,r=e.length;0<=r?A<r:A>r;A=0<=r?++A:--A)n.push(this.writeByte(e.charCodeAt(A)));return n},t.prototype.readShort=function(){return this.readInt16()},t.prototype.writeShort=function(e){return this.writeInt16(e)},t.prototype.readLongLong=function(){var e,A,r,n,i,s,a,o;return e=this.readByte(),A=this.readByte(),r=this.readByte(),n=this.readByte(),i=this.readByte(),s=this.readByte(),a=this.readByte(),o=this.readByte(),128&e?-1*(72057594037927940*(255^e)+281474976710656*(255^A)+1099511627776*(255^r)+4294967296*(255^n)+16777216*(255^i)+65536*(255^s)+256*(255^a)+(255^o)+1):72057594037927940*e+281474976710656*A+1099511627776*r+4294967296*n+16777216*i+65536*s+256*a+o},t.prototype.writeLongLong=function(e){var A,r;return A=Math.floor(e/4294967296),r=4294967295&e,this.writeByte(A>>24&255),this.writeByte(A>>16&255),this.writeByte(A>>8&255),this.writeByte(255&A),this.writeByte(r>>24&255),this.writeByte(r>>16&255),this.writeByte(r>>8&255),this.writeByte(255&r)},t.prototype.readInt=function(){return this.readInt32()},t.prototype.writeInt=function(e){return this.writeInt32(e)},t.prototype.read=function(e){var A,r;for(A=[],r=0;0<=e?r<e:r>e;r=0<=e?++r:--r)A.push(this.readByte());return A},t.prototype.write=function(e){var A,r,n,i;for(i=[],r=0,n=e.length;r<n;r++)A=e[r],i.push(this.writeByte(A));return i},t})(),Mq=(function(){var t;function e(A){var r,n,i;for(this.scalarType=A.readInt(),this.tableCount=A.readShort(),this.searchRange=A.readShort(),this.entrySelector=A.readShort(),this.rangeShift=A.readShort(),this.tables={},n=0,i=this.tableCount;0<=i?n<i:n>i;n=0<=i?++n:--n)r={tag:A.readString(4),checksum:A.readInt(),offset:A.readInt(),length:A.readInt()},this.tables[r.tag]=r}return e.prototype.encode=function(A){var r,n,i,s,a,o,c,g,m,B,w,x,U;for(U in w=Object.keys(A).length,o=Math.log(2),m=16*Math.floor(Math.log(w)/o),s=Math.floor(m/o),g=16*w-m,(n=new go).writeInt(this.scalarType),n.writeShort(w),n.writeShort(m),n.writeShort(s),n.writeShort(g),i=16*w,c=n.pos+i,a=null,x=[],A)for(B=A[U],n.writeString(U),n.writeInt(t(B)),n.writeInt(c),n.writeInt(B.length),x=x.concat(B),U==="head"&&(a=c),c+=B.length;c%4;)x.push(0),c++;return n.write(x),r=2981146554-t(n.data),n.pos=a+8,n.writeUInt32(r),n.data},t=function(A){var r,n,i,s;for(A=q_.call(A);A.length%4;)A.push(0);for(i=new go(A),n=0,r=0,s=A.length;r<s;r=r+=4)n+=i.readUInt32();return 4294967295&n},e})(),qq={}.hasOwnProperty,Ya=function(t,e){for(var A in e)qq.call(e,A)&&(t[A]=e[A]);function r(){this.constructor=t}return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t};ya=(function(){function t(e){var A;this.file=e,A=this.file.directory.tables[this.tag],this.exists=!!A,A&&(this.offset=A.offset,this.length=A.length,this.parse(this.file.contents))}return t.prototype.parse=function(){},t.prototype.encode=function(){},t.prototype.raw=function(){return this.exists?(this.file.contents.pos=this.offset,this.file.contents.read(this.length)):null},t})();var Kq=(function(){function t(){return t.__super__.constructor.apply(this,arguments)}return Ya(t,ya),t.prototype.tag="head",t.prototype.parse=function(e){return e.pos=this.offset,this.version=e.readInt(),this.revision=e.readInt(),this.checkSumAdjustment=e.readInt(),this.magicNumber=e.readInt(),this.flags=e.readShort(),this.unitsPerEm=e.readShort(),this.created=e.readLongLong(),this.modified=e.readLongLong(),this.xMin=e.readShort(),this.yMin=e.readShort(),this.xMax=e.readShort(),this.yMax=e.readShort(),this.macStyle=e.readShort(),this.lowestRecPPEM=e.readShort(),this.fontDirectionHint=e.readShort(),this.indexToLocFormat=e.readShort(),this.glyphDataFormat=e.readShort()},t.prototype.encode=function(e){var A;return(A=new go).writeInt(this.version),A.writeInt(this.revision),A.writeInt(this.checkSumAdjustment),A.writeInt(this.magicNumber),A.writeShort(this.flags),A.writeShort(this.unitsPerEm),A.writeLongLong(this.created),A.writeLongLong(this.modified),A.writeShort(this.xMin),A.writeShort(this.yMin),A.writeShort(this.xMax),A.writeShort(this.yMax),A.writeShort(this.macStyle),A.writeShort(this.lowestRecPPEM),A.writeShort(this.fontDirectionHint),A.writeShort(e),A.writeShort(this.glyphDataFormat),A.data},t})(),Q_=(function(){function t(e,A){var r,n,i,s,a,o,c,g,m,B,w,x,U,_,E,q,R;switch(this.platformID=e.readUInt16(),this.encodingID=e.readShort(),this.offset=A+e.readInt(),m=e.pos,e.pos=this.offset,this.format=e.readUInt16(),this.length=e.readUInt16(),this.language=e.readUInt16(),this.isUnicode=this.platformID===3&&this.encodingID===1&&this.format===4||this.platformID===0&&this.format===4,this.codeMap={},this.format){case 0:for(o=0;o<256;++o)this.codeMap[o]=e.readByte();break;case 4:for(w=e.readUInt16(),B=w/2,e.pos+=6,i=(function(){var P,re;for(re=[],o=P=0;0<=B?P<B:P>B;o=0<=B?++P:--P)re.push(e.readUInt16());return re})(),e.pos+=2,U=(function(){var P,re;for(re=[],o=P=0;0<=B?P<B:P>B;o=0<=B?++P:--P)re.push(e.readUInt16());return re})(),c=(function(){var P,re;for(re=[],o=P=0;0<=B?P<B:P>B;o=0<=B?++P:--P)re.push(e.readUInt16());return re})(),g=(function(){var P,re;for(re=[],o=P=0;0<=B?P<B:P>B;o=0<=B?++P:--P)re.push(e.readUInt16());return re})(),n=(this.length-e.pos+this.offset)/2,a=(function(){var P,re;for(re=[],o=P=0;0<=n?P<n:P>n;o=0<=n?++P:--P)re.push(e.readUInt16());return re})(),o=E=0,R=i.length;E<R;o=++E)for(_=i[o],r=q=x=U[o];x<=_?q<=_:q>=_;r=x<=_?++q:--q)g[o]===0?s=r+c[o]:(s=a[g[o]/2+(r-x)-(B-o)]||0)!==0&&(s+=c[o]),this.codeMap[r]=65535&s}e.pos=m}return t.encode=function(e,A){var r,n,i,s,a,o,c,g,m,B,w,x,U,_,E,q,R,P,re,fe,ne,ee,V,ie,O,H,J,Z,ge,Ce,Ee,de,be,Pe,Fe,T,$,Y,Ae,oe,we,Ue,_e,Le,Oe,Ye;switch(Z=new go,s=Object.keys(e).sort(function(qe,it){return qe-it}),A){case"macroman":for(U=0,_=(function(){var qe=[];for(x=0;x<256;++x)qe.push(0);return qe})(),q={0:0},i={},ge=0,be=s.length;ge<be;ge++)q[_e=e[n=s[ge]]]==null&&(q[_e]=++U),i[n]={old:e[n],new:q[e[n]]},_[n]=q[e[n]];return Z.writeUInt16(1),Z.writeUInt16(0),Z.writeUInt32(12),Z.writeUInt16(0),Z.writeUInt16(262),Z.writeUInt16(0),Z.write(_),{charMap:i,subtable:Z.data,maxGlyphID:U+1};case"unicode":for(H=[],m=[],R=0,q={},r={},E=c=null,Ce=0,Pe=s.length;Ce<Pe;Ce++)q[re=e[n=s[Ce]]]==null&&(q[re]=++R),r[n]={old:re,new:q[re]},a=q[re]-n,E!=null&&a===c||(E&&m.push(E),H.push(n),c=a),E=n;for(E&&m.push(E),m.push(65535),H.push(65535),ie=2*(V=H.length),ee=2*Math.pow(Math.log(V)/Math.LN2,2),B=Math.log(ee/2)/Math.LN2,ne=2*V-ee,o=[],fe=[],w=[],x=Ee=0,Fe=H.length;Ee<Fe;x=++Ee){if(O=H[x],g=m[x],O===65535){o.push(0),fe.push(0);break}if(O-(J=r[O].new)>=32768)for(o.push(0),fe.push(2*(w.length+V-x)),n=de=O;O<=g?de<=g:de>=g;n=O<=g?++de:--de)w.push(r[n].new);else o.push(J-O),fe.push(0)}for(Z.writeUInt16(3),Z.writeUInt16(1),Z.writeUInt32(12),Z.writeUInt16(4),Z.writeUInt16(16+8*V+2*w.length),Z.writeUInt16(0),Z.writeUInt16(ie),Z.writeUInt16(ee),Z.writeUInt16(B),Z.writeUInt16(ne),we=0,T=m.length;we<T;we++)n=m[we],Z.writeUInt16(n);for(Z.writeUInt16(0),Ue=0,$=H.length;Ue<$;Ue++)n=H[Ue],Z.writeUInt16(n);for(Le=0,Y=o.length;Le<Y;Le++)a=o[Le],Z.writeUInt16(a);for(Oe=0,Ae=fe.length;Oe<Ae;Oe++)P=fe[Oe],Z.writeUInt16(P);for(Ye=0,oe=w.length;Ye<oe;Ye++)U=w[Ye],Z.writeUInt16(U);return{charMap:r,subtable:Z.data,maxGlyphID:R+1}}},t})(),M_=(function(){function t(){return t.__super__.constructor.apply(this,arguments)}return Ya(t,ya),t.prototype.tag="cmap",t.prototype.parse=function(e){var A,r,n;for(e.pos=this.offset,this.version=e.readUInt16(),n=e.readUInt16(),this.tables=[],this.unicode=null,r=0;0<=n?r<n:r>n;r=0<=n?++r:--r)A=new Q_(e,this.offset),this.tables.push(A),A.isUnicode&&this.unicode==null&&(this.unicode=A);return!0},t.encode=function(e,A){var r,n;return A==null&&(A="macroman"),r=Q_.encode(e,A),(n=new go).writeUInt16(0),n.writeUInt16(1),r.table=n.data.concat(r.subtable),r},t})(),jq=(function(){function t(){return t.__super__.constructor.apply(this,arguments)}return Ya(t,ya),t.prototype.tag="hhea",t.prototype.parse=function(e){return e.pos=this.offset,this.version=e.readInt(),this.ascender=e.readShort(),this.decender=e.readShort(),this.lineGap=e.readShort(),this.advanceWidthMax=e.readShort(),this.minLeftSideBearing=e.readShort(),this.minRightSideBearing=e.readShort(),this.xMaxExtent=e.readShort(),this.caretSlopeRise=e.readShort(),this.caretSlopeRun=e.readShort(),this.caretOffset=e.readShort(),e.pos+=8,this.metricDataFormat=e.readShort(),this.numberOfMetrics=e.readUInt16()},t})(),Vq=(function(){function t(){return t.__super__.constructor.apply(this,arguments)}return Ya(t,ya),t.prototype.tag="OS/2",t.prototype.parse=function(e){if(e.pos=this.offset,this.version=e.readUInt16(),this.averageCharWidth=e.readShort(),this.weightClass=e.readUInt16(),this.widthClass=e.readUInt16(),this.type=e.readShort(),this.ySubscriptXSize=e.readShort(),this.ySubscriptYSize=e.readShort(),this.ySubscriptXOffset=e.readShort(),this.ySubscriptYOffset=e.readShort(),this.ySuperscriptXSize=e.readShort(),this.ySuperscriptYSize=e.readShort(),this.ySuperscriptXOffset=e.readShort(),this.ySuperscriptYOffset=e.readShort(),this.yStrikeoutSize=e.readShort(),this.yStrikeoutPosition=e.readShort(),this.familyClass=e.readShort(),this.panose=(function(){var A,r;for(r=[],A=0;A<10;++A)r.push(e.readByte());return r})(),this.charRange=(function(){var A,r;for(r=[],A=0;A<4;++A)r.push(e.readInt());return r})(),this.vendorID=e.readString(4),this.selection=e.readShort(),this.firstCharIndex=e.readShort(),this.lastCharIndex=e.readShort(),this.version>0&&(this.ascent=e.readShort(),this.descent=e.readShort(),this.lineGap=e.readShort(),this.winAscent=e.readShort(),this.winDescent=e.readShort(),this.codePageRange=(function(){var A,r;for(r=[],A=0;A<2;A=++A)r.push(e.readInt());return r})(),this.version>1))return this.xHeight=e.readShort(),this.capHeight=e.readShort(),this.defaultChar=e.readShort(),this.breakChar=e.readShort(),this.maxContext=e.readShort()},t})(),Gq=(function(){function t(){return t.__super__.constructor.apply(this,arguments)}return Ya(t,ya),t.prototype.tag="post",t.prototype.parse=function(e){var A,r,n;switch(e.pos=this.offset,this.format=e.readInt(),this.italicAngle=e.readInt(),this.underlinePosition=e.readShort(),this.underlineThickness=e.readShort(),this.isFixedPitch=e.readInt(),this.minMemType42=e.readInt(),this.maxMemType42=e.readInt(),this.minMemType1=e.readInt(),this.maxMemType1=e.readInt(),this.format){case 65536:case 196608:break;case 131072:var i;for(r=e.readUInt16(),this.glyphNameIndex=[],i=0;0<=r?i<r:i>r;i=0<=r?++i:--i)this.glyphNameIndex.push(e.readUInt16());for(this.names=[],n=[];e.pos<this.offset+this.length;)A=e.readByte(),n.push(this.names.push(e.readString(A)));return n;case 151552:return r=e.readUInt16(),this.offsets=e.read(r);case 262144:return this.map=function(){var s,a,o;for(o=[],i=s=0,a=this.file.maxp.numGlyphs;0<=a?s<a:s>a;i=0<=a?++s:--s)o.push(e.readUInt32());return o}.call(this)}},t})(),zq=function(t,e){this.raw=t,this.length=t.length,this.platformID=e.platformID,this.encodingID=e.encodingID,this.languageID=e.languageID},Wq=(function(){function t(){return t.__super__.constructor.apply(this,arguments)}return Ya(t,ya),t.prototype.tag="name",t.prototype.parse=function(e){var A,r,n,i,s,a,o,c,g,m,B;for(e.pos=this.offset,e.readShort(),A=e.readShort(),a=e.readShort(),r=[],i=0;0<=A?i<A:i>A;i=0<=A?++i:--i)r.push({platformID:e.readShort(),encodingID:e.readShort(),languageID:e.readShort(),nameID:e.readShort(),length:e.readShort(),offset:this.offset+a+e.readShort()});for(o={},i=g=0,m=r.length;g<m;i=++g)n=r[i],e.pos=n.offset,c=e.readString(n.length),s=new zq(c,n),o[B=n.nameID]==null&&(o[B]=[]),o[n.nameID].push(s);this.strings=o,this.copyright=o[0],this.fontFamily=o[1],this.fontSubfamily=o[2],this.uniqueSubfamily=o[3],this.fontName=o[4],this.version=o[5];try{this.postscriptName=o[6][0].raw.replace(/[\x00-\x19\x80-\xff]/g,"")}catch{this.postscriptName=o[4][0].raw.replace(/[\x00-\x19\x80-\xff]/g,"")}return this.trademark=o[7],this.manufacturer=o[8],this.designer=o[9],this.description=o[10],this.vendorUrl=o[11],this.designerUrl=o[12],this.license=o[13],this.licenseUrl=o[14],this.preferredFamily=o[15],this.preferredSubfamily=o[17],this.compatibleFull=o[18],this.sampleText=o[19]},t})(),Xq=(function(){function t(){return t.__super__.constructor.apply(this,arguments)}return Ya(t,ya),t.prototype.tag="maxp",t.prototype.parse=function(e){return e.pos=this.offset,this.version=e.readInt(),this.numGlyphs=e.readUInt16(),this.maxPoints=e.readUInt16(),this.maxContours=e.readUInt16(),this.maxCompositePoints=e.readUInt16(),this.maxComponentContours=e.readUInt16(),this.maxZones=e.readUInt16(),this.maxTwilightPoints=e.readUInt16(),this.maxStorage=e.readUInt16(),this.maxFunctionDefs=e.readUInt16(),this.maxInstructionDefs=e.readUInt16(),this.maxStackElements=e.readUInt16(),this.maxSizeOfInstructions=e.readUInt16(),this.maxComponentElements=e.readUInt16(),this.maxComponentDepth=e.readUInt16()},t})(),$q=(function(){function t(){return t.__super__.constructor.apply(this,arguments)}return Ya(t,ya),t.prototype.tag="hmtx",t.prototype.parse=function(e){var A,r,n,i,s,a,o;for(e.pos=this.offset,this.metrics=[],A=0,a=this.file.hhea.numberOfMetrics;0<=a?A<a:A>a;A=0<=a?++A:--A)this.metrics.push({advance:e.readUInt16(),lsb:e.readInt16()});for(n=this.file.maxp.numGlyphs-this.file.hhea.numberOfMetrics,this.leftSideBearings=(function(){var c,g;for(g=[],A=c=0;0<=n?c<n:c>n;A=0<=n?++c:--c)g.push(e.readInt16());return g})(),this.widths=function(){var c,g,m,B;for(B=[],c=0,g=(m=this.metrics).length;c<g;c++)i=m[c],B.push(i.advance);return B}.call(this),r=this.widths[this.widths.length-1],o=[],A=s=0;0<=n?s<n:s>n;A=0<=n?++s:--s)o.push(this.widths.push(r));return o},t.prototype.forGlyph=function(e){return e in this.metrics?this.metrics[e]:{advance:this.metrics[this.metrics.length-1].advance,lsb:this.leftSideBearings[e-this.metrics.length]}},t})(),q_=[].slice,Yq=(function(){function t(){return t.__super__.constructor.apply(this,arguments)}return Ya(t,ya),t.prototype.tag="glyf",t.prototype.parse=function(){return this.cache={}},t.prototype.glyphFor=function(e){var A,r,n,i,s,a,o,c,g,m;return e in this.cache?this.cache[e]:(i=this.file.loca,A=this.file.contents,r=i.indexOf(e),(n=i.lengthOf(e))===0?this.cache[e]=null:(A.pos=this.offset+r,s=(a=new go(A.read(n))).readShort(),c=a.readShort(),m=a.readShort(),o=a.readShort(),g=a.readShort(),this.cache[e]=s===-1?new Zq(a,c,m,o,g):new Jq(a,s,c,m,o,g),this.cache[e]))},t.prototype.encode=function(e,A,r){var n,i,s,a,o;for(s=[],i=[],a=0,o=A.length;a<o;a++)n=e[A[a]],i.push(s.length),n&&(s=s.concat(n.encode(r)));return i.push(s.length),{table:s,offsets:i}},t})(),Jq=(function(){function t(e,A,r,n,i,s){this.raw=e,this.numberOfContours=A,this.xMin=r,this.yMin=n,this.xMax=i,this.yMax=s,this.compound=!1}return t.prototype.encode=function(){return this.raw.data},t})(),Zq=(function(){function t(e,A,r,n,i){var s,a;for(this.raw=e,this.xMin=A,this.yMin=r,this.xMax=n,this.yMax=i,this.compound=!0,this.glyphIDs=[],this.glyphOffsets=[],s=this.raw;a=s.readShort(),this.glyphOffsets.push(s.pos),this.glyphIDs.push(s.readUInt16()),32&a;)s.pos+=1&a?4:2,128&a?s.pos+=8:64&a?s.pos+=4:8&a&&(s.pos+=2)}return t.prototype.encode=function(){var e,A,r;for(A=new go(q_.call(this.raw.data)),e=0,r=this.glyphIDs.length;e<r;++e)A.pos=this.glyphOffsets[e];return A.data},t})(),e9=(function(){function t(){return t.__super__.constructor.apply(this,arguments)}return Ya(t,ya),t.prototype.tag="loca",t.prototype.parse=function(e){var A,r;return e.pos=this.offset,A=this.file.head.indexToLocFormat,this.offsets=A===0?function(){var n,i;for(i=[],r=0,n=this.length;r<n;r+=2)i.push(2*e.readUInt16());return i}.call(this):function(){var n,i;for(i=[],r=0,n=this.length;r<n;r+=4)i.push(e.readUInt32());return i}.call(this)},t.prototype.indexOf=function(e){return this.offsets[e]},t.prototype.lengthOf=function(e){return this.offsets[e+1]-this.offsets[e]},t.prototype.encode=function(e,A){for(var r=new Uint32Array(this.offsets.length),n=0,i=0,s=0;s<r.length;++s)if(r[s]=n,i<A.length&&A[i]==s){++i,r[s]=n;var a=this.offsets[s],o=this.offsets[s+1]-a;o>0&&(n+=o)}for(var c=new Array(4*r.length),g=0;g<r.length;++g)c[4*g+3]=255&r[g],c[4*g+2]=(65280&r[g])>>8,c[4*g+1]=(16711680&r[g])>>16,c[4*g]=(4278190080&r[g])>>24;return c},t})(),t9=(function(){function t(e){this.font=e,this.subset={},this.unicodes={},this.next=33}return t.prototype.generateCmap=function(){var e,A,r,n,i;for(A in n=this.font.cmap.tables[0].codeMap,e={},i=this.subset)r=i[A],e[A]=n[r];return e},t.prototype.glyphsFor=function(e){var A,r,n,i,s,a,o;for(n={},s=0,a=e.length;s<a;s++)n[i=e[s]]=this.font.glyf.glyphFor(i);for(i in A=[],n)(r=n[i])!=null&&r.compound&&A.push.apply(A,r.glyphIDs);if(A.length>0)for(i in o=this.glyphsFor(A))r=o[i],n[i]=r;return n},t.prototype.encode=function(e,A){var r,n,i,s,a,o,c,g,m,B,w,x,U,_,E;for(n in r=M_.encode(this.generateCmap(),"unicode"),s=this.glyphsFor(e),w={0:0},E=r.charMap)w[(o=E[n]).old]=o.new;for(x in B=r.maxGlyphID,s)x in w||(w[x]=B++);return g=(function(q){var R,P;for(R in P={},q)P[q[R]]=R;return P})(w),m=Object.keys(g).sort(function(q,R){return q-R}),U=(function(){var q,R,P;for(P=[],q=0,R=m.length;q<R;q++)a=m[q],P.push(g[a]);return P})(),i=this.font.glyf.encode(s,U,w),c=this.font.loca.encode(i.offsets,U),_={cmap:this.font.cmap.raw(),glyf:i.table,loca:c,hmtx:this.font.hmtx.raw(),hhea:this.font.hhea.raw(),maxp:this.font.maxp.raw(),post:this.font.post.raw(),name:this.font.name.raw(),head:this.font.head.encode(A)},this.font.os2.exists&&(_["OS/2"]=this.font.os2.raw()),this.font.directory.encode(_)},t})();Ct.API.PDFObject=(function(){var t;function e(){}return t=function(A,r){return(Array(r+1).join("0")+A).slice(-r)},e.convert=function(A){var r,n,i,s;if(Array.isArray(A))return"["+(function(){var a,o,c;for(c=[],a=0,o=A.length;a<o;a++)r=A[a],c.push(e.convert(r));return c})().join(" ")+"]";if(typeof A=="string")return"/"+A;if(A?.isString)return"("+A+")";if(A instanceof Date)return"(D:"+t(A.getUTCFullYear(),4)+t(A.getUTCMonth(),2)+t(A.getUTCDate(),2)+t(A.getUTCHours(),2)+t(A.getUTCMinutes(),2)+t(A.getUTCSeconds(),2)+"Z)";if({}.toString.call(A)==="[object Object]"){for(n in i=["<<"],A)s=A[n],i.push("/"+n+" "+e.convert(s));return i.push(">>"),i.join(`
88
- `)}return""+A},e})();Xl();var f3=t=>new Promise((e,A)=>{let r=new FileReader;r.onloadend=()=>{let n=r.result;typeof n=="string"?e(n.split(",")[1]):A(new Error("Unable to encode PDF blob to base64"))},r.onerror=A,r.readAsDataURL(t)}),T2=async t=>{if(!t)throw new Error("PDF source is required");if(t instanceof Blob)return t;if(typeof t.output=="function"){let e=t.output("blob");return e instanceof Promise?await e:e}throw new Error("Unsupported PDF source. Pass a Blob or a jsPDF document instance.")},P9=async t=>{if(!t)throw new Error("File source is required");if(t instanceof Blob)return t;if(typeof t.output=="function"){let e=t.output("blob");return e instanceof Promise?await e:e}if(t instanceof ArrayBuffer)return new Blob([t]);if(t instanceof Uint8Array)return new Blob([t]);if(t&&typeof t.arrayBuffer=="function"){let e=await t.arrayBuffer();return new Blob([e])}throw new Error("Unsupported file source. Pass a Blob, ArrayBuffer, Uint8Array, or a jsPDF document instance.")},N2=t=>URL.createObjectURL(t),o3=async(t,e)=>{let A=N2(t),r=document.createElement("a");r.href=A,r.download=e,r.style.display="none",document.body.appendChild(r),r.click(),document.body.removeChild(r),URL.revokeObjectURL(A)},h3=t=>{if(!t)return"";let e=String(t).trim().split(".");return e.length>1?e.pop().toLowerCase():""},R9=t=>{let e=h3(t);return e?[{name:e.toUpperCase(),extensions:[e]}]:[]},Gf=(t,e="pdf")=>t?String(t).includes(".")?t:`${t}.${e}`:`document.${e}`,l3=async(t,e,A="pdf")=>{let{Filesystem:r,Directory:n}=await Promise.resolve().then(()=>(X_(),W_)),{Toast:i}=await Promise.resolve().then(()=>(e3(),Z_)),s=Gf(e,A),a=await f3(t);await r.writeFile({path:s,data:a,directory:n.Documents,recursive:!0});let o=await r.getUri({directory:n.Documents,path:s});try{await i.show({text:`Saved to Documents/${s}`,duration:"short"})}catch{}return o?.uri??s},u3=async(t,e,A="pdf")=>{let{save:r}=await Promise.resolve().then(()=>(A3(),t3)),{writeFile:n}=await Promise.resolve().then(()=>(s3(),a3)),i=Gf(e,A),s=R9(i),a=await r({defaultPath:i,filters:s});if(!a)return;let o=await t.arrayBuffer(),c=new Uint8Array(o);return await n(a,c),a},d3=async(t,e,A="preview")=>{let r=typeof window<"u"?window.__TAURI__?.core?.invoke:void 0;if(typeof r!="function")return;let n=await f3(t),i=Gf(e||"document.pdf");return await r("open_pdf_file",{fileName:i,action:A,payload:n})},D9=async(t,e)=>{if(Kn&&typeof window<"u"&&window.__TAURI__?.core?.invoke)try{let n=await d3(t,e,"preview");if(n)return n}catch{}let A=N2(t),r=null;if(typeof window<"u"&&typeof window.open=="function")try{if(r=window.open("","_blank","noopener,noreferrer"),r){r.location.href=A;try{r.focus?.()}catch{}return setTimeout(()=>{try{URL.revokeObjectURL(A)}catch{}},1500),A}}catch{}if(typeof document<"u"){let n=document.createElement("a");n.href=A,n.target="_blank",n.rel="noopener noreferrer",n.style.display="none",document.body.appendChild(n),n.click(),document.body.removeChild(n)}return A},H9=async t=>{if(Kn&&typeof window<"u"&&window.__TAURI__?.core?.invoke)try{let i=await d3(t,"document.pdf","print");if(i)return i}catch{}let e=N2(t),A=null;if(typeof window<"u"&&typeof window.open=="function")try{if(A=window.open("","_blank","noopener,noreferrer"),A){A.location.href=e;try{A.focus?.()}catch{}setTimeout(()=>{try{A.print?.()}catch{}try{A.close?.()}catch{}try{URL.revokeObjectURL(e)}catch{}},600);return}}catch{}if(typeof document>"u")throw new Error("PDF printing requires a browser document context.");let r=document.createElement("iframe");r.style.position="fixed",r.style.right="0",r.style.bottom="0",r.style.width="0",r.style.height="0",r.style.border="0",r.src=e;let n=()=>{r.parentNode&&r.parentNode.removeChild(r);try{URL.revokeObjectURL(e)}catch{}};return new Promise((i,s)=>{r.onload=()=>{try{r.contentWindow.focus(),r.contentWindow.print(),setTimeout(n,1e3),i()}catch(a){n(),s(a)}},document.body.appendChild(r)})};function g3(){return{async generatePdfFromElement(t,e={}){if(!t)throw new Error("Element is required to generate PDF.");let A=await(0,c3.default)(t,{scale:e.scale??2,useCORS:!0,backgroundColor:e.backgroundColor??"#ffffff",...e.html2canvas}),r=A.toDataURL("image/png"),n=new Ct(e.jsPDF||{orientation:"p",unit:"mm",format:"a4"}),i=e.pageWidth??210,s=e.pageHeight??297,a=A.height*i/A.width,o=0;n.addImage(r,"PNG",0,o,i,a);let c=a-s;for(;c>0;)o=c-a,n.addPage(),n.addImage(r,"PNG",0,o,i,a),c-=s;return n},async downloadPdf(t,e){let A=await T2(t),r=Gf(e,"pdf");return Ki&&li!=="web"?await l3(A,r,"pdf"):Kn?await u3(A,r,"pdf"):(await o3(A,r),r)},async downloadFile(t,e){let A=await P9(t),r=Gf(e,"bin"),n=h3(r)||"bin";return Ki&&li!=="web"?await l3(A,r,n):Kn?await u3(A,r,n):(await o3(A,r),r)},async previewPdf(t,e="preview.pdf"){let A=await T2(t);return await D9(A,e)},async printPdf(t){let e=await T2(t);return await H9(e)}}}W2();k3();var V9=3e4,X2=null;async function G9(){return X2||(X2=await Promise.resolve().then(()=>(Xl(),Lm))),X2}var $2=null;async function z9(){return $2||($2=await Promise.resolve().then(()=>(W2(),O3))),$2}var ml=class extends Error{constructor(e,A={}){super(e),this.name="TevrocError",this.status=A.status,this.code=A.code,this.details=A.details,this.response=A.response}};function W9(t={}){return new Pp(t)}var Pp=class{constructor(e={}){let A=e.baseUrl??e.url,r=e.serviceUrl??e.url;if(!A)throw new TypeError("createClient requires a baseUrl");if(this.baseUrl=q3(A),this.serviceUrl=q3(r),this.appId=e.appId,this.appName=e.appName,this.payAccount=e.payAccount??"default",this.isNative=e.isNative??!1,this.fetch=(e.fetch??globalThis.fetch).bind(globalThis),typeof this.fetch!="function")throw new TypeError("No fetch implementation available");this.timeoutMs=e.timeoutMs??V9,this.defaultHeaders=dK(e.headers),this.token=e.token??null,this.auth=eK(this),this.entities=this.isNative?eB(this.appId):AK(this),this.functions=rK(this),this.integrations=nK(this),this.agents=iK(this),this.logs=sK(this),this.connectors=oK(this),this.customIntegrations=lK(this),this.sso=uK(this),this.files=this.isNative?$h(this.appId):cK(this),this.native={store:Mo(this.appId),files:$h(this.appId),googleDrive:tB(this.appId),projects:AB(this.appId)},this.offline=hB(this),this.payments=Z9(this),this.commerce=Y9(this),this.realtime=$9(this),this.shiplogic=X9(this),this.platform=J9(this),this.pdf=g3(this)}setToken(e){return this.token=e||null,this.token?Op()?.setItem("tevroc_access_token",this.token):Op()?.removeItem("tevroc_access_token"),this}clearToken(){return this.token=null,Op()?.removeItem("tevroc_access_token"),this}async request(e,A={}){let r=(A.method??"GET").toUpperCase(),n=new Headers(this.defaultHeaders),i=A.query?hK(A.query):"",s=`${this.baseUrl}${e.startsWith("/")?e:`/${e}`}${i}`,a=new AbortController,o=setTimeout(()=>a.abort(),A.timeoutMs??this.timeoutMs),c=this.token||gK();console.log(c,A),c&&A.auth!==!1&&n.set("authorization",`Bearer ${c}`),this.appId&&n.set("x-app-id",this.appId);let g=A.body;if(g!=null&&wK(g)&&(n.set("content-type","application/json"),g=JSON.stringify(g)),A.headers)for(let[m,B]of Object.entries(A.headers))B!=null&&n.set(m,String(B));console.error(n,s);try{let m=await this.fetch(s,{method:r,headers:n,body:g,signal:A.signal??a.signal}),B=await fK(m,A.parseAs);return console.log("Response from request:",B),B}catch(m){throw m?.name==="AbortError"?new ml("Request timed out",{code:"timeout"}):m instanceof ml?m:new ml(m?.message??"Network request failed",{code:"network_error",details:m})}finally{clearTimeout(o)}}};function X9(t){return{getRates:(e={})=>t.request("/shiplogic/rates",{method:"POST",body:e}),createShipment:(e={})=>t.request("/shiplogic/shipments",{method:"POST",body:e}),cancelShipment:e=>t.request(`/shiplogic/shipments/${encodeURIComponent(e)}`,{method:"DELETE"}),trackShipment:e=>t.request(`/shiplogic/track/${encodeURIComponent(e)}`),printLabel:e=>t.request(`/shiplogic/labels/${encodeURIComponent(e)}`,{parseAs:"response"}),validateAddress:(e={})=>t.request("/shiplogic/address/validate",{method:"POST",body:e}),getBranches:(e={})=>t.request("/shiplogic/branches",{query:e}),getCollectionSlots:(e={})=>t.request("/shiplogic/collections/slots",{method:"POST",body:e}),bookCollection:(e={})=>t.request("/shiplogic/collections",{method:"POST",body:e})}}function $9(t){let e=A=>A.replace(/^http:/,"ws:").replace(/^https:/,"wss:");return{connect:(A,r={})=>{let n=`${e(t.baseUrl)}/realtime/${encodeURIComponent(A||"default")}`,i=new WebSocket(n);return i.addEventListener("open",s=>r.open?.(s)),i.addEventListener("message",s=>{let a=s.data;try{a=JSON.parse(s.data)}catch{}r.message?.(a,s)}),i.addEventListener("close",s=>r.close?.(s)),i.addEventListener("error",s=>r.error?.(s)),{socket:i,send:s=>i.readyState===WebSocket.OPEN&&i.send(typeof s=="string"?s:JSON.stringify(s)),close:()=>i.close()}},iceServers:(A={})=>{let r=[],n=String(A.stun_urls||A.stunUrls||"stun:stun.l.google.com:19302").split(",").map(i=>i.trim()).filter(Boolean);return n.length&&r.push({urls:n}),(A.turn_url||A.turnUrl)&&r.push({urls:A.turn_url||A.turnUrl,username:A.turn_username||A.turnUsername,credential:A.turn_credential||A.turnCredential}),r}}}function Y9(t){let e=A=>({list:(r={})=>t.request(`/commerce/${encodeURIComponent(A)}`,{query:r}),query:(r={})=>t.request(`/commerce/${encodeURIComponent(A)}/query`,{method:"POST",body:r}),create:(r={})=>t.request(`/commerce/${encodeURIComponent(A)}`,{method:"POST",body:r}),update:(r,n={})=>t.request(`/commerce/${encodeURIComponent(A)}/${encodeURIComponent(r)}`,{method:"PATCH",body:n})});return{orders:e("CustomerOrder"),deliveries:e("Delivery"),deliveryMessages:e("DeliveryMessage"),availability:e("AvailabilitySlot"),bookings:e("Booking"),appointmentMessages:e("AppointmentMessage"),appointmentSignals:e("AppointmentSignal")}}function J9(t){return(async function(){let{isNative:e,isCapacitor:A,isTauri:r,platform:n}=await G9();return{platform:n,isCapacitor:A,isTauri:r,isNative:e}})()}function Z9(t){return{create:async({amountZAR:e,appId:A="tevrocsoft",mode:r="web",account:n="default",companyId:i,externalCallback:s=void 0}={})=>await H3(e,{appId:A,serviceUrl:t.serviceUrl,mode:r,payAccount:n,companyId:i,externalCallback:s}),createCheckout:async(e={})=>await t.request("/create-checkout",{method:"POST",body:e,auth:!1}),onstatus:e=>{if(typeof e!="function")throw new Error("onstatus requires a function");return D3(e)}}}function eK(t){return{async register(e){let A=Qs(e,t),r=await t.request("/auth/register",{method:"POST",body:A,auth:!1});return r.token&&t.setToken(r.token),r},loginWithProvider:async(e,A,r=async()=>{})=>{if(e==="google"){let{createGoogleLogin:n,subscribeGoogleLogin:i}=await z9();if(console.log({serviceUrl:t.serviceUrl,appId:t.appId,appName:t.appName}),n({serviceUrl:t.serviceUrl,appId:t.appId,appName:t.appName}),A){let s=i(async(a,o)=>{if(console.log("Google callback:",a,o),s(),!a)return;let c=await t.request("/auth/google",{method:"POST",body:Qs({accessToken:a.accessToken},t),auth:!1});console.log(c),await r(c.token,c.user),console.log("Redirecting to:",A),window.location.href=A})}}},googleLogin:e=>z2(e),onGoogleLogin:e=>G2(e),async login(e){let A=Qs(e,t),r=await t.request("/auth/login",{method:"POST",body:A,auth:!1});return r.token&&t.setToken(r.token),r},async logout(){let e=await t.request("/auth/logout",{method:"POST",body:Qs({},t)});return t.clearToken(),e},inviteUser:e=>t.request("/users/invite",{method:"POST",body:Qs(e,t)}),acceptInvite:e=>t.request("/auth/accept-invite",{method:"POST",body:Qs(e,t),auth:!1}),me:()=>t.request("/auth/me",{headers:tK(t)}),verifyOtp:e=>t.request("/auth/verify-otp",{method:"POST",body:Qs(e,t),auth:!1}),changePassword:e=>t.request("/auth/change-password",{method:"POST",body:Qs(e,t)}),resetPassword:e=>t.request("/auth/reset-password",{method:"POST",body:Qs(e,t),auth:!1}),loginUrl:e=>t.request("/auth/login-url",{query:e?{redirectTo:e,appId:t.appId||void 0}:{appId:t.appId||void 0},auth:!1})}}function Qs(t={},e){let A={...t||{}};return e?.appId&&A.appId==null&&(A.appId=e.appId),A}function tK(t){return t?.appId?{"x-app-id":t.appId}:{}}function AK(t){return new Proxy({},{get(e,A){if(typeof A=="string")return K3(t,A)}})}function K3(t,e){let A=`/entities/${encodeURIComponent(e)}`;function r(n,i={}){return Object.entries(i).every(([s,a])=>a&&typeof a=="object"?"$eq"in a?n?.[s]===a.$eq:!0:n?.[s]===a)}return{list:async n=>{if(!t.offline?.isOnline()){let i=await t.native.store.get(`entities/${e}`);return{data:Object.values(i.val()||{}),limit:n?.limit,offset:n?.offset||0}}return t.request(A,{query:n})},get:async n=>t.offline?.isOnline()?t.request(`${A}/${encodeURIComponent(n)}`):{data:(await t.native.store.get(`${e}/${n}`)).val()},create:async n=>t.offline?.isOnline()?t.request(A,{method:"POST",body:n}):t.offline.queueOperation(e,"create",n?.id,n),update:async(n,i)=>t.offline?.isOnline()?t.request(`${A}/${encodeURIComponent(n)}`,{method:"PATCH",body:i}):t.offline.queueOperation(e,"update",n,i),delete:async n=>t.offline?.isOnline()?t.request(`${A}/${encodeURIComponent(n)}`,{method:"DELETE"}):t.offline.queueOperation(e,"delete",n),query:async(n={})=>{if(!t.offline?.isOnline()){let i=await t.native.store.get(`entities/${e}`);return{data:Object.values(i.val()||{}).filter(a=>r(a,n.filter||n.where||n.filters||{})).slice(0,n.limit||200),limit:n.limit}}return t.request(`${A}/query`,{method:"POST",body:n})},filter:async(n={},i,s)=>t.offline?.isOnline()?t.request(`${A}/query`,{method:"POST",body:pK(n,i,s)}):K3(t,e).query({filter:n,limit:s}),bulkCreate:async n=>{if(!t.offline?.isOnline()){let i=0;for(let s of n)await t.offline.queueOperation(e,"create",s?.id,s),i+=1;return{inserted:i}}return t.request(`${A}/bulk`,{method:"POST",body:{records:n}})},bulkUpdate:async n=>{if(!t.offline?.isOnline()){let i=0;for(let s of n)s?.id&&(await t.offline.queueOperation(e,"update",s.id,s),i+=1);return{updated:i}}return t.request(`${A}/bulk`,{method:"PATCH",body:{records:n}})},bulkDelete:async n=>{if(!t.offline?.isOnline()){for(let i of n)await t.offline.queueOperation(e,"delete",i);return{deleted:n.length}}return t.request(`${A}/bulk`,{method:"DELETE",body:{ids:n}})},import:async n=>{if(!t.offline?.isOnline()){let i=0;for(let s of n)await t.offline.queueOperation(e,"create",s?.id,s),i+=1;return{imported:i}}return t.request(`${A}/import`,{method:"POST",body:{records:n}})}}}function rK(t){return new Proxy({invoke:(e,A)=>t.request(`/functions/${encodeURIComponent(e)}`,{method:"POST",body:A})},{get(e,A){if(A in e)return e[A];if(typeof A=="string")return r=>e.invoke(A,r)}})}function nK(t){return{Core:{InvokeLLM:e=>t.request("/integrations/core/invoke-llm",{method:"POST",body:e}),GenerateImage:e=>t.request("/integrations/core/generate-image",{method:"POST",body:e}),UploadFile:(e,A={})=>M3(t,"/integrations/core/upload-file",e,A),UploadPrivateFile:(e,A={})=>M3(t,"/integrations/core/upload-private-file",e,A),CreateFileSignedUrl:e=>t.request("/integrations/core/create-file-signed-url",{method:"POST",body:e}),SendEmail:e=>t.request("/integrations/core/send-email",{method:"POST",body:e}),ExtractDataFromUploadedFile:e=>t.request("/integrations/core/extract-data-from-uploaded-file",{method:"POST",body:e})}}}function iK(t){return new Proxy({},{get(e,A){if(typeof A=="string")return aK(t,A)}})}function aK(t,e){let A=`/agents/${encodeURIComponent(e)}/conversations`;return{createConversation:(r={})=>t.request(A,{method:"POST",body:r}),listConversations:()=>t.request(A),getConversation:r=>t.request(`${A}/${encodeURIComponent(r)}`),deleteConversation:r=>t.request(`${A}/${encodeURIComponent(r)}`,{method:"DELETE"}),addMessage:(r,n)=>t.request(`${A}/${encodeURIComponent(r)}/messages`,{method:"POST",body:n}),listMessages:r=>t.request(`${A}/${encodeURIComponent(r)}/messages`)}}function sK(t){return{list:e=>t.request("/app-logs",{query:e}),create:e=>t.request("/app-logs",{method:"POST",body:e}),get:e=>t.request(`/app-logs/${encodeURIComponent(e)}`)}}function oK(t){return{list:()=>t.request("/connectors"),get:e=>t.request(`/connectors/${encodeURIComponent(e)}`),connect:(e,A={})=>t.request(`/connectors/${encodeURIComponent(e)}/connect`,{method:"POST",body:A}),disconnect:e=>t.request(`/connectors/${encodeURIComponent(e)}/disconnect`,{method:"POST"}),status:e=>t.request(`/connectors/${encodeURIComponent(e)}/status`),user:{list:()=>t.request("/user-connectors"),get:e=>t.request(`/user-connectors/${encodeURIComponent(e)}`),refresh:e=>t.request(`/user-connectors/${encodeURIComponent(e)}/refresh`,{method:"POST"}),delete:e=>t.request(`/user-connectors/${encodeURIComponent(e)}`,{method:"DELETE"})}}}function lK(t){return new Proxy({invoke:(e,A,r)=>t.request(`/custom-integrations/${encodeURIComponent(e)}/${encodeURIComponent(A)}`,{method:"POST",body:r})},{get(e,A){if(A in e)return e[A];if(typeof A=="string")return new Proxy({},{get(r,n){if(typeof n=="string")return i=>e.invoke(A,n,i)}})}})}function uK(t){return{accessToken:e=>t.request("/sso/access-token",{method:"POST",body:e,auth:!1}),callback:e=>t.request("/sso/callback",{query:e,auth:!1})}}function cK(t){return{url:e=>`${t.baseUrl}/files/${encodeURIComponent(e)}`,privateUrl:e=>`${t.baseUrl}/private-files/${encodeURIComponent(e)}`,get:e=>t.request(`/files/${encodeURIComponent(e)}`,{parseAs:"response",auth:!1}),getPrivate:e=>t.request(`/private-files/${encodeURIComponent(e)}`,{parseAs:"response"})}}function M3(t,e,A,r){let n={};return r.filename&&(n["x-filename"]=r.filename),r.contentType&&(n["content-type"]=r.contentType),t.request(e,{method:"POST",body:A,headers:n})}async function fK(t,e){if(e==="response")return t;let r=(t.headers.get("content-type")??"").includes("application/json"),n=r?await t.json():await t.text();if(!t.ok){let i=r&&n?.error?n.error:{};throw new ml(i.message??t.statusText,{status:t.status,code:i.code??"api_error",details:i.details??n,response:t})}return n}function hK(t){let e=new URLSearchParams;for(let[r,n]of Object.entries(t))if(n!=null)if(Array.isArray(n))for(let i of n)e.append(r,String(i));else e.set(r,String(n));let A=e.toString();return A?`?${A}`:""}function q3(t){return String(t).replace(/\/+$/,"")}function dK(t={}){return Object.fromEntries(new Headers(t).entries())}function Op(){return typeof globalThis<"u"?globalThis.localStorage:void 0}function gK(){return Op()?.getItem("tevroc_access_token")??null}function pK(t={},e,A){let r={filter:t};return typeof e=="string"?r.sort=e:e&&typeof e=="object"&&Object.assign(r,e),A!==void 0&&(r.limit=A),r}function wK(t){let e=typeof ArrayBuffer<"u"&&t instanceof ArrayBuffer,A=typeof Blob<"u"&&t instanceof Blob,r=typeof FormData<"u"&&t instanceof FormData;return typeof t=="object"&&!e&&!A&&!r}return sS(vK);})();
88
+ `)}return""+A},e})();Xl();var f3=t=>new Promise((e,A)=>{let r=new FileReader;r.onloadend=()=>{let n=r.result;typeof n=="string"?e(n.split(",")[1]):A(new Error("Unable to encode PDF blob to base64"))},r.onerror=A,r.readAsDataURL(t)}),T2=async t=>{if(!t)throw new Error("PDF source is required");if(t instanceof Blob)return t;if(typeof t.output=="function"){let e=t.output("blob");return e instanceof Promise?await e:e}throw new Error("Unsupported PDF source. Pass a Blob or a jsPDF document instance.")},P9=async t=>{if(!t)throw new Error("File source is required");if(t instanceof Blob)return t;if(typeof t.output=="function"){let e=t.output("blob");return e instanceof Promise?await e:e}if(t instanceof ArrayBuffer)return new Blob([t]);if(t instanceof Uint8Array)return new Blob([t]);if(t&&typeof t.arrayBuffer=="function"){let e=await t.arrayBuffer();return new Blob([e])}throw new Error("Unsupported file source. Pass a Blob, ArrayBuffer, Uint8Array, or a jsPDF document instance.")},N2=t=>URL.createObjectURL(t),o3=async(t,e)=>{let A=N2(t),r=document.createElement("a");r.href=A,r.download=e,r.style.display="none",document.body.appendChild(r),r.click(),document.body.removeChild(r),URL.revokeObjectURL(A)},h3=t=>{if(!t)return"";let e=String(t).trim().split(".");return e.length>1?e.pop().toLowerCase():""},R9=t=>{let e=h3(t);return e?[{name:e.toUpperCase(),extensions:[e]}]:[]},Gf=(t,e="pdf")=>t?String(t).includes(".")?t:`${t}.${e}`:`document.${e}`,l3=async(t,e,A="pdf")=>{let{Filesystem:r,Directory:n}=await Promise.resolve().then(()=>(X_(),W_)),{Toast:i}=await Promise.resolve().then(()=>(e3(),Z_)),s=Gf(e,A),a=await f3(t);await r.writeFile({path:s,data:a,directory:n.Documents,recursive:!0});let o=await r.getUri({directory:n.Documents,path:s});try{await i.show({text:`Saved to Documents/${s}`,duration:"short"})}catch{}return o?.uri??s},u3=async(t,e,A="pdf")=>{let{save:r}=await Promise.resolve().then(()=>(A3(),t3)),{writeFile:n}=await Promise.resolve().then(()=>(s3(),a3)),i=Gf(e,A),s=R9(i),a=await r({defaultPath:i,filters:s});if(!a)return;let o=await t.arrayBuffer(),c=new Uint8Array(o);return await n(a,c),a},d3=async(t,e,A="preview")=>{let r=typeof window<"u"?window.__TAURI__?.core?.invoke:void 0;if(typeof r!="function")return;let n=await f3(t),i=Gf(e||"document.pdf");return await r("open_pdf_file",{fileName:i,action:A,payload:n})},D9=async(t,e)=>{if(Kn&&typeof window<"u"&&window.__TAURI__?.core?.invoke)try{let n=await d3(t,e,"preview");if(n)return n}catch{}let A=N2(t),r=null;if(typeof window<"u"&&typeof window.open=="function")try{if(r=window.open("","_blank","noopener,noreferrer"),r){r.location.href=A;try{r.focus?.()}catch{}return setTimeout(()=>{try{URL.revokeObjectURL(A)}catch{}},1500),A}}catch{}if(typeof document<"u"){let n=document.createElement("a");n.href=A,n.target="_blank",n.rel="noopener noreferrer",n.style.display="none",document.body.appendChild(n),n.click(),document.body.removeChild(n)}return A},H9=async t=>{if(Kn&&typeof window<"u"&&window.__TAURI__?.core?.invoke)try{let i=await d3(t,"document.pdf","print");if(i)return i}catch{}let e=N2(t),A=null;if(typeof window<"u"&&typeof window.open=="function")try{if(A=window.open("","_blank","noopener,noreferrer"),A){A.location.href=e;try{A.focus?.()}catch{}setTimeout(()=>{try{A.print?.()}catch{}try{A.close?.()}catch{}try{URL.revokeObjectURL(e)}catch{}},600);return}}catch{}if(typeof document>"u")throw new Error("PDF printing requires a browser document context.");let r=document.createElement("iframe");r.style.position="fixed",r.style.right="0",r.style.bottom="0",r.style.width="0",r.style.height="0",r.style.border="0",r.src=e;let n=()=>{r.parentNode&&r.parentNode.removeChild(r);try{URL.revokeObjectURL(e)}catch{}};return new Promise((i,s)=>{r.onload=()=>{try{r.contentWindow.focus(),r.contentWindow.print(),setTimeout(n,1e3),i()}catch(a){n(),s(a)}},document.body.appendChild(r)})};function g3(){return{async generatePdfFromElement(t,e={}){if(!t)throw new Error("Element is required to generate PDF.");let A=await(0,c3.default)(t,{scale:e.scale??2,useCORS:!0,backgroundColor:e.backgroundColor??"#ffffff",...e.html2canvas}),r=A.toDataURL("image/png"),n=new Ct(e.jsPDF||{orientation:"p",unit:"mm",format:"a4"}),i=e.pageWidth??210,s=e.pageHeight??297,a=A.height*i/A.width,o=0;n.addImage(r,"PNG",0,o,i,a);let c=a-s;for(;c>0;)o=c-a,n.addPage(),n.addImage(r,"PNG",0,o,i,a),c-=s;return n},async downloadPdf(t,e){let A=await T2(t),r=Gf(e,"pdf");return Ki&&li!=="web"?await l3(A,r,"pdf"):Kn?await u3(A,r,"pdf"):(await o3(A,r),r)},async downloadFile(t,e){let A=await P9(t),r=Gf(e,"bin"),n=h3(r)||"bin";return Ki&&li!=="web"?await l3(A,r,n):Kn?await u3(A,r,n):(await o3(A,r),r)},async previewPdf(t,e="preview.pdf"){let A=await T2(t);return await D9(A,e)},async printPdf(t){let e=await T2(t);return await H9(e)}}}W2();k3();var V9=3e4,X2=null;async function G9(){return X2||(X2=await Promise.resolve().then(()=>(Xl(),Lm))),X2}var $2=null;async function z9(){return $2||($2=await Promise.resolve().then(()=>(W2(),O3))),$2}var ml=class extends Error{constructor(e,A={}){super(e),this.name="TevrocError",this.status=A.status,this.code=A.code,this.details=A.details,this.response=A.response}};function W9(t={}){return new Pp(t)}var Pp=class{constructor(e={}){let A=e.baseUrl??e.url,r=e.serviceUrl??e.url;if(!A)throw new TypeError("createClient requires a baseUrl");if(this.baseUrl=q3(A),this.serviceUrl=q3(r),this.appId=e.appId,this.userId=e.userId??e.user_id??"default",this.appName=e.appName,this.payAccount=e.payAccount??"default",this.isNative=e.isNative??!1,this.fetch=(e.fetch??globalThis.fetch).bind(globalThis),typeof this.fetch!="function")throw new TypeError("No fetch implementation available");this.timeoutMs=e.timeoutMs??V9,this.defaultHeaders=dK(e.headers),this.token=e.token??null,this.auth=eK(this),this.entities=this.isNative?eB(this.appId):AK(this),this.functions=rK(this),this.integrations=nK(this),this.agents=iK(this),this.logs=sK(this),this.connectors=oK(this),this.customIntegrations=lK(this),this.sso=uK(this),this.files=this.isNative?$h(this.appId):cK(this),this.native={store:Mo(this.appId),files:$h(this.appId),googleDrive:tB(this.appId),projects:AB(this.appId)},this.offline=hB(this),this.payments=Z9(this),this.commerce=Y9(this),this.realtime=$9(this),this.shiplogic=X9(this),this.platform=J9(this),this.pdf=g3(this)}setToken(e){return this.token=e||null,this.token?Op()?.setItem("tevroc_access_token",this.token):Op()?.removeItem("tevroc_access_token"),this}clearToken(){return this.token=null,Op()?.removeItem("tevroc_access_token"),this}async request(e,A={}){let r=(A.method??"GET").toUpperCase(),n=new Headers(this.defaultHeaders),i=A.query?hK(A.query):"",s=`${this.baseUrl}${e.startsWith("/")?e:`/${e}`}${i}`,a=new AbortController,o=setTimeout(()=>a.abort(),A.timeoutMs??this.timeoutMs),c=this.token||gK();console.log(c,A),c&&A.auth!==!1&&n.set("authorization",`Bearer ${c}`),this.appId&&n.set("x-app-id",this.appId),this.userId&&n.set("x-user-id",this.userId);let g=A.body;if(g!=null&&wK(g)&&(n.set("content-type","application/json"),g=JSON.stringify(g)),A.headers)for(let[m,B]of Object.entries(A.headers))B!=null&&n.set(m,String(B));console.error(n,s);try{let m=await this.fetch(s,{method:r,headers:n,body:g,signal:A.signal??a.signal}),B=await fK(m,A.parseAs);return console.log("Response from request:",B),B}catch(m){throw m?.name==="AbortError"?new ml("Request timed out",{code:"timeout"}):m instanceof ml?m:new ml(m?.message??"Network request failed",{code:"network_error",details:m})}finally{clearTimeout(o)}}};function X9(t){return{getRates:(e={})=>t.request("/shiplogic/rates",{method:"POST",body:e}),createShipment:(e={})=>t.request("/shiplogic/shipments",{method:"POST",body:e}),cancelShipment:e=>t.request(`/shiplogic/shipments/${encodeURIComponent(e)}`,{method:"DELETE"}),trackShipment:e=>t.request(`/shiplogic/track/${encodeURIComponent(e)}`),printLabel:e=>t.request(`/shiplogic/labels/${encodeURIComponent(e)}`,{parseAs:"response"}),validateAddress:(e={})=>t.request("/shiplogic/address/validate",{method:"POST",body:e}),getBranches:(e={})=>t.request("/shiplogic/branches",{query:e}),getCollectionSlots:(e={})=>t.request("/shiplogic/collections/slots",{method:"POST",body:e}),bookCollection:(e={})=>t.request("/shiplogic/collections",{method:"POST",body:e})}}function $9(t){let e=A=>A.replace(/^http:/,"ws:").replace(/^https:/,"wss:");return{connect:(A,r={})=>{let n=`${e(t.baseUrl)}/realtime/${encodeURIComponent(A||"default")}`,i=new WebSocket(n);return i.addEventListener("open",s=>r.open?.(s)),i.addEventListener("message",s=>{let a=s.data;try{a=JSON.parse(s.data)}catch{}r.message?.(a,s)}),i.addEventListener("close",s=>r.close?.(s)),i.addEventListener("error",s=>r.error?.(s)),{socket:i,send:s=>i.readyState===WebSocket.OPEN&&i.send(typeof s=="string"?s:JSON.stringify(s)),close:()=>i.close()}},iceServers:(A={})=>{let r=[],n=String(A.stun_urls||A.stunUrls||"stun:stun.l.google.com:19302").split(",").map(i=>i.trim()).filter(Boolean);return n.length&&r.push({urls:n}),(A.turn_url||A.turnUrl)&&r.push({urls:A.turn_url||A.turnUrl,username:A.turn_username||A.turnUsername,credential:A.turn_credential||A.turnCredential}),r}}}function Y9(t){let e=A=>({list:(r={})=>t.request(`/commerce/${encodeURIComponent(A)}`,{query:r}),query:(r={})=>t.request(`/commerce/${encodeURIComponent(A)}/query`,{method:"POST",body:r}),create:(r={})=>t.request(`/commerce/${encodeURIComponent(A)}`,{method:"POST",body:r}),update:(r,n={})=>t.request(`/commerce/${encodeURIComponent(A)}/${encodeURIComponent(r)}`,{method:"PATCH",body:n})});return{orders:e("CustomerOrder"),deliveries:e("Delivery"),deliveryMessages:e("DeliveryMessage"),availability:e("AvailabilitySlot"),bookings:e("Booking"),appointmentMessages:e("AppointmentMessage"),appointmentSignals:e("AppointmentSignal")}}function J9(t){return(async function(){let{isNative:e,isCapacitor:A,isTauri:r,platform:n}=await G9();return{platform:n,isCapacitor:A,isTauri:r,isNative:e}})()}function Z9(t){return{create:async({amountZAR:e,appId:A="tevrocsoft",mode:r="web",account:n="default",companyId:i,externalCallback:s=void 0}={})=>await H3(e,{appId:A,serviceUrl:t.serviceUrl,mode:r,payAccount:n,companyId:i,externalCallback:s}),createCheckout:async(e={})=>await t.request("/create-checkout",{method:"POST",body:e,auth:!1}),onstatus:e=>{if(typeof e!="function")throw new Error("onstatus requires a function");return D3(e)}}}function eK(t){return{async register(e){let A=Qs(e,t),r=await t.request("/auth/register",{method:"POST",body:A,auth:!1});return r.token&&t.setToken(r.token),r},loginWithProvider:async(e,A,r=async()=>{})=>{if(e==="google"){let{createGoogleLogin:n,subscribeGoogleLogin:i}=await z9();if(console.log({serviceUrl:t.serviceUrl,appId:t.appId,appName:t.appName}),n({serviceUrl:t.serviceUrl,appId:t.appId,appName:t.appName}),A){let s=i(async(a,o)=>{if(console.log("Google callback:",a,o),s(),!a)return;let c=await t.request("/auth/google",{method:"POST",body:Qs({accessToken:a.accessToken},t),auth:!1});console.log(c),await r(c.token,c.user),console.log("Redirecting to:",A),window.location.href=A})}}},googleLogin:e=>z2(e),onGoogleLogin:e=>G2(e),async login(e){let A=Qs(e,t),r=await t.request("/auth/login",{method:"POST",body:A,auth:!1});return r.token&&t.setToken(r.token),r},async logout(){let e=await t.request("/auth/logout",{method:"POST",body:Qs({},t)});return t.clearToken(),e},inviteUser:e=>t.request("/users/invite",{method:"POST",body:Qs(e,t)}),acceptInvite:e=>t.request("/auth/accept-invite",{method:"POST",body:Qs(e,t),auth:!1}),me:()=>t.request("/auth/me",{headers:tK(t)}),verifyOtp:e=>t.request("/auth/verify-otp",{method:"POST",body:Qs(e,t),auth:!1}),changePassword:e=>t.request("/auth/change-password",{method:"POST",body:Qs(e,t)}),resetPassword:e=>t.request("/auth/reset-password",{method:"POST",body:Qs(e,t),auth:!1}),loginUrl:e=>t.request("/auth/login-url",{query:e?{redirectTo:e,appId:t.appId||void 0}:{appId:t.appId||void 0},auth:!1})}}function Qs(t={},e){let A={...t||{}};return e?.appId&&A.appId==null&&(A.appId=e.appId),A}function tK(t){return t?.appId?{"x-app-id":t.appId}:{}}function AK(t){return new Proxy({},{get(e,A){if(typeof A=="string")return K3(t,A)}})}function K3(t,e){let A=`/entities/${encodeURIComponent(e)}`;function r(n,i={}){return Object.entries(i).every(([s,a])=>a&&typeof a=="object"?"$eq"in a?n?.[s]===a.$eq:!0:n?.[s]===a)}return{list:async n=>{if(!t.offline?.isOnline()){let i=await t.native.store.get(`entities/${e}`);return{data:Object.values(i.val()||{}),limit:n?.limit,offset:n?.offset||0}}return t.request(A,{query:n})},get:async n=>t.offline?.isOnline()?t.request(`${A}/${encodeURIComponent(n)}`):{data:(await t.native.store.get(`${e}/${n}`)).val()},create:async n=>t.offline?.isOnline()?t.request(A,{method:"POST",body:n}):t.offline.queueOperation(e,"create",n?.id,n),update:async(n,i)=>t.offline?.isOnline()?t.request(`${A}/${encodeURIComponent(n)}`,{method:"PATCH",body:i}):t.offline.queueOperation(e,"update",n,i),delete:async n=>t.offline?.isOnline()?t.request(`${A}/${encodeURIComponent(n)}`,{method:"DELETE"}):t.offline.queueOperation(e,"delete",n),query:async(n={})=>{if(!t.offline?.isOnline()){let i=await t.native.store.get(`entities/${e}`);return{data:Object.values(i.val()||{}).filter(a=>r(a,n.filter||n.where||n.filters||{})).slice(0,n.limit||200),limit:n.limit}}return t.request(`${A}/query`,{method:"POST",body:n})},filter:async(n={},i,s)=>t.offline?.isOnline()?t.request(`${A}/query`,{method:"POST",body:pK(n,i,s)}):K3(t,e).query({filter:n,limit:s}),bulkCreate:async n=>{if(!t.offline?.isOnline()){let i=0;for(let s of n)await t.offline.queueOperation(e,"create",s?.id,s),i+=1;return{inserted:i}}return t.request(`${A}/bulk`,{method:"POST",body:{records:n}})},bulkUpdate:async n=>{if(!t.offline?.isOnline()){let i=0;for(let s of n)s?.id&&(await t.offline.queueOperation(e,"update",s.id,s),i+=1);return{updated:i}}return t.request(`${A}/bulk`,{method:"PATCH",body:{records:n}})},bulkDelete:async n=>{if(!t.offline?.isOnline()){for(let i of n)await t.offline.queueOperation(e,"delete",i);return{deleted:n.length}}return t.request(`${A}/bulk`,{method:"DELETE",body:{ids:n}})},import:async n=>{if(!t.offline?.isOnline()){let i=0;for(let s of n)await t.offline.queueOperation(e,"create",s?.id,s),i+=1;return{imported:i}}return t.request(`${A}/import`,{method:"POST",body:{records:n}})}}}function rK(t){return new Proxy({invoke:(e,A)=>t.request(`/functions/${encodeURIComponent(e)}`,{method:"POST",body:A})},{get(e,A){if(A in e)return e[A];if(typeof A=="string")return r=>e.invoke(A,r)}})}function nK(t){return{Core:{InvokeLLM:e=>{let A=e&&typeof e=="object"?{...e,appId:e.appId??t.appId,userId:e.userId??t.userId??"default"}:{appId:t.appId,userId:t.userId??"default"};return t.request("/integrations/core/invoke-llm",{method:"POST",body:A})},GenerateImage:e=>t.request("/integrations/core/generate-image",{method:"POST",body:e}),UploadFile:(e,A={})=>M3(t,"/integrations/core/upload-file",e,A),UploadPrivateFile:(e,A={})=>M3(t,"/integrations/core/upload-private-file",e,A),CreateFileSignedUrl:e=>t.request("/integrations/core/create-file-signed-url",{method:"POST",body:e}),SendEmail:e=>t.request("/integrations/core/send-email",{method:"POST",body:e}),ExtractDataFromUploadedFile:e=>t.request("/integrations/core/extract-data-from-uploaded-file",{method:"POST",body:e})}}}function iK(t){return new Proxy({},{get(e,A){if(typeof A=="string")return aK(t,A)}})}function aK(t,e){let A=`/agents/${encodeURIComponent(e)}/conversations`,r=(n={})=>({...n,appId:n.appId??t.appId,userId:n.userId??t.userId??"default"});return{createConversation:(n={})=>t.request(A,{method:"POST",body:r(n)}),listConversations:()=>t.request(A),getConversation:n=>t.request(`${A}/${encodeURIComponent(n)}`),deleteConversation:n=>t.request(`${A}/${encodeURIComponent(n)}`,{method:"DELETE"}),addMessage:(n,i)=>t.request(`${A}/${encodeURIComponent(n)}/messages`,{method:"POST",body:r(i)}),listMessages:n=>t.request(`${A}/${encodeURIComponent(n)}/messages`)}}function sK(t){return{list:e=>t.request("/app-logs",{query:e}),create:e=>t.request("/app-logs",{method:"POST",body:e}),get:e=>t.request(`/app-logs/${encodeURIComponent(e)}`)}}function oK(t){return{list:()=>t.request("/connectors"),get:e=>t.request(`/connectors/${encodeURIComponent(e)}`),connect:(e,A={})=>t.request(`/connectors/${encodeURIComponent(e)}/connect`,{method:"POST",body:A}),disconnect:e=>t.request(`/connectors/${encodeURIComponent(e)}/disconnect`,{method:"POST"}),status:e=>t.request(`/connectors/${encodeURIComponent(e)}/status`),user:{list:()=>t.request("/user-connectors"),get:e=>t.request(`/user-connectors/${encodeURIComponent(e)}`),refresh:e=>t.request(`/user-connectors/${encodeURIComponent(e)}/refresh`,{method:"POST"}),delete:e=>t.request(`/user-connectors/${encodeURIComponent(e)}`,{method:"DELETE"})}}}function lK(t){return new Proxy({invoke:(e,A,r)=>t.request(`/custom-integrations/${encodeURIComponent(e)}/${encodeURIComponent(A)}`,{method:"POST",body:r})},{get(e,A){if(A in e)return e[A];if(typeof A=="string")return new Proxy({},{get(r,n){if(typeof n=="string")return i=>e.invoke(A,n,i)}})}})}function uK(t){return{accessToken:e=>t.request("/sso/access-token",{method:"POST",body:e,auth:!1}),callback:e=>t.request("/sso/callback",{query:e,auth:!1})}}function cK(t){return{url:e=>`${t.baseUrl}/files/${encodeURIComponent(e)}`,privateUrl:e=>`${t.baseUrl}/private-files/${encodeURIComponent(e)}`,get:e=>t.request(`/files/${encodeURIComponent(e)}`,{parseAs:"response",auth:!1}),getPrivate:e=>t.request(`/private-files/${encodeURIComponent(e)}`,{parseAs:"response"})}}function M3(t,e,A,r){let n={};return r.filename&&(n["x-filename"]=r.filename),r.contentType&&(n["content-type"]=r.contentType),t.request(e,{method:"POST",body:A,headers:n})}async function fK(t,e){if(e==="response")return t;let r=(t.headers.get("content-type")??"").includes("application/json"),n=r?await t.json():await t.text();if(!t.ok){let i=r&&n?.error?n.error:{};throw new ml(i.message??t.statusText,{status:t.status,code:i.code??"api_error",details:i.details??n,response:t})}return n}function hK(t){let e=new URLSearchParams;for(let[r,n]of Object.entries(t))if(n!=null)if(Array.isArray(n))for(let i of n)e.append(r,String(i));else e.set(r,String(n));let A=e.toString();return A?`?${A}`:""}function q3(t){return String(t).replace(/\/+$/,"")}function dK(t={}){return Object.fromEntries(new Headers(t).entries())}function Op(){return typeof globalThis<"u"?globalThis.localStorage:void 0}function gK(){return Op()?.getItem("tevroc_access_token")??null}function pK(t={},e,A){let r={filter:t};return typeof e=="string"?r.sort=e:e&&typeof e=="object"&&Object.assign(r,e),A!==void 0&&(r.limit=A),r}function wK(t){let e=typeof ArrayBuffer<"u"&&t instanceof ArrayBuffer,A=typeof Blob<"u"&&t instanceof Blob,r=typeof FormData<"u"&&t instanceof FormData;return typeof t=="object"&&!e&&!A&&!r}return sS(vK);})();
89
89
  /*! Bundled license information:
90
90
 
91
91
  @capacitor/core/dist/index.js:
package/tevroc-sdk.umd.js CHANGED
@@ -41331,6 +41331,7 @@ var Tevroc = (() => {
41331
41331
  this.baseUrl = normalizeBaseUrl(baseUrl);
41332
41332
  this.serviceUrl = normalizeBaseUrl(serviceUrl);
41333
41333
  this.appId = options.appId;
41334
+ this.userId = options.userId ?? options.user_id ?? "default";
41334
41335
  this.appName = options.appName;
41335
41336
  this.payAccount = options.payAccount ?? "default";
41336
41337
  this.isNative = options.isNative ?? false;
@@ -41394,6 +41395,9 @@ var Tevroc = (() => {
41394
41395
  if (this.appId) {
41395
41396
  headers.set("x-app-id", this.appId);
41396
41397
  }
41398
+ if (this.userId) {
41399
+ headers.set("x-user-id", this.userId);
41400
+ }
41397
41401
  let body = options.body;
41398
41402
  if (body !== void 0 && body !== null && isJsonBody(body)) {
41399
41403
  headers.set("content-type", "application/json");
@@ -41722,7 +41726,10 @@ var Tevroc = (() => {
41722
41726
  function createIntegrationApi(client) {
41723
41727
  return {
41724
41728
  Core: {
41725
- InvokeLLM: (payload) => client.request("/integrations/core/invoke-llm", { method: "POST", body: payload }),
41729
+ InvokeLLM: (payload) => {
41730
+ const body = payload && typeof payload === "object" ? { ...payload, appId: payload.appId ?? client.appId, userId: payload.userId ?? client.userId ?? "default" } : { appId: client.appId, userId: client.userId ?? "default" };
41731
+ return client.request("/integrations/core/invoke-llm", { method: "POST", body });
41732
+ },
41726
41733
  GenerateImage: (payload) => client.request("/integrations/core/generate-image", { method: "POST", body: payload }),
41727
41734
  UploadFile: (file, options = {}) => upload(client, "/integrations/core/upload-file", file, options),
41728
41735
  UploadPrivateFile: (file, options = {}) => upload(client, "/integrations/core/upload-private-file", file, options),
@@ -41745,12 +41752,17 @@ var Tevroc = (() => {
41745
41752
  }
41746
41753
  function createAgentApi(client, agentName) {
41747
41754
  const base = `/agents/${encodeURIComponent(agentName)}/conversations`;
41755
+ const withContext = (payload = {}) => ({
41756
+ ...payload,
41757
+ appId: payload.appId ?? client.appId,
41758
+ userId: payload.userId ?? client.userId ?? "default"
41759
+ });
41748
41760
  return {
41749
- createConversation: (input = {}) => client.request(base, { method: "POST", body: input }),
41761
+ createConversation: (input = {}) => client.request(base, { method: "POST", body: withContext(input) }),
41750
41762
  listConversations: () => client.request(base),
41751
41763
  getConversation: (conversationId) => client.request(`${base}/${encodeURIComponent(conversationId)}`),
41752
41764
  deleteConversation: (conversationId) => client.request(`${base}/${encodeURIComponent(conversationId)}`, { method: "DELETE" }),
41753
- addMessage: (conversationId, input) => client.request(`${base}/${encodeURIComponent(conversationId)}/messages`, { method: "POST", body: input }),
41765
+ addMessage: (conversationId, input) => client.request(`${base}/${encodeURIComponent(conversationId)}/messages`, { method: "POST", body: withContext(input) }),
41754
41766
  listMessages: (conversationId) => client.request(`${base}/${encodeURIComponent(conversationId)}/messages`)
41755
41767
  };
41756
41768
  }