UNPKG

teddy

Version:

🧸 Teddy is the most readable and easy to learn templating language there is!

739 lines • 417 kB
/******/var __webpack_modules__={ /***/"./node_modules/boolbase/index.js": /*!****************************************!*\ !*** ./node_modules/boolbase/index.js ***! \****************************************/ /***/module=>{module.exports={trueFunc:function(){return true},falseFunc:function(){return false}}; /***/}, /***/"./node_modules/cheerio-select/lib/esm/helpers.js": /*!********************************************************!*\ !*** ./node_modules/cheerio-select/lib/esm/helpers.js ***! \********************************************************/ /***/(__unused_webpack___webpack_module__,__webpack_exports__,__webpack_require__)=>{__webpack_require__.r(__webpack_exports__); /* harmony export */__webpack_require__.d(__webpack_exports__,{ /* harmony export */getDocumentRoot:()=>/* binding */getDocumentRoot /* harmony export */,groupSelectors:()=>/* binding */groupSelectors /* harmony export */}); /* harmony import */var _positionals_js__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__(/*! ./positionals.js */"./node_modules/cheerio-select/lib/esm/positionals.js");function getDocumentRoot(node){while(node.parent)node=node.parent;return node}function groupSelectors(selectors){const filteredSelectors=[];const plainSelectors=[];for(const selector of selectors)if(selector.some(_positionals_js__WEBPACK_IMPORTED_MODULE_0__.isFilter))filteredSelectors.push(selector);else plainSelectors.push(selector);return[plainSelectors,filteredSelectors]} //# sourceMappingURL=helpers.js.map /***/}, /***/"./node_modules/cheerio-select/lib/esm/index.js": /*!******************************************************!*\ !*** ./node_modules/cheerio-select/lib/esm/index.js ***! \******************************************************/ /***/(__unused_webpack___webpack_module__,__webpack_exports__,__webpack_require__)=>{__webpack_require__.r(__webpack_exports__); /* harmony export */__webpack_require__.d(__webpack_exports__,{ /* harmony export */aliases:()=>/* reexport safe */css_select__WEBPACK_IMPORTED_MODULE_0__.aliases /* harmony export */,filter:()=>/* binding */filter /* harmony export */,filters:()=>/* reexport safe */css_select__WEBPACK_IMPORTED_MODULE_0__.filters /* harmony export */,is:()=>/* binding */is /* harmony export */,pseudos:()=>/* reexport safe */css_select__WEBPACK_IMPORTED_MODULE_0__.pseudos /* harmony export */,select:()=>/* binding */select /* harmony export */,some:()=>/* binding */some /* harmony export */}); /* harmony import */var css_what__WEBPACK_IMPORTED_MODULE_5__=__webpack_require__(/*! css-what */"./node_modules/css-what/lib/es/types.js"); /* harmony import */var css_what__WEBPACK_IMPORTED_MODULE_6__=__webpack_require__(/*! css-what */"./node_modules/css-what/lib/es/parse.js"); /* harmony import */var css_select__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__(/*! css-select */"./node_modules/css-select/lib/esm/index.js"); /* harmony import */var domutils__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__(/*! domutils */"./node_modules/domutils/lib/esm/index.js"); /* harmony import */var boolbase__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__(/*! boolbase */"./node_modules/boolbase/index.js"); /* harmony import */var _helpers_js__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__(/*! ./helpers.js */"./node_modules/cheerio-select/lib/esm/helpers.js"); /* harmony import */var _positionals_js__WEBPACK_IMPORTED_MODULE_4__=__webpack_require__(/*! ./positionals.js */"./node_modules/cheerio-select/lib/esm/positionals.js"); // Re-export pseudo extension points const UNIVERSAL_SELECTOR={type:css_what__WEBPACK_IMPORTED_MODULE_5__.SelectorType.Universal,namespace:null};const SCOPE_PSEUDO={type:css_what__WEBPACK_IMPORTED_MODULE_5__.SelectorType.Pseudo,name:"scope",data:null};function is(element,selector,options={}){return some([element],selector,options)}function some(elements,selector,options={}){if(typeof selector==="function")return elements.some(selector);const[plain,filtered]=(0,_helpers_js__WEBPACK_IMPORTED_MODULE_3__.groupSelectors)((0,css_what__WEBPACK_IMPORTED_MODULE_6__.parse)(selector));return plain.length>0&&elements.some((0,css_select__WEBPACK_IMPORTED_MODULE_0__._compileToken)(plain,options))||filtered.some((sel=>filterBySelector(sel,elements,options).length>0))}function filterByPosition(filter,elems,data,options){const num=typeof data==="string"?parseInt(data,10):NaN;switch(filter){case"first":case"lt": // Already done in `getLimit` return elems;case"last":return elems.length>0?[elems[elems.length-1]]:elems;case"nth":case"eq":return isFinite(num)&&Math.abs(num)<elems.length?[num<0?elems[elems.length+num]:elems[num]]:[];case"gt":return isFinite(num)?elems.slice(num+1):[];case"even":return elems.filter(((_,i)=>i%2===0));case"odd":return elems.filter(((_,i)=>i%2===1));case"not":{const filtered=new Set(filterParsed(data,elems,options));return elems.filter((e=>!filtered.has(e)))}}}function filter(selector,elements,options={}){return filterParsed((0,css_what__WEBPACK_IMPORTED_MODULE_6__.parse)(selector),elements,options)} /** * Filter a set of elements by a selector. * * Will return elements in the original order. * * @param selector Selector to filter by. * @param elements Elements to filter. * @param options Options for selector. */function filterParsed(selector,elements,options){if(elements.length===0)return[];const[plainSelectors,filteredSelectors]=(0,_helpers_js__WEBPACK_IMPORTED_MODULE_3__.groupSelectors)(selector);let found;if(plainSelectors.length){const filtered=filterElements(elements,plainSelectors,options); // If there are no filters, just return if(filteredSelectors.length===0)return filtered; // Otherwise, we have to do some filtering if(filtered.length)found=new Set(filtered)}for(let i=0;i<filteredSelectors.length&&(found===null||found===void 0?void 0:found.size)!==elements.length;i++){const filteredSelector=filteredSelectors[i];const missing=found?elements.filter((e=>domutils__WEBPACK_IMPORTED_MODULE_1__.isTag(e)&&!found.has(e))):elements;if(missing.length===0)break;const filtered=filterBySelector(filteredSelector,elements,options);if(filtered.length)if(!found){ /* * If we haven't found anything before the last selector, * just return what we found now. */ if(i===filteredSelectors.length-1)return filtered;found=new Set(filtered)}else filtered.forEach((el=>found.add(el)))}return typeof found!=="undefined"?found.size===elements.length?elements:// Filter elements to preserve order elements.filter((el=>found.has(el))):[]}function filterBySelector(selector,elements,options){var _a;if(selector.some(css_what__WEBPACK_IMPORTED_MODULE_6__.isTraversal)){ /* * Get root node, run selector with the scope * set to all of our nodes. */ const root=(_a=options.root)!==null&&_a!==void 0?_a:(0,_helpers_js__WEBPACK_IMPORTED_MODULE_3__.getDocumentRoot)(elements[0]);const opts={...options,context:elements,relativeSelector:false};selector.push(SCOPE_PSEUDO);return findFilterElements(root,selector,opts,true,elements.length)} // Performance optimization: If we don't have to traverse, just filter set. return findFilterElements(elements,selector,options,false,elements.length)}function select(selector,root,options={},limit=1/0){if(typeof selector==="function")return find(root,selector);const[plain,filtered]=(0,_helpers_js__WEBPACK_IMPORTED_MODULE_3__.groupSelectors)((0,css_what__WEBPACK_IMPORTED_MODULE_6__.parse)(selector));const results=filtered.map((sel=>findFilterElements(root,sel,options,true,limit))); // Plain selectors can be queried in a single go if(plain.length)results.push(findElements(root,plain,options,limit));if(results.length===0)return[]; // If there was only a single selector, just return the result if(results.length===1)return results[0]; // Sort results, filtering for duplicates return domutils__WEBPACK_IMPORTED_MODULE_1__.uniqueSort(results.reduce(((a,b)=>[...a,...b])))} /** * * @param root Element(s) to search from. * @param selector Selector to look for. * @param options Options for querying. * @param queryForSelector Query multiple levels deep for the initial selector, even if it doesn't contain a traversal. */function findFilterElements(root,selector,options,queryForSelector,totalLimit){const filterIndex=selector.findIndex(_positionals_js__WEBPACK_IMPORTED_MODULE_4__.isFilter);const sub=selector.slice(0,filterIndex);const filter=selector[filterIndex]; // If we are at the end of the selector, we can limit the number of elements to retrieve. const partLimit=selector.length-1===filterIndex?totalLimit:1/0; /* * Set the number of elements to retrieve. * Eg. for :first, we only have to get a single element. */const limit=(0,_positionals_js__WEBPACK_IMPORTED_MODULE_4__.getLimit)(filter.name,filter.data,partLimit);if(limit===0)return[]; /* * Skip `findElements` call if our selector starts with a positional * pseudo. */const elemsNoLimit=sub.length===0&&!Array.isArray(root)?domutils__WEBPACK_IMPORTED_MODULE_1__.getChildren(root).filter(domutils__WEBPACK_IMPORTED_MODULE_1__.isTag):sub.length===0?(Array.isArray(root)?root:[root]).filter(domutils__WEBPACK_IMPORTED_MODULE_1__.isTag):queryForSelector||sub.some(css_what__WEBPACK_IMPORTED_MODULE_6__.isTraversal)?findElements(root,[sub],options,limit):filterElements(root,[sub],options);const elems=elemsNoLimit.slice(0,limit);let result=filterByPosition(filter.name,elems,filter.data,options);if(result.length===0||selector.length===filterIndex+1)return result;const remainingSelector=selector.slice(filterIndex+1);const remainingHasTraversal=remainingSelector.some(css_what__WEBPACK_IMPORTED_MODULE_6__.isTraversal);if(remainingHasTraversal){if((0,css_what__WEBPACK_IMPORTED_MODULE_6__.isTraversal)(remainingSelector[0])){const{type}=remainingSelector[0];if(type===css_what__WEBPACK_IMPORTED_MODULE_5__.SelectorType.Sibling||type===css_what__WEBPACK_IMPORTED_MODULE_5__.SelectorType.Adjacent) // If we have a sibling traversal, we need to also look at the siblings. result=(0,css_select__WEBPACK_IMPORTED_MODULE_0__.prepareContext)(result,domutils__WEBPACK_IMPORTED_MODULE_1__,true); // Avoid a traversal-first selector error. remainingSelector.unshift(UNIVERSAL_SELECTOR)}options={...options, // Avoid absolutizing the selector relativeSelector:false, /* * Add a custom root func, to make sure traversals don't match elements * that aren't a part of the considered tree. */ rootFunc:el=>result.includes(el)}}else if(options.rootFunc&&options.rootFunc!==boolbase__WEBPACK_IMPORTED_MODULE_2__.trueFunc)options={...options,rootFunc:boolbase__WEBPACK_IMPORTED_MODULE_2__.trueFunc}; /* * If we have another filter, recursively call `findFilterElements`, * with the `recursive` flag disabled. We only have to look for more * elements when we see a traversal. * * Otherwise, */return remainingSelector.some(_positionals_js__WEBPACK_IMPORTED_MODULE_4__.isFilter)?findFilterElements(result,remainingSelector,options,false,totalLimit):remainingHasTraversal?// Query existing elements to resolve traversal. findElements(result,[remainingSelector],options,totalLimit):// If we don't have any more traversals, simply filter elements. filterElements(result,[remainingSelector],options)}function findElements(root,sel,options,limit){const query=(0,css_select__WEBPACK_IMPORTED_MODULE_0__._compileToken)(sel,options,root);return find(root,query,limit)}function find(root,query,limit=1/0){const elems=(0,css_select__WEBPACK_IMPORTED_MODULE_0__.prepareContext)(root,domutils__WEBPACK_IMPORTED_MODULE_1__,query.shouldTestNextSiblings);return domutils__WEBPACK_IMPORTED_MODULE_1__.find((node=>domutils__WEBPACK_IMPORTED_MODULE_1__.isTag(node)&&query(node)),elems,true,limit)}function filterElements(elements,sel,options){const els=(Array.isArray(elements)?elements:[elements]).filter(domutils__WEBPACK_IMPORTED_MODULE_1__.isTag);if(els.length===0)return els;const query=(0,css_select__WEBPACK_IMPORTED_MODULE_0__._compileToken)(sel,options);return query===boolbase__WEBPACK_IMPORTED_MODULE_2__.trueFunc?els:els.filter(query)} //# sourceMappingURL=index.js.map /***/}, /***/"./node_modules/cheerio-select/lib/esm/positionals.js": /*!************************************************************!*\ !*** ./node_modules/cheerio-select/lib/esm/positionals.js ***! \************************************************************/ /***/(__unused_webpack___webpack_module__,__webpack_exports__,__webpack_require__)=>{__webpack_require__.r(__webpack_exports__); /* harmony export */__webpack_require__.d(__webpack_exports__,{ /* harmony export */filterNames:()=>/* binding */filterNames /* harmony export */,getLimit:()=>/* binding */getLimit /* harmony export */,isFilter:()=>/* binding */isFilter /* harmony export */});const filterNames=new Set(["first","last","eq","gt","nth","lt","even","odd"]);function isFilter(s){if(s.type!=="pseudo")return false;if(filterNames.has(s.name))return true;if(s.name==="not"&&Array.isArray(s.data)) // Only consider `:not` with embedded filters return s.data.some((s=>s.some(isFilter)));return false}function getLimit(filter,data,partLimit){const num=data!=null?parseInt(data,10):NaN;switch(filter){case"first":return 1;case"nth":case"eq":return isFinite(num)?num>=0?num+1:1/0:0;case"lt":return isFinite(num)?num>=0?Math.min(num,partLimit):1/0:0;case"gt":return isFinite(num)?1/0:0;case"odd":return 2*partLimit;case"even":return 2*partLimit-1;case"last":case"not":return 1/0}} //# sourceMappingURL=positionals.js.map /***/}, /***/"./node_modules/cheerio/dist/browser/api/attributes.js": /*!*************************************************************!*\ !*** ./node_modules/cheerio/dist/browser/api/attributes.js ***! \*************************************************************/ /***/(__unused_webpack___webpack_module__,__webpack_exports__,__webpack_require__)=>{__webpack_require__.r(__webpack_exports__); /* harmony export */__webpack_require__.d(__webpack_exports__,{ /* harmony export */addClass:()=>/* binding */addClass /* harmony export */,attr:()=>/* binding */attr /* harmony export */,data:()=>/* binding */data /* harmony export */,hasClass:()=>/* binding */hasClass /* harmony export */,prop:()=>/* binding */prop /* harmony export */,removeAttr:()=>/* binding */removeAttr /* harmony export */,removeClass:()=>/* binding */removeClass /* harmony export */,toggleClass:()=>/* binding */toggleClass /* harmony export */,val:()=>/* binding */val /* harmony export */}); /* harmony import */var _static_js__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__(/*! ../static.js */"./node_modules/cheerio/dist/browser/static.js"); /* harmony import */var _utils_js__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__(/*! ../utils.js */"./node_modules/cheerio/dist/browser/utils.js"); /* harmony import */var domhandler__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__(/*! domhandler */"./node_modules/domhandler/lib/esm/index.js"); /* harmony import */var domutils__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__(/*! domutils */"./node_modules/domutils/lib/esm/index.js"); /** * Methods for getting and modifying attributes. * * @module cheerio/attributes */const hasOwn=Object.prototype.hasOwnProperty;const rspace=/\s+/;const dataAttrPrefix="data-"; // Attributes that are booleans const rboolean=/^(?:autofocus|autoplay|async|checked|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped|selected)$/i; // Matches strings that look like JSON objects or arrays const rbrace=/^{[^]*}$|^\[[^]*]$/;function getAttr(elem,name,xmlMode){var _a;if(!elem||!(0,domhandler__WEBPACK_IMPORTED_MODULE_2__.isTag)(elem))return;(_a=elem.attribs)!==null&&_a!==void 0?_a:elem.attribs={}; // Return the entire attribs object if no attribute specified if(!name)return elem.attribs;if(hasOwn.call(elem.attribs,name)) // Get the (decoded) attribute return!xmlMode&&rboolean.test(name)?name:elem.attribs[name]; // Mimic the DOM and return text content as value for `option's` if(elem.name==="option"&&name==="value")return(0,_static_js__WEBPACK_IMPORTED_MODULE_0__.text)(elem.children); // Mimic DOM with default value for radios/checkboxes if(elem.name==="input"&&(elem.attribs["type"]==="radio"||elem.attribs["type"]==="checkbox")&&name==="value")return"on";return} /** * Sets the value of an attribute. The attribute will be deleted if the value is * `null`. * * @private * @param el - The element to set the attribute on. * @param name - The attribute's name. * @param value - The attribute's value. */function setAttr(el,name,value){if(value===null)removeAttribute(el,name);else el.attribs[name]=`${value}`}function attr(name,value){ // Set the value (with attr map support) if(typeof name==="object"||value!==void 0){if(typeof value==="function"){if(typeof name!=="string")throw new Error("Bad combination of arguments.");return(0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.domEach)(this,((el,i)=>{if((0,domhandler__WEBPACK_IMPORTED_MODULE_2__.isTag)(el))setAttr(el,name,value.call(el,i,el.attribs[name]))}))}return(0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.domEach)(this,(el=>{if(!(0,domhandler__WEBPACK_IMPORTED_MODULE_2__.isTag)(el))return;if(typeof name==="object")for(const objName of Object.keys(name)){const objValue=name[objName];setAttr(el,objName,objValue)}else setAttr(el,name,value)}))}return arguments.length>1?this:getAttr(this[0],name,this.options.xmlMode)} /** * Gets a node's prop. * * @private * @category Attributes * @param el - Element to get the prop of. * @param name - Name of the prop. * @param xmlMode - Disable handling of special HTML attributes. * @returns The prop's value. */function getProp(el,name,xmlMode){return name in el?// @ts-expect-error TS doesn't like us accessing the value directly here. el[name]:!xmlMode&&rboolean.test(name)?getAttr(el,name,false)!==void 0:getAttr(el,name,xmlMode)} /** * Sets the value of a prop. * * @private * @param el - The element to set the prop on. * @param name - The prop's name. * @param value - The prop's value. * @param xmlMode - Disable handling of special HTML attributes. */function setProp(el,name,value,xmlMode){if(name in el) // @ts-expect-error Overriding value el[name]=value;else setAttr(el,name,!xmlMode&&rboolean.test(name)?value?"":null:`${value}`)}function prop(name,value){var _a;if(typeof name==="string"&&value===void 0){const el=this[0];if(!el||!(0,domhandler__WEBPACK_IMPORTED_MODULE_2__.isTag)(el))return;switch(name){case"style":{const property=this.css();const keys=Object.keys(property);for(let i=0;i<keys.length;i++)property[i]=keys[i];property.length=keys.length;return property}case"tagName":case"nodeName":return el.name.toUpperCase();case"href":case"src":{const prop=(_a=el.attribs)===null||_a===void 0?void 0:_a[name];if(typeof URL!=="undefined"&&(name==="href"&&(el.tagName==="a"||el.tagName==="link")||name==="src"&&(el.tagName==="img"||el.tagName==="iframe"||el.tagName==="audio"||el.tagName==="video"||el.tagName==="source"))&&prop!==void 0&&this.options.baseURI)return new URL(prop,this.options.baseURI).href;return prop}case"innerText":return(0,domutils__WEBPACK_IMPORTED_MODULE_3__.innerText)(el);case"textContent":return(0,domutils__WEBPACK_IMPORTED_MODULE_3__.textContent)(el);case"outerHTML":return this.clone().wrap("<container />").parent().html();case"innerHTML":return this.html();default:return getProp(el,name,this.options.xmlMode)}}if(typeof name==="object"||value!==void 0){if(typeof value==="function"){if(typeof name==="object")throw new TypeError("Bad combination of arguments.");return(0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.domEach)(this,((el,i)=>{if((0,domhandler__WEBPACK_IMPORTED_MODULE_2__.isTag)(el))setProp(el,name,value.call(el,i,getProp(el,name,this.options.xmlMode)),this.options.xmlMode)}))}return(0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.domEach)(this,(el=>{if(!(0,domhandler__WEBPACK_IMPORTED_MODULE_2__.isTag)(el))return;if(typeof name==="object")for(const key of Object.keys(name)){const val=name[key];setProp(el,key,val,this.options.xmlMode)}else setProp(el,name,value,this.options.xmlMode)}))}return} /** * Sets the value of a data attribute. * * @private * @param elem - The element to set the data attribute on. * @param name - The data attribute's name. * @param value - The data attribute's value. */function setData(elem,name,value){var _a;(_a=elem.data)!==null&&_a!==void 0?_a:elem.data={};if(typeof name==="object")Object.assign(elem.data,name);else if(typeof name==="string"&&value!==void 0)elem.data[name]=value} /** * Read _all_ HTML5 `data-*` attributes from the equivalent HTML5 `data-*` * attribute, and cache the value in the node's internal data store. * * @private * @category Attributes * @param el - Element to get the data attribute of. * @returns A map with all of the data attributes. */function readAllData(el){for(const domName of Object.keys(el.attribs)){if(!domName.startsWith(dataAttrPrefix))continue;const jsName=(0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.camelCase)(domName.slice(dataAttrPrefix.length));if(!hasOwn.call(el.data,jsName))el.data[jsName]=parseDataValue(el.attribs[domName])}return el.data} /** * Read the specified attribute from the equivalent HTML5 `data-*` attribute, * and (if present) cache the value in the node's internal data store. * * @private * @category Attributes * @param el - Element to get the data attribute of. * @param name - Name of the data attribute. * @returns The data attribute's value. */function readData(el,name){const domName=dataAttrPrefix+(0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.cssCase)(name);const data=el.data;if(hasOwn.call(data,name))return data[name];if(hasOwn.call(el.attribs,domName))return data[name]=parseDataValue(el.attribs[domName]);return} /** * Coerce string data-* attributes to their corresponding JavaScript primitives. * * @private * @category Attributes * @param value - The value to parse. * @returns The parsed value. */function parseDataValue(value){if(value==="null")return null;if(value==="true")return true;if(value==="false")return false;const num=Number(value);if(value===String(num))return num;if(rbrace.test(value))try{return JSON.parse(value)}catch{ /* Ignore */}return value}function data(name,value){var _a;const elem=this[0];if(!elem||!(0,domhandler__WEBPACK_IMPORTED_MODULE_2__.isTag)(elem))return;const dataEl=elem;(_a=dataEl.data)!==null&&_a!==void 0?_a:dataEl.data={}; // Return the entire data object if no data specified if(name==null)return readAllData(dataEl); // Set the value (with attr map support) if(typeof name==="object"||value!==void 0){(0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.domEach)(this,(el=>{if((0,domhandler__WEBPACK_IMPORTED_MODULE_2__.isTag)(el))if(typeof name==="object")setData(el,name);else setData(el,name,value)}));return this}return readData(dataEl,name)}function val(value){const querying=arguments.length===0;const element=this[0];if(!element||!(0,domhandler__WEBPACK_IMPORTED_MODULE_2__.isTag)(element))return querying?void 0:this;switch(element.name){case"textarea":return this.text(value);case"select":{const option=this.find("option:selected");if(!querying){if(this.attr("multiple")==null&&typeof value==="object")return this;this.find("option").removeAttr("selected");const values=typeof value==="object"?value:[value];for(const val of values)this.find(`option[value="${val}"]`).attr("selected","");return this}return this.attr("multiple")?option.toArray().map((el=>(0,_static_js__WEBPACK_IMPORTED_MODULE_0__.text)(el.children))):option.attr("value")}case"input":case"option":return querying?this.attr("value"):this.attr("value",value)}return} /** * Remove an attribute. * * @private * @param elem - Node to remove attribute from. * @param name - Name of the attribute to remove. */function removeAttribute(elem,name){if(!elem.attribs||!hasOwn.call(elem.attribs,name))return;delete elem.attribs[name]} /** * Splits a space-separated list of names to individual names. * * @category Attributes * @param names - Names to split. * @returns - Split names. */function splitNames(names){return names?names.trim().split(rspace):[]} /** * Method for removing attributes by `name`. * * @category Attributes * @example * * ```js * $('.pear').removeAttr('class').html(); * //=> <li>Pear</li> * * $('.apple').attr('id', 'favorite'); * $('.apple').removeAttr('id class').html(); * //=> <li>Apple</li> * ``` * * @param name - Name of the attribute. * @returns The instance itself. * @see {@link https://api.jquery.com/removeAttr/} */function removeAttr(name){const attrNames=splitNames(name);for(const attrName of attrNames)(0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.domEach)(this,(elem=>{if((0,domhandler__WEBPACK_IMPORTED_MODULE_2__.isTag)(elem))removeAttribute(elem,attrName)}));return this} /** * Check to see if _any_ of the matched elements have the given `className`. * * @category Attributes * @example * * ```js * $('.pear').hasClass('pear'); * //=> true * * $('apple').hasClass('fruit'); * //=> false * * $('li').hasClass('pear'); * //=> true * ``` * * @param className - Name of the class. * @returns Indicates if an element has the given `className`. * @see {@link https://api.jquery.com/hasClass/} */function hasClass(className){return this.toArray().some((elem=>{const clazz=(0,domhandler__WEBPACK_IMPORTED_MODULE_2__.isTag)(elem)&&elem.attribs["class"];let idx=-1;if(clazz&&className.length>0)while((idx=clazz.indexOf(className,idx+1))>-1){const end=idx+className.length;if((idx===0||rspace.test(clazz[idx-1]))&&(end===clazz.length||rspace.test(clazz[end])))return true}return false}))} /** * Adds class(es) to all of the matched elements. Also accepts a `function`. * * @category Attributes * @example * * ```js * $('.pear').addClass('fruit').html(); * //=> <li class="pear fruit">Pear</li> * * $('.apple').addClass('fruit red').html(); * //=> <li class="apple fruit red">Apple</li> * ``` * * @param value - Name of new class. * @returns The instance itself. * @see {@link https://api.jquery.com/addClass/} */function addClass(value){ // Support functions if(typeof value==="function")return(0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.domEach)(this,((el,i)=>{if((0,domhandler__WEBPACK_IMPORTED_MODULE_2__.isTag)(el)){const className=el.attribs["class"]||"";addClass.call([el],value.call(el,i,className))}})); // Return if no value or not a string or function if(!value||typeof value!=="string")return this;const classNames=value.split(rspace);const numElements=this.length;for(let i=0;i<numElements;i++){const el=this[i]; // If selected element isn't a tag, move on if(!(0,domhandler__WEBPACK_IMPORTED_MODULE_2__.isTag)(el))continue; // If we don't already have classes — always set xmlMode to false here, as it doesn't matter for classes const className=getAttr(el,"class",false);if(className){let setClass=` ${className} `; // Check if class already exists for(const cn of classNames){const appendClass=`${cn} `;if(!setClass.includes(` ${appendClass}`))setClass+=appendClass}setAttr(el,"class",setClass.trim())}else setAttr(el,"class",classNames.join(" ").trim())}return this} /** * Removes one or more space-separated classes from the selected elements. If no * `className` is defined, all classes will be removed. Also accepts a * `function`. * * @category Attributes * @example * * ```js * $('.pear').removeClass('pear').html(); * //=> <li class="">Pear</li> * * $('.apple').addClass('red').removeClass().html(); * //=> <li class="">Apple</li> * ``` * * @param name - Name of the class. If not specified, removes all elements. * @returns The instance itself. * @see {@link https://api.jquery.com/removeClass/} */function removeClass(name){ // Handle if value is a function if(typeof name==="function")return(0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.domEach)(this,((el,i)=>{if((0,domhandler__WEBPACK_IMPORTED_MODULE_2__.isTag)(el))removeClass.call([el],name.call(el,i,el.attribs["class"]||""))}));const classes=splitNames(name);const numClasses=classes.length;const removeAll=arguments.length===0;return(0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.domEach)(this,(el=>{if(!(0,domhandler__WEBPACK_IMPORTED_MODULE_2__.isTag)(el))return;if(removeAll) // Short circuit the remove all case as this is the nice one el.attribs["class"]="";else{const elClasses=splitNames(el.attribs["class"]);let changed=false;for(let j=0;j<numClasses;j++){const index=elClasses.indexOf(classes[j]);if(index>=0){elClasses.splice(index,1);changed=true; /* * We have to do another pass to ensure that there are not duplicate * classes listed */j--}}if(changed)el.attribs["class"]=elClasses.join(" ")}}))} /** * Add or remove class(es) from the matched elements, depending on either the * class's presence or the value of the switch argument. Also accepts a * `function`. * * @category Attributes * @example * * ```js * $('.apple.green').toggleClass('fruit green red').html(); * //=> <li class="apple fruit red">Apple</li> * * $('.apple.green').toggleClass('fruit green red', true).html(); * //=> <li class="apple green fruit red">Apple</li> * ``` * * @param value - Name of the class. Can also be a function. * @param stateVal - If specified the state of the class. * @returns The instance itself. * @see {@link https://api.jquery.com/toggleClass/} */function toggleClass(value,stateVal){ // Support functions if(typeof value==="function")return(0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.domEach)(this,((el,i)=>{if((0,domhandler__WEBPACK_IMPORTED_MODULE_2__.isTag)(el))toggleClass.call([el],value.call(el,i,el.attribs["class"]||"",stateVal),stateVal)})); // Return if no value or not a string or function if(!value||typeof value!=="string")return this;const classNames=value.split(rspace);const numClasses=classNames.length;const state=typeof stateVal==="boolean"?stateVal?1:-1:0;const numElements=this.length;for(let i=0;i<numElements;i++){const el=this[i]; // If selected element isn't a tag, move on if(!(0,domhandler__WEBPACK_IMPORTED_MODULE_2__.isTag)(el))continue;const elementClasses=splitNames(el.attribs["class"]); // Check if class already exists for(let j=0;j<numClasses;j++){ // Check if the class name is currently defined const index=elementClasses.indexOf(classNames[j]); // Add if stateValue === true or we are toggling and there is no value if(state>=0&&index<0)elementClasses.push(classNames[j]);else if(state<=0&&index>=0) // Otherwise remove but only if the item exists elementClasses.splice(index,1)}el.attribs["class"]=elementClasses.join(" ")}return this} //# sourceMappingURL=attributes.js.map /***/}, /***/"./node_modules/cheerio/dist/browser/api/css.js": /*!******************************************************!*\ !*** ./node_modules/cheerio/dist/browser/api/css.js ***! \******************************************************/ /***/(__unused_webpack___webpack_module__,__webpack_exports__,__webpack_require__)=>{__webpack_require__.r(__webpack_exports__); /* harmony export */__webpack_require__.d(__webpack_exports__,{ /* harmony export */css:()=>/* binding */css /* harmony export */}); /* harmony import */var _utils_js__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__(/*! ../utils.js */"./node_modules/cheerio/dist/browser/utils.js"); /* harmony import */var domhandler__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__(/*! domhandler */"./node_modules/domhandler/lib/esm/index.js"); /** * Set multiple CSS properties for every matched element. * * @category CSS * @param prop - The names of the properties. * @param val - The new values. * @returns The instance itself. * @see {@link https://api.jquery.com/css/} */function css(prop,val){if(prop!=null&&val!=null|| // When `prop` is a "plain" object typeof prop==="object"&&!Array.isArray(prop))return(0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.domEach)(this,((el,i)=>{if((0,domhandler__WEBPACK_IMPORTED_MODULE_1__.isTag)(el)) // `prop` can't be an array here anymore. setCss(el,prop,val,i)}));if(this.length===0)return;return getCss(this[0],prop)} /** * Set styles of all elements. * * @private * @param el - Element to set style of. * @param prop - Name of property. * @param value - Value to set property to. * @param idx - Optional index within the selection. */function setCss(el,prop,value,idx){if(typeof prop==="string"){const styles=getCss(el);const val=typeof value==="function"?value.call(el,idx,styles[prop]):value;if(val==="")delete styles[prop];else if(val!=null)styles[prop]=val;el.attribs["style"]=stringify(styles)}else if(typeof prop==="object"){const keys=Object.keys(prop);for(let i=0;i<keys.length;i++){const k=keys[i];setCss(el,k,prop[k],i)}}}function getCss(el,prop){if(!el||!(0,domhandler__WEBPACK_IMPORTED_MODULE_1__.isTag)(el))return;const styles=parse(el.attribs["style"]);if(typeof prop==="string")return styles[prop];if(Array.isArray(prop)){const newStyles={};for(const item of prop)if(styles[item]!=null)newStyles[item]=styles[item];return newStyles}return styles} /** * Stringify `obj` to styles. * * @private * @category CSS * @param obj - Object to stringify. * @returns The serialized styles. */function stringify(obj){return Object.keys(obj).reduce(((str,prop)=>`${str}${str?" ":""}${prop}: ${obj[prop]};`),"")} /** * Parse `styles`. * * @private * @category CSS * @param styles - Styles to be parsed. * @returns The parsed styles. */function parse(styles){styles=(styles||"").trim();if(!styles)return{};const obj={};let key;for(const str of styles.split(";")){const n=str.indexOf(":"); // If there is no :, or if it is the first/last character, add to the previous item's value if(n<1||n===str.length-1){const trimmed=str.trimEnd();if(trimmed.length>0&&key!==void 0)obj[key]+=`;${trimmed}`}else{key=str.slice(0,n).trim();obj[key]=str.slice(n+1).trim()}}return obj} //# sourceMappingURL=css.js.map /***/}, /***/"./node_modules/cheerio/dist/browser/api/extract.js": /*!**********************************************************!*\ !*** ./node_modules/cheerio/dist/browser/api/extract.js ***! \**********************************************************/ /***/(__unused_webpack___webpack_module__,__webpack_exports__,__webpack_require__)=>{__webpack_require__.r(__webpack_exports__); /* harmony export */__webpack_require__.d(__webpack_exports__,{ /* harmony export */extract:()=>/* binding */extract /* harmony export */});function getExtractDescr(descr){var _a;if(typeof descr==="string")return{selector:descr,value:"textContent"};return{selector:descr.selector,value:(_a=descr.value)!==null&&_a!==void 0?_a:"textContent"}} /** * Extract multiple values from a document, and store them in an object. * * @param map - An object containing key-value pairs. The keys are the names of * the properties to be created on the object, and the values are the * selectors to be used to extract the values. * @returns An object containing the extracted values. */function extract(map){const ret={};for(const key in map){const descr=map[key];const isArray=Array.isArray(descr);const{selector,value}=getExtractDescr(isArray?descr[0]:descr);const fn=typeof value==="function"?value:typeof value==="string"?el=>this._make(el).prop(value):el=>this._make(el).extract(value);if(isArray)ret[key]=this._findBySelector(selector,Number.POSITIVE_INFINITY).map(((_,el)=>fn(el,key,ret))).get();else{const $=this._findBySelector(selector,1);ret[key]=$.length>0?fn($[0],key,ret):void 0}}return ret} //# sourceMappingURL=extract.js.map /***/}, /***/"./node_modules/cheerio/dist/browser/api/forms.js": /*!********************************************************!*\ !*** ./node_modules/cheerio/dist/browser/api/forms.js ***! \********************************************************/ /***/(__unused_webpack___webpack_module__,__webpack_exports__,__webpack_require__)=>{__webpack_require__.r(__webpack_exports__); /* harmony export */__webpack_require__.d(__webpack_exports__,{ /* harmony export */serialize:()=>/* binding */serialize /* harmony export */,serializeArray:()=>/* binding */serializeArray /* harmony export */}); /* harmony import */var domhandler__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__(/*! domhandler */"./node_modules/domhandler/lib/esm/index.js"); /* * https://github.com/jquery/jquery/blob/2.1.3/src/manipulation/var/rcheckableType.js * https://github.com/jquery/jquery/blob/2.1.3/src/serialize.js */const submittableSelector="input,select,textarea,keygen";const r20=/%20/g;const rCRLF=/\r?\n/g; /** * Encode a set of form elements as a string for submission. * * @category Forms * @example * * ```js * $('<form><input name="foo" value="bar" /></form>').serialize(); * //=> 'foo=bar' * ``` * * @returns The serialized form. * @see {@link https://api.jquery.com/serialize/} */function serialize(){ // Convert form elements into name/value objects const arr=this.serializeArray(); // Serialize each element into a key/value string const retArr=arr.map((data=>`${encodeURIComponent(data.name)}=${encodeURIComponent(data.value)}`)); // Return the resulting serialization return retArr.join("&").replace(r20,"+")} /** * Encode a set of form elements as an array of names and values. * * @category Forms * @example * * ```js * $('<form><input name="foo" value="bar" /></form>').serializeArray(); * //=> [ { name: 'foo', value: 'bar' } ] * ``` * * @returns The serialized form. * @see {@link https://api.jquery.com/serializeArray/} */function serializeArray(){ // Resolve all form elements from either forms or collections of form elements return this.map(((_,elem)=>{const $elem=this._make(elem);if((0,domhandler__WEBPACK_IMPORTED_MODULE_0__.isTag)(elem)&&elem.name==="form")return $elem.find(submittableSelector).toArray();return $elem.filter(submittableSelector).toArray()})).filter( // Verify elements have a name (`attr.name`) and are not disabled (`:enabled`) '[name!=""]:enabled'+ // And cannot be clicked (`[type=submit]`) or are used in `x-www-form-urlencoded` (`[type=file]`) ":not(:submit, :button, :image, :reset, :file)"+ // And are either checked/don't have a checkable state ":matches([checked], :not(:checkbox, :radio))").map(((_,elem)=>{var _a;const $elem=this._make(elem);const name=$elem.attr("name");// We have filtered for elements with a name before. // If there is no value set (e.g. `undefined`, `null`), then default value to empty const value=(_a=$elem.val())!==null&&_a!==void 0?_a:""; // If we have an array of values (e.g. `<select multiple>`), return an array of key/value pairs if(Array.isArray(value))return value.map((val=>( /* * We trim replace any line endings (e.g. `\r` or `\r\n` with `\r\n`) to guarantee consistency across platforms * These can occur inside of `<textarea>'s` */ {name,value:val.replace(rCRLF,"\r\n")}))); // Otherwise (e.g. `<input type="text">`, return only one key/value pair return{name,value:value.replace(rCRLF,"\r\n")}})).toArray()} //# sourceMappingURL=forms.js.map /***/}, /***/"./node_modules/cheerio/dist/browser/api/manipulation.js": /*!***************************************************************!*\ !*** ./node_modules/cheerio/dist/browser/api/manipulation.js ***! \***************************************************************/ /***/(__unused_webpack___webpack_module__,__webpack_exports__,__webpack_require__)=>{__webpack_require__.r(__webpack_exports__); /* harmony export */__webpack_require__.d(__webpack_exports__,{ /* harmony export */_makeDomArray:()=>/* binding */_makeDomArray /* harmony export */,after:()=>/* binding */after /* harmony export */,append:()=>/* binding */append /* harmony export */,appendTo:()=>/* binding */appendTo /* harmony export */,before:()=>/* binding */before /* harmony export */,clone:()=>/* binding */clone /* harmony export */,empty:()=>/* binding */empty /* harmony export */,html:()=>/* binding */html /* harmony export */,insertAfter:()=>/* binding */insertAfter /* harmony export */,insertBefore:()=>/* binding */insertBefore /* harmony export */,prepend:()=>/* binding */prepend /* harmony export */,prependTo:()=>/* binding */prependTo /* harmony export */,remove:()=>/* binding */remove /* harmony export */,replaceWith:()=>/* binding */replaceWith /* harmony export */,text:()=>/* binding */text /* harmony export */,toString:()=>/* binding */toString /* harmony export */,unwrap:()=>/* binding */unwrap /* harmony export */,wrap:()=>/* binding */wrap /* harmony export */,wrapAll:()=>/* binding */wrapAll /* harmony export */,wrapInner:()=>/* binding */wrapInner /* harmony export */}); /* harmony import */var domhandler__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__(/*! domhandler */"./node_modules/domhandler/lib/esm/index.js"); /* harmony import */var _parse_js__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__(/*! ../parse.js */"./node_modules/cheerio/dist/browser/parse.js"); /* harmony import */var _static_js__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__(/*! ../static.js */"./node_modules/cheerio/dist/browser/static.js"); /* harmony import */var _utils_js__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__(/*! ../utils.js */"./node_modules/cheerio/dist/browser/utils.js"); /* harmony import */var domutils__WEBPACK_IMPORTED_MODULE_4__=__webpack_require__(/*! domutils */"./node_modules/domutils/lib/esm/index.js"); /** * Methods for modifying the DOM structure. * * @module cheerio/manipulation */ /** * Create an array of nodes, recursing into arrays and parsing strings if * necessary. * * @private * @category Manipulation * @param elem - Elements to make an array of. * @param clone - Optionally clone nodes. * @returns The array of nodes. */function _makeDomArray(elem,clone){if(elem==null)return[];if(typeof elem==="string")return this._parse(elem,this.options,false,null).children.slice(0);if("length"in elem){if(elem.length===1)return this._makeDomArray(elem[0],clone);const result=[];for(let i=0;i<elem.length;i++){const el=elem[i];if(typeof el==="object"){if(el==null)continue;if(!("length"in el)){result.push(clone?(0,domhandler__WEBPACK_IMPORTED_MODULE_0__.cloneNode)(el,true):el);continue}}result.push(...this._makeDomArray(el,clone))}return result}return[clone?(0,domhandler__WEBPACK_IMPORTED_MODULE_0__.cloneNode)(elem,true):elem]}function _insert(concatenator){return function(...elems){const lastIdx=this.length-1;return(0,_utils_js__WEBPACK_IMPORTED_MODULE_3__.domEach)(this,((el,i)=>{if(!(0,domhandler__WEBPACK_IMPORTED_MODULE_0__.hasChildren)(el))return;const domSrc=typeof elems[0]==="function"?elems[0].call(el,i,this._render(el.children)):elems;const dom=this._makeDomArray(domSrc,i<lastIdx);concatenator(dom,el.children,el)}))}} /** * Modify an array in-place, removing some number of elements and adding new * elements directly following them. * * @private * @category Manipulation * @param array - Target array to splice. * @param spliceIdx - Index at which to begin changing the array. * @param spliceCount - Number of elements to remove from the array. * @param newElems - Elements to insert into the array. * @param parent - The parent of the node. * @returns The spliced array. */function uniqueSplice(array,spliceIdx,spliceCount,newElems,parent){var _a,_b;const spliceArgs=[spliceIdx,spliceCount,...newElems];const prev=spliceIdx===0?null:array[spliceIdx-1];const next=spliceIdx+spliceCount>=array.length?null:array[spliceIdx+spliceCount]; /* * Before splicing in new elements, ensure they do not already appear in the * current array. */for(let idx=0;idx<newElems.length;++idx){const node=newElems[idx];const oldParent=node.parent;if(oldParent){const oldSiblings=oldParent.children;const prevIdx=oldSiblings.indexOf(node);if(prevIdx>-1){oldParent.children.splice(prevIdx,1);if(parent===oldParent&&spliceIdx>prevIdx)spliceArgs[0]--}}node.parent=parent;if(node.prev)node.prev.next=(_a=node.next)!==null&&_a!==void 0?_a:null;if(node.next)node.next.prev=(_b=node.prev)!==null&&_b!==void 0?_b:null;node.prev=idx===0?prev:newElems[idx-1];node.next=idx===newElems.length-1?next:newElems[idx+1]}if(prev)prev.next=newElems[0];if(next)next.prev=newElems[newElems.length-1];return array.splice(...spliceArgs)} /** * Insert every element in the set of matched elements to the end of the target. * * @category Manipulation * @example * * ```js * $('<li class="plum">Plum</li>').appendTo('#fruits'); * $.html(); * //=> <ul id="fruits"> * // <li class="apple">Apple</li> * // <li class="orange">Orange</li> * // <li class="pear">Pear</li> * // <li class="plum">Plum</li> * // </ul> * ``` * * @param target - Element to append elements to. * @returns The instance itself. * @see {@link https://api.jquery.com/appendTo/} */function appendTo(target){const appendTarget=(0,_utils_js__WEBPACK_IMPORTED_MODULE_3__.isCheerio)(target)?target:this._make(target);appendTarget.append(this);return this} /** * Insert every element in the set of matched elements to the beginning of the * target. * * @category Manipulation * @example * * ```js * $('<li class="plum">Plum</li>').prependTo('#fruits'); * $.html(); * //=> <ul id="fruits"> * // <li class="plum">Plum</li> * // <li class="apple">Apple</li> * // <li class="orange">Orange</li> * // <li class="pear">Pear</li> * // </ul> * ``` * * @param target - Element to prepend elements to. * @returns The instance itself. * @see {@link https://api.jquery.com/prependTo/} */function prependTo(target){const prependTarget=(0,_utils_js__WEBPACK_IMPORTED_MODULE_3__.isCheerio)(target)?target:this._make(target);prependTarget.prepend(this);return this} /** * Inserts content as the _last_ child of each of the selected elements. * * @category Manipulation * @example * * ```js * $('ul').append('<li class="plum">Plum</li>'); * $.html(); * //=> <ul id="fruits"> * // <li class="apple">Apple</li> * // <li class="orange">Orange</li> * // <li class="pear">Pear</li> * // <li class="plum">Plum</li> * // </ul> * ``` * * @see {@link https://api.jquery.com/append/} */const append=_insert(((dom,children,parent)=>{uniqueSplice(children,children.length,0,dom,parent)})); /** * Inserts content as the _first_ child of each of the selected elements. * * @category Manipulation * @example * * ```js * $('ul').prepend('<li class="plum">Plum</li>'); * $.html(); * //=> <ul id="fruits"> * // <li class="plum">Plum</li> * // <li class="apple">Apple</li> * // <li class="orange">Orange</li> * // <li class="pear">Pear</li> * // </ul> * ``` * * @see {@link https://api.jquery.com/prepend/} */const prepend=_insert(((dom,children,parent)=>{uniqueSplice(children,0,0,dom,parent)}));function _wrap(insert){return function(wrapper){const lastIdx=this.length-1;const lastParent=this.parents().last();for(let i=0;i<this.length;i++){const el=this[i];const wrap=typeof wrapper==="function"?wrapper.call(el,i,el):typeof wrapper==="string"&&!(0,_utils_js__WEBPACK_IMPORTED_MODULE_3__.isHtml)(wrapper)?lastParent.find(wrapper).clone():wrapper;const[wrapperDom]=this._makeDomArray(wrap,i<lastIdx);if(!wrapperDom||!(0,domhandler__WEBPACK_IMPORTED_MODULE_0__.hasChildren)(wrapperDom))continue;let elInsertLocation=wrapperDom; /* * Find the deepest child. Only consider the first tag child of each node * (ignore text); stop if no children are found. */let j=0;while(j<elInsertLocation.children.length){const child=elInsertLocation.children[j];if((0,domhandler__WEBPACK_IMPORTED_MODULE_0__.isTag)(child)){elInsertLocation=child;j=0}else j++}insert(el,elInsertLocation,[wrapperDom])}return this}} /** * The .wrap() function can take any string or object that could be passed to * the $() factory function to specify a DOM structure. This structure may be * nested several levels deep, but should contain only one inmost element. A * copy of this structure will be wrapped around each of the elements in the set * of matched elements. This method returns the original set of elements for * chaining purposes. * * @category Manipulation * @example * * ```js * const redFruit = $('<div class="red-fruit"></div>'); * $('.apple').wrap(redFruit); * * //=> <ul id="fruits"> * // <div class="red-fruit"> * // <li class="apple">Apple</li> * // </div> * // <li class="orange">Orange</li> * // <li class="plum">Plum</li> * // </ul> * * const healthy = $('<div class="healthy"></div>'); * $('li').wrap(healthy); * * //=> <ul id="fruits"> * // <div class="healthy"> * // <li class="apple">Apple</li> * // </div> * // <div class="healthy"> * // <li class="orange">Orange</li> * // </div> * // <div class="healthy"> * // <li class="plum">Plum</li> * // </div> * // </ul> * ``` * * @param wrapper - The DOM structure to wrap around each element in the * selection. * @see {@link https://api.jquery.com/wrap/} */const wrap=_wrap(((el,elInsertLocation,wrapperDom)=>{const{parent}=el;if(!parent)return;const siblings=parent.children;const index=siblings.indexOf(el);(0,_parse_js__WEBPACK_IMPORTED_MODULE_1__.update)([el],elInsertLocation); /* * The previous operation removed the current element from the `siblings` * array, so the `dom` array can be inserted without removing any * additional elements. */uniqueSplice(siblings,index,0,wrapperDom,parent)})); /** * The .wrapInner() function can take any string or object that could be passed * to the $() factory function to specify a DOM structure. This structure may be * nested several levels deep, but should contain only one inmost element. The * structure will be wrapped around the content of each of the elements in the * set of matched elements. * * @category Manipulation * @example * * ```js * const redFruit = $('<div class="red-fruit"></div>'); * $('.apple').wrapInner(redFruit); * * //=> <ul id="fruits"> * // <li class="apple"> * //