@idm-plugin/ghg
Version:
idm plugin for greenhouse gas
2 lines (1 loc) • 25.7 kB
JavaScript
(function(E,I){typeof exports=="object"&&typeof module<"u"?I(exports,require("@log4js-node/log4js-api"),require("@turf/turf")):typeof define=="function"&&define.amd?define(["exports","@log4js-node/log4js-api","@turf/turf"],I):(E=typeof globalThis<"u"?globalThis:E||self,I(E["idm-plugin-rabbitmq"]={},E["@log4js-node/log4js-api"],E["@turf/turf"]))})(this,function(E,I,g){"use strict";var k=Object.defineProperty;var J=(E,I,g)=>I in E?k(E,I,{enumerable:!0,configurable:!0,writable:!0,value:g}):E[I]=g;var B=(E,I,g)=>(J(E,typeof I!="symbol"?I+"":I,g),g);function m(R){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(R){for(const t in R)if(t!=="default"){const n=Object.getOwnPropertyDescriptor(R,t);Object.defineProperty(e,t,n.get?n:{enumerable:!0,get:()=>R[t]})}}return e.default=R,Object.freeze(e)}const D=m(g),z={};let L;try{L=I.getLogger("eu-ets")}catch{}finally{}const U=class U{static async readBoundaries(e){const t=z.readFileSync(e,"utf-8");return JSON.parse(t)}static async convert2Geojson(e){const t=[];for(const l of e){const c=l.bound;let a=c.at(-1);const i=c.at(-2);i[0]===a[0]&&i[1]===a[1]&&c.pop();const s=c.at(0);a=c.at(-1),(s[0]!==a[0]||s[1]!==a[1])&&c.push(s);const r=c.map(o=>[o[1],o[0]]);t.push([r])}return D.multiPolygon(t)}static async isInEU(e,t={}){const n=D.point([e.lng,e.lat]),l=D.booleanPointInPolygon(n,U.euMrvBoundaries,{ignoreBoundary:!1});return L==null||L.info("[%s] port(%j) in-eu: %s",t.requireId,e,l),l}static async isFuelEUExclude(e,t={}){const n=D.point([e.lng,e.lat]),l=D.booleanPointInPolygon(n,U.fuelEuExclude,{ignoreBoundary:!1});return L==null||L.info("[%s] port(%j) in-eu: %s",t.requireId,e,l),l}};B(U,"boundaries",{type:"Feature",properties:{},geometry:{type:"MultiPolygon",coordinates:[[[[10.10742,58.07788],[6.81152,56.84897],[7.4707,55.22902],[7.60254,54.1367],[4.30664,53.46189],[2.68066,52.07951],[1.88965,51.20688],[.79102,50.62507],[-.13184,49.86632],[-3.2959,49.83798],[-5.75684,48.40003],[-11.7334,41.54148],[-9.66797,35.88905],[-6.89941,35.81781],[-5.81726,35.9113],[-4.3396,36.16449],[-.41748,36.75649],[4.72412,38.09998],[9.82178,37.77071],[11.5741,37.20408],[12.01355,36.4257],[12.48596,35.24113],[19.75342,35.56798],[25.33447,33.50476],[32.65137,33.4131],[35.17822,34.84988],[35.37598,36.26199],[31.94824,35.58585],[28.93799,35.83563],[28.49854,36.41244],[28.32825,36.58025],[27.70203,36.4257],[27.35046,36.61553],[27.23511,36.72568],[27.46033,36.87083],[27.27905,36.9455],[27.1637,37.02448],[27.13623,37.26968],[27.11975,37.48358],[27.01538,37.58594],[26.95358,37.65882],[26.99066,37.68817],[27.09503,37.70338],[27.13898,37.76854],[27.05658,37.84558],[26.80939,37.95503],[26.1145,38.11295],[26.19141,38.35458],[26.2793,38.44068],[26.32874,38.48369],[26.3356,38.56427],[26.26694,38.65442],[26.61987,38.83543],[26.73523,39.06611],[26.55396,39.25778],[26.4798,39.35766],[26.48941,39.44998],[26.35345,39.45104],[26.15707,39.43195],[25.97717,39.44044],[26.07742,39.69345],[26.10077,39.80432],[26.04721,39.89499],[25.98679,39.97817],[26.21887,40.39676],[26.4386,40.55555],[26.06506,40.54303],[25.9552,40.70563],[26.0424,40.72853],[26.07193,40.72384],[26.32324,40.83044],[26.48804,41.01307],[26.55396,41.19519],[26.89453,41.52503],[27.16919,41.80408],[28.34473,41.88592],[30.36621,44.90258],[29.68506,45.32125],[22.76367,54.40614],[19.59961,54.47004],[18.0835,55.71473],[10.65674,59.06315],[10.10742,58.07788]]],[[[-24.16992,67.27204],[-26.80664,64.77413],[-18.54492,62.14498],[-9.31641,63.62674],[-8.4375,67.33986],[-18.28125,68.39918],[-24.16992,67.27204]]],[[[10.67871,59.08574],[9.22852,57.9615],[4.57031,57.93818],[3.07617,62.85515],[7.29492,65.21989],[11.38184,67.3906],[14.98535,70.5249],[26.80664,71.96539],[33.61816,70.31874],[31.46484,70.37785],[30.81116,69.91521],[30.85785,69.79983],[30.82764,69.78465],[30.92651,69.67427],[30.95398,69.56139],[30.66833,69.52491],[30.35522,69.61503],[30.12451,69.67045],[30.08057,69.42669],[29.13574,68.98993],[28.74023,68.56038],[30.32227,67.74276],[29.42139,66.64427],[30.76172,65.65827],[32.16797,62.71446],[28.07007,60.60315],[27.79541,60.33782],[28.67432,60.0429],[27.90527,59.86137],[27.86133,59.54546],[28.14697,59.44508],[28.30078,59.04055],[28.14697,58.24016],[28.10303,57.563],[28.45459,56.02295],[26.2793,54.00777],[24.30176,53.73572],[23.33496,53.74871],[22.76367,54.40614],[22.82959,54.90188],[22.17041,55.10352],[21.46729,55.22902],[21.09375,55.20395],[21.00586,55.62179],[16.09497,56.57764],[10.67871,59.08574]]],[[[-7.20154,55.06893],[-6.99829,55.17887],[-6.86646,55.23529],[-7.11914,55.44771],[-8.08594,55.5193],[-9.25049,54.99337],[-10.85449,53.96901],[-10.85449,52.38901],[-10.21729,50.99993],[-7.40479,51.60437],[-6.24023,52.01194],[-5.66895,52.65639],[-5.76782,53.7617],[-6.05896,53.9884],[-6.25671,54.1045],[-6.95984,54.23634],[-7.43225,54.12704],[-7.94312,54.29409],[-8.15186,54.45407],[-8.02551,54.54021],[-7.68494,54.62934],[-7.85522,54.74048],[-7.58606,54.73731],[-7.4762,54.86712],[-7.39929,54.99022],[-7.20154,55.06893]]],[[[-15.16113,29.36303],[-18.21533,29.31514],[-18.28125,27.23509],[-15.35889,27.17647],[-13.93066,27.73216],[-13.12866,29.02735],[-12.84302,29.77391],[-15.16113,29.36303]]],[[[-61.59485,16.57829],[-62.00684,16.35177],[-61.96289,15.85567],[-61.61682,15.71295],[-61.0675,15.7764],[-60.82031,16.13554],[-60.88623,16.46769],[-61.40259,16.62567],[-61.59485,16.57829]]],[[[-53.83301,6.06409],[-54.14063,5.58318],[-54.54712,4.97056],[-54.32739,3.28311],[-54.56909,2.30651],[-53.80005,1.90029],[-52.59155,2.06498],[-51.87744,3.72175],[-51.61377,4.10537],[-51.60278,4.23686],[-51.5918,4.91583],[-53.00903,5.9439],[-53.83301,6.06409]]],[[[-61.16089,14.95009],[-61.41907,14.80675],[-61.17737,14.36551],[-60.69397,14.35487],[-60.5896,14.58358],[-60.83679,14.85985],[-61.16089,14.95009]]],[[[45.20325,-12.57065],[44.95605,-12.55456],[44.94507,-12.76359],[44.94507,-13.02597],[45.16479,-13.10623],[45.32959,-13.02061],[45.35706,-12.80109],[45.30212,-12.63498],[45.20325,-12.57065]]],[[[-63.13705,18.0943],[-63.16383,18.09071],[-63.17276,18.06101],[-63.15491,18.04403],[-63.13362,18.05317],[-63.1089,18.05317],[-63.09311,18.04403],[-63.08006,18.0486],[-63.06702,18.0584],[-63.05122,18.06297],[-63.02856,18.05383],[-63.01071,18.05252],[-62.98187,18.0486],[-62.94617,18.10539],[-62.95715,18.14585],[-63.06358,18.14259],[-63.1192,18.12171],[-63.13705,18.0943]]],[[[55.31616,-20.73557],[54.94263,-21.1255],[55.46997,-21.55528],[56.15112,-21.49396],[56.40381,-20.86908],[55.67871,-20.48877],[55.31616,-20.73557]]],[[[-16.83655,33.19733],[-17.44629,33.00866],[-17.65503,32.5607],[-16.75415,32.30571],[-15.75989,32.28249],[-16.00159,33.16974],[-16.3092,33.42686],[-16.83655,33.19733]]],[[[-26.72974,39.3343],[-31.15723,40.00237],[-31.76147,39.45316],[-30.53101,38.03079],[-26.15845,36.85325],[-23.68652,36.46547],[-23.48877,38.39334],[-26.16943,39.15562],[-26.72974,39.3343]]]]}}),B(U,"euMrvBoundaries",{type:"Feature",properties:{},geometry:{type:"MultiPolygon",coordinates:[[[[10.10742,58.07788],[6.81152,56.84897],[7.4707,55.22902],[7.60253,54.1367],[4.30663,53.46188],[2.68067,52.07952],[1.88965,51.20688],[.79102,50.62507],[-.13183,49.86632],[-2.06818,49.8433],[-2.0462,49.68007],[-2.14233,49.54125],[-1.81823,49.21042],[-1.91987,48.86472],[-2.406,48.81228],[-3.52662,48.96398],[-5.75683,48.40003],[-11.7334,41.54148],[-9.66797,35.88905],[-6.89942,35.81782],[-6.37618,35.92687],[-6.08643,35.97023],[-5.85708,35.9491],[-5.56183,35.95745],[-5.49042,35.98023],[-5.4578,36.00607],[-5.35308,36.04217],[-5.33763,36.05493],[-5.35068,36.06187],[-5.36305,36.07657],[-5.3754,36.09627],[-5.39668,36.13095],[-5.38708,36.14702],[-5.3627,36.16005],[-5.35085,36.15632],[-5.33248,36.1595],[-5.23293,36.14342],[-5.22675,36.1057],[-5.25627,36.05908],[-5.29198,35.98245],[-5.38673,35.95855],[-5.39017,35.92353],[-5.37935,35.91185],[-5.37643,35.8935],[-5.373,35.88182],[-5.35308,35.87292],[-5.34278,35.87403],[-5.32493,35.85622],[-5.23842,35.87903],[-5.14228,35.96578],[-5.10933,36.05465],[-5.0283,36.08352],[-4.8539,36.08458],[-4.3396,36.16448],[-.41748,36.75648],[4.72412,38.09998],[9.82178,37.77072],[11.5741,37.20408],[12.01355,36.4257],[12.48597,35.24113],[14.91943,35.62158],[16.61133,37.30028],[17.73193,39.01065],[18.67675,39.58875],[18.7207,40.4971],[17.13867,41.44273],[16.32568,42.03297],[17.81982,42.67437],[18.55042,42.34637],[18.5669,42.39102],[18.59437,42.44575],[17.69897,43.06888],[15.79833,44.80912],[16.36963,45.35987],[17.77588,45.12005],[19.0503,44.80133],[18.84155,45.36758],[19.30298,45.98933],[20.1709,46.157],[21.03882,45.65245],[21.6211,45.10455],[21.44532,44.74673],[22.31323,44.52785],[23.00537,44.10337],[22.85157,43.19717],[22.36817,42.4721],[22.91748,41.6565],[22.63183,41.07935],[21.57715,40.94672],[20.61035,40.3298],[20.30137,39.7093],[20.17398,39.6517],[20.0909,39.68235],[20.04525,39.6961],[20.03392,39.70072],[20.01812,39.6945],[20.0104,39.69173],[20.00163,39.68315],[19.98207,39.67945],[19.9553,39.73755],[19.98482,39.78453],[19.86328,39.96238],[19.27002,40.03182],[19.17938,39.67972],[20.25878,37.21283],[25.33447,33.50477],[32.65137,33.4131],[35.17822,34.84988],[35.37598,36.26198],[31.55273,35.54563],[29.69363,35.96633],[29.6648,36.11652],[29.61117,36.14875],[29.6158,36.16733],[29.59155,36.17778],[29.56532,36.1629],[29.5376,36.16338],[29.51305,36.18347],[29.46842,36.16615],[29.34723,36.1595],[28.49853,36.41243],[28.32825,36.58025],[27.98767,36.5008],[27.92725,36.54827],[27.93137,36.62765],[27.9039,36.70145],[27.77687,36.6921],[27.68967,36.6045],[27.33535,36.6001],[27.23512,36.72568],[27.41638,36.81148],[27.48298,36.86643],[27.44865,36.91422],[27.40265,36.94495],[27.28523,36.94112],[27.22652,36.94687],[27.18087,36.97485],[27.11838,37.00145],[27.17262,37.04942],[27.0813,37.14062],[27.17193,37.25875],[27.11425,37.39635],[27.06207,37.53587],[26.95358,37.65882],[26.99067,37.68817],[27.09503,37.70338],[27.13898,37.76853],[27.05658,37.84558],[26.80938,37.95503],[26.11588,38.11727],[26.19142,38.35458],[26.2793,38.44068],[26.32873,38.48368],[26.3356,38.56427],[26.26693,38.65442],[26.61987,38.83543],[26.73523,39.06612],[26.55397,39.25778],[26.4798,39.35767],[26.48942,39.44998],[26.35345,39.45103],[26.15707,39.43195],[25.97717,39.44043],[26.02112,39.67548],[25.9552,39.73677],[25.85907,39.79588],[25.7602,39.8992],[25.68055,39.94975],[25.56243,40.06547],[25.5954,40.23132],[26.21887,40.39677],[26.4386,40.55555],[26.06507,40.54303],[25.9552,40.70563],[26.0424,40.72853],[26.07193,40.72383],[26.32323,40.83043],[26.48803,41.01307],[26.55397,41.19518],[26.89453,41.52503],[27.16918,41.80408],[28.34473,41.88592],[30.36622,44.90258],[29.68507,45.32125],[22.76367,54.40613],[19.59962,54.47003],[18.0835,55.71473],[10.9156,58.94363],[10.6382,58.95886],[10.33813,58.93159],[10.12939,58.6598],[10.10742,58.07788]]],[[[-24.16992,67.27203],[-26.80663,64.77413],[-18.54492,62.14498],[-9.31642,63.62673],[-8.4375,67.33987],[-18.28125,68.39918],[-24.16992,67.27203]]],[[[10.67871,59.08574],[9.22852,57.9615],[4.57031,57.93818],[3.07617,62.85515],[7.29492,65.21989],[11.38184,67.3906],[14.98535,70.5249],[26.80664,71.96539],[33.61816,70.31874],[31.46484,70.37785],[30.81116,69.91521],[30.85785,69.79983],[30.82764,69.78465],[30.92651,69.67427],[30.95398,69.56139],[30.66833,69.52491],[30.35522,69.61503],[30.12451,69.67045],[30.08057,69.42669],[29.13574,68.98993],[28.74023,68.56038],[30.32227,67.74276],[29.42139,66.64427],[30.76172,65.65827],[32.16797,62.71446],[28.07007,60.60315],[27.79541,60.33782],[28.67432,60.0429],[27.90527,59.86137],[27.86133,59.54546],[28.14697,59.44508],[28.30078,59.04055],[28.14697,58.24016],[28.10303,57.563],[28.45459,56.02295],[26.2793,54.00777],[24.30176,53.73572],[23.33496,53.74871],[22.76367,54.40614],[22.82959,54.90188],[22.17041,55.10352],[21.46729,55.22902],[21.09375,55.20395],[21.00586,55.62179],[16.09497,56.57764],[10.67871,59.08574]]],[[[-7.20154,55.06893],[-6.99829,55.17887],[-6.86646,55.23529],[-7.11914,55.44771],[-8.08594,55.5193],[-9.25049,54.99337],[-10.85449,53.96901],[-10.85449,52.38901],[-10.21729,50.99993],[-7.40479,51.60437],[-6.24023,52.01194],[-5.66895,52.65639],[-5.76782,53.7617],[-6.05896,53.9884],[-6.25671,54.1045],[-6.95984,54.23634],[-7.43225,54.12704],[-7.94312,54.29409],[-8.15186,54.45407],[-8.02551,54.54021],[-7.68494,54.62934],[-7.85522,54.74048],[-7.58606,54.73731],[-7.4762,54.86712],[-7.39929,54.99022],[-7.20154,55.06893]]],[[[-15.16113,29.36303],[-18.21533,29.31514],[-18.28125,27.23509],[-15.35889,27.17647],[-13.93066,27.73216],[-13.12866,29.02735],[-12.84302,29.77391],[-15.16113,29.36303]]],[[[-61.59485,16.57829],[-62.00684,16.35177],[-61.96289,15.85567],[-61.61682,15.71295],[-61.0675,15.7764],[-60.82031,16.13554],[-60.88623,16.46769],[-61.40259,16.62567],[-61.59485,16.57829]]],[[[-53.83301,6.06409],[-54.14063,5.58318],[-54.54712,4.97056],[-54.32739,3.28311],[-54.56909,2.30651],[-53.80005,1.90029],[-52.59155,2.06498],[-51.87744,3.72175],[-51.61377,4.10537],[-51.60278,4.23686],[-51.5918,4.91583],[-53.00903,5.9439],[-53.83301,6.06409]]],[[[-61.16089,14.95009],[-61.41907,14.80675],[-61.17737,14.36551],[-60.69397,14.35487],[-60.5896,14.58358],[-60.83679,14.85985],[-61.16089,14.95009]]],[[[45.20325,-12.57065],[44.95605,-12.55456],[44.94507,-12.76359],[44.94507,-13.02597],[45.16479,-13.10623],[45.32959,-13.02061],[45.35706,-12.80109],[45.30212,-12.63498],[45.20325,-12.57065]]],[[[-63.13705,18.0943],[-63.16383,18.09071],[-63.17276,18.06101],[-63.15491,18.04403],[-63.13362,18.05317],[-63.1089,18.05317],[-63.09311,18.04403],[-63.08006,18.0486],[-63.06702,18.0584],[-63.05122,18.06297],[-63.02856,18.05383],[-63.01071,18.05252],[-62.98187,18.0486],[-62.94617,18.10539],[-62.95715,18.14585],[-63.06358,18.14259],[-63.1192,18.12171],[-63.13705,18.0943]]],[[[55.31616,-20.73557],[54.94263,-21.1255],[55.46997,-21.55528],[56.15112,-21.49396],[56.40381,-20.86908],[55.67871,-20.48877],[55.31616,-20.73557]]],[[[-16.83655,33.19733],[-17.44629,33.00866],[-17.65503,32.5607],[-16.75415,32.30571],[-15.75989,32.28249],[-16.00159,33.16974],[-16.3092,33.42686],[-16.83655,33.19733]]],[[[-26.72974,39.3343],[-31.15723,40.00237],[-31.76147,39.45316],[-30.53101,38.03079],[-26.15845,36.85325],[-23.68652,36.46547],[-23.48877,38.39334],[-26.16943,39.15562],[-26.72974,39.3343]]]]}}),B(U,"fuelEuExclude",{type:"Feature",properties:{},geometry:{type:"MultiPolygon",coordinates:[[[[10.35048,58.97197],[9.22852,57.9615],[4.57032,57.93818],[3.07617,62.85515],[7.29492,65.21988],[11.38183,67.3906],[14.98535,70.5249],[26.80663,71.96538],[31.48682,70.39262],[30.55298,70.06183],[30.97047,69.93783],[30.95947,69.87367],[30.90453,69.83773],[31.0199,69.5518],[30.60242,69.51147],[30.2124,69.62652],[29.39942,68.9978],[28.76222,69.17037],[29.13573,69.67998],[28.34473,69.74855],[27.99317,70.07307],[16.74317,66.99883],[12.87598,62.93523],[13.44727,61.2068],[12.46673,59.97838],[12.18383,59.86688],[11.95862,59.66913],[11.69768,59.59693],[11.88172,59.29113],[11.77185,59.0038],[11.651,58.87627],[11.53563,58.87627],[11.45737,58.88762],[11.45873,58.933],[11.45598,58.98542],[11.41582,59.03685],[11.3839,59.08822],[11.33927,59.1143],[11.30423,59.10583],[11.18477,59.08008],[11.15662,59.08008],[11.10855,59.00238],[11.07147,58.97815],[10.91783,58.94283],[10.88677,58.94807],[10.74052,58.95567],[10.35048,58.97197]]],[[[-24.16992,67.27203],[-26.80663,64.77413],[-18.54492,62.14498],[-9.31642,63.62673],[-8.4375,67.33987],[-18.28125,68.39918],[-24.16992,67.27203]]]]}});let v=U,A;try{A=I.getLogger("eu-ets")}catch{}finally{}const q={2024:.4,2025:.7,2026:1};var b=(R=>(R[R.PROP5=.99]="PROP5",R[R.PROP10=.97]="PROP10",R[R.PROP15=.95]="PROP15",R))(b||{});const h={DGO_Factor:{co2:3.206,ch4:5e-5,n2o:18e-5,lcv:.0427,wtt:14.4},MDO_Factor:{co2:3.206,ch4:5e-5,n2o:18e-5,lcv:.0427,wtt:14.4},MGO_Factor:{co2:3.206,ch4:5e-5,n2o:18e-5,lcv:.0427,wtt:14.4},HFO_Factor:{co2:3.114,ch4:5e-5,n2o:18e-5,lcv:.0405,wtt:13.5},LFO_Factor:{co2:3.151,ch4:5e-5,n2o:18e-5,lcv:.041,wtt:13.2},LNG_OTTO_MEDIUM_SPD_Factor:{co2:2.75,ch4:0,n2o:11e-5,cj:3.1,lcv:.0491,wtt:18.5},LNG_OTTO_SLOW_SPD_Factor:{co2:2.75,ch4:0,n2o:11e-5,cj:1.7,lcv:.0491,wtt:18.5},LNG_DIESEL_SLOW_SPD_Factor:{co2:2.75,ch4:0,n2o:11e-5,cj:.2,lcv:.0491,wtt:18.5},LNG_LBSI_Factor:{co2:2.75,ch4:0,n2o:11e-5,cj:2.6,lcv:.0491,wtt:18.5},ETHANE_Factor:{co2:2.927,ch4:5e-5,n2o:18e-5,lcv:.0464,wtt:18.5},LPG_PROPANE_Factor:{co2:3,ch4:5e-5,n2o:18e-5,lcv:.046,wtt:7.8},LPG_BUTANE_Factor:{co2:3.03,ch4:5e-5,n2o:18e-5,lcv:.046,wtt:7.8},METHANOL_Factor:{co2:1.375,ch4:5e-5,n2o:18e-5,lcv:.0199,wtt:31.3},CUSTOM_Factor:{co2:3.114,ch4:5e-5,n2o:18e-5,lcv:.0405,wtt:13.5,E:90.389}},T={CO2:1,CH4:28,N2O:265},j={CO2:1,CH4:25,N2O:298};var K=(R=>(R.HFO="HFO",R.LFO="LFO",R.LSFO="LSFO",R.DGO="DGO",R.MGO="MGO",R.MDO="MDO",R.LNG_OTTO_MEDIUM_SPD="LNG_OTTO_MEDIUM_SPD",R.LNG_OTTO_SLOW_SPD="LNG_OTTO_SLOW_SPD",R.LNG_DIESEL_SLOW_SPD="LNG_DIESEL_SLOW_SPD",R.LNG_LBSI="LNG_LBSI",R.LPG="LPG",R.LNG="LNG",R.METHANOL="METHANOL",R.BIODIESEL="BIODIESEL",R))(K||{}),V=(R=>(R.EU_MRV_Non_EU="Non EU",R.EU_MRV_Arrived_EU="Arrived EU",R.EU_MRV_Departed_EU="Departed EU",R.EU_MRV_Between_EU="Between EU",R))(V||{});class W{static calculateMRV(e,t,n,l,c){let a=0,i=0;return n?c?(a=e*(1-n/100)*t+e*(n/100),i=((1-n/100)*t+n/100)/l):(a=e*(1-n/100)*t,i=(1-n/100)*t/l):(a=e*t,i=t/l),{mrv:a,ttw:i}}static calculateWtT(e){let t=0;return e.wtt?t=e.wtt:e.E&&e.lcv&&(t=e.E-e.co2/e.lcv),t}static calculateCO2MRV(e,t,n,l={}){const c=h[`${t}_Factor`]||h.CUSTOM_Factor,a=(n==null?void 0:n.co2)||c.co2,i=(n==null?void 0:n.cj)||c.cj,s=(n==null?void 0:n.lcv)||c.lcv,{mrv:r,ttw:o}=this.calculateMRV(e,a,i,s||0);return A==null||A.info("[%s] co2 emission: %j",l.requireId,{cons:e,type:t,factor:c,customFactor:n,mrv:r,ttw:o}),{mrv:Math.round(r*T.CO2*1e3)/1e3,ttw:Math.round(o*j.CO2*1e3)/1e3}}static calculateCH4MRV(e,t,n,l={}){const c=h[`${t}_Factor`]||h.CUSTOM_Factor,a=(n==null?void 0:n.ch4)||c.ch4,i=(n==null?void 0:n.cj)||c.cj,s=(n==null?void 0:n.lcv)||c.lcv,{mrv:r,ttw:o}=this.calculateMRV(e,a||0,i,s||0,!0);return A==null||A.info("[%s] ch4 emission: %j",l.requireId,{cons:e,type:t,factor:c,customFactor:n,mrv:r,ttw:o}),{mrv:Math.round(r*T.CH4*1e3)/1e3,ttw:Math.round(o*j.CH4*1e3)/1e3}}static calculateN2OMRV(e,t,n,l={}){const c=h[`${t}_Factor`]||h.CUSTOM_Factor,a=(n==null?void 0:n.n2o)||c.n2o,i=(n==null?void 0:n.cj)||c.cj,s=(n==null?void 0:n.lcv)||c.lcv,{mrv:r,ttw:o}=this.calculateMRV(e,a||0,i,s||0);return A==null||A.info("[%s] n2o emission: %j",l.requireId,{cons:e,type:t,factor:c,customFactor:n,mrv:r,ttw:o}),{mrv:Math.round(r*T.N2O*1e3)/1e3,ttw:Math.round(o*j.N2O*1e3)/1e3}}static calculateGHGMRV(e,t,n=64.56,l=2025,c=1,a={}){const i=this.calculateCO2MRV(e,t,a.factor),s=this.calculateCH4MRV(e,t,a.factor),r=this.calculateN2OMRV(e,t,a.factor),o=a.factor||h[`${t}_Factor`]||h.CUSTOM_Factor;let f=0,d=0,S=0;l>=2026?(d=i.mrv+s.mrv+r.mrv,S=1):(d=i.mrv,S=q[l]||0),l>=2024?f=i.mrv+s.mrv+r.mrv:f=i.mrv,f=Math.round(f*1e3)/1e3,d=Math.round(d*c*1e3)/1e3;const C=Math.round(d*S*1e3)/1e3,P=Math.round(n*C*100)/100,M=Math.round(this.calculateWtT(o)*1e3)/1e3,_=Math.round((i.ttw+s.ttw+r.ttw)*1e3)/1e3,H=o.lcv||0,y=Math.round(e*H*c*1e3)/1e3;return{ghg:f,ghg2:d,euas:C,price:n,year:l,radio:S,cost:P,energy:y,lcv:H,wtt:M,ttw:_,co2:i,ch4:s,n2o:r}}static calculateGHGMRV2(e,t=2025,n=64.56,l={}){let c=0,a=0,i=0,s=0,r=0,o=0;const f=new Map;for(const N of e){const u=this.calculateGHGMRV(N.cons,N.type,n,t,N.areaRate,{requireId:l.requireId,factor:N.customFactor});c=Math.round((c+u.ghg2)*1e3)/1e3,a=Math.round((a+u.euas)*1e3)/1e3,i=Math.round((i+u.cost)*1e3)/1e3,s=Math.round((s+u.energy)*1e3)/1e3,r=Math.round((r+u.wtt*u.energy)*1e3)/1e3,o=Math.round((o+u.ttw*u.energy)*1e3)/1e3;const O=f.get(N.type)||{cons:0,ghg2:0,euas:0,cost:0,energy:0,wtt:0,ttw:{total:0,co2:0,ch4:0,n2o:0},lcv:0,wtw:0,type:N.type,wttEmission:0,ttwEmission:0};O.cons=Math.round((O.cons+N.cons)*1e3)/1e3,O.ghg2=Math.round((O.ghg2+u.ghg2)*1e3)/1e3,O.euas=Math.round((O.euas+u.euas)*1e3)/1e3,O.cost=Math.round((O.cost+u.cost)*1e3)/1e3,O.energy=Math.round((O.energy+u.energy)*1e3)/1e3,O.lcv=u.lcv,O.wtt=u.wtt,O.ttw.total=u.ttw,O.ttw.co2=u.co2.ttw,O.ttw.ch4=u.ch4.ttw,O.ttw.n2o=u.n2o.ttw,O.wtw=Math.round((u.wtt+u.ttw)*1e3)/1e3,O.wttEmission=Math.round((O.wttEmission+u.wtt*u.energy)*1e3)/1e3,O.ttwEmission=Math.round((O.ttwEmission+u.ttw*u.energy)*1e3)/1e3,f.set(N.type,O)}const d=Array.from(f.values()),S=l.fwind||1;let C=0,P=0,M=0,_=0,H=0,y=0;return t>=2025&&(C=Math.round(r/s*1e3)/1e3,P=Math.round(o/s*1e3)/1e3,M=Math.round(S*(C+P)*1e3)/1e3,_=this.calculateGHGITarget(t),H=Math.round((_-M)*s*1e3)/1e3,y=H<0?Math.round(Math.abs(H*1e6)/(M*41e3)*2400*1e3)/1e3:0),{ghg2:c,euas:a,cost:i,energy:s,wtwEmission:Math.round((r+o)*1e3)/1e3,wttGhgi:C,ttwGhgi:P,actualGhgi:M,targetGhgi:_,balance:H,penalty:y,fwind:S,fuels:d}}static calculateGHGITarget(e){let t=91.16;return e>=2025&&(e>=2050?t=t*(1-.8):e>=2045?t=t*(1-.62):e>=2040?t=t*(1-.31):e>=2035?t=t*(1-.145):e>=2030?t=t*(1-.06):t=t*(1-.02)),Math.round(t*1e3)/1e3}static async calculateEUMRVLegCategory(e,t,n=!1,l={}){let c="Non EU";const a={departure:0,destination:0,atSea:0};if(e&&t){let i=await v.isInEU(e,l),s=await v.isInEU(t,l);n&&(i=i&&!await v.isFuelEUExclude(e,l),s=s&&!await v.isFuelEUExclude(t,l)),i&&s?(c="Between EU",a.departure=1,a.destination=1,a.atSea=1):i?(c="Departed EU",a.departure=1,a.destination=0,a.atSea=.5):s&&(c="Arrived EU",a.departure=0,a.destination=1,a.atSea=.5)}return{category:c,areaRate:a}}}let w;try{w=I.getLogger("cii")}catch{}finally{}var Y=(R=>(R.BULK_CARRIER="BULK CARRIER",R.GAS_CARRIER="GAS CARRIER",R.TANKER="TANKER",R.CONTAINER_SHIP="CONTAINER SHIP",R.GENERAL_CARGO_SHIP="GENERAL CARGO SHIP",R.REFRIGERATED_CARGO_CARRIER="REFRIGERATED CARGO CARRIER",R.COMBINATION_CARRIER="COMBINATION CARRIER",R.LNG_CARRIER="LNG CARRIER",R.RO_RO_CARGO_SHIP="RO-RO CARGO SHIP",R.RO_RO_CARGO_VEHICLE_SHIP="RO-RO CARGO VEHICLE SHIP",R.RO_RO_PASSENGER_SHIP="RO-RO PASSENGER SHIP",R.CRUISE_PASSENGER_SHIP="CRUISE PASSENGER SHIP",R))(Y||{});class G{static calculateCapacity(e,t={}){var a;const n=((a=e.type)==null?void 0:a.toUpperCase())||"BULK CARRIER",l=["BULK CARRIER","GAS CARRIER","TANKER","CONTAINER SHIP","GENERAL CARGO SHIP","REFRIGERATED CARGO CARRIER","LNG CARRIER","COMBINATION CARRIER"],c=["RO-RO CARGO SHIP","RO-RO CARGO VEHICLE SHIP","RO-RO PASSENGER SHIP","CRUISE PASSENGER SHIP"];return l.includes(n)?(w.info("[%s] use dwt as the vessel capacity: %s",t.requestId,e),e.dwt):c.includes(n)?(w.info("[%s] use gt as the vessel capacity: %s",t.requestId,e),e.gt):(w.info("[%s] use max(gt,dwt) as the vessel capacity: %s",t.requestId,e),e.dwt>e.gt?e.dwt:e.gt)}static calculateReferCII(e,t={}){var s,r;const n=G.calculateCapacity(e,t),l=((r=(s=e.type)==null?void 0:s.trim())==null?void 0:r.toUpperCase())||"BULK CARRIER";let c=0,a=0;l==="BULK CARRIER"?(c=4745,a=.622):l==="GAS CARRIER"?n>=65e3?(c=Math.pow(14405,7),a=2.071):(c=8104,a=.639):l==="TANKER"?(c=5247,a=.61):l==="CONTAINER SHIP"?(c=1984,a=.489):l==="GENERAL CARGO SHIP"?n>=2e4?(c=31948,a=.792):(c=588,a=.3885):l==="REFRIGERATED CARGO CARRIER"?(c=4600,a=.557):l==="COMBINATION CARRIER"?(c=5119,a=.622):l==="LNG CARRIER"?n>=1e5?(c=9.827,a=0):(c=Math.pow(14479,10),a=2.673):l==="RO-RO CARGO VEHICLE SHIP"?n<3e4?(c=330,a=.329):(c=3627,a=.59):l==="RO-RO CARGO SHIP"?(c=1967,a=.485):l==="RO-RO PASSENGER SHIP"?(c=2023,a=.46):l==="CRUISE PASSENGER SHIP"&&(c=930,a=.383);const i=Math.round(c*Math.pow(n,-a)*1e3)/1e3;return w.info("[%s] calculate refer cii (%d) with props: %j ",t.requestId,i,e),{referCii:i,referYear:2019}}static calculateRequiredCII(e,t,n={}){let l=0;t===2020?l=1:t===2021?l=2:t===2022?l=3:t===2023?l=5:t===2024?l=7:t===2025?l=9:t===2026&&(l=11);const c=Math.round((1-l/100)*e*1e3)/1e3;return w.info("[%s] calculate required cii (%d) with: %j",n.requestId,c,{year:t,ref:e}),{requiredCii:c,z:l,year:t,ref:e}}static calculateCO2(e,t,n={}){const{mrv:l}=W.calculateCO2MRV(e,t,n.customFactor,n);return l*Math.pow(10,6)}static calculateAttainedCII(e,t,n,l={}){const c=G.calculateCapacity(e,l),a=c*n,i=a?Math.round(t/a*1e3)/1e3:0;return w.info("[%s] calculate attained cii (%d) with: %j",l.requestId,i,{co2:t,distance:n,capacity:c}),{attainedCii:i,w:a,c:t}}static calculateGrade(e,t,n,l={}){var M,_;const c=G.calculateCapacity(e,l);let a=0,i=0,s=0,r=0;const o=((_=(M=e.type)==null?void 0:M.trim())==null?void 0:_.toUpperCase())||"BULK CARRIER";o==="BULK CARRIER"?(a=.86,i=.94,s=1.06,r=1.18):o==="GAS CARRIER"?c>=65e3?(a=.81,i=.91,s=1.12,r=1.44):(a=.85,i=.95,s=1.06,r=1.25):o==="TANKER"?(a=.82,i=.93,s=1.08,r=1.28):o==="CONTAINER SHIP"?(a=.83,i=.94,s=1.07,r=1.19):o==="GENERAL CARGO SHIP"?(a=.83,i=.94,s=1.06,r=1.19):o==="REFRIGERATED CARGO CARRIER"?(a=.78,i=.91,s=1.07,r=1.2):o==="COMBINATION CARRIER"?(a=.87,i=.96,s=1.06,r=1.14):o==="LNG CARRIER"?c>=1e5?(a=.89,i=.98,s=1.06,r=1.13):(a=.78,i=.92,s=1.1,r=1.37):o==="RO-RO CARGO VEHICLE SHIP"?(a=.86,i=.94,s=1.06,r=1.16):o==="RO-RO CARGO SHIP"?(a=.76,i=.89,s=1.08,r=1.27):o==="RO-RO PASSENGER SHIP"?(a=.76,i=.92,s=1.14,r=1.3):o==="CRUISE PASSENGER SHIP"?(a=.87,i=.95,s=1.06,r=1.16):(a=.86,i=.94,s=1.06,r=1.18);let f;const d=t*a,S=t*i,C=t*s,P=t*r;return n<=d?f="A":n<=S?f="B":n<=C?f="C":n<=P?f="D":f=a?"E":"-",w.info("[%s] calculate level (%s) with: %j",l.requestId,f,{...e,requiredCii:t,attainedCii:n,capacity:c,p1:d,p2:S,p3:C,p4:P}),{grade:f,attainedCii:n,requiredCii:t,capacity:c}}static calculateCII(e,t,n,l,c={}){const{attainedCii:a}=G.calculateAttainedCII(e,n,l,c),{referCii:i,referYear:s}=G.calculateReferCII(e,c),{requiredCii:r,z:o}=G.calculateRequiredCII(i,t,c),{grade:f,capacity:d}=G.calculateGrade(e,r,a,c);return{grade:f,attainedCii:a,requiredCii:r,referYear:s,year:t,z:o,capacity:d}}}E.CIIHelper=G,E.EUMRVLegCategory=V,E.EUTESHelper=W,E.EuBoundHelper=v,E.FuelType=K,E.GHGEmissionFactor=h,E.GWP_AR4=j,E.GWP_AR5=T,E.VesselType=Y,E.WindRewardFactor=b,E.YearRadio=q,Object.defineProperty(E,Symbol.toStringTag,{value:"Module"})});