iwmlib/dist/iwmlib.3rdparty.min.js

1 line
1.3 MiB
JavaScript
Raw Normal View History

2019-04-11 11:28:43 +02:00
var e;!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.OptimalSelect=t():e.OptimalSelect=t()}(this,function(){return function(r){var i={};function n(e){if(i[e])return i[e].exports;var t=i[e]={i:e,l:!1,exports:{}};return r[e].call(t.exports,t,t.exports,n),t.l=!0,t.exports}return n.m=r,n.c=i,n.i=function(e){return e},n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:r})},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=6)}([function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.convertNodeList=function(e){for(var t=e.length,r=new Array(t),i=0;i<t;i++)r[i]=e[i];return r},t.escapeValue=function(e){return e&&e.replace(/['"`\\/:\?&!#$%^()[\]{|}*+;,.<=>@~]/g,"\\$&").replace(/\n/g,"A")}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getCommonAncestor=function(e){var t=(1<arguments.length&&void 0!==arguments[1]?arguments[1]:{}).root,i=void 0===t?document:t,n=[];e.forEach(function(e,t){for(var r=[];e!==i;)e=e.parentNode,r.unshift(e);n[t]=r}),n.sort(function(e,t){return e.length-t.length});for(var r=n.shift(),o=null,a=function(){var t=r[s],e=n.some(function(e){return!e.some(function(e){return e===t})});if(e)return"break";o=t},s=0,u=r.length;s<u;s++){var c=a();if("break"===c)break}return o},t.getCommonProperties=function(e){var f={classes:[],attributes:{},tag:null};return e.forEach(function(e){var n,i,t,r,o=f.classes,a=f.attributes,s=f.tag;if(void 0!==o){var u=e.getAttribute("class");u?(u=u.trim().split(" "),o.length?(o=o.filter(function(t){return u.some(function(e){return e===t})})).length?f.classes=o:delete f.classes:f.classes=u):delete f.classes}if(void 0!==a&&(n=e.attributes,i=Object.keys(n).reduce(function(e,t){var r=n[t],i=r.name;return r&&"class"!==i&&(e[i]=r.value),e},{}),t=Object.keys(i),r=Object.keys(a),t.length?r.length?(a=r.reduce(function(e,t){var r=a[t];return r===i[t]&&(e[t]=r),e},{}),Object.keys(a).length?f.attributes=a:delete f.attributes):f.attributes=i:delete f.attributes),void 0!==s){var c=e.tagName.toLowerCase();s?c!==s&&delete f.tag:f.tag=c}}),f}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t){var r=2<arguments.length&&void 0!==arguments[2]?arguments[2]:{};Array.isArray(t)||(t=t.length?(0,l.convertNodeList)(t):[t]);if(!t.length||t.some(function(e){return 1!==e.nodeType}))throw new Error('Invalid input - to compare HTMLElements its necessary to provide a reference of the selected node(s)! (missing "elements")');(0,f.default)(t[0],r);var i=e.replace(/> /g,">").split(/\s+(?=(?:(?:[^"]*"){2})*[^"]*$)/);if(i.length<2)return h("",e,"",t);var n=[i.pop()];for(;1<i.length;){var o=i.pop(),a=i.join(" "),s=n.join(" "),u=a+" "+s,c=document.querySelectorAll(u);c.length!==t.length&&n.unshift(h(a,o,s,t))}n.unshift(i[0]),(i=n)[0]=h("",i[0],i.slice(1).join(" "),t),i[i.length-1]=h(i.slice(0,-1).join(" "),i[i.length-1],"",t);return i.join(" ").replace(/>/g,"> ").trim()};var i,n=r(3),f=(i=n)&&i.__esModule?i:{default:i},l=r(0);function h(r,i,n,o){if(r.length&&(r+=" "),n.length&&(n=" "+n),/\[*\]/.test(i)){var e=i.replace(/=.*$/,"]"),a=""+r+e+n;if(m(document.querySelectorAll(a),o))i=e;else for(var s=document.querySelectorAll(""+r+e),t=function(){var t=s[u];if(o.some(function(e){return t.contains(e)})){var e=t.tagName.toLowerCase();return a=""+r+e+n,m(document.querySelectorAll(a),o)&&(i=e),"break"}},u=0,c=s.length;u<c;u++){if("break"===t())break}}if(/>/.test(i)){var f=i.replace(/>/,"");a=""+r+f+n;m(document.querySelectorAll(a),o)&&(i=f)}if(/:nth-child/.test(i)){var l=i.replace(/nth-child/g,"nth-of-type");a=""+r+l+n;m(document.querySelectorAll(a),o)&&(i=l)}if(/\.\S+\.\S+/.test(i)){for(var h=i.trim().split(".").slice(1).map(function(e){return"."+e}).sort(function(e,t){return e.length-t.length});h.length;){var d=i.replace(h.shif