vcard4
Version:
An RFC 6350 compliant JavaScript library for generating and parsing version 4.0 vCards. Can also generate RFC 6351 compliant XML vCards and RFC 7095 compliant jCards. TypeScript type declarations are provided.
1 lines • 162 kB
JavaScript
function e(e,r){(null==r||r>e.length)&&(r=e.length);for(var t=0,a=Array(r);t<r;t++)a[t]=e[t];return a}function r(e,r,t){if("function"==typeof e?e===r:e.has(r))return arguments.length<3?r:t;throw new TypeError("Private element is not present on this object")}function t(e,r,t){return r=d(r),function(e,r){if(r&&("object"==typeof r||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,y()?Reflect.construct(r,t||[],d(e).constructor):r.apply(e,t))}function a(e,r){if(r.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function n(e,r){if(!(e instanceof r))throw new TypeError("Cannot call a class as a function")}function i(e,t){return e.get(r(e,t))}function o(e,r,t){a(e,r),r.set(e,t)}function u(e,t,a){return e.set(r(e,t),a),a}function s(e,r){a(e,r),r.add(e)}function c(e,r){for(var t=0;t<r.length;t++){var a=r[t];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,b(a.key),a)}}function p(e,r,t){return r&&c(e.prototype,r),t&&c(e,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function f(e,r){var t="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!t){if(Array.isArray(e)||(t=k(e))||r&&e&&"number"==typeof e.length){t&&(e=t);var a=0,n=function(){};return{s:n,n:function(){return a>=e.length?{done:!0}:{done:!1,value:e[a++]}},e:function(e){throw e},f:n}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,o=!0,u=!1;return{s:function(){t=t.call(e)},n:function(){var e=t.next();return o=e.done,e},e:function(e){u=!0,i=e},f:function(){try{o||null==t.return||t.return()}finally{if(u)throw i}}}}function l(e,r,t){return(r=b(r))in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function d(e){return d=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},d(e)}function h(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(r&&r.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),r&&P(e,r)}function y(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(y=function(){return!!e})()}function m(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);r&&(a=a.filter(function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable})),t.push.apply(t,a)}return t}function v(e){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{};r%2?m(Object(t),!0).forEach(function(r){l(e,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):m(Object(t)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))})}return e}function P(e,r){return P=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,r){return e.__proto__=r,e},P(e,r)}function w(e,r){return function(e){if(Array.isArray(e))return e}(e)||function(e,r){var t=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=t){var a,n,i,o,u=[],s=!0,c=!1;try{if(i=(t=t.call(e)).next,0===r){if(Object(t)!==t)return;s=!1}else for(;!(s=(a=i.call(t)).done)&&(u.push(a.value),u.length!==r);s=!0);}catch(e){c=!0,n=e}finally{try{if(!s&&null!=t.return&&(o=t.return(),Object(o)!==o))return}finally{if(c)throw n}}return u}}(e,r)||k(e,r)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function T(r){return function(r){if(Array.isArray(r))return e(r)}(r)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(r)||k(r)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function b(e){var r=function(e,r){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var a=t.call(e,r||"default");if("object"!=typeof a)return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===r?String:Number)(e)}(e,"string");return"symbol"==typeof r?r:r+""}function g(e){return g="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},g(e)}function k(r,t){if(r){if("string"==typeof r)return e(r,t);var a={}.toString.call(r).slice(8,-1);return"Object"===a&&r.constructor&&(a=r.constructor.name),"Map"===a||"Set"===a?Array.from(r):"Arguments"===a||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a)?e(r,t):void 0}}function A(e){var r="function"==typeof Map?new Map:void 0;return A=function(e){if(null===e||!function(e){try{return-1!==Function.toString.call(e).indexOf("[native code]")}catch(r){return"function"==typeof e}}(e))return e;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==r){if(r.has(e))return r.get(e);r.set(e,t)}function t(){return function(e,r,t){if(y())return Reflect.construct.apply(null,arguments);var a=[null];a.push.apply(a,r);var n=new(e.bind.apply(e,a));return t&&P(n,t.prototype),n}(e,arguments,d(this).constructor)}return t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),P(t,e)},A(e)}var S=function(){function e(r){var a;return n(this,e),(a=t(this,e,[r])).name="MissingArgument",a}return h(e,A(Error)),p(e)}();Object.freeze(S);var O=function(){function e(r){var a;return n(this,e),(a=t(this,e,[r])).name="InvalidArgument",a}return h(e,A(Error)),p(e)}();Object.freeze(O);var M=function(){function e(r){var a;return n(this,e),(a=t(this,e,[r])).name="InvalidVcard",a}return h(e,A(Error)),p(e)}();Object.freeze(M);var L=new WeakMap,N=function(){return p(function e(){if(n(this,e),o(this,L,["type","value","valueXML","valueJSON","identifier"]),this.constructor===e)throw new Error("Cannot create instance of base class")},[{key:"checkAbstractPropertiesAndMethods",value:function(){var e=this;if(!i(L,this).every(function(r){return Object.prototype.hasOwnProperty.call(e,r)||Object.prototype.hasOwnProperty.call(Object.getPrototypeOf(e),r)||Object.prototype.hasOwnProperty.call(e.constructor,r)}))throw new Error("All abstract properties and methods in abstract base class must be defined in child class")}},{key:"repr",value:function(){return this.value}},{key:"reprXML",value:function(){return this.valueXML}},{key:"reprJSON",value:function(){return this.valueJSON}}])}();Object.freeze(N);var I=new WeakMap,E=new WeakSet,X=function(){function e(a){var i;return n(this,e),s(i=t(this,e),E),o(i,I,void 0),r(E,i,J).call(i,a),u(I,i,a),i.checkAbstractPropertiesAndMethods(),Object.freeze(i),i}return h(e,N),p(e,[{key:"value",get:function(){return r(E,this,V).call(this,i(I,this))}},{key:"valueXML",get:function(){return"<".concat(this.constructor.type.toLowerCase(),">").concat(r(E,this,j).call(this,i(I,this)),"</").concat(this.constructor.type.toLowerCase(),">")}},{key:"valueJSON",get:function(){return[this.constructor.type.toLowerCase(),i(I,this)]}},{key:"_unsafe_raw_value",get:function(){return i(I,this)}}])}();function J(e){if(void 0===e||""===e)throw new S("Value for TextType must be supplied");if("string"!=typeof e)throw new TypeError("Only type string allowed for TextType value")}function V(e){return e.replaceAll("\\","\\\\").replaceAll(",","\\,").replaceAll(":","\\:").replaceAll(";","\\;").replaceAll("\n","\\n")}function j(e){return e.replaceAll("&","&").replaceAll(">",">").replaceAll("<","<").replaceAll('"',""").replaceAll("'","'")}l(X,"type","TEXT"),l(X,"identifier","TextType"),Object.freeze(X);var W=new WeakMap,x=new WeakSet,D=function(){function e(a){var i;return n(this,e),s(i=t(this,e),x),o(i,W,void 0),r(x,i,R).call(i,a),u(W,i,a),i.checkAbstractPropertiesAndMethods(),Object.freeze(i),i}return h(e,N),p(e,[{key:"value",get:function(){return i(W,this).reduce(function(e,r){return e.push(r.repr()),e},[]).join(",")}},{key:"valueXML",get:function(){return i(W,this).reduce(function(e,r){return e+r.reprXML()},"")}},{key:"valueJSON",get:function(){var e=i(W,this).reduce(function(e,r){return e.push(r.reprJSON().pop()),e},[]);return e.unshift(this.constructor.type.toLowerCase()),e}}])}();function R(e){if(void 0===e)throw new S("Value for TextListType must be supplied");if(!Array.isArray(e))throw new TypeError("Value for TextListType must be passed in an array");var r,t=f(e);try{for(t.s();!(r=t.n()).done;){if("TextType"!==r.value.constructor.identifier)throw new TypeError("Invalid type for value of TextListType. It should be an array of TextTypes")}}catch(e){t.e(e)}finally{t.f()}}l(D,"type","TEXT"),l(D,"identifier","TextListType"),Object.freeze(D);var z=new WeakMap,C=new WeakSet,U=function(){function e(a){var i;return n(this,e),s(i=t(this,e),C),o(i,z,void 0),r(C,i,$).call(i,a),u(z,i,a),i.checkAbstractPropertiesAndMethods(),Object.freeze(i),i}return h(e,N),p(e,[{key:"value",get:function(){return"".concat(i(z,this))}},{key:"valueXML",get:function(){return"<".concat(this.constructor.type.toLowerCase(),">").concat(i(z,this),"</").concat(this.constructor.type.toLowerCase(),">")}},{key:"valueJSON",get:function(){return[this.constructor.type.toLowerCase(),i(z,this)]}}])}();function $(e){if(void 0===e)throw new S("boolValue must be supplied");if("boolean"!=typeof e)throw new TypeError("Value for BooleanType should be of type boolean")}l(U,"type","BOOLEAN"),l(U,"identifier","BooleanType"),Object.freeze(U);var G=new WeakMap,B=new WeakMap,F=new WeakMap,_=new WeakMap,K=new WeakMap,H=new WeakMap,Z=new WeakMap,Y=new WeakMap,q=new WeakSet,Q=function(){function e(a,c){var p;return n(this,e),s(p=t(this,e),q),o(p,G,void 0),o(p,B,/^(?:(?:\d{4})|(?:(?:\d{4}(?:(?:(?:0[469]|11)(?:[0-2]\d|30))|(?:(?:0[13578]|1[02])(?:[0-2]\d|3[01]))))|(?:\d{2}(?:(?:(?:[02468][048]|[13579][26])(?:02)(?:[0-2]\d))|(?:(:?\d[13579]|[02468][26]|[13579][048])(?:02)(?:[0-2][0-8]|[01]9)))))|(?:-{2}(?:(?:(?:0[469]|11)(?:[0-2]\d|30)?)|(?:(?:0[13578]|1[02])(?:[0-2]\d|3[01])?)|(?:(?:02)(?:[0-2]\d)?)))|(?:-{3}(?:[0-2]\d|3[01]))|(?:\d{4}-(?:(?:0[1-9])|1[0-2])))$/),o(p,F,/^(?:(?:(?:(?:[01]\d)|(?:2[0-3]))(?:(?:[0-5]\d){1,2})?)|(?:-(?:[0-5]\d){1,2})|(?:-{2}[0-5]\d))(?:Z|(?:[+-]((?:[01]\d)|(?:2[0-3]))(?:[0-5]\d)?))?$/),o(p,_,/^(?:(?:(?:\d{4}(?:(?:(?:0[469]|11)(?:[0-2]\d|30))|(?:(?:0[13578]|1[02])(?:[0-2]\d|3[01]))))|(?:\d{2}(?:(?:(?:[02468][048]|[13579][26])(?:02)(?:[0-2]\d))|(?:(:?\d[13579]|[02468][26]|[13579][048])(?:02)(?:[0-2][0-8]|[01]9)))))|(?:-{2}(?:(?:(?:0[469]|11)(?:[0-2]\d|30))|(?:(?:0[13578]|1[02])(?:[0-2]\d|3[01]))|(?:(?:02)(?:[0-2]\d))))|(?:-{3}(?:[0-2]\d|3[01])))(?:T)(?:(?:(?:(?:[01]\d)|(?:2[0-3]))(?:(?:[0-5]\d){1,2})?)(?:Z|(?:[+-]((?:[01]\d)|(?:2[0-3]))(?:[0-5]\d)?))?)$/),o(p,K,new RegExp("(?:".concat(i(B,p).source,"|").concat(i(F,p).source.replace("^","^T"),"|").concat(i(_,p).source,")"))),o(p,H,/^(?:(?:\d{4}(?:(?:(?:0[469]|11)(?:[0-2]\d|30))|(?:(?:0[13578]|1[02])(?:[0-2]\d|3[01]))))|(?:\d{2}(?:(?:(?:[02468][048]|[13579][26])(?:02)(?:[0-2]\d))|(?:(:?\d[13579]|[02468][26]|[13579][048])(?:02)(?:[0-2][0-8]|[01]9)))))(?:T)(?:(?:(?:(?:[01]\d)|(?:2[0-3]))(?:[0-5]\d){2})(?:Z|(?:[+-]((?:[01]\d)|(?:2[0-3]))(?:[0-5]\d)?))?)$/),o(p,Z,/^(?:[+-]((?:[01]\d)|(?:2[0-3]))(?:[0-5]\d)?)$/),o(p,Y,20),r(q,p,ee).call(p,a,c),u(G,p,c),p.checkAbstractPropertiesAndMethods(),Object.freeze(p),p}return h(e,N),p(e,[{key:"value",get:function(){return"".concat(i(G,this))}},{key:"valueXML",get:function(){var e=this.type.toLowerCase(),r=i(G,this);if("date-and-or-time"===e)switch(!0){case i(B,this).test(r):e="date";break;case i(F,this).test(r):e="time";break;case i(_,this).test(r):e="date-time"}return"<".concat(e,">").concat(r,"</").concat(e,">")}},{key:"valueJSON",get:function(){var e,r=this.type.toLowerCase();function t(e){return/^\d{8}$/.test(e)?((e=T(e)).splice(4,0,"-"),e.splice(7,0,"-"),e.join("")):/^-{2}\d{4}$/.test(e)?((e=T(e)).splice(4,0,"-"),e.join("")):e}function a(e){for(var r=[],t=0;t<e.length;t+=2)/^\d$/.test(e[t])?(r.push(e[t]),r.push(e[t+1]),/^\d$/.test(e[t+2])&&r.push(":")):(r.push(e[t]),t--);return r.join("")}switch(r){case"date":e=t(i(G,this));break;case"time":case"utc-offset":e=a(i(G,this));break;case"date-time":case"timestamp":e=t((e=i(G,this).split("T"))[0])+"T"+a(e[1]);break;case"date-and-or-time":e=i(G,this).includes("T")?t((e=i(G,this).split("T"))[0])+"T"+a(e[1]):t(i(G,this))}return[r,e]}}])}();function ee(e,r){if(void 0===r||void 0===e)throw new S("Value and type for DateTimeType must be supplied");if(!/^(?:(?:date((?:andor)?(?:time))?)|(?:time(?:stamp)?)|(?:utcoffset))$/.test(e))throw new O("Accepted values of type for DateTimeType are date, time, datetime, dateandortime, timestamp or utcoffset");if("".concat(r).length>i(Y,this))throw new O("The value must not exceed ".concat(i(Y,this)," characters"));switch(e){case"date":if(!i(B,this).test(r))throw new O("Invalid value for type date of DateTimeType");this.type="DATE";break;case"time":if(!i(F,this).test(r))throw new O("Invalid value for type time of DateTimeType");this.type="TIME";break;case"datetime":if(!i(_,this).test(r))throw new O("Invalid value for type datetime of DateTimeType");this.type="DATE-TIME";break;case"dateandortime":if(!i(K,this).test(r))throw new O("Invalid value for type dateandortime of DateTimeType");this.type="DATE-AND-OR-TIME";break;case"timestamp":if(!i(H,this).test(r))throw new O("Invalid value for type timestamp of DateTimeType");this.type="TIMESTAMP";break;case"utcoffset":if(!i(Z,this).test(r))throw new O("Invalid value for type utcoffset of DateTimeType");this.type="UTC-OFFSET";break;default:throw new O("Accepted values for type property of type object for DateTimeType are date, time, datetime, dateandortime, timestamp or utcoffset")}}l(Q,"identifier","DateTimeType"),Object.freeze(Q);var re=new WeakMap,te=new WeakSet,ae=function(){function e(a){var i;return n(this,e),s(i=t(this,e),te),o(i,re,void 0),r(te,i,ne).call(i,a),u(re,i,a),i.type=a[0].type,i.checkAbstractPropertiesAndMethods(),Object.freeze(i),i}return h(e,N),p(e,[{key:"value",get:function(){return i(re,this).reduce(function(e,r){return e.push(r.repr()),e},[]).join(",")}},{key:"valueXML",get:function(){return i(re,this).reduce(function(e,r){return e+r.reprXML()},"")}},{key:"valueJSON",get:function(){var e=i(re,this).reduce(function(e,r){return e.push(r.reprJSON().pop()),e},[]);return e.unshift(this.type.toLowerCase()),e}}])}();function ne(e){if(void 0===e)throw new S("Value for DateTimeListType must be supplied");if(!Array.isArray(e))throw new TypeError("Value for DateTimeListType should be passed in an array");var r,t=e[0].type,a=f(e);try{for(a.s();!(r=a.n()).done;){var n=r.value;if(n.type!==t)throw new TypeError("Value for DateTimeListType should be an array of DateTimeTypes of the same type");if("UTC-OFFSET"===n.type)throw new TypeError("Invalid type for value of DateTimeListType");if("DateTimeType"!==n.constructor.identifier)throw new TypeError("Value for DateTimeListType should be an array of DateTimeTypes")}}catch(e){a.e(e)}finally{a.f()}}l(ae,"identifier","DateTimeListType"),Object.freeze(ae);var ie=new WeakMap,oe=new WeakSet,ue=function(){function e(a){var i;return n(this,e),s(i=t(this,e),oe),o(i,ie,void 0),r(oe,i,se).call(i,a),u(ie,i,a),i.checkAbstractPropertiesAndMethods(),Object.freeze(i),i}return h(e,N),p(e,[{key:"value",get:function(){return"".concat(i(ie,this))}},{key:"valueXML",get:function(){return"<".concat(this.constructor.type.toLowerCase(),">").concat(i(ie,this),"</").concat(this.constructor.type.toLowerCase(),">")}},{key:"valueJSON",get:function(){return[this.constructor.type.toLowerCase(),i(ie,this)]}}])}();function se(e){if(void 0===e)throw new S("Value for IntegerType must be supplied");if("number"!=typeof e&&"bigint"!=typeof e)throw new TypeError("Value for IntegerType must be of type number or bigint");if(/\./.test(e.toString()))throw new O("Invalid value for IntegerType");if(!("number"!=typeof e||-Number.MAX_SAFE_INTEGER<e&&e<Number.MAX_SAFE_INTEGER))throw new O("The maximum value is ".concat(Number.MAX_SAFE_INTEGER,", and the minimum value is ").concat(Number.MIN_SAFE_INTEGER," for number IntegerType"));if("bigint"==typeof e&&!(-9223372036854775809n<e&&e<9223372036854775808n))throw new O("The maximum value is 9223372036854775807n, and the minimum value is -9223372036854775808n for bigint IntegerType")}l(ue,"type","INTEGER"),l(ue,"identifier","IntegerType"),Object.freeze(ue);var ce=new WeakMap,pe=new WeakSet,fe=function(){function e(a){var i;return n(this,e),s(i=t(this,e),pe),o(i,ce,void 0),r(pe,i,le).call(i,a),u(ce,i,a),i.checkAbstractPropertiesAndMethods(),Object.freeze(i),i}return h(e,N),p(e,[{key:"value",get:function(){return i(ce,this).reduce(function(e,r){return e.push(r.repr()),e},[]).join(",")}},{key:"valueXML",get:function(){return i(ce,this).reduce(function(e,r){return e+r.reprXML()},"")}},{key:"valueJSON",get:function(){var e=i(ce,this).reduce(function(e,r){return e.push(r.reprJSON().pop()),e},[]);return e.unshift(this.constructor.type.toLowerCase()),e}}])}();function le(e){if(void 0===e)throw new S("Value for IntegerListType must be supplied");if(!Array.isArray(e))throw new TypeError("Value for IntegerListType must be passed in an array");var r,t=f(e);try{for(t.s();!(r=t.n()).done;){if("IntegerType"!==r.value.constructor.identifier)throw new TypeError("Invalid type for value of IntegerListType. It should be an array of IntegerTypes")}}catch(e){t.e(e)}finally{t.f()}}l(fe,"type","INTEGER"),l(fe,"identifier","IntegerListType"),Object.freeze(fe);var de=new WeakMap,he=new WeakSet,ye=function(){function e(a){var i;return n(this,e),s(i=t(this,e),he),o(i,de,void 0),r(he,i,me).call(i,a),u(de,i,a),i.checkAbstractPropertiesAndMethods(),Object.freeze(i),i}return h(e,N),p(e,[{key:"value",get:function(){return"".concat(i(de,this))}},{key:"valueXML",get:function(){return"<".concat(this.constructor.type.toLowerCase(),">").concat(i(de,this),"</").concat(this.constructor.type.toLowerCase(),">")}},{key:"valueJSON",get:function(){return[this.constructor.type.toLowerCase(),i(de,this)]}}])}();function me(e){if(void 0===e)throw new S("Value for FloatType must be supplied");if("number"!=typeof e&&!/\./.test(e)||!/^[-+]?\d+\.\d+$/.test(e))throw new TypeError("Invalid value for FloatType")}l(ye,"type","FLOAT"),l(ye,"identifier","FloatType"),Object.freeze(ye);var ve=new WeakMap,Pe=new WeakSet,we=function(){function e(a){var i;return n(this,e),s(i=t(this,e),Pe),o(i,ve,void 0),r(Pe,i,Te).call(i,a),u(ve,i,a),i.checkAbstractPropertiesAndMethods(),Object.freeze(i),i}return h(e,N),p(e,[{key:"value",get:function(){return i(ve,this).reduce(function(e,r){return e.push(r.repr()),e},[]).join(",")}},{key:"valueXML",get:function(){return i(ve,this).reduce(function(e,r){return e+r.reprXML()},"")}},{key:"valueJSON",get:function(){var e=i(ve,this).reduce(function(e,r){return e.push(r.reprJSON().pop()),e},[]);return e.unshift(this.constructor.type.toLowerCase()),e}}])}();function Te(e){if(void 0===e)throw new S("Value for FloatListType must be supplied");if(!Array.isArray(e))throw new TypeError("Value of FloatListType should be passed in an array");var r,t=f(e);try{for(t.s();!(r=t.n()).done;){if("FloatType"!==r.value.constructor.identifier)throw new TypeError("Value of FloatListType should be an array of FloatTypes")}}catch(e){t.e(e)}finally{t.f()}}l(we,"type","FLOAT"),l(we,"identifier","FloatListType"),Object.freeze(we);var be=new WeakMap,ge=new WeakMap,ke=new WeakMap,Ae=new WeakSet,Se=function(){function e(a){var i;return n(this,e),s(i=t(this,e),Ae),o(i,be,void 0),o(i,ge,/^(?:[a-zA-Z]{2,3}(-[a-zA-Z]{3}){0,3})(-[0-9A-Za-z]+){0,3}(-x(-[0-9A-Za-z]{1,8})+)?(-[0-9A-WY-Za-wy-z]+)?(-[0-9A-Za-z]+)?$/),o(i,ke,255),r(Ae,i,Oe).call(i,a),u(be,i,a),i.checkAbstractPropertiesAndMethods(),Object.freeze(i),i}return h(e,N),p(e,[{key:"value",get:function(){return i(be,this)}},{key:"valueXML",get:function(){return"<".concat(this.constructor.type.toLowerCase(),">").concat(i(be,this),"</").concat(this.constructor.type.toLowerCase(),">")}},{key:"valueJSON",get:function(){return[this.constructor.type.toLowerCase(),i(be,this)]}}])}();function Oe(e){if(void 0===e)throw new S("Value for LanguageTagType must be supplied");if("string"!=typeof e)throw new TypeError("Value for LanguageTagType should be of type string");if(e.length>i(ke,this))throw new O("Value for LanguageTagType must not exceed ".concat(i(ke,this)," characters"));if(!i(ge,this).test(e))throw new O("Invalid language tag")}l(Se,"type","LANGUAGE-TAG"),l(Se,"identifier","LanguageTagType"),Object.freeze(Se);var Me=new WeakMap,Le=new WeakSet,Ne=function(){function e(a){var i;return n(this,e),s(i=t(this,e),Le),o(i,Me,void 0),r(Le,i,Ie).call(i,a),u(Me,i,a),i.checkAbstractPropertiesAndMethods(),Object.freeze(i),i}return h(e,N),p(e,[{key:"value",get:function(){return i(Me,this)}},{key:"valueXML",get:function(){return"<".concat(this.constructor.type.toLowerCase(),">").concat(i(Me,this),"</").concat(this.constructor.type.toLowerCase(),">")}},{key:"valueJSON",get:function(){return[this.constructor.type.toLowerCase(),i(Me,this)]}}])}();function Ie(e){if(void 0===e)throw new S("Value for URIType must be supplied");if("string"!=typeof e)throw new TypeError("Value for URIType should be of type string");if(!URL.canParse(e))throw new O("Invalid URI")}l(Ne,"type","URI"),l(Ne,"identifier","URIType"),Object.freeze(Ne);var Ee=new WeakMap,Xe=new WeakMap,Je=new WeakSet,Ve=function(){function e(a){var i;return n(this,e),s(i=t(this,e),Je),o(i,Ee,/^[MFONU]$/),o(i,Xe,void 0),r(Je,i,je).call(i,a),u(Xe,i,a),i.checkAbstractPropertiesAndMethods(),Object.freeze(i),i}return h(e,N),p(e,[{key:"value",get:function(){return i(Xe,this)}},{key:"valueXML",get:function(){return"<sex>".concat(i(Xe,this),"</sex>")}},{key:"valueJSON",get:function(){return[this.constructor.type.toLowerCase(),i(Xe,this)]}}])}();function je(e){if(void 0===e)throw new S("Value for SexType must be supplied");if(!i(Ee,this).test(e))throw new O("Invalid sex")}l(Ve,"type","TEXT"),l(Ve,"identifier","SexType"),Object.freeze(Ve);var We=new WeakSet,xe=function(){function e(a,i){var o;return n(this,e),s(o=t(this,e),We),r(We,o,De).call(o,a,i),o.targetProp=a.toUpperCase(),o.checkAbstractPropertiesAndMethods(),Object.freeze(o),o}return h(e,N),p(e)}();function De(e,r){var t,a;if(void 0===r||void 0===e)throw new S("Value and target property for SpecialValueType must be supplied");var n,i;switch(!0){case/^KindProperty$/i.test(e):if("string"!=typeof r||!/^(?:individual|group|org|location|application|x-[a-z0-9-]+)$/i.test(r))throw new O("Invalid value for SpecialValueType for KindProperty");this.value=r,this.valueXML="<text>".concat(r,"</text>"),this.valueJSON=[this.constructor.type.toLowerCase(),r];break;case/^NProperty$/i.test(e):if(!Array.isArray(r)||5!==r.length)throw new O("Invalid value for SpecialValueType for NProperty. It should be an array with a length of 5");for(var o=0;o<r.length;o++)if(r[o]&&"TextType"!==r[o].constructor.identifier&&"TextListType"!==r[o].constructor.identifier)throw new TypeError("Invalid value for SpecialValueType for NProperty. The items in the array, if present, should be of type TextType or TextListType");n=T(r);for(var u=0;u<n.length;u++)n[u]&&(n[u]=n[u].repr());this.value=n.join(";"),this.valueXML="",this.valueJSON=[];for(var s=0;s<r.length;s++)switch(s){case 0:r[s]?(this.valueXML+=r[s].reprXML().replaceAll("text>","surname>"),2===(i=r[s].reprJSON()).length?this.valueJSON[s]=i.pop():(i.shift(),this.valueJSON[s]=i)):(this.valueXML+="<surname/>",this.valueJSON[s]="");break;case 1:r[s]?(this.valueXML+=r[s].reprXML().replaceAll("text>","given>"),2===(i=r[s].reprJSON()).length?this.valueJSON[s]=i.pop():(i.shift(),this.valueJSON[s]=i)):(this.valueXML+="<given/>",this.valueJSON[s]="");break;case 2:r[s]?(this.valueXML+=r[s].reprXML().replaceAll("text>","additional>"),2===(i=r[s].reprJSON()).length?this.valueJSON[s]=i.pop():(i.shift(),this.valueJSON[s]=i)):(this.valueXML+="<additional/>",this.valueJSON[s]="");break;case 3:r[s]?(this.valueXML+=r[s].reprXML().replaceAll("text>","prefix>"),2===(i=r[s].reprJSON()).length?this.valueJSON[s]=i.pop():(i.shift(),this.valueJSON[s]=i)):(this.valueXML+="<prefix/>",this.valueJSON[s]="");break;case 4:r[s]?(this.valueXML+=r[s].reprXML().replaceAll("text>","suffix>"),2===(i=r[s].reprJSON()).length?this.valueJSON[s]=i.pop():(i.shift(),this.valueJSON[s]=i)):(this.valueXML+="<suffix/>",this.valueJSON[s]="")}this.valueJSON=[this.constructor.type.toLowerCase(),this.valueJSON];break;case/^GenderProperty$/i.test(e):if(!Array.isArray(r)||2!==r.length)throw new O("Invalid value for SpecialValueType for GenderProperty. It should be an array with a length of 2");if(r[0]&&"SexType"!==r[0].constructor.identifier)throw new TypeError("Invalid value for SpecialValueType for GenderProperty. The first item in the array, if present, should be of type SexType");if(!r[0]&&!r[1]||r[1]&&"TextType"!==r[1].constructor.identifier)throw new TypeError("Invalid value for SpecialValueType for GenderProperty. The second item in the array, if present, should be of type TextType");this.value=r.reduce(function(e,r){return e?"".concat(e,";").concat(r.repr()):r.repr()},""),this.valueXML=r.reduce(function(e,r){return e+r.reprXML()},""),this.valueJSON=r.reduce(function(e,r){return e.push(r.reprJSON().pop()),e},[]),1===this.valueJSON.length?this.valueJSON.unshift(this.constructor.type.toLowerCase()):this.valueJSON=[this.constructor.type.toLowerCase(),this.valueJSON];break;case/^AdrProperty$/i.test(e):if(!Array.isArray(r)||7!==r.length)throw new O("Invalid value for SpecialValueType for AdrProperty. It should be an array with a length of 7");for(var c=0;c<r.length;c++)if(r[c]&&"TextType"!==r[c].constructor.identifier)throw new TypeError("Invalid value for SpecialValueType for AdrProperty. The items in the array, if present, should be of type TextType");n=T(r);for(var p=0;p<n.length;p++)n[p]&&(n[p]=n[p].repr());this.value=n.join(";"),this.valueXML="",this.valueJSON=[];for(var f=0;f<r.length;f++)switch(f){case 0:r[f]?(this.valueXML+=r[f].reprXML().replaceAll("text>","pobox>"),2===(i=r[f].reprJSON()).length?this.valueJSON[f]=i.pop():(i.shift(),this.valueJSON[f]=i)):(this.valueXML+="<pobox/>",this.valueJSON[f]="");break;case 1:r[f]?(this.valueXML+=r[f].reprXML().replaceAll("text>","ext>"),2===(i=r[f].reprJSON()).length?this.valueJSON[f]=i.pop():(i.shift(),this.valueJSON[f]=i)):(this.valueXML+="<ext/>",this.valueJSON[f]="");break;case 2:r[f]?(this.valueXML+=r[f].reprXML().replaceAll("text>","street>"),2===(i=r[f].reprJSON()).length?this.valueJSON[f]=i.pop():(i.shift(),this.valueJSON[f]=i)):(this.valueXML+="<street/>",this.valueJSON[f]="");break;case 3:r[f]?(this.valueXML+=r[f].reprXML().replaceAll("text>","locality>"),2===(i=r[f].reprJSON()).length?this.valueJSON[f]=i.pop():(i.shift(),this.valueJSON[f]=i)):(this.valueXML+="<locality/>",this.valueJSON[f]="");break;case 4:r[f]?(this.valueXML+=r[f].reprXML().replaceAll("text>","region>"),2===(i=r[f].reprJSON()).length?this.valueJSON[f]=i.pop():(i.shift(),this.valueJSON[f]=i)):(this.valueXML+="<region/>",this.valueJSON[f]="");break;case 5:r[f]?(this.valueXML+=r[f].reprXML().replaceAll("text>","code>"),2===(i=r[f].reprJSON()).length?this.valueJSON[f]=i.pop():(i.shift(),this.valueJSON[f]=i)):(this.valueXML+="<code/>",this.valueJSON[f]="");break;case 6:r[f]?(this.valueXML+=r[f].reprXML().replaceAll("text>","country>"),2===(i=r[f].reprJSON()).length?this.valueJSON[f]=i.pop():(i.shift(),this.valueJSON[f]=i)):(this.valueXML+="<country/>",this.valueJSON[f]="")}this.valueJSON=[this.constructor.type.toLowerCase(),this.valueJSON];break;case/^OrgProperty$/i.test(e):if(!(Array.isArray(r)&&r.length>=1))throw new O("Invalid value for SpecialValueType for OrgProperty. It should be an array with at least one item");for(var l=0;l<r.length;l++){var d;if("TextType"!==(null===(d=r[l])||void 0===d||null===(d=d.constructor)||void 0===d?void 0:d.identifier))throw new TypeError("Invalid value for SpecialValueType for OrgProperty. The items in the array should be of type TextType")}this.value=r.reduce(function(e,r){return e?"".concat(e,";").concat(r.repr()):r.repr()},""),this.valueXML=r.reduce(function(e,r){return e+r.reprXML()},""),this.valueJSON=r.reduce(function(e,r){return e.push(r.reprJSON().pop()),e},[]),1===this.valueJSON.length?this.valueJSON.unshift(this.constructor.type.toLowerCase()):this.valueJSON=[this.constructor.type.toLowerCase(),this.valueJSON];break;case/^ClientpidmapProperty$/i.test(e):if(!Array.isArray(r)||2!==r.length)throw new O("Invalid value for SpecialValueType for ClientpidmapProperty. It should be an array with a length of 2");if("IntegerType"!==(null===(t=r[0])||void 0===t||null===(t=t.constructor)||void 0===t?void 0:t.identifier))throw new TypeError("Invalid value for SpecialValueType for ClientpidmapProperty. The first item in the array should be of type IntegerType");if(0>=Number(r[0].repr()))throw new O("Invalid value for SpecialValueType for ClientpidmapProperty. The first item in the array should be a positive integer of type IntegerType. Zero is not allowed");if("URIType"!==(null===(a=r[1])||void 0===a||null===(a=a.constructor)||void 0===a?void 0:a.identifier))throw new TypeError("Invalid value for SpecialValueType for ClientpidmapProperty. The second item in the array should be of type URIType");this.value=r.reduce(function(e,r){return e?"".concat(e,";").concat(r.repr()):r.repr()},""),this.valueXML=r.reduce(function(e,r){return e+r.reprXML()},""),this.valueJSON=["unknown",r.reduce(function(e,r){return e.push(r.reprJSON().pop()),e},[])];break;default:throw new O("Invalid target property for SpecialValueType")}}l(xe,"identifier","SpecialValueType"),l(xe,"type","TEXT"),Object.freeze(xe);var Re=new WeakMap,ze=new WeakSet,Ce=function(){function e(a){var i;return n(this,e),s(i=t(this,e),ze),o(i,Re,void 0),r(ze,i,Ue).call(i,a),u(Re,i,a),i.checkAbstractPropertiesAndMethods(),Object.freeze(i),i}return h(e,N),p(e,[{key:"value",get:function(){var e=r(ze,this,$e).call(this,i(Re,this));return/[:;]/.test(e)?'"'.concat(e,'"'):e}},{key:"valueXML",get:function(){return"<".concat(this.constructor.type.toLowerCase(),">").concat(r(ze,this,Ge).call(this,i(Re,this)),"</").concat(this.constructor.type.toLowerCase(),">")}},{key:"valueJSON",get:function(){return[this.constructor.type.toLowerCase(),i(Re,this)]}},{key:"_unsafe_raw_value",get:function(){return i(Re,this)}}])}();function Ue(e){if(void 0===e||""===e)throw new S("Value for ParameterValueType must be supplied");if("string"!=typeof e)throw new TypeError("Only type string allowed for ParameterValueType value");if(/[\x00-\x08\x0b\x0c\x0e-\x1f\x7f]/.test(e))throw new O("Value includes forbidden characters")}function $e(e){return e.replaceAll("^","^^").replaceAll("\n","^n").replaceAll('"',"^’")}function Ge(e){return e.replaceAll("&","&").replaceAll(">",">").replaceAll("<","<").replaceAll('"',""").replaceAll("'","'")}l(Ce,"type","TEXT"),l(Ce,"identifier","ParameterValueType"),Object.freeze(Ce);var Be=new WeakMap,Fe=function(){return p(function e(){if(n(this,e),o(this,Be,["param","value","valueXML","valueJSON","identifier"]),this.constructor===e)throw new Error("Cannot create instance of base class")},[{key:"checkAbstractPropertiesAndMethods",value:function(){var e=this;if(!i(Be,this).every(function(r){return Object.prototype.hasOwnProperty.call(e,r)||Object.prototype.hasOwnProperty.call(Object.getPrototypeOf(e),r)||Object.prototype.hasOwnProperty.call(e.constructor,r)}))throw new Error("All abstract properties and methods in abstract base class must be defined in child class")}},{key:"repr",value:function(){return"".concat(this.constructor.param||this.param,"=").concat(this.value)}},{key:"reprXML",value:function(){var e,r,t=(null===(e=this.constructor.param)||void 0===e?void 0:e.toLowerCase())||(null===(r=this.param)||void 0===r?void 0:r.toLowerCase());return/^(?:altid|base|calscale|cc|geo|index|label|language|level|mediatype|pid|pref|sort-as|type|tz|value|x-[A-Za-z0-9]+)$/.test(t)?"value"===t?"":"<".concat(t,">").concat(this.valueXML,"</").concat(t,">"):"<unknown>".concat(this.valueXML.replace(/<[a-z\-]+?>/g,"<text>").replace(/<\/[a-z\-]+?>/g,"</text>"),"</unknown>")}},{key:"reprJSON",value:function(){var e,r,t=(null===(e=this.constructor.param)||void 0===e?void 0:e.toLowerCase())||(null===(r=this.param)||void 0===r?void 0:r.toLowerCase());if("value"===t)return{};var a=this.valueJSON;return a.shift(),1===(a=a.map(function(e){return e.toString()})).length&&(a=a.pop()),l({},t,a)}}])}();Object.freeze(Fe);var _e=new WeakMap,Ke=new WeakSet,He=function(){function e(a){var i;return n(this,e),s(i=t(this,e),Ke),o(i,_e,void 0),r(Ke,i,Ze).call(i,a),u(_e,i,a),i.checkAbstractPropertiesAndMethods(),Object.freeze(i),i}return h(e,Fe),p(e,[{key:"value",get:function(){return i(_e,this).repr()}},{key:"valueXML",get:function(){return i(_e,this).reprXML()}},{key:"valueJSON",get:function(){return i(_e,this).reprJSON()}}])}();function Ze(e){if(void 0===e)throw new S("Language Tag for LanguageParameter must be supplied");if("LanguageTagType"!==e.constructor.identifier)throw new TypeError("The value of the LANGUAGE property parameter should be of type LanguageTagType")}l(He,"param","LANGUAGE"),l(He,"identifier","LanguageParameter"),Object.freeze(He);var Ye=new WeakMap,qe=new WeakSet,Qe=function(){function e(a){var i;return n(this,e),s(i=t(this,e),qe),o(i,Ye,void 0),r(qe,i,er).call(i,a),u(Ye,i,a),i.checkAbstractPropertiesAndMethods(),Object.freeze(i),i}return h(e,Fe),p(e,[{key:"value",get:function(){return(i(Ye,this).type||i(Ye,this).constructor.type).toLowerCase()}},{key:"valueXML",get:function(){return""}},{key:"valueJSON",get:function(){return[]}}])}();function er(e){if(void 0===e)throw new S("Value for ValueParameter must be supplied");if(!Object.prototype.hasOwnProperty.call(e,"type")&&!Object.prototype.hasOwnProperty.call(e.constructor,"type"))throw new O("Value for ValueParameter not recognized")}l(Qe,"param","VALUE"),l(Qe,"identifier","ValueParameter"),Object.freeze(Qe);var rr=new WeakMap,tr=new WeakSet,ar=function(){function e(a){var i;return n(this,e),s(i=t(this,e),tr),o(i,rr,void 0),r(tr,i,nr).call(i,a),u(rr,i,a),i.checkAbstractPropertiesAndMethods(),Object.freeze(i),i}return h(e,Fe),p(e,[{key:"value",get:function(){return i(rr,this).repr()}},{key:"valueXML",get:function(){return i(rr,this).reprXML()}},{key:"valueJSON",get:function(){return i(rr,this).reprJSON()}}])}();function nr(e){if(void 0===e)throw new S("Value for PrefParameter must be supplied");if("IntegerType"!==e.constructor.identifier)throw new TypeError("Value for PrefParameter should be of type IntegerType");if(Number(e.repr())<1||Number(e.repr())>100)throw new O("Value for PrefParameter must be between 1 and 100")}l(ar,"param","PREF"),l(ar,"identifier","PrefParameter"),Object.freeze(ar);var ir=new WeakMap,or=new WeakSet,ur=function(){function e(a){var i;return n(this,e),s(i=t(this,e),or),o(i,ir,void 0),r(or,i,sr).call(i,a),u(ir,i,a),i.checkAbstractPropertiesAndMethods(),Object.freeze(i),i}return h(e,Fe),p(e,[{key:"value",get:function(){return i(ir,this).repr()}},{key:"valueXML",get:function(){return i(ir,this).reprXML()}},{key:"valueJSON",get:function(){return i(ir,this).reprJSON()}}])}();function sr(e){if(void 0===e)throw new S("Value for AltidParameter must be supplied");if("ParameterValueType"!==e.constructor.identifier)throw new O("Value for AltidParameter must be of type ParameterValueType")}l(ur,"param","ALTID"),l(ur,"identifier","AltidParameter"),Object.freeze(ur);var cr=new WeakMap,pr=new WeakMap,fr=new WeakSet,lr=function(){function e(a){var i;return n(this,e),s(i=t(this,e),fr),o(i,cr,void 0),o(i,pr,/^\d+(?:\.\d+)?$/),r(fr,i,dr).call(i,a),u(cr,i,a),i.checkAbstractPropertiesAndMethods(),Object.freeze(i),i}return h(e,Fe),p(e,[{key:"value",get:function(){return Array.isArray(i(cr,this))?i(cr,this).map(function(e){return Array.isArray(e)?e.map(function(e){return e.repr()}).join("."):e.repr()}).join(","):i(cr,this).repr()}},{key:"valueXML",get:function(){return(Array.isArray(i(cr,this))?i(cr,this).map(function(e){return Array.isArray(e)?"<integer>"+e.map(function(e){return e.repr()}).join(".")+"</integer>":e.reprXML()}).join(""):i(cr,this).reprXML()).replaceAll("integer","text")}},{key:"valueJSON",get:function(){return Array.isArray(i(cr,this))?["integer"].concat(T(i(cr,this).map(function(e){return Array.isArray(e)?Number(e.map(function(e){return e.repr()}).join(".")):e.reprJSON().pop()}))):i(cr,this).reprJSON()}}])}();function dr(e){if(void 0===e)throw new S("Value for PIDParameter must be supplied");if(!Array.isArray(e)&&"IntegerType"!==e.constructor.identifier)throw new O("Invalid value for PIDParameter");if(Array.isArray(e)&&!e.every(function(e){return Array.isArray(e)?2===e.length&&e.every(function(e){return"IntegerType"===e.constructor.identifier}):"IntegerType"===e.constructor.identifier}))throw new O("Invalid value for PIDParameter")}l(lr,"param","PID"),l(lr,"identifier","PIDParameter"),Object.freeze(lr);var hr=new WeakMap,yr=new WeakMap,mr=new WeakMap,vr=new WeakMap,Pr=new WeakSet,wr=function(){function e(a,i){var c;return n(this,e),s(c=t(this,e),Pr),o(c,hr,void 0),o(c,yr,/^(?:work|home|x-[a-z0-9-]+)$/i),o(c,mr,/^(?:text|voice|fax|cell|video|pager|textphone|main)$/i),o(c,vr,/(?:contact|acquaintance|friend|met|co-worker|colleague|co-resident|neighbor|child|parent|sibling|spouse|kin|muse|crush|date|sweetheart|me|agent|emergency)/i),r(Pr,c,Tr).call(c,a,i),u(hr,c,i),c.targetProp=a.toUpperCase(),c.checkAbstractPropertiesAndMethods(),Object.freeze(c),c}return h(e,Fe),p(e,[{key:"value",get:function(){return Array.isArray(i(hr,this))?'"'.concat(i(hr,this).map(function(e){return e.repr()}).join(",").replaceAll('"',""),'"'):i(hr,this).repr()}},{key:"valueXML",get:function(){return Array.isArray(i(hr,this))?i(hr,this).map(function(e){return e.reprXML()}).join(""):i(hr,this).reprXML()}},{key:"valueJSON",get:function(){return Array.isArray(i(hr,this))?["text"].concat(T(i(hr,this).map(function(e){return e._unsafe_raw_value}))):i(hr,this).reprJSON()}}])}();function Tr(e,r){var t=this;if(void 0===r||void 0===e)throw new S("Value and target property for TypeParameter must be supplied");if((Array.isArray(r)||"ParameterValueType"!==r.constructor.identifier)&&(!Array.isArray(r)||!r.every(function(e){return"ParameterValueType"===e.constructor.identifier})))throw new TypeError("Value for TypeParameter must be of type ParameterValueType or an array of ParameterValueTypes");var a=new RegExp("(?:".concat(i(mr,this).source,"|").concat(i(yr,this).source,")"),"i"),n=new RegExp("(?:".concat(i(vr,this).source,"|").concat(i(yr,this).source,")"),"i");switch(!0){case/^TelProperty$/i.test(e):if((Array.isArray(r)||!a.test(r.repr()))&&(!Array.isArray(r)||!r.every(function(e){return a.test(e.repr())})))throw new O("Invalid value for TypeParameter for TelProperty");break;case/^RelatedProperty$/i.test(e):if((Array.isArray(r)||!n.test(r.repr()))&&(!Array.isArray(r)||!r.every(function(e){return n.test(e.repr())})))throw new O("Invalid value for TypeParameter for RelatedProperty");break;default:if((Array.isArray(r)||!i(yr,this).test(r.repr()))&&(!Array.isArray(r)||!r.every(function(e){return i(yr,t).test(e.repr())})))throw new O("Invalid value for TypeParameter")}}l(wr,"param","TYPE"),l(wr,"identifier","TypeParameter"),Object.freeze(wr);var br=new WeakMap,gr=new WeakMap,kr=new WeakMap,Ar=new WeakSet,Sr=function(){function e(a){var i;return n(this,e),s(i=t(this,e),Ar),o(i,br,/^(?:[A-Za-z0-9!#\$&\.\+\-\^_]){1,127}\/(?:[A-Za-z0-9!#\$&\.\+\-\^_]){1,127}$/),o(i,gr,/^[A-Za-z0-9!#\$&\.\+\-\^_]+=[A-Za-z0-9!#\$&\.\+\-\^_]+$/),o(i,kr,void 0),r(Ar,i,Or).call(i,a),u(kr,i,a),i.checkAbstractPropertiesAndMethods(),Object.freeze(i),i}return h(e,Fe),p(e,[{key:"value",get:function(){return Array.isArray(i(kr,this))?'"'.concat(i(kr,this).map(function(e){return e.repr()}).join(";"),'"'):i(kr,this).repr()}},{key:"valueXML",get:function(){return Array.isArray(i(kr,this))?"<text>"+i(kr,this).map(function(e){return e.reprXML()}).join(";").replace(/<\/?text>/g,"")+"</text>":i(kr,this).reprXML()}},{key:"valueJSON",get:function(){return Array.isArray(i(kr,this))?["text",i(kr,this).map(function(e){return e._unsafe_raw_value}).join(";")]:i(kr,this).reprJSON()}}])}();function Or(e){if(void 0===e)throw new S("Value for MediatypeParameter must be supplied");if(!Array.isArray(e)&&"ParameterValueType"!==e.constructor.identifier||Array.isArray(e)&&!e.every(function(e){return"ParameterValueType"===e.constructor.identifier}))throw new TypeError("Value for MediatypeParameter must be of ParameterValueType or an array of ParameterValueTypes");if(!Array.isArray(e)&&!i(br,this).test(e.repr()))throw new O("Invalid media type");if(Array.isArray(e)){if(2!==e.length)throw new O("Invalid value for MediatypeParameter. It should be an array with a length of 2");if(!i(br,this).test(e[0].repr()))throw new O("Invalid media type");if(!i(gr,this).test(e[1].repr()))throw new O("Invalid media type")}}l(Sr,"param","MEDIATYPE"),l(Sr,"identifier","MediatypeParameter"),Object.freeze(Sr);var Mr=new WeakMap,Lr=new WeakMap,Nr=new WeakSet,Ir=function(){function e(a){var i;return n(this,e),s(i=t(this,e),Nr),o(i,Mr,void 0),o(i,Lr,/^(?:gregorian|[Xx]-[A-Za-z0-9-]+)$/),r(Nr,i,Er).call(i,a),u(Mr,i,a),i.checkAbstractPropertiesAndMethods(),Object.freeze(i),i}return h(e,Fe),p(e,[{key:"value",get:function(){return i(Mr,this).repr()}},{key:"valueXML",get:function(){return i(Mr,this).reprXML()}},{key:"valueJSON",get:function(){return i(Mr,this).reprJSON()}}])}();function Er(e){if(void 0===e)throw new S("Value for CalscaleParameter must be supplied");if("ParameterValueType"!==e.constructor.identifier)throw new S("Value for CalscaleParameter must of type ParameterValueType");if(!i(Lr,this).test(e.repr()))throw new O("Invalid calscale value")}l(Ir,"param","CALSCALE"),l(Ir,"identifier","CalscaleParameter"),Object.freeze(Ir);var Xr=new WeakMap,Jr=new WeakSet,Vr=function(){function e(a){var i;return n(this,e),s(i=t(this,e),Jr),o(i,Xr,void 0),r(Jr,i,jr).call(i,a),u(Xr,i,a),i.checkAbstractPropertiesAndMethods(),Object.freeze(i),i}return h(e,Fe),p(e,[{key:"value",get:function(){return Array.isArray(i(Xr,this))?'"'.concat(i(Xr,this).map(function(e){return e.repr()}).join(",").replaceAll('"',""),'"'):i(Xr,this).repr()}},{key:"valueXML",get:function(){return Array.isArray(i(Xr,this))?i(Xr,this).map(function(e){return e.reprXML()}).join(""):i(Xr,this).reprXML()}},{key:"valueJSON",get:function(){return Array.isArray(i(Xr,this))?["text"].concat(T(i(Xr,this).map(function(e){return e._unsafe_raw_value}))):i(Xr,this).reprJSON()}}])}();function jr(e){if(void 0===e)throw new S("Value for SortAsParameter must be supplied");if((Array.isArray(e)||"ParameterValueType"!==e.constructor.identifier)&&(!Array.isArray(e)||!e.every(function(e){return"ParameterValueType"===e.constructor.identifier})))throw new TypeError("Value for SortAsParameter must be of type ParameterValueType or an array of ParameterValueTypes")}l(Vr,"param","SORT-AS"),l(Vr,"identifier","SortAsParameter"),Object.freeze(Vr);var Wr=new WeakMap,xr=new WeakSet,Dr=function(){function e(a){var i;return n(this,e),s(i=t(this,e),xr),o(i,Wr,void 0),r(xr,i,Rr).call(i,a),u(Wr,i,a),i.checkAbstractPropertiesAndMethods(),Object.freeze(i),i}return h(e,Fe),p(e,[{key:"value",get:function(){return'"'.concat(i(Wr,this).repr(),'"')}},{key:"valueXML",get:function(){return i(Wr,this).reprXML()}},{key:"valueJSON",get:function(){return i(Wr,this).reprJSON()}}])}();function Rr(e){if(void 0===e)throw new S("Value for GeoParameter must be supplied");if("URIType"!==e.constructor.identifier)throw new TypeError("Value for GeoParameter must be of type URIType")}l(Dr,"param","GEO"),l(Dr,"identifier","GeoParameter"),Object.freeze(Dr);var zr=new WeakMap,Cr=new WeakSet,Ur=function(){function e(a){var i;return n(this,e),s(i=t(this,e),Cr),o(i,zr,void 0),r(Cr,i,$r).call(i,a),u(zr,i,a),i.checkAbstractPropertiesAndMethods(),Object.freeze(i),i}return h(e,Fe),p(e,[{key:"value",get:function(){return"URIType"===i(zr,this).constructor.identifier?'"'.concat(i(zr,this).repr(),'"'):i(zr,this).repr()}},{key:"valueXML",get:function(){return i(zr,this).reprXML()}},{key:"valueJSON",get:function(){return i(zr,this).reprJSON()}}])}();function $r(e){if(void 0===e)throw new S("Value for TzParameter must be supplied");if("ParameterValueType"!==e.constructor.identifier&&"URIType"!==e.constructor.identifier&&("DateTimeType"!==e.constructor.identifier||"UTC-OFFSET"!==e.type))throw new TypeError("Invalid type for value for TzParameter")}l(Ur,"param","TZ"),l(Ur,"identifier","TzParameter"),Object.freeze(Ur);var Gr=new WeakMap,Br=new WeakMap,Fr=new WeakMap,_r=new WeakSet,Kr=function(){function e(a,i){var c;return n(this,e),s(c=t(this,e),_r),o(c,Gr,void 0),o(c,Br,void 0),o(c,Fr,/^x-[a-z0-9-]+$/i),r(_r,c,Hr).call(c,a,i),u(Br,c,a),u(Gr,c,i),c.checkAbstractPropertiesAndMethods(),Object.freeze(c),c}return h(e,Fe),p(e,[{key:"param",get:function(){return"".concat(i(Br,this))}},{key:"value",get:function(){return i(Gr,this).repr()}},{key:"valueXML",get:function(){return i(Gr,this).reprXML()}},{key:"valueJSON",get:function(){return i(Gr,this).reprJSON()}}])}();function Hr(e,r){if(void 0===e||void 0===r)throw new S("Parameter name and value for AnyParameter must be supplied");if(!i(Fr,this).test(e))throw new O("Invalid parameter name for AnyParameter");if("ParameterValueType"!==r.constructor.identifier)throw new O("Invalid value for AnyParameter")}l(Kr,"identifier","AnyParameter"),Object.freeze(Kr);var Zr=new WeakMap,Yr=new WeakSet,qr=function(){function e(a){var i;return n(this,e),s(i=t(this,e),Yr),o(i,Zr,void 0),r(Yr,i,Qr).call(i,a),u(Zr,i,a),i.checkAbstractPropertiesAndMethods(),Object.freeze(i),i}return h(e,Fe),p(e,[{key:"value",get:function(){return i(Zr,this).repr()}},{key:"valueXML",get:function(){return i(Zr,this).reprXML()}},{key:"valueJSON",get:function(){return i(Zr,this).reprJSON()}}])}();function Qr(e){if(void 0===e)throw new S("Value for LabelParameter must be supplied");if("ParameterValueType"!==e.constructor.identifier)throw new TypeError("Value for LabelParameter should be of type ParameterValueType")}l(qr,"param","LABEL"),l(qr,"identifier","LabelParameter"),Object.freeze(qr);var et=new WeakMap,rt=new WeakSet,tt=function(){function e(a){var i;return n(this,e),s(i=t(this,e),rt),o(i,et,void 0),r(rt,i,at).call(i,a),u(et,i,a),i.checkAbstractPropertiesAndMethods(),Object.freeze(i),i}return h(e,Fe),p(e,[{key:"value",get:function(){return i(et,this).repr()}},{key:"valueXML",get:function(){return i(et,this).reprXML()}},{key:"valueJSON",get:function(){return i(et,this).reprJSON()}}])}();function at(e){if(void 0===e)throw new S("Value for CCParameter must be supplied");if("ParameterValueType"!==e.constructor.identifier||!/^[A-Za-z0-9]{2}$/.test(e.repr()))throw new O("Invalid value for CCParameter")}l(tt,"param","CC"),l(tt,"identifier","CCParameter"),Object.freeze(tt);var nt=new WeakMap,it=new WeakSet,ot=function(){function e(a){var i;return n(this,e),s(i=t(this,e),it),o(i,nt,void 0),r(it,i,ut).call(i,a),u(nt,i,a),i.checkAbstractPropertiesAndMethods(),Object.freeze(i),i}return h(e,Fe),p(e,[{key:"value",get:function(){return i(nt,this).repr()}},{key:"valueXML",get:function(){return i(nt,this).reprXML()}},{key:"valueJSON",get:function(){return i(nt,this).reprJSON()}}])}();function ut(e){if(void 0===e)throw new S("Value for IndexParameter must be supplied");if("IntegerType"!==e.constructor.identifier||!(Number(e.repr())>0))throw new O("Invalid value for IndexParameter. Must be a positive integer")}l(ot,"param","INDEX"),l(ot,"identifier","IndexParameter"),Object.freeze(ot);var st=new WeakMap,ct=new WeakMap,pt=new WeakMap,ft=new WeakSet,lt=function(){function e(a,i){var c;return n(this,e),s(c=t(this,e),ft),o(c,st,/^(?:beginner|average|expert)$/),o(c,ct,/^(?:high|medium|low)$/),o(c,pt,void 0),r(ft,c,dt).call(c,a,i),u(pt,c,i),c.targetProp=a.toUpperCase(),c.checkAbstractPropertiesAndMethods(),Object.freeze(c),c}return h(e,Fe),p(e,[{key:"value",get:function(){return i(pt,this).repr()}},{key:"valueXML",get:function(){return i(pt,this).reprXML()}},{key:"valueJSON",get:function(){return i(pt,this).reprJSON()}}])}();function dt(e,r){if(void 0===r||void 0===e)throw new S("Value and target property for LevelParameter must be supplied");if("ParameterValueType"!==r.constructor.identifier)throw new O("Invalid value for LevelParameter");switch(!0){case/^expertiseProperty$/i.test(e)&&i(st,this).test(r.repr()):case/^(?:hobby|interest)Property$/i.test(e)&&i(ct,this).test(r.repr()):break;default:throw new O("Invalid value for LevelParameter")}}l(lt,"param","LEVEL"),l(lt,"identifier","LevelParameter"),Object.freeze(lt);var ht=new WeakMap,yt=function(){return p(function e(){if(n(this,e),o(this,ht,["prop","cardinality","acceptableParamTypes","acceptableValTypes","params","paramsXML","paramsJSON","value","valueXML","valueJSON","identifier"]),this.constructor===e)throw new Error("Cannot create instance of base class")},[{key:"checkAbstractPropertiesAndMethods",value:function(){var e=this;if(!i(ht,this).every(function(r){return Object.prototype.hasOwnProperty.call(e,r)||Object.prototype.hasOwnProperty.call(Object.getPrototypeOf(e),r)||Object.prototype.hasOwnProperty.call(e.constructor,r)}))throw new Error("All abstract properties and methods in base class must be defined in child class")}},{key:"repr",value:function(){var e=""===this.params?"".concat(this.constructor.prop||this.prop,":").concat(this.value):"".concat(this.constructor.prop