1// generated by diplomat-tool 2import wasm from "./diplomat-wasm.mjs"; 3import * as diplomatRuntime from "./diplomat-runtime.mjs"; 4 5 6 7export class BidiDirection { 8 9 #value = undefined; 10 11 static #values = new Map([ 12 ["Ltr", 0], 13 ["Rtl", 1], 14 ["Mixed", 2] 15 ]); 16 17 static getAllEntries() { 18 return BidiDirection.#values.entries(); 19 } 20 21 #internalConstructor(value) { 22 if (arguments.length > 1 && arguments[0] === diplomatRuntime.internalConstructor) { 23 // We pass in two internalConstructor arguments to create *new* 24 // instances of this type, otherwise the enums are treated as singletons. 25 if (arguments[1] === diplomatRuntime.internalConstructor ) { 26 this.#value = arguments[2]; 27 return this; 28 } 29 return BidiDirection.#objectValues[arguments[1]]; 30 } 31 32 if (value instanceof BidiDirection) { 33 return value; 34 } 35 36 let intVal = BidiDirection.#values.get(value); 37 38 // Nullish check, checks for null or undefined 39 if (intVal != null) { 40 return BidiDirection.#objectValues[intVal]; 41 } 42 43 throw TypeError(value + " is not a BidiDirection and does not correspond to any of its enumerator values."); 44 } 45 46 static fromValue(value) { 47 return new BidiDirection(value); 48 } 49 50 get value() { 51 return [...BidiDirection.#values.keys()][this.#value]; 52 } 53 54 get ffiValue() { 55 return this.#value; 56 } 57 static #objectValues = [ 58 new BidiDirection(diplomatRuntime.internalConstructor, diplomatRuntime.internalConstructor, 0), 59 new BidiDirection(diplomatRuntime.internalConstructor, diplomatRuntime.internalConstructor, 1), 60 new BidiDirection(diplomatRuntime.internalConstructor, diplomatRuntime.internalConstructor, 2), 61 ]; 62 63 static Ltr = BidiDirection.#objectValues[0]; 64 static Rtl = BidiDirection.#objectValues[1]; 65 static Mixed = BidiDirection.#objectValues[2]; 66 67 constructor(value) { 68 return this.#internalConstructor(...arguments) 69 } 70}