hexo/node_modules/jstoxml/dist/jstoxml-min.js

1 line
5.5 KiB
JavaScript
Raw Normal View History

2023-09-25 15:58:56 +08:00
!function(t,e){if("function"==typeof define&&define.amd)define(["exports"],e);else if("undefined"!=typeof exports)e(exports);else{var n={exports:{}};e(n.exports),t.jstoxml=n.exports}}("undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:this,function(t){"use strict";function e(t){return function(t){if(Array.isArray(t))return n(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(!t)return;if("string"==typeof t)return n(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return n(t,e)}(t)||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 n(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function r(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),n.push.apply(n,r)}return n}function o(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?r(Object(n),!0).forEach(function(e){a(t,e,n[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):r(Object(n)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))})}return t}function a(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function c(t){"@babel/helpers - typeof";return(c="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}Object.defineProperty(t,"__esModule",{value:!0}),t.toXML=t.default=void 0;var i=["_selfCloseTag","_attrs"],u=new RegExp(i.join("|"),"g"),f=function(t){return(Array.isArray(t)?"array":"object"===c(t)&&null!==t&&t._name&&"special-object")||t instanceof Date&&"date"||null===t&&"null"||c(t)},l=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if("string"!=typeof t)return t;var n=new RegExp("(".concat(Object.keys(e).join("|"),")(?!(\\w|#)*;)"),"g");return String(t).replace(n,function(t,n){return e[n]||""})},s=function(){var t=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=arguments.length>1?arguments[1]:void 0,n=[];n=Array.isArray(t)?t.map(function(t){var n=Object.keys(t)[0],r=t[n],o=e?l(r,e):r,a=!0===o?"":'="'.concat(o,'"');return"".concat(n).concat(a)}):Object.keys(t).map(function(n){var r=e?l(t[n],e):t[n],o=!0===t[n]?"":'="'.concat(r,'"');return"".concat(n).concat(o)});return n}(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},arguments.length>1?arguments[1]:void 0);if(0===t.length)return"";var e=t.join(" ");return" ".concat(e)},p=["string","number","boolean"],b=function(t){return p.includes(f(t))},y=([].concat(p,["date","special-object"]),{"<":"&lt;",">":"&gt;","&":"&amp;"}),d=function t(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},a=r.depth,p=void 0===a?0:a,d=r.indent,v=r._isFirstItem,m=r._isOutputStart,g=void 0===m||m,h=r.header,j=r.attributesFilter,O=void 0===j?{}:j,_=r.filter,S=void 0===_?{}:_,k="boolean"==typeof O&&!O?{}:o(o(o({},y),{'"':"&quot;"}),O),w="boolean"==typeof S&&!S?{}:o(o({},y),S),A=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return t.repeat(e)}(d,p),x=f(n),P=function(t){var e=t.header,n=(t.indent,t.isOutputStart);return e&&n?"boolean"===c(e)?'<?xml version="1.0" encoding="UTF-8"?>':e:""}({header:h,indent:d,depth:p,isOutputStart:g}),I=g&&!P&&v&&0===p,T="";swi