PageSourceSearch

https://www.siminn.is/_next/static/chunks/13498.aaf14d9f7376e27e.js

js siminn.is collected 2026-09-24 09:32:16 UTC 11,184 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[13498],{13498:(e,t,r)=>{r.r(t),r.d(t,{createConnection:()=>k});var s=r(32978),o=r(66693),n=r(93054),i=r(85068),a=r(84046),c=r(41774);r(96336),r(78075);var l=r(32899),u=r(46112),h=r(69052),d=r(5539),g=r(41961),f=r(953);let y=class extends f.nJ{destroy(){this.emit("destroy")}get connectionError(){return this.errorString?new n.A("stream-connection",this.errorString):null}onFeature(e){this.emit("data-received",e)}onMessage(e){this.emit("message-received",e)}};(0,s.Cg)([(0,d.MZ)({readOnly:!0})],y.prototype,"connectionError",null),y=(0,s.Cg)([(0,l.$)("esri.layers.support.StreamConnection")],y);let _=class extends y{constructor(e){super({}),this._outstandingMessages=[],this.errorString=null;const{geometryType:t,spatialReference:r,sourceSpatialReference:s}=e;this._config=e,this._featureZScaler=(0,g.N)(t,s,r),this._open()}normalizeCtorArgs(){return{}}async _open(){await this._tryCreateWebSocket(),this.destroyed||await this._handshake()}destroy(){super.destroy(),null!=this._websocket&&(this._websocket.onopen=null,this._websocket.onclose=null,this._websocket.onerror=null,this._websocket.onmessage=null,this._websocket.close()),this._websocket=null}get connectionStatus(){if(null==this._websocket)return"disconnected";switch(this._websocket.readyState){case 0:case 1:return"connected";case 2:case 3:return"disconnected"}}sendMessageToSocket(e){null!=this._websocket?this._websocket.send(JSON.stringify(e)):this._outstandingMessages.push(e)}sendMessageToClient(e){this._onMessage(e)}updateCustomParameters(e){this._config.customParameters=e,null!=this._websocket&&this._websocket.close()}async _tryCreateWebSocket(e=this._config.source.path,t=1e3,r=0){try{if(this.destroyed)return;let t=(0,c.a6)(e,this._config.customParameters??{});this._websocket=await this._createWebSocket(t),this.notifyChange("connectionStatus")}catch(o){let s=t/1e3;return this._config.maxReconnectionAttempts&&r>=this._config.maxReconnectionAttempts?(i.A.getLogger(this).error(new n.A("websocket-connection","Exceeded maxReconnectionAttempts attempts. No further attempts will be made")),void this.destroy()):(i.A.getLogger(this).error(new n.A("websocket-connection",`Failed to connect. Attempting to reconnect in ${s}s`,o)),await (0,a.Pl)(t),this._tryCreateWebSocket(e,Math.min(1.5*t,1e3*this._config.maxReconnectionInterval),r+1))}}_setWebSocketJSONParseHandler(e){e.onmessage=e=>{try{let t=JSON.parse(e.data);this._onMessage(t)}catch(e){return void i.A.getLogger(this).error(new n.A("websocket-connection","Failed to parse message, invalid JSON",{error:e}))}}}_createWebSocket(e){return new Promise((t,r)=>{let s=new WebSocket(e);s.onopen=()=>{(s.onopen=null,this.destroyed)?(s.onclose=null,s.close()):(s.onclose=e=>this._onClose(e),s.onerror=e=>this._onError(e),this._setWebSocketJSONParseHandler(s),t(s))},s.onclose=e=>{s.onopen=s.onclose=null,r(e)}})}async _handshake(e=1e4){let t=this._websocket;if(null==t)return;let r=(0,a.Tw)(),s=t.onmessage,{filter:o,outFields:c,spatialReference:l}=this._config;return r.timeout(e),t.onmessage=e=>{let a=null;try{a=JSON.parse(e.data)}catch(e){}for(let u of(a&&"object"==typeof a||(i.A.getLogger(this).error(new n.A("websocket-connection","Protocol violation. Handshake failed - malformed message",e.data)),r.reject(),this.destroy()),a.spatialReference?.wkid!==l?.wkid&&(i.A.getLogger(this).error(new n.A("websocket-connection",`Protocol violation. Handshake failed - expected wkid of ${l.wkid}`,e.data)),r.reject(),this.destroy()),"json"!==a.format&&(i.A.getLogger(this).error(new n.A("websocket-connection","Protocol violation. Handshake failed - format is not set",e.data)),r.reject(),this.destroy()),o&&a.filter!==o&&i.A.getLogger(this).error(new n.A("websocket-connection","Tried to set filter, but server doesn't support it")),c&&a.outFields!==c&&i.A.getLogger(this).error(new n.A("websocket-connection","Tried to set outFields, but server doesn't support it")),t.onmessage=s,this._outstandingMessages))t.send(JSON.stringify(u));this._outstandingMessages=[],r.resolve()},t.send(JSON.stringify({filter:o,outFields:c,format:"json",spatialReference:{wkid:l.wkid}})),r.promise}_onMessage(e){if(this.onMessage(e),"type"in e)switch(e.type){case"features":case"featureResult":for(let t of e.features)null!=this._featureZScaler&&this._featureZScaler(t.geometry),this.onFeature(t)}}_onError(e){let t="Encountered an error over WebSocket connection";this._set("errorString",t),i.A.getLogger(this).error("websocket-connection",t)}_onClose(e){this._websocket=null,this.notifyChange("connectionStatus"),1e3!==e.code&&i.A.getLogger(this).error("websocket-connection",`WebSocket closed unexpectedly with error code ${e.code}`),this.destroyed||this._open()}};(0,s.Cg)([(0,d.MZ)()],_.prototype,"connectionStatus",null),(0,s.Cg)([(0,d.MZ)()],_.prototype,"errorString",void 0),_=(0,s.Cg)([(0,l.$)("esri.layers.graphics.sources.connections.WebSocketConnection")],_);var p=r(58343),w=r(47129);let m={maxQueryDepth:5,maxRecordCountFactor:3},S=class extends _{constructor(e){super({...m,...e}),this._buddyServicesQuery=null,this._relatedFeatures=null}async _open(){let e=await this._fetchServiceDefinition(this._config.source);e.timeInfo.trackIdField||i.A.getLogger(this).warn("GeoEvent service was configured without a TrackIdField. This may result in certain functionality being disabled. The purgeOptions.maxObservations property will have no effect.");let t=this._fetchWebSocketUrl(e.streamUrls,this._config.spatialReference);
1this._buddyServicesQuery||(this._buddyServicesQuery=this._queryBuddyServices()),await this._buddyServicesQuery,await this._tryCreateWebSocket(t);let{filter:r,outFields:s}=this._config;this.destroyed||this._setFilter(r,s)}_onMessage(e){if("attributes"in e){let t;try{t=this._enrich(e),null!=this._featureZScaler&&this._featureZScaler(t.geometry)}catch(e){return void i.A.getLogger(this).error(new n.A("geoevent-connection","Failed to parse message",e))}this.onFeature(t)}else this.onMessage(e)}async _fetchServiceDefinition(e){let t={f:"json",...this._config.customParameters},r=(0,o.A)(e.path,{query:t,responseType:"json"}),s=(await r).data;return this._serviceDefinition=s,s}_fetchWebSocketUrl(e,t){let{urls:r,token:s}=e[0],o=this._inferWebSocketBaseUrl(r);return(0,c.a6)(`${o}/subscribe`,{outSR:""+t.wkid,token:s})}_inferWebSocketBaseUrl(e){if(1===e.length)return e[0];for(let t of e)if(t.includes("wss"))return t;return i.A.getLogger(this).error(new n.A("geoevent-connection","Unable to infer WebSocket url",e)),null}async _setFilter(e,t){let r=this._websocket;if(null==r||null==e&&null==t)return;let s=JSON.stringify({filter:this._serializeFilter(e,t)}),o=!1,c=(0,a.Tw)(),l=()=>{o||(this.destroyed||this._websocket!==r||i.A.getLogger(this).error(new n.A("geoevent-connection","Server timed out when setting filter")),c.reject())},u=e=>{let t=JSON.parse(e.data);t.filter&&(t.error&&(i.A.getLogger(this).error(new n.A("geoevent-connection","Failed to set service filter",t.error)),this._set("errorString",`Could not set service filter - ${t.error}`),c.reject(t.error)),this._setWebSocketJSONParseHandler(r),o=!0,c.resolve())};return r.onmessage=u,r.send(s),setTimeout(l,1e4),c.promise}_serializeFilter(e,t){let r={};if(null==e&&null==t)return r;if(e?.geometry)try{let t=(0,h.rS)(e.geometry);if("extent"!==t.type)throw new n.A("geoevent-connection",`Expected extent but found type ${t.type}`);r.geometry=JSON.stringify(t.shiftCentralMeridian())}catch(e){i.A.getLogger(this).error(new n.A("geoevent-connection","Encountered an error when setting connection geometryDefinition",e))}return e?.where&&"1 = 1"!==e.where&&"1=1"!==e.where&&(r.where=e.where),null!=t&&(r.outFields=t.join(",")),r}_enrich(e){if(!this._relatedFeatures)return e;let t=this._serviceDefinition.relatedFeatures.joinField,r=e.attributes[t],s=this._relatedFeatures.get(r);if(!s)return i.A.getLogger(this).warn("geoevent-connection","Feature join failed. Is the join field configured correctly?",e),e;let{attributes:o,geometry:a}=s;for(let t in o)e.attributes[t]=o[t];return a&&(e.geometry=a),e.geometry||e.centroid||i.A.getLogger(this).error(new n.A("geoevent-connection","Found malformed feature - no geometry found",e)),e}async _queryBuddyServices(){try{let{relatedFeatures:e,keepLatestArchive:t}=this._serviceDefinition,r=this._queryRelatedFeatures(e),s=this._queryArchive(t);await r;let o=await s;if(!o)return;for(let e of o.features)this.onFeature(this._enrich(e))}catch(e){i.A.getLogger(this).error(new n.A("geoevent-connection","Encountered an error when querying buddy services",{error:e}))}}async _queryRelatedFeatures(e){if(!e)return;let t=await this._queryBuddy(e.featuresUrl);this._addRelatedFeatures(t)}async _queryArchive(e){if(e)return this._queryBuddy(e.featuresUrl)}async _queryBuddy(e){let t=new(await Promise.all([r.e(3846),r.e(94919),r.e(86183),r.e(93186),r.e(54502),r.e(6841),r.e(48922)]).then(r.bind(r,54502))).default({url:e}),{capabilities:s}=await t.load(),o=s.query.supportsMaxRecordCountFactor,n=s.query.supportsPagination,i=s.query.supportsCentroid,a=this._config.maxRecordCountFactor,c=t.capabilities.query.maxRecordCount,l=o?c*a:c,h=new w.A;if(h.outFields=this._config.outFields??["*"],h.where=this._config.filter?.where??"1=1",h.returnGeometry=!0,h.returnExceededLimitFeatures=!0,h.outSpatialReference=u.A.fromJSON(this._config.spatialReference),i&&(h.returnCentroid=!0),o&&(h.maxRecordCountFactor=a),n)return h.num=l,t.destroy(),this._queryPages(e,h);let d=await (0,p.eW)(e,h,this._config.sourceSpatialReference);return t.destroy(),d.data}async _queryPages(e,t,r=[],s=0){t.start=null!=t.num?s*t.num:null;let{data:o}=await (0,p.eW)(e,t,this._config.sourceSpatialReference);return o.exceededTransferLimit&&s<(this._config.maxQueryDepth??0)?(o.features.forEac
1h(e=>r.push(e)),this._queryPages(e,t,r,s+1)):(r.forEach(e=>o.features.push(e)),o)}_addRelatedFeatures(e){let t=new Map,r=e.features,s=this._serviceDefinition.relatedFeatures.joinField;for(let e of r){let r=e.attributes[s];t.set(r,e)}this._relatedFeatures=t}};S=(0,s.Cg)([(0,l.$)("esri.layers.graphics.sources.connections.GeoEventConnection")],S);let b=class extends y{constructor(e){super({}),this.connectionStatus="connected",this.errorString=null;const{geometryType:t,spatialReference:r,sourceSpatialReference:s}=e;this._featureZScaler=(0,g.N)(t,s,r)}normalizeCtorArgs(){return{}}updateCustomParameters(e){}sendMessageToSocket(e){}sendMessageToClient(e){if("type"in e)switch(e.type){case"features":case"featureResult":for(let t of e.features)null!=this._featureZScaler&&this._featureZScaler(t.geometry),this.onFeature(t)}this.onMessage(e)}};function k(e,t,r,s,o,n,i,a,c){let l={source:e,sourceSpatialReference:t,spatialReference:r,geometryType:s,filter:function(e,t){if(null==e&&null==t)return null;let r={};return null!=t&&(r.geometry=t),null!=e&&(r.where=e),r}(o,n),maxReconnectionAttempts:i,maxReconnectionInterval:a,customParameters:c};return e?e.path.startsWith("wss://")||e.path.startsWith("ws://")?new _(l):new S(l):new b(l)}(0,s.Cg)([(0,d.MZ)()],b.prototype,"connectionStatus",void 0),(0,s.Cg)([(0,d.MZ)()],b.prototype,"errorString",void 0),b=(0,s.Cg)([(0,l.$)("esri.layers.support.ClientSideConnection")],b)}}]);

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.