/* rb_econv_open_by_transcoder_entries
551397
private static EConv openByTranscoderEntries(int n, Entry[] entries) {
        EConv econv = new EConv(n);

        for (int i = 0; i < n; i++) {
            Transcoder transcoder = entries[i].getTranscoder();
            econv.addTranscoderAt(transcoder, econv.numTranscoders);
        }
        return econv;
    }
658630
function convertEntry(entry) {
	entry.description = entry.desc
	delete entry.desc

	if (entry.values) {
		entry.values.forEach(v => {
			v.description = v.desc
			delete v.desc

			if (v.browsers) {
				if (v.browsers === 'all') {
					delete v.browsers
				} else {
					v.browsers = entry.browsers.split(',')
					if (v.browsers.length === 1 && v.browsers[0] === "all") {
						delete v.browsers
					}
				}
			}
		})
	}

	if (entry.browsers) {
		if (entry.browsers === 'all') {
			delete entry.browsers
		} else {
			entry.browsers = entry.browsers.split(',')
		}
	}

	if (entry.restriction) {
		entry.restrictions = entry.restriction.split(',').map((s) => { return s.trim(); });
		if (entry.restrictions.length === 1 && entry.restrictions[0] === "none") {
			delete entry.restrictions
		}
	} else {
		delete entry.restrictions
	}
	delete entry.restriction

	if (entry.status) {
		entry.status = expandEntryStatus(entry.status)
	}
}
528161
function encodeGetMarketProfitAndLoss(doc, result) {
    // annotations
    if (!result.annotations) {
        // bets
        doc.startElement('annotations').writeAttribute('xsi:null', '1');
        doc.endElement();
    } else {
        doc.startElement('annotations').writeAttribute('xsi:type',
                'n2:ArrayOfProfitAndLoss');
        for ( var i = 0; i < result.annotations.length; ++i) {
            var ann = result.annotations[i];
            doc.startElement('n2:ProfitAndLoss').writeAttribute('xsi:type',
                    'n2:ProfitAndLoss');
            // futureIfWin
            doc.startElement('futureIfWin').writeAttribute('xsi:type', 'xsd:double');
            doc.text(ann.futureIfWin + '');
            doc.endElement();
            // ifWin
            doc.startElement('ifWin').writeAttribute('xsi:type', 'xsd:double');
            doc.text((1 * ann.ifWin).toFixed(2));
            doc.endElement();
            // selectionID
            doc.startElement('selectionId').writeAttribute('xsi:type', 'xsd:integer');
            doc.text(ann.selectionId);
            doc.endElement();
            // selectionName
            doc.startElement('selectionName').writeAttribute('xsi:type', 'xsd:string');
            doc.text(ann.selectionName);
            doc.endElement();
            // worstCaseIfWin
            doc.startElement('worstCaseIfWin').writeAttribute('xsi:type', 'xsd:double');
            doc.text(ann.worstCaseIfWin + '');
            doc.endElement();
            // ifLoss
            doc.startElement('ifLoss').writeAttribute('xsi:type', 'xsd:double');
            doc.text((1 * ann.ifLoss).toFixed(2));
            doc.endElement();

            doc.endElement();
        }
        doc.endElement();
    }
    // commissionApplied
    doc.startElement('commissionApplied').writeAttribute('xsi:type', 'xsd:double');
    doc.text(result.commissionApplied + '');
    doc.endElement();
    // currencyCode
    doc.startElement('currencyCode').writeAttribute('xsi:type', 'xsd:string');
    doc.text(result.currencyCode);
    doc.endElement();
    // includesSettledBets
    doc.startElement('includesSettledBets').writeAttribute('xsi:type', 'xsd:booleang');
    doc.text(result.includesSettledBets ? "true" : "false");
    doc.endElement();
    // includesBspBets
    doc.startElement('includesBspBets').writeAttribute('xsi:type', 'xsd:booleang');
    doc.text(result.includesBspBets ? "true" : "false");
    doc.endElement();
    // marketId
    doc.startElement('marketId').writeAttribute('xsi:type', 'xsd:integer');
    doc.text(result.marketId);
    doc.endElement();
    // marketName
    doc.startElement('marketName').writeAttribute('xsi:type', 'xsd:string');
    doc.text(result.marketName);
    doc.endElement();
    // marketStatus
    doc.startElement('marketStatus').writeAttribute('xsi:type', 'n2:MarketStatusEnum');
    doc.text(result.marketStatus);
    doc.endElement();
    // unit
    doc.startElement('unit').writeAttribute('xsi:type', 'xsd:string');
    doc.text(result.unit || 'N/A');
    doc.endElement();
}
621081
function rstr2binb(input) {
    var i, l = input.length * 8,
      output = Array(input.length >> 2),
      lo = output.length;
    for (i = 0; i < lo; i += 1) {
      output[i] = 0;
    }
    for (i = 0; i < l; i += 8) {
      output[i >> 5] |= (input.charCodeAt(i / 8) & 0xFF) << (24 - i % 32);
    }
    return output;
  }
461616
function base32DecodeNextCharacter(chunk, characterIndex, buffer, index) {
    const byteIndex = Math.floor(index + (characterIndex * 5) / 8);
    const offset = characterIndex % 8;
    switch (offset) {
        case 0:
            buffer[byteIndex] |= chunk << 3;
            break;
        case 1:
            buffer[byteIndex] |= chunk >>> 2;
            buffer[byteIndex + 1] |= chunk << 6;
            break;
        case 2:
            buffer[byteIndex] |= chunk << 1;
            break;
        case 3:
            buffer[byteIndex] |= chunk >>> 4;
            buffer[byteIndex + 1] |= chunk << 4;
            break;
        case 4:
            buffer[byteIndex] |= chunk >>> 1;
            buffer[byteIndex + 1] |= chunk << 7;
            break;
        case 5:
            buffer[byteIndex] |= chunk << 2;
            break;
        case 6:
            buffer[byteIndex] |= chunk >>> 3;
            buffer[byteIndex + 1] |= chunk << 5;
            break;
        case 7:
            buffer[byteIndex] |= chunk;
            break;
    }
}
651182
public int insertOutput(byte[] str, int strP, int strLen, byte[] strEncoding) {
        byte[] insertEncoding = encodingToInsertOutput();
        byte[] insertBuf = null;

        started = true;

        if (strLen == 0) return 0;

        final byte[] insertStr;
        final int insertP;
        final int insertLen;
        if (caseInsensitiveEquals(insertEncoding, strEncoding)) {
            insertStr = str;
            insertP = 0;
            insertLen = strLen;
        } else {
            Ptr insertLenP = new Ptr();
            insertBuf = new byte[4096]; // FIXME: wasteful
            insertStr = allocateConvertedString(strEncoding, insertEncoding, str, strP, strLen, insertBuf, insertLenP);
            insertLen = insertLenP.p;
            insertP = insertStr == str ? strP : 0;
            if (insertStr == null) return -1;
        }

        int need = insertLen;

        final int lastTranscodingIndex = numTranscoders - 1;
        final Transcoding transcoding;

        Buffer buf;

        if (numTranscoders == 0) {
            transcoding = null;
            buf = inBuf;
        } else if (elements[lastTranscodingIndex].transcoding.transcoder.compatibility.isEncoder()) {
            transcoding = elements[lastTranscodingIndex].transcoding;
            need += transcoding.readAgainLength;
            if (need < insertLen) return -1;

            if (lastTranscodingIndex == 0) {
                buf = inBuf;
            } else {
                buf = elements[lastTranscodingIndex - 1];
            }
        } else {
            transcoding = elements[lastTranscodingIndex].transcoding;
            buf = elements[lastTranscodingIndex];
        }

        if (buf == null) {
            buf = new Buffer();
            buf.allocate(need);
        } else if (buf.bytes == null) {
            buf.allocate(need);
        } else if ((buf.bufEnd - buf.dataEnd) < need) {
            // try to compact buffer by moving data portion back to bufStart
            System.arraycopy(buf.bytes, buf.dataStart, buf.bytes, buf.bufStart, buf.dataEnd - buf.dataStart);
            buf.dataEnd = buf.bufStart + (buf.dataEnd - buf.dataStart);
            buf.dataStart = buf.bufStart;

            if ((buf.bufEnd - buf.dataEnd) < need) {
                // still not enough room; use a separate buffer
                int s = (buf.dataEnd - buf.bufStart) + need;
                if (s < need) return -1;
                Buffer buf2 = buf = new Buffer();
                buf2.allocate(s);
                System.arraycopy(buf.bytes, buf.bufStart, buf2.bytes, 0, s); // ??
                buf2.dataStart = 0;
                buf2.dataEnd = buf.dataEnd - buf.bufStart;
            }
        }

        System.arraycopy(insertStr, insertP, buf.bytes, buf.dataEnd, insertLen);
        buf.dataEnd += insertLen;
        if (transcoding != null && transcoding.transcoder.compatibility.isEncoder()) {
            System.arraycopy(transcoding.readBuf, transcoding.recognizedLength, buf.bytes, buf.dataEnd, transcoding.readAgainLength);
            buf.dataEnd += transcoding.readAgainLength;
            transcoding.readAgainLength = 0;
        }

        return 0;
    }
1177909
function charCodesToString(charCodes) {
  // Use these methods to be able to convert large strings
  if (hasProperty('Buffer')) {
    return Buffer.from(charCodes).toString(STR_ENCODING)
  } else if (hasProperty('TextDecoder')) {
    return new TextDecoder(STR_ENCODING) // eslint-disable-line no-undef
      .decode(new Int8Array(charCodes))
  }

  // Fallback method
  let str = ''

  for (let i = 0; i < charCodes.length; i += STR_SLICE_SIZE) {
    str += String.fromCharCode.apply(
      null,
      charCodes.slice(i, i + STR_SLICE_SIZE)
    )
  }

  return str
}
165755
void addTranscoderAt(Transcoder transcoder, int i) {
        if (numTranscoders == elements.length) {
            EConvElement[] tmp = new EConvElement[elements.length * 2];
            System.arraycopy(elements, 0, tmp, 0, i);
            System.arraycopy(elements, i, tmp, i + 1, elements.length - i);
            elements = tmp;
        } else {
            System.arraycopy(elements, i, elements, i + 1, elements.length - i - 1);
        }

        elements[i] = new EConvElement(transcoder.transcoding(0));
        elements[i].allocate(4096);
        numTranscoders++;

        if (!decorator(transcoder.source, transcoder.destination)) {
            for (int j = numTranscoders - 1; i <= j; j--) {
                Transcoding tc = elements[j].transcoding;
                Transcoder tr = tc.transcoder;
                if (!decorator(tr.source, tr.destination)) {
                    lastTranscoding = tc;
                    break;
                }
            }
        }
    }
1038945
function () {
    var chunks = [];
    return through2.obj(function (file, enc, cb) {
        chunks.push(file);
        var string = file._contents.toString();
        var regex  = /\/\*\*debug:start\*\*\/[\s\S]*\/\*\*debug:end\*\*\//g;
        var stripped = string.replace(regex, "");
        file.contents = new Buffer(stripped);
        this.push(file);
        cb();
    });
}
444010
function b64toBlob(b64Data, contentType, sliceSize) {
	contentType = contentType || '';
	sliceSize = sliceSize || 512;

	var byteCharacters = atob(b64Data);
	var byteArrays = [];

	for (var offset = 0; offset < byteCharacters.length; offset += sliceSize) {
		var slice = byteCharacters.slice(offset, offset + sliceSize);

		var byteNumbers = new Array(slice.length);
		for (var i = 0; i < slice.length; i++) {
			byteNumbers[i] = slice.charCodeAt(i);
		}

		var byteArray = new Uint8Array(byteNumbers);

		byteArrays.push(byteArray);
	}

	var blob = new Blob(byteArrays, {type: contentType});
	return blob;
}
1101356
function (trans, val) {
		var key,
			tmpArr = {},
			isArr = $.isArray(trans);
		for (key in trans) {
			if (isArr || trans.hasOwnProperty(key)) {
				tmpArr[trans[key]] = val || key;
			}
		}
		return tmpArr;
	}
827853
def transcode(infile, outfile=None, incoding="shift-jis", outcoding="utf-8"):
    """"""
    if not outfile:
        outfile = os.path.basename(infile) + '.utf8'
    with codecs.open(infile, "rb", incoding) as fpin:
        with codecs.open(outfile, "wb", outcoding) as fpout:
            fpout.write(fpin.read())
403134
function encodeArray_PRIM_BULK_KNOWN( encoder, data, meta ) {
	var DEBUG_THIS = false;

	//
	// Bulk Array for Known Object (PRIM_BULK_KNOWN)
	//
	// .......  .   +   Data Length  +  Entity ID + Bulk Op-Codes
	// 0111110 [LN]    [16bit/32bit]     [16bit]     (IRef Meta)
	//

	// Lookup signature
	var object, id, i, c_export = 0, eid=meta[0], getProps=meta[1], plen=-1,
		propertyTable = [], waveTable = [], op8 = [], op16 = [], local_ids = [],
		c_same = 0, use_same = false, last = undefined, iref_count = 0;
	encoder.counters.arr_prim_bulk_known+=1;
	encoder.log(LOG.ARR, "array.prim.known, len="+data.length+
		", eid="+eid+", [");
	encoder.logIndent(1);

	// Put header
	if (data.length < UINT16_MAX) { // 16-bit length prefix
		encoder.stream8.write( pack1b( ARR_OP.PRIM_BULK_KNOWN | NUMTYPE_LN.UINT16 ) );
		encoder.stream16.write( pack2b( data.length, false ) );
		encoder.counters.arr_hdr+=3;
	} else { // 32-bit length prefix
		encoder.stream8.write( pack1b( ARR_OP.PRIM_BULK_KNOWN | NUMTYPE_LN.UINT32 ) );
		encoder.stream32.write( pack4b( data.length, false ) );
		encoder.counters.arr_hdr+=5;
	}

	// console.log("--> @"+(encoder.stream16.offset/2),"EID:",eid,"LEN:",data.length);

	// Write EID
	encoder.stream16.write( pack2b( eid, false ) );
	encoder.counters.arr_hdr+=2;
	// console.log("--- EID",eid," --- @"+encoder.stream16.offset);

	// Populate fields
	for (var j=0, el=data.length; j<el; ++j) {
		object = data[j];

		// Check if same to previous
		if ( use_same && ((object === last) || 
			 (encoder.optimize.cfwa_object_byval
			&& deepEqual(last, object, {strict:true}))) ) {

			// console.log(last,"==",object);

			// First encounter, flush exports
			if (c_export > 0) {
				// console.log(">>[known="+c_export+" (ref)]>>");
				if (DEBUG_THIS) console.log("->-[==] DEFINE(",c_export,"), j=",j);
				op8.push( pack1b( PRIM_BULK_KNOWN_OP.DEFINE | (c_export-1) )  )
				encoder.counters.arr_dat+=1;
				c_export = 0;
			}

			// Flush every 32 items
			c_same++;
			if (c_same > 31) {
				// console.log(">>[same="+c_same+"]>>");
				if (DEBUG_THIS) console.log("->-[OV] REPEAT(",c_same,"), j=",j);
				op8.push( pack1b( PRIM_BULK_KNOWN_OP.REPEAT | (c_same-1) )  )
				encoder.counters.arr_dat+=1;
				c_same = 0;
			}

			// Don't process the rest
			continue;

		} else {

			// Flush the moment we don't have a same item
			if (c_same > 0) {
				// console.log(last,"!=",object);
				// console.log(">>[same="+c_same+"]>>");
				if (DEBUG_THIS) console.log("->-[!=] REPEAT(",c_same,"), j=",j);
				op8.push( pack1b( PRIM_BULK_KNOWN_OP.REPEAT | (c_same-1) )  )
				encoder.counters.arr_dat+=1;
				c_same = 0;
			}

		}

		// Keep last
		last = object;
		use_same = true;

		// Check ByRef internally
		id = encoder.lookupIRef( object );
		if (id > -1) {
			if (c_export > 0) {
				// console.log(">>[known="+c_export+" (ref)]>>");
				if (DEBUG_THIS) console.log("->-[iR] DEFINE(",c_export,"), j=",j);
				op8.push( pack1b( PRIM_BULK_KNOWN_OP.DEFINE | (c_export-1) )  )
				encoder.counters.arr_dat+=1;
				c_export = 0;
			}

			// console.log(">>[iref="+id+" (ref)]>>");
			if (DEBUG_THIS) console.log("->- IREF(",id,"), j=",j);
			encodeLIREF( encoder, op8, op16, local_ids, id );
			continue;
		}

		// Check ByRef externally
		id = encoder.lookupXRef( object );
		if (id > -1) {
			if (c_export > 0) {
				// console.log(">>[known="+c_export+" (ref)]>>");
				if (DEBUG_THIS) console.log("->- DEFINE(",c_export,"), j=",j);
				op8.push( pack1b( PRIM_BULK_KNOWN_OP.DEFINE | (c_export-1) )  )
				encoder.counters.arr_dat+=1;
				c_export = 0;
			}
			// console.log(">>[xref="+id+"]>>");
			if (DEBUG_THIS) console.log("->- XREF(",id,"), j=",j);
			op8.push( pack1b( PRIM_BULK_KNOWN_OP.XREF, false ) );
			op16.push( pack2b( id & 0xFFFF, false ) );
			encoder.counters.arr_dat+=3;
			continue;
		}

		// Populate property table (for byval lookup)
		propertyTable = getProps( object );
		if (!propertyTable) {
			throw new Errors.AssertError('Profile property encoder returned unexpected data!');
		}

		// Check ByVal ref
		id = encoder.lookupIVal( propertyTable, eid );
		if (id > -1) {
			if (c_export > 0) {
				// console.log(">>[known="+c_export+" (ref)]>>");
				if (DEBUG_THIS) console.log("->- DEFINE(",c_export,"), j=",j);
				op8.push( pack1b( PRIM_BULK_KNOWN_OP.DEFINE | (c_export-1) )  )
				encoder.counters.arr_dat+=1;
				c_export = 0;
			}
			// console.log(">>[iref="+id+" (val)]>>");
			if (DEBUG_THIS) console.log("->- IREF(",id,"), j=",j);
			encodeLIREF( encoder, op8, op16, local_ids, id );
			encoder.counters.arr_dat+=3;
			continue;
		}

		// Keep IREF
		encoder.keepIRef( object, propertyTable, eid );
		iref_count++;

		// Init weave table if empty
		if (plen === -1) {
			plen = propertyTable.length;
			for (i=0; i<plen; ++i) {
				waveTable.push( [] );
			}
		}

		// Populate the weave table for the actual encoding.
		for (i=0; i<plen; ++i) {
			waveTable[i].push( propertyTable[i] );
		}

		// Count how many objects are exported in a bulk,
		// and flush every 64 items since that's how much
		// we can fit in a single 8-bit command
		c_export++;
		if (c_export > 63) {
			// console.log(">>[known="+c_export+" (bulk)]>>");
			if (DEBUG_THIS) console.log("->- DEFINE(",c_export,"), j=",j);
			op8.push( pack1b( PRIM_BULK_KNOWN_OP.DEFINE | (c_export-1) ) );
			encoder.counters.arr_hdr+=1;
			c_export = 0;
		}

	}

	// Finalize pending op-codes
	if (c_export > 0) {
		// console.log(">>[known="+c_export+" (end)]>>");
		if (DEBUG_THIS) console.log("->- DEFINE(",c_export,"), j=",j);
		op8.push( pack1b( PRIM_BULK_KNOWN_OP.DEFINE | (c_export-1) ) );
		encoder.counters.arr_hdr+=1;
	}
	if (c_same > 0) {
		// console.log(">>[same="+c_same+"]>>");
		if (DEBUG_THIS) console.log("->- REPEAT(",c_same,"), j=",j);
		op8.push( pack1b( PRIM_BULK_KNOWN_OP.REPEAT | (c_same-1) )  )
		encoder.counters.arr_dat+=1;
	}


	// Write number of iref items for faster initialization on decoder-side
	if (data.length < UINT16_MAX) {
		if (DEBUG_THIS) console.log("->- HINT16="+iref_count);
		encoder.stream16.write( pack2b( iref_count, false ) );
		encoder.counters.arr_hdr+=3;
	} else { // 32-bit length prefix
		if (DEBUG_THIS) console.log("->- HINT32="+iref_count);
		encoder.stream32.write( pack4b( iref_count, false ) );
		encoder.counters.arr_hdr+=5;
	}

	// Write weaved properties
	if (iref_count && (plen === -1))
		throw new Errors.AssertError("Something went really wrong in the logic!");
	if (iref_count > 0) {
		encodeArray( encoder, Array.prototype.concat.apply([], waveTable) );
	}

	// Write decoding instructions
	encoder.stream8.writeMany( op8 );
	encoder.stream16.writeMany( op16 );

	// Close log group
	encoder.logIndent(-1);
	encoder.log(LOG.ARR, "]");

}
764818
def lstm_seq2seq_internal_bid_encoder(inputs, targets, hparams, train):
  """"""
  with tf.variable_scope("lstm_seq2seq_bid_encoder"):
    if inputs is not None:
      inputs_length = common_layers.length_from_embedding(inputs)
      # Flatten inputs.
      inputs = common_layers.flatten4d3d(inputs)
      # LSTM encoder.
      _, final_encoder_state = lstm_bid_encoder(
          inputs, inputs_length, hparams, train, "encoder")
    else:
      inputs_length = None
      final_encoder_state = None
    # LSTM decoder.
    shifted_targets = common_layers.shift_right(targets)
    # Add 1 to account for the padding added to the left from shift_right
    targets_length = common_layers.length_from_embedding(shifted_targets) + 1
    hparams_decoder = copy.copy(hparams)
    hparams_decoder.hidden_size = 2 * hparams.hidden_size
    decoder_outputs, _ = lstm(
        common_layers.flatten4d3d(shifted_targets),
        targets_length,
        hparams_decoder,
        train,
        "decoder",
        initial_state=final_encoder_state)
    return tf.expand_dims(decoder_outputs, axis=2)
1231292
function(bufferView, entryIndex) {
  return bufferView.toString('base64', entryIndex * SLUGID_SIZE, SLUGID_SIZE * (entryIndex + 1))
    .replace(/\+/g, '-')
    .replace(/\//g, '_')
    .replace(/==/g, '');
}
851885
function csvWrapForExcel(encoder) {
  // Pipe the CSV encoder to the ucs2 converter
  var converter = new Stream.Transform();
  var csvStream = new Stream.PassThrough();
  converter._transform = function(chunk, encoding, cb) {
    this.push(new Buffer(chunk.toString(), 'ucs2'));
    cb();
  };
  // Write the UCS2 BOM http://www.unicode.org/faq/utf_bom.html#bom1
  csvStream.write(new Buffer([0xFF, 0xFE]));
  return encoder.pipe(converter).pipe(csvStream);
}
992651
function IndexEntrySee($txta, $txtb)
	{
		if ($this->directionality == 'rtl') { // *OTL*
			// ONLY DO THIS IF NOT IN TAGS
			if ($txta == strip_tags($txta)) {
				$txta = str_replace(':', ' - ', $txta); // *OTL*
			}
			if ($txtb == strip_tags($txtb)) {
				$txtb = str_replace(':', ' - ', $txtb); // *OTL*
			}
		} // *OTL*
		else { // *OTL*
			if ($txta == strip_tags($txta)) {
				$txta = str_replace(':', ', ', $txta);
			}
			if ($txtb == strip_tags($txtb)) {
				$txtb = str_replace(':', ', ', $txtb);
			}
		} // *OTL*
		$this->Reference[] = ['t' => $txta . ' - see ' . $txtb, 'p' => []];
	}