PageSourceSearch

https://cheese-stories.ru/6376.e4e930dc46740a8c.js

js cheese-stories.ru collected 2026-09-30 17:28:28 UTC 5,411 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunkyumapos_web_client_mobile=self.webpackChunkyumapos_web_client_mobile||[]).push([[6376],{6376(O,C,b){b.r(C),b.d(C,{YMapClusterer:()=>f,clusterByGrid:()=>F});const w=(c,t)=>{let e,s,r;return function(){const o=this,i=arguments;e?(clearTimeout(s),s=setTimeout(()=>{Date.now()-r>=t&&(c.apply(o,i),r=Date.now())},Math.max(t-(Date.now()-r),0))):(c.apply(o,i),r=Date.now(),e=!0)}},k={props:{method:{type:Object,required:!0},features:{type:Array,required:!0},marker:Function,cluster:Function,tickTimeout:{type:Number,default:200},onRender:Function,maxZoom:{type:Number}}};var g,v,M;const I=Object.freeze({tickTimeout:200});class f extends ymaps3.YMapComplexEntity{constructor(t){super(t),this._entitiesCache={},this._visibleEntities={},this._render=this._render.bind(this)}_isVisible(t,e,s){const{x:r,y:o}=s.toWorldCoordinates(t.geometry.coordinates),{x:i,y:n}=s.toWorldCoordinates(e[0]),{x:l,y:a}=s.toWorldCoordinates(e[1]),h=l-i,u=n-a;return i-h/2<=r&&l+h/2>=r&&n+u/2>=o&&a-u/2<=o}_getEntity({lnglat:t,features:e,clusterId:s}){let r=this._entitiesCache[s];return r||(r=1===e.length?this._props.marker(e[0]):this._props.cluster(t,e),this._entitiesCache[s]=r),r}_getVisibleEntities(t){const e={};return t.forEach(s=>{const r=this._getEntity(s);e[s.clusterId]=r}),e}_syncVisibleEntities(t){for(const e in this._visibleEntities)t[e]||this._container.removeChild(this._visibleEntities[e]);for(const e in t)this._visibleEntities[e]||this._container.addChild(t[e])}_render({mapInAction:t}={}){const e=this.root;if(!e||t)return;const s=this._props.features.filter(i=>this._isVisible(i,e.bounds,e.projection));let r;if(r=this._props.maxZoom&&e.zoom>this._props.maxZoom?s.map(i=>({world:e.projection.toWorldCoordinates(i.geometry.coordinates),lnglat:i.geometry.coordinates,clusterId:i.id,features:[i]})):this._props.method.render({map:e,features:s}),this._props.onRender&&!1===this._props.onRender(r))return;const o=this._getVisibleEntities(r);this._syncVisibleEntities(o),this._visibleEntities=o}_onAttach(){this._entitiesCache={},this._visibleEntities={},this._container=new ymaps3.YMapCollection({}),this.addChild(this._container);const t=this._props.tickTimeout?w(this._render,this._props.tickTimeout):this._render;this._mapListener=new ymaps3.YMapListener({onUpdate:t,onResize:t}),this.addChild(this._mapListener),this._render()}_onDetach(){this.removeChild(this._container),this.removeChild(this._mapListener),this._entitiesCache={},this._visibleEntities={}}_onUpdate(){this._render()}}function E(c,t,e){const s=2**t/2*256;return function T(c,t,e={x:0,y:0}){return e.x=c.x/t.x,e.y=c.y/t.y,e}(c,{x:s,y:-s},e)}
1g=ymaps3.overrideKeyReactify,v=ymaps3.overrideKeyVuefy,M=ymaps3.optionsKeyVuefy,f.__implName="YMapClusterer",f.defaultProps=I,f[g]=(c,{reactify:t,React:e})=>{const s=t.entity(c);return e.forwardRef((o,i)=>{const[n,l]=e.useState([]),a=e.useCallback(h=>{const u={};return h.forEach(({lnglat:y,features:d,clusterId:p})=>{u[p]=e.createElement(e.Fragment,{key:p},1===d.length?o.marker(d[0]):o.cluster(y,d))}),l(Object.values(u)),!1},[o]);return e.createElement(e.Fragment,null,e.createElement(s,{...o,ref:i,onRender:a}),n)})},f[v]=(c,t,{vuefy:e,Vue:s})=>{const r=e.entity(c,t),o=e.entity(ymaps3.YMapCollection);return s.defineComponent({name:"YMapClustererContainer",props:t,slots:Object,setup(i,{slots:n}){const l=s.ref(null),a=h=>{const u={};return h.forEach(({lnglat:y,features:d,clusterId:p})=>{var _,m;u[p]=s.h(s.Fragment,{key:p},1===d.length?null===(_=n.marker)||void 0===_?void 0:_.call(n,{feature:d[0]}):null===(m=n.cluster)||void 0===m?void 0:m.call(n,{coordinates:y,features:d}))}),l.value=Object.values(u),!1};return()=>[s.h(r,{...i,onRender:a}),s.h(o,()=>l.value)]}})},f[M]=k;class V{constructor(t){this._nextFeatureIndex=0,this._featureIdCharCache={},this._gridSize=t}_getClusterSizeWorld(t){return E({x:this._gridSize,y:0},t).x}_computeVisibleClusters(t,e,s){const r=function S(c,t,e={x:0,y:0}){return e.x=c.x/t,e.y=c.y/t,e}(E(t,e),2),o=s.y+r.y,i=s.y-r.y,n=s.x-r.x,l=s.x+r.x,a=this._getClusterSizeWorld(e),h=Math.floor(n/a),u=Math.ceil(l/a),y=Math.floor(o/a),d=Math.ceil(i/a),p=new Map;for(let _=h;_<=u;_++)for(let m=y;m<=d;m++)p.set(`${_}-${m}`,!0);return p}_clusterize(t,e,s){const r=new Map,o=this._getClusterSizeWorld(s);for(const i of e){const n={world:t.projection.toWorldCoordinates(i.geometry.coordinates),lnglat:i.geometry.coordinates,clusterId:"",features:[i]},h=`${Math.floor(n.world.x/o)}-${Math.floor(n.world.y/o)}`;let u=r.get(h);u||(u={sumX:0,sumY:0,objects:[],features:[]},r.set(h,u)),u.sumX+=n.world.x,u.sumY+=n.world.y,u.objects.push(n),u.features.push(n.features[0])}return r}_generateClusterId(t){const e=["cluster-"];return t.forEach(({id:s})=>{this._featureIdCharCache[s]||(this._featureIdCharCache[s]=String.fromCharCode(this._nextFeatureIndex),this._nextFeatureIndex+=1),e.push(this._featureIdCharCache[s])}),e.join("")}render({map:t,features:e}){const s=Math.round(t.zoom),r=this._computeVisibleClusters(t.size,s,t.projection.toWorldCoordinates(t.center)),o=this._clusterize(t,e,s),i=[];for(const[n,l]of o.entries()){if(!r.get(n))continue;const a=l.objects.length;if(1===a)i.push({...l.objects[0],clusterId:l.features[0].id});else{const h={x:l.sumX/a,y:l.sumY/a};i.push({world:h,lnglat:t.projection.fromWorldCoordinates(h),clusterId:this._generateClusterId(l.features),features:l.features})}}return i}}function F({gridSize:c}){return new V(c)}}}]);

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.