PageSourceSearch

https://www.melgeek.com/cdn/shop/t/121/assets/kik-accessory-core.js?v=176761982888801851111789634318

js melgeek.com collected 2026-10-02 17:25:29 UTC 2,637 bytes, 2 lines download raw bytes

1(function(root){"use strict";const compatible=(entry,variantId)=>entry.scope==="all"||entry.scope==="variants"&&entry.keyboardVariants.includes(String(variantId)),signature=item=>JSON.stringify([String(item.variant_id||item.id),String(item.selling_plan_allocation?.selling_plan?.id||item.selling_plan||""),Object.entries(item.properties||{}).filter(([,value])=>value!==""&&value!=null).sort(([a],[b])=>a.localeCompare(b))]),quantityOf=(cart,item)=>cart.items.reduce((sum,line)=>sum+(signature(line)===signature(item)?line.quantity:0),0),reconcile=(before,after,items)=>items.map(item=>{const added=Math.max(0,quantityOf(after,item)-quantityOf(before,item));return{...item,added,missing:Math.max(0,item.quantity-added)}}),selectVariant=(variants,selected,fallbackId,names)=>{const options=Object.entries(selected||{});return options.length?variants.find(variant=>options.length===variant.options.length&&options.every(([key,value])=>{const index=names.indexOf(key);return index>=0&&(variant[`option${index+1}`]??variant.options[index])===value})):variants.find(variant=>String(variant.id)===String(fallbackId))};class Purchase{constructor(fetcher,rootUrl){this.fetcher=fetcher,this.rootUrl=rootUrl,this.busy=!1,this.uncertain=!1}async request(path,options={}){const controller=new AbortController,timer=setTimeout(()=>controller.abort(),15e3);try{const response=await this.fetcher(this.rootUrl+path,{...options,signal:controller.signal,cache:"no-store"}),data=await response.json();if(!response.ok||data.status>=400||data.errors)throw new Error(data.description||data.message||"Cart request failed");return data}finally{clearTimeout(timer)}}async add(items,sections,path){if(this.busy||this.uncertain)return{blocked:!0};this.busy=!0;let before,attempted=!1,data,error;try{before=await this.request("cart.js"),attempted=!0;try{data=await this.request("cart/add.js",{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify({items,sections,sections_url:path})})}catch(failure){error=failure}const after=await this.request("cart.js"),lines=reconcile(before,after,items),complete=!error&&lines.every(line=>line.missing===0);return this.uncertain=!complete,{complete,lines,cart:after,sections:data?.sections,error}}catch(failure){return this.uncertain=attempted,{complete:!1,uncertain:attempted,error:failure}}finally{this.busy=!1}}}const api={compatible,signature,reconcile,selectVariant,Purchase};typeof module<"u"&&module.exports?module.exports=api:root.KikAccessoryCore=api})(globalThis);
2//# sourceMappingURL=/cdn/shop/t/121/assets/kik-accessory-core.js.map?v=176761982888801851111789634318

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.