(function (_, Kotlin) { 'use strict'; var Kind_CLASS = Kotlin.Kind.CLASS; var listOf = Kotlin.kotlin.collections.listOf_i5x0yv$; function get_cm($receiver) { return $receiver / 2.54; } function get_asPoints($receiver) { return $receiver * 72; } function SlipInfo(eventNbr, event, lane, heat, swimmer, team) { this.eventNbr = eventNbr; this.event = event; this.lane = lane; this.heat = heat; this.swimmer = swimmer; this.team = team; } SlipInfo.$metadata$ = { kind: Kind_CLASS, simpleName: 'SlipInfo', interfaces: [] }; SlipInfo.prototype.component1 = function () { return this.eventNbr; }; SlipInfo.prototype.component2 = function () { return this.event; }; SlipInfo.prototype.component3 = function () { return this.lane; }; SlipInfo.prototype.component4 = function () { return this.heat; }; SlipInfo.prototype.component5 = function () { return this.swimmer; }; SlipInfo.prototype.component6 = function () { return this.team; }; SlipInfo.prototype.copy_cdqwiw$ = function (eventNbr, event, lane, heat, swimmer, team) { return new SlipInfo(eventNbr === void 0 ? this.eventNbr : eventNbr, event === void 0 ? this.event : event, lane === void 0 ? this.lane : lane, heat === void 0 ? this.heat : heat, swimmer === void 0 ? this.swimmer : swimmer, team === void 0 ? this.team : team); }; SlipInfo.prototype.toString = function () { return 'SlipInfo(eventNbr=' + Kotlin.toString(this.eventNbr) + (', event=' + Kotlin.toString(this.event)) + (', lane=' + Kotlin.toString(this.lane)) + (', heat=' + Kotlin.toString(this.heat)) + (', swimmer=' + Kotlin.toString(this.swimmer)) + (', team=' + Kotlin.toString(this.team)) + ')'; }; SlipInfo.prototype.hashCode = function () { var result = 0; result = result * 31 + Kotlin.hashCode(this.eventNbr) | 0; result = result * 31 + Kotlin.hashCode(this.event) | 0; result = result * 31 + Kotlin.hashCode(this.lane) | 0; result = result * 31 + Kotlin.hashCode(this.heat) | 0; result = result * 31 + Kotlin.hashCode(this.swimmer) | 0; result = result * 31 + Kotlin.hashCode(this.team) | 0; return result; }; SlipInfo.prototype.equals = function (other) { return this === other || (other !== null && (typeof other === 'object' && (Object.getPrototypeOf(this) === Object.getPrototypeOf(other) && (Kotlin.equals(this.eventNbr, other.eventNbr) && Kotlin.equals(this.event, other.event) && Kotlin.equals(this.lane, other.lane) && Kotlin.equals(this.heat, other.heat) && Kotlin.equals(this.swimmer, other.swimmer) && Kotlin.equals(this.team, other.team))))); }; function main$lambda(req, res) { var doc = new (require('pdfkit'))(); res.setHeader('Content-Type', 'application/pdf'); var slips = listOf([new SlipInfo(1, 'Girls 8&U 100 Yd Medley Relay', 1, 1, 'A', 'Delshire'), new SlipInfo(1, 'Girls 8&U 100 Yd Medley Relay', 1, 3, 'B', 'Delshire'), new SlipInfo(19, 'Boys 15-18 50 Yd Freestyle', 3, 5, 'Jack Hart', 'Delshire'), new SlipInfo(19, 'Boys 15-18 50 Yd Freestyle', 6, 1, 'Joseph Obert', 'Delshire'), new SlipInfo(1, 'Girls 8&U 100 Yd Medley Relay', 1, 1, 'A', 'Delshire'), new SlipInfo(1, 'Girls 8&U 100 Yd Medley Relay', 1, 3, 'B', 'Delshire')]); doc.pipe(res); writeSlip(slips.get_za3lpa$(0), doc, 0, 0); writeSlip(slips.get_za3lpa$(1), doc, 1, 0); writeSlip(slips.get_za3lpa$(2), doc, 0, 1); writeSlip(slips.get_za3lpa$(3), doc, 1, 1); writeSlip(slips.get_za3lpa$(4), doc, 0, 2); writeSlip(slips.get_za3lpa$(5), doc, 1, 2); var dashOptions = {}; dashOptions.space = 10; doc.moveTo(get_asPoints(get_cm(10.25)), get_asPoints(get_cm(1.0))).lineTo(get_asPoints(get_cm(10.25)), get_asPoints(get_cm(27.0))).dash(5, dashOptions).stroke(); doc.moveTo(get_asPoints(get_cm(1.0)), get_asPoints(get_cm(8.5))).lineTo(get_asPoints(get_cm(21.0)), get_asPoints(get_cm(8.5))).dash(5, dashOptions).stroke(); doc.moveTo(get_asPoints(get_cm(1.0)), get_asPoints(get_cm(16.5))).lineTo(get_asPoints(get_cm(21.0)), get_asPoints(get_cm(16.5))).dash(5, dashOptions).stroke(); return doc.end(); } function main(args) { var fireFunctions = require('firebase-functions'); fireFunctions.config(); exports.laneslips = fireFunctions.https.onRequest(main$lambda); } function writeSlip($receiver, doc, x, y) { var xOffset = get_asPoints(get_cm(10.0)) * x; var yOffset = get_asPoints(get_cm(8.0)) * y; var leftMargin = get_asPoints(get_cm(1.0)) + xOffset; var opts = {}; opts.width = get_asPoints(get_cm(8.5)); opts.align = 'center'; doc.fontSize(13); doc.font('Helvetica-Bold'); doc.text('Southern Ohio Swim League', leftMargin, get_asPoints(get_cm(1.5)) + yOffset, opts); doc.fontSize(11); doc.font('Times-Roman'); var eventY = get_asPoints(get_cm(2.3)) + yOffset; doc.text('EVENT #' + $receiver.eventNbr + ' - ' + $receiver.event, leftMargin, eventY); var lineSeparation = get_asPoints(get_cm(0.6)); var laneY = eventY + lineSeparation; doc.text('Lane:', leftMargin, laneY); var colWidth = get_asPoints(get_cm(1.3)); doc.text('1', leftMargin + colWidth * 1, laneY); doc.text('2', leftMargin + colWidth * 2, laneY); doc.text('3', leftMargin + colWidth * 3, laneY); doc.text('4', leftMargin + colWidth * 4, laneY); doc.text('5', leftMargin + colWidth * 5, laneY); doc.text('6', leftMargin + colWidth * 6, laneY); doc.circle(leftMargin + colWidth * $receiver.lane + get_asPoints(get_cm(0.1)), laneY + get_asPoints(get_cm(0.15)), get_asPoints(get_cm(0.3))); doc.stroke(); var heatY = laneY + lineSeparation; doc.text('Heat:', leftMargin, heatY); doc.text('1', leftMargin + colWidth * 1, heatY); doc.text('2', leftMargin + colWidth * 2, heatY); doc.text('3', leftMargin + colWidth * 3, heatY); doc.text('4', leftMargin + colWidth * 4, heatY); doc.text('5', leftMargin + colWidth * 5, heatY); doc.text('6', leftMargin + colWidth * 6, heatY); doc.circle(leftMargin + colWidth * $receiver.heat + get_asPoints(get_cm(0.1)), heatY + get_asPoints(get_cm(0.15)), get_asPoints(get_cm(0.3))); doc.stroke(); var nameY = heatY + lineSeparation; doc.text('Name: ' + $receiver.swimmer, leftMargin, nameY); var teamY = nameY + lineSeparation; doc.text('Team: ' + $receiver.team, leftMargin, teamY); var timesY = teamY + lineSeparation * 1.5; doc.text('Times:', leftMargin, timesY); doc.moveTo(leftMargin + colWidth, timesY + 14).lineTo(leftMargin + colWidth + get_asPoints(get_cm(2.0)), timesY + 14).stroke(); doc.moveTo(leftMargin + colWidth + get_asPoints(get_cm(2.7)), timesY + 14).lineTo(leftMargin + colWidth + get_asPoints(get_cm(4.7)), timesY + 14).stroke(); doc.moveTo(leftMargin + colWidth + get_asPoints(get_cm(5.4)), timesY + 14).lineTo(leftMargin + colWidth + get_asPoints(get_cm(7.4)), timesY + 14).stroke(); var officialTimesY = timesY + lineSeparation * 1.5; doc.text('Official Time:', leftMargin, officialTimesY); doc.moveTo(leftMargin + colWidth * 2, officialTimesY + 14).lineTo(leftMargin + colWidth * 2 + get_asPoints(get_cm(4.0)), officialTimesY + 14).stroke(); var placeY = officialTimesY + lineSeparation * 1.25; doc.text('Place:', leftMargin, placeY); doc.text('1', leftMargin + colWidth * 1, placeY); doc.text('2', leftMargin + colWidth * 2, placeY); doc.text('3', leftMargin + colWidth * 3, placeY); doc.text('4', leftMargin + colWidth * 4, placeY); doc.text('5', leftMargin + colWidth * 5, placeY); doc.text('6', leftMargin + colWidth * 6, placeY); } var package$online = _.online || (_.online = {}); var package$cinphart = package$online.cinphart || (package$online.cinphart = {}); var package$laneslips = package$cinphart.laneslips || (package$cinphart.laneslips = {}); package$laneslips.get_cm_yrwdxr$ = get_cm; package$laneslips.get_asPoints_yrwdxr$ = get_asPoints; package$laneslips.SlipInfo = SlipInfo; package$laneslips.main_kand9s$ = main; package$laneslips.writeSlip_xwsitz$ = writeSlip; main([]); Kotlin.defineModule('index', _); return _; }(module.exports, require('kotlin')));