physical-quantity 1.1.91 → 1.1.92

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/README.md CHANGED
@@ -282,6 +282,7 @@ Contributions are welcome! Please contact the developer for any bugs, features,
282
282
  ## Change Log
283
283
  | Version | Date | Description |
284
284
  |---|---|---|
285
+ | v1.1.92 |20251001| Power unit W[Watt] changed to W. |
285
286
  | v1.1.91 |20251001| Power unit Btu(AC) for air conditioner. |
286
287
  | v1.1.90 |20250120| Volume unit 'mL' to 'ml'. |
287
288
  | v1.1.88 |20241016| Code optimized. |
package/dist/pq.es.js CHANGED
@@ -165,7 +165,7 @@ const o = 0.45359237, r = 9.80665, v = 5280, l = 25.4 / 1e3, n = 12 * l, W = 185
165
165
  ],
166
166
  /* 111 */
167
167
  Power: [
168
- "W[watt]",
168
+ "W",
169
169
  "kW",
170
170
  "MW",
171
171
  "GW[Gigawatt]",
package/dist/pq.umd.js CHANGED
@@ -1,4 +1,4 @@
1
- (function(u,L){typeof exports=="object"&&typeof module<"u"?L(exports):typeof define=="function"&&define.amd?define(["exports"],L):(u=typeof globalThis<"u"?globalThis:u||self,L(u.PQWebComponents={}))})(this,function(u){"use strict";const o=.45359237,r=9.80665,H=5280,a=25.4/1e3,n=12*a,W=1852,Q=66*660,p=4.54609,g=231,I=268.8025,f=1/8,F=1/20,j=1/16,B=8,_=8,Y=1/16,X=240,Z=250,tt=10,N=14.59390294,b=1055.05585262,y=4.1868,M=4.184,R=550*o*r*n,C=101325,$=1/760,U=133.322387415,et=624150974e10,k={Length:["m","nano[nm]","µm","micron","mm","cm","dm","km","in","ft-in","thou[mil, or thousandth of an inch]","ft","yd","mile","NM[M, nmi, or nautical mile]"],Mass:["kg","g","mg","µg","oz","lbm","slug","ton(US/short)","ton(UK-Imperial/long)","tonne"],Time:["s[second]","s","minute","h","h[hour]","day","week"],ElectricalCurrent:["A","Ampere[amp]","mA","µA","kA","MA","esu/s"],Temperature:["°K","°C","°F","°Ra"],"Amount of Substance":["mol","mmol","kmol"],"Luminous Intensity":["cd[candela]","lm/sr","cp[candlepower]","cp[candlepower(before 1948)]"],Acceleration:["m/s²","m/min²","mm/s²","ft/s²","ft/min²","in/s²"],"Gravitational Constant":["m³/kg/s²","N⋅m²/kg²","dyn⋅cm²/g²"],"Velocity (Angular)":["rad/s","rad/min","rad/h","deg°/s","deg°/min","deg°/h","rpm[rev/min]","rev/s"],"Acceleration (Angular)":["rad/s²","rad/min²","deg°/s²","deg°/min²"],Illuminance:["lux","lumen/m²","lm/m²","meter-candle","phot","foot-candle","fc","lumen/ft²","lm/ft²"],Frequency:["Hz","1/s","1/min","rpm","1/hour","mHz","kHz","MHz","GHz"],Area:["m²","µm²","mm²","cm²","km²","hectare","in²","ft²","yd²","acre","mile²"],"Volume / Section Modulus":["m³","µm³","mm³","cm³","L","ml","km³","in³","ft³","yd³","gal(UK-imperial)","gal(US-liquid)","gal(US-dry)","pint(UK-imperial)","pint(US-liquid)","pint(US-dry)","fluid ounce(UK-imperial)","fluid ounce(US-liquid)","bushel(UK-imperial)","bushel(US-dry)","cup(US-liquid)","cup(Legal)","cup(Metric)","cup(Imperial)"],"Polar Moment of Inertia":["m⁴","mm⁴","cm⁴","in⁴","ft⁴"],"Moment of Inertia":["kg⋅m²","g⋅cm²","g⋅mm²","lbm⋅ft²","lbm⋅in²","oz⋅in²"],Force:["N","kN","MN","kgf","lb","lbf","kip[kilo pound]"],Angle:["radian","rad","deg°","revolution"],"Solid Angle":["sr[steradian]","m²/m²"],"BMI-Body Mass Index/Ballistic Coefficient":["kg/m²","g/cm²","g/mm²","tonne/m²","lbm/yd²","lbm/ft²","lbm/in²","oz/yd²","oz/ft²","oz/in²"],Density:["kg/m³","kg/L","g/cm³","g/mm³","lbm/ft³","lbm/in³"],Energy:["J[Joule]","kJ","MJ","GJ","TNT Equivalent[kiloton]","Btu","MM Btu","calorie(IT)","kilo-calorie(IT)","calorie(TH)","kilo-calorie(TH)","HP Hour","Wh","kWh","eV[electron-volt]"],Power:["W[watt]","kW","MW","GW[Gigawatt]","Btu/h","Btu/minute","MM Btu/h","Btu(AC)","calorie(IT)/second","calorie(IT)/minute","kilo-calorie(IT)/hour","calorie(TH)/second","calorie(TH)/minute","kilo-calorie(TH)/hour","lb-ft/second","lb-ft/minute","HP","J/second","J/minute","J/h","MJ/h","kJ/minute"],"Torque, Moment of Force":["Nm","kNm","lb-in","kip-in","lb-ft","oz-in","oz-ft"],"Pressure/Stress":["Pa","kPa","MPa","GPa","bar","mbar","atm","mm HG","cm HG","in HG","mm W.C.","m W.C.","in W.C.","psf","psi","ksi","ksi[kip/in²]"],"Pressure Drop per Unit Length":["Pa/m","Pascal/m","kPa/m","MPa/km","bar/m","mbar/mm","atm/m","mm HG/m","in HG/ft","mm W.C./m","m W.C./m","in W.C./ft","in W.C./100 ft","psf/in","psi/ft","ksi/ft","Torr/ft","mTorr/m"],"Uniformly Distributed (Uniform Line) Load | Stiffness of Linear Spring":["N/m","N/mm","kN/m","lb/ft","kips/ft","lb/in"],"Stiffness of Rotary Spring":["N⋅m/rad","N⋅m/deg°","N⋅mm/rad","N⋅mm/deg°","lb-ft/rad","lb-ft/deg°","lb-in/rad","lb-in/deg°"],"Flow Rate (Volume)":["m³/s","m³/min","m³/h","L/s","L/min","L/h","cm³/s","cm³/min","in³/s","in³/min","ft³/s","CFM","CFM[ft³/min]","CFH","CFH[ft³/h]","yd³/min","yd³/h","gpm(US)","gph(US)","bushel(UK-imperial)/h","bushel(US)/h"],"Flow Rate (Mass)":["kg/s","kg/min","kg/h","g/s","g/min","g/h","slug/s","slug/min","slug/h","lbm/s","lbm/min","lbm/h","oz/s","oz/min","oz/h","tonne/h","short ton/h","long ton/h"],"Speed / Velocity (Linear)":["m/s","mm/s","km/s","mm/min","m/min","km/min","mm/h","m/h","km/h","in/s","fps","fps[ft/second]","fpm","fpm[ft/minute]","mph[mile/h]","knot[kn, kt, or nautical mile/h]"],"Fuel Heat Value (Volume)":["J/m³","J/L","kJ/L","kJ/m³","MJ/m³","GJ/m³","cal(IT)/L","kcal(IT)/m³","cal(TH)/L","kcal(TH)/m³","Wh/L","Wh/m³","kWh/m³","HP Hour/ft³","Btu/gal(US)","Btu/ft³","MM Btu/ft³"],"Fuel Heat Value (Mass)":["J/kg","J/g","kJ/kg","MJ/kg","GJ/kg","cal(IT)/g","kcal(IT)/kg","cal(TH)/g","kcal(TH)/kg","Wh/g","Wh/kg","kWh/kg","HP Hour/lbm","Btu/lbm","MM Btu/lbm","Btu/ton(short)"],"Mass Heat Capacity":["J/(kg·°K)","J/(kg·°C)","J/(g·°K)","J/(g·°C)","Btu/(lbm·°F)"],"Viscosity - Absolute/Dynamic(μ)":["PI[Pa·s]","N·s/m²","kg/m/s","P[Poise]","cP","lb·s/ft²","lbm/ft/s"],"Viscosity - Kinematic":["m²/s","m²/min","m²/hr","St[cm²/s]","Stoke","cm²/min","cm²/hr","cSt[mm²/s]","mm²/min","mm²/hr","ft²/s","ft²/min","ft²/hr","in²/s","in²/min","in²/hr"],"Linear Thermal Expansion Coefficient":["1/°K","1/°C","1/°F","1/°Ra"],"Thermal Conductivity":["W/(m⋅°K)","W/(cm⋅°K)","BTU/(h⋅ft⋅°F)","BTU/(h⋅in⋅°F)"],"Electrical Charge":["C[coulomb]","Ah","ampere-hour","mAh","e[electron]","faraday"],"Electrical Potential Difference (Voltage)":["V","Volt","joule/coulomb","J/C","µV","mV","kV","MV"],"Electrical Resistance(Impedance)":["Ω[Ohm]","µΩ","mΩ","kΩ","MΩ"],"Electrical Capacitance":["F[farad]","pF","nF","µF","mF"],"Electrical Inductance":["H[henry]","µH","mH"],"Electrical Conductance":["S[siemens]","℧","µS","mS","kS"],"Magnetic Flux":["Wb[weber]","nWb","µWb","mWb","cWb","dWb"],"Luminous Flux":["lm[lumen]","cd⋅sr"],"Magnetic Flux Density":["T[tesla]","Wb/m²","µT","G","mT"],"Katalytic Activity":["kat[katal]","mol/s","µkat","mkat","kkat","Mkat"],Radioactivity:["Bq[becquerel]","1/s","µBq","mBq","kBq","MBq","Rd[rutherford]","Ci[curie]"],"Absorbed Dose of Ionizing Radiation":["Gy[gray]","J/kg","µGy","mGy","kGy","MGy"],"Equivalent Dose of Ionizing Radiation":["Sv[sievert]","J/kg","µSv","mSv","kSv","MSv"],"Volumetric Displacement":["m³/rad","m³/rev","L/rev","cc/rev","ft³/rev","in³/rev","gal(US-liquid)/rev"],"Fuel Economy":["km/L","mpg(US)","mile/gal(US-liquid)","mpg(UK)","mile/gal(UK-imperial)","mile/L"],"Fuel Consumption":["m³/m","L/km","L/100km","L/mile","L/100mile","gal(US-liquid)/mile","gal(US-liquid)/100mile","gal(UK-imperial)/mile","gal(UK-imperial)/100mile"],"New Energy Economy (MPGe)":["m/J","km/kWh","km/MJ","MPGe","mile/MJ","mile/kWh","mile/MM Btu"],"New Energy Consumption":["J/m","Wh/km","Wh/mile","kWh/km","kWh/100km","kWh/mile","kWh/100mile","MJ/km","MJ/100km","MJ/mile","MJ/100mile","MM Btu/km","MM Btu/100km","MM Btu/mile","MM Btu/100mile"],"Baud Rate":["bit/s","Bd","kBd","MBd","GBd"],Currency:["$","¢","$1K","$1M","$1B","$1T"],"Impulse / Momentum":["N·s","Newton-second","lb·s","kg·m/s","lbm·fps","lbm·fpm"],"Digital Storage":["bit","kilobit","kibibit","megabit","mebibit","gigabit","gibibit","terabit","tebibit","petabit","pebibit","byte","kilobyte","kibibyte","megabyte","mebibyte","gigabyte","gibibyte","terabyte","tebibyte","petabyte","pebibyte"],"Data Transfer Rate":["bit/s","kilobit/s","kibibit/s","megabit/s","mebibit/s","gigabit/s","gibibit/s","terabit/s","tebibit/s","petabit/s","pebibit/s"]},w={Length:{m:1,"nano[nm]":1/1e9,µm:1/1e6,micron:1/1e6,mm:1/1e3,cm:.01,dm:.1,km:1e3,in:a,"thou[mil, or thousandth of an inch]":a/1e3,"ft-in":a,ft:n,yd:3*n,mile:H*n,"NM[M, nmi, or nautical mile]":W},Mass:{kg:1,g:.001,mg:1/1e6,µg:1/1e9,oz:1/16*o,lbm:o,slug:N,"ton(US/short)":2e3*o,"ton(UK-Imperial/long)":2240*o,tonne:1e3},Time:{"s[second]":1,s:1,minute:60,h:3600,"h[hour]":3600,day:3600*24,week:3600*24*7},ElectricalCurrent:{A:1,"Ampere[amp]":1,mA:.001,µA:1e-6,kA:1e3,MA:1e6,"esu/s":1/3e9},Temperature:{"°K":{c0:1,c1:0},"°C":{c0:1,c1:273.15},"°F":{c0:5/9,c1:255.3722222},"°Ra":{c0:5/9,c1:0}},"Amount of Substance":{mol:1,mmol:.001,kmol:1e3},"Luminous Intensity":{"cd[candela]":1,"lm/sr":1,"cp[candlepower]":1,"cp[candlepower(before 1948)]":.981},Acceleration:{"m/s²":1,"m/min²":1/3600,"mm/s²":.001,"ft/s²":n,"ft/min²":n/3600,"in/s²":a},"Gravitational Constant":{"m³/kg/s²":1,"N⋅m²/kg²":1,"dyn⋅cm²/g²":1e3},"Velocity (Angular)":{"rad/s":1,"rad/min":1/60,"rad/h":1/3600,"deg°/s":Math.PI/180,"deg°/min":Math.PI/180/60,"deg°/h":Math.PI/180/3600,"rpm[rev/min]":2*Math.PI/60,"rev/s":2*Math.PI},"Acceleration (Angular)":{"rad/s²":1,"rad/min²":1/3600,"deg°/s²":Math.PI/180,"deg°/min²":Math.PI/180/3600},Illuminance:{lux:1,"lumen/m²":1,"lm/m²":1,"meter-candle":1,phot:1e4,"foot-candle":1/Math.pow(n,2),fc:1/Math.pow(n,2),"lumen/ft²":1/Math.pow(n,2),"lm/ft²":1/Math.pow(n,2)},Frequency:{Hz:1,"1/s":1,"1/min":1/60,rpm:1/60,"1/hour":1/3600,mHz:1/1e3,kHz:1e3,MHz:1e6,GHz:1e9},Area:{"m²":1,"µm²":Math.pow(1/1e6,2),"mm²":Math.pow(1/1e3,2),"cm²":Math.pow(1/100,2),"km²":1e6,hectare:Math.pow(100,2),"in²":Math.pow(a,2),"ft²":Math.pow(n,2),"yd²":Math.pow(n*3,2),acre:Q*Math.pow(n,2),"mile²":Math.pow(H*n,2)},"Volume / Section Modulus":{"m³":1,"µm³":Math.pow(1/1e6,3),"mm³":Math.pow(1/1e3,3),"cm³":Math.pow(1/100,3),L:1/1e3,ml:1/1e6,"km³":Math.pow(1e3,3),"in³":Math.pow(a,3),"ft³":Math.pow(n,3),"yd³":Math.pow(n*3,3),"gal(UK-imperial)":p*1/1e3,"gal(US-liquid)":g*Math.pow(a,3),"gal(US-dry)":I*Math.pow(a,3),"pint(UK-imperial)":f*p*1/1e3,"pint(US-liquid)":f*g*Math.pow(a,3),"pint(US-dry)":f*I*Math.pow(a,3),"fluid ounce(UK-imperial)":F*f*p/1e3,"fluid ounce(US-liquid)":j*f*g*Math.pow(a,3),"bushel(UK-imperial)":B*p/1e3,"bushel(US-dry)":_*I*Math.pow(a,3),"cup(US-liquid)":Y*g*Math.pow(a,3),"cup(Legal)":X*Math.pow(.01,3),"cup(Metric)":Z*Math.pow(.01,3),"cup(Imperial)":tt*F*f*p/1e3},"Polar Moment of Inertia":{"m⁴":1,"mm⁴":1e-12,"cm⁴":1e-8,"in⁴":Math.pow(a,4),"ft⁴":Math.pow(n,4)},"Moment of Inertia":{"kg⋅m²":1,"g⋅cm²":1/(1e3*1e4),"g⋅mm²":1/(1e3*1e6),"lbm⋅ft²":o*Math.pow(n,2),"lbm⋅in²":o*Math.pow(a,2),"oz⋅in²":o/16*Math.pow(a,2)},Force:{N:1,kN:1e3,MN:1e6,kgf:r,lb:o*r,lbf:o*r,"kip[kilo pound]":1e3*o*r},Angle:{radian:1,rad:1,"deg°":Math.PI/180,revolution:Math.PI*2},"Solid Angle":{"sr[steradian]":1,"m²/m²":1},"BMI-Body Mass Index/Ballistic Coefficient":{"kg/m²":1,"g/cm²":1/1e3/Math.pow(.01,2),"g/mm²":1/1e3/Math.pow(.001,2),"tonne/m²":1e3,"lbm/yd²":o/Math.pow(n*3,2),"lbm/ft²":o/Math.pow(n,2),"lbm/in²":o/Math.pow(a,2),"oz/yd²":o/16/Math.pow(3*n,2),"oz/ft²":o/16/Math.pow(n,2),"oz/in²":o/16/Math.pow(a,2)},Density:{"kg/m³":1,"kg/L":1e3,"g/cm³":1/1e3/Math.pow(.01,3),"g/mm³":1/1e3/Math.pow(.001,3),"lbm/ft³":o/Math.pow(n,3),"lbm/in³":o/Math.pow(a,3)},Energy:{"J[Joule]":1,kJ:1e3,MJ:1e6,GJ:1e9,"TNT Equivalent[kiloton]":1e9*M,Btu:b,"MM Btu":b*1e6,"calorie(IT)":y,"kilo-calorie(IT)":y*1e3,"calorie(TH)":M,"kilo-calorie(TH)":M*1e3,"HP Hour":R*3600,Wh:3600,kWh:3600*1e3,"eV{electron-volt]":1/et},Power:{W:1,kW:1e3,MW:1e6,"GW[Gigawatt]":1e9,"Btu/h":b/3600,"Btu/minute":b/60,"MM Btu/h":b*1e6/3600,"Btu(AC)":b/3600,"calorie(IT)/second":y,"calorie(IT)/minute":y/60,"kilo-calorie(IT)/hour":y*1e3/3600,"calorie(TH)/second":M,"calorie(TH)/minute":M/60,"kilo-calorie(TH)/hour":M*1e3/3600,"lb-ft/second":o*r*n,"lb-ft/minute":o*r*n/60,HP:R,"J/second":1,"J/minute":1/60,"J/h":1/3600,"MJ/h":1e6/3600,"kJ/minute":1e3/60},"Torque, Moment of Force":{Nm:1,kNm:1e3,"lb-in":o*r*a,"kip-in":1e3*o*r*a,"lb-ft":o*r*n,"oz-in":o/16*r*a,"oz-ft":o/16*r*n},"Pressure/Stress":{Pa:1,kPa:1e3,MPa:1e6,GPa:1e9,bar:100*1e3,mbar:100,atm:C,"mm HG":U,"cm HG":U*10,"in HG":U*25.4,"mm W.C.":1/1e3*1e3*r,"m W.C.":1*1e3*r,"in W.C.":a*1e3*r,psf:o*r/Math.pow(n,2),psi:o*r/Math.pow(a,2),ksi:o*r/Math.pow(a,2)*1e3,"ksi{kip/in²]":o*r/Math.pow(a,2)*1e3},"Pressure Drop per Unit Length":{"Pa/m":1,"Pascal/m":1,"kPa/m":1e3,"MPa/km":1e6/1e3,"bar/m":1e5,"mbar/mm":100*1e3,"atm/m":C,"mm HG/m":U,"in HG/ft":U*25.4/n,"mm W.C./m":1/1e3*1e3*r,"m W.C./m":1e3*r,"in W.C./ft":a*1e3*r/n,"in W.C./100 ft":a*1e3*r/n/100,"psf/in":o*r/Math.pow(n,2)/a,"psi/ft":o*r/Math.pow(n,2)/n,"ksi/ft":o*r/Math.pow(n,2)/n*1e3,"Torr/ft":$*C/n,"mTorr/m":$*C/1e3},"Uniformly Distributed (Uniform Line) Load | Stiffness of Linear Spring":{"N/m":1,"N/mm":1e3,"kN/m":1e3,"lb/ft":o*r/n,"kips/ft":1e3*o*r/n,"lb/in":o*r/a},"Stiffness of Rotary Spring":{"N⋅m/rad":1,"N⋅m/deg°":1/Math.PI*180,"N⋅mm/rad":1/1e3,"N⋅mm/deg°":1/1e3/Math.PI*180,"lb-ft/rad":o*r*n,"lb-ft/deg°":o*r*n/(Math.PI/180),"lb-in/rad":o*r*a,"lb-in/deg°":o*r*a/(Math.PI/180)},"Flow Rate (Volume)":{"m³/s":1,"m³/min":1/60,"m³/h":1/3600,"L/s":1/1e3,"L/min":1/1e3/60,"L/h":1/1e3/3600,"cm³/s":1e-6,"cm³/min":1e-6/60,"in³/s":Math.pow(a,3),"in³/min":Math.pow(a,3)/60,"ft³/s":Math.pow(n,3),CFM:Math.pow(n,3)/60,"CFM[ft³/min]":Math.pow(n,3)/60,CFH:Math.pow(n,3)/3600,"CFH[ft³/h]":Math.pow(n,3)/3600,"yd³/min":Math.pow(n*3,3)/60,"yd³/h":Math.pow(n*3,3)/3600,"gpm(US)":g*Math.pow(a,3)/60,"gph(US)":g*Math.pow(a,3)/3600,"bushel(UK-imperial)/h":B*p/1e3/3600,"bushel(US)/h":_*I*Math.pow(a,3)/3600},"Flow Rate (Mass)":{"kg/s":1,"kg/min":1/60,"kg/h":1/3600,"g/s":1/1e3,"g/min":1/1e3/60,"g/h":1/1e3/3600,"slug/s":N,"slug/min":N/60,"slug/h":N/3600,"lbm/s":o,"lbm/min":o/60,"lbm/h":o/3600,"oz/s":o/16,"oz/min":o/16/60,"oz/h":o/16/3600,"tonne/h":1e3/3600,"short ton/h":2e3*o/3600,"long ton/h":2240*o/3600},"Speed / Velocity (Linear)":{"m/s":1,"mm/s":1/1e3,"km/s":1,"mm/min":1/1e3/60,"m/min":1/60,"km/min":1e3/60,"mm/h":1/1e3/3600,"m/h":1/3600,"km/h":1e3/3600,"in/s":a,fps:n,"fps[ft/second]":n,fpm:n/60,"fpm[ft/minute]":n/60,"mph[mile/h]":H*n/3600,"knot[kn, kt, or nautical mile/h]":W/3600},"Electrical Potential Difference (Voltage)":{V:1,Volt:1,"joule/coulomb":1,"J/C":1,µV:1/1e6,mV:1/1e3,kV:1e3,MV:1e6}},T=l=>{if(console.log("getUnitCategory called with unit:",l),!l)return console.warn("Unit is undefined or null"),"Custom";for(const t in k)if(k[t].includes(l))return console.log(`Category found for unit ${l}:`,t),t;return console.warn(`No category found for unit: ${l}`),"Custom"},d=(l,t,e,i)=>{if(t==="ft-in"&&e!=="ft-in")return it(l,e);if(t!=="ft-in"&&e==="ft-in")return nt(l,t);if(i!=="Temperature"){const s=w[i][t]/w[i][e];return l*s}else{const s=w[i][t].c0,m=w[i][t].c1,c=w[i][e].c0,h=w[i][e].c1;return(l*s+m-h)/c}},O=(l,t)=>{let e;if(Number.isInteger(l)?e=l.toString():e=l.toFixed(t).replace(/\.?0+$/,""),Math.abs(parseFloat(e))>=1e3){const i=e.split(".");i[0]=i[0].replace(/\B(?=(\d{3})+(?!\d))/g,","),e=i.join(".")}return e},P=l=>{const t=/(\d+)\'(\s*-\s*)?(\d+)?(\s+)?(\d+)?\/?(\d+)?/,e=/(\d+)\'/,i=/(\d+)/;let s=l.match(t);if(s){const m=parseInt(s[1])||0,c=parseInt(s[3])||0,h=parseInt(s[5])||0,v=parseInt(s[6])||1;return D(m,c,h,v)}if(s=l.match(e),s){const m=parseInt(s[1])||0;return D(m,0,0,1)}if(s=l.match(i),s){const m=parseInt(s[1])||0;return D(0,m,0,1)}return parseFloat(l)},D=(l,t,e,i)=>l*12+t+e/i,S=(l,t='1/16"')=>{if(l<0)return`-${S(-l,t)}`;const e=parseInt(t.split("/")[1].replace('"',""));let i=Math.floor(l/12),s=Math.floor(l%12);const m=l-Math.floor(l);let c="";if(m>0&&t!==0){let v=Math.round(m*e);const q=(K,x)=>x?q(x,K%x):K,z=q(v,e);c=` ${v/z}/${e/z}`,c.trim()==="1/1"&&(s++,s>=12&&(i++,s-=12),c="")}let h="";return i>0&&(h+=`${i}'`),i>0&&(s>0||c!=="")&&(h+="-"),s>0&&(h+=`${s}`),c!==""&&(h+=c),(s>0||c!=="")&&(h+='"'),h.trim()},it=(l,t)=>{const e=l*.0254;return d(e,"m",t,"Length")},nt=(l,t)=>d(l,t,"m","Length")/.0254;class E extends HTMLElement{constructor(){super(),this.attachShadow({mode:"open"}),this.tooltipTimeout=null,this.unitCategory="",this.e3dLogoUrl="https://firebasestorage.googleapis.com/v0/b/auto-calc-80237.appspot.com/o/shared%2Fassets%2Fimages%2Fe3d-logo2.png?alt=media&token=7064f466-6168-4b8a-b921-4e86115cb492",console.log("PhysicalQuantity constructor called")}connectedCallback(){console.log("connectedCallback called"),this.unit=this.getAttribute("unit"),console.log("Initial unit:",this.unit),this.updateUnitCategory(),this.inputValue=this.getAttribute("value"),console.log("Initial inputValue:",this.inputValue),this.value=this.parseValue(this.inputValue,this.unit),console.log("Parsed value:",this.value),this.decimalPlaces=parseInt(this.getAttribute("decimal-places"))||2,this.showUnitArrow=!this.hasAttribute("show-unit-arrow")||this.getAttribute("show-unit-arrow")==="true",console.log("Initial state:",{unit:this.unit,value:this.value,unitCategory:this.unitCategory,decimalPlaces:this.decimalPlaces,showUnitArrow:this.showUnitArrow}),this.render(),this.attachEventListeners()}disconnectedCallback(){this.removeEventListeners()}static get observedAttributes(){return["value","unit","decimal-places","show-unit-arrow"]}attributeChangedCallback(t,e,i){if(console.log(`attributeChangedCallback called: ${t}`,{oldValue:e,newValue:i}),t==="value")this.inputValue=i||"0",this.value=this.parseValue(this.inputValue,this.unit),console.log("New value parsed:",this.value);else if(t==="unit"){const s=this.unit,m=this.unitCategory;this.unit=i||"mm",this.updateUnitCategory(),s!==this.unit&&(m===this.unitCategory?(console.log("Converting value:",{from:s,to:this.unit,value:this.value,unitCategory:this.unitCategory}),this.value=d({value:this.value,fromUnit:s,toUnit:this.unit,unitCategory:this.unitCategory})):console.log("Unit category changed, keeping original value"),console.log("New value:",this.value))}else t==="decimal-places"?(this.decimalPlaces=parseInt(i)||2,console.log("New decimal places:",this.decimalPlaces)):t==="show-unit-arrow"&&(this.showUnitArrow=i===null||i==="true",console.log("Show unit arrow:",this.showUnitArrow));this.render()}updateUnitCategory(){console.log("updateUnitCategory called with unit:",this.unit),this.unitCategory=T(this.unit),console.log("Updated unit category:",this.unitCategory)}parseValue(t,e){if(console.log("parseValue called with:",{value:t,unit:e}),typeof t=="string"&&t.trim()==="")return console.log("Empty string value, returning 0"),0;const i=e==="ft-in"?P(t):parseFloat(t)||0;return console.log("Parsed value:",i),i}formatDisplayValue(){return this.unit==="ft-in"?S(this.value):O(this.value,this.decimalPlaces)}handleUnitChange(t){if(t.target.tagName==="SELECT"){const e=t.target.value;console.log("handleUnitChange:",{from:this.unit,to:e,value:this.value,unitCategory:this.unitCategory}),this.value=d(this.value,this.unit,e,this.unitCategory),console.log("Converted value:",this.value),this.unit=e,this.updateUnitCategory(),this.render()}this.updateDropdownWidth()}render(){const t=this.formatDisplayValue();this.shadowRoot.innerHTML=`
1
+ (function(u,L){typeof exports=="object"&&typeof module<"u"?L(exports):typeof define=="function"&&define.amd?define(["exports"],L):(u=typeof globalThis<"u"?globalThis:u||self,L(u.PQWebComponents={}))})(this,function(u){"use strict";const o=.45359237,r=9.80665,H=5280,a=25.4/1e3,n=12*a,W=1852,Q=66*660,p=4.54609,g=231,I=268.8025,f=1/8,F=1/20,j=1/16,B=8,_=8,Y=1/16,X=240,Z=250,tt=10,N=14.59390294,b=1055.05585262,y=4.1868,M=4.184,R=550*o*r*n,C=101325,$=1/760,U=133.322387415,et=624150974e10,k={Length:["m","nano[nm]","µm","micron","mm","cm","dm","km","in","ft-in","thou[mil, or thousandth of an inch]","ft","yd","mile","NM[M, nmi, or nautical mile]"],Mass:["kg","g","mg","µg","oz","lbm","slug","ton(US/short)","ton(UK-Imperial/long)","tonne"],Time:["s[second]","s","minute","h","h[hour]","day","week"],ElectricalCurrent:["A","Ampere[amp]","mA","µA","kA","MA","esu/s"],Temperature:["°K","°C","°F","°Ra"],"Amount of Substance":["mol","mmol","kmol"],"Luminous Intensity":["cd[candela]","lm/sr","cp[candlepower]","cp[candlepower(before 1948)]"],Acceleration:["m/s²","m/min²","mm/s²","ft/s²","ft/min²","in/s²"],"Gravitational Constant":["m³/kg/s²","N⋅m²/kg²","dyn⋅cm²/g²"],"Velocity (Angular)":["rad/s","rad/min","rad/h","deg°/s","deg°/min","deg°/h","rpm[rev/min]","rev/s"],"Acceleration (Angular)":["rad/s²","rad/min²","deg°/s²","deg°/min²"],Illuminance:["lux","lumen/m²","lm/m²","meter-candle","phot","foot-candle","fc","lumen/ft²","lm/ft²"],Frequency:["Hz","1/s","1/min","rpm","1/hour","mHz","kHz","MHz","GHz"],Area:["m²","µm²","mm²","cm²","km²","hectare","in²","ft²","yd²","acre","mile²"],"Volume / Section Modulus":["m³","µm³","mm³","cm³","L","ml","km³","in³","ft³","yd³","gal(UK-imperial)","gal(US-liquid)","gal(US-dry)","pint(UK-imperial)","pint(US-liquid)","pint(US-dry)","fluid ounce(UK-imperial)","fluid ounce(US-liquid)","bushel(UK-imperial)","bushel(US-dry)","cup(US-liquid)","cup(Legal)","cup(Metric)","cup(Imperial)"],"Polar Moment of Inertia":["m⁴","mm⁴","cm⁴","in⁴","ft⁴"],"Moment of Inertia":["kg⋅m²","g⋅cm²","g⋅mm²","lbm⋅ft²","lbm⋅in²","oz⋅in²"],Force:["N","kN","MN","kgf","lb","lbf","kip[kilo pound]"],Angle:["radian","rad","deg°","revolution"],"Solid Angle":["sr[steradian]","m²/m²"],"BMI-Body Mass Index/Ballistic Coefficient":["kg/m²","g/cm²","g/mm²","tonne/m²","lbm/yd²","lbm/ft²","lbm/in²","oz/yd²","oz/ft²","oz/in²"],Density:["kg/m³","kg/L","g/cm³","g/mm³","lbm/ft³","lbm/in³"],Energy:["J[Joule]","kJ","MJ","GJ","TNT Equivalent[kiloton]","Btu","MM Btu","calorie(IT)","kilo-calorie(IT)","calorie(TH)","kilo-calorie(TH)","HP Hour","Wh","kWh","eV[electron-volt]"],Power:["W","kW","MW","GW[Gigawatt]","Btu/h","Btu/minute","MM Btu/h","Btu(AC)","calorie(IT)/second","calorie(IT)/minute","kilo-calorie(IT)/hour","calorie(TH)/second","calorie(TH)/minute","kilo-calorie(TH)/hour","lb-ft/second","lb-ft/minute","HP","J/second","J/minute","J/h","MJ/h","kJ/minute"],"Torque, Moment of Force":["Nm","kNm","lb-in","kip-in","lb-ft","oz-in","oz-ft"],"Pressure/Stress":["Pa","kPa","MPa","GPa","bar","mbar","atm","mm HG","cm HG","in HG","mm W.C.","m W.C.","in W.C.","psf","psi","ksi","ksi[kip/in²]"],"Pressure Drop per Unit Length":["Pa/m","Pascal/m","kPa/m","MPa/km","bar/m","mbar/mm","atm/m","mm HG/m","in HG/ft","mm W.C./m","m W.C./m","in W.C./ft","in W.C./100 ft","psf/in","psi/ft","ksi/ft","Torr/ft","mTorr/m"],"Uniformly Distributed (Uniform Line) Load | Stiffness of Linear Spring":["N/m","N/mm","kN/m","lb/ft","kips/ft","lb/in"],"Stiffness of Rotary Spring":["N⋅m/rad","N⋅m/deg°","N⋅mm/rad","N⋅mm/deg°","lb-ft/rad","lb-ft/deg°","lb-in/rad","lb-in/deg°"],"Flow Rate (Volume)":["m³/s","m³/min","m³/h","L/s","L/min","L/h","cm³/s","cm³/min","in³/s","in³/min","ft³/s","CFM","CFM[ft³/min]","CFH","CFH[ft³/h]","yd³/min","yd³/h","gpm(US)","gph(US)","bushel(UK-imperial)/h","bushel(US)/h"],"Flow Rate (Mass)":["kg/s","kg/min","kg/h","g/s","g/min","g/h","slug/s","slug/min","slug/h","lbm/s","lbm/min","lbm/h","oz/s","oz/min","oz/h","tonne/h","short ton/h","long ton/h"],"Speed / Velocity (Linear)":["m/s","mm/s","km/s","mm/min","m/min","km/min","mm/h","m/h","km/h","in/s","fps","fps[ft/second]","fpm","fpm[ft/minute]","mph[mile/h]","knot[kn, kt, or nautical mile/h]"],"Fuel Heat Value (Volume)":["J/m³","J/L","kJ/L","kJ/m³","MJ/m³","GJ/m³","cal(IT)/L","kcal(IT)/m³","cal(TH)/L","kcal(TH)/m³","Wh/L","Wh/m³","kWh/m³","HP Hour/ft³","Btu/gal(US)","Btu/ft³","MM Btu/ft³"],"Fuel Heat Value (Mass)":["J/kg","J/g","kJ/kg","MJ/kg","GJ/kg","cal(IT)/g","kcal(IT)/kg","cal(TH)/g","kcal(TH)/kg","Wh/g","Wh/kg","kWh/kg","HP Hour/lbm","Btu/lbm","MM Btu/lbm","Btu/ton(short)"],"Mass Heat Capacity":["J/(kg·°K)","J/(kg·°C)","J/(g·°K)","J/(g·°C)","Btu/(lbm·°F)"],"Viscosity - Absolute/Dynamic(μ)":["PI[Pa·s]","N·s/m²","kg/m/s","P[Poise]","cP","lb·s/ft²","lbm/ft/s"],"Viscosity - Kinematic":["m²/s","m²/min","m²/hr","St[cm²/s]","Stoke","cm²/min","cm²/hr","cSt[mm²/s]","mm²/min","mm²/hr","ft²/s","ft²/min","ft²/hr","in²/s","in²/min","in²/hr"],"Linear Thermal Expansion Coefficient":["1/°K","1/°C","1/°F","1/°Ra"],"Thermal Conductivity":["W/(m⋅°K)","W/(cm⋅°K)","BTU/(h⋅ft⋅°F)","BTU/(h⋅in⋅°F)"],"Electrical Charge":["C[coulomb]","Ah","ampere-hour","mAh","e[electron]","faraday"],"Electrical Potential Difference (Voltage)":["V","Volt","joule/coulomb","J/C","µV","mV","kV","MV"],"Electrical Resistance(Impedance)":["Ω[Ohm]","µΩ","mΩ","kΩ","MΩ"],"Electrical Capacitance":["F[farad]","pF","nF","µF","mF"],"Electrical Inductance":["H[henry]","µH","mH"],"Electrical Conductance":["S[siemens]","℧","µS","mS","kS"],"Magnetic Flux":["Wb[weber]","nWb","µWb","mWb","cWb","dWb"],"Luminous Flux":["lm[lumen]","cd⋅sr"],"Magnetic Flux Density":["T[tesla]","Wb/m²","µT","G","mT"],"Katalytic Activity":["kat[katal]","mol/s","µkat","mkat","kkat","Mkat"],Radioactivity:["Bq[becquerel]","1/s","µBq","mBq","kBq","MBq","Rd[rutherford]","Ci[curie]"],"Absorbed Dose of Ionizing Radiation":["Gy[gray]","J/kg","µGy","mGy","kGy","MGy"],"Equivalent Dose of Ionizing Radiation":["Sv[sievert]","J/kg","µSv","mSv","kSv","MSv"],"Volumetric Displacement":["m³/rad","m³/rev","L/rev","cc/rev","ft³/rev","in³/rev","gal(US-liquid)/rev"],"Fuel Economy":["km/L","mpg(US)","mile/gal(US-liquid)","mpg(UK)","mile/gal(UK-imperial)","mile/L"],"Fuel Consumption":["m³/m","L/km","L/100km","L/mile","L/100mile","gal(US-liquid)/mile","gal(US-liquid)/100mile","gal(UK-imperial)/mile","gal(UK-imperial)/100mile"],"New Energy Economy (MPGe)":["m/J","km/kWh","km/MJ","MPGe","mile/MJ","mile/kWh","mile/MM Btu"],"New Energy Consumption":["J/m","Wh/km","Wh/mile","kWh/km","kWh/100km","kWh/mile","kWh/100mile","MJ/km","MJ/100km","MJ/mile","MJ/100mile","MM Btu/km","MM Btu/100km","MM Btu/mile","MM Btu/100mile"],"Baud Rate":["bit/s","Bd","kBd","MBd","GBd"],Currency:["$","¢","$1K","$1M","$1B","$1T"],"Impulse / Momentum":["N·s","Newton-second","lb·s","kg·m/s","lbm·fps","lbm·fpm"],"Digital Storage":["bit","kilobit","kibibit","megabit","mebibit","gigabit","gibibit","terabit","tebibit","petabit","pebibit","byte","kilobyte","kibibyte","megabyte","mebibyte","gigabyte","gibibyte","terabyte","tebibyte","petabyte","pebibyte"],"Data Transfer Rate":["bit/s","kilobit/s","kibibit/s","megabit/s","mebibit/s","gigabit/s","gibibit/s","terabit/s","tebibit/s","petabit/s","pebibit/s"]},w={Length:{m:1,"nano[nm]":1/1e9,µm:1/1e6,micron:1/1e6,mm:1/1e3,cm:.01,dm:.1,km:1e3,in:a,"thou[mil, or thousandth of an inch]":a/1e3,"ft-in":a,ft:n,yd:3*n,mile:H*n,"NM[M, nmi, or nautical mile]":W},Mass:{kg:1,g:.001,mg:1/1e6,µg:1/1e9,oz:1/16*o,lbm:o,slug:N,"ton(US/short)":2e3*o,"ton(UK-Imperial/long)":2240*o,tonne:1e3},Time:{"s[second]":1,s:1,minute:60,h:3600,"h[hour]":3600,day:3600*24,week:3600*24*7},ElectricalCurrent:{A:1,"Ampere[amp]":1,mA:.001,µA:1e-6,kA:1e3,MA:1e6,"esu/s":1/3e9},Temperature:{"°K":{c0:1,c1:0},"°C":{c0:1,c1:273.15},"°F":{c0:5/9,c1:255.3722222},"°Ra":{c0:5/9,c1:0}},"Amount of Substance":{mol:1,mmol:.001,kmol:1e3},"Luminous Intensity":{"cd[candela]":1,"lm/sr":1,"cp[candlepower]":1,"cp[candlepower(before 1948)]":.981},Acceleration:{"m/s²":1,"m/min²":1/3600,"mm/s²":.001,"ft/s²":n,"ft/min²":n/3600,"in/s²":a},"Gravitational Constant":{"m³/kg/s²":1,"N⋅m²/kg²":1,"dyn⋅cm²/g²":1e3},"Velocity (Angular)":{"rad/s":1,"rad/min":1/60,"rad/h":1/3600,"deg°/s":Math.PI/180,"deg°/min":Math.PI/180/60,"deg°/h":Math.PI/180/3600,"rpm[rev/min]":2*Math.PI/60,"rev/s":2*Math.PI},"Acceleration (Angular)":{"rad/s²":1,"rad/min²":1/3600,"deg°/s²":Math.PI/180,"deg°/min²":Math.PI/180/3600},Illuminance:{lux:1,"lumen/m²":1,"lm/m²":1,"meter-candle":1,phot:1e4,"foot-candle":1/Math.pow(n,2),fc:1/Math.pow(n,2),"lumen/ft²":1/Math.pow(n,2),"lm/ft²":1/Math.pow(n,2)},Frequency:{Hz:1,"1/s":1,"1/min":1/60,rpm:1/60,"1/hour":1/3600,mHz:1/1e3,kHz:1e3,MHz:1e6,GHz:1e9},Area:{"m²":1,"µm²":Math.pow(1/1e6,2),"mm²":Math.pow(1/1e3,2),"cm²":Math.pow(1/100,2),"km²":1e6,hectare:Math.pow(100,2),"in²":Math.pow(a,2),"ft²":Math.pow(n,2),"yd²":Math.pow(n*3,2),acre:Q*Math.pow(n,2),"mile²":Math.pow(H*n,2)},"Volume / Section Modulus":{"m³":1,"µm³":Math.pow(1/1e6,3),"mm³":Math.pow(1/1e3,3),"cm³":Math.pow(1/100,3),L:1/1e3,ml:1/1e6,"km³":Math.pow(1e3,3),"in³":Math.pow(a,3),"ft³":Math.pow(n,3),"yd³":Math.pow(n*3,3),"gal(UK-imperial)":p*1/1e3,"gal(US-liquid)":g*Math.pow(a,3),"gal(US-dry)":I*Math.pow(a,3),"pint(UK-imperial)":f*p*1/1e3,"pint(US-liquid)":f*g*Math.pow(a,3),"pint(US-dry)":f*I*Math.pow(a,3),"fluid ounce(UK-imperial)":F*f*p/1e3,"fluid ounce(US-liquid)":j*f*g*Math.pow(a,3),"bushel(UK-imperial)":B*p/1e3,"bushel(US-dry)":_*I*Math.pow(a,3),"cup(US-liquid)":Y*g*Math.pow(a,3),"cup(Legal)":X*Math.pow(.01,3),"cup(Metric)":Z*Math.pow(.01,3),"cup(Imperial)":tt*F*f*p/1e3},"Polar Moment of Inertia":{"m⁴":1,"mm⁴":1e-12,"cm⁴":1e-8,"in⁴":Math.pow(a,4),"ft⁴":Math.pow(n,4)},"Moment of Inertia":{"kg⋅m²":1,"g⋅cm²":1/(1e3*1e4),"g⋅mm²":1/(1e3*1e6),"lbm⋅ft²":o*Math.pow(n,2),"lbm⋅in²":o*Math.pow(a,2),"oz⋅in²":o/16*Math.pow(a,2)},Force:{N:1,kN:1e3,MN:1e6,kgf:r,lb:o*r,lbf:o*r,"kip[kilo pound]":1e3*o*r},Angle:{radian:1,rad:1,"deg°":Math.PI/180,revolution:Math.PI*2},"Solid Angle":{"sr[steradian]":1,"m²/m²":1},"BMI-Body Mass Index/Ballistic Coefficient":{"kg/m²":1,"g/cm²":1/1e3/Math.pow(.01,2),"g/mm²":1/1e3/Math.pow(.001,2),"tonne/m²":1e3,"lbm/yd²":o/Math.pow(n*3,2),"lbm/ft²":o/Math.pow(n,2),"lbm/in²":o/Math.pow(a,2),"oz/yd²":o/16/Math.pow(3*n,2),"oz/ft²":o/16/Math.pow(n,2),"oz/in²":o/16/Math.pow(a,2)},Density:{"kg/m³":1,"kg/L":1e3,"g/cm³":1/1e3/Math.pow(.01,3),"g/mm³":1/1e3/Math.pow(.001,3),"lbm/ft³":o/Math.pow(n,3),"lbm/in³":o/Math.pow(a,3)},Energy:{"J[Joule]":1,kJ:1e3,MJ:1e6,GJ:1e9,"TNT Equivalent[kiloton]":1e9*M,Btu:b,"MM Btu":b*1e6,"calorie(IT)":y,"kilo-calorie(IT)":y*1e3,"calorie(TH)":M,"kilo-calorie(TH)":M*1e3,"HP Hour":R*3600,Wh:3600,kWh:3600*1e3,"eV{electron-volt]":1/et},Power:{W:1,kW:1e3,MW:1e6,"GW[Gigawatt]":1e9,"Btu/h":b/3600,"Btu/minute":b/60,"MM Btu/h":b*1e6/3600,"Btu(AC)":b/3600,"calorie(IT)/second":y,"calorie(IT)/minute":y/60,"kilo-calorie(IT)/hour":y*1e3/3600,"calorie(TH)/second":M,"calorie(TH)/minute":M/60,"kilo-calorie(TH)/hour":M*1e3/3600,"lb-ft/second":o*r*n,"lb-ft/minute":o*r*n/60,HP:R,"J/second":1,"J/minute":1/60,"J/h":1/3600,"MJ/h":1e6/3600,"kJ/minute":1e3/60},"Torque, Moment of Force":{Nm:1,kNm:1e3,"lb-in":o*r*a,"kip-in":1e3*o*r*a,"lb-ft":o*r*n,"oz-in":o/16*r*a,"oz-ft":o/16*r*n},"Pressure/Stress":{Pa:1,kPa:1e3,MPa:1e6,GPa:1e9,bar:100*1e3,mbar:100,atm:C,"mm HG":U,"cm HG":U*10,"in HG":U*25.4,"mm W.C.":1/1e3*1e3*r,"m W.C.":1*1e3*r,"in W.C.":a*1e3*r,psf:o*r/Math.pow(n,2),psi:o*r/Math.pow(a,2),ksi:o*r/Math.pow(a,2)*1e3,"ksi{kip/in²]":o*r/Math.pow(a,2)*1e3},"Pressure Drop per Unit Length":{"Pa/m":1,"Pascal/m":1,"kPa/m":1e3,"MPa/km":1e6/1e3,"bar/m":1e5,"mbar/mm":100*1e3,"atm/m":C,"mm HG/m":U,"in HG/ft":U*25.4/n,"mm W.C./m":1/1e3*1e3*r,"m W.C./m":1e3*r,"in W.C./ft":a*1e3*r/n,"in W.C./100 ft":a*1e3*r/n/100,"psf/in":o*r/Math.pow(n,2)/a,"psi/ft":o*r/Math.pow(n,2)/n,"ksi/ft":o*r/Math.pow(n,2)/n*1e3,"Torr/ft":$*C/n,"mTorr/m":$*C/1e3},"Uniformly Distributed (Uniform Line) Load | Stiffness of Linear Spring":{"N/m":1,"N/mm":1e3,"kN/m":1e3,"lb/ft":o*r/n,"kips/ft":1e3*o*r/n,"lb/in":o*r/a},"Stiffness of Rotary Spring":{"N⋅m/rad":1,"N⋅m/deg°":1/Math.PI*180,"N⋅mm/rad":1/1e3,"N⋅mm/deg°":1/1e3/Math.PI*180,"lb-ft/rad":o*r*n,"lb-ft/deg°":o*r*n/(Math.PI/180),"lb-in/rad":o*r*a,"lb-in/deg°":o*r*a/(Math.PI/180)},"Flow Rate (Volume)":{"m³/s":1,"m³/min":1/60,"m³/h":1/3600,"L/s":1/1e3,"L/min":1/1e3/60,"L/h":1/1e3/3600,"cm³/s":1e-6,"cm³/min":1e-6/60,"in³/s":Math.pow(a,3),"in³/min":Math.pow(a,3)/60,"ft³/s":Math.pow(n,3),CFM:Math.pow(n,3)/60,"CFM[ft³/min]":Math.pow(n,3)/60,CFH:Math.pow(n,3)/3600,"CFH[ft³/h]":Math.pow(n,3)/3600,"yd³/min":Math.pow(n*3,3)/60,"yd³/h":Math.pow(n*3,3)/3600,"gpm(US)":g*Math.pow(a,3)/60,"gph(US)":g*Math.pow(a,3)/3600,"bushel(UK-imperial)/h":B*p/1e3/3600,"bushel(US)/h":_*I*Math.pow(a,3)/3600},"Flow Rate (Mass)":{"kg/s":1,"kg/min":1/60,"kg/h":1/3600,"g/s":1/1e3,"g/min":1/1e3/60,"g/h":1/1e3/3600,"slug/s":N,"slug/min":N/60,"slug/h":N/3600,"lbm/s":o,"lbm/min":o/60,"lbm/h":o/3600,"oz/s":o/16,"oz/min":o/16/60,"oz/h":o/16/3600,"tonne/h":1e3/3600,"short ton/h":2e3*o/3600,"long ton/h":2240*o/3600},"Speed / Velocity (Linear)":{"m/s":1,"mm/s":1/1e3,"km/s":1,"mm/min":1/1e3/60,"m/min":1/60,"km/min":1e3/60,"mm/h":1/1e3/3600,"m/h":1/3600,"km/h":1e3/3600,"in/s":a,fps:n,"fps[ft/second]":n,fpm:n/60,"fpm[ft/minute]":n/60,"mph[mile/h]":H*n/3600,"knot[kn, kt, or nautical mile/h]":W/3600},"Electrical Potential Difference (Voltage)":{V:1,Volt:1,"joule/coulomb":1,"J/C":1,µV:1/1e6,mV:1/1e3,kV:1e3,MV:1e6}},T=l=>{if(console.log("getUnitCategory called with unit:",l),!l)return console.warn("Unit is undefined or null"),"Custom";for(const t in k)if(k[t].includes(l))return console.log(`Category found for unit ${l}:`,t),t;return console.warn(`No category found for unit: ${l}`),"Custom"},d=(l,t,e,i)=>{if(t==="ft-in"&&e!=="ft-in")return it(l,e);if(t!=="ft-in"&&e==="ft-in")return nt(l,t);if(i!=="Temperature"){const s=w[i][t]/w[i][e];return l*s}else{const s=w[i][t].c0,m=w[i][t].c1,c=w[i][e].c0,h=w[i][e].c1;return(l*s+m-h)/c}},O=(l,t)=>{let e;if(Number.isInteger(l)?e=l.toString():e=l.toFixed(t).replace(/\.?0+$/,""),Math.abs(parseFloat(e))>=1e3){const i=e.split(".");i[0]=i[0].replace(/\B(?=(\d{3})+(?!\d))/g,","),e=i.join(".")}return e},P=l=>{const t=/(\d+)\'(\s*-\s*)?(\d+)?(\s+)?(\d+)?\/?(\d+)?/,e=/(\d+)\'/,i=/(\d+)/;let s=l.match(t);if(s){const m=parseInt(s[1])||0,c=parseInt(s[3])||0,h=parseInt(s[5])||0,v=parseInt(s[6])||1;return D(m,c,h,v)}if(s=l.match(e),s){const m=parseInt(s[1])||0;return D(m,0,0,1)}if(s=l.match(i),s){const m=parseInt(s[1])||0;return D(0,m,0,1)}return parseFloat(l)},D=(l,t,e,i)=>l*12+t+e/i,S=(l,t='1/16"')=>{if(l<0)return`-${S(-l,t)}`;const e=parseInt(t.split("/")[1].replace('"',""));let i=Math.floor(l/12),s=Math.floor(l%12);const m=l-Math.floor(l);let c="";if(m>0&&t!==0){let v=Math.round(m*e);const q=(K,x)=>x?q(x,K%x):K,z=q(v,e);c=` ${v/z}/${e/z}`,c.trim()==="1/1"&&(s++,s>=12&&(i++,s-=12),c="")}let h="";return i>0&&(h+=`${i}'`),i>0&&(s>0||c!=="")&&(h+="-"),s>0&&(h+=`${s}`),c!==""&&(h+=c),(s>0||c!=="")&&(h+='"'),h.trim()},it=(l,t)=>{const e=l*.0254;return d(e,"m",t,"Length")},nt=(l,t)=>d(l,t,"m","Length")/.0254;class E extends HTMLElement{constructor(){super(),this.attachShadow({mode:"open"}),this.tooltipTimeout=null,this.unitCategory="",this.e3dLogoUrl="https://firebasestorage.googleapis.com/v0/b/auto-calc-80237.appspot.com/o/shared%2Fassets%2Fimages%2Fe3d-logo2.png?alt=media&token=7064f466-6168-4b8a-b921-4e86115cb492",console.log("PhysicalQuantity constructor called")}connectedCallback(){console.log("connectedCallback called"),this.unit=this.getAttribute("unit"),console.log("Initial unit:",this.unit),this.updateUnitCategory(),this.inputValue=this.getAttribute("value"),console.log("Initial inputValue:",this.inputValue),this.value=this.parseValue(this.inputValue,this.unit),console.log("Parsed value:",this.value),this.decimalPlaces=parseInt(this.getAttribute("decimal-places"))||2,this.showUnitArrow=!this.hasAttribute("show-unit-arrow")||this.getAttribute("show-unit-arrow")==="true",console.log("Initial state:",{unit:this.unit,value:this.value,unitCategory:this.unitCategory,decimalPlaces:this.decimalPlaces,showUnitArrow:this.showUnitArrow}),this.render(),this.attachEventListeners()}disconnectedCallback(){this.removeEventListeners()}static get observedAttributes(){return["value","unit","decimal-places","show-unit-arrow"]}attributeChangedCallback(t,e,i){if(console.log(`attributeChangedCallback called: ${t}`,{oldValue:e,newValue:i}),t==="value")this.inputValue=i||"0",this.value=this.parseValue(this.inputValue,this.unit),console.log("New value parsed:",this.value);else if(t==="unit"){const s=this.unit,m=this.unitCategory;this.unit=i||"mm",this.updateUnitCategory(),s!==this.unit&&(m===this.unitCategory?(console.log("Converting value:",{from:s,to:this.unit,value:this.value,unitCategory:this.unitCategory}),this.value=d({value:this.value,fromUnit:s,toUnit:this.unit,unitCategory:this.unitCategory})):console.log("Unit category changed, keeping original value"),console.log("New value:",this.value))}else t==="decimal-places"?(this.decimalPlaces=parseInt(i)||2,console.log("New decimal places:",this.decimalPlaces)):t==="show-unit-arrow"&&(this.showUnitArrow=i===null||i==="true",console.log("Show unit arrow:",this.showUnitArrow));this.render()}updateUnitCategory(){console.log("updateUnitCategory called with unit:",this.unit),this.unitCategory=T(this.unit),console.log("Updated unit category:",this.unitCategory)}parseValue(t,e){if(console.log("parseValue called with:",{value:t,unit:e}),typeof t=="string"&&t.trim()==="")return console.log("Empty string value, returning 0"),0;const i=e==="ft-in"?P(t):parseFloat(t)||0;return console.log("Parsed value:",i),i}formatDisplayValue(){return this.unit==="ft-in"?S(this.value):O(this.value,this.decimalPlaces)}handleUnitChange(t){if(t.target.tagName==="SELECT"){const e=t.target.value;console.log("handleUnitChange:",{from:this.unit,to:e,value:this.value,unitCategory:this.unitCategory}),this.value=d(this.value,this.unit,e,this.unitCategory),console.log("Converted value:",this.value),this.unit=e,this.updateUnitCategory(),this.render()}this.updateDropdownWidth()}render(){const t=this.formatDisplayValue();this.shadowRoot.innerHTML=`
2
2
  <style>
3
3
  :host {
4
4
  display: inline-flex;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "physical-quantity",
3
- "version": "1.1.91",
3
+ "version": "1.1.92",
4
4
  "description": "A web component bundle to represent physical quantities with automated unit conversion.",
5
5
  "main": "dist/pq.umd.js",
6
6
  "module": "dist/pq.es.js",