@dvina/sdk 5.0.70 → 5.0.76
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/{_generated_sdk-CuWY4r7U.d.ts → _generated_sdk-Dkdq-O9z.d.ts} +7 -2
- package/dist/ai/index.d.ts +24 -4
- package/dist/ai/index.js +1 -1
- package/dist/billing/index.d.ts +1 -1
- package/dist/billing/index.js +1 -1
- package/dist/{chunk-3AC3GJMQ.js → chunk-BU3BH2KO.js} +1 -1
- package/dist/chunk-XBOJ7CCU.js +1 -0
- package/dist/{connection-DTiW92Zh.d.ts → connection-DsemtinG.d.ts} +18 -4
- package/dist/{error-B-z8CPkV.d.ts → error-CuX-RKTE.d.ts} +3 -8
- package/dist/formats/index.d.ts +73 -0
- package/dist/formats/index.js +1 -0
- package/dist/index.d.ts +6 -6
- package/dist/index.js +5 -5
- package/dist/package.json +4 -0
- package/dist/pagination/index.d.ts +3 -3
- package/package.json +7 -2
- package/dist/chunk-YQD7354H.js +0 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { a as DvinaAsyncRef, b as DvinaRequest, M as MutationOptions, F as FetchOptions, C as ConnectionVariables, D as DvinaQueryRef, W as WithIncludes, c as ConnectionWithNodes } from './types-DlNXHZQK.js';
|
|
2
|
-
import { R as RealtimeEventTopic, S as SyncEngine, a as Request, C as Connection } from './connection-
|
|
2
|
+
import { R as RealtimeEventTopic, S as SyncEngine, a as Request, C as Connection } from './connection-DsemtinG.js';
|
|
3
3
|
import { DocumentNode, VariableDefinitionNode, ArgumentNode } from 'graphql';
|
|
4
|
-
import { D as DvinaError } from './error-
|
|
4
|
+
import { D as DvinaError } from './error-CuX-RKTE.js';
|
|
5
5
|
import { WorkspaceSubscription, EntitlementDetail, BillingClient } from './billing/index.js';
|
|
6
6
|
|
|
7
7
|
interface ActiveChatsSnapshot {
|
|
@@ -11,6 +11,11 @@ interface ActiveChatsSnapshot {
|
|
|
11
11
|
* or a turn a restart cut off is to be continued. Older servers leave it out.
|
|
12
12
|
*/
|
|
13
13
|
pendingChatIds?: string[];
|
|
14
|
+
/**
|
|
15
|
+
* Chats whose work waits on Dvina's own browser or computer starting: working, with no turn running, and going on by
|
|
16
|
+
* itself once it is up (the API decides it: TurnRuns). Older servers leave it out: nothing waits there.
|
|
17
|
+
*/
|
|
18
|
+
startingChatIds?: string[];
|
|
14
19
|
}
|
|
15
20
|
interface DevicePresenceSnapshot {
|
|
16
21
|
devices: Array<{
|
package/dist/ai/index.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { UIMessage, DefaultChatTransport } from 'ai';
|
|
2
|
-
import { D as DvinaSdk, C as ChatMessage, a as ChatMessageConnection } from '../_generated_sdk-
|
|
2
|
+
import { D as DvinaSdk, C as ChatMessage, a as ChatMessageConnection } from '../_generated_sdk-Dkdq-O9z.js';
|
|
3
3
|
import '../types-DlNXHZQK.js';
|
|
4
4
|
import 'graphql';
|
|
5
|
-
import '../connection-
|
|
5
|
+
import '../connection-DsemtinG.js';
|
|
6
6
|
import 'dexie';
|
|
7
|
-
import '../error-
|
|
7
|
+
import '../error-CuX-RKTE.js';
|
|
8
8
|
import '../billing/index.js';
|
|
9
9
|
|
|
10
10
|
/** Where the supervisor sent a user message: answered itself, relayed it to a task, or started a new task. */
|
|
@@ -541,6 +541,26 @@ type DvinaTaskRow = {
|
|
|
541
541
|
* ended. A failure reads as done; its note says what happened.
|
|
542
542
|
*/
|
|
543
543
|
declare function taskStateOf(chat: DvinaTaskRow, jobStatus: string | null | undefined): DvinaTaskState;
|
|
544
|
+
/** A tool call the system answered with a hold (the API's held-call.ts `heldCall`): the model reads `note`. */
|
|
545
|
+
type HeldCallOutput = {
|
|
546
|
+
guarded: 'hold';
|
|
547
|
+
note: string;
|
|
548
|
+
hold: {
|
|
549
|
+
reason: string;
|
|
550
|
+
machine?: string;
|
|
551
|
+
} & Record<string, unknown>;
|
|
552
|
+
};
|
|
553
|
+
/** Whether a tool's output is a hold's answer. */
|
|
554
|
+
declare function isHeldOutput(output: unknown): output is HeldCallOutput;
|
|
555
|
+
/**
|
|
556
|
+
* Where a reply's turn ended held: the first held call of its last step that called tools. The model reads the hold's
|
|
557
|
+
* note and ends its turn (with a line of its own, a step without calls, after it); a later step that called a tool
|
|
558
|
+
* again means the work went on, and nothing is held. -1 when it ended on none. The one rule the API's chat waits by
|
|
559
|
+
* (held-call.ts) and the app reads a reply by.
|
|
560
|
+
*/
|
|
561
|
+
declare function endingHoldIndex(reply: Pick<UIMessage, 'parts'>): number;
|
|
562
|
+
/** The hold a reply's turn ended on (endingHoldIndex), or undefined. */
|
|
563
|
+
declare function endingHoldOf(reply: Pick<UIMessage, 'parts'> | undefined): HeldCallOutput['hold'] | undefined;
|
|
544
564
|
|
|
545
565
|
type DvinaChatTransportOptions = {
|
|
546
566
|
/** API origin including protocol, e.g. `https://api.dvina.ai`. */
|
|
@@ -670,4 +690,4 @@ type DvinaLazyToolOutput = {
|
|
|
670
690
|
/** The held-back output a tool part carries instead of its output, or `null` for a whole output. */
|
|
671
691
|
declare function lazyToolOutputOf(output: unknown): DvinaLazyToolOutput | null;
|
|
672
692
|
|
|
673
|
-
export { type DvinaAnswerOutcome, type DvinaChatActionsSdk, type DvinaChatMessageNode, type DvinaChatTransportOptions, type DvinaDataParts, type DvinaGoal, type DvinaGoalCriterion, type DvinaGoalEvaluation, type DvinaGoalStatus, type DvinaLazyToolOutput, type DvinaMessageLinks, type DvinaMessageMetadata, type DvinaMessagePage, type DvinaMessageRoute, type DvinaTaskRow, type DvinaTaskState, type DvinaToolMetadata, type DvinaUIMessage, LIVE_FILE_FORMATS, MAX_MESSAGE_PAGE, answerDvinaQuestion, answerDvinaToolCall, createDvinaChatTransport, createDvinaTemporaryChatTransport, dvinaMessagePageOf, dvinaUIMessageOf, fetchAllDvinaChatMessages, fetchDvinaNextPrompt, lazyToolOutputOf, postDvinaChatMessage, replyTargetIn, respondDvinaApproval, startDvinaDay, stopDvinaChat, taskStateOf, wasUpdated };
|
|
693
|
+
export { type DvinaAnswerOutcome, type DvinaChatActionsSdk, type DvinaChatMessageNode, type DvinaChatTransportOptions, type DvinaDataParts, type DvinaGoal, type DvinaGoalCriterion, type DvinaGoalEvaluation, type DvinaGoalStatus, type DvinaLazyToolOutput, type DvinaMessageLinks, type DvinaMessageMetadata, type DvinaMessagePage, type DvinaMessageRoute, type DvinaTaskRow, type DvinaTaskState, type DvinaToolMetadata, type DvinaUIMessage, type HeldCallOutput, LIVE_FILE_FORMATS, MAX_MESSAGE_PAGE, answerDvinaQuestion, answerDvinaToolCall, createDvinaChatTransport, createDvinaTemporaryChatTransport, dvinaMessagePageOf, dvinaUIMessageOf, endingHoldIndex, endingHoldOf, fetchAllDvinaChatMessages, fetchDvinaNextPrompt, isHeldOutput, lazyToolOutputOf, postDvinaChatMessage, replyTargetIn, respondDvinaApproval, startDvinaDay, stopDvinaChat, taskStateOf, wasUpdated };
|
package/dist/ai/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import {a}from'../chunk-32KGDH2Q.js';import {b as b$1,c as c$1}from'../chunk-
|
|
1
|
+
import {a}from'../chunk-32KGDH2Q.js';import {b as b$1,c as c$1}from'../chunk-XBOJ7CCU.js';import'../chunk-EK7ODJWE.js';import {DefaultChatTransport}from'ai';var b={html:"html",htm:"html",md:"markdown",markdown:"markdown",csv:"csv",svg:"svg",mmd:"mermaid",mermaid:"mermaid"},P=2;function*_(e,{named:t=true}={}){if(e?.role!=="user")return;if(t&&e.metadata?.inResponseToTaskChatId)return e.metadata.inResponseToTaskChatId;let a=e.metadata?.inResponseToId??void 0;for(let n=0;a&&n<P;n++){let r=yield a;if(r?.referencedChatId)return r.referencedChatId;a=r?.inResponseToId??void 0;}}function T(e,t){let a=_(e),n=a.next();for(;!n.done;)n=a.next(t(n.value));return n.value}function C(e){return e.callProviderMetadata?.dvina?.updated===true}function x(e,t){if(e.waitingOn)return "waiting";let a=t===void 0||t==="running",n=r=>r?new Date(r).getTime():0;return a&&e.busyAt&&(!e.idleAt||n(e.busyAt)>n(e.idleAt))?"working":a&&e.queuedAt?"starting":t&&t!=="running"?"ready":e.idleOutcome==="interrupted"?"stopped":"done"}function c(e){let t=e;return typeof t=="object"&&t!==null&&t.guarded==="hold"&&typeof t.note=="string"&&typeof t.hold?.reason=="string"}function m(e){let t=n=>n.type.startsWith("tool-")||n.type==="dynamic-tool",a=e.parts.flatMap((n,r)=>n.type==="step-start"?[r]:[]);for(let n=a.length-1;n>=-1;n--){let r=n<0?0:a[n]??0,i=e.parts.slice(r,a[n+1]??e.parts.length);if(!i.some(t))continue;let s=i.findIndex(o=>t(o)&&o.state==="output-available"&&c(o.output));return s<0?-1:r+s}return -1}function M(e){if(!e)return;let t=m(e);return t<0?void 0:e.parts[t].output.hold}function U(e){let t=`${e.apiUrl.replace(/\/+$/,"")}/api/chat`;return new DefaultChatTransport({api:t,fetch:k(w(e)),prepareSendMessagesRequest:({id:a,messages:n,trigger:r,messageId:i,body:s})=>({api:`${t}/${encodeURIComponent(a)}`,body:{...s,trigger:r,messageId:i,message:n[n.length-1]}}),prepareReconnectToStreamRequest:({id:a})=>({api:`${t}/${encodeURIComponent(a)}/stream`})})}function N(e){return new DefaultChatTransport({api:`${e.apiUrl.replace(/\/+$/,"")}/api/temporary-chat`,fetch:k(w(e))})}var f=[1e3,2e3,4e3,8e3,15e3,3e4],d=429,L=6e4;function k(e,t=f,a=[503]){return async(n,r)=>{for(let i of t){let s=await e(n,r).catch(u=>{if(r?.signal?.aborted||!(u instanceof TypeError))throw u;return null}),o=s?.status===d;if(s&&!o&&!a.includes(s.status))return s;await s?.body?.cancel().catch(()=>{}),await v(o?G(s,i):i,r?.signal??void 0);}return e(n,r)}}function G(e,t){let a=Number.NaN;return e.headers.forEach((n,r)=>{Number.isNaN(a)&&r.toLowerCase().startsWith("retry-after")&&(a=Number(n));}),Number.isFinite(a)&&a>0?Math.min(Math.max(a*1e3,t),L):t}function v(e,t){return new Promise((a,n)=>{if(t?.aborted)return n(t.reason);let r=setTimeout(()=>{t?.removeEventListener("abort",i),a();},e),i=()=>{clearTimeout(r),n(t?.reason);};t?.addEventListener("abort",i,{once:true});})}var z=a();function w(e){let t=e.fetch??globalThis.fetch.bind(globalThis),a=async(n,r,i)=>{let s=new Headers(r?.headers);s.set("Authorization",`Bearer ${await e.getToken({forceRefresh:i})}`);let o=z();o&&!s.has("x-user-timezone")&&s.set("x-user-timezone",o);let u=e.getLanguage?.();return u&&!s.has("x-preferred-language")&&s.set("x-preferred-language",u),t(n,{...r,headers:s})};return async(n,r)=>{let i=await a(n,r,false);return i.status===401?a(n,r,true):i}}async function H(e,t,a,n){await l(()=>e.sendChatMessageWhileRunning({chatId:t,message:a}),{statuses:X,rateLimited:true,signal:n});}async function j(e,t){let a=await l(()=>e.chatNextPrompt({chatId:t}),{delaysMs:[1e3,3e3]});return typeof a=="string"&&a.trim()?a:null}async function F(e,t){await l(()=>e.stopChat({chatId:t}),{statuses:O});}function W(e,t,a,n){return h(()=>e.respondChatApproval({chatId:t,toolCallId:a,approved:n.approved}))}function Y(e,t,a,n){return h(()=>e.answerChatQuestion({chatId:t,toolCallId:a,answers:n}))}function $(e,t,a,n){return h(()=>e.answerChatToolCall({chatId:t,toolCallId:a,...n}))}async function Q(e){return {started:await e.startChatDay()}}async function h(e){try{return await l(e,{statuses:O,signal:AbortSignal.timeout(K)}),"sent"}catch(t){if(q(t))return "answered-elsewhere";throw t}}function q(e){return e instanceof b$1&&e.errors.some(t=>t.message===A||t.extensions?.code===A)}var A="NOT_WAITING";function V(e){return e instanceof c$1?e.status===d:e instanceof b$1&&e.errors.some(t=>/ThrottlerException|Too Many Requests/i.test(t.message)||t.extensions?.code==="TOO_MANY_REQUESTS"||t.extensions?.originalError?.statusCode===d)}var B=[503],X=[500,502,503,504],O=[502,503,504],K=9e4,R=0;async function l(e,{delaysMs:t=f,statuses:a=B,rateLimited:n=false,signal:r}={}){let i=s=>s instanceof c$1&&(s.status===R||a.includes(s.status??R))||n&&V(s);for(let s of t){try{return await S(e(),r)}catch(o){if(r?.aborted||!i(o))throw o}await v(s,r);}return S(e(),r)}function S(e,t){return t?t.aborted?Promise.reject(t.reason):new Promise((a,n)=>{let r=()=>n(t.reason);t.addEventListener("abort",r,{once:true}),e.then(a,n).finally(()=>t.removeEventListener("abort",r));}):e}function D(e){return {id:e.id,role:e.role,parts:e.parts??[],...e.metadata?{metadata:e.metadata}:{}}}function J(e){let{pageInfo:t}=e;return {messages:e.nodes.map(D),hasOlder:t.hasPreviousPage,hasNewer:t.hasNextPage,...t.startCursor?{startCursor:t.startCursor}:{},...t.endCursor?{endCursor:t.endCursor}:{}}}var E=200;async function Z(e,t,{pageSize:a=E}={}){let n=[],r;for(;;){let i=await e.chatMessages({...t,first:a,after:r}).fetch();n.push(...i.nodes.map(D));let s=i.pageInfo.endCursor??void 0;if(!i.pageInfo.hasNextPage||!s||s===r)return n;r=s;}}function ee(e){if(!e||typeof e!="object"||!("dvinaLazyOutput"in e))return null;let t=e.dvinaLazyOutput;if(!t||typeof t!="object")return null;let{bytes:a,preview:n,urls:r}=t;return {bytes:typeof a=="number"?a:0,preview:typeof n=="string"?n:"",urls:Array.isArray(r)?r.filter(i=>typeof i=="string"):[]}}export{b as LIVE_FILE_FORMATS,E as MAX_MESSAGE_PAGE,Y as answerDvinaQuestion,$ as answerDvinaToolCall,U as createDvinaChatTransport,N as createDvinaTemporaryChatTransport,J as dvinaMessagePageOf,D as dvinaUIMessageOf,m as endingHoldIndex,M as endingHoldOf,Z as fetchAllDvinaChatMessages,j as fetchDvinaNextPrompt,c as isHeldOutput,ee as lazyToolOutputOf,H as postDvinaChatMessage,T as replyTargetIn,W as respondDvinaApproval,Q as startDvinaDay,F as stopDvinaChat,x as taskStateOf,C as wasUpdated};
|
package/dist/billing/index.d.ts
CHANGED
package/dist/billing/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{k as BillingClient,g as CancelReason,h as EntitlementTier,i as SubscriptionCycle,j as SubscriptionProvider}from'../chunk-
|
|
1
|
+
export{k as BillingClient,g as CancelReason,h as EntitlementTier,i as SubscriptionCycle,j as SubscriptionProvider}from'../chunk-BU3BH2KO.js';import'../chunk-XBOJ7CCU.js';import'../chunk-EK7ODJWE.js';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {g as g$1,d,c,a,l,e}from'./chunk-YQD7354H.js';var F=new WeakMap;async function x(e,n){let t=F.get(e);if(!t){let a=e({forceRefresh:true}).finally(()=>{F.get(e)===a&&F.delete(e);});F.set(e,a),t=a;}let i=await t;if(n&&i===n)throw new d("Token refresh did not produce a new token",n);return i}var qe=1e3,Z=1e3,Be=3,je=3e4;function He(e,n=Math.random){return Math.floor(n()*e)}function Ge(e){return e instanceof Error&&e.name==="AbortError"}function Q(){return Date.now()}var R=class{constructor(n){this.options=n;}abortController;abortReason;attemptPromise;closed=false;consecutiveAuthFailures=0;forceRefreshNext=false;lastActivityAt=null;lastConnectedAt=null;lastError;reconnectAttempt=0;reconnectTimer;restartAfterCurrentAttempt=false;state="idle";staleTimer;shouldRun=false;get snapshot(){return {consecutiveAuthFailures:this.consecutiveAuthFailures,id:this.options.id,kind:this.options.kind,lastActivityAt:this.lastActivityAt,lastConnectedAt:this.lastConnectedAt,lastError:this.lastError,reconnectAttempt:this.reconnectAttempt,state:this.state}}async start(){if(this.closed)throw new Error(`Connection '${this.options.kind}:${this.options.id}' is closed`);return this.shouldRun=true,this.clearReconnectTimer(),this.attemptPromise&&this.abortReason&&(this.restartAfterCurrentAttempt=true),this.ensureAttempt()}stop(){this.shouldRun=false,this.restartAfterCurrentAttempt=false,this.clearReconnectTimer(),this.clearStaleTimer(),this.abort("manual"),this.setState("idle");}close(){this.closed=true,this.shouldRun=false,this.restartAfterCurrentAttempt=false,this.clearReconnectTimer(),this.clearStaleTimer(),this.abort("manual"),this.setState("closed");}reconnect(){if(!(this.closed||this.isHealthy()||this.state==="connecting")){if(this.shouldRun=true,this.clearReconnectTimer(),this.clearStaleTimer(),this.abortController){this.restartAfterCurrentAttempt=true,this.abort("restart");return}this.ensureAttempt();}}ensureAttempt(){if(!this.shouldRun||this.closed)return Promise.resolve();if(!this.attemptPromise){let n=this.runAttempt().finally(()=>{this.attemptPromise===n&&(this.attemptPromise=void 0),this.restartAfterCurrentAttempt&&this.shouldRun&&!this.closed&&(this.restartAfterCurrentAttempt=false,this.ensureAttempt());});this.attemptPromise=n;}return this.attemptPromise}async runAttempt(){if(!this.shouldRun||this.closed)return;let n=this.lastConnectedAt!==null||this.reconnectAttempt>0;this.setState("connecting"),this.lastError=void 0,this.abortReason=void 0;let t=new AbortController;this.abortController=t;try{let i=this.forceRefreshNext?await x(this.options.getToken):await this.options.getToken(void 0);if(this.forceRefreshNext=!1,await this.options.dial({isReconnect:n,markActivity:()=>this.markActivity(),markConnected:()=>this.markConnected(),requestTokenRefresh:()=>{this.forceRefreshNext=!0;},signal:t.signal,token:i}),!this.shouldRun||this.closed)return;this.scheduleReconnect("end");}catch(i){if(Ge(i)){this.abortReason==="stale"&&this.shouldRun&&!this.closed&&this.scheduleReconnect("end");return}if(!this.shouldRun||this.closed)return;this.handleFailure(i);}finally{this.abortController===t&&(this.abortController=void 0),this.abortReason=void 0;}}handleFailure(n){if(this.lastError=n,n instanceof d||this.options.isFatalError?.(n)){this.shouldRun=false,this.clearReconnectTimer(),this.clearStaleTimer(),this.setState("failed"),this.options.onFatalError?.(n);return}if(this.options.isAuthError?.(n)??false){if(this.consecutiveAuthFailures+=1,this.forceRefreshNext=true,this.setState("reconnecting"),this.consecutiveAuthFailures>=(this.options.maxConsecutiveAuthFailures??Be)){this.shouldRun=false,this.clearReconnectTimer(),this.clearStaleTimer(),this.setState("failed"),this.options.onFatalError?.(n);return}this.scheduleReconnect("auth");return}this.consecutiveAuthFailures=0,typeof navigator<"u"&&"onLine"in navigator&&navigator.onLine===false?this.setState("offline"):this.setState("reconnecting"),this.scheduleReconnect("failure");}scheduleReconnect(n){if(!this.shouldRun||this.closed)return;this.clearReconnectTimer(),this.clearStaleTimer();let t=n==="auth"?this.options.authRetryDelayMs??qe:n==="failure"?this.nextReconnectDelay():this.options.baseReconnectDelayMs??Z;this.reconnectTimer=setTimeout(()=>{this.reconnectTimer=void 0,this.ensureAttempt();},t);}nextReconnectDelay(){let n=this.options.baseReconnectDelayMs??Z,t=this.options.maxReconnectDelayMs??je,i=Math.min(n*Math.pow(2,this.reconnectAttempt),t);return this.reconnectAttempt+=1,this.options.jitter==="full"?He(i):i}isHealthy(){if(this.state!=="connected"||!this.abortController)return false;let n=this.options.staleTimeoutMs;return !n||n<=0?true:this.lastActivityAt!==null&&Q()-this.lastActivityAt<n}markConnected(){this.consecutiveAuthFailures=0,this.reconnectAttempt=0,this.lastConnectedAt=Q(),this.setState("connected"),this.markActivity();}markActivity(){this.lastActivityAt=Q(),this.armStaleTimer();}armStaleTimer(){this.clearStaleTimer();let n=this.options.staleTimeoutMs;!n||n<=0||this.state!=="connected"||(this.staleTimer=setTimeout(()=>{!this.shouldRun||this.closed||!this.abortController||(this.setState("stale"),this.abort("stale"));},n));}clearReconnectTimer(){this.reconnectTimer&&(clearTimeout(this.reconnectTimer),this.reconnectTimer=void 0);}clearStaleTimer(){this.staleTimer&&(clearTimeout(this.staleTimer),this.staleTimer=void 0);}abort(n){this.abortController&&(this.abortReason=n,this.abortController.abort(),this.abortController=void 0);}setState(n){this.state!==n&&(this.state=n,this.options.onStateChange?.(this.snapshot));}};var Ye=(c=>(c.HitLimits="HIT_LIMITS",c.MissingFeature="MISSING_FEATURE",c.NotUsing="NOT_USING",c.Other="OTHER",c.Quality="QUALITY",c.Switching="SWITCHING",c.TooExpensive="TOO_EXPENSIVE",c))(Ye||{}),We=(o=>(o.Enterprise="enterprise",o.Free="free",o.Max="max",o.Plus="plus",o.Pro="pro",o))(We||{}),ze=(a=>(a.Daily="DAILY",a.Monthly="MONTHLY",a.Weekly="WEEKLY",a.Yearly="YEARLY",a))(ze||{}),Xe=(t=>(t.Revcat="REVCAT",t.Stripe="STRIPE",t))(Xe||{});var K={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"query",name:{kind:"Name",value:"Plans"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"plans"},selectionSet:{kind:"SelectionSet",selections:[{kind:"FragmentSpread",name:{kind:"Name",value:"PlanFragment"}}]}}]}},{kind:"FragmentDefinition",name:{kind:"Name",value:"PlanFragment"},typeCondition:{kind:"NamedType",name:{kind:"Name",value:"Plan"}},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"id"}},{kind:"Field",name:{kind:"Name",value:"name"}},{kind:"Field",name:{kind:"Name",value:"tier"}},{kind:"Field",name:{kind:"Name",value:"prices"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"id"}},{kind:"Field",name:{kind:"Name",value:"currency"}},{kind:"Field",name:{kind:"Name",value:"amount"}},{kind:"Field",name:{kind:"Name",value:"interval"}},{kind:"Field",name:{kind:"Name",value:"campaign"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"name"}},{kind:"Field",name:{kind:"Name",value:"originalAmount"}},{kind:"Field",name:{kind:"Name",value:"discountedAmount"}},{kind:"Field",name:{kind:"Name",value:"percentOff"}},{kind:"Field",name:{kind:"Name",value:"expiresAt"}}]}}]}},{kind:"Field",name:{kind:"Name",value:"entitlements"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"canAddUser"}},{kind:"Field",name:{kind:"Name",value:"minUsers"}},{kind:"Field",name:{kind:"Name",value:"team"}},{kind:"Field",name:{kind:"Name",value:"capacity"}},{kind:"Field",name:{kind:"Name",value:"sourceTypes"}},{kind:"Field",name:{kind:"Name",value:"softTokenUsageLimit"}},{kind:"Field",name:{kind:"Name",value:"hardTokenUsageLimit"}},{kind:"Field",name:{kind:"Name",value:"canAddReport"}},{kind:"Field",name:{kind:"Name",value:"canUseApi"}},{kind:"Field",name:{kind:"Name",value:"maxStructuredSize"}},{kind:"Field",name:{kind:"Name",value:"maxUnstructuredSize"}}]}},{kind:"Field",name:{kind:"Name",value:"features"}}]}}]},ee={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"query",name:{kind:"Name",value:"Plan"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"id"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"String"}}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"plan"},arguments:[{kind:"Argument",name:{kind:"Name",value:"id"},value:{kind:"Variable",name:{kind:"Name",value:"id"}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"FragmentSpread",name:{kind:"Name",value:"PlanFragment"}}]}}]}},{kind:"FragmentDefinition",name:{kind:"Name",value:"PlanFragment"},typeCondition:{kind:"NamedType",name:{kind:"Name",value:"Plan"}},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"id"}},{kind:"Field",name:{kind:"Name",value:"name"}},{kind:"Field",name:{kind:"Name",value:"tier"}},{kind:"Field",name:{kind:"Name",value:"prices"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"id"}},{kind:"Field",name:{kind:"Name",value:"currency"}},{kind:"Field",name:{kind:"Name",value:"amount"}},{kind:"Field",name:{kind:"Name",value:"interval"}},{kind:"Field",name:{kind:"Name",value:"campaign"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"name"}},{kind:"Field",name:{kind:"Name",value:"originalAmount"}},{kind:"Field",name:{kind:"Name",value:"discountedAmount"}},{kind:"Field",name:{kind:"Name",value:"percentOff"}},{kind:"Field",name:{kind:"Name",value:"expiresAt"}}]}}]}},{kind:"Field",name:{kind:"Name",value:"entitlements"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"canAddUser"}},{kind:"Field",name:{kind:"Name",value:"minUsers"}},{kind:"Field",name:{kind:"Name",value:"team"}},{kind:"Field",name:{kind:"Name",value:"capacity"}},{kind:"Field",name:{kind:"Name",value:"sourceTypes"}},{kind:"Field",name:{kind:"Name",value:"softTokenUsageLimit"}},{kind:"Field",name:{kind:"Name",value:"hardTokenUsageLimit"}},{kind:"Field",name:{kind:"Name",value:"canAddReport"}},{kind:"Field",name:{kind:"Name",value:"canUseApi"}},{kind:"Field",name:{kind:"Name",value:"maxStructuredSize"}},{kind:"Field",name:{kind:"Name",value:"maxUnstructuredSize"}}]}},{kind:"Field",name:{kind:"Name",value:"features"}}]}}]},ne={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"query",name:{kind:"Name",value:"TierOrders"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"tierOrders"}}]}}]},te={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"query",name:{kind:"Name",value:"Entitlements"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"entitlements"}}]}}]},ie={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"query",name:{kind:"Name",value:"Subscription"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"subscription"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"tier"}},{kind:"Field",name:{kind:"Name",value:"provider"}},{kind:"Field",name:{kind:"Name",value:"cycle"}},{kind:"Field",name:{kind:"Name",value:"seats"}},{kind:"Field",name:{kind:"Name",value:"cancelAtPeriodEnd"}},{kind:"Field",name:{kind:"Name",value:"currentPeriodStart"}},{kind:"Field",name:{kind:"Name",value:"currentPeriodEnd"}},{kind:"Field",name:{kind:"Name",value:"pausedUntil"}},{kind:"Field",name:{kind:"Name",value:"scheduledChange"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"effectiveDate"}},{kind:"Field",name:{kind:"Name",value:"newTier"}},{kind:"Field",name:{kind:"Name",value:"newSeats"}},{kind:"Field",name:{kind:"Name",value:"newCycle"}}]}}]}}]}}]},ae={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"query",name:{kind:"Name",value:"SubscriptionForManager"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"workspaceId"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"String"}}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"subscriptionForManager"},arguments:[{kind:"Argument",name:{kind:"Name",value:"workspaceId"},value:{kind:"Variable",name:{kind:"Name",value:"workspaceId"}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"tier"}},{kind:"Field",name:{kind:"Name",value:"provider"}},{kind:"Field",name:{kind:"Name",value:"cycle"}},{kind:"Field",name:{kind:"Name",value:"seats"}},{kind:"Field",name:{kind:"Name",value:"cancelAtPeriodEnd"}},{kind:"Field",name:{kind:"Name",value:"currentPeriodStart"}},{kind:"Field",name:{kind:"Name",value:"currentPeriodEnd"}},{kind:"Field",name:{kind:"Name",value:"scheduledChange"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"effectiveDate"}},{kind:"Field",name:{kind:"Name",value:"newTier"}},{kind:"Field",name:{kind:"Name",value:"newSeats"}},{kind:"Field",name:{kind:"Name",value:"newCycle"}}]}}]}}]}}]},re={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"query",name:{kind:"Name",value:"SubscriptionEntitlements"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"subscriptionEntitlements"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"canAddUser"}},{kind:"Field",name:{kind:"Name",value:"minUsers"}},{kind:"Field",name:{kind:"Name",value:"team"}},{kind:"Field",name:{kind:"Name",value:"capacity"}},{kind:"Field",name:{kind:"Name",value:"sourceTypes"}},{kind:"Field",name:{kind:"Name",value:"softTokenUsageLimit"}},{kind:"Field",name:{kind:"Name",value:"hardTokenUsageLimit"}},{kind:"Field",name:{kind:"Name",value:"canAddReport"}},{kind:"Field",name:{kind:"Name",value:"canUseApi"}},{kind:"Field",name:{kind:"Name",value:"maxStructuredSize"}},{kind:"Field",name:{kind:"Name",value:"maxUnstructuredSize"}}]}}]}}]},oe={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"query",name:{kind:"Name",value:"SubscriptionEntitlementsForManager"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"workspaceId"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"String"}}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"subscriptionEntitlementsForManager"},arguments:[{kind:"Argument",name:{kind:"Name",value:"workspaceId"},value:{kind:"Variable",name:{kind:"Name",value:"workspaceId"}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"canAddUser"}},{kind:"Field",name:{kind:"Name",value:"minUsers"}},{kind:"Field",name:{kind:"Name",value:"team"}},{kind:"Field",name:{kind:"Name",value:"capacity"}},{kind:"Field",name:{kind:"Name",value:"sourceTypes"}},{kind:"Field",name:{kind:"Name",value:"softTokenUsageLimit"}},{kind:"Field",name:{kind:"Name",value:"hardTokenUsageLimit"}},{kind:"Field",name:{kind:"Name",value:"canAddReport"}},{kind:"Field",name:{kind:"Name",value:"canUseApi"}},{kind:"Field",name:{kind:"Name",value:"maxStructuredSize"}},{kind:"Field",name:{kind:"Name",value:"maxUnstructuredSize"}}]}}]}}]},se={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"query",name:{kind:"Name",value:"ProrationAmount"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"targetPriceId"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"String"}}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"prorationAmount"},arguments:[{kind:"Argument",name:{kind:"Name",value:"targetPriceId"},value:{kind:"Variable",name:{kind:"Name",value:"targetPriceId"}}}]}]}}]},le={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"mutation",name:{kind:"Name",value:"UpgradePlan"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"targetPriceId"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"String"}}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"upgradePlan"},arguments:[{kind:"Argument",name:{kind:"Name",value:"targetPriceId"},value:{kind:"Variable",name:{kind:"Name",value:"targetPriceId"}}}]}]}}]},ue={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"mutation",name:{kind:"Name",value:"DowngradePlan"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"targetPriceId"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"String"}}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"downgradePlan"},arguments:[{kind:"Argument",name:{kind:"Name",value:"targetPriceId"},value:{kind:"Variable",name:{kind:"Name",value:"targetPriceId"}}}]}]}}]},ce={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"mutation",name:{kind:"Name",value:"AddSeats"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"additionalSeats"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"Int"}}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"addSeats"},arguments:[{kind:"Argument",name:{kind:"Name",value:"additionalSeats"},value:{kind:"Variable",name:{kind:"Name",value:"additionalSeats"}}}]}]}}]},de={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"mutation",name:{kind:"Name",value:"ChangeBillingCycle"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"targetPriceId"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"String"}}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"changeBillingCycle"},arguments:[{kind:"Argument",name:{kind:"Name",value:"targetPriceId"},value:{kind:"Variable",name:{kind:"Name",value:"targetPriceId"}}}]}]}}]},me={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"mutation",name:{kind:"Name",value:"RemoveSeats"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"seatsToRemove"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"Int"}}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"removeSeats"},arguments:[{kind:"Argument",name:{kind:"Name",value:"seatsToRemove"},value:{kind:"Variable",name:{kind:"Name",value:"seatsToRemove"}}}]}]}}]},pe={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"mutation",name:{kind:"Name",value:"CancelSubscription"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"reason"}},type:{kind:"NamedType",name:{kind:"Name",value:"CancelReason"}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"comment"}},type:{kind:"NamedType",name:{kind:"Name",value:"String"}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"cancelSubscription"},arguments:[{kind:"Argument",name:{kind:"Name",value:"reason"},value:{kind:"Variable",name:{kind:"Name",value:"reason"}}},{kind:"Argument",name:{kind:"Name",value:"comment"},value:{kind:"Variable",name:{kind:"Name",value:"comment"}}}]}]}}]},ke={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"query",name:{kind:"Name",value:"RetentionOffers"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"retentionOffers"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"pauseDays"}},{kind:"Field",name:{kind:"Name",value:"discountPercent"}},{kind:"Field",name:{kind:"Name",value:"discountMonths"}}]}}]}}]},Se={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"mutation",name:{kind:"Name",value:"PauseSubscription"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"pauseSubscription"}}]}}]},ye={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"mutation",name:{kind:"Name",value:"ApplyRetentionDiscount"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"applyRetentionDiscount"}}]}}]},fe={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"mutation",name:{kind:"Name",value:"ReactivateSubscription"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"reactivateSubscription"}}]}}]},ve={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"mutation",name:{kind:"Name",value:"CancelSubscriptionForManager"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"workspaceId"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"String"}}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"cancelSubscriptionForManager"},arguments:[{kind:"Argument",name:{kind:"Name",value:"workspaceId"},value:{kind:"Variable",name:{kind:"Name",value:"workspaceId"}}}]}]}}]},be={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"mutation",name:{kind:"Name",value:"ReactivateSubscriptionForManager"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"workspaceId"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"String"}}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"reactivateSubscriptionForManager"},arguments:[{kind:"Argument",name:{kind:"Name",value:"workspaceId"},value:{kind:"Variable",name:{kind:"Name",value:"workspaceId"}}}]}]}}]},he={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"mutation",name:{kind:"Name",value:"CreateCustomer"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"name"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"String"}}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"email"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"String"}}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"workspaceId"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"String"}}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"userId"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"String"}}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"createCustomer"},arguments:[{kind:"Argument",name:{kind:"Name",value:"name"},value:{kind:"Variable",name:{kind:"Name",value:"name"}}},{kind:"Argument",name:{kind:"Name",value:"email"},value:{kind:"Variable",name:{kind:"Name",value:"email"}}},{kind:"Argument",name:{kind:"Name",value:"workspaceId"},value:{kind:"Variable",name:{kind:"Name",value:"workspaceId"}}},{kind:"Argument",name:{kind:"Name",value:"userId"},value:{kind:"Variable",name:{kind:"Name",value:"userId"}}}]}]}}]},ge={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"mutation",name:{kind:"Name",value:"ReleaseSchedule"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"releaseSchedule"}}]}}]},Ne={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"mutation",name:{kind:"Name",value:"CreateCheckoutSession"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"priceId"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"String"}}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"successUrl"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"String"}}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"cancelUrl"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"String"}}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"createCheckoutSession"},arguments:[{kind:"Argument",name:{kind:"Name",value:"priceId"},value:{kind:"Variable",name:{kind:"Name",value:"priceId"}}},{kind:"Argument",name:{kind:"Name",value:"successUrl"},value:{kind:"Variable",name:{kind:"Name",value:"successUrl"}}},{kind:"Argument",name:{kind:"Name",value:"cancelUrl"},value:{kind:"Variable",name:{kind:"Name",value:"cancelUrl"}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"url"}}]}}]}}]},Te={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"mutation",name:{kind:"Name",value:"CreateCustomerPortalSession"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"returnUrl"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"String"}}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"createCustomerPortalSession"},arguments:[{kind:"Argument",name:{kind:"Name",value:"returnUrl"},value:{kind:"Variable",name:{kind:"Name",value:"returnUrl"}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"url"}}]}}]}}]},De={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"query",name:{kind:"Name",value:"CheckoutTrial"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"checkoutTrial"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"tier"}},{kind:"Field",name:{kind:"Name",value:"days"}}]}}]}}]};function Ee(e,n){throw new Error(n)}var B={Name:[],Document:["definitions"],OperationDefinition:["name","variableDefinitions","directives","selectionSet"],VariableDefinition:["variable","type","defaultValue","directives"],Variable:["name"],SelectionSet:["selections"],Field:["alias","name","arguments","directives","selectionSet"],Argument:["name","value"],FragmentSpread:["name","directives"],InlineFragment:["typeCondition","directives","selectionSet"],FragmentDefinition:["name","variableDefinitions","typeCondition","directives","selectionSet"],IntValue:[],FloatValue:[],StringValue:[],BooleanValue:[],NullValue:[],EnumValue:[],ListValue:["values"],ObjectValue:["fields"],ObjectField:["name","value"],Directive:["name","arguments"],NamedType:["name"],ListType:["type"],NonNullType:["type"],SchemaDefinition:["description","directives","operationTypes"],OperationTypeDefinition:["type"],ScalarTypeDefinition:["description","name","directives"],ObjectTypeDefinition:["description","name","interfaces","directives","fields"],FieldDefinition:["description","name","arguments","type","directives"],InputValueDefinition:["description","name","type","defaultValue","directives"],InterfaceTypeDefinition:["description","name","interfaces","directives","fields"],UnionTypeDefinition:["description","name","directives","types"],EnumTypeDefinition:["description","name","directives","values"],EnumValueDefinition:["description","name","directives"],InputObjectTypeDefinition:["description","name","directives","fields"],DirectiveDefinition:["description","name","arguments","locations"],SchemaExtension:["directives","operationTypes"],ScalarTypeExtension:["name","directives"],ObjectTypeExtension:["name","interfaces","directives","fields"],InterfaceTypeExtension:["name","interfaces","directives","fields"],UnionTypeExtension:["name","directives","types"],EnumTypeExtension:["name","directives","values"],InputObjectTypeExtension:["name","directives","fields"]},Je=new Set(Object.keys(B));function j(e){let n=e?.kind;return typeof n=="string"&&Je.has(n)}var q;(function(e){e.QUERY="query",e.MUTATION="mutation",e.SUBSCRIPTION="subscription";})(q||(q={}));var g;(function(e){e.NAME="Name",e.DOCUMENT="Document",e.OPERATION_DEFINITION="OperationDefinition",e.VARIABLE_DEFINITION="VariableDefinition",e.SELECTION_SET="SelectionSet",e.FIELD="Field",e.ARGUMENT="Argument",e.FRAGMENT_SPREAD="FragmentSpread",e.INLINE_FRAGMENT="InlineFragment",e.FRAGMENT_DEFINITION="FragmentDefinition",e.VARIABLE="Variable",e.INT="IntValue",e.FLOAT="FloatValue",e.STRING="StringValue",e.BOOLEAN="BooleanValue",e.NULL="NullValue",e.ENUM="EnumValue",e.LIST="ListValue",e.OBJECT="ObjectValue",e.OBJECT_FIELD="ObjectField",e.DIRECTIVE="Directive",e.NAMED_TYPE="NamedType",e.LIST_TYPE="ListType",e.NON_NULL_TYPE="NonNullType",e.SCHEMA_DEFINITION="SchemaDefinition",e.OPERATION_TYPE_DEFINITION="OperationTypeDefinition",e.SCALAR_TYPE_DEFINITION="ScalarTypeDefinition",e.OBJECT_TYPE_DEFINITION="ObjectTypeDefinition",e.FIELD_DEFINITION="FieldDefinition",e.INPUT_VALUE_DEFINITION="InputValueDefinition",e.INTERFACE_TYPE_DEFINITION="InterfaceTypeDefinition",e.UNION_TYPE_DEFINITION="UnionTypeDefinition",e.ENUM_TYPE_DEFINITION="EnumTypeDefinition",e.ENUM_VALUE_DEFINITION="EnumValueDefinition",e.INPUT_OBJECT_TYPE_DEFINITION="InputObjectTypeDefinition",e.DIRECTIVE_DEFINITION="DirectiveDefinition",e.SCHEMA_EXTENSION="SchemaExtension",e.SCALAR_TYPE_EXTENSION="ScalarTypeExtension",e.OBJECT_TYPE_EXTENSION="ObjectTypeExtension",e.INTERFACE_TYPE_EXTENSION="InterfaceTypeExtension",e.UNION_TYPE_EXTENSION="UnionTypeExtension",e.ENUM_TYPE_EXTENSION="EnumTypeExtension",e.INPUT_OBJECT_TYPE_EXTENSION="InputObjectTypeExtension";})(g||(g={}));function H(e){return e===9||e===32}function Ae(e,n){let t=e.replace(/"""/g,'\\"""'),i=t.split(/\r\n|[\n\r]/g),a=i.length===1,o=i.length>1&&i.slice(1).every(T=>T.length===0||H(T.charCodeAt(0))),s=t.endsWith('\\"""'),c=e.endsWith('"')&&!s,m=e.endsWith("\\"),l=c||m,d=(!a||e.length>70||l||o||s),p="",k=a&&H(e.charCodeAt(0));return (d&&!k||o)&&(p+=`
|
|
1
|
+
import {g as g$1,d,c,a,l,e}from'./chunk-XBOJ7CCU.js';var F=new WeakMap;async function x(e,n){let t=F.get(e);if(!t){let a=e({forceRefresh:true}).finally(()=>{F.get(e)===a&&F.delete(e);});F.set(e,a),t=a;}let i=await t;if(n&&i===n)throw new d("Token refresh did not produce a new token",n);return i}var qe=1e3,Z=1e3,Be=3,je=3e4;function He(e,n=Math.random){return Math.floor(n()*e)}function Ge(e){return e instanceof Error&&e.name==="AbortError"}function Q(){return Date.now()}var R=class{constructor(n){this.options=n;}abortController;abortReason;attemptPromise;closed=false;consecutiveAuthFailures=0;forceRefreshNext=false;lastActivityAt=null;lastConnectedAt=null;lastError;reconnectAttempt=0;reconnectTimer;restartAfterCurrentAttempt=false;state="idle";staleTimer;shouldRun=false;get snapshot(){return {consecutiveAuthFailures:this.consecutiveAuthFailures,id:this.options.id,kind:this.options.kind,lastActivityAt:this.lastActivityAt,lastConnectedAt:this.lastConnectedAt,lastError:this.lastError,reconnectAttempt:this.reconnectAttempt,state:this.state}}async start(){if(this.closed)throw new Error(`Connection '${this.options.kind}:${this.options.id}' is closed`);return this.shouldRun=true,this.clearReconnectTimer(),this.attemptPromise&&this.abortReason&&(this.restartAfterCurrentAttempt=true),this.ensureAttempt()}stop(){this.shouldRun=false,this.restartAfterCurrentAttempt=false,this.clearReconnectTimer(),this.clearStaleTimer(),this.abort("manual"),this.setState("idle");}close(){this.closed=true,this.shouldRun=false,this.restartAfterCurrentAttempt=false,this.clearReconnectTimer(),this.clearStaleTimer(),this.abort("manual"),this.setState("closed");}reconnect(){if(!(this.closed||this.isHealthy()||this.state==="connecting")){if(this.shouldRun=true,this.clearReconnectTimer(),this.clearStaleTimer(),this.abortController){this.restartAfterCurrentAttempt=true,this.abort("restart");return}this.ensureAttempt();}}ensureAttempt(){if(!this.shouldRun||this.closed)return Promise.resolve();if(!this.attemptPromise){let n=this.runAttempt().finally(()=>{this.attemptPromise===n&&(this.attemptPromise=void 0),this.restartAfterCurrentAttempt&&this.shouldRun&&!this.closed&&(this.restartAfterCurrentAttempt=false,this.ensureAttempt());});this.attemptPromise=n;}return this.attemptPromise}async runAttempt(){if(!this.shouldRun||this.closed)return;let n=this.lastConnectedAt!==null||this.reconnectAttempt>0;this.setState("connecting"),this.lastError=void 0,this.abortReason=void 0;let t=new AbortController;this.abortController=t;try{let i=this.forceRefreshNext?await x(this.options.getToken):await this.options.getToken(void 0);if(this.forceRefreshNext=!1,await this.options.dial({isReconnect:n,markActivity:()=>this.markActivity(),markConnected:()=>this.markConnected(),requestTokenRefresh:()=>{this.forceRefreshNext=!0;},signal:t.signal,token:i}),!this.shouldRun||this.closed)return;this.scheduleReconnect("end");}catch(i){if(Ge(i)){this.abortReason==="stale"&&this.shouldRun&&!this.closed&&this.scheduleReconnect("end");return}if(!this.shouldRun||this.closed)return;this.handleFailure(i);}finally{this.abortController===t&&(this.abortController=void 0),this.abortReason=void 0;}}handleFailure(n){if(this.lastError=n,n instanceof d||this.options.isFatalError?.(n)){this.shouldRun=false,this.clearReconnectTimer(),this.clearStaleTimer(),this.setState("failed"),this.options.onFatalError?.(n);return}if(this.options.isAuthError?.(n)??false){if(this.consecutiveAuthFailures+=1,this.forceRefreshNext=true,this.setState("reconnecting"),this.consecutiveAuthFailures>=(this.options.maxConsecutiveAuthFailures??Be)){this.shouldRun=false,this.clearReconnectTimer(),this.clearStaleTimer(),this.setState("failed"),this.options.onFatalError?.(n);return}this.scheduleReconnect("auth");return}this.consecutiveAuthFailures=0,typeof navigator<"u"&&"onLine"in navigator&&navigator.onLine===false?this.setState("offline"):this.setState("reconnecting"),this.scheduleReconnect("failure");}scheduleReconnect(n){if(!this.shouldRun||this.closed)return;this.clearReconnectTimer(),this.clearStaleTimer();let t=n==="auth"?this.options.authRetryDelayMs??qe:n==="failure"?this.nextReconnectDelay():this.options.baseReconnectDelayMs??Z;this.reconnectTimer=setTimeout(()=>{this.reconnectTimer=void 0,this.ensureAttempt();},t);}nextReconnectDelay(){let n=this.options.baseReconnectDelayMs??Z,t=this.options.maxReconnectDelayMs??je,i=Math.min(n*Math.pow(2,this.reconnectAttempt),t);return this.reconnectAttempt+=1,this.options.jitter==="full"?He(i):i}isHealthy(){if(this.state!=="connected"||!this.abortController)return false;let n=this.options.staleTimeoutMs;return !n||n<=0?true:this.lastActivityAt!==null&&Q()-this.lastActivityAt<n}markConnected(){this.consecutiveAuthFailures=0,this.reconnectAttempt=0,this.lastConnectedAt=Q(),this.setState("connected"),this.markActivity();}markActivity(){this.lastActivityAt=Q(),this.armStaleTimer();}armStaleTimer(){this.clearStaleTimer();let n=this.options.staleTimeoutMs;!n||n<=0||this.state!=="connected"||(this.staleTimer=setTimeout(()=>{!this.shouldRun||this.closed||!this.abortController||(this.setState("stale"),this.abort("stale"));},n));}clearReconnectTimer(){this.reconnectTimer&&(clearTimeout(this.reconnectTimer),this.reconnectTimer=void 0);}clearStaleTimer(){this.staleTimer&&(clearTimeout(this.staleTimer),this.staleTimer=void 0);}abort(n){this.abortController&&(this.abortReason=n,this.abortController.abort(),this.abortController=void 0);}setState(n){this.state!==n&&(this.state=n,this.options.onStateChange?.(this.snapshot));}};var Ye=(c=>(c.HitLimits="HIT_LIMITS",c.MissingFeature="MISSING_FEATURE",c.NotUsing="NOT_USING",c.Other="OTHER",c.Quality="QUALITY",c.Switching="SWITCHING",c.TooExpensive="TOO_EXPENSIVE",c))(Ye||{}),We=(o=>(o.Enterprise="enterprise",o.Free="free",o.Max="max",o.Plus="plus",o.Pro="pro",o))(We||{}),ze=(a=>(a.Daily="DAILY",a.Monthly="MONTHLY",a.Weekly="WEEKLY",a.Yearly="YEARLY",a))(ze||{}),Xe=(t=>(t.Revcat="REVCAT",t.Stripe="STRIPE",t))(Xe||{});var K={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"query",name:{kind:"Name",value:"Plans"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"plans"},selectionSet:{kind:"SelectionSet",selections:[{kind:"FragmentSpread",name:{kind:"Name",value:"PlanFragment"}}]}}]}},{kind:"FragmentDefinition",name:{kind:"Name",value:"PlanFragment"},typeCondition:{kind:"NamedType",name:{kind:"Name",value:"Plan"}},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"id"}},{kind:"Field",name:{kind:"Name",value:"name"}},{kind:"Field",name:{kind:"Name",value:"tier"}},{kind:"Field",name:{kind:"Name",value:"prices"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"id"}},{kind:"Field",name:{kind:"Name",value:"currency"}},{kind:"Field",name:{kind:"Name",value:"amount"}},{kind:"Field",name:{kind:"Name",value:"interval"}},{kind:"Field",name:{kind:"Name",value:"campaign"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"name"}},{kind:"Field",name:{kind:"Name",value:"originalAmount"}},{kind:"Field",name:{kind:"Name",value:"discountedAmount"}},{kind:"Field",name:{kind:"Name",value:"percentOff"}},{kind:"Field",name:{kind:"Name",value:"expiresAt"}}]}}]}},{kind:"Field",name:{kind:"Name",value:"entitlements"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"canAddUser"}},{kind:"Field",name:{kind:"Name",value:"minUsers"}},{kind:"Field",name:{kind:"Name",value:"team"}},{kind:"Field",name:{kind:"Name",value:"capacity"}},{kind:"Field",name:{kind:"Name",value:"sourceTypes"}},{kind:"Field",name:{kind:"Name",value:"softTokenUsageLimit"}},{kind:"Field",name:{kind:"Name",value:"hardTokenUsageLimit"}},{kind:"Field",name:{kind:"Name",value:"canAddReport"}},{kind:"Field",name:{kind:"Name",value:"canUseApi"}},{kind:"Field",name:{kind:"Name",value:"maxStructuredSize"}},{kind:"Field",name:{kind:"Name",value:"maxUnstructuredSize"}}]}},{kind:"Field",name:{kind:"Name",value:"features"}}]}}]},ee={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"query",name:{kind:"Name",value:"Plan"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"id"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"String"}}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"plan"},arguments:[{kind:"Argument",name:{kind:"Name",value:"id"},value:{kind:"Variable",name:{kind:"Name",value:"id"}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"FragmentSpread",name:{kind:"Name",value:"PlanFragment"}}]}}]}},{kind:"FragmentDefinition",name:{kind:"Name",value:"PlanFragment"},typeCondition:{kind:"NamedType",name:{kind:"Name",value:"Plan"}},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"id"}},{kind:"Field",name:{kind:"Name",value:"name"}},{kind:"Field",name:{kind:"Name",value:"tier"}},{kind:"Field",name:{kind:"Name",value:"prices"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"id"}},{kind:"Field",name:{kind:"Name",value:"currency"}},{kind:"Field",name:{kind:"Name",value:"amount"}},{kind:"Field",name:{kind:"Name",value:"interval"}},{kind:"Field",name:{kind:"Name",value:"campaign"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"name"}},{kind:"Field",name:{kind:"Name",value:"originalAmount"}},{kind:"Field",name:{kind:"Name",value:"discountedAmount"}},{kind:"Field",name:{kind:"Name",value:"percentOff"}},{kind:"Field",name:{kind:"Name",value:"expiresAt"}}]}}]}},{kind:"Field",name:{kind:"Name",value:"entitlements"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"canAddUser"}},{kind:"Field",name:{kind:"Name",value:"minUsers"}},{kind:"Field",name:{kind:"Name",value:"team"}},{kind:"Field",name:{kind:"Name",value:"capacity"}},{kind:"Field",name:{kind:"Name",value:"sourceTypes"}},{kind:"Field",name:{kind:"Name",value:"softTokenUsageLimit"}},{kind:"Field",name:{kind:"Name",value:"hardTokenUsageLimit"}},{kind:"Field",name:{kind:"Name",value:"canAddReport"}},{kind:"Field",name:{kind:"Name",value:"canUseApi"}},{kind:"Field",name:{kind:"Name",value:"maxStructuredSize"}},{kind:"Field",name:{kind:"Name",value:"maxUnstructuredSize"}}]}},{kind:"Field",name:{kind:"Name",value:"features"}}]}}]},ne={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"query",name:{kind:"Name",value:"TierOrders"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"tierOrders"}}]}}]},te={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"query",name:{kind:"Name",value:"Entitlements"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"entitlements"}}]}}]},ie={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"query",name:{kind:"Name",value:"Subscription"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"subscription"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"tier"}},{kind:"Field",name:{kind:"Name",value:"provider"}},{kind:"Field",name:{kind:"Name",value:"cycle"}},{kind:"Field",name:{kind:"Name",value:"seats"}},{kind:"Field",name:{kind:"Name",value:"cancelAtPeriodEnd"}},{kind:"Field",name:{kind:"Name",value:"currentPeriodStart"}},{kind:"Field",name:{kind:"Name",value:"currentPeriodEnd"}},{kind:"Field",name:{kind:"Name",value:"pausedUntil"}},{kind:"Field",name:{kind:"Name",value:"scheduledChange"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"effectiveDate"}},{kind:"Field",name:{kind:"Name",value:"newTier"}},{kind:"Field",name:{kind:"Name",value:"newSeats"}},{kind:"Field",name:{kind:"Name",value:"newCycle"}}]}}]}}]}}]},ae={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"query",name:{kind:"Name",value:"SubscriptionForManager"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"workspaceId"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"String"}}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"subscriptionForManager"},arguments:[{kind:"Argument",name:{kind:"Name",value:"workspaceId"},value:{kind:"Variable",name:{kind:"Name",value:"workspaceId"}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"tier"}},{kind:"Field",name:{kind:"Name",value:"provider"}},{kind:"Field",name:{kind:"Name",value:"cycle"}},{kind:"Field",name:{kind:"Name",value:"seats"}},{kind:"Field",name:{kind:"Name",value:"cancelAtPeriodEnd"}},{kind:"Field",name:{kind:"Name",value:"currentPeriodStart"}},{kind:"Field",name:{kind:"Name",value:"currentPeriodEnd"}},{kind:"Field",name:{kind:"Name",value:"scheduledChange"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"effectiveDate"}},{kind:"Field",name:{kind:"Name",value:"newTier"}},{kind:"Field",name:{kind:"Name",value:"newSeats"}},{kind:"Field",name:{kind:"Name",value:"newCycle"}}]}}]}}]}}]},re={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"query",name:{kind:"Name",value:"SubscriptionEntitlements"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"subscriptionEntitlements"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"canAddUser"}},{kind:"Field",name:{kind:"Name",value:"minUsers"}},{kind:"Field",name:{kind:"Name",value:"team"}},{kind:"Field",name:{kind:"Name",value:"capacity"}},{kind:"Field",name:{kind:"Name",value:"sourceTypes"}},{kind:"Field",name:{kind:"Name",value:"softTokenUsageLimit"}},{kind:"Field",name:{kind:"Name",value:"hardTokenUsageLimit"}},{kind:"Field",name:{kind:"Name",value:"canAddReport"}},{kind:"Field",name:{kind:"Name",value:"canUseApi"}},{kind:"Field",name:{kind:"Name",value:"maxStructuredSize"}},{kind:"Field",name:{kind:"Name",value:"maxUnstructuredSize"}}]}}]}}]},oe={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"query",name:{kind:"Name",value:"SubscriptionEntitlementsForManager"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"workspaceId"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"String"}}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"subscriptionEntitlementsForManager"},arguments:[{kind:"Argument",name:{kind:"Name",value:"workspaceId"},value:{kind:"Variable",name:{kind:"Name",value:"workspaceId"}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"canAddUser"}},{kind:"Field",name:{kind:"Name",value:"minUsers"}},{kind:"Field",name:{kind:"Name",value:"team"}},{kind:"Field",name:{kind:"Name",value:"capacity"}},{kind:"Field",name:{kind:"Name",value:"sourceTypes"}},{kind:"Field",name:{kind:"Name",value:"softTokenUsageLimit"}},{kind:"Field",name:{kind:"Name",value:"hardTokenUsageLimit"}},{kind:"Field",name:{kind:"Name",value:"canAddReport"}},{kind:"Field",name:{kind:"Name",value:"canUseApi"}},{kind:"Field",name:{kind:"Name",value:"maxStructuredSize"}},{kind:"Field",name:{kind:"Name",value:"maxUnstructuredSize"}}]}}]}}]},se={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"query",name:{kind:"Name",value:"ProrationAmount"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"targetPriceId"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"String"}}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"prorationAmount"},arguments:[{kind:"Argument",name:{kind:"Name",value:"targetPriceId"},value:{kind:"Variable",name:{kind:"Name",value:"targetPriceId"}}}]}]}}]},le={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"mutation",name:{kind:"Name",value:"UpgradePlan"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"targetPriceId"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"String"}}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"upgradePlan"},arguments:[{kind:"Argument",name:{kind:"Name",value:"targetPriceId"},value:{kind:"Variable",name:{kind:"Name",value:"targetPriceId"}}}]}]}}]},ue={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"mutation",name:{kind:"Name",value:"DowngradePlan"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"targetPriceId"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"String"}}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"downgradePlan"},arguments:[{kind:"Argument",name:{kind:"Name",value:"targetPriceId"},value:{kind:"Variable",name:{kind:"Name",value:"targetPriceId"}}}]}]}}]},ce={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"mutation",name:{kind:"Name",value:"AddSeats"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"additionalSeats"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"Int"}}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"addSeats"},arguments:[{kind:"Argument",name:{kind:"Name",value:"additionalSeats"},value:{kind:"Variable",name:{kind:"Name",value:"additionalSeats"}}}]}]}}]},de={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"mutation",name:{kind:"Name",value:"ChangeBillingCycle"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"targetPriceId"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"String"}}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"changeBillingCycle"},arguments:[{kind:"Argument",name:{kind:"Name",value:"targetPriceId"},value:{kind:"Variable",name:{kind:"Name",value:"targetPriceId"}}}]}]}}]},me={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"mutation",name:{kind:"Name",value:"RemoveSeats"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"seatsToRemove"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"Int"}}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"removeSeats"},arguments:[{kind:"Argument",name:{kind:"Name",value:"seatsToRemove"},value:{kind:"Variable",name:{kind:"Name",value:"seatsToRemove"}}}]}]}}]},pe={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"mutation",name:{kind:"Name",value:"CancelSubscription"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"reason"}},type:{kind:"NamedType",name:{kind:"Name",value:"CancelReason"}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"comment"}},type:{kind:"NamedType",name:{kind:"Name",value:"String"}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"cancelSubscription"},arguments:[{kind:"Argument",name:{kind:"Name",value:"reason"},value:{kind:"Variable",name:{kind:"Name",value:"reason"}}},{kind:"Argument",name:{kind:"Name",value:"comment"},value:{kind:"Variable",name:{kind:"Name",value:"comment"}}}]}]}}]},ke={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"query",name:{kind:"Name",value:"RetentionOffers"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"retentionOffers"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"pauseDays"}},{kind:"Field",name:{kind:"Name",value:"discountPercent"}},{kind:"Field",name:{kind:"Name",value:"discountMonths"}}]}}]}}]},Se={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"mutation",name:{kind:"Name",value:"PauseSubscription"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"pauseSubscription"}}]}}]},ye={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"mutation",name:{kind:"Name",value:"ApplyRetentionDiscount"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"applyRetentionDiscount"}}]}}]},fe={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"mutation",name:{kind:"Name",value:"ReactivateSubscription"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"reactivateSubscription"}}]}}]},ve={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"mutation",name:{kind:"Name",value:"CancelSubscriptionForManager"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"workspaceId"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"String"}}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"cancelSubscriptionForManager"},arguments:[{kind:"Argument",name:{kind:"Name",value:"workspaceId"},value:{kind:"Variable",name:{kind:"Name",value:"workspaceId"}}}]}]}}]},be={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"mutation",name:{kind:"Name",value:"ReactivateSubscriptionForManager"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"workspaceId"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"String"}}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"reactivateSubscriptionForManager"},arguments:[{kind:"Argument",name:{kind:"Name",value:"workspaceId"},value:{kind:"Variable",name:{kind:"Name",value:"workspaceId"}}}]}]}}]},he={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"mutation",name:{kind:"Name",value:"CreateCustomer"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"name"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"String"}}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"email"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"String"}}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"workspaceId"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"String"}}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"userId"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"String"}}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"createCustomer"},arguments:[{kind:"Argument",name:{kind:"Name",value:"name"},value:{kind:"Variable",name:{kind:"Name",value:"name"}}},{kind:"Argument",name:{kind:"Name",value:"email"},value:{kind:"Variable",name:{kind:"Name",value:"email"}}},{kind:"Argument",name:{kind:"Name",value:"workspaceId"},value:{kind:"Variable",name:{kind:"Name",value:"workspaceId"}}},{kind:"Argument",name:{kind:"Name",value:"userId"},value:{kind:"Variable",name:{kind:"Name",value:"userId"}}}]}]}}]},ge={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"mutation",name:{kind:"Name",value:"ReleaseSchedule"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"releaseSchedule"}}]}}]},Ne={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"mutation",name:{kind:"Name",value:"CreateCheckoutSession"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"priceId"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"String"}}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"successUrl"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"String"}}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"cancelUrl"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"String"}}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"createCheckoutSession"},arguments:[{kind:"Argument",name:{kind:"Name",value:"priceId"},value:{kind:"Variable",name:{kind:"Name",value:"priceId"}}},{kind:"Argument",name:{kind:"Name",value:"successUrl"},value:{kind:"Variable",name:{kind:"Name",value:"successUrl"}}},{kind:"Argument",name:{kind:"Name",value:"cancelUrl"},value:{kind:"Variable",name:{kind:"Name",value:"cancelUrl"}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"url"}}]}}]}}]},Te={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"mutation",name:{kind:"Name",value:"CreateCustomerPortalSession"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"returnUrl"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"String"}}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"createCustomerPortalSession"},arguments:[{kind:"Argument",name:{kind:"Name",value:"returnUrl"},value:{kind:"Variable",name:{kind:"Name",value:"returnUrl"}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"url"}}]}}]}}]},De={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"query",name:{kind:"Name",value:"CheckoutTrial"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"checkoutTrial"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"tier"}},{kind:"Field",name:{kind:"Name",value:"days"}}]}}]}}]};function Ee(e,n){throw new Error(n)}var B={Name:[],Document:["definitions"],OperationDefinition:["name","variableDefinitions","directives","selectionSet"],VariableDefinition:["variable","type","defaultValue","directives"],Variable:["name"],SelectionSet:["selections"],Field:["alias","name","arguments","directives","selectionSet"],Argument:["name","value"],FragmentSpread:["name","directives"],InlineFragment:["typeCondition","directives","selectionSet"],FragmentDefinition:["name","variableDefinitions","typeCondition","directives","selectionSet"],IntValue:[],FloatValue:[],StringValue:[],BooleanValue:[],NullValue:[],EnumValue:[],ListValue:["values"],ObjectValue:["fields"],ObjectField:["name","value"],Directive:["name","arguments"],NamedType:["name"],ListType:["type"],NonNullType:["type"],SchemaDefinition:["description","directives","operationTypes"],OperationTypeDefinition:["type"],ScalarTypeDefinition:["description","name","directives"],ObjectTypeDefinition:["description","name","interfaces","directives","fields"],FieldDefinition:["description","name","arguments","type","directives"],InputValueDefinition:["description","name","type","defaultValue","directives"],InterfaceTypeDefinition:["description","name","interfaces","directives","fields"],UnionTypeDefinition:["description","name","directives","types"],EnumTypeDefinition:["description","name","directives","values"],EnumValueDefinition:["description","name","directives"],InputObjectTypeDefinition:["description","name","directives","fields"],DirectiveDefinition:["description","name","arguments","locations"],SchemaExtension:["directives","operationTypes"],ScalarTypeExtension:["name","directives"],ObjectTypeExtension:["name","interfaces","directives","fields"],InterfaceTypeExtension:["name","interfaces","directives","fields"],UnionTypeExtension:["name","directives","types"],EnumTypeExtension:["name","directives","values"],InputObjectTypeExtension:["name","directives","fields"]},Je=new Set(Object.keys(B));function j(e){let n=e?.kind;return typeof n=="string"&&Je.has(n)}var q;(function(e){e.QUERY="query",e.MUTATION="mutation",e.SUBSCRIPTION="subscription";})(q||(q={}));var g;(function(e){e.NAME="Name",e.DOCUMENT="Document",e.OPERATION_DEFINITION="OperationDefinition",e.VARIABLE_DEFINITION="VariableDefinition",e.SELECTION_SET="SelectionSet",e.FIELD="Field",e.ARGUMENT="Argument",e.FRAGMENT_SPREAD="FragmentSpread",e.INLINE_FRAGMENT="InlineFragment",e.FRAGMENT_DEFINITION="FragmentDefinition",e.VARIABLE="Variable",e.INT="IntValue",e.FLOAT="FloatValue",e.STRING="StringValue",e.BOOLEAN="BooleanValue",e.NULL="NullValue",e.ENUM="EnumValue",e.LIST="ListValue",e.OBJECT="ObjectValue",e.OBJECT_FIELD="ObjectField",e.DIRECTIVE="Directive",e.NAMED_TYPE="NamedType",e.LIST_TYPE="ListType",e.NON_NULL_TYPE="NonNullType",e.SCHEMA_DEFINITION="SchemaDefinition",e.OPERATION_TYPE_DEFINITION="OperationTypeDefinition",e.SCALAR_TYPE_DEFINITION="ScalarTypeDefinition",e.OBJECT_TYPE_DEFINITION="ObjectTypeDefinition",e.FIELD_DEFINITION="FieldDefinition",e.INPUT_VALUE_DEFINITION="InputValueDefinition",e.INTERFACE_TYPE_DEFINITION="InterfaceTypeDefinition",e.UNION_TYPE_DEFINITION="UnionTypeDefinition",e.ENUM_TYPE_DEFINITION="EnumTypeDefinition",e.ENUM_VALUE_DEFINITION="EnumValueDefinition",e.INPUT_OBJECT_TYPE_DEFINITION="InputObjectTypeDefinition",e.DIRECTIVE_DEFINITION="DirectiveDefinition",e.SCHEMA_EXTENSION="SchemaExtension",e.SCALAR_TYPE_EXTENSION="ScalarTypeExtension",e.OBJECT_TYPE_EXTENSION="ObjectTypeExtension",e.INTERFACE_TYPE_EXTENSION="InterfaceTypeExtension",e.UNION_TYPE_EXTENSION="UnionTypeExtension",e.ENUM_TYPE_EXTENSION="EnumTypeExtension",e.INPUT_OBJECT_TYPE_EXTENSION="InputObjectTypeExtension";})(g||(g={}));function H(e){return e===9||e===32}function Ae(e,n){let t=e.replace(/"""/g,'\\"""'),i=t.split(/\r\n|[\n\r]/g),a=i.length===1,o=i.length>1&&i.slice(1).every(T=>T.length===0||H(T.charCodeAt(0))),s=t.endsWith('\\"""'),c=e.endsWith('"')&&!s,m=e.endsWith("\\"),l=c||m,d=(!a||e.length>70||l||o||s),p="",k=a&&H(e.charCodeAt(0));return (d&&!k||o)&&(p+=`
|
|
2
2
|
`),p+=t,(d||l)&&(p+=`
|
|
3
3
|
`),'"""'+p+'"""'}function Fe(e){return C(e,[])}function C(e,n){switch(typeof e){case "string":return JSON.stringify(e);case "function":return e.name?`[function ${e.name}]`:"[function]";case "object":return $e(e,n);default:return String(e)}}function $e(e,n){if(e===null)return "null";if(n.includes(e))return "[Circular]";let t=[...n,e];if(Ze(e)){let i=e.toJSON();if(i!==e)return typeof i=="string"?i:C(i,t)}else if(Array.isArray(e))return en(e,t);return Ke(e,t)}function Ze(e){return typeof e.toJSON=="function"}function Ke(e,n){let t=Object.entries(e);return t.length===0?"{}":n.length>2?"["+nn(e)+"]":"{ "+t.map(([a,o])=>a+": "+C(o,n)).join(", ")+" }"}function en(e,n){if(e.length===0)return "[]";if(n.length>2)return "[Array]";let t=Math.min(10,e.length),i=e.length-t,a=[];for(let o=0;o<t;++o)a.push(C(e[o],n));return i===1?a.push("... 1 more item"):i>1&&a.push(`... ${i} more items`),"["+a.join(", ")+"]"}function nn(e){let n=Object.prototype.toString.call(e).replace(/^\[object /,"").replace(/]$/,"");if(n==="Object"&&typeof e.constructor=="function"){let t=e.constructor.name;if(typeof t=="string"&&t!=="")return t}return n}function xe(e){return `"${e.replace(tn,an)}"`}var tn=/[\x00-\x1f\x22\x5c\x7f-\x9f]/g;function an(e){return rn[e.charCodeAt(0)]}var rn=["\\u0000","\\u0001","\\u0002","\\u0003","\\u0004","\\u0005","\\u0006","\\u0007","\\b","\\t","\\n","\\u000B","\\f","\\r","\\u000E","\\u000F","\\u0010","\\u0011","\\u0012","\\u0013","\\u0014","\\u0015","\\u0016","\\u0017","\\u0018","\\u0019","\\u001A","\\u001B","\\u001C","\\u001D","\\u001E","\\u001F","","",'\\"',"","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","\\\\","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","\\u007F","\\u0080","\\u0081","\\u0082","\\u0083","\\u0084","\\u0085","\\u0086","\\u0087","\\u0088","\\u0089","\\u008A","\\u008B","\\u008C","\\u008D","\\u008E","\\u008F","\\u0090","\\u0091","\\u0092","\\u0093","\\u0094","\\u0095","\\u0096","\\u0097","\\u0098","\\u0099","\\u009A","\\u009B","\\u009C","\\u009D","\\u009E","\\u009F"];var G=Object.freeze({});function I(e,n,t=B){let i=new Map;for(let f of Object.values(g))i.set(f,Y(n,f));let a,o=Array.isArray(e),s=[e],c=-1,m=[],l=e,d,p,k=[],T=[];do{c++;let f=c===s.length,z=f&&m.length!==0;if(f){if(d=T.length===0?void 0:k[k.length-1],l=p,p=T.pop(),z)if(o){l=l.slice();let b=0;for(let[L,X]of m){let J=L-b;X===null?(l.splice(J,1),b++):l[J]=X;}}else {l=Object.defineProperties({},Object.getOwnPropertyDescriptors(l));for(let[b,L]of m)l[b]=L;}c=a.index,s=a.keys,m=a.edits,o=a.inArray,a=a.prev;}else if(p){if(d=o?c:s[c],l=p[d],l==null)continue;k.push(d);}let v;if(!Array.isArray(l)){var w,P;j(l)||Ee(false,`Invalid AST Node: ${Fe(l)}.`);let b=f?(w=i.get(l.kind))===null||w===void 0?void 0:w.leave:(P=i.get(l.kind))===null||P===void 0?void 0:P.enter;if(v=b?.call(n,l,d,p,k,T),v===G)break;if(v===false){if(!f){k.pop();continue}}else if(v!==void 0&&(m.push([d,v]),!f))if(j(v))l=v;else {k.pop();continue}}if(v===void 0&&z&&m.push([d,l]),f)k.pop();else {var U;a={inArray:o,index:c,keys:s,edits:m,prev:a},o=Array.isArray(l),s=o?l:(U=t[l.kind])!==null&&U!==void 0?U:[],c=-1,m=[],p&&T.push(p),p=l;}}while(a!==void 0);return m.length!==0?m[m.length-1][1]:e}function Y(e,n){let t=e[n];return typeof t=="object"?t:typeof t=="function"?{enter:t,leave:void 0}:{enter:e.enter,leave:e.leave}}function O(e){return I(e,sn)}var on=80,sn={Name:{leave:e=>e.value},Variable:{leave:e=>"$"+e.name},Document:{leave:e=>r(e.definitions,`
|
|
4
4
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var o=class extends Error{cause;operation;watched;constructor(n,r){super(n),this.name="DvinaError",this.cause=r;}},s=class extends o{errors;query;variables;constructor(n,r,t){let E=n.map(a=>a.message).join("; ")||"Unknown GraphQL error";super(E),this.name="DvinaGraphQLError",this.errors=n,this.query=r,this.variables=t;}},p=class extends o{status;constructor(n,r,t){super(n,t),this.name="DvinaNetworkError",this.status=r;}},l=class extends o{failedToken;constructor(n="Authentication failed",r,t){super(n,typeof r=="string"?t:r),this.name="DvinaAuthenticationError",this.failedToken=typeof r=="string"?r:void 0;}},_=class extends o{status=403;constructor(n="Forbidden",r){super(n,r),this.name="DvinaForbiddenError";}},y={failed:"not written",stalled:"not yet written","given-up":"never written: the store is read again"},g=class extends o{constructor(r,t,E,a){super(`Sync change ${y[r]} (${t.join(", ")})`,a);this.stage=r;this.tables=t;this.visibility=E;this.name="DvinaSyncApplyError";}},i={SESSION_TOKEN_LIMIT_REACHED:"SESSION_TOKEN_LIMIT_REACHED",STORAGE_LIMIT_REACHED:"STORAGE_LIMIT_REACHED",DEEP_ANALYSIS_LIMIT_EXCEEDED:"DEEP_ANALYSIS_LIMIT_EXCEEDED",PLAN_DETAIL_RESTRICTION:"PLAN_DETAIL_RESTRICTION",RESOURCE_NOT_FOUND:"RESOURCE_NOT_FOUND"},I=new Set([i.PLAN_DETAIL_RESTRICTION,i.STORAGE_LIMIT_REACHED,i.DEEP_ANALYSIS_LIMIT_EXCEEDED]),c=class extends s{restrictionCode;constructor(n,r,t,E){super(n,t,E),this.name="DvinaPlanRestrictionError",this.restrictionCode=r;}},u=class extends s{constructor(n,r,t){super(n,r,t),this.name="DvinaTokenLimitError";}},d=class extends s{constructor(n,r,t){super(n,r,t),this.name="DvinaNotFoundError";}};function R(e){for(let n of e){let r=n.extensions?.code;if(r!=null)return String(r).toUpperCase()}}function h(e,n,r){let t=R(e);return t===i.SESSION_TOKEN_LIMIT_REACHED?new u(e,n,r):t===i.RESOURCE_NOT_FOUND?new d(e,n,r):t&&I.has(t)?new c(e,t,n,r):new s(e,n,r)}export{o as a,s as b,p as c,l as d,_ as e,g as f,i as g,c as h,u as i,d as j,R as k,h as l};
|
|
@@ -2,7 +2,7 @@ import { D as DvinaQueryRef, M as MutationOptions, b as DvinaRequest, P as PageI
|
|
|
2
2
|
import { DocumentNode } from 'graphql';
|
|
3
3
|
import * as dexie from 'dexie';
|
|
4
4
|
import { Dexie, Table } from 'dexie';
|
|
5
|
-
import { D as DvinaError, a as DvinaAuthenticationError, b as DvinaForbiddenError, c as DvinaNetworkError } from './error-
|
|
5
|
+
import { D as DvinaError, a as DvinaAuthenticationError, b as DvinaForbiddenError, c as DvinaNetworkError, d as DvinaSyncApplyError } from './error-CuX-RKTE.js';
|
|
6
6
|
|
|
7
7
|
/** Cached result metadata for a specific query + variables combination */
|
|
8
8
|
interface QueryResultEntry {
|
|
@@ -122,7 +122,10 @@ declare class DvinaDatabase {
|
|
|
122
122
|
/** Access all tables */
|
|
123
123
|
get allTables(): Table[];
|
|
124
124
|
/** Run a read-write transaction across specified tables */
|
|
125
|
-
|
|
125
|
+
/** Dexie's transaction; `scope` gets it, so it can abort it (IndexedDB `IDBTransaction.abort()`). */
|
|
126
|
+
transaction<U>(mode: 'rw' | 'r', tables: Table[], scope: (transaction: {
|
|
127
|
+
abort(): void;
|
|
128
|
+
}) => PromiseLike<U> | U): dexie.PromiseExtended<U>;
|
|
126
129
|
/** Counts the deletes applied here (optimistic or the sync's); a read notes it as it starts (readMark). */
|
|
127
130
|
private _deleteClock;
|
|
128
131
|
/** The latest deletes applied here, by `table:key`, at their clock; the oldest go past DELETES_KEPT. */
|
|
@@ -348,7 +351,7 @@ interface SseTransportOptions {
|
|
|
348
351
|
* Called when auth recovery fails permanently, when the API refuses the stream (403), and when the token is
|
|
349
352
|
* another cell's (421 WRONG_CELL: a DvinaNetworkError with status 421; the stream keeps retrying meanwhile).
|
|
350
353
|
*/
|
|
351
|
-
onError?: (error: DvinaAuthenticationError | DvinaForbiddenError | DvinaNetworkError) => void;
|
|
354
|
+
onError?: (error: DvinaAuthenticationError | DvinaForbiddenError | DvinaNetworkError | DvinaSyncApplyError) => void;
|
|
352
355
|
}
|
|
353
356
|
interface SseTransport {
|
|
354
357
|
/** Start the SSE connection */
|
|
@@ -525,6 +528,12 @@ declare class SyncEngine {
|
|
|
525
528
|
* watched in many places registers once, so a client does not run into the server's per-user limit.
|
|
526
529
|
*/
|
|
527
530
|
private _serverSubscriptions;
|
|
531
|
+
/**
|
|
532
|
+
* The device's cursor each server subscription was registered with while its query kept none (its first read had
|
|
533
|
+
* not landed, or found nothing to keep): the server catches it up from there, so a record made while the read and
|
|
534
|
+
* the registration crossed still reaches it. The query's own cursor takes over once its read keeps one.
|
|
535
|
+
*/
|
|
536
|
+
private _registeredCursors;
|
|
528
537
|
/** Last per-query revalidation timestamp to avoid refetch storms. */
|
|
529
538
|
private _lastRevalidatedAt;
|
|
530
539
|
/** Retry timers for recovery refetches that failed and need another attempt. */
|
|
@@ -600,7 +609,12 @@ declare class SyncEngine {
|
|
|
600
609
|
* it has committed. A read awaited inside it (a fetch, not the store's) let it commit while it waited, and the
|
|
601
610
|
* batch's next write failed (prod 2026-11-13: TransactionInactiveError on Document / FeedItem changes).
|
|
602
611
|
*/
|
|
603
|
-
processSyncEvents(events: SseSyncEvent[]): Promise<void>;
|
|
612
|
+
processSyncEvents(events: SseSyncEvent[], signal?: AbortSignal): Promise<void>;
|
|
613
|
+
/**
|
|
614
|
+
* Reads a watched list again from the server: a list change (query event) the store did not take, which the stream
|
|
615
|
+
* does not send again. Its revalidation tries again on failure (revalidation-retry).
|
|
616
|
+
*/
|
|
617
|
+
readSubscriptionAgain(subscriptionId: string): Promise<void>;
|
|
604
618
|
/** Writes the change and the cursor to the store; returns the watched lists to read again once it is written. */
|
|
605
619
|
private _processSyncEvent;
|
|
606
620
|
/**
|
|
@@ -51,18 +51,13 @@ declare class DvinaForbiddenError extends DvinaError {
|
|
|
51
51
|
readonly status = 403;
|
|
52
52
|
constructor(message?: string, cause?: Error);
|
|
53
53
|
}
|
|
54
|
-
/**
|
|
55
|
-
* A sync change the device could not write to its store: one that failed (`failed`), or one still not written after
|
|
56
|
-
* SYNC_APPLY_STALL_MS (`stalled`: its store write waits, on the device's database, for a transaction that does not end).
|
|
57
|
-
* Nothing the reader is told; the app logs it, with the tables and whether its page was hidden.
|
|
58
|
-
*/
|
|
59
54
|
declare class DvinaSyncApplyError extends DvinaError {
|
|
60
|
-
readonly stage: 'failed' | 'stalled';
|
|
55
|
+
readonly stage: 'failed' | 'stalled' | 'given-up';
|
|
61
56
|
/** The tables the change writes to (its models), never its contents. */
|
|
62
57
|
readonly tables: readonly string[];
|
|
63
58
|
/** The page's `document.visibilityState` when it was reported; none outside a browser. */
|
|
64
59
|
readonly visibility: string | undefined;
|
|
65
|
-
constructor(stage: 'failed' | 'stalled',
|
|
60
|
+
constructor(stage: 'failed' | 'stalled' | 'given-up',
|
|
66
61
|
/** The tables the change writes to (its models), never its contents. */
|
|
67
62
|
tables: readonly string[],
|
|
68
63
|
/** The page's `document.visibilityState` when it was reported; none outside a browser. */
|
|
@@ -126,4 +121,4 @@ interface GraphQLErrorEntry {
|
|
|
126
121
|
extensions?: Record<string, unknown>;
|
|
127
122
|
}
|
|
128
123
|
|
|
129
|
-
export { DvinaError as D, GRAPHQL_ERROR_CODES as G, DvinaAuthenticationError as a, DvinaForbiddenError as b, DvinaNetworkError as c,
|
|
124
|
+
export { DvinaError as D, GRAPHQL_ERROR_CODES as G, DvinaAuthenticationError as a, DvinaForbiddenError as b, DvinaNetworkError as c, DvinaSyncApplyError as d, DvinaGraphQLError as e, DvinaNotFoundError as f, type DvinaOperationKind as g, DvinaPlanRestrictionError as h, DvinaTokenLimitError as i, type GraphQLErrorEntry as j, createGraphQLError as k, extractErrorCode as l };
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What a file is to the person: the family its card, its icon and its place (Media or Files) come from.
|
|
3
|
+
* `model`, `cad` and `electronics` are the professional families the 3D, CAD and electronics viewers take over.
|
|
4
|
+
*/
|
|
5
|
+
type FileKind = 'document' | 'table' | 'code' | 'text' | 'image' | 'audio' | 'video' | 'archive' | 'model' | 'cad' | 'electronics' | 'file';
|
|
6
|
+
/**
|
|
7
|
+
* How the side panel opens a file: an artifact-renderer viewer (`@dvina/artifact-renderer`'s `ViewerFormat`), the
|
|
8
|
+
* app's media viewer (`image`, `audio`, `video`), or none (`none`: the file card with Download). A new viewer adds its
|
|
9
|
+
* id here and moves its formats' `viewer` to it.
|
|
10
|
+
*/
|
|
11
|
+
type FileViewer = 'pdf' | 'docx' | 'pptx' | 'xlsx' | 'xls' | 'csv' | 'tsv' | 'epub' | 'markdown' | 'html' | 'code' | 'text' | 'mermaid' | 'json' | 'jsonl' | 'yaml' | 'toml' | 'ini' | 'xml' | 'zip' | 'image' | 'audio' | 'video' | 'gerber' | 'kicad' | 'firmware' | 'dxf' | 'dwg' | 'ifc' | 'model3d' | 'none';
|
|
12
|
+
/**
|
|
13
|
+
* How a file's thumbnail is drawn: `auto` lets quicklook tell by the file's name and type, `text` draws it as the text
|
|
14
|
+
* it is (a type quicklook does not know is text), `icon` draws none and the card shows the format's poster.
|
|
15
|
+
*/
|
|
16
|
+
type FileThumbnail = 'auto' | 'text' | 'icon';
|
|
17
|
+
type FileFormat = {
|
|
18
|
+
/** The registry's own name for the format, stable: `kicad-schematic`. */
|
|
19
|
+
id: string;
|
|
20
|
+
/** What the format is, in English, as a card names it: "KiCad schematic". */
|
|
21
|
+
label: string;
|
|
22
|
+
kind: FileKind;
|
|
23
|
+
/** File extensions, lower case, without the dot; one may hold dots or underscores (`kicad_sch`). */
|
|
24
|
+
extensions: readonly string[];
|
|
25
|
+
/** Whole file names, lower case, for files known by name alone (`makefile`, `cmakelists.txt`). */
|
|
26
|
+
fileNames?: readonly string[];
|
|
27
|
+
/** MIME types a browser, a phone or a mail gives such a file. */
|
|
28
|
+
mimeTypes: readonly string[];
|
|
29
|
+
/**
|
|
30
|
+
* The `DocumentFormat` row the API keeps it under (its key): reading into search, plan checks and the Library's
|
|
31
|
+
* filters go by it. A format with no row of its own is kept as `txt` (read as text) or `unstructuredFile` (kept as
|
|
32
|
+
* it is, not read), so a new format needs no migration.
|
|
33
|
+
*/
|
|
34
|
+
storedAs: string;
|
|
35
|
+
viewer: FileViewer;
|
|
36
|
+
/** The Shiki language the `code` viewer highlights it in; one Shiki lacks is drawn plain until the viewer adds it. */
|
|
37
|
+
language?: string;
|
|
38
|
+
thumbnail: FileThumbnail;
|
|
39
|
+
};
|
|
40
|
+
/** The format a file of no listed type is: kept as it is, shown as its card with Download, never refused. */
|
|
41
|
+
declare const UNKNOWN_FILE_FORMAT: FileFormat;
|
|
42
|
+
/**
|
|
43
|
+
* Every file format Dvina knows: the one list the API stores and reads files by and the apps view, highlight, name
|
|
44
|
+
* and draw them by. A new format is one entry here; a file of no listed format is still taken (`UNKNOWN_FILE_FORMAT`).
|
|
45
|
+
*/
|
|
46
|
+
declare const FILE_FORMATS: readonly FileFormat[];
|
|
47
|
+
/** A file as the registry tells its format: by its name (or extension) first, then by its MIME type. */
|
|
48
|
+
type FileIdentity = {
|
|
49
|
+
/** The file's name (`board.kicad_pcb`, `Makefile`) or a path; only its last segment counts. */
|
|
50
|
+
name?: string | null;
|
|
51
|
+
/** Its extension, with or without the dot, any case. */
|
|
52
|
+
extension?: string | null;
|
|
53
|
+
mimeType?: string | null;
|
|
54
|
+
};
|
|
55
|
+
/**
|
|
56
|
+
* A file name's extension, lower case and without the dot (`Board.KICAD_PCB` → `kicad_pcb`); none for a name without
|
|
57
|
+
* one (`Makefile`) or a dot file's name alone (`.env`).
|
|
58
|
+
*/
|
|
59
|
+
declare function extensionOf(name: string | null | undefined): string | undefined;
|
|
60
|
+
/** The listed format of a file, or none (a type Dvina has no entry for, which it still takes: `fileFormatOrUnknown`). */
|
|
61
|
+
declare function fileFormatOf(file: FileIdentity): FileFormat | undefined;
|
|
62
|
+
/** The format of a file, a listed one or `UNKNOWN_FILE_FORMAT`: every file has one. */
|
|
63
|
+
declare function fileFormatOrUnknown(file: FileIdentity): FileFormat;
|
|
64
|
+
/** A format by its registry id. */
|
|
65
|
+
declare function fileFormatById(id: string): FileFormat | undefined;
|
|
66
|
+
/** The formats kept under one `DocumentFormat` row, in the registry's order. */
|
|
67
|
+
declare function fileFormatsStoredAs(storedAs: string): FileFormat[];
|
|
68
|
+
/** The `DocumentFormat` rows of one kind's formats. */
|
|
69
|
+
declare function storedAsOfKind(kind: FileKind): string[];
|
|
70
|
+
/** Whether a format is text a person reads line by line (code, configuration, netlists, firmware images). */
|
|
71
|
+
declare function isTextFormat(format: FileFormat): boolean;
|
|
72
|
+
|
|
73
|
+
export { FILE_FORMATS, type FileFormat, type FileIdentity, type FileKind, type FileThumbnail, type FileViewer, UNKNOWN_FILE_FORMAT, extensionOf, fileFormatById, fileFormatOf, fileFormatOrUnknown, fileFormatsStoredAs, isTextFormat, storedAsOfKind };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import'../chunk-EK7ODJWE.js';var v={id:"file",label:"File",kind:"file",extensions:[],mimeTypes:[],storedAs:"unstructuredFile",viewer:"none",thumbnail:"icon"};function t(e,i,s,o,d=[]){return {id:e,label:i,kind:"code",extensions:s,mimeTypes:d,storedAs:e,viewer:"code",language:o,thumbnail:"auto"}}function a(e){return {mimeTypes:[],viewer:"code",thumbnail:"text",...e}}var c=[{id:"pdf",label:"PDF",kind:"document",extensions:["pdf"],mimeTypes:["application/pdf"],storedAs:"pdf",viewer:"pdf",thumbnail:"auto"},{id:"doc",label:"Word document",kind:"document",extensions:["doc"],mimeTypes:["application/msword"],storedAs:"doc",viewer:"pdf",thumbnail:"auto"},{id:"docx",label:"Word document",kind:"document",extensions:["docx"],mimeTypes:["application/vnd.openxmlformats-officedocument.wordprocessingml.document"],storedAs:"doc",viewer:"docx",thumbnail:"auto"},{id:"odt",label:"OpenDocument text",kind:"document",extensions:["odt"],mimeTypes:["application/vnd.oasis.opendocument.text"],storedAs:"odt",viewer:"pdf",thumbnail:"auto"},{id:"rtf",label:"Rich text",kind:"document",extensions:["rtf"],mimeTypes:["application/rtf","text/rtf"],storedAs:"rtf",viewer:"pdf",thumbnail:"auto"},{id:"ppt",label:"Presentation",kind:"document",extensions:["ppt","odp"],mimeTypes:["application/vnd.ms-powerpoint","application/vnd.oasis.opendocument.presentation"],storedAs:"ppt",viewer:"pdf",thumbnail:"auto"},{id:"pptx",label:"Presentation",kind:"document",extensions:["pptx"],mimeTypes:["application/vnd.openxmlformats-officedocument.presentationml.presentation"],storedAs:"ppt",viewer:"pptx",thumbnail:"auto"},{id:"epub",label:"EPUB",kind:"document",extensions:["epub"],mimeTypes:["application/epub+zip"],storedAs:"epub",viewer:"epub",thumbnail:"auto"},{id:"eml",label:"Mail",kind:"document",extensions:["eml"],mimeTypes:["message/rfc822"],storedAs:"eml",viewer:"markdown",thumbnail:"auto"},{id:"msg",label:"Outlook mail",kind:"document",extensions:["msg"],mimeTypes:["application/vnd.ms-outlook"],storedAs:"msg",viewer:"markdown",thumbnail:"auto"},{id:"html",label:"Web page",kind:"document",extensions:["html","htm"],mimeTypes:["text/html"],storedAs:"html",viewer:"html",language:"html",thumbnail:"auto"},{id:"md",label:"Markdown",kind:"document",extensions:["md","markdown"],mimeTypes:["text/markdown"],storedAs:"md",viewer:"markdown",language:"markdown",thumbnail:"auto"},{id:"rst",label:"reStructuredText",kind:"text",extensions:["rst"],mimeTypes:[],storedAs:"rst",viewer:"text",language:"rst",thumbnail:"text"},{id:"mermaid",label:"Mermaid diagram",kind:"text",extensions:["mmd","mermaid"],mimeTypes:[],storedAs:"txt",viewer:"mermaid",language:"mermaid",thumbnail:"text"},{id:"txt",label:"Text",kind:"text",extensions:["txt"],mimeTypes:["text/plain"],storedAs:"txt",viewer:"text",thumbnail:"auto"},{id:"log",label:"Log",kind:"text",extensions:["log"],mimeTypes:[],storedAs:"log",viewer:"text",thumbnail:"text"},{id:"xlsx",label:"Spreadsheet",kind:"table",extensions:["xlsx","ods"],mimeTypes:["application/vnd.openxmlformats-officedocument.spreadsheetml.sheet","application/vnd.oasis.opendocument.spreadsheet"],storedAs:"excel",viewer:"xlsx",thumbnail:"auto"},{id:"xls",label:"Spreadsheet",kind:"table",extensions:["xls"],mimeTypes:["application/vnd.ms-excel"],storedAs:"excel",viewer:"xls",thumbnail:"auto"},{id:"csv",label:"CSV",kind:"table",extensions:["csv"],mimeTypes:["text/csv"],storedAs:"csv",viewer:"csv",thumbnail:"auto"},{id:"tsv",label:"TSV",kind:"table",extensions:["tsv"],mimeTypes:["text/tab-separated-values"],storedAs:"tsv",viewer:"tsv",thumbnail:"auto"},t("c","C",["c"],"c",["text/x-c"]),t("cc","C++",["cc"],"cpp"),t("cpp","C++",["cpp"],"cpp",["text/x-c++src"]),t("cxx","C++",["cxx"],"cpp"),t("h","C header",["h"],"c",["text/x-chdr"]),t("hh","C++ header",["hh"],"cpp"),t("hpp","C++ header",["hpp"],"cpp",["text/x-c++hdr"]),t("cs","C#",["cs"],"csharp",["text/x-csharp"]),t("css","CSS",["css"],"css",["text/css"]),t("scss","SCSS",["scss"],"scss"),t("go","Go",["go"],"go",["text/x-go"]),t("java","Java",["java"],"java",["text/x-java-source"]),t("js","JavaScript",["js"],"javascript",["application/javascript","application/x-javascript","text/javascript"]),t("cjs","JavaScript",["cjs"],"javascript"),t("mjs","JavaScript",["mjs"],"javascript"),t("jsx","JSX",["jsx"],"jsx",["text/jsx"]),t("ts","TypeScript",["ts"],"typescript",["application/x-typescript","text/typescript","text/x-typescript"]),t("tsx","TSX",["tsx"],"tsx",["text/tsx"]),t("kt","Kotlin",["kt","kts"],"kotlin",["text/x-kotlin"]),t("php","PHP",["php"],"php",["application/x-httpd-php","text/x-php"]),t("py","Python",["py"],"python",["text/x-python"]),t("rb","Ruby",["rb"],"ruby",["text/x-ruby","text/x-script.ruby"]),t("rs","Rust",["rs"],"rust",["text/x-rust"]),t("scala","Scala",["scala"],"scala",["text/x-scala"]),t("sh","Shell script",["sh","bash","zsh"],"bash",["application/x-sh","text/x-sh"]),t("sol","Solidity",["sol"],"solidity",["text/x-solidity"]),t("sql","SQL",["sql"],"sql",["application/sql","text/x-sql"]),t("swift","Swift",["swift"],"swift",["text/x-swift"]),t("tex","LaTeX",["tex"],"latex",["text/x-tex"]),t("vue","Vue",["vue"],"vue"),{...t("ino","Arduino sketch",["ino"],"cpp"),storedAs:"cpp",thumbnail:"text"},{id:"json",label:"JSON",kind:"code",extensions:["json"],mimeTypes:["application/json"],storedAs:"json",viewer:"json",language:"json",thumbnail:"auto"},{id:"jsonl",label:"JSON Lines",kind:"code",extensions:["jsonl","ndjson"],mimeTypes:["application/x-ndjson"],storedAs:"jsonl",viewer:"jsonl",language:"json",thumbnail:"text"},{id:"yaml",label:"YAML",kind:"code",extensions:["yaml","yml"],mimeTypes:["application/x-yaml","application/yaml","text/yaml"],storedAs:"yaml",viewer:"yaml",language:"yaml",thumbnail:"auto"},{id:"toml",label:"TOML",kind:"code",extensions:["toml"],mimeTypes:["application/toml"],storedAs:"toml",viewer:"toml",language:"toml",thumbnail:"text"},{id:"ini",label:"INI",kind:"code",extensions:["ini"],mimeTypes:[],storedAs:"ini",viewer:"ini",language:"ini",thumbnail:"text"},{id:"xml",label:"XML",kind:"code",extensions:["xml"],mimeTypes:["application/xml","text/xml"],storedAs:"xml",viewer:"xml",language:"xml",thumbnail:"auto"},a({id:"cmake",label:"CMake",kind:"code",extensions:["cmake"],fileNames:["cmakelists.txt"],storedAs:"txt",language:"cmake"}),a({id:"makefile",label:"Makefile",kind:"code",extensions:["mk","mak"],fileNames:["makefile","gnumakefile"],storedAs:"txt",language:"make"}),a({id:"asm",label:"Assembly",kind:"code",extensions:["asm","s"],storedAs:"txt",language:"asm"}),a({id:"linker-script",label:"Linker script",kind:"code",extensions:["ld","lds"],storedAs:"txt",language:"linker-script"}),{id:"source-map",label:"Source map",kind:"code",extensions:["js.map","css.map","mjs.map","cjs.map"],mimeTypes:[],storedAs:"unstructuredFile",viewer:"json",language:"json",thumbnail:"icon"},a({id:"linker-map",viewer:"firmware",thumbnail:"text",label:"Linker map",kind:"electronics",extensions:["map"],storedAs:"unstructuredFile",language:"linker-map"}),a({id:"intel-hex",viewer:"firmware",thumbnail:"text",label:"Intel HEX",kind:"electronics",extensions:["hex","ihex","ihx"],storedAs:"unstructuredFile",language:"ihex"}),a({id:"srec",viewer:"firmware",thumbnail:"text",label:"Motorola S-record",kind:"electronics",extensions:["srec","s19","s28","s37","mot"],storedAs:"unstructuredFile",language:"srec"}),{id:"elf",label:"ELF binary",kind:"electronics",extensions:["elf","axf","o"],mimeTypes:["application/x-elf","application/x-executable","application/x-sharedlib","application/x-object"],storedAs:"unstructuredFile",viewer:"firmware",thumbnail:"icon"},a({id:"verilog",label:"Verilog",kind:"code",extensions:["v","vh"],storedAs:"txt",language:"verilog"}),a({id:"systemverilog",label:"SystemVerilog",kind:"code",extensions:["sv","svh"],storedAs:"txt",language:"system-verilog"}),a({id:"vhdl",label:"VHDL",kind:"code",extensions:["vhd","vhdl"],storedAs:"txt",language:"vhdl"}),a({id:"spice",label:"SPICE netlist",kind:"electronics",extensions:["spice","cir","sp"],storedAs:"txt",language:"spice"}),a({id:"kicad-schematic",viewer:"kicad",thumbnail:"auto",label:"KiCad schematic",kind:"electronics",extensions:["kicad_sch"],storedAs:"txt",language:"scheme"}),a({id:"kicad-pcb",viewer:"kicad",thumbnail:"auto",label:"KiCad PCB",kind:"electronics",extensions:["kicad_pcb"],storedAs:"unstructuredFile",language:"scheme"}),a({id:"kicad-symbol",viewer:"kicad",thumbnail:"auto",label:"KiCad symbols",kind:"electronics",extensions:["kicad_sym"],storedAs:"txt",language:"scheme"}),a({id:"kicad-footprint",viewer:"kicad",thumbnail:"auto",label:"KiCad footprint",kind:"electronics",extensions:["kicad_mod"],storedAs:"txt",language:"scheme"}),a({id:"kicad-project",label:"KiCad project",kind:"electronics",extensions:["kicad_pro"],storedAs:"txt",language:"json"}),a({id:"gerber",viewer:"gerber",thumbnail:"auto",label:"Gerber",kind:"electronics",extensions:["gbr","ger","gtl","gbl","gto","gbo","gts","gbs","gtp","gbp","gko","gm1","gml","g1","g2","gp1","gp2","pho","art"],mimeTypes:["application/vnd.gerber"],storedAs:"unstructuredFile",language:"gerber"}),a({id:"excellon",viewer:"gerber",thumbnail:"auto",label:"Drill file",kind:"electronics",extensions:["drl","xln","exc","drd","ncd"],storedAs:"unstructuredFile",language:"excellon"}),a({id:"dxf",viewer:"dxf",thumbnail:"auto",label:"DXF drawing",kind:"cad",extensions:["dxf"],mimeTypes:["image/vnd.dxf","application/dxf","image/x-dxf"],storedAs:"unstructuredFile",language:"dxf"}),a({id:"ifc",viewer:"ifc",thumbnail:"auto",label:"IFC model",kind:"cad",extensions:["ifc"],mimeTypes:["model/ifc","application/x-step"],storedAs:"unstructuredFile",language:"step"}),a({id:"gcode",label:"G-code",kind:"cad",extensions:["gcode","nc","ngc"],mimeTypes:["text/x-gcode"],storedAs:"unstructuredFile",language:"gcode"}),{id:"dwg",label:"DWG drawing",kind:"cad",extensions:["dwg"],mimeTypes:["image/vnd.dwg","application/acad","image/x-dwg"],storedAs:"unstructuredFile",viewer:"dwg",thumbnail:"auto"},l("glb","glTF model",["glb"],["model/gltf-binary"]),l("gltf","glTF model",["gltf"],["model/gltf+json"]),l("obj","OBJ model",["obj"],["model/obj","text/prs.wavefront-obj"]),l("stl","STL model",["stl"],["model/stl","application/sla","application/vnd.ms-pki.stl"]),l("3mf","3MF model",["3mf"],["model/3mf","application/vnd.ms-package.3dmanufacturing-3dmodel+xml"]),l("ply","PLY model",["ply"],["application/ply","model/ply"]),l("fbx","FBX model",["fbx"],["model/fbx"]),l("usdz","USDZ model",["usdz"],["model/vnd.usdz+zip","model/usd"]),l("step","STEP model",["step","stp"],["model/step","application/step","model/step+xml"]),l("iges","IGES model",["iges","igs"],["model/iges","application/iges"]),n("avif","image",["avif"],["image/avif"]),n("bmp","image",["bmp"],["image/bmp"]),n("gif","image",["gif"],["image/gif"]),n("heic","image",["heic","heif"],["image/heic","image/heif"]),n("jpeg","image",["jpeg","jpg"],["image/jpeg"]),n("png","image",["png"],["image/png"]),n("svg","image",["svg"],["image/svg+xml"]),n("tiff","image",["tif","tiff"],["image/tiff"]),n("webp","image",["webp"],["image/webp"]),n("mp3","audio",["mp3"],["audio/mp3","audio/mpeg"]),n("m4a","audio",["m4a"],["audio/mp4","audio/x-m4a"]),n("wav","audio",["wav"],["audio/wav","audio/x-wav","audio/wave"]),n("ogg","audio",["ogg","oga","opus"],["audio/ogg","audio/opus"]),n("aac","audio",["aac"],["audio/aac","audio/x-aac"]),n("amr","audio",["amr"],["audio/amr"]),n("flac","audio",["flac"],["audio/flac","audio/x-flac"]),n("mp4","video",["mp4","m4v"],["video/mp4","video/x-m4v"]),n("mov","video",["mov"],["video/quicktime"]),n("webm","video",["webm"],["video/webm"]),n("3gp","video",["3gp"],["video/3gpp","audio/3gpp"]),n("mkv","video",["mkv"],["video/x-matroska"]),n("avi","video",["avi"],["video/x-msvideo","video/avi"]),{id:"zip",label:"ZIP archive",kind:"archive",extensions:["zip"],mimeTypes:["application/zip","application/x-zip-compressed"],storedAs:"zip",viewer:"zip",thumbnail:"auto"},r("7z","7-Zip archive",["7z"],["application/x-7z-compressed"]),r("rar","RAR archive",["rar"],["application/vnd.rar","application/x-rar-compressed"]),r("tar","Tar archive",["tar"],["application/x-tar"]),r("gzip","Gzip archive",["gz","tgz"],["application/gzip","application/x-gzip"]),r("bzip2","Bzip2 archive",["bz2"],["application/x-bzip2"])];function n(e,i,s,o){return {id:e,label:i==="image"?"Image":i==="audio"?"Audio":"Video",kind:i,extensions:s,mimeTypes:o,storedAs:e,viewer:i,thumbnail:"auto"}}function r(e,i,s,o){return {id:e,label:i,kind:"archive",extensions:s,mimeTypes:o,storedAs:"unstructuredFile",viewer:"none",thumbnail:"icon"}}function l(e,i,s,o){return {id:e,label:i,kind:"model",extensions:s,mimeTypes:o,storedAs:"unstructuredFile",viewer:"model3d",thumbnail:"icon"}}var m=new Map,x=new Map,p=new Map,g=new Map;for(let e of c){g.set(e.id,e);for(let i of e.extensions)m.has(i)||m.set(i,e);for(let i of e.fileNames??[])x.set(i,e);for(let i of e.mimeTypes)p.has(i)||p.set(i,e);}function b(e){return (e.split(/[\\/]/).pop()??"").trim().toLowerCase()}function y(e){if(!e)return;let i=b(e),s=i.lastIndexOf(".");return s>0&&s<i.length-1?i.slice(s+1):void 0}function f(e){let i=b(e),s=x.get(i);if(s)return s;let o=i.split(".");for(let d=1;d<o.length;d++){let u=m.get(o.slice(d).join("."));if(u)return u}}function h(e){return m.get(e.trim().replace(/^\./,"").toLowerCase())}function k(e){return p.get(e.split(";")[0]?.trim().toLowerCase()??"")}function w(e){return (e.name?f(e.name):void 0)??(e.extension?h(e.extension):void 0)??(e.mimeType?k(e.mimeType):void 0)}function F(e){return w(e)??v}function A(e){return g.get(e)}function T(e){return c.filter(i=>i.storedAs===e)}function j(e){return [...new Set(c.filter(i=>i.kind===e).map(i=>i.storedAs))]}function S(e){return e.thumbnail==="text"||e.viewer==="code"||e.viewer==="text"}export{c as FILE_FORMATS,v as UNKNOWN_FILE_FORMAT,y as extensionOf,A as fileFormatById,w as fileFormatOf,F as fileFormatOrUnknown,T as fileFormatsStoredAs,S as isTextFormat,j as storedAsOfKind};
|