@kmhgmbh/dialer-vue-components
Version:
VueJS components for telephony and dialer functions 2
3 lines • 307 kB
JavaScript
"use strict";var vo=Object.defineProperty;var So=(f,n,s)=>n in f?vo(f,n,{enumerable:!0,configurable:!0,writable:!0,value:s}):f[n]=s;var he=(f,n,s)=>(So(f,typeof n!="symbol"?n+"":n,s),s);Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const h=require("vue");class Co{constructor(n){he(this,"baseUrl");this.baseUrl=n.baseUrl!==void 0?n.baseUrl:"http://localhost:8082"}async authenticate(n,s,a){try{const u=await this.fetchPrivateToken();return console.log("✓ Reused existing session cookie, skipping full sign-in"),u}catch(u){console.log("ℹ No valid session cookie, performing full sign-in flow",u)}try{const u=await this.fetchVerificationToken();console.log("✓ Step 1: Verification token obtained");const t=await this.fetchPublicKey();console.log("✓ Step 2: Public key obtained");const _=await this.importPublicKey(t);console.log("✓ Step 3: Public key imported");const p=JSON.stringify({__HRequestVerificationToken:u,login:n,password:s,station:a,timeZone:"W. Europe Standard Time",network:"",InHermesLogin:!0}),o=await this.encryptDataHybrid(p,_);console.log("✓ Step 4: Login data encrypted"),await this.signIn(u,o),console.log("✓ Step 5: Sign in successful, cookies obtained");const T=await this.fetchPrivateToken();return console.log("✓ Step 6: Private Token obtained"),T}catch(u){throw console.error("❌ Authentication failed:",u),u}}async fetchVerificationToken(){console.log("BASE URL:",this.baseUrl);const n=`${this.baseUrl}/hermes360/Admin/launcher/login`;console.log("🌐 Step 1: Fetching login page from:",n);const s=await fetch(n,{method:"GET",credentials:"include"});if(console.log("📦 Step 1 Response status:",s.status),console.log("📦 Step 1 Response headers:",Object.fromEntries(s.headers.entries())),s.headers.get("set-cookie")?console.log("🍪 Step 1 Set-Cookie header received"):console.warn("⚠️ Step 1: No Set-Cookie header in response"),!s.ok)throw new Error(`Failed to fetch login page: ${s.status}`);const u=await s.text(),t=this.parseVerificationToken(u);if(!t)throw new Error("__HRequestVerificationToken not found in login page");return console.log("✅ Step 1: Verification token extracted"),t}parseVerificationToken(n){const u=new DOMParser().parseFromString(n,"text/html").querySelector("#login-form");if(!u)return null;const t=u.querySelector('input[name="__HRequestVerificationToken"]');return(t==null?void 0:t.value)||null}async fetchPublicKey(){const n=`${this.baseUrl}/hermes360/Admin/Launcher/api/Authentification/GetPublicKey`,s=await fetch(n,{method:"GET",credentials:"include",headers:{Accept:"application/json"}});if(s.headers.get("set-cookie")&&console.log("🍪 Step 2 Set-Cookie header received"),!s.ok)throw new Error(`Failed to fetch public key: ${s.status}`);const u=await s.json();return console.log("✅ Step 2: Public key received"),u.publicKey}toBase64Url(n){return n.replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}async importPublicKey(n){const a=new DOMParser().parseFromString(n,"text/xml"),u=a.getElementsByTagName("Modulus")[0],t=a.getElementsByTagName("Exponent")[0];if(!u||!t)throw new Error("Invalid public key XML format");const _=u.textContent||"",p=t.textContent||"",o=this.toBase64Url(_),T=this.toBase64Url(p),g={kty:"RSA",n:o,e:T,alg:"RSA-OAEP-256",ext:!0};return crypto.subtle.importKey("jwk",g,{name:"RSA-OAEP",hash:"SHA-256"},!0,["encrypt"])}async encryptDataHybrid(n,s){const a=await crypto.subtle.generateKey({name:"AES-GCM",length:256},!0,["encrypt","decrypt"]),t=new TextEncoder().encode(n),_=crypto.getRandomValues(new Uint8Array(12)),p=await crypto.subtle.encrypt({name:"AES-GCM",iv:_},a,t),o=await crypto.subtle.exportKey("raw",a),T=await crypto.subtle.encrypt({name:"RSA-OAEP"},s,o),g=btoa(String.fromCharCode(...new Uint8Array(p))),S=btoa(String.fromCharCode(...new Uint8Array(T))),b=btoa(String.fromCharCode(..._));return{encryptedData:g,encryptedAesKey:S,iv:b}}async signIn(n,s){const a=`${this.baseUrl}/hermes360/Admin/Launcher/api/Authentification/SignIn`;console.log("🌐 Step 4: Signing in to:",a);const u=new URLSearchParams;u.append("__HRequestVerificationToken",n),u.append("encryptedData",s.encryptedData),u.append("encryptedAesKey",s.encryptedAesKey),u.append("iv",s.iv);const t=await fetch(a,{method:"POST",credentials:"include",headers:{Accept:"application/json, text/javascript, */*; q=0.01","Content-Type":"application/x-www-form-urlencoded; charset=UTF-8"},body:u.toString()});if(t.headers.get("set-cookie")?console.log("🍪 Step 4 Set-Cookie header received"):console.error("❌ Step 4: No Set-Cookie header! Cookies not received!"),t.status===401)throw new Error("Authentication failed: Invalid credentials (401)");if(!t.ok)throw new Error(`Sign in failed: ${t.status}`);try{const p=await t.json();if(p.Result&&p.Result!==0){const T={1:"Account is disabled",2:"Account is blocked",3:"Password reset required",7:"Account does not exist"}[p.Result]||`Unknown error (Result: ${p.Result})`;throw new Error(`Sign in failed: ${T}`)}}catch(p){if(p instanceof SyntaxError){console.log("✅ Step 4: Empty response (expected), checking for cookies...");return}throw p}console.log("✅ Step 4: Sign in successful")}async fetchPrivateToken(){const n=`${this.baseUrl}/hermes360/PlateformPublication/api/login/Agent`,s=await fetch(n,{method:"POST",credentials:"include",headers:{Accept:"application/json, text/javascript, */*; q=0.01","Content-Type":"application/json; charset=UTF-8"},body:JSON.stringify({Oid:"",Token:""})});if(!s.ok)throw new Error(`Failed to fetch Private Token: ${s.status}`);const a=await s.json();if(!a.PT||!a.Oid)throw console.error("❌ Invalid Private Token response"),new Error("Invalid Private Token response - PT or Oid is empty. This indicates missing authentication cookies (Vocalcom.Application.Token, SessionCookieToken). Check if Step 4 (SignIn) set the cookies correctly.");return console.log("✅ Step 5: Private Token obtained successfully"),a}}const z={CONNECTED:"CONNECTED",DISCONNECTED:"DISCONNECTED",LOGGED_IN:"LOGGED_IN",LOGGED_OUT:"LOGGED_OUT",SESSION_START:"SESSION_START",SESSION_END:"SESSION_END",SESSION_STATE:"SESSION_STATE",AGENT_STATE:"AGENT_STATE",TELEPHONY_STATE:"TELEPHONY_STATE",RECORD_START:"RECORD_START",RECORD_STOP:"RECORD_STOP",ERROR:"ERROR",CONNECTION_ERROR:"CONNECTION_ERROR",CALL_TRANSFERRED:"CALL_TRANSFERRED",DEBUG:"DEBUG"},ci={Off:0,Waiting:1,Working:2,Pause:3},ds={online:["Online"],afterCall:["Nach dem Anruf","After call"],preview:["Vorschau Aufruf","Preview call"],onHold:["Online (Kunde wartend)","Online (client on Hold)"]};class Eo{constructor(){he(this,"GLOABL_CONTEXT_TYPE",0);he(this,"TELEPHONY_CONTEXT_TYPE",1);he(this,"agentLink",{});he(this,"subscribers",[]);he(this,"logger",!1);he(this,"campaign",null);he(this,"config",null);he(this,"username",null);he(this,"password",null);he(this,"extension",null);he(this,"isSessionOpened",!1);he(this,"currentAgentState",null);he(this,"currentTelephonyState",null);he(this,"currentCallSessionId",null);he(this,"isOutboundUser",!1);he(this,"PhoneNumberTypes",null);he(this,"isLoggedIn",!1);he(this,"authService",null);he(this,"pendingLogin",null);he(this,"loginRetryIntervalId",null);he(this,"loginPollingStartedAt",0);he(this,"LOGIN_POLLING_INTERVAL_MS",500);he(this,"LOGIN_POLLING_TIMEOUT_MS",3e4);console.log("AgentLinkAdapter created")}subscribe(n){if(this.subscribers.includes(n)){console.log("Subject: Observer has been attached already.");return}this.subscribers.push(n)}unsubscribe(n){this.subscribers=this.subscribers.filter(s=>s!==n)}notify(n,s="",a=void 0){this.subscribers.forEach(u=>{u.value={state:n,message:s,code:a}})}setConfig(n){if(this.config=n,n.hermesBaseUrl!==void 0||n.useHermesAuth){const s=n.hermesBaseUrl!==void 0?n.hermesBaseUrl:"";this.authService=new Co({baseUrl:s})}}init(n){this.agentLink||this.notify(z.ERROR,"Please set the config settings"),this.removeAllIdsFromSessionStorage(),!(this.agentLink&&this.agentLink.Connected)&&(window.parent.Log=(s,a,u)=>{this.logger&&console.log(s,u);try{this.catchEvents(u)}catch(t){console.error(t)}},typeof window.screenRecorder>"u"&&(window.screenRecorder=null),typeof window.allowDesktopSharing>"u"&&(window.allowDesktopSharing=!1),window.parent.agentlink_object_path="hermes/",window.parent.agentlink_default_protocol="WEBSOCKET",window.parent.websock_protocol="wss",window.parent.websock_proto="wss",window.parent.websock_port=443,this.agentLink=new window.AgentLinkClass(443,"wss"),this.PhoneNumberTypes=window.parent.PhoneNumberTypes||{},Object.assign(this.agentLink,this.config),this.isOutboundUser=n,this.agentLink.attachEvent("OnConnect",s=>this.onConnect(s)),this.agentLink.attachEvent("OnUserIdentification",()=>this.onUserIdentification()),this.agentLink.attachEvent("OnAgentStateChange",(s,a,u)=>this.onAgentStateChanged(s,a,u)),this.agentLink.attachEvent("OnSessionOpen",()=>this.onSessionOpen()),this.agentLink.attachEvent("OnSessionClose",()=>this.onSessionClose()),this.agentLink.attachEvent("OnSessionStateChange",(s,a,u,t)=>this.onSessionStateChange(s,a,u,t)),this.agentLink.attachEvent("OnDisconnect",()=>this.onDisconnect()),this.agentLink.attachEvent("OnTelephonyRecordStart",s=>this.onTelephonyRecordStart(s)),this.agentLink.attachEvent("OnTelephonyRecordStop",s=>this.onTelephonyRecordStop(s)),this.agentLink.Connect())}isActionReady(n){try{const s=window.TelephonySessionActionAllowed[n];return this.agentLink.Telephony.GetSession().ActionIsReady(s)}catch{return!1}}async login(n,s,a){if(!(this.agentLink.LoggedIn||this.isLoggedIn)){this.username=n,this.password=s,this.extension=a;try{if(this.authService){const u=await this.authService.authenticate(n,s,a);this.pendingLogin={id:u.Id.toString(),password:u.Password,station:a,pt:u.PT}}else console.log("⚠️ Using legacy login method (no authService configured)"),this.pendingLogin={id:n,password:s,station:a};this._startLoginPolling()}catch(u){throw console.error("❌ Login failed:",u),this.pendingLogin=null,u instanceof Error?this.notify(z.CONNECTION_ERROR,u.message):this.notify(z.CONNECTION_ERROR,"Authentifizierung fehlgeschlagen"),u}}}_startLoginPolling(){this.loginRetryIntervalId||(this.loginPollingStartedAt=Date.now(),this._tryLogin(),this.loginRetryIntervalId=setInterval(()=>{if(Date.now()-this.loginPollingStartedAt>=this.LOGIN_POLLING_TIMEOUT_MS){this._stopLoginRetry(),this.pendingLogin=null,this.notify(z.CONNECTION_ERROR,"Anmeldung fehlgeschlagen: AgentLink wurde nicht rechtzeitig bereit (Timeout).");return}this._tryLogin()},this.LOGIN_POLLING_INTERVAL_MS))}_tryLogin(){var _;if(!this.pendingLogin)return;if(this.agentLink.LoggedIn||this.isLoggedIn){this.pendingLogin=null,this._stopLoginRetry();return}const n=window.AgentActionAllowed??((_=window.parent)==null?void 0:_.AgentActionAllowed);if(!n||!this.agentLink.ActionIsReady(n.Login))return;this._stopLoginRetry();const{id:s,password:a,station:u,pt:t}=this.pendingLogin;this.pendingLogin=null,this.isLoggedIn=!0,console.log("✓ AgentLink login initiated",t?"with Private Token":"(legacy)"),this.agentLink.Login(s,a,u,t)}_stopLoginRetry(){this.loginRetryIntervalId&&(clearInterval(this.loginRetryIntervalId),this.loginRetryIntervalId=null)}logout(){this.agentLink.LoggedIn&&this.agentLink.Logout(),this.isLoggedIn=!1,this.pendingLogin=null,this._stopLoginRetry(),this.removeAllIdsFromSessionStorage()}call(n,s,a){s?this.agentLink.Telephony.GetSession().PreviewCall(n):this.agentLink.Telephony.ActionIsReady(window.parent.ContextActionAllowed.ManualCall)?this.campaign?this.agentLink.Telephony.ManualCall(this.campaign.id,n,null,null,1,a):this.notify(z.ERROR,"Es ist keine Kampagne gesetzt."):this.notify(z.ERROR,"Manueller Anruf nicht erlaubt.")}hangup(){const n=this.agentLink.Telephony.GetSession();n&&n.Hangup(),this.isOutboundUser||this.logout()}hold(){const n=this.agentLink.Telephony.GetSession();n&&n.Hold()}retrieve(){const n=this.agentLink.Telephony.GetSession();n&&n.Retrieve()}redial(n){const s=this.agentLink.Telephony.GetSession();s&&s.Redial(n)}previewCancel(){const n=this.agentLink.Telephony.GetSession();n&&n.PreviewCancel()}getSessionId(){if(this.agentLink.LoggedIn){const n=this.agentLink.Telephony.GetSession();if(n)return n.SessionId}return null}getSession(){if(this.agentLink.LoggedIn){const n=this.agentLink.Telephony.GetSession();if(n)return n}return null}getManualCampaigns(){const n=[];for(let s=0;s<this.agentLink.ManualCampaigns.Count;s+=1){const a=JSON.parse(JSON.stringify(this.agentLink.ManualCampaigns.Item(s))),u={description:a.Description,id:a.CampaignId};n.push(u)}return n}setManualCamapaign(n){this.campaign=n}setLogger(n){this.logger=n}getLogger(){return this.logger}getCampaigns(){const n=[];for(let s=0;s<this.agentLink.Campaigns.Count;s+=1){const a=this.agentLink.Campaigns.Item(s);let u=!0;a.State===window.CampaignStates.Close&&(u=!1),n.push({name:a.Description,queue:a.Queue,campaignId:a.CampaignId,type:a.Type,state:a.State,dialing:a.Dialing,active:u})}return n}getQueues(){const n=[];for(let s=0;s<this.agentLink.Telephony.Queues.Count;s+=1){const a=this.agentLink.Telephony.Queues.Item(s);n.push({name:a.Description,queue:a.QueueId,active:a.EnabledBy})}return n}getPauseOptions(){const n=[];for(let s=0;s<this.agentLink.PauseCodes.Count;s+=1){const a=this.agentLink.PauseCodes.Item(s);n.push({description:a.Description,code:a.Code,duration:a.Duration})}return n}requestPause(n){this.agentLink.ActionIsReady(window.AgentActionAllowed.Pause)?this.agentLink.RequestPause(n,0):this.notify(z.ERROR,"Pause aktuell nicht möglich.")}stopPause(){this.agentLink.RequestReady()}startRecording(n){this.isSessionOpened?this.agentLink.Record(n):this.notify(z.ERROR,"Keine aktive Session vorhanden.")}stopRecording(){this.agentLink.RecordStop(!0)}catchEvents(n){n.includes("MAXRING_ATTEMPTED")&&this.notify(z.ERROR,"Max. Ringversuch"),n.includes("InvalidAgentIdentification")&&this.notify(z.CONNECTION_ERROR,"Ungültige Anmeldedaten"),n.includes("The phone number dialed is not valid")&&this.notify(z.ERROR,"Ungültige Rufnummer"),n.includes("InvalidStationIdentification")&&this.notify(z.CONNECTION_ERROR,"Keine Verbindung mit der Nebenstelle möglich"),n.includes("AgentAlreadyMonitored")&&this.notify(z.CONNECTION_ERROR,"Die Nebenstelle ist bereits verbunden"),n.includes("StationNotConnected")&&this.notify(z.CONNECTION_ERROR,"Station nicht verbunden – bitte SIP/WebRTC-Verbindung prüfen"),n.includes("SipStationAlreadyConnected")&&this.notify(z.CONNECTION_ERROR,"Die Station wird bereits von einer anderen Sitzung verwendet")}onConnect(n){n?(this.notify(z.CONNECTED),this._tryLogin()):(this.isLoggedIn=!1,this.notify(z.DISCONNECTED))}onUserIdentification(){this.agentLink.LoggedIn?this.notify(z.LOGGED_IN):(this.isLoggedIn=!1,this.notify(z.LOGGED_OUT))}onAgentStateChanged(n,s,a){n===this.GLOABL_CONTEXT_TYPE&&(this.currentAgentState=a,this.notify(z.AGENT_STATE,a,s)),n===this.TELEPHONY_CONTEXT_TYPE&&(this.currentTelephonyState=a,this.notify(z.TELEPHONY_STATE,a,s)),this._tryLogin()}getAgentState(){return this.currentAgentState}getTelephonyState(){return this.currentTelephonyState}onSessionOpen(){const n=this.getSession();this.currentCallSessionId=this.getSessionId(),this.notify(z.SESSION_START,{sessionId:n.SessionId,indice:n.Indice,contactNumber:n.ContactNumber,campaignId:n.CampaignId,campaignType:n.CampaignType,campaignDescription:n.CampaignDescription}),this.isSessionOpened=!0}onSessionClose(){this.notify(z.SESSION_END,{sessionId:this.currentCallSessionId}),this.currentCallSessionId=null,this.isSessionOpened=!1}onSessionStateChange(n,s,a,u){this.notify(z.SESSION_STATE,{contextType:n,sessionId:s,label:u},a)}onDisconnect(){this.notify(z.DISCONNECTED),this.isLoggedIn=!1}onTelephonyRecordStart(n){this.notify(z.RECORD_START,n)}onTelephonyRecordStop(n){this.notify(z.RECORD_STOP,n)}startQueue(n,s,a){console.log("Starting Queue: ",a),this.agentLink.StartQueue(n,s),this.addIdToSessionStorage(s)}stopQueue(n,s,a){console.log("Stoping Queue: ",a),this.agentLink.StopQueue(n,s),this.removeIdFromSessionStorage(s)}doInternalBlindTransfer(n){this.isActionReady("BlindTransfer")&&(this.agentLink.Telephony.GetSession().BlindTransfer(n,this.PhoneNumberTypes.Internal),this.notify(z.CALL_TRANSFERRED))}doBlindTransfer(n,s=!1){this.agentLink.Telephony.GetSession().BlindTransfer(n,s?this.PhoneNumberTypes.External:this.PhoneNumberTypes.Did,""),this.notify(z.CALL_TRANSFERRED)}handoverCall(){this.agentLink.Telephony.GetSession().Transfer(),this.notify(z.CALL_TRANSFERRED)}doWarmHandover(n,s=!1){this.agentLink.Telephony.GetSession().ConsultationCall(n,s?this.PhoneNumberTypes.External:this.PhoneNumberTypes.Did,""),this.notify(z.CALL_TRANSFERRED)}setCallStatus(n){this.previewCancel(),this.agentLink.Telephony.GetSession().SetCallStatus(n.status,n.details,n.followupDateTime,n.followupPhoneNumber,n.followUpValidity,n.comment)}addIdToSessionStorage(n){const s=JSON.parse(sessionStorage.getItem("activeCampaigns"))||[];s.includes(n)||(s.push(n),sessionStorage.setItem("activeCampaigns",JSON.stringify(s)))}removeIdFromSessionStorage(n){const a=(JSON.parse(sessionStorage.getItem("activeCampaigns"))||[]).filter(u=>u!==n);sessionStorage.setItem("activeCampaigns",JSON.stringify(a))}checkIdInSessionStorage(n){return(JSON.parse(sessionStorage.getItem("activeCampaigns"))||[]).includes(n)}removeAllIdsFromSessionStorage(){sessionStorage.removeItem("activeCampaigns")}}function Ao(){const f={};function n(u,t){f[u]||(f[u]=[]),f[u].push(t)}function s(u,t){if(!f[u])return;const _=f[u].indexOf(t);_>-1&&f[u].splice(_,1)}function a(u,...t){f[u]&&f[u].forEach(_=>{_(...t)})}return{on:n,off:s,emit:a}}function bo(f){return f&&f.__esModule&&Object.prototype.hasOwnProperty.call(f,"default")?f.default:f}const yo="jssip@3.13.6",Ro="jssip@3.13.6",wo=!1,Io="sha512-Bf1ndrSuqpO87/AG56WACR7kKcCvKOzaIQROu7JUMh0qFaGOV4NuR+wsnaXa7f3/d6xhwVczczFyt1ywJmTjPg==",No="/jssip",Oo={},xo={type:"version",registry:!0,raw:"jssip@3.13.6",name:"jssip",escapedName:"jssip",rawSpec:"3.13.6",saveSpec:null,fetchSpec:"3.13.6"},Do=["/"],ko="https://registry.npmjs.org/jssip/-/jssip-3.13.6.tgz",Uo="5af3c453b1594a822fe2ffa8a50ceadbd491b40c",Lo="jssip@3.13.6",Po="/Users/ruslan.ibraev/kmh/dialer-vue-components",$o={url:"https://github.com/versatica/JsSIP/issues"},Mo=!1,Ho=[{name:"José Luis Millán",email:"jmillan@aliax.net",url:"https://github.com/jmillan"},{name:"Iñaki Baz Castillo",email:"ibc@aliax.net",url:"https://inakibaz.me"}],Fo={debug:"^4.3.1",events:"^3.3.0","sdp-transform":"^2.14.1"},Bo=!1,qo="The Javascript SIP library",Vo={"@eslint/eslintrc":"^3.3.3","@eslint/js":"^9.39.2","@types/debug":"^4.1.12","@types/events":"^3.0.3","@types/jest":"^30.0.0","@types/node":"^25.0.10",cpx:"^1.5.0",esbuild:"^0.27.2",eslint:"^9.39.1","eslint-config-prettier":"^10.1.8","eslint-plugin-jest":"^29.12.1","eslint-plugin-prettier":"^5.5.5",globals:"^17.0.0",jest:"^30.2.0","open-cli":"^8.0.0",pegjs:"^0.7.0",prettier:"^3.8.1","ts-jest":"^29.4.6",typedoc:"^0.28.16",typescript:"^5.9.3","typescript-eslint":"^8.53.1"},Go=["LICENSE","README.md","npm-scripts.mjs","lib"],Wo="https://jssip.net",jo=["sip","websocket","webrtc","node","browser","library"],Ko="MIT",Yo="lib/JsSIP.js",zo="jssip",Qo={type:"git",url:"git+https://github.com/versatica/JsSIP.git"},Jo={build:"node npm-scripts.mjs build",coverage:"node npm-scripts.mjs coverage",docs:"node npm-scripts.mjs docs","docs:check":"node npm-scripts.mjs docs:check","docs:watch":"node npm-scripts.mjs docs:watch",lint:"node npm-scripts.mjs lint","lint:fix":"node npm-scripts.mjs lint:fix",release:"node npm-scripts.mjs release",test:"node npm-scripts.mjs test","typescript:build":"node npm-scripts.mjs typescript:build"},Xo="JsSIP",Zo="lib/JsSIP.d.ts",ea="3.13.6",fi={_from:yo,_id:Ro,_inBundle:wo,_integrity:Io,_location:No,_phantomChildren:Oo,_requested:xo,_requiredBy:Do,_resolved:ko,_shasum:Uo,_spec:Lo,_where:Po,bugs:$o,bundleDependencies:Mo,contributors:Ho,dependencies:Fo,deprecated:Bo,description:qo,devDependencies:Vo,files:Go,homepage:Wo,keywords:jo,license:Ko,main:Yo,name:zo,repository:Qo,scripts:Jo,title:Xo,types:Zo,version:ea},Il=fi;var ve={USER_AGENT:`${Il.title} ${Il.version}`,SIP:"sip",SIPS:"sips",causes:{CONNECTION_ERROR:"Connection Error",REQUEST_TIMEOUT:"Request Timeout",SIP_FAILURE_CODE:"SIP Failure Code",INTERNAL_ERROR:"Internal Error",BUSY:"Busy",REJECTED:"Rejected",REDIRECTED:"Redirected",UNAVAILABLE:"Unavailable",NOT_FOUND:"Not Found",ADDRESS_INCOMPLETE:"Address Incomplete",INCOMPATIBLE_SDP:"Incompatible SDP",MISSING_SDP:"Missing SDP",AUTHENTICATION_ERROR:"Authentication Error",BYE:"Terminated",WEBRTC_ERROR:"WebRTC Error",CANCELED:"Canceled",NO_ANSWER:"No Answer",EXPIRES:"Expires",NO_ACK:"No ACK",DIALOG_ERROR:"Dialog Error",USER_DENIED_MEDIA_ACCESS:"User Denied Media Access",BAD_MEDIA_DESCRIPTION:"Bad Media Description",RTP_TIMEOUT:"RTP Timeout"},SIP_ERROR_CAUSES:{REDIRECTED:[300,301,302,305,380],BUSY:[486,600],REJECTED:[403,603],NOT_FOUND:[404,604],UNAVAILABLE:[480,410,408,430],ADDRESS_INCOMPLETE:[484,424],INCOMPATIBLE_SDP:[488,606],AUTHENTICATION_ERROR:[401,407]},ACK:"ACK",BYE:"BYE",CANCEL:"CANCEL",INFO:"INFO",INVITE:"INVITE",MESSAGE:"MESSAGE",NOTIFY:"NOTIFY",OPTIONS:"OPTIONS",REGISTER:"REGISTER",REFER:"REFER",UPDATE:"UPDATE",SUBSCRIBE:"SUBSCRIBE",DTMF_TRANSPORT:{INFO:"INFO",RFC2833:"RFC2833"},REASON_PHRASE:{100:"Trying",180:"Ringing",181:"Call Is Being Forwarded",182:"Queued",183:"Session Progress",199:"Early Dialog Terminated",200:"OK",202:"Accepted",204:"No Notification",300:"Multiple Choices",301:"Moved Permanently",302:"Moved Temporarily",305:"Use Proxy",380:"Alternative Service",400:"Bad Request",401:"Unauthorized",402:"Payment Required",403:"Forbidden",404:"Not Found",405:"Method Not Allowed",406:"Not Acceptable",407:"Proxy Authentication Required",408:"Request Timeout",410:"Gone",412:"Conditional Request Failed",413:"Request Entity Too Large",414:"Request-URI Too Long",415:"Unsupported Media Type",416:"Unsupported URI Scheme",417:"Unknown Resource-Priority",420:"Bad Extension",421:"Extension Required",422:"Session Interval Too Small",423:"Interval Too Brief",424:"Bad Location Information",428:"Use Identity Header",429:"Provide Referrer Identity",430:"Flow Failed",433:"Anonymity Disallowed",436:"Bad Identity-Info",437:"Unsupported Certificate",438:"Invalid Identity Header",439:"First Hop Lacks Outbound Support",440:"Max-Breadth Exceeded",469:"Bad Info Package",470:"Consent Needed",478:"Unresolvable Destination",480:"Temporarily Unavailable",481:"Call/Transaction Does Not Exist",482:"Loop Detected",483:"Too Many Hops",484:"Address Incomplete",485:"Ambiguous",486:"Busy Here",487:"Request Terminated",488:"Not Acceptable Here",489:"Bad Event",491:"Request Pending",493:"Undecipherable",494:"Security Agreement Required",500:"JsSIP Internal Error",501:"Not Implemented",502:"Bad Gateway",503:"Service Unavailable",504:"Server Time-out",505:"Version Not Supported",513:"Message Too Large",580:"Precondition Failure",600:"Busy Everywhere",603:"Decline",604:"Does Not Exist Anywhere",606:"Not Acceptable"},ALLOWED_METHODS:"INVITE,ACK,CANCEL,BYE,UPDATE,MESSAGE,OPTIONS,REFER,INFO,NOTIFY,SUBSCRIBE",ACCEPTED_BODY_TYPES:"application/sdp, application/dtmf-relay",MAX_FORWARDS:69,SESSION_EXPIRES:90,MIN_SESSION_EXPIRES:60,CONNECTION_RECOVERY_MAX_INTERVAL:30,CONNECTION_RECOVERY_MIN_INTERVAL:2};class ta extends Error{constructor(n,s){super(),this.code=1,this.name="CONFIGURATION_ERROR",this.parameter=n,this.value=s,this.message=this.value?`Invalid value ${JSON.stringify(this.value)} for parameter "${this.parameter}"`:`Missing parameter: ${this.parameter}`}}class sa extends Error{constructor(n){super(),this.code=2,this.name="INVALID_STATE_ERROR",this.status=n,this.message=`Invalid status: ${n}`}}class na extends Error{constructor(n){super(),this.code=3,this.name="NOT_SUPPORTED_ERROR",this.message=n}}class ra extends Error{constructor(n){super(),this.code=4,this.name="NOT_READY_ERROR",this.message=n}}var rt={ConfigurationError:ta,InvalidStateError:sa,NotSupportedError:na,NotReadyError:ra},Se={},Js,Nl;function Dn(){if(Nl)return Js;Nl=1;const f=ht(),n=Je();return Js=class di{static parse(a){if(a=n.parse(a,"Name_Addr_Header"),a!==-1)return a}constructor(a,u,t){if(!a||!(a instanceof f))throw new TypeError('missing or invalid "uri" parameter');this._uri=a,this._parameters={},this.display_name=u;for(const _ in t)Object.prototype.hasOwnProperty.call(t,_)&&this.setParam(_,t[_])}get uri(){return this._uri}get display_name(){return this._display_name}set display_name(a){this._display_name=a===0?"0":a}setParam(a,u){a&&(this._parameters[a.toLowerCase()]=typeof u>"u"||u===null?null:u.toString())}getParam(a){if(a)return this._parameters[a.toLowerCase()]}hasParam(a){if(a)return this._parameters.hasOwnProperty(a.toLowerCase())&&!0||!1}deleteParam(a){if(a=a.toLowerCase(),this._parameters.hasOwnProperty(a)){const u=this._parameters[a];return delete this._parameters[a],u}}clearParams(){this._parameters={}}clone(){return new di(this._uri.clone(),this._display_name,JSON.parse(JSON.stringify(this._parameters)))}_quote(a){return a.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}toString(){let a=this._display_name?`"${this._quote(this._display_name)}" `:"";a+=`<${this._uri.toString()}>`;for(const u in this._parameters)Object.prototype.hasOwnProperty.call(this._parameters,u)&&(a+=`;${u}`,this._parameters[u]!==null&&(a+=`=${this._parameters[u]}`));return a}},Js}var Xs,Ol;function Je(){return Ol||(Ol=1,Xs=function(){function f(s){return'"'+s.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\x08/g,"\\b").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\f/g,"\\f").replace(/\r/g,"\\r").replace(/[\x00-\x07\x0B\x0E-\x1F\x80-\uFFFF]/g,escape)+'"'}var n={parse:function(s,a){var u={CRLF:T,DIGIT:g,ALPHA:S,HEXDIG:b,WSP:U,OCTET:F,DQUOTE:$,SP:A,HTAB:Z,alphanum:Q,reserved:se,unreserved:C,mark:D,escaped:j,LWS:P,SWS:B,HCOLON:ee,TEXT_UTF8_TRIM:L,TEXT_UTF8char:w,UTF8_NONASCII:R,UTF8_CONT:x,LHEX:ge,token:Y,token_nodot:De,separators:Ge,word:we,STAR:$e,SLASH:Me,EQUAL:re,LPAREN:He,RPAREN:We,RAQUOT:je,LAQUOT:Fe,COMMA:V,SEMI:K,COLON:Be,LDQUOT:ke,RDQUOT:ft,comment:X,ctext:q,quoted_string:ne,quoted_string_clean:le,qdtext:_e,quoted_pair:pe,SIP_URI_noparams:oe,SIP_URI:ze,uri_scheme:Ue,uri_scheme_sips:Qt,uri_scheme_sip:Jt,userinfo:Ct,user:I,user_unreserved:te,password:Te,hostport:Oe,host:Ze,hostname:Is,domainlabel:Ns,toplabel:Gn,IPv6reference:Os,IPv6address:xs,h16:G,ls32:qe,IPv4address:Nt,dec_octet:Ot,port:Wn,uri_parameters:jn,uri_parameter:Ds,transport_param:Kn,user_param:Yn,method_param:zn,ttl_param:Qn,maddr_param:Jn,lr_param:Xn,other_param:Zn,pname:er,pvalue:tr,paramchar:xt,param_unreserved:sr,headers:nr,header:Xt,hname:rr,hvalue:lr,hnv_unreserved:Dt,Request_Response:Ui,Request_Line:ir,Request_URI:or,absoluteURI:ks,hier_part:ar,net_path:ur,abs_path:Zt,opaque_part:cr,uric:kt,uric_no_slash:fr,path_segments:dr,segment:es,param:Us,pchar:Ut,scheme:hr,authority:_r,srvr:pr,reg_name:mr,query:gr,SIP_Version:Ls,INVITEm:Tr,ACKm:vr,OPTIONSm:Sr,BYEm:Cr,CANCELm:Er,REGISTERm:Ar,SUBSCRIBEm:br,NOTIFYm:yr,REFERm:Rr,Method:ts,Status_Line:wr,Status_Code:Ir,extension_code:Nr,Reason_Phrase:Or,Allow_Events:Li,Call_ID:Pi,Contact:$i,contact_param:ss,name_addr:_t,display_name:ns,contact_params:Ps,c_p_q:xr,c_p_expires:Dr,delta_seconds:pt,qvalue:kr,generic_param:Ce,gen_value:Ur,Content_Disposition:Mi,disp_type:Lr,disp_param:$s,handling_param:Pr,Content_Encoding:Hi,Content_Length:Fi,Content_Type:Bi,media_type:$r,m_type:Mr,discrete_type:Hr,composite_type:Fr,extension_token:rs,x_token:Br,m_subtype:qr,m_parameter:Ms,m_value:Vr,CSeq:qi,CSeq_value:Gr,Expires:Vi,Event:Gi,event_type:Lt,From:Wi,from_param:Hs,tag_param:Fs,Max_Forwards:ji,Min_Expires:Ki,Name_Addr_Header:Yi,Proxy_Authenticate:zi,challenge:Bs,other_challenge:Wr,auth_param:Pt,digest_cln:ls,realm:jr,realm_value:Kr,domain:Yr,URI:is,nonce:zr,nonce_value:Qr,opaque:Jr,stale:Xr,algorithm:Zr,qop_options:el,qop_value:os,Proxy_Require:Qi,Record_Route:Ji,rec_route:as,Reason:Xi,reason_param:qs,reason_cause:tl,Require:Zi,Route:eo,route_param:us,Subscription_State:to,substate_value:sl,subexp_params:Vs,event_reason_value:nl,Subject:so,Supported:no,To:ro,to_param:Gs,Via:lo,via_param:cs,via_params:Ws,via_ttl:rl,via_maddr:ll,via_received:il,via_branch:ol,response_port:al,rport:ul,sent_protocol:cl,protocol_name:fl,transport:dl,sent_by:hl,via_host:_l,via_port:pl,ttl:js,WWW_Authenticate:io,Session_Expires:oo,s_e_expires:ml,s_e_params:Ks,s_e_refresher:gl,extension_header:ao,header_value:Tl,message_body:uo,uuid_URI:co,uuid:vl,hex4:ot,hex8:Sl,hex12:Cl,Refer_To:fo,Replaces:ho,call_id:El,replaces_param:Ys,to_tag:Al,from_tag:bl,early_flag:yl};if(a!==void 0){if(u[a]===void 0)throw new Error("Invalid rule name: "+f(a)+".")}else a="CRLF";var t=0,_=0,p=[];function o(e){t<_||(t>_&&(_=t,p=[]),p.push(e))}function T(){var e;return s.substr(t,2)===`\r
`?(e=`\r
`,t+=2):(e=null,o('"\\r\\n"')),e}function g(){var e;return/^[0-9]/.test(s.charAt(t))?(e=s.charAt(t),t++):(e=null,o("[0-9]")),e}function S(){var e;return/^[a-zA-Z]/.test(s.charAt(t))?(e=s.charAt(t),t++):(e=null,o("[a-zA-Z]")),e}function b(){var e;return/^[0-9a-fA-F]/.test(s.charAt(t))?(e=s.charAt(t),t++):(e=null,o("[0-9a-fA-F]")),e}function U(){var e;return e=A(),e===null&&(e=Z()),e}function F(){var e;return/^[\0-\xFF]/.test(s.charAt(t))?(e=s.charAt(t),t++):(e=null,o("[\\0-\\xFF]")),e}function $(){var e;return/^["]/.test(s.charAt(t))?(e=s.charAt(t),t++):(e=null,o('["]')),e}function A(){var e;return s.charCodeAt(t)===32?(e=" ",t++):(e=null,o('" "')),e}function Z(){var e;return s.charCodeAt(t)===9?(e=" ",t++):(e=null,o('"\\t"')),e}function Q(){var e;return/^[a-zA-Z0-9]/.test(s.charAt(t))?(e=s.charAt(t),t++):(e=null,o("[a-zA-Z0-9]")),e}function se(){var e;return s.charCodeAt(t)===59?(e=";",t++):(e=null,o('";"')),e===null&&(s.charCodeAt(t)===47?(e="/",t++):(e=null,o('"/"')),e===null&&(s.charCodeAt(t)===63?(e="?",t++):(e=null,o('"?"')),e===null&&(s.charCodeAt(t)===58?(e=":",t++):(e=null,o('":"')),e===null&&(s.charCodeAt(t)===64?(e="@",t++):(e=null,o('"@"')),e===null&&(s.charCodeAt(t)===38?(e="&",t++):(e=null,o('"&"')),e===null&&(s.charCodeAt(t)===61?(e="=",t++):(e=null,o('"="')),e===null&&(s.charCodeAt(t)===43?(e="+",t++):(e=null,o('"+"')),e===null&&(s.charCodeAt(t)===36?(e="$",t++):(e=null,o('"$"')),e===null&&(s.charCodeAt(t)===44?(e=",",t++):(e=null,o('","'))))))))))),e}function C(){var e;return e=Q(),e===null&&(e=D()),e}function D(){var e;return s.charCodeAt(t)===45?(e="-",t++):(e=null,o('"-"')),e===null&&(s.charCodeAt(t)===95?(e="_",t++):(e=null,o('"_"')),e===null&&(s.charCodeAt(t)===46?(e=".",t++):(e=null,o('"."')),e===null&&(s.charCodeAt(t)===33?(e="!",t++):(e=null,o('"!"')),e===null&&(s.charCodeAt(t)===126?(e="~",t++):(e=null,o('"~"')),e===null&&(s.charCodeAt(t)===42?(e="*",t++):(e=null,o('"*"')),e===null&&(s.charCodeAt(t)===39?(e="'",t++):(e=null,o(`"'"`)),e===null&&(s.charCodeAt(t)===40?(e="(",t++):(e=null,o('"("')),e===null&&(s.charCodeAt(t)===41?(e=")",t++):(e=null,o('")"')))))))))),e}function j(){var e,r,l,i,c;return i=t,c=t,s.charCodeAt(t)===37?(e="%",t++):(e=null,o('"%"')),e!==null?(r=b(),r!==null?(l=b(),l!==null?e=[e,r,l]:(e=null,t=c)):(e=null,t=c)):(e=null,t=c),e!==null&&(e=function(d,m){return m.join("")}(i,e)),e===null&&(t=i),e}function P(){var e,r,l,i,c,d;for(i=t,c=t,d=t,e=[],r=U();r!==null;)e.push(r),r=U();if(e!==null?(r=T(),r!==null?e=[e,r]:(e=null,t=d)):(e=null,t=d),e=e!==null?e:"",e!==null){if(l=U(),l!==null)for(r=[];l!==null;)r.push(l),l=U();else r=null;r!==null?e=[e,r]:(e=null,t=c)}else e=null,t=c;return e!==null&&(e=function(m){return" "}()),e===null&&(t=i),e}function B(){var e;return e=P(),e=e!==null?e:"",e}function ee(){var e,r,l,i,c;for(i=t,c=t,e=[],r=A(),r===null&&(r=Z());r!==null;)e.push(r),r=A(),r===null&&(r=Z());return e!==null?(s.charCodeAt(t)===58?(r=":",t++):(r=null,o('":"')),r!==null?(l=B(),l!==null?e=[e,r,l]:(e=null,t=c)):(e=null,t=c)):(e=null,t=c),e!==null&&(e=function(d){return":"}()),e===null&&(t=i),e}function L(){var e,r,l,i,c,d,m;if(c=t,d=t,r=w(),r!==null)for(e=[];r!==null;)e.push(r),r=w();else e=null;if(e!==null){for(r=[],m=t,l=[],i=P();i!==null;)l.push(i),i=P();for(l!==null?(i=w(),i!==null?l=[l,i]:(l=null,t=m)):(l=null,t=m);l!==null;){for(r.push(l),m=t,l=[],i=P();i!==null;)l.push(i),i=P();l!==null?(i=w(),i!==null?l=[l,i]:(l=null,t=m)):(l=null,t=m)}r!==null?e=[e,r]:(e=null,t=d)}else e=null,t=d;return e!==null&&(e=function(E){return s.substring(t,E)}(c)),e===null&&(t=c),e}function w(){var e;return/^[!-~]/.test(s.charAt(t))?(e=s.charAt(t),t++):(e=null,o("[!-~]")),e===null&&(e=R()),e}function R(){var e;return/^[\x80-\uFFFF]/.test(s.charAt(t))?(e=s.charAt(t),t++):(e=null,o("[\\x80-\\uFFFF]")),e}function x(){var e;return/^[\x80-\xBF]/.test(s.charAt(t))?(e=s.charAt(t),t++):(e=null,o("[\\x80-\\xBF]")),e}function ge(){var e;return e=g(),e===null&&(/^[a-f]/.test(s.charAt(t))?(e=s.charAt(t),t++):(e=null,o("[a-f]"))),e}function Y(){var e,r,l;if(l=t,r=Q(),r===null&&(s.charCodeAt(t)===45?(r="-",t++):(r=null,o('"-"')),r===null&&(s.charCodeAt(t)===46?(r=".",t++):(r=null,o('"."')),r===null&&(s.charCodeAt(t)===33?(r="!",t++):(r=null,o('"!"')),r===null&&(s.charCodeAt(t)===37?(r="%",t++):(r=null,o('"%"')),r===null&&(s.charCodeAt(t)===42?(r="*",t++):(r=null,o('"*"')),r===null&&(s.charCodeAt(t)===95?(r="_",t++):(r=null,o('"_"')),r===null&&(s.charCodeAt(t)===43?(r="+",t++):(r=null,o('"+"')),r===null&&(s.charCodeAt(t)===96?(r="`",t++):(r=null,o('"`"')),r===null&&(s.charCodeAt(t)===39?(r="'",t++):(r=null,o(`"'"`)),r===null&&(s.charCodeAt(t)===126?(r="~",t++):(r=null,o('"~"')))))))))))),r!==null)for(e=[];r!==null;)e.push(r),r=Q(),r===null&&(s.charCodeAt(t)===45?(r="-",t++):(r=null,o('"-"')),r===null&&(s.charCodeAt(t)===46?(r=".",t++):(r=null,o('"."')),r===null&&(s.charCodeAt(t)===33?(r="!",t++):(r=null,o('"!"')),r===null&&(s.charCodeAt(t)===37?(r="%",t++):(r=null,o('"%"')),r===null&&(s.charCodeAt(t)===42?(r="*",t++):(r=null,o('"*"')),r===null&&(s.charCodeAt(t)===95?(r="_",t++):(r=null,o('"_"')),r===null&&(s.charCodeAt(t)===43?(r="+",t++):(r=null,o('"+"')),r===null&&(s.charCodeAt(t)===96?(r="`",t++):(r=null,o('"`"')),r===null&&(s.charCodeAt(t)===39?(r="'",t++):(r=null,o(`"'"`)),r===null&&(s.charCodeAt(t)===126?(r="~",t++):(r=null,o('"~"'))))))))))));else e=null;return e!==null&&(e=function(i){return s.substring(t,i)}(l)),e===null&&(t=l),e}function De(){var e,r,l;if(l=t,r=Q(),r===null&&(s.charCodeAt(t)===45?(r="-",t++):(r=null,o('"-"')),r===null&&(s.charCodeAt(t)===33?(r="!",t++):(r=null,o('"!"')),r===null&&(s.charCodeAt(t)===37?(r="%",t++):(r=null,o('"%"')),r===null&&(s.charCodeAt(t)===42?(r="*",t++):(r=null,o('"*"')),r===null&&(s.charCodeAt(t)===95?(r="_",t++):(r=null,o('"_"')),r===null&&(s.charCodeAt(t)===43?(r="+",t++):(r=null,o('"+"')),r===null&&(s.charCodeAt(t)===96?(r="`",t++):(r=null,o('"`"')),r===null&&(s.charCodeAt(t)===39?(r="'",t++):(r=null,o(`"'"`)),r===null&&(s.charCodeAt(t)===126?(r="~",t++):(r=null,o('"~"'))))))))))),r!==null)for(e=[];r!==null;)e.push(r),r=Q(),r===null&&(s.charCodeAt(t)===45?(r="-",t++):(r=null,o('"-"')),r===null&&(s.charCodeAt(t)===33?(r="!",t++):(r=null,o('"!"')),r===null&&(s.charCodeAt(t)===37?(r="%",t++):(r=null,o('"%"')),r===null&&(s.charCodeAt(t)===42?(r="*",t++):(r=null,o('"*"')),r===null&&(s.charCodeAt(t)===95?(r="_",t++):(r=null,o('"_"')),r===null&&(s.charCodeAt(t)===43?(r="+",t++):(r=null,o('"+"')),r===null&&(s.charCodeAt(t)===96?(r="`",t++):(r=null,o('"`"')),r===null&&(s.charCodeAt(t)===39?(r="'",t++):(r=null,o(`"'"`)),r===null&&(s.charCodeAt(t)===126?(r="~",t++):(r=null,o('"~"')))))))))));else e=null;return e!==null&&(e=function(i){return s.substring(t,i)}(l)),e===null&&(t=l),e}function Ge(){var e;return s.charCodeAt(t)===40?(e="(",t++):(e=null,o('"("')),e===null&&(s.charCodeAt(t)===41?(e=")",t++):(e=null,o('")"')),e===null&&(s.charCodeAt(t)===60?(e="<",t++):(e=null,o('"<"')),e===null&&(s.charCodeAt(t)===62?(e=">",t++):(e=null,o('">"')),e===null&&(s.charCodeAt(t)===64?(e="@",t++):(e=null,o('"@"')),e===null&&(s.charCodeAt(t)===44?(e=",",t++):(e=null,o('","')),e===null&&(s.charCodeAt(t)===59?(e=";",t++):(e=null,o('";"')),e===null&&(s.charCodeAt(t)===58?(e=":",t++):(e=null,o('":"')),e===null&&(s.charCodeAt(t)===92?(e="\\",t++):(e=null,o('"\\\\"')),e===null&&(e=$(),e===null&&(s.charCodeAt(t)===47?(e="/",t++):(e=null,o('"/"')),e===null&&(s.charCodeAt(t)===91?(e="[",t++):(e=null,o('"["')),e===null&&(s.charCodeAt(t)===93?(e="]",t++):(e=null,o('"]"')),e===null&&(s.charCodeAt(t)===63?(e="?",t++):(e=null,o('"?"')),e===null&&(s.charCodeAt(t)===61?(e="=",t++):(e=null,o('"="')),e===null&&(s.charCodeAt(t)===123?(e="{",t++):(e=null,o('"{"')),e===null&&(s.charCodeAt(t)===125?(e="}",t++):(e=null,o('"}"')),e===null&&(e=A(),e===null&&(e=Z())))))))))))))))))),e}function we(){var e,r,l;if(l=t,r=Q(),r===null&&(s.charCodeAt(t)===45?(r="-",t++):(r=null,o('"-"')),r===null&&(s.charCodeAt(t)===46?(r=".",t++):(r=null,o('"."')),r===null&&(s.charCodeAt(t)===33?(r="!",t++):(r=null,o('"!"')),r===null&&(s.charCodeAt(t)===37?(r="%",t++):(r=null,o('"%"')),r===null&&(s.charCodeAt(t)===42?(r="*",t++):(r=null,o('"*"')),r===null&&(s.charCodeAt(t)===95?(r="_",t++):(r=null,o('"_"')),r===null&&(s.charCodeAt(t)===43?(r="+",t++):(r=null,o('"+"')),r===null&&(s.charCodeAt(t)===96?(r="`",t++):(r=null,o('"`"')),r===null&&(s.charCodeAt(t)===39?(r="'",t++):(r=null,o(`"'"`)),r===null&&(s.charCodeAt(t)===126?(r="~",t++):(r=null,o('"~"')),r===null&&(s.charCodeAt(t)===40?(r="(",t++):(r=null,o('"("')),r===null&&(s.charCodeAt(t)===41?(r=")",t++):(r=null,o('")"')),r===null&&(s.charCodeAt(t)===60?(r="<",t++):(r=null,o('"<"')),r===null&&(s.charCodeAt(t)===62?(r=">",t++):(r=null,o('">"')),r===null&&(s.charCodeAt(t)===58?(r=":",t++):(r=null,o('":"')),r===null&&(s.charCodeAt(t)===92?(r="\\",t++):(r=null,o('"\\\\"')),r===null&&(r=$(),r===null&&(s.charCodeAt(t)===47?(r="/",t++):(r=null,o('"/"')),r===null&&(s.charCodeAt(t)===91?(r="[",t++):(r=null,o('"["')),r===null&&(s.charCodeAt(t)===93?(r="]",t++):(r=null,o('"]"')),r===null&&(s.charCodeAt(t)===63?(r="?",t++):(r=null,o('"?"')),r===null&&(s.charCodeAt(t)===123?(r="{",t++):(r=null,o('"{"')),r===null&&(s.charCodeAt(t)===125?(r="}",t++):(r=null,o('"}"'))))))))))))))))))))))))),r!==null)for(e=[];r!==null;)e.push(r),r=Q(),r===null&&(s.charCodeAt(t)===45?(r="-",t++):(r=null,o('"-"')),r===null&&(s.charCodeAt(t)===46?(r=".",t++):(r=null,o('"."')),r===null&&(s.charCodeAt(t)===33?(r="!",t++):(r=null,o('"!"')),r===null&&(s.charCodeAt(t)===37?(r="%",t++):(r=null,o('"%"')),r===null&&(s.charCodeAt(t)===42?(r="*",t++):(r=null,o('"*"')),r===null&&(s.charCodeAt(t)===95?(r="_",t++):(r=null,o('"_"')),r===null&&(s.charCodeAt(t)===43?(r="+",t++):(r=null,o('"+"')),r===null&&(s.charCodeAt(t)===96?(r="`",t++):(r=null,o('"`"')),r===null&&(s.charCodeAt(t)===39?(r="'",t++):(r=null,o(`"'"`)),r===null&&(s.charCodeAt(t)===126?(r="~",t++):(r=null,o('"~"')),r===null&&(s.charCodeAt(t)===40?(r="(",t++):(r=null,o('"("')),r===null&&(s.charCodeAt(t)===41?(r=")",t++):(r=null,o('")"')),r===null&&(s.charCodeAt(t)===60?(r="<",t++):(r=null,o('"<"')),r===null&&(s.charCodeAt(t)===62?(r=">",t++):(r=null,o('">"')),r===null&&(s.charCodeAt(t)===58?(r=":",t++):(r=null,o('":"')),r===null&&(s.charCodeAt(t)===92?(r="\\",t++):(r=null,o('"\\\\"')),r===null&&(r=$(),r===null&&(s.charCodeAt(t)===47?(r="/",t++):(r=null,o('"/"')),r===null&&(s.charCodeAt(t)===91?(r="[",t++):(r=null,o('"["')),r===null&&(s.charCodeAt(t)===93?(r="]",t++):(r=null,o('"]"')),r===null&&(s.charCodeAt(t)===63?(r="?",t++):(r=null,o('"?"')),r===null&&(s.charCodeAt(t)===123?(r="{",t++):(r=null,o('"{"')),r===null&&(s.charCodeAt(t)===125?(r="}",t++):(r=null,o('"}"')))))))))))))))))))))))));else e=null;return e!==null&&(e=function(i){return s.substring(t,i)}(l)),e===null&&(t=l),e}function $e(){var e,r,l,i,c;return i=t,c=t,e=B(),e!==null?(s.charCodeAt(t)===42?(r="*",t++):(r=null,o('"*"')),r!==null?(l=B(),l!==null?e=[e,r,l]:(e=null,t=c)):(e=null,t=c)):(e=null,t=c),e!==null&&(e=function(d){return"*"}()),e===null&&(t=i),e}function Me(){var e,r,l,i,c;return i=t,c=t,e=B(),e!==null?(s.charCodeAt(t)===47?(r="/",t++):(r=null,o('"/"')),r!==null?(l=B(),l!==null?e=[e,r,l]:(e=null,t=c)):(e=null,t=c)):(e=null,t=c),e!==null&&(e=function(d){return"/"}()),e===null&&(t=i),e}function re(){var e,r,l,i,c;return i=t,c=t,e=B(),e!==null?(s.charCodeAt(t)===61?(r="=",t++):(r=null,o('"="')),r!==null?(l=B(),l!==null?e=[e,r,l]:(e=null,t=c)):(e=null,t=c)):(e=null,t=c),e!==null&&(e=function(d){return"="}()),e===null&&(t=i),e}function He(){var e,r,l,i,c;return i=t,c=t,e=B(),e!==null?(s.charCodeAt(t)===40?(r="(",t++):(r=null,o('"("')),r!==null?(l=B(),l!==null?e=[e,r,l]:(e=null,t=c)):(e=null,t=c)):(e=null,t=c),e!==null&&(e=function(d){return"("}()),e===null&&(t=i),e}function We(){var e,r,l,i,c;return i=t,c=t,e=B(),e!==null?(s.charCodeAt(t)===41?(r=")",t++):(r=null,o('")"')),r!==null?(l=B(),l!==null?e=[e,r,l]:(e=null,t=c)):(e=null,t=c)):(e=null,t=c),e!==null&&(e=function(d){return")"}()),e===null&&(t=i),e}function je(){var e,r,l,i;return l=t,i=t,s.charCodeAt(t)===62?(e=">",t++):(e=null,o('">"')),e!==null?(r=B(),r!==null?e=[e,r]:(e=null,t=i)):(e=null,t=i),e!==null&&(e=function(c){return">"}()),e===null&&(t=l),e}function Fe(){var e,r,l,i;return l=t,i=t,e=B(),e!==null?(s.charCodeAt(t)===60?(r="<",t++):(r=null,o('"<"')),r!==null?e=[e,r]:(e=null,t=i)):(e=null,t=i),e!==null&&(e=function(c){return"<"}()),e===null&&(t=l),e}function V(){var e,r,l,i,c;return i=t,c=t,e=B(),e!==null?(s.charCodeAt(t)===44?(r=",",t++):(r=null,o('","')),r!==null?(l=B(),l!==null?e=[e,r,l]:(e=null,t=c)):(e=null,t=c)):(e=null,t=c),e!==null&&(e=function(d){return","}()),e===null&&(t=i),e}function K(){var e,r,l,i,c;return i=t,c=t,e=B(),e!==null?(s.charCodeAt(t)===59?(r=";",t++):(r=null,o('";"')),r!==null?(l=B(),l!==null?e=[e,r,l]:(e=null,t=c)):(e=null,t=c)):(e=null,t=c),e!==null&&(e=function(d){return";"}()),e===null&&(t=i),e}function Be(){var e,r,l,i,c;return i=t,c=t,e=B(),e!==null?(s.charCodeAt(t)===58?(r=":",t++):(r=null,o('":"')),r!==null?(l=B(),l!==null?e=[e,r,l]:(e=null,t=c)):(e=null,t=c)):(e=null,t=c),e!==null&&(e=function(d){return":"}()),e===null&&(t=i),e}function ke(){var e,r,l,i;return l=t,i=t,e=B(),e!==null?(r=$(),r!==null?e=[e,r]:(e=null,t=i)):(e=null,t=i),e!==null&&(e=function(c){return'"'}()),e===null&&(t=l),e}function ft(){var e,r,l,i;return l=t,i=t,e=$(),e!==null?(r=B(),r!==null?e=[e,r]:(e=null,t=i)):(e=null,t=i),e!==null&&(e=function(c){return'"'}()),e===null&&(t=l),e}function X(){var e,r,l,i;if(i=t,e=He(),e!==null){for(r=[],l=q(),l===null&&(l=pe(),l===null&&(l=X()));l!==null;)r.push(l),l=q(),l===null&&(l=pe(),l===null&&(l=X()));r!==null?(l=We(),l!==null?e=[e,r,l]:(e=null,t=i)):(e=null,t=i)}else e=null,t=i;return e}function q(){var e;return/^[!-']/.test(s.charAt(t))?(e=s.charAt(t),t++):(e=null,o("[!-']")),e===null&&(/^[*-[]/.test(s.charAt(t))?(e=s.charAt(t),t++):(e=null,o("[*-[]")),e===null&&(/^[\]-~]/.test(s.charAt(t))?(e=s.charAt(t),t++):(e=null,o("[\\]-~]")),e===null&&(e=R(),e===null&&(e=P())))),e}function ne(){var e,r,l,i,c,d;if(c=t,d=t,e=B(),e!==null)if(r=$(),r!==null){for(l=[],i=_e(),i===null&&(i=pe());i!==null;)l.push(i),i=_e(),i===null&&(i=pe());l!==null?(i=$(),i!==null?e=[e,r,l,i]:(e=null,t=d)):(e=null,t=d)}else e=null,t=d;else e=null,t=d;return e!==null&&(e=function(m){return s.substring(t,m)}(c)),e===null&&(t=c),e}function le(){var e,r,l,i,c,d;if(c=t,d=t,e=B(),e!==null)if(r=$(),r!==null){for(l=[],i=_e(),i===null&&(i=pe());i!==null;)l.push(i),i=_e(),i===null&&(i=pe());l!==null?(i=$(),i!==null?e=[e,r,l,i]:(e=null,t=d)):(e=null,t=d)}else e=null,t=d;else e=null,t=d;return e!==null&&(e=function(m){var E=s.substring(t,m).trim();return E.substring(1,E.length-1).replace(/\\([\x00-\x09\x0b-\x0c\x0e-\x7f])/g,"$1")}(c)),e===null&&(t=c),e}function _e(){var e;return e=P(),e===null&&(s.charCodeAt(t)===33?(e="!",t++):(e=null,o('"!"')),e===null&&(/^[#-[]/.test(s.charAt(t))?(e=s.charAt(t),t++):(e=null,o("[#-[]")),e===null&&(/^[\]-~]/.test(s.charAt(t))?(e=s.charAt(t),t++):(e=null,o("[\\]-~]")),e===null&&(e=R())))),e}function pe(){var e,r,l;return l=t,s.charCodeAt(t)===92?(e="\\",t++):(e=null,o('"\\\\"')),e!==null?(/^[\0-\t]/.test(s.charAt(t))?(r=s.charAt(t),t++):(r=null,o("[\\0-\\t]")),r===null&&(/^[\x0B-\f]/.test(s.charAt(t))?(r=s.charAt(t),t++):(r=null,o("[\\x0B-\\f]")),r===null&&(/^[\x0E-]/.test(s.charAt(t))?(r=s.charAt(t),t++):(r=null,o("[\\x0E-]")))),r!==null?e=[e,r]:(e=null,t=l)):(e=null,t=l),e}function oe(){var e,r,l,i,c,d;return c=t,d=t,e=Ue(),e!==null?(s.charCodeAt(t)===58?(r=":",t++):(r=null,o('":"')),r!==null?(l=Ct(),l=l!==null?l:"",l!==null?(i=Oe(),i!==null?e=[e,r,l,i]:(e=null,t=d)):(e=null,t=d)):(e=null,t=d)):(e=null,t=d),e!==null&&(e=function(m){try{v.uri=new Rl(v.scheme,v.user,v.host,v.port),delete v.scheme,delete v.user,delete v.host,delete v.host_type,delete v.port}catch{v=-1}}()),e===null&&(t=c),e}function ze(){var e,r,l,i,c,d,m,E;return m=t,E=t,e=Ue(),e!==null?(s.charCodeAt(t)===58?(r=":",t++):(r=null,o('":"')),r!==null?(l=Ct(),l=l!==null?l:"",l!==null?(i=Oe(),i!==null?(c=jn(),c!==null?(d=nr(),d=d!==null?d:"",d!==null?e=[e,r,l,i,c,d]:(e=null,t=E)):(e=null,t=E)):(e=null,t=E)):(e=null,t=E)):(e=null,t=E)):(e=null,t=E),e!==null&&(e=function(O){try{v.uri=new Rl(v.scheme,v.user,v.host,v.port,v.uri_params,v.uri_headers),delete v.scheme,delete v.user,delete v.host,delete v.host_type,delete v.port,delete v.uri_params,a==="SIP_URI"&&(v=v.uri)}catch{v=-1}}()),e===null&&(t=m),e}function Ue(){var e;return e=Qt(),e===null&&(e=Jt()),e}function Qt(){var e,r;return r=t,s.substr(t,4).toLowerCase()==="sips"?(e=s.substr(t,4),t+=4):(e=null,o('"sips"')),e!==null&&(e=function(l,i){v.scheme=i.toLowerCase()}(r,e)),e===null&&(t=r),e}function Jt(){var e,r;return r=t,s.substr(t,3).toLowerCase()==="sip"?(e=s.substr(t,3),t+=3):(e=null,o('"sip"')),e!==null&&(e=function(l,i){v.scheme=i.toLowerCase()}(r,e)),e===null&&(t=r),e}function Ct(){var e,r,l,i,c,d;return i=t,c=t,e=I(),e!==null?(d=t,s.charCodeAt(t)===58?(r=":",t++):(r=null,o('":"')),r!==null?(l=Te(),l!==null?r=[r,l]:(r=null,t=d)):(r=null,t=d),r=r!==null?r:"",r!==null?(s.charCodeAt(t)===64?(l="@",t++):(l=null,o('"@"')),l!==null?e=[e,r,l]:(e=null,t=c)):(e=null,t=c)):(e=null,t=c),e!==null&&(e=function(m){v.user=decodeURIComponent(s.substring(t-1,m))}(i)),e===null&&(t=i),e}function I(){var e,r;if(r=C(),r===null&&(r=j(),r===null&&(r=te())),r!==null)for(e=[];r!==null;)e.push(r),r=C(),r===null&&(r=j(),r===null&&(r=te()));else e=null;return e}function te(){var e;return s.charCodeAt(t)===38?(e="&",t++):(e=null,o('"&"')),e===null&&(s.charCodeAt(t)===61?(e="=",t++):(e=null,o('"="')),e===null&&(s.charCodeAt(t)===43?(e="+",t++):(e=null,o('"+"')),e===null&&(s.charCodeAt(t)===36?(e="$",t++):(e=null,o('"$"')),e===null&&(s.charCodeAt(t)===44?(e=",",t++):(e=null,o('","')),e===null&&(s.charCodeAt(t)===59?(e=";",t++):(e=null,o('";"')),e===null&&(s.charCodeAt(t)===63?(e="?",t++):(e=null,o('"?"')),e===null&&(s.charCodeAt(t)===47?(e="/",t++):(e=null,o('"/"'))))))))),e}function Te(){var e,r,l;for(l=t,e=[],r=C(),r===null&&(r=j(),r===null&&(s.charCodeAt(t)===38?(r="&",t++):(r=null,o('"&"')),r===null&&(s.charCodeAt(t)===61?(r="=",t++):(r=null,o('"="')),r===null&&(s.charCodeAt(t)===43?(r="+",t++):(r=null,o('"+"')),r===null&&(s.charCodeAt(t)===36?(r="$",t++):(r=null,o('"$"')),r===null&&(s.charCodeAt(t)===44?(r=",",t++):(r=null,o('","'))))))));r!==null;)e.push(r),r=C(),r===null&&(r=j(),r===null&&(s.charCodeAt(t)===38?(r="&",t++):(r=null,o('"&"')),r===null&&(s.charCodeAt(t)===61?(r="=",t++):(r=null,o('"="')),r===null&&(s.charCodeAt(t)===43?(r="+",t++):(r=null,o('"+"')),r===null&&(s.charCodeAt(t)===36?(r="$",t++):(r=null,o('"$"')),r===null&&(s.charCodeAt(t)===44?(r=",",t++):(r=null,o('","'))))))));return e!==null&&(e=function(i){v.password=s.substring(t,i)}(l)),e===null&&(t=l),e}function Oe(){var e,r,l,i,c;return i=t,e=Ze(),e!==null?(c=t,s.charCodeAt(t)===58?(r=":",t++):(r=null,o('":"')),r!==null?(l=Wn(),l!==null?r=[r,l]:(r=null,t=c)):(r=null,t=c),r=r!==null?r:"",r!==null?e=[e,r]:(e=null,t=i)):(e=null,t=i),e}function Ze(){var e,r;return r=t,e=Is(),e===null&&(e=Nt(),e===null&&(e=Os())),e!==null&&(e=function(l){return v.host=s.substring(t,l).toLowerCase(),v.host}(r)),e===null&&(t=r),e}function Is(){var e,r,l,i,c,d;for(i=t,c=t,e=[],d=t,r=Ns(),r!==null?(s.charCodeAt(t)===46?(l=".",t++):(l=null,o('"."')),l!==null?r=[r,l]:(r=null,t=d)):(r=null,t=d);r!==null;)e.push(r),d=t,r=Ns(),r!==null?(s.charCodeAt(t)===46?(l=".",t++):(l=null,o('"."')),l!==null?r=[r,l]:(r=null,t=d)):(r=null,t=d);return e!==null?(r=Gn(),r!==null?(s.charCodeAt(t)===46?(l=".",t++):(l=null,o('"."')),l=l!==null?l:"",l!==null?e=[e,r,l]:(e=null,t=c)):(e=null,t=c)):(e=null,t=c),e!==null&&(e=function(m){return v.host_type="domain",s.substring(t,m)}(i)),e===null&&(t=i),e}function Ns(){var e,r,l,i;if(i=t,e=Q(),e!==null){for(r=[],l=Q(),l===null&&(s.charCodeAt(t)===45?(l="-",t++):(l=null,o('"-"')),l===null&&(s.charCodeAt(t)===95?(l="_",t++):(l=null,o('"_"'))));l!==null;)r.push(l),l=Q(),l===null&&(s.charCodeAt(t)===45?(l="-",t++):(l=null,o('"-"')),l===null&&(s.charCodeAt(t)===95?(l="_",t++):(l=null,o('"_"'))));r!==null?e=[e,r]:(e=null,t=i)}else e=null,t=i;return e}function Gn(){var e,r,l,i;if(i=t,e=S(),e!==null){for(r=[],l=Q(),l===null&&(s.charCodeAt(t)===45?(l="-",t++):(l=null,o('"-"')),l===null&&(s.charCodeAt(t)===95?(l="_",t++):(l=null,o('"_"'))));l!==null;)r.push(l),l=Q(),l===null&&(s.charCodeAt(t)===45?(l="-",t++):(l=null,o('"-"')),l===null&&(s.charCodeAt(t)===95?(l="_",t++):(l=null,o('"_"'))));r!==null?e=[e,r]:(e=null,t=i)}else e=null,t=i;return e}function Os(){var e,r,l,i,c;return i=t,c=t,s.charCodeAt(t)===91?(e="[",t++):(e=null,o('"["')),e!==null?(r=xs(),r!==null?(s.charCodeAt(t)===93?(l="]",t++):(l=null,o('"]"')),l!==null?e=[e,r,l]:(e=null,t=c)):(e=null,t=c)):(e=null,t=c),e!==null&&(e=function(d){return v.host_type="IPv6",s.substring(t,d)}(i)),e===null&&(t=i),e}function xs(){var e,r,l,i,c,d,m,E,O,J,de,et,fs,Qs,y,W;return Qs=t,y=t,e=G(),e!==null?(s.charCodeAt(t)===58?(r=":",t++):(r=null,o('":"')),r!==null?(l=G(),l!==null?(s.charCodeAt(t)===58?(i=":",t++):(i=null,o('":"')),i!==null?(c=G(),c!==null?(s.charCodeAt(t)===58?(d=":",t++):(d=null,o('":"')),d!==null?(m=G(),m!==null?(s.charCodeAt(t)===58?(E=":",t++):(E=null,o('":"')),E!==null?(O=G(),O!==null?(s.charCodeAt