"use strict";var Type,Enum,util=module.exports=require("./util/minimal"),roots=require("./roots");util.codegen=require("@protobufjs/codegen"),util.fetch=require("@protobufjs/fetch"),util.path=require("@protobufjs/path"),util.fs=util.inquire("fs"),util.toArray=function(e){if(e){for(var t=Object.keys(e),r=Array(t.length),o=0;o<t.length;)r[o]=e[t[o++]];return r}return[]},util.toObject=function(e){for(var t={},r=0;r<e.length;){var o=e[r++],u=e[r++];void 0!==u&&(t[o]=u)}return t};var safePropBackslashRe=/\\/g,safePropQuoteRe=/"/g;util.isReserved=function(e){return/^(?:do|if|in|for|let|new|try|var|case|else|enum|eval|false|null|this|true|void|with|break|catch|class|const|super|throw|while|yield|delete|export|import|public|return|static|switch|typeof|default|extends|finally|package|private|continue|debugger|function|arguments|interface|protected|implements|instanceof)$/.test(e)},util.safeProp=function(e){return!/^[$\w_]+$/.test(e)||util.isReserved(e)?'["'+e.replace(safePropBackslashRe,"\\\\").replace(safePropQuoteRe,'\\"')+'"]':"."+e},util.getProp=function(e,t){return e&&Object.prototype.hasOwnProperty.call(e,t)?e[t]:void 0},util.ucFirst=function(e){return e.charAt(0).toUpperCase()+e.substring(1)};var camelCaseRe=/_([a-z])/g;util.camelCase=function(e){return e.substring(0,1)+e.substring(1).replace(camelCaseRe,function(e,t){return t.toUpperCase()})},util.compareFieldsById=function(e,t){return e.id-t.id},util.decorateType=function(e,t){if(e.$type)return t&&e.$type.name!==t&&(util.decorateRoot.remove(e.$type),e.$type.name=t,util.decorateRoot.add(e.$type)),e.$type;Type||(Type=require("./type"));var r=new Type(t||e.name);return util.decorateRoot.add(r),r.ctor=e,Object.defineProperty(e,"$type",{value:r,enumerable:!1}),Object.defineProperty(e.prototype,"$type",{value:r,enumerable:!1}),r};var decorateEnumIndex=0;util.decorateEnum=function(e){if(e.$type)return e.$type;Enum||(Enum=require("./enum"));var t=new Enum("Enum"+decorateEnumIndex++,e);return util.decorateRoot.add(t),Object.defineProperty(e,"$type",{value:t,enumerable:!1}),t},util.setProperty=function(e,t,r,o){if("object"!=typeof e)throw TypeError("dst must be an object");if(!t)throw TypeError("path must be specified");return function e(t,r,u){var n=r.shift();if("__proto__"===n||"prototype"===n)return t;if(r.length>0)t[n]=e(t[n]||{},r,u);else{var i=t[n];if(i&&o)return t;i&&(u=[].concat(i).concat(u)),t[n]=u}return t}(e,t=t.split("."),r)},Object.defineProperty(util,"decorateRoot",{get:function(){return roots.decorated||(roots.decorated=new(require("./root")))}});