voxnix 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +109 -0
- package/dist/voxnix.js +17484 -0
- package/dist/voxnix.umd.cjs +102 -0
- package/package.json +44 -0
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
(function(){"use strict";try{if(typeof document<"u"){var t=document.createElement("style");t.appendChild(document.createTextNode('*,:before,:after{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }::backdrop{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }*,:before,:after{box-sizing:border-box;border-width:0;border-style:solid;border-color:#e5e7eb}:before,:after{--tw-content: ""}html,:host{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;-o-tab-size:4;tab-size:4;font-family:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol,"Noto Color Emoji";font-feature-settings:normal;font-variation-settings:normal;-webkit-tap-highlight-color:transparent}body{margin:0;line-height:inherit}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-feature-settings:normal;font-variation-settings:normal;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-family:inherit;font-feature-settings:inherit;font-variation-settings:inherit;font-size:100%;font-weight:inherit;line-height:inherit;letter-spacing:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,input:where([type=button]),input:where([type=reset]),input:where([type=submit]){-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dl,dd,h1,h2,h3,h4,h5,h6,hr,figure,p,pre{margin:0}fieldset{margin:0;padding:0}legend{padding:0}ol,ul,menu{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{opacity:1;color:#9ca3af}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}button,[role=button]{cursor:pointer}:disabled{cursor:default}img,svg,video,canvas,audio,iframe,embed,object{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}[hidden]:where(:not([hidden=until-found])){display:none}body{background-color:transparent;--tw-text-opacity: 1;color:rgb(31 41 55 / var(--tw-text-opacity, 1));-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;font-family:Inter,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen,Ubuntu,Cantarell,Open Sans,Helvetica Neue,sans-serif}.fixed{position:fixed}.absolute{position:absolute}.relative{position:relative}.inset-0{top:0;right:0;bottom:0;left:0}.left-0{left:0}.left-1\\/2{left:50%}.top-0{top:0}.top-4{top:1rem}.-z-10{z-index:-10}.z-10{z-index:10}.z-50{z-index:50}.z-\\[9999\\]{z-index:9999}.mx-auto{margin-left:auto;margin-right:auto}.mb-1{margin-bottom:.25rem}.mb-2{margin-bottom:.5rem}.mb-6{margin-bottom:1.5rem}.mb-8{margin-bottom:2rem}.mr-1\\.5{margin-right:.375rem}.mt-0\\.5{margin-top:.125rem}.mt-1{margin-top:.25rem}.mt-2{margin-top:.5rem}.mt-4{margin-top:1rem}.mt-6{margin-top:1.5rem}.mt-auto{margin-top:auto}.block{display:block}.flex{display:flex}.grid{display:grid}.hidden{display:none}.h-10{height:2.5rem}.h-12{height:3rem}.h-14{height:3.5rem}.h-16{height:4rem}.h-2{height:.5rem}.h-20{height:5rem}.h-24{height:6rem}.h-3\\.5{height:.875rem}.h-32{height:8rem}.h-6{height:1.5rem}.h-full{height:100%}.min-h-\\[20px\\]{min-height:20px}.min-h-\\[260px\\]{min-height:260px}.min-h-\\[88px\\]{min-height:88px}.w-10{width:2.5rem}.w-12{width:3rem}.w-14{width:3.5rem}.w-16{width:4rem}.w-2{width:.5rem}.w-20{width:5rem}.w-24{width:6rem}.w-3\\.5{width:.875rem}.w-32{width:8rem}.w-6{width:1.5rem}.w-full{width:100%}.max-w-\\[240px\\]{max-width:240px}.max-w-\\[360px\\]{max-width:360px}.max-w-sm{max-width:24rem}.flex-1{flex:1 1 0%}.-translate-x-1\\/2{--tw-translate-x: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.transform{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}@keyframes bounce{0%,to{transform:translateY(-25%);animation-timing-function:cubic-bezier(.8,0,1,1)}50%{transform:none;animation-timing-function:cubic-bezier(0,0,.2,1)}}.animate-bounce{animation:bounce 1s infinite}@keyframes ping{75%,to{transform:scale(2);opacity:0}}.animate-ping{animation:ping 1s cubic-bezier(0,0,.2,1) infinite}@keyframes pulse{50%{opacity:.5}}.animate-pulse{animation:pulse 2s cubic-bezier(.4,0,.6,1) infinite}@keyframes spin{to{transform:rotate(360deg)}}.animate-spin{animation:spin 1s linear infinite}.grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.flex-col{flex-direction:column}.items-center{align-items:center}.justify-center{justify-content:center}.gap-1\\.5{gap:.375rem}.gap-2{gap:.5rem}.gap-4{gap:1rem}.gap-8{gap:2rem}.space-y-4>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1rem * var(--tw-space-y-reverse))}.overflow-hidden{overflow:hidden}.truncate{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.rounded-2xl{border-radius:1rem}.rounded-full{border-radius:9999px}.rounded-lg{border-radius:.5rem}.border{border-width:1px}.border-4{border-width:4px}.border-t{border-top-width:1px}.border-none{border-style:none}.border-gray-100{--tw-border-opacity: 1;border-color:rgb(243 244 246 / var(--tw-border-opacity, 1))}.border-gray-300{--tw-border-opacity: 1;border-color:rgb(209 213 219 / var(--tw-border-opacity, 1))}.border-green-500\\/20{border-color:#22c55e33}.border-primary{--tw-border-opacity: 1;border-color:rgb(63 49 146 / var(--tw-border-opacity, 1))}.border-primary-border{--tw-border-opacity: 1;border-color:rgb(209 204 235 / var(--tw-border-opacity, 1))}.border-primary-border\\/40{border-color:#d1cceb66}.border-primary-border\\/50{border-color:#d1cceb80}.border-primary\\/20{border-color:#3f319233}.border-primary\\/5{border-color:#3f31920d}.border-red-500{--tw-border-opacity: 1;border-color:rgb(239 68 68 / var(--tw-border-opacity, 1))}.border-t-transparent{border-top-color:transparent}.bg-black\\/50{background-color:#00000080}.bg-green-500{--tw-bg-opacity: 1;background-color:rgb(34 197 94 / var(--tw-bg-opacity, 1))}.bg-green-500\\/10{background-color:#22c55e1a}.bg-green-500\\/20{background-color:#22c55e33}.bg-green-500\\/5{background-color:#22c55e0d}.bg-green-600{--tw-bg-opacity: 1;background-color:rgb(22 163 74 / var(--tw-bg-opacity, 1))}.bg-primary{--tw-bg-opacity: 1;background-color:rgb(63 49 146 / var(--tw-bg-opacity, 1))}.bg-primary-light\\/40{background-color:#f0eff766}.bg-primary-light\\/80{background-color:#f0eff7cc}.bg-primary\\/10{background-color:#3f31921a}.bg-primary\\/5{background-color:#3f31920d}.bg-red-500{--tw-bg-opacity: 1;background-color:rgb(239 68 68 / var(--tw-bg-opacity, 1))}.bg-red-600{--tw-bg-opacity: 1;background-color:rgb(220 38 38 / var(--tw-bg-opacity, 1))}.bg-transparent{background-color:transparent}.bg-white{--tw-bg-opacity: 1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1))}.bg-white\\/5{background-color:#ffffff0d}.bg-white\\/90{background-color:#ffffffe6}.bg-gradient-to-tr{background-image:linear-gradient(to top right,var(--tw-gradient-stops))}.from-green-500\\/20{--tw-gradient-from: rgb(34 197 94 / .2) var(--tw-gradient-from-position);--tw-gradient-to: rgb(34 197 94 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-primary\\/0{--tw-gradient-from: rgb(63 49 146 / 0) var(--tw-gradient-from-position);--tw-gradient-to: rgb(63 49 146 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-primary\\/20{--tw-gradient-from: rgb(63 49 146 / .2) var(--tw-gradient-from-position);--tw-gradient-to: rgb(63 49 146 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-red-500\\/20{--tw-gradient-from: rgb(239 68 68 / .2) var(--tw-gradient-from-position);--tw-gradient-to: rgb(239 68 68 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.via-primary\\/5{--tw-gradient-to: rgb(63 49 146 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), rgb(63 49 146 / .05) var(--tw-gradient-via-position), var(--tw-gradient-to)}.to-green-500\\/5{--tw-gradient-to: rgb(34 197 94 / .05) var(--tw-gradient-to-position)}.to-primary\\/0{--tw-gradient-to: rgb(63 49 146 / 0) var(--tw-gradient-to-position)}.to-primary\\/5{--tw-gradient-to: rgb(63 49 146 / .05) var(--tw-gradient-to-position)}.to-red-500\\/5{--tw-gradient-to: rgb(239 68 68 / .05) var(--tw-gradient-to-position)}.fill-white{fill:#fff}.p-4{padding:1rem}.p-6{padding:1.5rem}.px-4{padding-left:1rem;padding-right:1rem}.px-6{padding-left:1.5rem;padding-right:1.5rem}.px-8{padding-left:2rem;padding-right:2rem}.py-1\\.5{padding-top:.375rem;padding-bottom:.375rem}.py-2{padding-top:.5rem;padding-bottom:.5rem}.py-2\\.5{padding-top:.625rem;padding-bottom:.625rem}.py-4{padding-top:1rem;padding-bottom:1rem}.py-5{padding-top:1.25rem;padding-bottom:1.25rem}.py-8{padding-top:2rem;padding-bottom:2rem}.pb-4{padding-bottom:1rem}.pt-8{padding-top:2rem}.text-center{text-align:center}.text-2xl{font-size:1.5rem;line-height:2rem}.text-3xl{font-size:1.875rem;line-height:2.25rem}.text-\\[10px\\]{font-size:10px}.text-lg{font-size:1.125rem;line-height:1.75rem}.text-sm{font-size:.875rem;line-height:1.25rem}.text-xl{font-size:1.25rem;line-height:1.75rem}.text-xs{font-size:.75rem;line-height:1rem}.font-bold{font-weight:700}.font-medium{font-weight:500}.font-semibold{font-weight:600}.uppercase{text-transform:uppercase}.tracking-wide{letter-spacing:.025em}.tracking-wider{letter-spacing:.05em}.tracking-widest{letter-spacing:.1em}.text-gray-400{--tw-text-opacity: 1;color:rgb(156 163 175 / var(--tw-text-opacity, 1))}.text-gray-500{--tw-text-opacity: 1;color:rgb(107 114 128 / var(--tw-text-opacity, 1))}.text-gray-700{--tw-text-opacity: 1;color:rgb(55 65 81 / var(--tw-text-opacity, 1))}.text-gray-800{--tw-text-opacity: 1;color:rgb(31 41 55 / var(--tw-text-opacity, 1))}.text-green-600{--tw-text-opacity: 1;color:rgb(22 163 74 / var(--tw-text-opacity, 1))}.text-green-700{--tw-text-opacity: 1;color:rgb(21 128 61 / var(--tw-text-opacity, 1))}.text-primary{--tw-text-opacity: 1;color:rgb(63 49 146 / var(--tw-text-opacity, 1))}.text-red-500{--tw-text-opacity: 1;color:rgb(239 68 68 / var(--tw-text-opacity, 1))}.text-red-600{--tw-text-opacity: 1;color:rgb(220 38 38 / var(--tw-text-opacity, 1))}.text-red-700{--tw-text-opacity: 1;color:rgb(185 28 28 / var(--tw-text-opacity, 1))}.text-white{--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}.opacity-0{opacity:0}.opacity-50{opacity:.5}.opacity-75{opacity:.75}.shadow-\\[0_4px_12px_rgba\\(220\\,38\\,38\\,0\\.3\\)\\]{--tw-shadow: 0 4px 12px rgba(220,38,38,.3);--tw-shadow-colored: 0 4px 12px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-\\[0_4px_12px_rgba\\(220\\,38\\,38\\,0\\.35\\)\\]{--tw-shadow: 0 4px 12px rgba(220,38,38,.35);--tw-shadow-colored: 0 4px 12px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-\\[0_4px_12px_rgba\\(239\\,68\\,68\\,0\\.3\\)\\]{--tw-shadow: 0 4px 12px rgba(239,68,68,.3);--tw-shadow-colored: 0 4px 12px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-\\[0_4px_16px_rgba\\(22\\,163\\,74\\,0\\.4\\)\\]{--tw-shadow: 0 4px 16px rgba(22,163,74,.4);--tw-shadow-colored: 0 4px 16px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-\\[0_4px_16px_rgba\\(220\\,38\\,38\\,0\\.4\\)\\]{--tw-shadow: 0 4px 16px rgba(220,38,38,.4);--tw-shadow-colored: 0 4px 16px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-inner{--tw-shadow: inset 0 2px 4px 0 rgb(0 0 0 / .05);--tw-shadow-colored: inset 0 2px 4px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-lg{--tw-shadow: 0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1);--tw-shadow-colored: 0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-md{--tw-shadow: 0 4px 6px -1px rgb(0 0 0 / .1), 0 2px 4px -2px rgb(0 0 0 / .1);--tw-shadow-colored: 0 4px 6px -1px var(--tw-shadow-color), 0 2px 4px -2px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-xl{--tw-shadow: 0 20px 25px -5px rgb(0 0 0 / .1), 0 8px 10px -6px rgb(0 0 0 / .1);--tw-shadow-colored: 0 20px 25px -5px var(--tw-shadow-color), 0 8px 10px -6px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.outline-none{outline:2px solid transparent;outline-offset:2px}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.backdrop-blur-md{--tw-backdrop-blur: blur(12px);-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.backdrop-blur-sm{--tw-backdrop-blur: blur(4px);-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.transition-all{transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-colors{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-opacity{transition-property:opacity;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-transform{transition-property:transform;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.duration-1000{transition-duration:1s}.duration-200{transition-duration:.2s}@keyframes fadeIn{0%{opacity:0;transform:scale(.98)}to{opacity:1;transform:scale(1)}}@keyframes slideUp{0%{opacity:0;transform:translateY(10px)}to{opacity:1;transform:translateY(0)}}.animate-fadeIn{animation:fadeIn .25s cubic-bezier(.16,1,.3,1) forwards}.animate-slideUp{animation:slideUp .3s cubic-bezier(.16,1,.3,1) forwards}.hover\\:bg-green-700:hover{--tw-bg-opacity: 1;background-color:rgb(21 128 61 / var(--tw-bg-opacity, 1))}.hover\\:bg-primary-hover:hover{--tw-bg-opacity: 1;background-color:rgb(43 32 102 / var(--tw-bg-opacity, 1))}.hover\\:bg-primary-light:hover{--tw-bg-opacity: 1;background-color:rgb(240 239 247 / var(--tw-bg-opacity, 1))}.hover\\:bg-primary\\/10:hover{background-color:#3f31921a}.hover\\:bg-red-700:hover{--tw-bg-opacity: 1;background-color:rgb(185 28 28 / var(--tw-bg-opacity, 1))}.hover\\:text-primary:hover{--tw-text-opacity: 1;color:rgb(63 49 146 / var(--tw-text-opacity, 1))}.hover\\:shadow-\\[0_6px_22px_rgba\\(22\\,163\\,74\\,0\\.5\\)\\]:hover{--tw-shadow: 0 6px 22px rgba(22,163,74,.5);--tw-shadow-colored: 0 6px 22px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.focus\\:border-primary:focus{--tw-border-opacity: 1;border-color:rgb(63 49 146 / var(--tw-border-opacity, 1))}.focus\\:ring-2:focus{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus\\:ring-primary:focus{--tw-ring-opacity: 1;--tw-ring-color: rgb(63 49 146 / var(--tw-ring-opacity, 1))}.active\\:scale-95:active{--tw-scale-x: .95;--tw-scale-y: .95;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.active\\:bg-primary\\/20:active{background-color:#3f319233}.group:hover .group-hover\\:opacity-100{opacity:1}.group:active .group-active\\:scale-95{--tw-scale-x: .95;--tw-scale-y: .95;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}')),document.head.appendChild(t)}}catch(r){console.error("vite-plugin-css-injected-by-js",r)}})();
|
|
2
|
+
(function(Kt,Ue){typeof exports=="object"&&typeof module<"u"?Ue(exports,require("react")):typeof define=="function"&&define.amd?define(["exports","react"],Ue):(Kt=typeof globalThis<"u"?globalThis:Kt||self,Ue(Kt.Voxnix={},Kt.React))})(this,function(Kt,Ue){"use strict";var Q=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function wo(s){return s&&s.__esModule&&Object.prototype.hasOwnProperty.call(s,"default")?s.default:s}function Co(s){if(s.__esModule)return s;var e=s.default;if(typeof e=="function"){var t=function r(){return this instanceof r?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};t.prototype=e.prototype}else t={};return Object.defineProperty(t,"__esModule",{value:!0}),Object.keys(s).forEach(function(r){var i=Object.getOwnPropertyDescriptor(s,r);Object.defineProperty(t,r,i.get?i:{enumerable:!0,get:function(){return s[r]}})}),t}var qs={exports:{}},Rr={};/**
|
|
3
|
+
* @license React
|
|
4
|
+
* react-jsx-runtime.production.min.js
|
|
5
|
+
*
|
|
6
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
7
|
+
*
|
|
8
|
+
* This source code is licensed under the MIT license found in the
|
|
9
|
+
* LICENSE file in the root directory of this source tree.
|
|
10
|
+
*/var En;function _o(){if(En)return Rr;En=1;var s=Ue,e=Symbol.for("react.element"),t=Symbol.for("react.fragment"),r=Object.prototype.hasOwnProperty,i=s.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,n={key:!0,ref:!0,__self:!0,__source:!0};function a(o,d,c){var l,g={},u=null,y=null;c!==void 0&&(u=""+c),d.key!==void 0&&(u=""+d.key),d.ref!==void 0&&(y=d.ref);for(l in d)r.call(d,l)&&!n.hasOwnProperty(l)&&(g[l]=d[l]);if(o&&o.defaultProps)for(l in d=o.defaultProps,d)g[l]===void 0&&(g[l]=d[l]);return{$$typeof:e,type:o,key:u,ref:y,props:g,_owner:i.current}}return Rr.Fragment=t,Rr.jsx=a,Rr.jsxs=a,Rr}var Fr={};/**
|
|
11
|
+
* @license React
|
|
12
|
+
* react-jsx-runtime.development.js
|
|
13
|
+
*
|
|
14
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
15
|
+
*
|
|
16
|
+
* This source code is licensed under the MIT license found in the
|
|
17
|
+
* LICENSE file in the root directory of this source tree.
|
|
18
|
+
*/var yn;function Do(){return yn||(yn=1,process.env.NODE_ENV!=="production"&&function(){var s=Ue,e=Symbol.for("react.element"),t=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),i=Symbol.for("react.strict_mode"),n=Symbol.for("react.profiler"),a=Symbol.for("react.provider"),o=Symbol.for("react.context"),d=Symbol.for("react.forward_ref"),c=Symbol.for("react.suspense"),l=Symbol.for("react.suspense_list"),g=Symbol.for("react.memo"),u=Symbol.for("react.lazy"),y=Symbol.for("react.offscreen"),v=Symbol.iterator,C="@@iterator";function _(D){if(D===null||typeof D!="object")return null;var P=v&&D[v]||D[C];return typeof P=="function"?P:null}var x=s.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function p(D){{for(var P=arguments.length,Y=new Array(P>1?P-1:0),Z=1;Z<P;Z++)Y[Z-1]=arguments[Z];E("error",D,Y)}}function E(D,P,Y){{var Z=x.ReactDebugCurrentFrame,ge=Z.getStackAddendum();ge!==""&&(P+="%s",Y=Y.concat([ge]));var pe=Y.map(function(ae){return String(ae)});pe.unshift("Warning: "+P),Function.prototype.apply.call(console[D],console,pe)}}var b=!1,S=!1,T=!1,F=!1,h=!1,M;M=Symbol.for("react.module.reference");function A(D){return!!(typeof D=="string"||typeof D=="function"||D===r||D===n||h||D===i||D===c||D===l||F||D===y||b||S||T||typeof D=="object"&&D!==null&&(D.$$typeof===u||D.$$typeof===g||D.$$typeof===a||D.$$typeof===o||D.$$typeof===d||D.$$typeof===M||D.getModuleId!==void 0))}function f(D,P,Y){var Z=D.displayName;if(Z)return Z;var ge=P.displayName||P.name||"";return ge!==""?Y+"("+ge+")":Y}function w(D){return D.displayName||"Context"}function m(D){if(D==null)return null;if(typeof D.tag=="number"&&p("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof D=="function")return D.displayName||D.name||null;if(typeof D=="string")return D;switch(D){case r:return"Fragment";case t:return"Portal";case n:return"Profiler";case i:return"StrictMode";case c:return"Suspense";case l:return"SuspenseList"}if(typeof D=="object")switch(D.$$typeof){case o:var P=D;return w(P)+".Consumer";case a:var Y=D;return w(Y._context)+".Provider";case d:return f(D,D.render,"ForwardRef");case g:var Z=D.displayName||null;return Z!==null?Z:m(D.type)||"Memo";case u:{var ge=D,pe=ge._payload,ae=ge._init;try{return m(ae(pe))}catch{return null}}}return null}var q=Object.assign,N=0,z,V,ie,he,ue,k,$;function H(){}H.__reactDisabledLog=!0;function I(){{if(N===0){z=console.log,V=console.info,ie=console.warn,he=console.error,ue=console.group,k=console.groupCollapsed,$=console.groupEnd;var D={configurable:!0,enumerable:!0,value:H,writable:!0};Object.defineProperties(console,{info:D,log:D,warn:D,error:D,group:D,groupCollapsed:D,groupEnd:D})}N++}}function me(){{if(N--,N===0){var D={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:q({},D,{value:z}),info:q({},D,{value:V}),warn:q({},D,{value:ie}),error:q({},D,{value:he}),group:q({},D,{value:ue}),groupCollapsed:q({},D,{value:k}),groupEnd:q({},D,{value:$})})}N<0&&p("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var fe=x.ReactCurrentDispatcher,ke;function J(D,P,Y){{if(ke===void 0)try{throw Error()}catch(ge){var Z=ge.stack.trim().match(/\n( *(at )?)/);ke=Z&&Z[1]||""}return`
|
|
19
|
+
`+ke+D}}var Bt=!1,ct;{var Gr=typeof WeakMap=="function"?WeakMap:Map;ct=new Gr}function Yt(D,P){if(!D||Bt)return"";{var Y=ct.get(D);if(Y!==void 0)return Y}var Z;Bt=!0;var ge=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var pe;pe=fe.current,fe.current=null,I();try{if(P){var ae=function(){throw Error()};if(Object.defineProperty(ae.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(ae,[])}catch(We){Z=We}Reflect.construct(D,[],ae)}else{try{ae.call()}catch(We){Z=We}D.call(ae.prototype)}}else{try{throw Error()}catch(We){Z=We}D()}}catch(We){if(We&&Z&&typeof We.stack=="string"){for(var te=We.stack.split(`
|
|
20
|
+
`),qe=Z.stack.split(`
|
|
21
|
+
`),_e=te.length-1,be=qe.length-1;_e>=1&&be>=0&&te[_e]!==qe[be];)be--;for(;_e>=1&&be>=0;_e--,be--)if(te[_e]!==qe[be]){if(_e!==1||be!==1)do if(_e--,be--,be<0||te[_e]!==qe[be]){var tt=`
|
|
22
|
+
`+te[_e].replace(" at new "," at ");return D.displayName&&tt.includes("<anonymous>")&&(tt=tt.replace("<anonymous>",D.displayName)),typeof D=="function"&&ct.set(D,tt),tt}while(_e>=1&&be>=0);break}}}finally{Bt=!1,fe.current=pe,me(),Error.prepareStackTrace=ge}var Sr=D?D.displayName||D.name:"",hr=Sr?J(Sr):"";return typeof D=="function"&&ct.set(D,hr),hr}function Ke(D,P,Y){return Yt(D,!1)}function Ne(D){var P=D.prototype;return!!(P&&P.isReactComponent)}function kt(D,P,Y){if(D==null)return"";if(typeof D=="function")return Yt(D,Ne(D));if(typeof D=="string")return J(D);switch(D){case c:return J("Suspense");case l:return J("SuspenseList")}if(typeof D=="object")switch(D.$$typeof){case d:return Ke(D.render);case g:return kt(D.type,P,Y);case u:{var Z=D,ge=Z._payload,pe=Z._init;try{return kt(pe(ge),P,Y)}catch{}}}return""}var dt=Object.prototype.hasOwnProperty,cr={},Wt=x.ReactDebugCurrentFrame;function Vt(D){if(D){var P=D._owner,Y=kt(D.type,D._source,P?P.type:null);Wt.setExtraStackFrame(Y)}else Wt.setExtraStackFrame(null)}function dr(D,P,Y,Z,ge){{var pe=Function.call.bind(dt);for(var ae in D)if(pe(D,ae)){var te=void 0;try{if(typeof D[ae]!="function"){var qe=Error((Z||"React class")+": "+Y+" type `"+ae+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof D[ae]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw qe.name="Invariant Violation",qe}te=D[ae](P,ae,Z,Y,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(_e){te=_e}te&&!(te instanceof Error)&&(Vt(ge),p("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",Z||"React class",Y,ae,typeof te),Vt(null)),te instanceof Error&&!(te.message in cr)&&(cr[te.message]=!0,Vt(ge),p("Failed %s type: %s",Y,te.message),Vt(null))}}}var Ze=Array.isArray;function Pe(D){return Ze(D)}function vt(D){{var P=typeof Symbol=="function"&&Symbol.toStringTag,Y=P&&D[Symbol.toStringTag]||D.constructor.name||"Object";return Y}}function br(D){try{return zr(D),!1}catch{return!0}}function zr(D){return""+D}function It(D){if(br(D))return p("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",vt(D)),zr(D)}var Gt=x.ReactCurrentOwner,hn={key:!0,ref:!0,__self:!0,__source:!0},Kr,Zr;function zt(D){if(dt.call(D,"ref")){var P=Object.getOwnPropertyDescriptor(D,"ref").get;if(P&&P.isReactWarning)return!1}return D.ref!==void 0}function lr(D){if(dt.call(D,"key")){var P=Object.getOwnPropertyDescriptor(D,"key").get;if(P&&P.isReactWarning)return!1}return D.key!==void 0}function un(D,P){typeof D.ref=="string"&&Gt.current}function Fs(D,P){{var Y=function(){Kr||(Kr=!0,p("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",P))};Y.isReactWarning=!0,Object.defineProperty(D,"key",{get:Y,configurable:!0})}}function Bs(D,P){{var Y=function(){Zr||(Zr=!0,p("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",P))};Y.isReactWarning=!0,Object.defineProperty(D,"ref",{get:Y,configurable:!0})}}var fn=function(D,P,Y,Z,ge,pe,ae){var te={$$typeof:e,type:D,key:P,ref:Y,props:ae,_owner:pe};return te._store={},Object.defineProperty(te._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(te,"_self",{configurable:!1,enumerable:!1,writable:!1,value:Z}),Object.defineProperty(te,"_source",{configurable:!1,enumerable:!1,writable:!1,value:ge}),Object.freeze&&(Object.freeze(te.props),Object.freeze(te)),te};function gn(D,P,Y,Z,ge){{var pe,ae={},te=null,qe=null;Y!==void 0&&(It(Y),te=""+Y),lr(P)&&(It(P.key),te=""+P.key),zt(P)&&(qe=P.ref,un(P,ge));for(pe in P)dt.call(P,pe)&&!hn.hasOwnProperty(pe)&&(ae[pe]=P[pe]);if(D&&D.defaultProps){var _e=D.defaultProps;for(pe in _e)ae[pe]===void 0&&(ae[pe]=_e[pe])}if(te||qe){var be=typeof D=="function"?D.displayName||D.name||"Unknown":D;te&&Fs(ae,be),qe&&Bs(ae,be)}return fn(D,te,qe,ge,Z,Gt.current,ae)}}var Ar=x.ReactCurrentOwner,ks=x.ReactDebugCurrentFrame;function $t(D){if(D){var P=D._owner,Y=kt(D.type,D._source,P?P.type:null);ks.setExtraStackFrame(Y)}else ks.setExtraStackFrame(null)}var Jr;Jr=!1;function Tr(D){return typeof D=="object"&&D!==null&&D.$$typeof===e}function Is(){{if(Ar.current){var D=m(Ar.current.type);if(D)return`
|
|
23
|
+
|
|
24
|
+
Check the render method of \``+D+"`."}return""}}function xn(D){return""}var $s={};function Hs(D){{var P=Is();if(!P){var Y=typeof D=="string"?D:D.displayName||D.name;Y&&(P=`
|
|
25
|
+
|
|
26
|
+
Check the top-level render call using <`+Y+">.")}return P}}function Ps(D,P){{if(!D._store||D._store.validated||D.key!=null)return;D._store.validated=!0;var Y=Hs(P);if($s[Y])return;$s[Y]=!0;var Z="";D&&D._owner&&D._owner!==Ar.current&&(Z=" It was passed a child from "+m(D._owner.type)+"."),$t(D),p('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',Y,Z),$t(null)}}function Os(D,P){{if(typeof D!="object")return;if(Pe(D))for(var Y=0;Y<D.length;Y++){var Z=D[Y];Tr(Z)&&Ps(Z,P)}else if(Tr(D))D._store&&(D._store.validated=!0);else if(D){var ge=_(D);if(typeof ge=="function"&&ge!==D.entries)for(var pe=ge.call(D),ae;!(ae=pe.next()).done;)Tr(ae.value)&&Ps(ae.value,P)}}}function Ms(D){{var P=D.type;if(P==null||typeof P=="string")return;var Y;if(typeof P=="function")Y=P.propTypes;else if(typeof P=="object"&&(P.$$typeof===d||P.$$typeof===g))Y=P.propTypes;else return;if(Y){var Z=m(P);dr(Y,D.props,"prop",Z,D)}else if(P.PropTypes!==void 0&&!Jr){Jr=!0;var ge=m(P);p("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",ge||"Unknown")}typeof P.getDefaultProps=="function"&&!P.getDefaultProps.isReactClassApproved&&p("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function pn(D){{for(var P=Object.keys(D.props),Y=0;Y<P.length;Y++){var Z=P[Y];if(Z!=="children"&&Z!=="key"){$t(D),p("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",Z),$t(null);break}}D.ref!==null&&($t(D),p("Invalid attribute `ref` supplied to `React.Fragment`."),$t(null))}}var Xr={};function Oe(D,P,Y,Z,ge,pe){{var ae=A(D);if(!ae){var te="";(D===void 0||typeof D=="object"&&D!==null&&Object.keys(D).length===0)&&(te+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");var qe=xn();qe?te+=qe:te+=Is();var _e;D===null?_e="null":Pe(D)?_e="array":D!==void 0&&D.$$typeof===e?(_e="<"+(m(D.type)||"Unknown")+" />",te=" Did you accidentally export a JSX literal instead of a component?"):_e=typeof D,p("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",_e,te)}var be=gn(D,P,Y,ge,pe);if(be==null)return be;if(ae){var tt=P.children;if(tt!==void 0)if(Z)if(Pe(tt)){for(var Sr=0;Sr<tt.length;Sr++)Os(tt[Sr],D);Object.freeze&&Object.freeze(tt)}else p("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else Os(tt,D)}if(dt.call(P,"key")){var hr=m(D),We=Object.keys(P).filter(function(Yh){return Yh!=="key"}),vn=We.length>0?"{key: someKey, "+We.join(": ..., ")+": ...}":"{key: someKey}";if(!Xr[hr+vn]){var jh=We.length>0?"{"+We.join(": ..., ")+": ...}":"{}";p(`A props object containing a "key" prop is being spread into JSX:
|
|
27
|
+
let props = %s;
|
|
28
|
+
<%s {...props} />
|
|
29
|
+
React keys must be passed directly to JSX without using spread:
|
|
30
|
+
let props = %s;
|
|
31
|
+
<%s key={someKey} {...props} />`,vn,hr,jh,hr),Xr[hr+vn]=!0}}return D===r?pn(be):Ms(be),be}}function Et(D,P,Y){return Oe(D,P,Y,!0)}function Ns(D,P,Y){return Oe(D,P,Y,!1)}var mn=Ns,Lh=Et;Fr.Fragment=r,Fr.jsx=mn,Fr.jsxs=Lh}()),Fr}process.env.NODE_ENV==="production"?qs.exports=_o():qs.exports=Do();var Me=qs.exports;const bo="0.21.1";class Zt extends Error{constructor(e){super(e),Object.setPrototypeOf(this,new.target.prototype)}}class Us extends Zt{constructor(e){super(e||"Unsupported content type.")}}class Ls extends Zt{constructor(e){super(e||"Request pending.")}}class Ao extends Zt{constructor(e){super(e||"Unspecified session description handler error.")}}class js extends Zt{constructor(){super("The session has terminated.")}}class Br extends Zt{constructor(e){super(e||"An error occurred during state transition.")}}class To{constructor(e){this.incomingAckRequest=e}get request(){return this.incomingAckRequest.message}}class So{constructor(e){this.incomingByeRequest=e}get request(){return this.incomingByeRequest.message}accept(e){return this.incomingByeRequest.accept(e),Promise.resolve()}reject(e){return this.incomingByeRequest.reject(e),Promise.resolve()}}class Ro{constructor(e){this.incomingCancelRequest=e}get request(){return this.incomingCancelRequest}}class kr{constructor(){this.listeners=new Array}addListener(e,t){const r=i=>{this.removeListener(r),e(i)};(t==null?void 0:t.once)===!0?this.listeners.push(r):this.listeners.push(e)}emit(e){this.listeners.slice().forEach(t=>t(e))}removeAllListeners(){this.listeners=[]}removeListener(e){this.listeners=this.listeners.filter(t=>t!==e)}on(e){return this.addListener(e)}off(e){return this.removeListener(e)}once(e){return this.addListener(e,{once:!0})}}class Fo{constructor(e){this.incomingInfoRequest=e}get request(){return this.incomingInfoRequest.message}accept(e){return this.incomingInfoRequest.accept(e),Promise.resolve()}reject(e){return this.incomingInfoRequest.reject(e),Promise.resolve()}}class wn{constructor(e){this.parameters={};for(const t in e)e.hasOwnProperty(t)&&this.setParam(t,e[t])}setParam(e,t){e&&(this.parameters[e.toLowerCase()]=typeof t>"u"||t===null?null:t.toString())}getParam(e){if(e)return this.parameters[e.toLowerCase()]}hasParam(e){return!!(e&&this.parameters[e.toLowerCase()]!==void 0)}deleteParam(e){if(e=e.toLowerCase(),this.hasParam(e)){const t=this.parameters[e];return delete this.parameters[e],t}}clearParams(){this.parameters={}}}class Le extends wn{constructor(e,t,r){super(r),this.uri=e,this._displayName=t}get friendlyName(){return this.displayName||this.uri.aor}get displayName(){return this._displayName}set displayName(e){this._displayName=e}clone(){return new Le(this.uri.clone(),this._displayName,JSON.parse(JSON.stringify(this.parameters)))}toString(){let e=this.displayName||this.displayName==="0"?'"'+this.displayName+'" ':"";e+="<"+this.uri.toString()+">";for(const t in this.parameters)this.parameters.hasOwnProperty(t)&&(e+=";"+t,this.parameters[t]!==null&&(e+="="+this.parameters[t]));return e}}class lt extends wn{constructor(e="sip",t,r,i,n,a){if(super(n||{}),this.headers={},!r)throw new TypeError('missing or invalid "host" parameter');for(const o in a)a.hasOwnProperty(o)&&this.setHeader(o,a[o]);this.raw={scheme:e,user:t,host:r,port:i},this.normal={scheme:e.toLowerCase(),user:t,host:r.toLowerCase(),port:i}}get scheme(){return this.normal.scheme}set scheme(e){this.raw.scheme=e,this.normal.scheme=e.toLowerCase()}get user(){return this.normal.user}set user(e){this.normal.user=this.raw.user=e}get host(){return this.normal.host}set host(e){this.raw.host=e,this.normal.host=e.toLowerCase()}get aor(){return this.normal.user+"@"+this.normal.host}get port(){return this.normal.port}set port(e){this.normal.port=this.raw.port=e}setHeader(e,t){this.headers[this.headerize(e)]=t instanceof Array?t:[t]}getHeader(e){if(e)return this.headers[this.headerize(e)]}hasHeader(e){return!!e&&!!this.headers.hasOwnProperty(this.headerize(e))}deleteHeader(e){if(e=this.headerize(e),this.headers.hasOwnProperty(e)){const t=this.headers[e];return delete this.headers[e],t}}clearHeaders(){this.headers={}}clone(){return new lt(this._raw.scheme,this._raw.user||"",this._raw.host,this._raw.port,JSON.parse(JSON.stringify(this.parameters)),JSON.parse(JSON.stringify(this.headers)))}toRaw(){return this._toString(this._raw)}toString(){return this._toString(this._normal)}get _normal(){return this.normal}get _raw(){return this.raw}_toString(e){let t=e.scheme+":";e.scheme.toLowerCase().match("^sips?$")||(t+="//"),e.user&&(t+=this.escapeUser(e.user)+"@"),t+=e.host,(e.port||e.port===0)&&(t+=":"+e.port);for(const i in this.parameters)this.parameters.hasOwnProperty(i)&&(t+=";"+i,this.parameters[i]!==null&&(t+="="+this.parameters[i]));const r=[];for(const i in this.headers)if(this.headers.hasOwnProperty(i))for(const n in this.headers[i])this.headers[i].hasOwnProperty(n)&&r.push(i+"="+this.headers[i][n]);return r.length>0&&(t+="?"+r.join("&")),t}escapeUser(e){let t;try{t=decodeURIComponent(e)}catch(r){throw r}return encodeURIComponent(t).replace(/%3A/ig,":").replace(/%2B/ig,"+").replace(/%3F/ig,"?").replace(/%2F/ig,"/")}headerize(e){const t={"Call-Id":"Call-ID",Cseq:"CSeq","Min-Se":"Min-SE",Rack:"RAck",Rseq:"RSeq","Www-Authenticate":"WWW-Authenticate"},r=e.toLowerCase().replace(/_/g,"-").split("-"),i=r.length;let n="";for(let a=0;a<i;a++)a!==0&&(n+="-"),n+=r[a].charAt(0).toUpperCase()+r[a].substring(1);return t[n]&&(n=t[n]),n}}function Cn(s,e){if(s.scheme!==e.scheme||s.user!==e.user||s.host!==e.host||s.port!==e.port)return!1;function t(n,a){const o=Object.keys(n.parameters),d=Object.keys(a.parameters);return!(!o.filter(l=>d.includes(l)).every(l=>n.parameters[l]===a.parameters[l])||!["user","ttl","method","transport"].every(l=>n.hasParam(l)&&a.hasParam(l)||!n.hasParam(l)&&!a.hasParam(l))||!["maddr"].every(l=>n.hasParam(l)&&a.hasParam(l)||!n.hasParam(l)&&!a.hasParam(l)))}if(!t(s,e))return!1;const r=Object.keys(s.headers),i=Object.keys(e.headers);if(r.length!==0||i.length!==0){if(r.length!==i.length)return!1;const n=r.filter(a=>i.includes(a));if(n.length!==i.length||!n.every(a=>s.headers[a].length&&e.headers[a].length&&s.headers[a][0]===e.headers[a][0]))return!1}return!0}function Ys(s,e,t){return t=t||" ",s.length>e?s:(e-=s.length,t+=t.repeat(e),s+t.slice(0,e))}class ur extends Error{constructor(e,t,r,i){super(),this.message=e,this.expected=t,this.found=r,this.location=i,this.name="SyntaxError",typeof Object.setPrototypeOf=="function"?Object.setPrototypeOf(this,ur.prototype):this.__proto__=ur.prototype,typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,ur)}static buildMessage(e,t){function r(c){return c.charCodeAt(0).toString(16).toUpperCase()}function i(c){return c.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,l=>"\\x0"+r(l)).replace(/[\x10-\x1F\x7F-\x9F]/g,l=>"\\x"+r(l))}function n(c){return c.replace(/\\/g,"\\\\").replace(/\]/g,"\\]").replace(/\^/g,"\\^").replace(/-/g,"\\-").replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,l=>"\\x0"+r(l)).replace(/[\x10-\x1F\x7F-\x9F]/g,l=>"\\x"+r(l))}function a(c){switch(c.type){case"literal":return'"'+i(c.text)+'"';case"class":const l=c.parts.map(g=>Array.isArray(g)?n(g[0])+"-"+n(g[1]):n(g));return"["+(c.inverted?"^":"")+l+"]";case"any":return"any character";case"end":return"end of input";case"other":return c.description}}function o(c){const l=c.map(a);let g,u;if(l.sort(),l.length>0){for(g=1,u=1;g<l.length;g++)l[g-1]!==l[g]&&(l[u]=l[g],u++);l.length=u}switch(l.length){case 1:return l[0];case 2:return l[0]+" or "+l[1];default:return l.slice(0,-1).join(", ")+", or "+l[l.length-1]}}function d(c){return c?'"'+i(c)+'"':"end of input"}return"Expected "+o(e)+" but "+d(t)+" found."}format(e){let t="Error: "+this.message;if(this.location){let r=null,i;for(i=0;i<e.length;i++)if(e[i].source===this.location.source){r=e[i].text.split(/\r\n|\n|\r/g);break}let n=this.location.start,a=this.location.source+":"+n.line+":"+n.column;if(r){let o=this.location.end,d=Ys("",n.line.toString().length," "),c=r[n.line-1],l=n.line===o.line?o.column:c.length+1;t+=`
|
|
32
|
+
--> `+a+`
|
|
33
|
+
`+d+` |
|
|
34
|
+
`+n.line+" | "+c+`
|
|
35
|
+
`+d+" | "+Ys("",n.column-1," ")+Ys("",l-n.column,"^")}else t+=`
|
|
36
|
+
at `+a}return t}}function Bo(s,e){e=e!==void 0?e:{};const t={},r=e.grammarSource,i={Contact:119,Name_Addr_Header:156,Record_Route:176,Request_Response:81,SIP_URI:45,Subscription_State:186,Supported:191,Require:182,Via:194,absoluteURI:84,Call_ID:118,Content_Disposition:130,Content_Length:135,Content_Type:136,CSeq:146,displayName:122,Event:149,From:151,host:52,Max_Forwards:154,Min_SE:213,Proxy_Authenticate:157,quoted_string:40,Refer_To:178,Replaces:179,Session_Expires:210,stun_URI:217,To:192,turn_URI:223,uuid:226,WWW_Authenticate:209,challenge:158,sipfrag:230,Referred_By:231};let n=119;const a=[`\r
|
|
37
|
+
`,x(`\r
|
|
38
|
+
`,!1),/^[0-9]/,p([["0","9"]],!1,!1),/^[a-zA-Z]/,p([["a","z"],["A","Z"]],!1,!1),/^[0-9a-fA-F]/,p([["0","9"],["a","f"],["A","F"]],!1,!1),/^[\0-\xFF]/,p([["\0","ÿ"]],!1,!1),/^["]/,p(['"'],!1,!1)," ",x(" ",!1)," ",x(" ",!1),/^[a-zA-Z0-9]/,p([["a","z"],["A","Z"],["0","9"]],!1,!1),";",x(";",!1),"/",x("/",!1),"?",x("?",!1),":",x(":",!1),"@",x("@",!1),"&",x("&",!1),"=",x("=",!1),"+",x("+",!1),"$",x("$",!1),",",x(",",!1),"-",x("-",!1),"_",x("_",!1),".",x(".",!1),"!",x("!",!1),"~",x("~",!1),"*",x("*",!1),"'",x("'",!1),"(",x("(",!1),")",x(")",!1),"%",x("%",!1),function(){return" "},function(){return":"},/^[!-~]/,p([["!","~"]],!1,!1),/^[\x80-\uFFFF]/,p([["",""]],!1,!1),/^[\x80-\xBF]/,p([["","¿"]],!1,!1),/^[a-f]/,p([["a","f"]],!1,!1),"`",x("`",!1),"<",x("<",!1),">",x(">",!1),"\\",x("\\",!1),"[",x("[",!1),"]",x("]",!1),"{",x("{",!1),"}",x("}",!1),function(){return"*"},function(){return"/"},function(){return"="},function(){return"("},function(){return")"},function(){return">"},function(){return"<"},function(){return","},function(){return";"},function(){return":"},function(){return'"'},/^[!-']/,p([["!","'"]],!1,!1),/^[*-[]/,p([["*","["]],!1,!1),/^[\]-~]/,p([["]","~"]],!1,!1),function(f){return f},/^[#-[]/,p([["#","["]],!1,!1),/^[\0-\t]/,p([["\0"," "]],!1,!1),/^[\v-\f]/,p([["\v","\f"]],!1,!1),/^[\x0E-\x7F]/,p([["",""]],!1,!1),function(){e=e||{data:{}},e.data.uri=new lt(e.data.scheme,e.data.user,e.data.host,e.data.port),delete e.data.scheme,delete e.data.user,delete e.data.host,delete e.data.host_type,delete e.data.port},function(){e=e||{data:{}},e.data.uri=new lt(e.data.scheme,e.data.user,e.data.host,e.data.port,e.data.uri_params,e.data.uri_headers),delete e.data.scheme,delete e.data.user,delete e.data.host,delete e.data.host_type,delete e.data.port,delete e.data.uri_params,e.startRule==="SIP_URI"&&(e.data=e.data.uri)},"sips",x("sips",!0),"sip",x("sip",!0),function(f){e=e||{data:{}},e.data.scheme=f},function(){e=e||{data:{}},e.data.user=decodeURIComponent(C().slice(0,-1))},function(){e=e||{data:{}},e.data.password=C()},function(){return e=e||{data:{}},e.data.host=C(),e.data.host},function(){return e=e||{data:{}},e.data.host_type="domain",C()},/^[a-zA-Z0-9_\-]/,p([["a","z"],["A","Z"],["0","9"],"_","-"],!1,!1),/^[a-zA-Z0-9\-]/,p([["a","z"],["A","Z"],["0","9"],"-"],!1,!1),function(){return e=e||{data:{}},e.data.host_type="IPv6",C()},"::",x("::",!1),function(){return e=e||{data:{}},e.data.host_type="IPv6",C()},function(){return e=e||{data:{}},e.data.host_type="IPv4",C()},"25",x("25",!1),/^[0-5]/,p([["0","5"]],!1,!1),"2",x("2",!1),/^[0-4]/,p([["0","4"]],!1,!1),"1",x("1",!1),/^[1-9]/,p([["1","9"]],!1,!1),function(f){return e=e||{data:{}},f=parseInt(f.join("")),e.data.port=f,f},"transport=",x("transport=",!0),"udp",x("udp",!0),"tcp",x("tcp",!0),"sctp",x("sctp",!0),"tls",x("tls",!0),function(f){e=e||{data:{}},e.data.uri_params||(e.data.uri_params={}),e.data.uri_params.transport=f.toLowerCase()},"user=",x("user=",!0),"phone",x("phone",!0),"ip",x("ip",!0),function(f){e=e||{data:{}},e.data.uri_params||(e.data.uri_params={}),e.data.uri_params.user=f.toLowerCase()},"method=",x("method=",!0),function(f){e=e||{data:{}},e.data.uri_params||(e.data.uri_params={}),e.data.uri_params.method=f},"ttl=",x("ttl=",!0),function(f){e=e||{data:{}},e.data.params||(e.data.params={}),e.data.params.ttl=f},"maddr=",x("maddr=",!0),function(f){e=e||{data:{}},e.data.uri_params||(e.data.uri_params={}),e.data.uri_params.maddr=f},"lr",x("lr",!0),function(){e=e||{data:{}},e.data.uri_params||(e.data.uri_params={}),e.data.uri_params.lr=void 0},function(f,w){e=e||{data:{}},e.data.uri_params||(e.data.uri_params={}),w===null?w=void 0:w=w[1],e.data.uri_params[f.toLowerCase()]=w},function(f,w){f=f.join("").toLowerCase(),w=w.join(""),e=e||{data:{}},e.data.uri_headers||(e.data.uri_headers={}),e.data.uri_headers[f]?e.data.uri_headers[f].push(w):e.data.uri_headers[f]=[w]},function(){e=e||{data:{}},e.startRule==="Refer_To"&&(e.data.uri=new lt(e.data.scheme,e.data.user,e.data.host,e.data.port,e.data.uri_params,e.data.uri_headers),delete e.data.scheme,delete e.data.user,delete e.data.host,delete e.data.host_type,delete e.data.port,delete e.data.uri_params)},"//",x("//",!1),function(){e=e||{data:{}},e.data.scheme=C()},x("SIP",!0),function(){e=e||{data:{}},e.data.sip_version=C()},"INVITE",x("INVITE",!1),"ACK",x("ACK",!1),"VXACH",x("VXACH",!1),"OPTIONS",x("OPTIONS",!1),"BYE",x("BYE",!1),"CANCEL",x("CANCEL",!1),"REGISTER",x("REGISTER",!1),"SUBSCRIBE",x("SUBSCRIBE",!1),"NOTIFY",x("NOTIFY",!1),"REFER",x("REFER",!1),"PUBLISH",x("PUBLISH",!1),function(){return e=e||{data:{}},e.data.method=C(),e.data.method},function(f){e=e||{data:{}},e.data.status_code=parseInt(f.join(""))},function(){e=e||{data:{}},e.data.reason_phrase=C()},function(){e=e||{data:{}},e.data=C()},function(){var f,w;for(e=e||{data:{}},w=e.data.multi_header.length,f=0;f<w;f++)if(e.data.multi_header[f].parsed===null){e.data=null;break}e.data!==null?e.data=e.data.multi_header:e.data=-1},function(){var f;e=e||{data:{}},e.data.multi_header||(e.data.multi_header=[]);try{f=new Le(e.data.uri,e.data.displayName,e.data.params),delete e.data.uri,delete e.data.displayName,delete e.data.params}catch{f=null}e.data.multi_header.push({position:d,offset:_().start.offset,parsed:f})},function(f){f=C().trim(),f[0]==='"'&&(f=f.substring(1,f.length-1)),e=e||{data:{}},e.data.displayName=f},"q",x("q",!0),function(f){e=e||{data:{}},e.data.params||(e.data.params={}),e.data.params.q=f},"expires",x("expires",!0),function(f){e=e||{data:{}},e.data.params||(e.data.params={}),e.data.params.expires=f},function(f){return parseInt(f.join(""))},"0",x("0",!1),function(){return parseFloat(C())},function(f,w){e=e||{data:{}},e.data.params||(e.data.params={}),w===null?w=void 0:w=w[1],e.data.params[f.toLowerCase()]=w},"render",x("render",!0),"session",x("session",!0),"icon",x("icon",!0),"alert",x("alert",!0),function(){e=e||{data:{}},e.startRule==="Content_Disposition"&&(e.data.type=C().toLowerCase())},"handling",x("handling",!0),"optional",x("optional",!0),"required",x("required",!0),function(f){e=e||{data:{}},e.data=parseInt(f.join(""))},function(){e=e||{data:{}},e.data=C()},"text",x("text",!0),"image",x("image",!0),"audio",x("audio",!0),"video",x("video",!0),"application",x("application",!0),"message",x("message",!0),"multipart",x("multipart",!0),"x-",x("x-",!0),function(f){e=e||{data:{}},e.data.value=parseInt(f.join(""))},function(f){e=e||{data:{}},e.data=f},function(f){e=e||{data:{}},e.data.event=f.toLowerCase()},function(){e=e||{data:{}};var f=e.data.tag;e.data=new Le(e.data.uri,e.data.displayName,e.data.params),f&&e.data.setParam("tag",f)},"tag",x("tag",!0),function(f){e=e||{data:{}},e.data.tag=f},function(f){e=e||{data:{}},e.data=parseInt(f.join(""))},function(f){e=e||{data:{}},e.data=f},function(){e=e||{data:{}},e.data=new Le(e.data.uri,e.data.displayName,e.data.params)},"digest",x("Digest",!0),"realm",x("realm",!0),function(f){e=e||{data:{}},e.data.realm=f},"domain",x("domain",!0),"nonce",x("nonce",!0),function(f){e=e||{data:{}},e.data.nonce=f},"opaque",x("opaque",!0),function(f){e=e||{data:{}},e.data.opaque=f},"stale",x("stale",!0),"true",x("true",!0),function(){e=e||{data:{}},e.data.stale=!0},"false",x("false",!0),function(){e=e||{data:{}},e.data.stale=!1},"algorithm",x("algorithm",!0),"md5",x("MD5",!0),"md5-sess",x("MD5-sess",!0),function(f){e=e||{data:{}},e.data.algorithm=f.toUpperCase()},"qop",x("qop",!0),"auth-int",x("auth-int",!0),"auth",x("auth",!0),function(f){e=e||{data:{}},e.data.qop||(e.data.qop=[]),e.data.qop.push(f.toLowerCase())},function(f){e=e||{data:{}},e.data.value=parseInt(f.join(""))},function(){var f,w;for(e=e||{data:{}},w=e.data.multi_header.length,f=0;f<w;f++)if(e.data.multi_header[f].parsed===null){e.data=null;break}e.data!==null?e.data=e.data.multi_header:e.data=-1},function(){var f;e=e||{data:{}},e.data.multi_header||(e.data.multi_header=[]);try{f=new Le(e.data.uri,e.data.displayName,e.data.params),delete e.data.uri,delete e.data.displayName,delete e.data.params}catch{f=null}e.data.multi_header.push({position:d,offset:_().start.offset,parsed:f})},function(){e=e||{data:{}},e.data=new Le(e.data.uri,e.data.displayName,e.data.params)},function(){e=e||{data:{}},e.data.replaces_from_tag&&e.data.replaces_to_tag||(e.data=-1)},function(){e=e||{data:{}},e.data={call_id:e.data}},"from-tag",x("from-tag",!0),function(f){e=e||{data:{}},e.data.replaces_from_tag=f},"to-tag",x("to-tag",!0),function(f){e=e||{data:{}},e.data.replaces_to_tag=f},"early-only",x("early-only",!0),function(){e=e||{data:{}},e.data.early_only=!0},function(f,w){return w},function(f,w){return A(f,w)},function(f){e=e||{data:{}},e.startRule==="Require"&&(e.data=f||[])},function(f){e=e||{data:{}},e.data.value=parseInt(f.join(""))},"active",x("active",!0),"pending",x("pending",!0),"terminated",x("terminated",!0),function(){e=e||{data:{}},e.data.state=C()},"reason",x("reason",!0),function(f){e=e||{data:{}},typeof f<"u"&&(e.data.reason=f)},function(f){e=e||{data:{}},typeof f<"u"&&(e.data.expires=f)},"retry_after",x("retry_after",!0),function(f){e=e||{data:{}},typeof f<"u"&&(e.data.retry_after=f)},"deactivated",x("deactivated",!0),"probation",x("probation",!0),"rejected",x("rejected",!0),"timeout",x("timeout",!0),"giveup",x("giveup",!0),"noresource",x("noresource",!0),"invariant",x("invariant",!0),function(f){e=e||{data:{}},e.startRule==="Supported"&&(e.data=f||[])},function(){e=e||{data:{}};var f=e.data.tag;e.data=new Le(e.data.uri,e.data.displayName,e.data.params),f&&e.data.setParam("tag",f)},"ttl",x("ttl",!0),function(f){e=e||{data:{}},e.data.ttl=f},"maddr",x("maddr",!0),function(f){e=e||{data:{}},e.data.maddr=f},"received",x("received",!0),function(f){e=e||{data:{}},e.data.received=f},"branch",x("branch",!0),function(f){e=e||{data:{}},e.data.branch=f},"rport",x("rport",!0),function(f){e=e||{data:{}},typeof f<"u"&&(e.data.rport=f.join(""))},function(f){e=e||{data:{}},e.data.protocol=f},x("UDP",!0),x("TCP",!0),x("TLS",!0),x("SCTP",!0),function(f){e=e||{data:{}},e.data.transport=f},function(){e=e||{data:{}},e.data.host=C()},function(f){e=e||{data:{}},e.data.port=parseInt(f.join(""))},function(f){return parseInt(f.join(""))},function(f){e=e||{data:{}},e.startRule==="Session_Expires"&&(e.data.deltaSeconds=f)},"refresher",x("refresher",!1),"uas",x("uas",!1),"uac",x("uac",!1),function(f){e=e||{data:{}},e.startRule==="Session_Expires"&&(e.data.refresher=f)},function(f){e=e||{data:{}},e.startRule==="Min_SE"&&(e.data=f)},"stuns",x("stuns",!0),"stun",x("stun",!0),function(f){e=e||{data:{}},e.data.scheme=f},function(f){e=e||{data:{}},e.data.host=f},"?transport=",x("?transport=",!1),"turns",x("turns",!0),"turn",x("turn",!0),function(f){e=e||{data:{}},e.data.transport=f},function(){e=e||{data:{}},e.data=C()},"Referred-By",x("Referred-By",!1),"b",x("b",!1),"cid",x("cid",!1)],o=[h('2 ""6 7!'),h('4"""5!7#'),h('4$""5!7%'),h(`4&""5!7'`),h(";'.# &;("),h('4(""5!7)'),h('4*""5!7+'),h('2,""6,7-'),h('2.""6.7/'),h('40""5!71'),h('22""6273. &24""6475.} &26""6677.q &28""6879.e &2:""6:7;.Y &2<""6<7=.M &2>""6>7?.A &2@""6@7A.5 &2B""6B7C.) &2D""6D7E'),h(";).# &;,"),h('2F""6F7G.} &2H""6H7I.q &2J""6J7K.e &2L""6L7M.Y &2N""6N7O.M &2P""6P7Q.A &2R""6R7S.5 &2T""6T7U.) &2V""6V7W'),h(`%%2X""6X7Y/5#;#/,$;#/#$+#)(#'#("'#&'#/"!&,)`),h(`%%$;$0#*;$&/,#; /#$+")("'#&'#." &"/=#$;$/�#*;$&&&#/'$8":Z" )("'#&'#`),h(';.." &"'),h(`%$;'.# &;(0)*;'.# &;(&/?#28""6879/0$;//'$8#:[# )(#'#("'#&'#`),h(`%%$;2/�#*;2&&&#/g#$%$;.0#*;.&/,#;2/#$+")("'#&'#0=*%$;.0#*;.&/,#;2/#$+")("'#&'#&/#$+")("'#&'#/"!&,)`),h('4\\""5!7].# &;3'),h('4^""5!7_'),h('4`""5!7a'),h(';!.) &4b""5!7c'),h('%$;). &2F""6F7G. &2J""6J7K.} &2L""6L7M.q &2X""6X7Y.e &2P""6P7Q.Y &2H""6H7I.M &2@""6@7A.A &2d""6d7e.5 &2R""6R7S.) &2N""6N7O/#0*;). &2F""6F7G. &2J""6J7K.} &2L""6L7M.q &2X""6X7Y.e &2P""6P7Q.Y &2H""6H7I.M &2@""6@7A.A &2d""6d7e.5 &2R""6R7S.) &2N""6N7O&&&#/"!&,)'),h('%$;). &2F""6F7G.} &2L""6L7M.q &2X""6X7Y.e &2P""6P7Q.Y &2H""6H7I.M &2@""6@7A.A &2d""6d7e.5 &2R""6R7S.) &2N""6N7O/#0*;). &2F""6F7G.} &2L""6L7M.q &2X""6X7Y.e &2P""6P7Q.Y &2H""6H7I.M &2@""6@7A.A &2d""6d7e.5 &2R""6R7S.) &2N""6N7O&&&#/"!&,)'),h(`2T""6T7U.ã &2V""6V7W.× &2f""6f7g.Ë &2h""6h7i.¿ &2:""6:7;.³ &2D""6D7E.§ &22""6273. &28""6879. &2j""6j7k. &;&.} &24""6475.q &2l""6l7m.e &2n""6n7o.Y &26""6677.M &2>""6>7?.A &2p""6p7q.5 &2r""6r7s.) &;'.# &;(`),h('%$;).ī &2F""6F7G.ğ &2J""6J7K.ē &2L""6L7M.ć &2X""6X7Y.û &2P""6P7Q.ï &2H""6H7I.ã &2@""6@7A.× &2d""6d7e.Ë &2R""6R7S.¿ &2N""6N7O.³ &2T""6T7U.§ &2V""6V7W. &2f""6f7g. &2h""6h7i. &28""6879.w &2j""6j7k.k &;&.e &24""6475.Y &2l""6l7m.M &2n""6n7o.A &26""6677.5 &2p""6p7q.) &2r""6r7s/Ĵ#0ı*;).ī &2F""6F7G.ğ &2J""6J7K.ē &2L""6L7M.ć &2X""6X7Y.û &2P""6P7Q.ï &2H""6H7I.ã &2@""6@7A.× &2d""6d7e.Ë &2R""6R7S.¿ &2N""6N7O.³ &2T""6T7U.§ &2V""6V7W. &2f""6f7g. &2h""6h7i. &28""6879.w &2j""6j7k.k &;&.e &24""6475.Y &2l""6l7m.M &2n""6n7o.A &26""6677.5 &2p""6p7q.) &2r""6r7s&&&#/"!&,)'),h(`%;//?#2P""6P7Q/0$;//'$8#:t# )(#'#("'#&'#`),h(`%;//?#24""6475/0$;//'$8#:u# )(#'#("'#&'#`),h(`%;//?#2>""6>7?/0$;//'$8#:v# )(#'#("'#&'#`),h(`%;//?#2T""6T7U/0$;//'$8#:w# )(#'#("'#&'#`),h(`%;//?#2V""6V7W/0$;//'$8#:x# )(#'#("'#&'#`),h(`%2h""6h7i/0#;//'$8":y" )("'#&'#`),h(`%;//6#2f""6f7g/'$8":z" )("'#&'#`),h(`%;//?#2D""6D7E/0$;//'$8#:{# )(#'#("'#&'#`),h(`%;//?#22""6273/0$;//'$8#:|# )(#'#("'#&'#`),h(`%;//?#28""6879/0$;//'$8#:}# )(#'#("'#&'#`),h(`%;//0#;&/'$8":~" )("'#&'#`),h(`%;&/0#;//'$8":~" )("'#&'#`),h(`%;=/T#$;G.) &;K.# &;F0/*;G.) &;K.# &;F&/,$;>/#$+#)(#'#("'#&'#`),h('4""5!7.A &4""5!7.5 &4""5!7.) &;3.# &;.'),h(`%%;//Q#;&/H$$;J.# &;K0)*;J.# &;K&/,$;&/#$+$)($'#(#'#("'#&'#/"!&,)`),h(`%;//]#;&/T$%$;J.# &;K0)*;J.# &;K&/"!&,)/1$;&/($8$:
$!!)($'#(#'#("'#&'#`),h(';..G &2L""6L7M.; &4""5!7./ &4""5!7.# &;3'),h(`%2j""6j7k/J#4""5!7.5 &4""5!7.) &4""5!7/#$+")("'#&'#`),h(`%;N/M#28""6879/>$;O." &"/0$;S/'$8$:$ )($'#(#'#("'#&'#`),h(`%;N/d#28""6879/U$;O." &"/G$;S/>$;_/5$;l." &"/'$8&:& )(&'#(%'#($'#(#'#("'#&'#`),h(`%3""5$7.) &3""5#7/' 8!:!! )`),h(`%;P/]#%28""6879/,#;R/#$+")("'#&'#." &"/6$2:""6:7;/'$8#:# )(#'#("'#&'#`),h("$;+.) &;-.# &;Q/2#0/*;+.) &;-.# &;Q&&&#"),h('2<""6<7=.q &2>""6>7?.e &2@""6@7A.Y &2B""6B7C.M &2D""6D7E.A &22""6273.5 &26""6677.) &24""6475'),h('%$;+._ &;-.Y &2<""6<7=.M &2>""6>7?.A &2@""6@7A.5 &2B""6B7C.) &2D""6D7E0e*;+._ &;-.Y &2<""6<7=.M &2>""6>7?.A &2@""6@7A.5 &2B""6B7C.) &2D""6D7E&/& 8!:! )'),h(`%;T/J#%28""6879/,#;^/#$+")("'#&'#." &"/#$+")("'#&'#`),h("%;U.) &;\\.# &;X/& 8!:! )"),h(`%$%;V/2#2J""6J7K/#$+")("'#&'#0<*%;V/2#2J""6J7K/#$+")("'#&'#&/D#;W/;$2J""6J7K." &"/'$8#:# )(#'#("'#&'#`),h('$4""5!7/,#0)*4""5!7&&&#'),h(`%4$""5!7%/?#$4""5!70)*4""5!7&/#$+")("'#&'#`),h(`%2l""6l7m/?#;Y/6$2n""6n7o/'$8#:# )(#'#("'#&'#`),h(`%%;Z/³#28""6879/¤$;Z/$28""6879/$;Z/$28""6879/t$;Z/k$28""6879/\\$;Z/S$28""6879/D$;Z/;$28""6879/,$;[/#$+-)(-'#(,'#(+'#(*'#()'#(('#(''#(&'#(%'#($'#(#'#("'#&'#.ސ &%2""67/¤#;Z/$28""6879/$;Z/$28""6879/t$;Z/k$28""6879/\\$;Z/S$28""6879/D$;Z/;$28""6879/,$;[/#$+,)(,'#(+'#(*'#()'#(('#(''#(&'#(%'#($'#(#'#("'#&'#.۹ &%2""67/#;Z/$28""6879/t$;Z/k$28""6879/\\$;Z/S$28""6879/D$;Z/;$28""6879/,$;[/#$+*)(*'#()'#(('#(''#(&'#(%'#($'#(#'#("'#&'#.ٺ &%2""67/t#;Z/k$28""6879/\\$;Z/S$28""6879/D$;Z/;$28""6879/,$;[/#$+()(('#(''#(&'#(%'#($'#(#'#("'#&'#.ؓ &%2""67/\\#;Z/S$28""6879/D$;Z/;$28""6879/,$;[/#$+&)(&'#(%'#($'#(#'#("'#&'#.ׄ &%2""67/D#;Z/;$28""6879/,$;[/#$+$)($'#(#'#("'#&'#.֍ &%2""67/,#;[/#$+")("'#&'#.ծ &%2""67/,#;Z/#$+")("'#&'#.Տ &%;Z/#2""67/$;Z/$28""6879/t$;Z/k$28""6879/\\$;Z/S$28""6879/D$;Z/;$28""6879/,$;[/#$++)(+'#(*'#()'#(('#(''#(&'#(%'#($'#(#'#("'#&'#.Ӈ &%;Z/ª#%28""6879/,#;Z/#$+")("'#&'#." &"/$2""67/t$;Z/k$28""6879/\\$;Z/S$28""6879/D$;Z/;$28""6879/,$;[/#$+*)(*'#()'#(('#(''#(&'#(%'#($'#(#'#("'#&'#.а &%;Z/¹#%28""6879/,#;Z/#$+")("'#&'#." &"/$%28""6879/,#;Z/#$+")("'#&'#." &"/k$2""67/\\$;Z/S$28""6879/D$;Z/;$28""6879/,$;[/#$+))()'#(('#(''#(&'#(%'#($'#(#'#("'#&'#.Ί &%;Z/È#%28""6879/,#;Z/#$+")("'#&'#." &"/¡$%28""6879/,#;Z/#$+")("'#&'#." &"/z$%28""6879/,#;Z/#$+")("'#&'#." &"/S$2""67/D$;Z/;$28""6879/,$;[/#$+()(('#(''#(&'#(%'#($'#(#'#("'#&'#.˕ &%;Z/×#%28""6879/,#;Z/#$+")("'#&'#." &"/°$%28""6879/,#;Z/#$+")("'#&'#." &"/$%28""6879/,#;Z/#$+")("'#&'#." &"/b$%28""6879/,#;Z/#$+")("'#&'#." &"/;$2""67/,$;[/#$+')(''#(&'#(%'#($'#(#'#("'#&'#.ȑ &%;Z/þ#%28""6879/,#;Z/#$+")("'#&'#." &"/×$%28""6879/,#;Z/#$+")("'#&'#." &"/°$%28""6879/,#;Z/#$+")("'#&'#." &"/$%28""6879/,#;Z/#$+")("'#&'#." &"/b$%28""6879/,#;Z/#$+")("'#&'#." &"/;$2""67/,$;Z/#$+()(('#(''#(&'#(%'#($'#(#'#("'#&'#.Ħ &%;Z/Ĝ#%28""6879/,#;Z/#$+")("'#&'#." &"/õ$%28""6879/,#;Z/#$+")("'#&'#." &"/Î$%28""6879/,#;Z/#$+")("'#&'#." &"/§$%28""6879/,#;Z/#$+")("'#&'#." &"/$%28""6879/,#;Z/#$+")("'#&'#." &"/Y$%28""6879/,#;Z/#$+")("'#&'#." &"/2$2""67/#$+()(('#(''#(&'#(%'#($'#(#'#("'#&'#/& 8!: ! )`),h(`%;#/M#;#." &"/?$;#." &"/1$;#." &"/#$+$)($'#(#'#("'#&'#`),h(`%;Z/;#28""6879/,$;Z/#$+#)(#'#("'#&'#.# &;\\`),h(`%;]/o#2J""6J7K/\`$;]/W$2J""6J7K/H$;]/?$2J""6J7K/0$;]/'$8':¡' )(''#(&'#(%'#($'#(#'#("'#&'#`),h(`%2¢""6¢7£/2#4¤""5!7¥/#$+")("'#&'#. &%2¦""6¦7§/;#4¨""5!7©/,$;!/#$+#)(#'#("'#&'#.j &%2ª""6ª7«/5#;!/,$;!/#$+#)(#'#("'#&'#.B &%4¬""5!7/,#;!/#$+")("'#&'#.# &;!`),h(`%%;!." &"/[#;!." &"/M$;!." &"/?$;!." &"/1$;!." &"/#$+%)(%'#($'#(#'#("'#&'#/' 8!:®!! )`),h(`$%22""6273/,#;\`/#$+")("'#&'#0<*%22""6273/,#;\`/#$+")("'#&'#&`),h(";a.A &;b.; &;c.5 &;d./ &;e.) &;f.# &;g"),h(`%3¯""5*7°/a#3±""5#7².G &3³""5#7´.; &3µ""5$7¶./ &3·""5#7¸.# &;6/($8":¹"! )("'#&'#`),h(`%3º""5%7»/I#3¼""5%7½./ &3¾""5"7¿.# &;6/($8":À"! )("'#&'#`),h(`%3Á""5'7Â/1#;/($8":Ã"! )("'#&'#`),h(`%3Ä""5$7Å/1#;ð/($8":Æ"! )("'#&'#`),h(`%3Ç""5&7È/1#;T/($8":É"! )("'#&'#`),h(`%3Ê""5"7Ë/N#%2>""6>7?/,#;6/#$+")("'#&'#." &"/'$8":Ì" )("'#&'#`),h(`%;h/P#%2>""6>7?/,#;i/#$+")("'#&'#." &"/)$8":Í""! )("'#&'#`),h('%$;j/�#*;j&&&#/"!&,)'),h('%$;j/�#*;j&&&#/"!&,)'),h(";k.) &;+.# &;-"),h('2l""6l7m.e &2n""6n7o.Y &24""6475.M &28""6879.A &2<""6<7=.5 &2@""6@7A.) &2B""6B7C'),h(`%26""6677/n#;m/e$$%2<""6<7=/,#;m/#$+")("'#&'#0<*%2<""6<7=/,#;m/#$+")("'#&'#&/#$+#)(#'#("'#&'#`),h(`%;n/A#2>""6>7?/2$;o/)$8#:Î#"" )(#'#("'#&'#`),h("$;p.) &;+.# &;-/2#0/*;p.) &;+.# &;-&&&#"),h("$;p.) &;+.# &;-0/*;p.) &;+.# &;-&"),h('2l""6l7m.e &2n""6n7o.Y &24""6475.M &26""6677.A &28""6879.5 &2@""6@7A.) &2B""6B7C'),h(";.# &;r"),h(`%;/G#;'/>$;s/5$;'/,$;/#$+%)(%'#($'#(#'#("'#&'#`),h(";M.# &;t"),h(`%;/E#28""6879/6$;u.# &;x/'$8#:Ï# )(#'#("'#&'#`),h(`%;v.# &;w/J#%26""6677/,#;/#$+")("'#&'#." &"/#$+")("'#&'#`),h(`%2Ð""6Ð7Ñ/:#;/1$;w." &"/#$+#)(#'#("'#&'#`),h(`%24""6475/,#;{/#$+")("'#&'#`),h(`%;z/3#$;y0#*;y&/#$+")("'#&'#`),h(";*.) &;+.# &;-"),h(';+. &;-. &22""6273.} &26""6677.q &28""6879.e &2:""6:7;.Y &2<""6<7=.M &2>""6>7?.A &2@""6@7A.5 &2B""6B7C.) &2D""6D7E'),h(`%;|/e#$%24""6475/,#;|/#$+")("'#&'#0<*%24""6475/,#;|/#$+")("'#&'#&/#$+")("'#&'#`),h(`%$;~0#*;~&/e#$%22""6273/,#;}/#$+")("'#&'#0<*%22""6273/,#;}/#$+")("'#&'#&/#$+")("'#&'#`),h("$;~0#*;~&"),h(';+.w &;-.q &28""6879.e &2:""6:7;.Y &2<""6<7=.M &2>""6>7?.A &2@""6@7A.5 &2B""6B7C.) &2D""6D7E'),h(`%%;"/#$;".G &;!.A &2@""6@7A.5 &2F""6F7G.) &2J""6J7K0M*;".G &;!.A &2@""6@7A.5 &2F""6F7G.) &2J""6J7K&/#$+")("'#&'#/& 8!:Ò! )`),h(";.# &;"),h(`%%;O/2#2:""6:7;/#$+")("'#&'#." &"/,#;S/#$+")("'#&'#." &"`),h('$;+. &;-.} &2B""6B7C.q &2D""6D7E.e &22""6273.Y &28""6879.M &2:""6:7;.A &2<""6<7=.5 &2>""6>7?.) &2@""6@7A/#0*;+. &;-.} &2B""6B7C.q &2D""6D7E.e &22""6273.Y &28""6879.M &2:""6:7;.A &2<""6<7=.5 &2>""6>7?.) &2@""6@7A&&&#'),h("$;y0#*;y&"),h(`%3""5#7Ó/q#24""6475/b$$;!/�#*;!&&&#/L$2J""6J7K/=$$;!/�#*;!&&&#/'$8%:Ô% )(%'#($'#(#'#("'#&'#`),h('2Õ""6Õ7Ö'),h('2×""6×7Ø'),h('2Ù""6Ù7Ú'),h('2Û""6Û7Ü'),h('2Ý""6Ý7Þ'),h('2ß""6ß7à'),h('2á""6á7â'),h('2ã""6ã7ä'),h('2å""6å7æ'),h('2ç""6ç7è'),h('2é""6é7ê'),h("%;
.Y &;.S &;.M &;.G &;.A &;.; &;.5 &;./ &;.) &;.# &;6/& 8!:ë! )"),h(`%;/G#;'/>$;/5$;'/,$;/#$+%)(%'#($'#(#'#("'#&'#`),h("%;/' 8!:ì!! )"),h(`%;!/5#;!/,$;!/#$+#)(#'#("'#&'#`),h("%$;*.A &;+.; &;-.5 &;3./ &;4.) &;'.# &;(0G*;*.A &;+.; &;-.5 &;3./ &;4.) &;'.# &;(&/& 8!:í! )"),h(`%;¶/Y#$%;A/,#;¶/#$+")("'#&'#06*%;A/,#;¶/#$+")("'#&'#&/#$+")("'#&'#`),h(`%;9/N#%2:""6:7;/,#;9/#$+")("'#&'#." &"/'$8":î" )("'#&'#`),h(`%;:.c &%;/Y#$%;A/,#;/#$+")("'#&'#06*%;A/,#;/#$+")("'#&'#&/#$+")("'#&'#/& 8!:ï! )`),h(`%;L.# &;/]#$%;B/,#;/#$+")("'#&'#06*%;B/,#;/#$+")("'#&'#&/'$8":ð" )("'#&'#`),h(`%;." &"/>#;@/5$;M/,$;?/#$+$)($'#(#'#("'#&'#`),h(`%%;6/Y#$%;./,#;6/#$+")("'#&'#06*%;./,#;6/#$+")("'#&'#&/#$+")("'#&'#.# &;H/' 8!:ñ!! )`),h(";.) &;.# &; "),h(`%3ò""5!7ó/:#;</1$;/($8#:ô#! )(#'#("'#&'#`),h(`%3õ""5'7ö/:#;</1$;/($8#:÷#! )(#'#("'#&'#`),h("%$;!/�#*;!&&&#/' 8!:ø!! )"),h(`%2ù""6ù7ú/o#%2J""6J7K/M#;!." &"/?$;!." &"/1$;!." &"/#$+$)($'#(#'#("'#&'#." &"/'$8":û" )("'#&'#`),h(`%;6/J#%;</,#;¡/#$+")("'#&'#." &"/)$8":ü""! )("'#&'#`),h(";6.) &;T.# &;H"),h(`%;£/Y#$%;B/,#;¤/#$+")("'#&'#06*%;B/,#;¤/#$+")("'#&'#&/#$+")("'#&'#`),h(`%3ý""5&7þ.G &3ÿ""5'7Ā.; &3ā""5$7Ă./ &3ă""5%7Ą.# &;6/& 8!:ą! )`),h(";¥.# &; "),h(`%3Ć""5(7ć/M#;</D$3Ĉ""5(7ĉ./ &3Ċ""5(7ċ.# &;6/#$+#)(#'#("'#&'#`),h(`%;6/Y#$%;A/,#;6/#$+")("'#&'#06*%;A/,#;6/#$+")("'#&'#&/#$+")("'#&'#`),h("%$;!/�#*;!&&&#/' 8!:Č!! )"),h("%;©/& 8!:č! )"),h(`%;ª/k#;;/b$;¯/Y$$%;B/,#;°/#$+")("'#&'#06*%;B/,#;°/#$+")("'#&'#&/#$+$)($'#(#'#("'#&'#`),h(";«.# &;¬"),h('3Ď""5$7ď.S &3Đ""5%7đ.G &3Ē""5%7ē.; &3Ĕ""5%7ĕ./ &3Ė""5+7ė.# &;'),h(`3Ę""5'7ę./ &3Ě""5)7ě.# &;`),h(";6.# &;®"),h(`%3Ĝ""5"7ĝ/,#;6/#$+")("'#&'#`),h(";.# &;6"),h(`%;6/5#;</,$;±/#$+#)(#'#("'#&'#`),h(";6.# &;H"),h(`%;³/5#;./,$;/#$+#)(#'#("'#&'#`),h("%$;!/�#*;!&&&#/' 8!:Ğ!! )"),h("%;/' 8!:ğ!! )"),h(`%;¶/^#$%;B/,#; /#$+")("'#&'#06*%;B/,#; /#$+")("'#&'#&/($8":Ġ"!!)("'#&'#`),h(`%%;7/e#$%2J""6J7K/,#;7/#$+")("'#&'#0<*%2J""6J7K/,#;7/#$+")("'#&'#&/#$+")("'#&'#/"!&,)`),h(`%;L.# &;/]#$%;B/,#;¸/#$+")("'#&'#06*%;B/,#;¸/#$+")("'#&'#&/'$8":ġ" )("'#&'#`),h(";¹.# &; "),h(`%3Ģ""5#7ģ/:#;</1$;6/($8#:Ĥ#! )(#'#("'#&'#`),h("%$;!/�#*;!&&&#/' 8!:ĥ!! )"),h("%;/' 8!:Ħ!! )"),h(`%$;0#*;&/x#;@/o$;M/f$;?/]$$%;B/,#; /#$+")("'#&'#06*%;B/,#; /#$+")("'#&'#&/'$8%:ħ% )(%'#($'#(#'#("'#&'#`),h(";¾"),h(`%3Ĩ""5&7ĩ/k#;./b$;Á/Y$$%;A/,#;Á/#$+")("'#&'#06*%;A/,#;Á/#$+")("'#&'#&/#$+$)($'#(#'#("'#&'#.# &;¿`),h(`%;6/k#;./b$;À/Y$$%;A/,#;À/#$+")("'#&'#06*%;A/,#;À/#$+")("'#&'#&/#$+$)($'#(#'#("'#&'#`),h(`%;6/;#;</2$;6.# &;H/#$+#)(#'#("'#&'#`),h(";Â.G &;Ä.A &;Æ.; &;È.5 &;É./ &;Ê.) &;Ë.# &;À"),h(`%3Ī""5%7ī/5#;</,$;Ã/#$+#)(#'#("'#&'#`),h("%;I/' 8!:Ĭ!! )"),h(`%3ĭ""5&7Į/#;</$;D/
$;Å/|$$%$;'/�#*;'&&&#/,#;Å/#$+")("'#&'#0C*%$;'/�#*;'&&&#/,#;Å/#$+")("'#&'#&/,$;E/#$+&)(&'#(%'#($'#(#'#("'#&'#`),h(";t.# &;w"),h(`%3į""5%7İ/5#;</,$;Ç/#$+#)(#'#("'#&'#`),h("%;I/' 8!:ı!! )"),h(`%3IJ""5&7ij/:#;</1$;I/($8#:Ĵ#! )(#'#("'#&'#`),h(`%3ĵ""5%7Ķ/]#;</T$%3ķ""5$7ĸ/& 8!:Ĺ! ).4 &%3ĺ""5%7Ļ/& 8!:ļ! )/#$+#)(#'#("'#&'#`),h(`%3Ľ""5)7ľ/R#;</I$3Ŀ""5#7ŀ./ &3Ł""5(7ł.# &;6/($8#:Ń#! )(#'#("'#&'#`),h(`%3ń""5#7Ņ/#;</$;D/$%;Ì/e#$%2D""6D7E/,#;Ì/#$+")("'#&'#0<*%2D""6D7E/,#;Ì/#$+")("'#&'#&/#$+")("'#&'#/,$;E/#$+%)(%'#($'#(#'#("'#&'#`),h(`%3ņ""5(7Ň./ &3ň""5$7ʼn.# &;6/' 8!:Ŋ!! )`),h(`%;6/Y#$%;A/,#;6/#$+")("'#&'#06*%;A/,#;6/#$+")("'#&'#&/#$+")("'#&'#`),h(`%;Ï/G#;./>$;Ï/5$;./,$;/#$+%)(%'#($'#(#'#("'#&'#`),h("%$;!/�#*;!&&&#/' 8!:ŋ!! )"),h(`%;Ñ/]#$%;A/,#;Ñ/#$+")("'#&'#06*%;A/,#;Ñ/#$+")("'#&'#&/'$8":Ō" )("'#&'#`),h(`%;/]#$%;B/,#; /#$+")("'#&'#06*%;B/,#; /#$+")("'#&'#&/'$8":ō" )("'#&'#`),h(`%;L.O &;.I &%;@." &"/:#;t/1$;?." &"/#$+#)(#'#("'#&'#/]#$%;B/,#; /#$+")("'#&'#06*%;B/,#; /#$+")("'#&'#&/'$8":Ŏ" )("'#&'#`),h(`%;Ô/]#$%;B/,#;Õ/#$+")("'#&'#06*%;B/,#;Õ/#$+")("'#&'#&/'$8":ŏ" )("'#&'#`),h("%;/& 8!:Ő! )"),h(`%3ő""5(7Œ/:#;</1$;6/($8#:œ#! )(#'#("'#&'#.g &%3Ŕ""5&7ŕ/:#;</1$;6/($8#:Ŗ#! )(#'#("'#&'#.: &%3ŗ""5*7Ř/& 8!:ř! ).# &; `),h(`%%;6/k#$%;A/2#;6/)$8":Ś""$ )("'#&'#0<*%;A/2#;6/)$8":Ś""$ )("'#&'#&/)$8":ś""! )("'#&'#." &"/' 8!:Ŝ!! )`),h(`%;Ø/Y#$%;A/,#;Ø/#$+")("'#&'#06*%;A/,#;Ø/#$+")("'#&'#&/#$+")("'#&'#`),h(`%;/Y#$%;B/,#; /#$+")("'#&'#06*%;B/,#; /#$+")("'#&'#&/#$+")("'#&'#`),h("%$;!/�#*;!&&&#/' 8!:ŝ!! )"),h(`%;Û/Y#$%;B/,#;Ü/#$+")("'#&'#06*%;B/,#;Ü/#$+")("'#&'#&/#$+")("'#&'#`),h(`%3Ş""5&7ş.; &3Š""5'7š./ &3Ţ""5*7ţ.# &;6/& 8!:Ť! )`),h(`%3ť""5&7Ŧ/:#;</1$;Ý/($8#:ŧ#! )(#'#("'#&'#.} &%3õ""5'7ö/:#;</1$;/($8#:Ũ#! )(#'#("'#&'#.P &%3ũ""5+7Ū/:#;</1$;/($8#:ū#! )(#'#("'#&'#.# &; `),h(`3Ŭ""5+7ŭ.k &3Ů""5)7ů._ &3Ű""5(7ű.S &3Ų""5'7ų.G &3Ŵ""5&7ŵ.; &3Ŷ""5*7ŷ./ &3Ÿ""5)7Ź.# &;6`),h(';1." &"'),h(`%%;6/k#$%;A/2#;6/)$8":Ś""$ )("'#&'#0<*%;A/2#;6/)$8":Ś""$ )("'#&'#&/)$8":ś""! )("'#&'#." &"/' 8!:ź!! )`),h(`%;L.# &;/]#$%;B/,#;á/#$+")("'#&'#06*%;B/,#;á/#$+")("'#&'#&/'$8":Ż" )("'#&'#`),h(";¹.# &; "),h(`%;ã/Y#$%;A/,#;ã/#$+")("'#&'#06*%;A/,#;ã/#$+")("'#&'#&/#$+")("'#&'#`),h(`%;ê/k#;./b$;í/Y$$%;B/,#;ä/#$+")("'#&'#06*%;B/,#;ä/#$+")("'#&'#&/#$+$)($'#(#'#("'#&'#`),h(";å.; &;æ.5 &;ç./ &;è.) &;é.# &; "),h(`%3ż""5#7Ž/:#;</1$;ð/($8#:ž#! )(#'#("'#&'#`),h(`%3ſ""5%7ƀ/:#;</1$;T/($8#:Ɓ#! )(#'#("'#&'#`),h(`%3Ƃ""5(7ƃ/F#;</=$;\\.) &;Y.# &;X/($8#:Ƅ#! )(#'#("'#&'#`),h(`%3ƅ""5&7Ɔ/:#;</1$;6/($8#:Ƈ#! )(#'#("'#&'#`),h(`%3ƈ""5%7Ɖ/A#;</8$$;!0#*;!&/($8#:Ɗ#! )(#'#("'#&'#`),h(`%;ë/G#;;/>$;6/5$;;/,$;ì/#$+%)(%'#($'#(#'#("'#&'#`),h(`%3""5#7Ó.# &;6/' 8!:Ƌ!! )`),h(`%3±""5#7ƌ.G &3³""5#7ƍ.; &3·""5#7Ǝ./ &3µ""5$7Ə.# &;6/' 8!:Ɛ!! )`),h(`%;î/D#%;C/,#;ï/#$+")("'#&'#." &"/#$+")("'#&'#`),h("%;U.) &;\\.# &;X/& 8!:Ƒ! )"),h(`%%;!." &"/[#;!." &"/M$;!." &"/?$;!." &"/1$;!." &"/#$+%)(%'#($'#(#'#("'#&'#/' 8!:ƒ!! )`),h(`%%;!/?#;!." &"/1$;!." &"/#$+#)(#'#("'#&'#/' 8!:Ɠ!! )`),h(";¾"),h(`%;/^#$%;B/,#;ó/#$+")("'#&'#06*%;B/,#;ó/#$+")("'#&'#&/($8":Ɣ"!!)("'#&'#`),h(";ô.# &; "),h(`%2ƕ""6ƕ7Ɩ/L#;</C$2Ɨ""6Ɨ7Ƙ.) &2ƙ""6ƙ7ƚ/($8#:ƛ#! )(#'#("'#&'#`),h(`%;/^#$%;B/,#; /#$+")("'#&'#06*%;B/,#; /#$+")("'#&'#&/($8":Ɯ"!!)("'#&'#`),h(`%;6/5#;0/,$;÷/#$+#)(#'#("'#&'#`),h("$;2.) &;4.# &;.0/*;2.) &;4.# &;.&"),h("$;%0#*;%&"),h(`%;ú/;#28""6879/,$;û/#$+#)(#'#("'#&'#`),h(`%3Ɲ""5%7ƞ.) &3Ɵ""5$7Ơ/' 8!:ơ!! )`),h(`%;ü/J#%28""6879/,#;^/#$+")("'#&'#." &"/#$+")("'#&'#`),h("%;\\.) &;X.# &;/' 8!:Ƣ!! )"),h(';".S &;!.M &2F""6F7G.A &2J""6J7K.5 &2H""6H7I.) &2N""6N7O'),h('2L""6L7M. &2B""6B7C. &2<""6<7=.} &2R""6R7S.q &2T""6T7U.e &2V""6V7W.Y &2P""6P7Q.M &2@""6@7A.A &2D""6D7E.5 &22""6273.) &2>""6>7?'),h(`%;Ā/b#28""6879/S$;û/J$%2ƣ""6ƣ7Ƥ/,#;ì/#$+")("'#&'#." &"/#$+$)($'#(#'#("'#&'#`),h(`%3ƥ""5%7Ʀ.) &3Ƨ""5$7ƨ/' 8!:ơ!! )`),h(`%3±""5#7².6 &3³""5#7´.* &$;+0#*;+&/' 8!:Ʃ!! )`),h(`%;Ą/#2F""6F7G/x$;ă/o$2F""6F7G/\`$;ă/W$2F""6F7G/H$;ă/?$2F""6F7G/0$;ą/'$8):ƪ) )()'#(('#(''#(&'#(%'#($'#(#'#("'#&'#`),h(`%;#/>#;#/5$;#/,$;#/#$+$)($'#(#'#("'#&'#`),h(`%;ă/,#;ă/#$+")("'#&'#`),h(`%;ă/5#;ă/,$;ă/#$+#)(#'#("'#&'#`),h(`%;q/T#$;m0#*;m&/D$%; /,#;ø/#$+")("'#&'#." &"/#$+#)(#'#("'#&'#`),h(`%2ƫ""6ƫ7Ƭ.) &2ƭ""6ƭ7Ʈ/w#;0/n$;Ĉ/e$$%;B/2#;ĉ.# &; /#$+")("'#&'#0<*%;B/2#;ĉ.# &; /#$+")("'#&'#&/#$+$)($'#(#'#("'#&'#`),h(";.# &;L"),h(`%2Ư""6Ư7ư/5#;</,$;Ċ/#$+#)(#'#("'#&'#`),h(`%;D/S#;,/J$2:""6:7;/;$;,.# &;T/,$;E/#$+%)(%'#($'#(#'#("'#&'#`)];let d=0,c=0;const l=[{line:1,column:1}];let g=0,u=[],y=0,v;if(e.startRule!==void 0){if(!(e.startRule in i))throw new Error(`Can't start parsing from rule "`+e.startRule+'".');n=i[e.startRule]}function C(){return s.substring(c,d)}function _(){return S(c,d)}function x(f,w){return{type:"literal",text:f,ignoreCase:w}}function p(f,w,m){return{type:"class",parts:f,inverted:w,ignoreCase:m}}function E(){return{type:"end"}}function b(f){let w=l[f],m;if(w)return w;for(m=f-1;!l[m];)m--;for(w=l[m],w={line:w.line,column:w.column};m<f;)s.charCodeAt(m)===10?(w.line++,w.column=1):w.column++,m++;return l[f]=w,w}function S(f,w){const m=b(f),q=b(w);return{source:r,start:{offset:f,line:m.line,column:m.column},end:{offset:w,line:q.line,column:q.column}}}function T(f){d<g||(d>g&&(g=d,u=[]),u.push(f))}function F(f,w,m){return new ur(ur.buildMessage(f,w),f,w,m)}function h(f){return f.split("").map(w=>w.charCodeAt(0)-32)}function M(f){const w=o[f];let m=0;const q=[];let N=w.length;const z=[],V=[];let ie;for(;;){for(;m<N;)switch(w[m]){case 0:V.push(a[w[m+1]]),m+=2;break;case 1:V.push(void 0),m++;break;case 2:V.push(null),m++;break;case 3:V.push(t),m++;break;case 4:V.push([]),m++;break;case 5:V.push(d),m++;break;case 6:V.pop(),m++;break;case 7:d=V.pop(),m++;break;case 8:V.length-=w[m+1],m+=2;break;case 9:V.splice(-2,1),m++;break;case 10:V[V.length-2].push(V.pop()),m++;break;case 11:V.push(V.splice(V.length-w[m+1],w[m+1])),m+=2;break;case 12:V.push(s.substring(V.pop(),d)),m++;break;case 13:z.push(N),q.push(m+3+w[m+1]+w[m+2]),V[V.length-1]?(N=m+3+w[m+1],m+=3):(N=m+3+w[m+1]+w[m+2],m+=3+w[m+1]);break;case 14:z.push(N),q.push(m+3+w[m+1]+w[m+2]),V[V.length-1]===t?(N=m+3+w[m+1],m+=3):(N=m+3+w[m+1]+w[m+2],m+=3+w[m+1]);break;case 15:z.push(N),q.push(m+3+w[m+1]+w[m+2]),V[V.length-1]!==t?(N=m+3+w[m+1],m+=3):(N=m+3+w[m+1]+w[m+2],m+=3+w[m+1]);break;case 16:V[V.length-1]!==t?(z.push(N),q.push(m),N=m+2+w[m+1],m+=2):m+=2+w[m+1];break;case 17:z.push(N),q.push(m+3+w[m+1]+w[m+2]),s.length>d?(N=m+3+w[m+1],m+=3):(N=m+3+w[m+1]+w[m+2],m+=3+w[m+1]);break;case 18:z.push(N),q.push(m+4+w[m+2]+w[m+3]),s.substr(d,a[w[m+1]].length)===a[w[m+1]]?(N=m+4+w[m+2],m+=4):(N=m+4+w[m+2]+w[m+3],m+=4+w[m+2]);break;case 19:z.push(N),q.push(m+4+w[m+2]+w[m+3]),s.substr(d,a[w[m+1]].length).toLowerCase()===a[w[m+1]]?(N=m+4+w[m+2],m+=4):(N=m+4+w[m+2]+w[m+3],m+=4+w[m+2]);break;case 20:z.push(N),q.push(m+4+w[m+2]+w[m+3]),a[w[m+1]].test(s.charAt(d))?(N=m+4+w[m+2],m+=4):(N=m+4+w[m+2]+w[m+3],m+=4+w[m+2]);break;case 21:V.push(s.substr(d,w[m+1])),d+=w[m+1],m+=2;break;case 22:V.push(a[w[m+1]]),d+=a[w[m+1]].length,m+=2;break;case 23:V.push(t),y===0&&T(a[w[m+1]]),m+=2;break;case 24:c=V[V.length-1-w[m+1]],m+=2;break;case 25:c=d,m++;break;case 26:ie=w.slice(m+4,m+4+w[m+3]).map(function(he){return V[V.length-1-he]}),V.splice(V.length-w[m+2],w[m+2],a[w[m+1]].apply(null,ie)),m+=4+w[m+3];break;case 27:V.push(M(w[m+1])),m+=2;break;case 28:y++,m++;break;case 29:y--,m++;break;default:throw new Error("Invalid opcode: "+w[m]+".")}if(z.length>0)N=z.pop(),m=q.pop();else break}return V[0]}e.data={};function A(f,w){return[f].concat(w)}if(v=M(n),v!==t&&d===s.length)return v;throw v!==t&&d<s.length&&T(E()),F(u,g<s.length?s.charAt(g):null,g<s.length?S(g,g+1):S(g,g))}const ko=Bo;var Ae;(function(s){function e(i,n){const a={startRule:n};try{ko(i,a)}catch{a.data=-1}return a.data}s.parse=e;function t(i){const n=s.parse(i,"Name_Addr_Header");return n!==-1?n:void 0}s.nameAddrHeaderParse=t;function r(i){const n=s.parse(i,"SIP_URI");return n!==-1?n:void 0}s.URIParse=r})(Ae=Ae||(Ae={}));const Io={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",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:"Internal Server 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"};function Jt(s,e=32){let t="";for(let r=0;r<s;r++){const i=Math.floor(Math.random()*e);t+=i.toString(e)}return t}function Qr(s){return Io[s]||""}function es(){return Jt(10)}function ht(s){const e={"Call-Id":"Call-ID",Cseq:"CSeq","Min-Se":"Min-SE",Rack:"RAck",Rseq:"RSeq","Www-Authenticate":"WWW-Authenticate"},t=s.toLowerCase().replace(/_/g,"-").split("-"),r=t.length;let i="";for(let n=0;n<r;n++)n!==0&&(i+="-"),i+=t[n].charAt(0).toUpperCase()+t[n].substring(1);return e[i]&&(i=e[i]),i}function Ir(s){return encodeURIComponent(s).replace(/%[A-F\d]{2}/g,"U").length}class _n{constructor(){this.headers={}}addHeader(e,t){const r={raw:t};e=ht(e),this.headers[e]?this.headers[e].push(r):this.headers[e]=[r]}getHeader(e){const t=this.headers[ht(e)];if(t){if(t[0])return t[0].raw}else return}getHeaders(e){const t=this.headers[ht(e)],r=[];if(!t)return[];for(const i of t)r.push(i.raw);return r}hasHeader(e){return!!this.headers[ht(e)]}parseHeader(e,t=0){if(e=ht(e),this.headers[e]){if(t>=this.headers[e].length)return}else return;const r=this.headers[e][t],i=r.raw;if(r.parsed)return r.parsed;const n=Ae.parse(i,e.replace(/-/g,"_"));if(n===-1){this.headers[e].splice(t,1);return}else return r.parsed=n,n}s(e,t=0){return this.parseHeader(e,t)}setHeader(e,t){this.headers[ht(e)]=[{raw:t}]}toString(){return this.data}}class fr extends _n{constructor(){super()}}class Ht extends _n{constructor(){super()}}class Xt{constructor(e,t,r,i,n,a,o){this.headers={},this.extraHeaders=[],this.options=Xt.getDefaultOptions(),n&&(this.options=Object.assign(Object.assign({},this.options),n),this.options.optionTags&&this.options.optionTags.length&&(this.options.optionTags=this.options.optionTags.slice()),this.options.routeSet&&this.options.routeSet.length&&(this.options.routeSet=this.options.routeSet.slice())),a&&a.length&&(this.extraHeaders=a.slice()),o&&(this.body={body:o.content,contentType:o.contentType}),this.method=e,this.ruri=t.clone(),this.fromURI=r.clone(),this.fromTag=this.options.fromTag?this.options.fromTag:es(),this.from=Xt.makeNameAddrHeader(this.fromURI,this.options.fromDisplayName,this.fromTag),this.toURI=i.clone(),this.toTag=this.options.toTag,this.to=Xt.makeNameAddrHeader(this.toURI,this.options.toDisplayName,this.toTag),this.callId=this.options.callId?this.options.callId:this.options.callIdPrefix+Jt(15),this.cseq=this.options.cseq,this.setHeader("route",this.options.routeSet),this.setHeader("via",""),this.setHeader("to",this.to.toString()),this.setHeader("from",this.from.toString()),this.setHeader("cseq",this.cseq+" "+this.method),this.setHeader("call-id",this.callId),this.setHeader("max-forwards","70")}static getDefaultOptions(){return{callId:"",callIdPrefix:"",cseq:1,toDisplayName:"",toTag:"",fromDisplayName:"",fromTag:"",forceRport:!1,hackViaTcp:!1,optionTags:["outbound"],routeSet:[],userAgentString:"sip.js",viaHost:""}}static makeNameAddrHeader(e,t,r){const i={};return r&&(i.tag=r),new Le(e,t,i)}getHeader(e){const t=this.headers[ht(e)];if(t){if(t[0])return t[0]}else{const r=new RegExp("^\\s*"+e+"\\s*:","i");for(const i of this.extraHeaders)if(r.test(i))return i.substring(i.indexOf(":")+1).trim()}}getHeaders(e){const t=[],r=this.headers[ht(e)];if(r)for(const i of r)t.push(i);else{const i=new RegExp("^\\s*"+e+"\\s*:","i");for(const n of this.extraHeaders)i.test(n)&&t.push(n.substring(n.indexOf(":")+1).trim())}return t}hasHeader(e){if(this.headers[ht(e)])return!0;{const t=new RegExp("^\\s*"+e+"\\s*:","i");for(const r of this.extraHeaders)if(t.test(r))return!0}return!1}setHeader(e,t){this.headers[ht(e)]=t instanceof Array?t:[t]}setViaHeader(e,t){this.options.hackViaTcp&&(t="TCP");let r="SIP/2.0/"+t;r+=" "+this.options.viaHost+";branch="+e,this.options.forceRport&&(r+=";rport"),this.setHeader("via",r),this.branch=e}toString(){let e="";e+=this.method+" "+this.ruri.toRaw()+` SIP/2.0\r
|
|
39
|
+
`;for(const t in this.headers)if(this.headers[t])for(const r of this.headers[t])e+=t+": "+r+`\r
|
|
40
|
+
`;for(const t of this.extraHeaders)e+=t.trim()+`\r
|
|
41
|
+
`;return e+="Supported: "+this.options.optionTags.join(", ")+`\r
|
|
42
|
+
`,e+="User-Agent: "+this.options.userAgentString+`\r
|
|
43
|
+
`,this.body?typeof this.body=="string"?(e+="Content-Length: "+Ir(this.body)+`\r
|
|
44
|
+
\r
|
|
45
|
+
`,e+=this.body):this.body.body&&this.body.contentType?(e+="Content-Type: "+this.body.contentType+`\r
|
|
46
|
+
`,e+="Content-Length: "+Ir(this.body.body)+`\r
|
|
47
|
+
\r
|
|
48
|
+
`,e+=this.body.body):e+=`Content-Length: 0\r
|
|
49
|
+
\r
|
|
50
|
+
`:e+=`Content-Length: 0\r
|
|
51
|
+
\r
|
|
52
|
+
`,e}}function Dn(s){return s==="application/sdp"?"session":"render"}function ts(s){const e=typeof s=="string"?s:s.body,t=typeof s=="string"?"application/sdp":s.contentType;return{contentDisposition:Dn(t),contentType:t,content:e}}function bn(s){return s&&typeof s.content=="string"&&typeof s.contentType=="string"&&s.contentDisposition===void 0?!0:typeof s.contentDisposition=="string"}function $r(s){let e,t,r;if(s instanceof fr&&s.body){const i=s.parseHeader("Content-Disposition");e=i?i.type:void 0,t=s.parseHeader("Content-Type"),r=s.body}if(s instanceof Ht&&s.body){const i=s.parseHeader("Content-Disposition");e=i?i.type:void 0,t=s.parseHeader("Content-Type"),r=s.body}if(s instanceof Xt&&s.body)if(e=s.getHeader("Content-Disposition"),t=s.getHeader("Content-Type"),typeof s.body=="string"){if(!t)throw new Error("Header content type header does not equal body content type.");r=s.body}else{if(t&&t!==s.body.contentType)throw new Error("Header content type header does not equal body content type.");t=s.body.contentType,r=s.body.body}if(bn(s)&&(e=s.contentDisposition,t=s.contentType,r=s.content),!!r){if(t&&!e&&(e=Dn(t)),!e)throw new Error("Content disposition undefined.");if(!t)throw new Error("Content type undefined.");return{contentDisposition:e,contentType:t,content:r}}}var Je;(function(s){s.Initial="Initial",s.Early="Early",s.AckWait="AckWait",s.Confirmed="Confirmed",s.Terminated="Terminated"})(Je=Je||(Je={}));var U;(function(s){s.Initial="Initial",s.HaveLocalOffer="HaveLocalOffer",s.HaveRemoteOffer="HaveRemoteOffer",s.Stable="Stable",s.Closed="Closed"})(U=U||(U={}));const yt=500,$o=4e3,An=5e3,Re={T1:yt,T2:$o,TIMER_B:64*yt,TIMER_D:0*yt,TIMER_F:64*yt,TIMER_H:64*yt,TIMER_I:0*An,TIMER_J:0*yt,TIMER_K:0*An,TIMER_L:64*yt,TIMER_M:64*yt,TIMER_N:64*yt,PROVISIONAL_RESPONSE_INTERVAL:6e4};class Pt extends Zt{constructor(e){super(e||"Transaction state error.")}}var j;(function(s){s.ACK="ACK",s.BYE="BYE",s.CANCEL="CANCEL",s.INFO="INFO",s.INVITE="INVITE",s.MESSAGE="MESSAGE",s.NOTIFY="NOTIFY",s.OPTIONS="OPTIONS",s.REGISTER="REGISTER",s.UPDATE="UPDATE",s.SUBSCRIBE="SUBSCRIBE",s.PUBLISH="PUBLISH",s.REFER="REFER",s.PRACK="PRACK"})(j=j||(j={}));const Ot=[j.ACK,j.BYE,j.CANCEL,j.INFO,j.INVITE,j.MESSAGE,j.NOTIFY,j.OPTIONS,j.PRACK,j.REFER,j.REGISTER,j.SUBSCRIBE];class Tn{constructor(e){this.incomingMessageRequest=e}get request(){return this.incomingMessageRequest.message}accept(e){return this.incomingMessageRequest.accept(e),Promise.resolve()}reject(e){return this.incomingMessageRequest.reject(e),Promise.resolve()}}class Ws{constructor(e){this.incomingNotifyRequest=e}get request(){return this.incomingNotifyRequest.message}accept(e){return this.incomingNotifyRequest.accept(e),Promise.resolve()}reject(e){return this.incomingNotifyRequest.reject(e),Promise.resolve()}}class Ho{constructor(e,t){this.incomingReferRequest=e,this.session=t}get referTo(){const e=this.incomingReferRequest.message.parseHeader("refer-to");if(!(e instanceof Le))throw new Error("Failed to parse Refer-To header.");return e}get referredBy(){return this.incomingReferRequest.message.getHeader("referred-by")}get replaces(){const e=this.referTo.uri.getHeader("replaces");return e instanceof Array?e[0]:e}get request(){return this.incomingReferRequest.message}accept(e={statusCode:202}){return this.incomingReferRequest.accept(e),Promise.resolve()}reject(e){return this.incomingReferRequest.reject(e),Promise.resolve()}makeInviter(e){if(this.inviter)return this.inviter;const t=this.referTo.uri.clone();t.clearHeaders(),e=e||{};const r=(e.extraHeaders||[]).slice(),i=this.replaces;i&&r.push("Replaces: "+decodeURIComponent(i));const n=this.referredBy;return n&&r.push("Referred-By: "+n),e.extraHeaders=r,this.inviter=this.session.userAgent._makeInviter(t,e),this.inviter._referred=this.session,this.session._referral=this.inviter,this.inviter}}var B;(function(s){s.Initial="Initial",s.Establishing="Establishing",s.Established="Established",s.Terminating="Terminating",s.Terminated="Terminated"})(B=B||(B={}));class Hr{constructor(e,t={}){this.pendingReinvite=!1,this.pendingReinviteAck=!1,this._state=B.Initial,this.delegate=t.delegate,this._stateEventEmitter=new kr,this._userAgent=e}dispose(){switch(this.logger.log(`Session ${this.id} in state ${this._state} is being disposed`),delete this.userAgent._sessions[this.id],this._sessionDescriptionHandler&&this._sessionDescriptionHandler.close(),this.state){case B.Initial:break;case B.Establishing:break;case B.Established:return new Promise(e=>{this._bye({onAccept:()=>e(),onRedirect:()=>e(),onReject:()=>e()})});case B.Terminating:break;case B.Terminated:break;default:throw new Error("Unknown state.")}return Promise.resolve()}get assertedIdentity(){return this._assertedIdentity}get dialog(){return this._dialog}get id(){return this._id}get replacee(){return this._replacee}get sessionDescriptionHandler(){return this._sessionDescriptionHandler}get sessionDescriptionHandlerFactory(){return this.userAgent.configuration.sessionDescriptionHandlerFactory}get sessionDescriptionHandlerModifiers(){return this._sessionDescriptionHandlerModifiers||[]}set sessionDescriptionHandlerModifiers(e){this._sessionDescriptionHandlerModifiers=e.slice()}get sessionDescriptionHandlerOptions(){return this._sessionDescriptionHandlerOptions||{}}set sessionDescriptionHandlerOptions(e){this._sessionDescriptionHandlerOptions=Object.assign({},e)}get sessionDescriptionHandlerModifiersReInvite(){return this._sessionDescriptionHandlerModifiersReInvite||[]}set sessionDescriptionHandlerModifiersReInvite(e){this._sessionDescriptionHandlerModifiersReInvite=e.slice()}get sessionDescriptionHandlerOptionsReInvite(){return this._sessionDescriptionHandlerOptionsReInvite||{}}set sessionDescriptionHandlerOptionsReInvite(e){this._sessionDescriptionHandlerOptionsReInvite=Object.assign({},e)}get state(){return this._state}get stateChange(){return this._stateEventEmitter}get userAgent(){return this._userAgent}bye(e={}){let t="Session.bye() may only be called if established session.";switch(this.state){case B.Initial:typeof this.cancel=="function"?(t+=" However Inviter.invite() has not yet been called.",t+=" Perhaps you should have called Inviter.cancel()?"):typeof this.reject=="function"&&(t+=" However Invitation.accept() has not yet been called.",t+=" Perhaps you should have called Invitation.reject()?");break;case B.Establishing:typeof this.cancel=="function"?(t+=" However a dialog does not yet exist.",t+=" Perhaps you should have called Inviter.cancel()?"):typeof this.reject=="function"&&(t+=" However Invitation.accept() has not yet been called (or not yet resolved).",t+=" Perhaps you should have called Invitation.reject()?");break;case B.Established:{const r=e.requestDelegate,i=this.copyRequestOptions(e.requestOptions);return this._bye(r,i)}case B.Terminating:t+=" However this session is already terminating.",typeof this.cancel=="function"?t+=" Perhaps you have already called Inviter.cancel()?":typeof this.reject=="function"&&(t+=" Perhaps you have already called Session.bye()?");break;case B.Terminated:t+=" However this session is already terminated.";break;default:throw new Error("Unknown state")}return this.logger.error(t),Promise.reject(new Error(`Invalid session state ${this.state}`))}info(e={}){if(this.state!==B.Established)return this.logger.error("Session.info() may only be called if established session."),Promise.reject(new Error(`Invalid session state ${this.state}`));const t=e.requestDelegate,r=this.copyRequestOptions(e.requestOptions);return this._info(t,r)}invite(e={}){if(this.logger.log("Session.invite"),this.state!==B.Established)return Promise.reject(new Error(`Invalid session state ${this.state}`));if(this.pendingReinvite)return Promise.reject(new Ls("Reinvite in progress. Please wait until complete, then try again."));this.pendingReinvite=!0,e.sessionDescriptionHandlerModifiers&&(this.sessionDescriptionHandlerModifiersReInvite=e.sessionDescriptionHandlerModifiers),e.sessionDescriptionHandlerOptions&&(this.sessionDescriptionHandlerOptionsReInvite=e.sessionDescriptionHandlerOptions);const t={onAccept:n=>{const a=$r(n.message);if(!a){this.logger.error("Received 2xx response to re-INVITE without a session description"),this.ackAndBye(n,400,"Missing session description"),this.stateTransition(B.Terminated),this.pendingReinvite=!1;return}if(e.withoutSdp){const o={sessionDescriptionHandlerOptions:this.sessionDescriptionHandlerOptionsReInvite,sessionDescriptionHandlerModifiers:this.sessionDescriptionHandlerModifiersReInvite};this.setOfferAndGetAnswer(a,o).then(d=>{n.ack({body:d})}).catch(d=>{this.logger.error("Failed to handle offer in 2xx response to re-INVITE"),this.logger.error(d.message),this.state===B.Terminated?n.ack():(this.ackAndBye(n,488,"Bad Media Description"),this.stateTransition(B.Terminated))}).then(()=>{this.pendingReinvite=!1,e.requestDelegate&&e.requestDelegate.onAccept&&e.requestDelegate.onAccept(n)})}else{const o={sessionDescriptionHandlerOptions:this.sessionDescriptionHandlerOptionsReInvite,sessionDescriptionHandlerModifiers:this.sessionDescriptionHandlerModifiersReInvite};this.setAnswer(a,o).then(()=>{n.ack()}).catch(d=>{this.logger.error("Failed to handle answer in 2xx response to re-INVITE"),this.logger.error(d.message),this.state!==B.Terminated?(this.ackAndBye(n,488,"Bad Media Description"),this.stateTransition(B.Terminated)):n.ack()}).then(()=>{this.pendingReinvite=!1,e.requestDelegate&&e.requestDelegate.onAccept&&e.requestDelegate.onAccept(n)})}},onProgress:n=>{},onRedirect:n=>{},onReject:n=>{this.logger.warn("Received a non-2xx response to re-INVITE"),this.pendingReinvite=!1,e.withoutSdp?e.requestDelegate&&e.requestDelegate.onReject&&e.requestDelegate.onReject(n):this.rollbackOffer().catch(a=>{if(this.logger.error("Failed to rollback offer on non-2xx response to re-INVITE"),this.logger.error(a.message),this.state!==B.Terminated){if(!this.dialog)throw new Error("Dialog undefined.");const o=[];o.push("Reason: "+this.getReasonHeaderValue(500,"Internal Server Error")),this.dialog.bye(void 0,{extraHeaders:o}),this.stateTransition(B.Terminated)}}).then(()=>{e.requestDelegate&&e.requestDelegate.onReject&&e.requestDelegate.onReject(n)})},onTrying:n=>{}},r=e.requestOptions||{};if(r.extraHeaders=(r.extraHeaders||[]).slice(),r.extraHeaders.push("Allow: "+Ot.toString()),r.extraHeaders.push("Contact: "+this._contact),e.withoutSdp){if(!this.dialog)throw this.pendingReinvite=!1,new Error("Dialog undefined.");return Promise.resolve(this.dialog.invite(t,r))}const i={sessionDescriptionHandlerOptions:this.sessionDescriptionHandlerOptionsReInvite,sessionDescriptionHandlerModifiers:this.sessionDescriptionHandlerModifiersReInvite};return this.getOffer(i).then(n=>{if(!this.dialog)throw this.pendingReinvite=!1,new Error("Dialog undefined.");return r.body=n,this.dialog.invite(t,r)}).catch(n=>{throw this.logger.error(n.message),this.logger.error("Failed to send re-INVITE"),this.pendingReinvite=!1,n})}message(e={}){if(this.state!==B.Established)return this.logger.error("Session.message() may only be called if established session."),Promise.reject(new Error(`Invalid session state ${this.state}`));const t=e.requestDelegate,r=this.copyRequestOptions(e.requestOptions);return this._message(t,r)}refer(e,t={}){if(this.state!==B.Established)return this.logger.error("Session.refer() may only be called if established session."),Promise.reject(new Error(`Invalid session state ${this.state}`));if(e instanceof Hr&&!e.dialog)return this.logger.error("Session.refer() may only be called with session which is established. You are perhaps attempting to attended transfer to a target for which there is not dialog yet established. Perhaps you are attempting a 'semi-attended' tansfer? Regardless, this is not supported. The recommended approached is to check to see if the target Session is in the Established state before calling refer(); if the state is not Established you may proceed by falling back using a URI as the target (blind transfer)."),Promise.reject(new Error(`Invalid session state ${this.state}`));const r=t.requestDelegate,i=this.copyRequestOptions(t.requestOptions);return i.extraHeaders=i.extraHeaders?i.extraHeaders.concat(this.referExtraHeaders(this.referToString(e))):this.referExtraHeaders(this.referToString(e)),this._refer(t.onNotify,r,i)}_bye(e,t){if(!this.dialog)return Promise.reject(new Error("Session dialog undefined."));const r=this.dialog;switch(r.sessionState){case Je.Initial:throw new Error(`Invalid dialog state ${r.sessionState}`);case Je.Early:throw new Error(`Invalid dialog state ${r.sessionState}`);case Je.AckWait:return this.stateTransition(B.Terminating),new Promise(i=>{r.delegate={onAck:()=>{const n=r.bye(e,t);return this.stateTransition(B.Terminated),i(n),Promise.resolve()},onAckTimeout:()=>{const n=r.bye(e,t);this.stateTransition(B.Terminated),i(n)}}});case Je.Confirmed:{const i=r.bye(e,t);return this.stateTransition(B.Terminated),Promise.resolve(i)}case Je.Terminated:throw new Error(`Invalid dialog state ${r.sessionState}`);default:throw new Error("Unrecognized state.")}}_info(e,t){return this.dialog?Promise.resolve(this.dialog.info(e,t)):Promise.reject(new Error("Session dialog undefined."))}_message(e,t){return this.dialog?Promise.resolve(this.dialog.message(e,t)):Promise.reject(new Error("Session dialog undefined."))}_refer(e,t,r){return this.dialog?(this.onNotify=e,Promise.resolve(this.dialog.refer(t,r))):Promise.reject(new Error("Session dialog undefined."))}ackAndBye(e,t,r){e.ack();const i=[];t&&i.push("Reason: "+this.getReasonHeaderValue(t,r)),e.session.bye(void 0,{extraHeaders:i})}onAckRequest(e){if(this.logger.log("Session.onAckRequest"),this.state!==B.Established&&this.state!==B.Terminating)return this.logger.error(`ACK received while in state ${this.state}, dropping request`),Promise.resolve();const t=this.dialog;if(!t)throw new Error("Dialog undefined.");const r={sessionDescriptionHandlerOptions:this.pendingReinviteAck?this.sessionDescriptionHandlerOptionsReInvite:this.sessionDescriptionHandlerOptions,sessionDescriptionHandlerModifiers:this.pendingReinviteAck?this._sessionDescriptionHandlerModifiersReInvite:this._sessionDescriptionHandlerModifiers};if(this.delegate&&this.delegate.onAck){const i=new To(e);this.delegate.onAck(i)}switch(this.pendingReinviteAck=!1,t.signalingState){case U.Initial:{this.logger.error(`Invalid signaling state ${t.signalingState}.`);const i=["Reason: "+this.getReasonHeaderValue(488,"Bad Media Description")];return t.bye(void 0,{extraHeaders:i}),this.stateTransition(B.Terminated),Promise.resolve()}case U.Stable:{const i=$r(e.message);return i?i.contentDisposition==="render"?(this._renderbody=i.content,this._rendertype=i.contentType,Promise.resolve()):i.contentDisposition!=="session"?Promise.resolve():this.setAnswer(i,r).catch(n=>{this.logger.error(n.message);const a=["Reason: "+this.getReasonHeaderValue(488,"Bad Media Description")];t.bye(void 0,{extraHeaders:a}),this.stateTransition(B.Terminated)}):Promise.resolve()}case U.HaveLocalOffer:{this.logger.error(`Invalid signaling state ${t.signalingState}.`);const i=["Reason: "+this.getReasonHeaderValue(488,"Bad Media Description")];return t.bye(void 0,{extraHeaders:i}),this.stateTransition(B.Terminated),Promise.resolve()}case U.HaveRemoteOffer:{this.logger.error(`Invalid signaling state ${t.signalingState}.`);const i=["Reason: "+this.getReasonHeaderValue(488,"Bad Media Description")];return t.bye(void 0,{extraHeaders:i}),this.stateTransition(B.Terminated),Promise.resolve()}case U.Closed:throw new Error(`Invalid signaling state ${t.signalingState}.`);default:throw new Error(`Invalid signaling state ${t.signalingState}.`)}}onByeRequest(e){if(this.logger.log("Session.onByeRequest"),this.state!==B.Established){this.logger.error(`BYE received while in state ${this.state}, dropping request`);return}if(this.delegate&&this.delegate.onBye){const t=new So(e);this.delegate.onBye(t)}else e.accept();this.stateTransition(B.Terminated)}onInfoRequest(e){if(this.logger.log("Session.onInfoRequest"),this.state!==B.Established){this.logger.error(`INFO received while in state ${this.state}, dropping request`);return}if(this.delegate&&this.delegate.onInfo){const t=new Fo(e);this.delegate.onInfo(t)}else e.accept()}onInviteRequest(e){if(this.logger.log("Session.onInviteRequest"),this.state!==B.Established){this.logger.error(`INVITE received while in state ${this.state}, dropping request`);return}this.pendingReinviteAck=!0;const t=["Contact: "+this._contact];if(e.message.hasHeader("P-Asserted-Identity")){const i=e.message.getHeader("P-Asserted-Identity");if(!i)throw new Error("Header undefined.");this._assertedIdentity=Ae.nameAddrHeaderParse(i)}const r={sessionDescriptionHandlerOptions:this.sessionDescriptionHandlerOptionsReInvite,sessionDescriptionHandlerModifiers:this.sessionDescriptionHandlerModifiersReInvite};this.generateResponseOfferAnswerInDialog(r).then(i=>{const n=e.accept({statusCode:200,extraHeaders:t,body:i});this.delegate&&this.delegate.onInvite&&this.delegate.onInvite(e.message,n.message,200)}).catch(i=>{if(this.logger.error(i.message),this.logger.error("Failed to handle to re-INVITE request"),!this.dialog)throw new Error("Dialog undefined.");if(this.logger.error(this.dialog.signalingState),this.dialog.signalingState===U.Stable){const n=e.reject({statusCode:488});this.delegate&&this.delegate.onInvite&&this.delegate.onInvite(e.message,n.message,488);return}this.rollbackOffer().then(()=>{const n=e.reject({statusCode:488});this.delegate&&this.delegate.onInvite&&this.delegate.onInvite(e.message,n.message,488)}).catch(n=>{this.logger.error(n.message),this.logger.error("Failed to rollback offer on re-INVITE request");const a=e.reject({statusCode:488});if(this.state!==B.Terminated){if(!this.dialog)throw new Error("Dialog undefined.");const o=[];o.push("Reason: "+this.getReasonHeaderValue(500,"Internal Server Error")),this.dialog.bye(void 0,{extraHeaders:o}),this.stateTransition(B.Terminated)}this.delegate&&this.delegate.onInvite&&this.delegate.onInvite(e.message,a.message,488)})})}onMessageRequest(e){if(this.logger.log("Session.onMessageRequest"),this.state!==B.Established){this.logger.error(`MESSAGE received while in state ${this.state}, dropping request`);return}if(this.delegate&&this.delegate.onMessage){const t=new Tn(e);this.delegate.onMessage(t)}else e.accept()}onNotifyRequest(e){if(this.logger.log("Session.onNotifyRequest"),this.state!==B.Established){this.logger.error(`NOTIFY received while in state ${this.state}, dropping request`);return}if(this.onNotify){const t=new Ws(e);this.onNotify(t);return}if(this.delegate&&this.delegate.onNotify){const t=new Ws(e);this.delegate.onNotify(t)}else e.accept()}onPrackRequest(e){if(this.logger.log("Session.onPrackRequest"),this.state!==B.Established){this.logger.error(`PRACK received while in state ${this.state}, dropping request`);return}throw new Error("Unimplemented.")}onReferRequest(e){if(this.logger.log("Session.onReferRequest"),this.state!==B.Established){this.logger.error(`REFER received while in state ${this.state}, dropping request`);return}if(!e.message.hasHeader("refer-to")){this.logger.warn("Invalid REFER packet. A refer-to header is required. Rejecting."),e.reject();return}const t=new Ho(e,this);this.delegate&&this.delegate.onRefer?this.delegate.onRefer(t):(this.logger.log("No delegate available to handle REFER, automatically accepting and following."),t.accept().then(()=>t.makeInviter(this._referralInviterOptions).invite()).catch(r=>{this.logger.error(r.message)}))}generateResponseOfferAnswer(e,t){if(this.dialog)return this.generateResponseOfferAnswerInDialog(t);const r=$r(e.message);return!r||r.contentDisposition!=="session"?this.getOffer(t):this.setOfferAndGetAnswer(r,t)}generateResponseOfferAnswerInDialog(e){if(!this.dialog)throw new Error("Dialog undefined.");switch(this.dialog.signalingState){case U.Initial:return this.getOffer(e);case U.HaveLocalOffer:return Promise.resolve(void 0);case U.HaveRemoteOffer:if(!this.dialog.offer)throw new Error(`Session offer undefined in signaling state ${this.dialog.signalingState}.`);return this.setOfferAndGetAnswer(this.dialog.offer,e);case U.Stable:return this.state!==B.Established?Promise.resolve(void 0):this.getOffer(e);case U.Closed:throw new Error(`Invalid signaling state ${this.dialog.signalingState}.`);default:throw new Error(`Invalid signaling state ${this.dialog.signalingState}.`)}}getOffer(e){const t=this.setupSessionDescriptionHandler(),r=e.sessionDescriptionHandlerOptions,i=e.sessionDescriptionHandlerModifiers;try{return t.getDescription(r,i).then(n=>ts(n)).catch(n=>{this.logger.error("Session.getOffer: SDH getDescription rejected...");const a=n instanceof Error?n:new Error("Session.getOffer unknown error.");throw this.logger.error(a.message),a})}catch(n){this.logger.error("Session.getOffer: SDH getDescription threw...");const a=n instanceof Error?n:new Error(n);return this.logger.error(a.message),Promise.reject(a)}}rollbackOffer(){const e=this.setupSessionDescriptionHandler();if(e.rollbackDescription===void 0)return Promise.resolve();try{return e.rollbackDescription().catch(t=>{this.logger.error("Session.rollbackOffer: SDH rollbackDescription rejected...");const r=t instanceof Error?t:new Error("Session.rollbackOffer unknown error.");throw this.logger.error(r.message),r})}catch(t){this.logger.error("Session.rollbackOffer: SDH rollbackDescription threw...");const r=t instanceof Error?t:new Error(t);return this.logger.error(r.message),Promise.reject(r)}}setAnswer(e,t){const r=this.setupSessionDescriptionHandler(),i=t.sessionDescriptionHandlerOptions,n=t.sessionDescriptionHandlerModifiers;try{if(!r.hasDescription(e.contentType))return Promise.reject(new Us)}catch(a){this.logger.error("Session.setAnswer: SDH hasDescription threw...");const o=a instanceof Error?a:new Error(a);return this.logger.error(o.message),Promise.reject(o)}try{return r.setDescription(e.content,i,n).catch(a=>{this.logger.error("Session.setAnswer: SDH setDescription rejected...");const o=a instanceof Error?a:new Error("Session.setAnswer unknown error.");throw this.logger.error(o.message),o})}catch(a){this.logger.error("Session.setAnswer: SDH setDescription threw...");const o=a instanceof Error?a:new Error(a);return this.logger.error(o.message),Promise.reject(o)}}setOfferAndGetAnswer(e,t){const r=this.setupSessionDescriptionHandler(),i=t.sessionDescriptionHandlerOptions,n=t.sessionDescriptionHandlerModifiers;try{if(!r.hasDescription(e.contentType))return Promise.reject(new Us)}catch(a){this.logger.error("Session.setOfferAndGetAnswer: SDH hasDescription threw...");const o=a instanceof Error?a:new Error(a);return this.logger.error(o.message),Promise.reject(o)}try{return r.setDescription(e.content,i,n).then(()=>r.getDescription(i,n)).then(a=>ts(a)).catch(a=>{this.logger.error("Session.setOfferAndGetAnswer: SDH setDescription or getDescription rejected...");const o=a instanceof Error?a:new Error("Session.setOfferAndGetAnswer unknown error.");throw this.logger.error(o.message),o})}catch(a){this.logger.error("Session.setOfferAndGetAnswer: SDH setDescription or getDescription threw...");const o=a instanceof Error?a:new Error(a);return this.logger.error(o.message),Promise.reject(o)}}setSessionDescriptionHandler(e){if(this._sessionDescriptionHandler)throw new Error("Session description handler defined.");this._sessionDescriptionHandler=e}setupSessionDescriptionHandler(){var e;return this._sessionDescriptionHandler?this._sessionDescriptionHandler:(this._sessionDescriptionHandler=this.sessionDescriptionHandlerFactory(this,this.userAgent.configuration.sessionDescriptionHandlerFactoryOptions),!((e=this.delegate)===null||e===void 0)&&e.onSessionDescriptionHandler&&this.delegate.onSessionDescriptionHandler(this._sessionDescriptionHandler,!1),this._sessionDescriptionHandler)}stateTransition(e){const t=()=>{throw new Error(`Invalid state transition from ${this._state} to ${e}`)};switch(this._state){case B.Initial:e!==B.Establishing&&e!==B.Established&&e!==B.Terminating&&e!==B.Terminated&&t();break;case B.Establishing:e!==B.Established&&e!==B.Terminating&&e!==B.Terminated&&t();break;case B.Established:e!==B.Terminating&&e!==B.Terminated&&t();break;case B.Terminating:e!==B.Terminated&&t();break;case B.Terminated:t();break;default:throw new Error("Unrecognized state.")}this._state=e,this.logger.log(`Session ${this.id} transitioned to state ${this._state}`),this._stateEventEmitter.emit(this._state),e===B.Terminated&&this.dispose()}copyRequestOptions(e={}){const t=e.extraHeaders?e.extraHeaders.slice():void 0,r=e.body?{contentDisposition:e.body.contentDisposition||"render",contentType:e.body.contentType||"text/plain",content:e.body.content||""}:void 0;return{extraHeaders:t,body:r}}getReasonHeaderValue(e,t){const r=e;let i=Qr(e);return!i&&t&&(i=t),"SIP;cause="+r+';text="'+i+'"'}referExtraHeaders(e){const t=[];return t.push("Referred-By: <"+this.userAgent.configuration.uri+">"),t.push("Contact: "+this._contact),t.push("Allow: "+["ACK","CANCEL","INVITE","MESSAGE","BYE","OPTIONS","INFO","NOTIFY","REFER"].toString()),t.push("Refer-To: "+e),t}referToString(e){let t;if(e instanceof lt)t=e.toString();else{if(!e.dialog)throw new Error("Dialog undefined.");const r=e.remoteIdentity.friendlyName,i=e.dialog.remoteTarget.toString(),n=e.dialog.callId,a=e.dialog.remoteTag,o=e.dialog.localTag,d=encodeURIComponent(`${n};to-tag=${a};from-tag=${o}`);t=`"${r}" <${i}?Replaces=${d}>`}return t}}var rt;(function(s){s.Required="Required",s.Supported="Supported",s.Unsupported="Unsupported"})(rt=rt||(rt={}));const Po={"100rel":!0,199:!0,answermode:!0,"early-session":!0,eventlist:!0,explicitsub:!0,"from-change":!0,"geolocation-http":!0,"geolocation-sip":!0,gin:!0,gruu:!0,histinfo:!0,ice:!0,join:!0,"multiple-refer":!0,norefersub:!0,nosub:!0,outbound:!0,path:!0,policy:!0,precondition:!0,pref:!0,privacy:!0,"recipient-list-invite":!0,"recipient-list-message":!0,"recipient-list-subscribe":!0,replaces:!0,"resource-priority":!0,"sdp-anat":!0,"sec-agree":!0,tdialog:!0,timer:!0,uui:!0};class Oo extends Hr{constructor(e,t){super(e),this.incomingInviteRequest=t,this.disposed=!1,this.expiresTimer=void 0,this.isCanceled=!1,this.rel100="none",this.rseq=Math.floor(Math.random()*1e4),this.userNoAnswerTimer=void 0,this.waitingForPrack=!1,this.logger=e.getLogger("sip.Invitation");const r=this.incomingInviteRequest.message,i=r.getHeader("require");i&&i.toLowerCase().includes("100rel")&&(this.rel100="required");const n=r.getHeader("supported");if(n&&n.toLowerCase().includes("100rel")&&(this.rel100="supported"),r.toTag=t.toTag,typeof r.toTag!="string")throw new TypeError("toTag should have been a string.");if(this.userNoAnswerTimer=setTimeout(()=>{t.reject({statusCode:480}),this.stateTransition(B.Terminated)},this.userAgent.configuration.noAnswerTimeout?this.userAgent.configuration.noAnswerTimeout*1e3:6e4),r.hasHeader("expires")){const d=Number(r.getHeader("expires")||0)*1e3;this.expiresTimer=setTimeout(()=>{this.state===B.Initial&&(t.reject({statusCode:487}),this.stateTransition(B.Terminated))},d)}const a=this.request.getHeader("P-Asserted-Identity");a&&(this._assertedIdentity=Ae.nameAddrHeaderParse(a)),this._contact=this.userAgent.contact.toString();const o=r.parseHeader("Content-Disposition");o&&o.type==="render"&&(this._renderbody=r.body,this._rendertype=r.getHeader("Content-Type")),this._id=r.callId+r.fromTag,this.userAgent._sessions[this._id]=this}dispose(){if(this.disposed)return Promise.resolve();switch(this.disposed=!0,this.expiresTimer&&(clearTimeout(this.expiresTimer),this.expiresTimer=void 0),this.userNoAnswerTimer&&(clearTimeout(this.userNoAnswerTimer),this.userNoAnswerTimer=void 0),this.prackNeverArrived(),this.state){case B.Initial:return this.reject().then(()=>super.dispose());case B.Establishing:return this.reject().then(()=>super.dispose());case B.Established:return super.dispose();case B.Terminating:return super.dispose();case B.Terminated:return super.dispose();default:throw new Error("Unknown state.")}}get autoSendAnInitialProvisionalResponse(){return this.rel100!=="required"&&this.userAgent.configuration.sendInitialProvisionalResponse}get body(){return this.incomingInviteRequest.message.body}get localIdentity(){return this.request.to}get remoteIdentity(){return this.request.from}get request(){return this.incomingInviteRequest.message}accept(e={}){if(this.logger.log("Invitation.accept"),this.state!==B.Initial){const t=new Error(`Invalid session state ${this.state}`);return this.logger.error(t.message),Promise.reject(t)}return e.sessionDescriptionHandlerModifiers&&(this.sessionDescriptionHandlerModifiers=e.sessionDescriptionHandlerModifiers),e.sessionDescriptionHandlerOptions&&(this.sessionDescriptionHandlerOptions=e.sessionDescriptionHandlerOptions),this.stateTransition(B.Establishing),this.sendAccept(e).then(({message:t,session:r})=>{r.delegate={onAck:i=>this.onAckRequest(i),onAckTimeout:()=>this.onAckTimeout(),onBye:i=>this.onByeRequest(i),onInfo:i=>this.onInfoRequest(i),onInvite:i=>this.onInviteRequest(i),onMessage:i=>this.onMessageRequest(i),onNotify:i=>this.onNotifyRequest(i),onPrack:i=>this.onPrackRequest(i),onRefer:i=>this.onReferRequest(i)},this._dialog=r,this.stateTransition(B.Established),this._replacee&&this._replacee._bye()}).catch(t=>this.handleResponseError(t))}progress(e={}){if(this.logger.log("Invitation.progress"),this.state!==B.Initial){const r=new Error(`Invalid session state ${this.state}`);return this.logger.error(r.message),Promise.reject(r)}const t=e.statusCode||180;if(t<100||t>199)throw new TypeError("Invalid statusCode: "+t);return e.sessionDescriptionHandlerModifiers&&(this.sessionDescriptionHandlerModifiers=e.sessionDescriptionHandlerModifiers),e.sessionDescriptionHandlerOptions&&(this.sessionDescriptionHandlerOptions=e.sessionDescriptionHandlerOptions),this.waitingForPrack?(this.logger.warn("Unexpected call for progress while waiting for prack, ignoring"),Promise.resolve()):e.statusCode===100?this.sendProgressTrying().then(()=>{}).catch(r=>this.handleResponseError(r)):this.rel100!=="required"&&!(this.rel100==="supported"&&e.rel100)&&!(this.rel100==="supported"&&this.userAgent.configuration.sipExtension100rel===rt.Required)?this.sendProgress(e).then(()=>{}).catch(r=>this.handleResponseError(r)):this.sendProgressReliableWaitForPrack(e).then(()=>{}).catch(r=>this.handleResponseError(r))}reject(e={}){if(this.logger.log("Invitation.reject"),this.state!==B.Initial&&this.state!==B.Establishing){const a=new Error(`Invalid session state ${this.state}`);return this.logger.error(a.message),Promise.reject(a)}const t=e.statusCode||480,r=e.reasonPhrase?e.reasonPhrase:Qr(t),i=e.extraHeaders||[];if(t<300||t>699)throw new TypeError("Invalid statusCode: "+t);const n=e.body?ts(e.body):void 0;return t<400?this.incomingInviteRequest.redirect([],{statusCode:t,reasonPhrase:r,extraHeaders:i,body:n}):this.incomingInviteRequest.reject({statusCode:t,reasonPhrase:r,extraHeaders:i,body:n}),this.stateTransition(B.Terminated),Promise.resolve()}_onCancel(e){if(this.logger.log("Invitation._onCancel"),this.state!==B.Initial&&this.state!==B.Establishing){this.logger.error(`CANCEL received while in state ${this.state}, dropping request`);return}if(this.delegate&&this.delegate.onCancel){const t=new Ro(e);this.delegate.onCancel(t)}this.isCanceled=!0,this.incomingInviteRequest.reject({statusCode:487}),this.stateTransition(B.Terminated)}handlePrackOfferAnswer(e){if(!this.dialog)throw new Error("Dialog undefined.");const t=$r(e.message);if(!t||t.contentDisposition!=="session")return Promise.resolve(void 0);const r={sessionDescriptionHandlerOptions:this.sessionDescriptionHandlerOptions,sessionDescriptionHandlerModifiers:this.sessionDescriptionHandlerModifiers};switch(this.dialog.signalingState){case U.Initial:throw new Error(`Invalid signaling state ${this.dialog.signalingState}.`);case U.Stable:return this.setAnswer(t,r).then(()=>{});case U.HaveLocalOffer:throw new Error(`Invalid signaling state ${this.dialog.signalingState}.`);case U.HaveRemoteOffer:return this.setOfferAndGetAnswer(t,r);case U.Closed:throw new Error(`Invalid signaling state ${this.dialog.signalingState}.`);default:throw new Error(`Invalid signaling state ${this.dialog.signalingState}.`)}}handleResponseError(e){let t=480;if(e instanceof Error?this.logger.error(e.message):this.logger.error(e),e instanceof Us?(this.logger.error("A session description handler occurred while sending response (content type unsupported"),t=415):e instanceof Ao?this.logger.error("A session description handler occurred while sending response"):e instanceof js?this.logger.error("Session ended before response could be formulated and sent (while waiting for PRACK)"):e instanceof Pt&&this.logger.error("Session changed state before response could be formulated and sent"),this.state===B.Initial||this.state===B.Establishing)try{this.incomingInviteRequest.reject({statusCode:t}),this.stateTransition(B.Terminated)}catch(r){throw this.logger.error("An error occurred attempting to reject the request while handling another error"),r}if(this.isCanceled){this.logger.warn("An error occurred while attempting to formulate and send a response to an incoming INVITE. However a CANCEL was received and processed while doing so which can (and often does) result in errors occurring as the session terminates in the meantime. Said error is being ignored.");return}throw e}onAckTimeout(){if(this.logger.log("Invitation.onAckTimeout"),!this.dialog)throw new Error("Dialog undefined.");this.logger.log("No ACK received for an extended period of time, terminating session"),this.dialog.bye(),this.stateTransition(B.Terminated)}sendAccept(e={}){const t={sessionDescriptionHandlerOptions:this.sessionDescriptionHandlerOptions,sessionDescriptionHandlerModifiers:this.sessionDescriptionHandlerModifiers},r=e.extraHeaders||[];return this.waitingForPrack?this.waitForArrivalOfPrack().then(()=>clearTimeout(this.userNoAnswerTimer)).then(()=>this.generateResponseOfferAnswer(this.incomingInviteRequest,t)).then(i=>this.incomingInviteRequest.accept({statusCode:200,body:i,extraHeaders:r})):(clearTimeout(this.userNoAnswerTimer),this.generateResponseOfferAnswer(this.incomingInviteRequest,t).then(i=>this.incomingInviteRequest.accept({statusCode:200,body:i,extraHeaders:r})))}sendProgress(e={}){const t=e.statusCode||180,r=e.reasonPhrase,i=(e.extraHeaders||[]).slice(),n=e.body?ts(e.body):void 0;if(t===183&&!n)return this.sendProgressWithSDP(e);try{const a=this.incomingInviteRequest.progress({statusCode:t,reasonPhrase:r,extraHeaders:i,body:n});return this._dialog=a.session,Promise.resolve(a)}catch(a){return Promise.reject(a)}}sendProgressWithSDP(e={}){const t={sessionDescriptionHandlerOptions:this.sessionDescriptionHandlerOptions,sessionDescriptionHandlerModifiers:this.sessionDescriptionHandlerModifiers},r=e.statusCode||183,i=e.reasonPhrase,n=(e.extraHeaders||[]).slice();return this.generateResponseOfferAnswer(this.incomingInviteRequest,t).then(a=>this.incomingInviteRequest.progress({statusCode:r,reasonPhrase:i,extraHeaders:n,body:a})).then(a=>(this._dialog=a.session,a))}sendProgressReliable(e={}){return e.extraHeaders=(e.extraHeaders||[]).slice(),e.extraHeaders.push("Require: 100rel"),e.extraHeaders.push("RSeq: "+Math.floor(Math.random()*1e4)),this.sendProgressWithSDP(e)}sendProgressReliableWaitForPrack(e={}){const t={sessionDescriptionHandlerOptions:this.sessionDescriptionHandlerOptions,sessionDescriptionHandlerModifiers:this.sessionDescriptionHandlerModifiers},r=e.statusCode||183,i=e.reasonPhrase,n=(e.extraHeaders||[]).slice();n.push("Require: 100rel"),n.push("RSeq: "+this.rseq++);let a;return new Promise((o,d)=>{this.waitingForPrack=!0,this.generateResponseOfferAnswer(this.incomingInviteRequest,t).then(c=>(a=c,this.incomingInviteRequest.progress({statusCode:r,reasonPhrase:i,extraHeaders:n,body:a}))).then(c=>{this._dialog=c.session;let l,g;c.session.delegate={onPrack:x=>{l=x,clearTimeout(y),clearTimeout(_),this.waitingForPrack&&(this.waitingForPrack=!1,this.handlePrackOfferAnswer(l).then(p=>{try{g=l.accept({statusCode:200,body:p}),this.prackArrived(),o({prackRequest:l,prackResponse:g,progressResponse:c})}catch(E){d(E)}}).catch(p=>d(p)))}};const y=setTimeout(()=>{this.waitingForPrack&&(this.waitingForPrack=!1,this.logger.warn("No PRACK received, rejecting INVITE."),clearTimeout(_),this.reject({statusCode:504}).then(()=>d(new js)).catch(x=>d(x)))},Re.T1*64),v=()=>{try{this.incomingInviteRequest.progress({statusCode:r,reasonPhrase:i,extraHeaders:n,body:a})}catch(x){this.waitingForPrack=!1,d(x);return}_=setTimeout(v,C*=2)};let C=Re.T1,_=setTimeout(v,C)}).catch(c=>{this.waitingForPrack=!1,d(c)})})}sendProgressTrying(){try{const e=this.incomingInviteRequest.trying();return Promise.resolve(e)}catch(e){return Promise.reject(e)}}waitForArrivalOfPrack(){if(this.waitingForPrackPromise)throw new Error("Already waiting for PRACK");return this.waitingForPrackPromise=new Promise((e,t)=>{this.waitingForPrackResolve=e,this.waitingForPrackReject=t}),this.waitingForPrackPromise}prackArrived(){this.waitingForPrackResolve&&this.waitingForPrackResolve(),this.waitingForPrackPromise=void 0,this.waitingForPrackResolve=void 0,this.waitingForPrackReject=void 0}prackNeverArrived(){this.waitingForPrackReject&&this.waitingForPrackReject(new js),this.waitingForPrackPromise=void 0,this.waitingForPrackResolve=void 0,this.waitingForPrackReject=void 0}}class Sn extends Hr{constructor(e,t,r={}){super(e,r),this.disposed=!1,this.earlyMedia=!1,this.earlyMediaSessionDescriptionHandlers=new Map,this.isCanceled=!1,this.inviteWithoutSdp=!1,this.logger=e.getLogger("sip.Inviter"),this.earlyMedia=r.earlyMedia!==void 0?r.earlyMedia:this.earlyMedia,this.fromTag=es(),this.inviteWithoutSdp=r.inviteWithoutSdp!==void 0?r.inviteWithoutSdp:this.inviteWithoutSdp;const i=Object.assign({},r);i.params=Object.assign({},r.params);const n=r.anonymous||!1,a=e.contact.toString({anonymous:n,outbound:n?!e.contact.tempGruu:!e.contact.pubGruu});n&&e.configuration.uri&&(i.params.fromDisplayName="Anonymous",i.params.fromUri="sip:anonymous@anonymous.invalid");let o=e.userAgentCore.configuration.aor;if(i.params.fromUri&&(o=typeof i.params.fromUri=="string"?Ae.URIParse(i.params.fromUri):i.params.fromUri),!o)throw new TypeError("Invalid from URI: "+i.params.fromUri);let d=t;if(i.params.toUri&&(d=typeof i.params.toUri=="string"?Ae.URIParse(i.params.toUri):i.params.toUri),!d)throw new TypeError("Invalid to URI: "+i.params.toUri);const c=Object.assign({},i.params);c.fromTag=this.fromTag;const l=(i.extraHeaders||[]).slice();n&&e.configuration.uri&&(l.push("P-Preferred-Identity: "+e.configuration.uri.toString()),l.push("Privacy: id")),l.push("Contact: "+a),l.push("Allow: "+["ACK","CANCEL","INVITE","MESSAGE","BYE","OPTIONS","INFO","NOTIFY","REFER"].toString()),e.configuration.sipExtension100rel===rt.Required&&l.push("Require: 100rel"),e.configuration.sipExtensionReplaces===rt.Required&&l.push("Require: replaces"),i.extraHeaders=l;const g=void 0;this.outgoingRequestMessage=e.userAgentCore.makeOutgoingRequestMessage(j.INVITE,t,o,d,c,l,g),this._contact=a,this._referralInviterOptions=i,this._renderbody=r.renderbody,this._rendertype=r.rendertype,r.sessionDescriptionHandlerModifiers&&(this.sessionDescriptionHandlerModifiers=r.sessionDescriptionHandlerModifiers),r.sessionDescriptionHandlerOptions&&(this.sessionDescriptionHandlerOptions=r.sessionDescriptionHandlerOptions),r.sessionDescriptionHandlerModifiersReInvite&&(this.sessionDescriptionHandlerModifiersReInvite=r.sessionDescriptionHandlerModifiersReInvite),r.sessionDescriptionHandlerOptionsReInvite&&(this.sessionDescriptionHandlerOptionsReInvite=r.sessionDescriptionHandlerOptionsReInvite),this._id=this.outgoingRequestMessage.callId+this.fromTag,this.userAgent._sessions[this._id]=this}dispose(){if(this.disposed)return Promise.resolve();switch(this.disposed=!0,this.disposeEarlyMedia(),this.state){case B.Initial:return this.cancel().then(()=>super.dispose());case B.Establishing:return this.cancel().then(()=>super.dispose());case B.Established:return super.dispose();case B.Terminating:return super.dispose();case B.Terminated:return super.dispose();default:throw new Error("Unknown state.")}}get body(){return this.outgoingRequestMessage.body}get localIdentity(){return this.outgoingRequestMessage.from}get remoteIdentity(){return this.outgoingRequestMessage.to}get request(){return this.outgoingRequestMessage}cancel(e={}){if(this.logger.log("Inviter.cancel"),this.state!==B.Initial&&this.state!==B.Establishing){const r=new Error(`Invalid session state ${this.state}`);return this.logger.error(r.message),Promise.reject(r)}this.isCanceled=!0,this.stateTransition(B.Terminating);function t(r,i){if(r&&r<200||r>699)throw new TypeError("Invalid statusCode: "+r);if(r){const n=r,a=Qr(r)||i;return"SIP;cause="+n+';text="'+a+'"'}}if(this.outgoingInviteRequest){let r;e.statusCode&&e.reasonPhrase&&(r=t(e.statusCode,e.reasonPhrase)),this.outgoingInviteRequest.cancel(r,e)}else this.logger.warn("Canceled session before INVITE was sent"),this.stateTransition(B.Terminated);return Promise.resolve()}invite(e={}){if(this.logger.log("Inviter.invite"),this.state!==B.Initial)return super.invite(e);if(e.sessionDescriptionHandlerModifiers&&(this.sessionDescriptionHandlerModifiers=e.sessionDescriptionHandlerModifiers),e.sessionDescriptionHandlerOptions&&(this.sessionDescriptionHandlerOptions=e.sessionDescriptionHandlerOptions),e.withoutSdp||this.inviteWithoutSdp)return this._renderbody&&this._rendertype&&(this.outgoingRequestMessage.body={contentType:this._rendertype,body:this._renderbody}),this.stateTransition(B.Establishing),Promise.resolve(this.sendInvite(e));const t={sessionDescriptionHandlerModifiers:this.sessionDescriptionHandlerModifiers,sessionDescriptionHandlerOptions:this.sessionDescriptionHandlerOptions};return this.getOffer(t).then(r=>(this.outgoingRequestMessage.body={body:r.content,contentType:r.contentType},this.stateTransition(B.Establishing),this.sendInvite(e))).catch(r=>{throw this.logger.log(r.message),this.state!==B.Terminated&&this.stateTransition(B.Terminated),r})}sendInvite(e={}){return this.outgoingInviteRequest=this.userAgent.userAgentCore.invite(this.outgoingRequestMessage,{onAccept:t=>{if(this.dialog){this.logger.log("Additional confirmed dialog, sending ACK and BYE"),this.ackAndBye(t);return}if(this.isCanceled){this.logger.log("Canceled session accepted, sending ACK and BYE"),this.ackAndBye(t),this.stateTransition(B.Terminated);return}this.notifyReferer(t),this.onAccept(t).then(()=>{this.disposeEarlyMedia()}).catch(()=>{this.disposeEarlyMedia()}).then(()=>{e.requestDelegate&&e.requestDelegate.onAccept&&e.requestDelegate.onAccept(t)})},onProgress:t=>{this.isCanceled||(this.notifyReferer(t),this.onProgress(t).catch(()=>{this.disposeEarlyMedia()}).then(()=>{e.requestDelegate&&e.requestDelegate.onProgress&&e.requestDelegate.onProgress(t)}))},onRedirect:t=>{this.notifyReferer(t),this.onRedirect(t),e.requestDelegate&&e.requestDelegate.onRedirect&&e.requestDelegate.onRedirect(t)},onReject:t=>{this.notifyReferer(t),this.onReject(t),e.requestDelegate&&e.requestDelegate.onReject&&e.requestDelegate.onReject(t)},onTrying:t=>{this.notifyReferer(t),this.onTrying(t),e.requestDelegate&&e.requestDelegate.onTrying&&e.requestDelegate.onTrying(t)}}),this.outgoingInviteRequest}disposeEarlyMedia(){this.earlyMediaSessionDescriptionHandlers.forEach(e=>{e.close()}),this.earlyMediaSessionDescriptionHandlers.clear()}notifyReferer(e){if(!this._referred)return;if(!(this._referred instanceof Hr))throw new Error("Referred session not instance of session");if(!this._referred.dialog)return;if(!e.message.statusCode)throw new Error("Status code undefined.");if(!e.message.reasonPhrase)throw new Error("Reason phrase undefined.");const t=e.message.statusCode,r=e.message.reasonPhrase,i=`SIP/2.0 ${t} ${r}`.trim(),n=this._referred.dialog.notify(void 0,{extraHeaders:["Event: refer","Subscription-State: terminated"],body:{contentDisposition:"render",contentType:"message/sipfrag",content:i}});n.delegate={onReject:()=>{this._referred=void 0}}}onAccept(e){if(this.logger.log("Inviter.onAccept"),this.state!==B.Establishing)return this.logger.error(`Accept received while in state ${this.state}, dropping response`),Promise.reject(new Error(`Invalid session state ${this.state}`));const t=e.message,r=e.session;switch(t.hasHeader("P-Asserted-Identity")&&(this._assertedIdentity=Ae.nameAddrHeaderParse(t.getHeader("P-Asserted-Identity"))),r.delegate={onAck:i=>this.onAckRequest(i),onBye:i=>this.onByeRequest(i),onInfo:i=>this.onInfoRequest(i),onInvite:i=>this.onInviteRequest(i),onMessage:i=>this.onMessageRequest(i),onNotify:i=>this.onNotifyRequest(i),onPrack:i=>this.onPrackRequest(i),onRefer:i=>this.onReferRequest(i)},this._dialog=r,r.signalingState){case U.Initial:return this.logger.error("Received 2xx response to INVITE without a session description"),this.ackAndBye(e,400,"Missing session description"),this.stateTransition(B.Terminated),Promise.reject(new Error("Bad Media Description"));case U.HaveLocalOffer:return this.logger.error("Received 2xx response to INVITE without a session description"),this.ackAndBye(e,400,"Missing session description"),this.stateTransition(B.Terminated),Promise.reject(new Error("Bad Media Description"));case U.HaveRemoteOffer:{if(!this._dialog.offer)throw new Error(`Session offer undefined in signaling state ${this._dialog.signalingState}.`);const i={sessionDescriptionHandlerModifiers:this.sessionDescriptionHandlerModifiers,sessionDescriptionHandlerOptions:this.sessionDescriptionHandlerOptions};return this.setOfferAndGetAnswer(this._dialog.offer,i).then(n=>{e.ack({body:n}),this.stateTransition(B.Established)}).catch(n=>{throw this.ackAndBye(e,488,"Invalid session description"),this.stateTransition(B.Terminated),n})}case U.Stable:{if(this.earlyMediaSessionDescriptionHandlers.size>0){const a=this.earlyMediaSessionDescriptionHandlers.get(r.id);if(!a)throw new Error("Session description handler undefined.");return this.setSessionDescriptionHandler(a),this.earlyMediaSessionDescriptionHandlers.delete(r.id),e.ack(),this.stateTransition(B.Established),Promise.resolve()}if(this.earlyMediaDialog){if(this.earlyMediaDialog!==r){this.earlyMedia&&this.logger.error("You have set the 'earlyMedia' option to 'true' which requires that your INVITE requests do not fork and yet this INVITE request did in fact fork. Consequentially and not surprisingly the end point which accepted the INVITE (confirmed dialog) does not match the end point with which early media has been setup (early dialog) and thus this session is unable to proceed. In accordance with the SIP specifications, the SIP servers your end point is connected to determine if an INVITE forks and the forking behavior of those servers cannot be controlled by this library. If you wish to use early media with this library you must configure those servers accordingly. Alternatively you may set the 'earlyMedia' to 'false' which will allow this library to function with any INVITE requests which do fork.");const a=new Error("Early media dialog does not equal confirmed dialog, terminating session");return this.logger.error(a.message),this.ackAndBye(e,488,"Not Acceptable Here"),this.stateTransition(B.Terminated),Promise.reject(a)}return e.ack(),this.stateTransition(B.Established),Promise.resolve()}const i=r.answer;if(!i)throw new Error("Answer is undefined.");const n={sessionDescriptionHandlerModifiers:this.sessionDescriptionHandlerModifiers,sessionDescriptionHandlerOptions:this.sessionDescriptionHandlerOptions};return this.setAnswer(i,n).then(()=>{let a;this._renderbody&&this._rendertype&&(a={body:{contentDisposition:"render",contentType:this._rendertype,content:this._renderbody}}),e.ack(a),this.stateTransition(B.Established)}).catch(a=>{throw this.logger.error(a.message),this.ackAndBye(e,488,"Not Acceptable Here"),this.stateTransition(B.Terminated),a})}case U.Closed:return Promise.reject(new Error("Terminated."));default:throw new Error("Unknown session signaling state.")}}onProgress(e){var t;if(this.logger.log("Inviter.onProgress"),this.state!==B.Establishing)return this.logger.error(`Progress received while in state ${this.state}, dropping response`),Promise.reject(new Error(`Invalid session state ${this.state}`));if(!this.outgoingInviteRequest)throw new Error("Outgoing INVITE request undefined.");const r=e.message,i=e.session;r.hasHeader("P-Asserted-Identity")&&(this._assertedIdentity=Ae.nameAddrHeaderParse(r.getHeader("P-Asserted-Identity")));const n=r.getHeader("require"),a=r.getHeader("rseq"),d=!!(n&&n.includes("100rel")&&a?Number(a):void 0),c=[];switch(d&&c.push("RAck: "+r.getHeader("rseq")+" "+r.getHeader("cseq")),i.signalingState){case U.Initial:return d&&(this.logger.warn("First reliable provisional response received MUST contain an offer when INVITE does not contain an offer."),e.prack({extraHeaders:c})),Promise.resolve();case U.HaveLocalOffer:return d&&e.prack({extraHeaders:c}),Promise.resolve();case U.HaveRemoteOffer:if(!d)return this.logger.warn("Non-reliable provisional response MUST NOT contain an initial offer, discarding response."),Promise.resolve();{const l=this.sessionDescriptionHandlerFactory(this,this.userAgent.configuration.sessionDescriptionHandlerFactoryOptions||{});return!((t=this.delegate)===null||t===void 0)&&t.onSessionDescriptionHandler&&this.delegate.onSessionDescriptionHandler(l,!0),this.earlyMediaSessionDescriptionHandlers.set(i.id,l),l.setDescription(r.body,this.sessionDescriptionHandlerOptions,this.sessionDescriptionHandlerModifiers).then(()=>l.getDescription(this.sessionDescriptionHandlerOptions,this.sessionDescriptionHandlerModifiers)).then(g=>{const u={contentDisposition:"session",contentType:g.contentType,content:g.body};e.prack({extraHeaders:c,body:u})}).catch(g=>{throw this.stateTransition(B.Terminated),g})}case U.Stable:if(d&&e.prack({extraHeaders:c}),this.earlyMedia&&!this.earlyMediaDialog){this.earlyMediaDialog=i;const l=i.answer;if(!l)throw new Error("Answer is undefined.");const g={sessionDescriptionHandlerModifiers:this.sessionDescriptionHandlerModifiers,sessionDescriptionHandlerOptions:this.sessionDescriptionHandlerOptions};return this.setAnswer(l,g).catch(u=>{throw this.stateTransition(B.Terminated),u})}return Promise.resolve();case U.Closed:return Promise.reject(new Error("Terminated."));default:throw new Error("Unknown session signaling state.")}}onRedirect(e){if(this.logger.log("Inviter.onRedirect"),this.state!==B.Establishing&&this.state!==B.Terminating){this.logger.error(`Redirect received while in state ${this.state}, dropping response`);return}this.stateTransition(B.Terminated)}onReject(e){if(this.logger.log("Inviter.onReject"),this.state!==B.Establishing&&this.state!==B.Terminating){this.logger.error(`Reject received while in state ${this.state}, dropping response`);return}this.stateTransition(B.Terminated)}onTrying(e){if(this.logger.log("Inviter.onTrying"),this.state!==B.Establishing){this.logger.error(`Trying received while in state ${this.state}, dropping response`);return}}}var le;(function(s){s.Initial="Initial",s.Registered="Registered",s.Unregistered="Unregistered",s.Terminated="Terminated"})(le=le||(le={}));class ut{constructor(e,t={}){this.disposed=!1,this._contacts=[],this._retryAfter=void 0,this._state=le.Initial,this._waiting=!1,this._stateEventEmitter=new kr,this._waitingEventEmitter=new kr,this.userAgent=e;const r=e.configuration.uri.clone();if(r.user=void 0,this.options=Object.assign(Object.assign(Object.assign({},ut.defaultOptions()),{registrar:r}),ut.stripUndefinedProperties(t)),this.options.extraContactHeaderParams=(this.options.extraContactHeaderParams||[]).slice(),this.options.extraHeaders=(this.options.extraHeaders||[]).slice(),!this.options.registrar)throw new Error("Registrar undefined.");if(this.options.registrar=this.options.registrar.clone(),this.options.regId&&!this.options.instanceId?this.options.instanceId=this.userAgent.instanceId:!this.options.regId&&this.options.instanceId&&(this.options.regId=1),this.options.instanceId&&Ae.parse(this.options.instanceId,"uuid")===-1)throw new Error("Invalid instanceId.");if(this.options.regId&&this.options.regId<0)throw new Error("Invalid regId.");const i=this.options.registrar,n=this.options.params&&this.options.params.fromUri||e.userAgentCore.configuration.aor,a=this.options.params&&this.options.params.toUri||e.configuration.uri,o=this.options.params||{},d=(t.extraHeaders||[]).slice();if(this.request=e.userAgentCore.makeOutgoingRequestMessage(j.REGISTER,i,n,a,o,d,void 0),this.expires=this.options.expires||ut.defaultExpires,this.expires<0)throw new Error("Invalid expires.");if(this.refreshFrequency=this.options.refreshFrequency||ut.defaultRefreshFrequency,this.refreshFrequency<50||this.refreshFrequency>99)throw new Error("Invalid refresh frequency. The value represents a percentage of the expiration time and should be between 50 and 99.");this.logger=e.getLogger("sip.Registerer"),this.options.logConfiguration&&(this.logger.log("Configuration:"),Object.keys(this.options).forEach(c=>{const l=this.options[c];switch(c){case"registrar":this.logger.log("· "+c+": "+l);break;default:this.logger.log("· "+c+": "+JSON.stringify(l))}})),this.id=this.request.callId+this.request.from.parameters.tag,this.userAgent._registerers[this.id]=this}static defaultOptions(){return{expires:ut.defaultExpires,extraContactHeaderParams:[],extraHeaders:[],logConfiguration:!0,instanceId:"",params:{},regId:0,registrar:new lt("sip","anonymous","anonymous.invalid"),refreshFrequency:ut.defaultRefreshFrequency}}static stripUndefinedProperties(e){return Object.keys(e).reduce((t,r)=>(e[r]!==void 0&&(t[r]=e[r]),t),{})}get contacts(){return this._contacts.slice()}get retryAfter(){return this._retryAfter}get state(){return this._state}get stateChange(){return this._stateEventEmitter}dispose(){return this.disposed?Promise.resolve():(this.disposed=!0,this.logger.log(`Registerer ${this.id} in state ${this.state} is being disposed`),delete this.userAgent._registerers[this.id],new Promise(e=>{const t=()=>{if(!this.waiting&&this._state===le.Registered){this.stateChange.addListener(()=>{this.terminated(),e()},{once:!0}),this.unregister();return}this.terminated(),e()};this.waiting?this.waitingChange.addListener(()=>{t()},{once:!0}):t()}))}register(e={}){if(this.state===le.Terminated)throw this.stateError(),new Error("Registerer terminated. Unable to register.");if(this.disposed)throw this.stateError(),new Error("Registerer disposed. Unable to register.");if(this.waiting){this.waitingWarning();const i=new Ls("REGISTER request already in progress, waiting for final response");return Promise.reject(i)}e.requestOptions&&(this.options=Object.assign(Object.assign({},this.options),e.requestOptions));const t=(this.options.extraHeaders||[]).slice();t.push("Contact: "+this.generateContactHeader(this.expires)),t.push("Allow: "+["ACK","CANCEL","INVITE","MESSAGE","BYE","OPTIONS","INFO","NOTIFY","REFER"].toString()),this.request.cseq++,this.request.setHeader("cseq",this.request.cseq+" REGISTER"),this.request.extraHeaders=t,this.waitingToggle(!0);const r=this.userAgent.userAgentCore.register(this.request,{onAccept:i=>{let n;i.message.hasHeader("expires")&&(n=Number(i.message.getHeader("expires"))),this._contacts=i.message.getHeaders("contact");let a=this._contacts.length;if(!a){this.logger.error("No Contact header in response to REGISTER, dropping response."),this.unregistered();return}let o;for(;a--;){if(o=i.message.parseHeader("contact",a),!o)throw new Error("Contact undefined");if(this.userAgent.contact.pubGruu&&Cn(o.uri,this.userAgent.contact.pubGruu)){n=Number(o.getParam("expires"));break}if(this.userAgent.configuration.contactName===""){if(o.uri.user===this.userAgent.contact.uri.user){n=Number(o.getParam("expires"));break}}else if(Cn(o.uri,this.userAgent.contact.uri)){n=Number(o.getParam("expires"));break}o=void 0}if(o===void 0){this.logger.error("No Contact header pointing to us, dropping response"),this.unregistered(),this.waitingToggle(!1);return}if(n===void 0){this.logger.error("Contact pointing to us is missing expires parameter, dropping response"),this.unregistered(),this.waitingToggle(!1);return}if(o.hasParam("temp-gruu")){const d=o.getParam("temp-gruu");d&&(this.userAgent.contact.tempGruu=Ae.URIParse(d.replace(/"/g,"")))}if(o.hasParam("pub-gruu")){const d=o.getParam("pub-gruu");d&&(this.userAgent.contact.pubGruu=Ae.URIParse(d.replace(/"/g,"")))}this.registered(n),e.requestDelegate&&e.requestDelegate.onAccept&&e.requestDelegate.onAccept(i),this.waitingToggle(!1)},onProgress:i=>{e.requestDelegate&&e.requestDelegate.onProgress&&e.requestDelegate.onProgress(i)},onRedirect:i=>{this.logger.error("Redirect received. Not supported."),this.unregistered(),e.requestDelegate&&e.requestDelegate.onRedirect&&e.requestDelegate.onRedirect(i),this.waitingToggle(!1)},onReject:i=>{if(i.message.statusCode===423){if(!i.message.hasHeader("min-expires")){this.logger.error("423 response received for REGISTER without Min-Expires, dropping response"),this.unregistered(),this.waitingToggle(!1);return}this.expires=Number(i.message.getHeader("min-expires")),this.waitingToggle(!1),this.register();return}this.logger.warn(`Failed to register, status code ${i.message.statusCode}`);let n=NaN;if(i.message.statusCode===500||i.message.statusCode===503){const a=i.message.getHeader("retry-after");a&&(n=Number.parseInt(a,void 0))}this._retryAfter=isNaN(n)?void 0:n,this.unregistered(),e.requestDelegate&&e.requestDelegate.onReject&&e.requestDelegate.onReject(i),this._retryAfter=void 0,this.waitingToggle(!1)},onTrying:i=>{e.requestDelegate&&e.requestDelegate.onTrying&&e.requestDelegate.onTrying(i)}});return Promise.resolve(r)}unregister(e={}){if(this.state===le.Terminated)throw this.stateError(),new Error("Registerer terminated. Unable to register.");if(this.disposed&&this.state!==le.Registered)throw this.stateError(),new Error("Registerer disposed. Unable to register.");if(this.waiting){this.waitingWarning();const i=new Ls("REGISTER request already in progress, waiting for final response");return Promise.reject(i)}this._state!==le.Registered&&!e.all&&this.logger.warn("Not currently registered, but sending an unregister anyway.");const t=(e.requestOptions&&e.requestOptions.extraHeaders||[]).slice();this.request.extraHeaders=t,e.all?(t.push("Contact: *"),t.push("Expires: 0")):t.push("Contact: "+this.generateContactHeader(0)),this.request.cseq++,this.request.setHeader("cseq",this.request.cseq+" REGISTER"),this.registrationTimer!==void 0&&(clearTimeout(this.registrationTimer),this.registrationTimer=void 0),this.waitingToggle(!0);const r=this.userAgent.userAgentCore.register(this.request,{onAccept:i=>{this._contacts=i.message.getHeaders("contact"),this.unregistered(),e.requestDelegate&&e.requestDelegate.onAccept&&e.requestDelegate.onAccept(i),this.waitingToggle(!1)},onProgress:i=>{e.requestDelegate&&e.requestDelegate.onProgress&&e.requestDelegate.onProgress(i)},onRedirect:i=>{this.logger.error("Unregister redirected. Not currently supported."),this.unregistered(),e.requestDelegate&&e.requestDelegate.onRedirect&&e.requestDelegate.onRedirect(i),this.waitingToggle(!1)},onReject:i=>{this.logger.error(`Unregister rejected with status code ${i.message.statusCode}`),this.unregistered(),e.requestDelegate&&e.requestDelegate.onReject&&e.requestDelegate.onReject(i),this.waitingToggle(!1)},onTrying:i=>{e.requestDelegate&&e.requestDelegate.onTrying&&e.requestDelegate.onTrying(i)}});return Promise.resolve(r)}clearTimers(){this.registrationTimer!==void 0&&(clearTimeout(this.registrationTimer),this.registrationTimer=void 0),this.registrationExpiredTimer!==void 0&&(clearTimeout(this.registrationExpiredTimer),this.registrationExpiredTimer=void 0)}generateContactHeader(e){let t=this.userAgent.contact.toString({register:!0});return this.options.regId&&this.options.instanceId&&(t+=";reg-id="+this.options.regId,t+=';+sip.instance="<urn:uuid:'+this.options.instanceId+'>"'),this.options.extraContactHeaderParams&&this.options.extraContactHeaderParams.forEach(r=>{t+=";"+r}),t+=";expires="+e,t}registered(e){this.clearTimers(),this.registrationTimer=setTimeout(()=>{this.registrationTimer=void 0,this.register()},this.refreshFrequency/100*e*1e3),this.registrationExpiredTimer=setTimeout(()=>{this.logger.warn("Registration expired"),this.unregistered()},e*1e3),this._state!==le.Registered&&this.stateTransition(le.Registered)}unregistered(){this.clearTimers(),this._state!==le.Unregistered&&this.stateTransition(le.Unregistered)}terminated(){this.clearTimers(),this._state!==le.Terminated&&this.stateTransition(le.Terminated)}stateTransition(e){const t=()=>{throw new Error(`Invalid state transition from ${this._state} to ${e}`)};switch(this._state){case le.Initial:e!==le.Registered&&e!==le.Unregistered&&e!==le.Terminated&&t();break;case le.Registered:e!==le.Unregistered&&e!==le.Terminated&&t();break;case le.Unregistered:e!==le.Registered&&e!==le.Terminated&&t();break;case le.Terminated:t();break;default:throw new Error("Unrecognized state.")}this._state=e,this.logger.log(`Registration transitioned to state ${this._state}`),this._stateEventEmitter.emit(this._state),e===le.Terminated&&this.dispose()}get waiting(){return this._waiting}get waitingChange(){return this._waitingEventEmitter}waitingToggle(e){if(this._waiting===e)throw new Error(`Invalid waiting transition from ${this._waiting} to ${e}`);this._waiting=e,this.logger.log(`Waiting toggled to ${this._waiting}`),this._waitingEventEmitter.emit(this._waiting)}waitingWarning(){let e="An attempt was made to send a REGISTER request while a prior one was still in progress.";e+=" RFC 3261 requires UAs MUST NOT send a new registration until they have received a final response",e+=" from the registrar for the previous one or the previous REGISTER request has timed out.",e+=" Note that if the transport disconnects, you still must wait for the prior request to time out before",e+=" sending a new REGISTER request or alternatively dispose of the current Registerer and create a new Registerer.",this.logger.warn(e)}stateError(){let t=`An attempt was made to send a REGISTER request when the Registerer ${this.state===le.Terminated?"is in 'Terminated' state":"has been disposed"}.`;t+=" The Registerer transitions to 'Terminated' when Registerer.dispose() is called.",t+=" Perhaps you called UserAgent.stop() which dipsoses of all Registerers?",this.logger.error(t)}}ut.defaultExpires=600,ut.defaultRefreshFrequency=99;var oe;(function(s){s.Initial="Initial",s.NotifyWait="NotifyWait",s.Pending="Pending",s.Active="Active",s.Terminated="Terminated"})(oe=oe||(oe={}));var K;(function(s){s.Connecting="Connecting",s.Connected="Connected",s.Disconnecting="Disconnecting",s.Disconnected="Disconnected"})(K=K||(K={}));var Ie;(function(s){s.Started="Started",s.Stopped="Stopped"})(Ie=Ie||(Ie={}));class De{constructor(){this._dataLength=0,this._bufferLength=0,this._state=new Int32Array(4),this._buffer=new ArrayBuffer(68),this._buffer8=new Uint8Array(this._buffer,0,68),this._buffer32=new Uint32Array(this._buffer,0,17),this.start()}static hashStr(e,t=!1){return this.onePassHasher.start().appendStr(e).end(t)}static hashAsciiStr(e,t=!1){return this.onePassHasher.start().appendAsciiStr(e).end(t)}static _hex(e){const t=De.hexChars,r=De.hexOut;let i,n,a,o;for(o=0;o<4;o+=1)for(n=o*8,i=e[o],a=0;a<8;a+=2)r[n+1+a]=t.charAt(i&15),i>>>=4,r[n+0+a]=t.charAt(i&15),i>>>=4;return r.join("")}static _md5cycle(e,t){let r=e[0],i=e[1],n=e[2],a=e[3];r+=(i&n|~i&a)+t[0]-680876936|0,r=(r<<7|r>>>25)+i|0,a+=(r&i|~r&n)+t[1]-389564586|0,a=(a<<12|a>>>20)+r|0,n+=(a&r|~a&i)+t[2]+606105819|0,n=(n<<17|n>>>15)+a|0,i+=(n&a|~n&r)+t[3]-1044525330|0,i=(i<<22|i>>>10)+n|0,r+=(i&n|~i&a)+t[4]-176418897|0,r=(r<<7|r>>>25)+i|0,a+=(r&i|~r&n)+t[5]+1200080426|0,a=(a<<12|a>>>20)+r|0,n+=(a&r|~a&i)+t[6]-1473231341|0,n=(n<<17|n>>>15)+a|0,i+=(n&a|~n&r)+t[7]-45705983|0,i=(i<<22|i>>>10)+n|0,r+=(i&n|~i&a)+t[8]+1770035416|0,r=(r<<7|r>>>25)+i|0,a+=(r&i|~r&n)+t[9]-1958414417|0,a=(a<<12|a>>>20)+r|0,n+=(a&r|~a&i)+t[10]-42063|0,n=(n<<17|n>>>15)+a|0,i+=(n&a|~n&r)+t[11]-1990404162|0,i=(i<<22|i>>>10)+n|0,r+=(i&n|~i&a)+t[12]+1804603682|0,r=(r<<7|r>>>25)+i|0,a+=(r&i|~r&n)+t[13]-40341101|0,a=(a<<12|a>>>20)+r|0,n+=(a&r|~a&i)+t[14]-1502002290|0,n=(n<<17|n>>>15)+a|0,i+=(n&a|~n&r)+t[15]+1236535329|0,i=(i<<22|i>>>10)+n|0,r+=(i&a|n&~a)+t[1]-165796510|0,r=(r<<5|r>>>27)+i|0,a+=(r&n|i&~n)+t[6]-1069501632|0,a=(a<<9|a>>>23)+r|0,n+=(a&i|r&~i)+t[11]+643717713|0,n=(n<<14|n>>>18)+a|0,i+=(n&r|a&~r)+t[0]-373897302|0,i=(i<<20|i>>>12)+n|0,r+=(i&a|n&~a)+t[5]-701558691|0,r=(r<<5|r>>>27)+i|0,a+=(r&n|i&~n)+t[10]+38016083|0,a=(a<<9|a>>>23)+r|0,n+=(a&i|r&~i)+t[15]-660478335|0,n=(n<<14|n>>>18)+a|0,i+=(n&r|a&~r)+t[4]-405537848|0,i=(i<<20|i>>>12)+n|0,r+=(i&a|n&~a)+t[9]+568446438|0,r=(r<<5|r>>>27)+i|0,a+=(r&n|i&~n)+t[14]-1019803690|0,a=(a<<9|a>>>23)+r|0,n+=(a&i|r&~i)+t[3]-187363961|0,n=(n<<14|n>>>18)+a|0,i+=(n&r|a&~r)+t[8]+1163531501|0,i=(i<<20|i>>>12)+n|0,r+=(i&a|n&~a)+t[13]-1444681467|0,r=(r<<5|r>>>27)+i|0,a+=(r&n|i&~n)+t[2]-51403784|0,a=(a<<9|a>>>23)+r|0,n+=(a&i|r&~i)+t[7]+1735328473|0,n=(n<<14|n>>>18)+a|0,i+=(n&r|a&~r)+t[12]-1926607734|0,i=(i<<20|i>>>12)+n|0,r+=(i^n^a)+t[5]-378558|0,r=(r<<4|r>>>28)+i|0,a+=(r^i^n)+t[8]-2022574463|0,a=(a<<11|a>>>21)+r|0,n+=(a^r^i)+t[11]+1839030562|0,n=(n<<16|n>>>16)+a|0,i+=(n^a^r)+t[14]-35309556|0,i=(i<<23|i>>>9)+n|0,r+=(i^n^a)+t[1]-1530992060|0,r=(r<<4|r>>>28)+i|0,a+=(r^i^n)+t[4]+1272893353|0,a=(a<<11|a>>>21)+r|0,n+=(a^r^i)+t[7]-155497632|0,n=(n<<16|n>>>16)+a|0,i+=(n^a^r)+t[10]-1094730640|0,i=(i<<23|i>>>9)+n|0,r+=(i^n^a)+t[13]+681279174|0,r=(r<<4|r>>>28)+i|0,a+=(r^i^n)+t[0]-358537222|0,a=(a<<11|a>>>21)+r|0,n+=(a^r^i)+t[3]-722521979|0,n=(n<<16|n>>>16)+a|0,i+=(n^a^r)+t[6]+76029189|0,i=(i<<23|i>>>9)+n|0,r+=(i^n^a)+t[9]-640364487|0,r=(r<<4|r>>>28)+i|0,a+=(r^i^n)+t[12]-421815835|0,a=(a<<11|a>>>21)+r|0,n+=(a^r^i)+t[15]+530742520|0,n=(n<<16|n>>>16)+a|0,i+=(n^a^r)+t[2]-995338651|0,i=(i<<23|i>>>9)+n|0,r+=(n^(i|~a))+t[0]-198630844|0,r=(r<<6|r>>>26)+i|0,a+=(i^(r|~n))+t[7]+1126891415|0,a=(a<<10|a>>>22)+r|0,n+=(r^(a|~i))+t[14]-1416354905|0,n=(n<<15|n>>>17)+a|0,i+=(a^(n|~r))+t[5]-57434055|0,i=(i<<21|i>>>11)+n|0,r+=(n^(i|~a))+t[12]+1700485571|0,r=(r<<6|r>>>26)+i|0,a+=(i^(r|~n))+t[3]-1894986606|0,a=(a<<10|a>>>22)+r|0,n+=(r^(a|~i))+t[10]-1051523|0,n=(n<<15|n>>>17)+a|0,i+=(a^(n|~r))+t[1]-2054922799|0,i=(i<<21|i>>>11)+n|0,r+=(n^(i|~a))+t[8]+1873313359|0,r=(r<<6|r>>>26)+i|0,a+=(i^(r|~n))+t[15]-30611744|0,a=(a<<10|a>>>22)+r|0,n+=(r^(a|~i))+t[6]-1560198380|0,n=(n<<15|n>>>17)+a|0,i+=(a^(n|~r))+t[13]+1309151649|0,i=(i<<21|i>>>11)+n|0,r+=(n^(i|~a))+t[4]-145523070|0,r=(r<<6|r>>>26)+i|0,a+=(i^(r|~n))+t[11]-1120210379|0,a=(a<<10|a>>>22)+r|0,n+=(r^(a|~i))+t[2]+718787259|0,n=(n<<15|n>>>17)+a|0,i+=(a^(n|~r))+t[9]-343485551|0,i=(i<<21|i>>>11)+n|0,e[0]=r+e[0]|0,e[1]=i+e[1]|0,e[2]=n+e[2]|0,e[3]=a+e[3]|0}start(){return this._dataLength=0,this._bufferLength=0,this._state.set(De.stateIdentity),this}appendStr(e){const t=this._buffer8,r=this._buffer32;let i=this._bufferLength,n,a;for(a=0;a<e.length;a+=1){if(n=e.charCodeAt(a),n<128)t[i++]=n;else if(n<2048)t[i++]=(n>>>6)+192,t[i++]=n&63|128;else if(n<55296||n>56319)t[i++]=(n>>>12)+224,t[i++]=n>>>6&63|128,t[i++]=n&63|128;else{if(n=(n-55296)*1024+(e.charCodeAt(++a)-56320)+65536,n>1114111)throw new Error("Unicode standard supports code points up to U+10FFFF");t[i++]=(n>>>18)+240,t[i++]=n>>>12&63|128,t[i++]=n>>>6&63|128,t[i++]=n&63|128}i>=64&&(this._dataLength+=64,De._md5cycle(this._state,r),i-=64,r[0]=r[16])}return this._bufferLength=i,this}appendAsciiStr(e){const t=this._buffer8,r=this._buffer32;let i=this._bufferLength,n,a=0;for(;;){for(n=Math.min(e.length-a,64-i);n--;)t[i++]=e.charCodeAt(a++);if(i<64)break;this._dataLength+=64,De._md5cycle(this._state,r),i=0}return this._bufferLength=i,this}appendByteArray(e){const t=this._buffer8,r=this._buffer32;let i=this._bufferLength,n,a=0;for(;;){for(n=Math.min(e.length-a,64-i);n--;)t[i++]=e[a++];if(i<64)break;this._dataLength+=64,De._md5cycle(this._state,r),i=0}return this._bufferLength=i,this}getState(){const e=this,t=e._state;return{buffer:String.fromCharCode.apply(null,e._buffer8),buflen:e._bufferLength,length:e._dataLength,state:[t[0],t[1],t[2],t[3]]}}setState(e){const t=e.buffer,r=e.state,i=this._state;let n;for(this._dataLength=e.length,this._bufferLength=e.buflen,i[0]=r[0],i[1]=r[1],i[2]=r[2],i[3]=r[3],n=0;n<t.length;n+=1)this._buffer8[n]=t.charCodeAt(n)}end(e=!1){const t=this._bufferLength,r=this._buffer8,i=this._buffer32,n=(t>>2)+1;let a;if(this._dataLength+=t,r[t]=128,r[t+1]=r[t+2]=r[t+3]=0,i.set(De.buffer32Identity.subarray(n),n),t>55&&(De._md5cycle(this._state,i),i.set(De.buffer32Identity)),a=this._dataLength*8,a<=4294967295)i[14]=a;else{const o=a.toString(16).match(/(.*?)(.{0,8})$/);if(o===null)return;const d=parseInt(o[2],16),c=parseInt(o[1],16)||0;i[14]=d,i[15]=c}return De._md5cycle(this._state,i),e?this._state:De._hex(this._state)}}De.stateIdentity=new Int32Array([1732584193,-271733879,-1732584194,271733878]),De.buffer32Identity=new Int32Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]),De.hexChars="0123456789abcdef",De.hexOut=[],De.onePassHasher=new De,De.hashStr("hello")!=="5d41402abc4b2a76b9719d911017c592"&&console.error("Md5 self test failed.");function Mt(s){return De.hashStr(s)}class Mo{constructor(e,t,r,i){this.logger=e.getLogger("sipjs.digestauthentication"),this.username=r,this.password=i,this.ha1=t,this.nc=0,this.ncHex="00000000"}authenticate(e,t,r){if(this.algorithm=t.algorithm,this.realm=t.realm,this.nonce=t.nonce,this.opaque=t.opaque,this.stale=t.stale,this.algorithm){if(this.algorithm!=="MD5")return this.logger.warn("challenge with Digest algorithm different than 'MD5', authentication aborted"),!1}else this.algorithm="MD5";if(!this.realm)return this.logger.warn("challenge without Digest realm, authentication aborted"),!1;if(!this.nonce)return this.logger.warn("challenge without Digest nonce, authentication aborted"),!1;if(t.qop)if(t.qop.indexOf("auth")>-1)this.qop="auth";else if(t.qop.indexOf("auth-int")>-1)this.qop="auth-int";else return this.logger.warn("challenge without Digest qop different than 'auth' or 'auth-int', authentication aborted"),!1;else this.qop=void 0;return this.method=e.method,this.uri=e.ruri,this.cnonce=Jt(12),this.nc+=1,this.updateNcHex(),this.nc===4294967296&&(this.nc=1,this.ncHex="00000001"),this.calculateResponse(r),!0}toString(){const e=[];if(!this.response)throw new Error("response field does not exist, cannot generate Authorization header");return e.push("algorithm="+this.algorithm),e.push('username="'+this.username+'"'),e.push('realm="'+this.realm+'"'),e.push('nonce="'+this.nonce+'"'),e.push('uri="'+this.uri+'"'),e.push('response="'+this.response+'"'),this.opaque&&e.push('opaque="'+this.opaque+'"'),this.qop&&(e.push("qop="+this.qop),e.push('cnonce="'+this.cnonce+'"'),e.push("nc="+this.ncHex)),"Digest "+e.join(", ")}updateNcHex(){const e=Number(this.nc).toString(16);this.ncHex="00000000".substr(0,8-e.length)+e}calculateResponse(e){let t,r;t=this.ha1,(t===""||t===void 0)&&(t=Mt(this.username+":"+this.realm+":"+this.password)),this.qop==="auth"?(r=Mt(this.method+":"+this.uri),this.response=Mt(t+":"+this.nonce+":"+this.ncHex+":"+this.cnonce+":auth:"+r)):this.qop==="auth-int"?(r=Mt(this.method+":"+this.uri+":"+Mt(e||"")),this.response=Mt(t+":"+this.nonce+":"+this.ncHex+":"+this.cnonce+":auth-int:"+r)):this.qop===void 0&&(r=Mt(this.method+":"+this.uri),this.response=Mt(t+":"+this.nonce+":"+r))}}var Fe;(function(s){s[s.error=0]="error",s[s.warn=1]="warn",s[s.log=2]="log",s[s.debug=3]="debug"})(Fe=Fe||(Fe={}));class Rn{constructor(e,t,r){this.logger=e,this.category=t,this.label=r}error(e){this.genericLog(Fe.error,e)}warn(e){this.genericLog(Fe.warn,e)}log(e){this.genericLog(Fe.log,e)}debug(e){this.genericLog(Fe.debug,e)}genericLog(e,t){this.logger.genericLog(e,this.category,this.label,t)}get level(){return this.logger.level}set level(e){this.logger.level=e}}class No{constructor(){this.builtinEnabled=!0,this._level=Fe.log,this.loggers={},this.logger=this.getLogger("sip:loggerfactory")}get level(){return this._level}set level(e){e>=0&&e<=3?this._level=e:e>3?this._level=3:Fe.hasOwnProperty(e)?this._level=e:this.logger.error("invalid 'level' parameter value: "+JSON.stringify(e))}get connector(){return this._connector}set connector(e){e?typeof e=="function"?this._connector=e:this.logger.error("invalid 'connector' parameter value: "+JSON.stringify(e)):this._connector=void 0}getLogger(e,t){if(t&&this.level===3)return new Rn(this,e,t);if(this.loggers[e])return this.loggers[e];{const r=new Rn(this,e);return this.loggers[e]=r,r}}genericLog(e,t,r,i){this.level>=e&&this.builtinEnabled&&this.print(e,t,r,i),this.connector&&this.connector(Fe[e],t,r,i)}print(e,t,r,i){if(typeof i=="string"){const n=[new Date,t];r&&n.push(r),i=n.concat(i).join(" | ")}switch(e){case Fe.error:console.error(i);break;case Fe.warn:console.warn(i);break;case Fe.log:console.log(i);break;case Fe.debug:console.debug(i);break}}}var rs;(function(s){function e(i,n){let a=n,o=0,d=0;if(i.substring(a,a+2).match(/(^\r\n)/))return-2;for(;o===0;){if(d=i.indexOf(`\r
|
|
53
|
+
`,a),d===-1)return d;!i.substring(d+2,d+4).match(/(^\r\n)/)&&i.charAt(d+2).match(/(^\s+)/)?a=d+2:o=d}return o}s.getHeader=e;function t(i,n,a,o){const d=n.indexOf(":",a),c=n.substring(a,d).trim(),l=n.substring(d+1,o).trim();let g;switch(c.toLowerCase()){case"via":case"v":i.addHeader("via",l),i.getHeaders("via").length===1?(g=i.parseHeader("Via"),g&&(i.via=g,i.viaBranch=g.branch)):g=0;break;case"from":case"f":i.setHeader("from",l),g=i.parseHeader("from"),g&&(i.from=g,i.fromTag=g.getParam("tag"));break;case"to":case"t":i.setHeader("to",l),g=i.parseHeader("to"),g&&(i.to=g,i.toTag=g.getParam("tag"));break;case"record-route":if(g=Ae.parse(l,"Record_Route"),g===-1){g=void 0;break}if(!(g instanceof Array)){g=void 0;break}g.forEach(u=>{i.addHeader("record-route",l.substring(u.position,u.offset)),i.headers["Record-Route"][i.getHeaders("record-route").length-1].parsed=u.parsed});break;case"call-id":case"i":i.setHeader("call-id",l),g=i.parseHeader("call-id"),g&&(i.callId=l);break;case"contact":case"m":if(g=Ae.parse(l,"Contact"),g===-1){g=void 0;break}if(!(g instanceof Array)){g=void 0;break}g.forEach(u=>{i.addHeader("contact",l.substring(u.position,u.offset)),i.headers.Contact[i.getHeaders("contact").length-1].parsed=u.parsed});break;case"content-length":case"l":i.setHeader("content-length",l),g=i.parseHeader("content-length");break;case"content-type":case"c":i.setHeader("content-type",l),g=i.parseHeader("content-type");break;case"cseq":i.setHeader("cseq",l),g=i.parseHeader("cseq"),g&&(i.cseq=g.value),i instanceof Ht&&(i.method=g.method);break;case"max-forwards":i.setHeader("max-forwards",l),g=i.parseHeader("max-forwards");break;case"www-authenticate":i.setHeader("www-authenticate",l),g=i.parseHeader("www-authenticate");break;case"proxy-authenticate":i.setHeader("proxy-authenticate",l),g=i.parseHeader("proxy-authenticate");break;case"refer-to":case"r":i.setHeader("refer-to",l),g=i.parseHeader("refer-to"),g&&(i.referTo=g);break;default:i.addHeader(c.toLowerCase(),l),g=0}return g===void 0?{error:"error parsing header '"+c+"'"}:!0}s.parseHeader=t;function r(i,n){let a=0,o=i.indexOf(`\r
|
|
54
|
+
`);if(o===-1){n.warn("no CRLF found, not a SIP message, discarded");return}const d=i.substring(0,o),c=Ae.parse(d,"Request_Response");let l;if(c===-1){n.warn('error parsing first line of SIP message: "'+d+'"');return}else c.status_code?(l=new Ht,l.statusCode=c.status_code,l.reasonPhrase=c.reason_phrase):(l=new fr,l.method=c.method,l.ruri=c.uri);l.data=i,a=o+2;let g;for(;;){if(o=e(i,a),o===-2){g=a+2;break}else if(o===-1){n.error("malformed message");return}const u=t(l,i,a,o);if(u&&u!==!0){n.error(u.error);return}a=o+2}return l.hasHeader("content-length")?l.body=i.substr(g,Number(l.getHeader("content-length"))):l.body=i.substring(g),l}s.parseMessage=r})(rs=rs||(rs={}));function Fn(s,e){const t=`\r
|
|
55
|
+
`;if(e.statusCode<100||e.statusCode>699)throw new TypeError("Invalid statusCode: "+e.statusCode);const r=e.reasonPhrase?e.reasonPhrase:Qr(e.statusCode);let i="SIP/2.0 "+e.statusCode+" "+r+t;e.statusCode>=100&&e.statusCode<200,e.statusCode;const n="From: "+s.getHeader("From")+t,a="Call-ID: "+s.callId+t,o="CSeq: "+s.cseq+" "+s.method+t,d=s.getHeaders("via").reduce((y,v)=>y+"Via: "+v+t,"");let c="To: "+s.getHeader("to");if(e.statusCode>100&&!s.parseHeader("to").hasParam("tag")){let y=e.toTag;y||(y=es()),c+=";tag="+y}c+=t;let l="";e.supported&&(l="Supported: "+e.supported.join(", ")+t);let g="";e.userAgent&&(g="User-Agent: "+e.userAgent+t);let u="";return e.extraHeaders&&(u=e.extraHeaders.reduce((y,v)=>y+v.trim()+t,"")),i+=d,i+=n,i+=c,i+=o,i+=a,i+=l,i+=g,i+=u,e.body?(i+="Content-Type: "+e.body.contentType+t,i+="Content-Length: "+Ir(e.body.content)+t+t,i+=e.body.content):i+="Content-Length: 0"+t+t,{message:i}}class Vs extends Zt{constructor(e){super(e||"Unspecified transport error.")}}class Bn{constructor(e,t,r,i,n){this._transport=e,this._user=t,this._id=r,this._state=i,this.listeners=new Array,this.logger=t.loggerFactory.getLogger(n,r),this.logger.debug(`Constructing ${this.typeToString()} with id ${this.id}.`)}dispose(){this.logger.debug(`Destroyed ${this.typeToString()} with id ${this.id}.`)}get id(){return this._id}get kind(){throw new Error("Invalid kind.")}get state(){return this._state}get transport(){return this._transport}addStateChangeListener(e,t){const r=()=>{this.removeStateChangeListener(r),e()};(t==null?void 0:t.once)===!0?this.listeners.push(r):this.listeners.push(e)}notifyStateChangeListeners(){this.listeners.slice().forEach(e=>e())}removeStateChangeListener(e){this.listeners=this.listeners.filter(t=>t!==e)}logTransportError(e,t){this.logger.error(e.message),this.logger.error(`Transport error occurred in ${this.typeToString()} with id ${this.id}.`),this.logger.error(t)}send(e){return this.transport.send(e).catch(t=>{if(t instanceof Vs)throw this.onTransportError(t),t;let r;throw t&&typeof t.message=="string"?r=new Vs(t.message):r=new Vs,this.onTransportError(r),r})}setState(e){this.logger.debug(`State change to "${e}" on ${this.typeToString()} with id ${this.id}.`),this._state=e,this._user.onStateChange&&this._user.onStateChange(e),this.notifyStateChangeListeners()}typeToString(){return"UnknownType"}}class kn extends Bn{constructor(e,t,r,i,n){super(t,r,e.viaBranch,i,n),this._request=e,this.user=r}get request(){return this._request}}var R;(function(s){s.Accepted="Accepted",s.Calling="Calling",s.Completed="Completed",s.Confirmed="Confirmed",s.Proceeding="Proceeding",s.Terminated="Terminated",s.Trying="Trying"})(R=R||(R={}));class je extends kn{constructor(e,t,r){super(e,t,r,R.Proceeding,"sip.transaction.ist")}dispose(){this.stopProgressExtensionTimer(),this.H&&(clearTimeout(this.H),this.H=void 0),this.I&&(clearTimeout(this.I),this.I=void 0),this.L&&(clearTimeout(this.L),this.L=void 0),super.dispose()}get kind(){return"ist"}receiveRequest(e){switch(this.state){case R.Proceeding:if(e.method===j.INVITE){this.lastProvisionalResponse&&this.send(this.lastProvisionalResponse).catch(r=>{this.logTransportError(r,"Failed to send retransmission of provisional response.")});return}break;case R.Accepted:if(e.method===j.INVITE)return;break;case R.Completed:if(e.method===j.INVITE){if(!this.lastFinalResponse)throw new Error("Last final response undefined.");this.send(this.lastFinalResponse).catch(r=>{this.logTransportError(r,"Failed to send retransmission of final response.")});return}if(e.method===j.ACK){this.stateTransition(R.Confirmed);return}break;case R.Confirmed:if(e.method===j.INVITE||e.method===j.ACK)return;break;case R.Terminated:if(e.method===j.INVITE||e.method===j.ACK)return;break;default:throw new Error(`Invalid state ${this.state}`)}const t=`INVITE server transaction received unexpected ${e.method} request while in state ${this.state}.`;this.logger.warn(t)}receiveResponse(e,t){if(e<100||e>699)throw new Error(`Invalid status code ${e}`);switch(this.state){case R.Proceeding:if(e>=100&&e<=199){this.lastProvisionalResponse=t,e>100&&this.startProgressExtensionTimer(),this.send(t).catch(i=>{this.logTransportError(i,"Failed to send 1xx response.")});return}if(e>=200&&e<=299){this.lastFinalResponse=t,this.stateTransition(R.Accepted),this.send(t).catch(i=>{this.logTransportError(i,"Failed to send 2xx response.")});return}if(e>=300&&e<=699){this.lastFinalResponse=t,this.stateTransition(R.Completed),this.send(t).catch(i=>{this.logTransportError(i,"Failed to send non-2xx final response.")});return}break;case R.Accepted:if(e>=200&&e<=299){this.send(t).catch(i=>{this.logTransportError(i,"Failed to send 2xx response.")});return}break;case R.Completed:break;case R.Confirmed:break;case R.Terminated:break;default:throw new Error(`Invalid state ${this.state}`)}const r=`INVITE server transaction received unexpected ${e} response from TU while in state ${this.state}.`;throw this.logger.error(r),new Error(r)}retransmitAcceptedResponse(){this.state===R.Accepted&&this.lastFinalResponse&&this.send(this.lastFinalResponse).catch(e=>{this.logTransportError(e,"Failed to send 2xx response.")})}onTransportError(e){this.user.onTransportError&&this.user.onTransportError(e)}typeToString(){return"INVITE server transaction"}stateTransition(e){const t=()=>{throw new Error(`Invalid state transition from ${this.state} to ${e}`)};switch(e){case R.Proceeding:t();break;case R.Accepted:case R.Completed:this.state!==R.Proceeding&&t();break;case R.Confirmed:this.state!==R.Completed&&t();break;case R.Terminated:this.state!==R.Accepted&&this.state!==R.Completed&&this.state!==R.Confirmed&&t();break;default:t()}this.stopProgressExtensionTimer(),e===R.Accepted&&(this.L=setTimeout(()=>this.timerL(),Re.TIMER_L)),e===R.Completed&&(this.H=setTimeout(()=>this.timerH(),Re.TIMER_H)),e===R.Confirmed&&(this.I=setTimeout(()=>this.timerI(),Re.TIMER_I)),e===R.Terminated&&this.dispose(),this.setState(e)}startProgressExtensionTimer(){this.progressExtensionTimer===void 0&&(this.progressExtensionTimer=setInterval(()=>{if(this.logger.debug(`Progress extension timer expired for INVITE server transaction ${this.id}.`),!this.lastProvisionalResponse)throw new Error("Last provisional response undefined.");this.send(this.lastProvisionalResponse).catch(e=>{this.logTransportError(e,"Failed to send retransmission of provisional response.")})},Re.PROVISIONAL_RESPONSE_INTERVAL))}stopProgressExtensionTimer(){this.progressExtensionTimer!==void 0&&(clearInterval(this.progressExtensionTimer),this.progressExtensionTimer=void 0)}timerG(){}timerH(){this.logger.debug(`Timer H expired for INVITE server transaction ${this.id}.`),this.state===R.Completed&&(this.logger.warn("ACK to negative final response was never received, terminating transaction."),this.stateTransition(R.Terminated))}timerI(){this.logger.debug(`Timer I expired for INVITE server transaction ${this.id}.`),this.stateTransition(R.Terminated)}timerL(){this.logger.debug(`Timer L expired for INVITE server transaction ${this.id}.`),this.state===R.Accepted&&this.stateTransition(R.Terminated)}}class ss extends Bn{constructor(e,t,r,i,n){super(t,r,ss.makeId(e),i,n),this._request=e,this.user=r,e.setViaHeader(this.id,t.protocol)}static makeId(e){if(e.method==="CANCEL"){if(!e.branch)throw new Error("Outgoing CANCEL request without a branch.");return e.branch}else return"z9hG4bK"+Math.floor(Math.random()*1e7)}get request(){return this._request}onRequestTimeout(){this.user.onRequestTimeout&&this.user.onRequestTimeout()}}class Ve extends ss{constructor(e,t,r){super(e,t,r,R.Trying,"sip.transaction.nict"),this.F=setTimeout(()=>this.timerF(),Re.TIMER_F),this.send(e.toString()).catch(i=>{this.logTransportError(i,"Failed to send initial outgoing request.")})}dispose(){this.F&&(clearTimeout(this.F),this.F=void 0),this.K&&(clearTimeout(this.K),this.K=void 0),super.dispose()}get kind(){return"nict"}receiveResponse(e){const t=e.statusCode;if(!t||t<100||t>699)throw new Error(`Invalid status code ${t}`);switch(this.state){case R.Trying:if(t>=100&&t<=199){this.stateTransition(R.Proceeding),this.user.receiveResponse&&this.user.receiveResponse(e);return}if(t>=200&&t<=699){if(this.stateTransition(R.Completed),t===408){this.onRequestTimeout();return}this.user.receiveResponse&&this.user.receiveResponse(e);return}break;case R.Proceeding:if(t>=100&&t<=199&&this.user.receiveResponse)return this.user.receiveResponse(e);if(t>=200&&t<=699){if(this.stateTransition(R.Completed),t===408){this.onRequestTimeout();return}this.user.receiveResponse&&this.user.receiveResponse(e);return}break;case R.Completed:return;case R.Terminated:return;default:throw new Error(`Invalid state ${this.state}`)}const r=`Non-INVITE client transaction received unexpected ${t} response while in state ${this.state}.`;this.logger.warn(r)}onTransportError(e){this.user.onTransportError&&this.user.onTransportError(e),this.stateTransition(R.Terminated,!0)}typeToString(){return"non-INVITE client transaction"}stateTransition(e,t=!1){const r=()=>{throw new Error(`Invalid state transition from ${this.state} to ${e}`)};switch(e){case R.Trying:r();break;case R.Proceeding:this.state!==R.Trying&&r();break;case R.Completed:this.state!==R.Trying&&this.state!==R.Proceeding&&r();break;case R.Terminated:this.state!==R.Trying&&this.state!==R.Proceeding&&this.state!==R.Completed&&(t||r());break;default:r()}e===R.Completed&&(this.F&&(clearTimeout(this.F),this.F=void 0),this.K=setTimeout(()=>this.timerK(),Re.TIMER_K)),e===R.Terminated&&this.dispose(),this.setState(e)}timerF(){this.logger.debug(`Timer F expired for non-INVITE client transaction ${this.id}.`),(this.state===R.Trying||this.state===R.Proceeding)&&(this.onRequestTimeout(),this.stateTransition(R.Terminated))}timerK(){this.state===R.Completed&&this.stateTransition(R.Terminated)}}class gr{constructor(e,t){this.core=e,this.dialogState=t,this.core.dialogs.set(this.id,this)}static initialDialogStateForUserAgentClient(e,t){const i=t.getHeaders("record-route").reverse(),n=t.parseHeader("contact");if(!n)throw new Error("Contact undefined.");if(!(n instanceof Le))throw new Error("Contact not instance of NameAddrHeader.");const a=n.uri,o=e.cseq,d=void 0,c=e.callId,l=e.fromTag,g=t.toTag;if(!c)throw new Error("Call id undefined.");if(!l)throw new Error("From tag undefined.");if(!g)throw new Error("To tag undefined.");if(!e.from)throw new Error("From undefined.");if(!e.to)throw new Error("To undefined.");const u=e.from.uri,y=e.to.uri;if(!t.statusCode)throw new Error("Incoming response status code undefined.");const v=t.statusCode<200;return{id:c+l+g,early:v,callId:c,localTag:l,remoteTag:g,localSequenceNumber:o,remoteSequenceNumber:d,localURI:u,remoteURI:y,remoteTarget:a,routeSet:i,secure:!1}}static initialDialogStateForUserAgentServer(e,t,r=!1){const n=e.getHeaders("record-route"),a=e.parseHeader("contact");if(!a)throw new Error("Contact undefined.");if(!(a instanceof Le))throw new Error("Contact not instance of NameAddrHeader.");const o=a.uri,d=e.cseq,c=void 0,l=e.callId,g=t,u=e.fromTag,y=e.from.uri,v=e.to.uri;return{id:l+g+u,early:r,callId:l,localTag:g,remoteTag:u,localSequenceNumber:c,remoteSequenceNumber:d,localURI:v,remoteURI:y,remoteTarget:o,routeSet:n,secure:!1}}dispose(){this.core.dialogs.delete(this.id)}get id(){return this.dialogState.id}get early(){return this.dialogState.early}get callId(){return this.dialogState.callId}get localTag(){return this.dialogState.localTag}get remoteTag(){return this.dialogState.remoteTag}get localSequenceNumber(){return this.dialogState.localSequenceNumber}get remoteSequenceNumber(){return this.dialogState.remoteSequenceNumber}get localURI(){return this.dialogState.localURI}get remoteURI(){return this.dialogState.remoteURI}get remoteTarget(){return this.dialogState.remoteTarget}get routeSet(){return this.dialogState.routeSet}get secure(){return this.dialogState.secure}get userAgentCore(){return this.core}confirm(){this.dialogState.early=!1}receiveRequest(e){if(e.method!==j.ACK){if(this.remoteSequenceNumber){if(e.cseq<=this.remoteSequenceNumber)throw new Error("Out of sequence in dialog request. Did you forget to call sequenceGuard()?");this.dialogState.remoteSequenceNumber=e.cseq}this.remoteSequenceNumber||(this.dialogState.remoteSequenceNumber=e.cseq)}}recomputeRouteSet(e){this.dialogState.routeSet=e.getHeaders("record-route").reverse()}createOutgoingRequestMessage(e,t){const r=this.remoteURI,i=this.remoteTag,n=this.localURI,a=this.localTag,o=this.callId;let d;t&&t.cseq?d=t.cseq:this.dialogState.localSequenceNumber?d=this.dialogState.localSequenceNumber+=1:d=this.dialogState.localSequenceNumber=1;const c=this.remoteTarget,l=this.routeSet,g=t&&t.extraHeaders,u=t&&t.body;return this.userAgentCore.makeOutgoingRequestMessage(e,c,n,r,{callId:o,cseq:d,fromTag:a,toTag:i,routeSet:l},g,u)}incrementLocalSequenceNumber(){if(!this.dialogState.localSequenceNumber)throw new Error("Local sequence number undefined.");this.dialogState.localSequenceNumber+=1}sequenceGuard(e){return e.method===j.ACK?!0:this.remoteSequenceNumber&&e.cseq<=this.remoteSequenceNumber?(this.core.replyStateless(e,{statusCode:500}),!1):!0}}class Nt extends ss{constructor(e,t,r){super(e,t,r,R.Calling,"sip.transaction.ict"),this.ackRetransmissionCache=new Map,this.B=setTimeout(()=>this.timerB(),Re.TIMER_B),this.send(e.toString()).catch(i=>{this.logTransportError(i,"Failed to send initial outgoing request.")})}dispose(){this.B&&(clearTimeout(this.B),this.B=void 0),this.D&&(clearTimeout(this.D),this.D=void 0),this.M&&(clearTimeout(this.M),this.M=void 0),super.dispose()}get kind(){return"ict"}ackResponse(e){const t=e.toTag;if(!t)throw new Error("To tag undefined.");const r="z9hG4bK"+Math.floor(Math.random()*1e7);e.setViaHeader(r,this.transport.protocol),this.ackRetransmissionCache.set(t,e),this.send(e.toString()).catch(i=>{this.logTransportError(i,"Failed to send ACK to 2xx response.")})}receiveResponse(e){const t=e.statusCode;if(!t||t<100||t>699)throw new Error(`Invalid status code ${t}`);switch(this.state){case R.Calling:if(t>=100&&t<=199){this.stateTransition(R.Proceeding),this.user.receiveResponse&&this.user.receiveResponse(e);return}if(t>=200&&t<=299){this.ackRetransmissionCache.set(e.toTag,void 0),this.stateTransition(R.Accepted),this.user.receiveResponse&&this.user.receiveResponse(e);return}if(t>=300&&t<=699){this.stateTransition(R.Completed),this.ack(e),this.user.receiveResponse&&this.user.receiveResponse(e);return}break;case R.Proceeding:if(t>=100&&t<=199){this.user.receiveResponse&&this.user.receiveResponse(e);return}if(t>=200&&t<=299){this.ackRetransmissionCache.set(e.toTag,void 0),this.stateTransition(R.Accepted),this.user.receiveResponse&&this.user.receiveResponse(e);return}if(t>=300&&t<=699){this.stateTransition(R.Completed),this.ack(e),this.user.receiveResponse&&this.user.receiveResponse(e);return}break;case R.Accepted:if(t>=200&&t<=299){if(!this.ackRetransmissionCache.has(e.toTag)){this.ackRetransmissionCache.set(e.toTag,void 0),this.user.receiveResponse&&this.user.receiveResponse(e);return}const i=this.ackRetransmissionCache.get(e.toTag);if(i){this.send(i.toString()).catch(n=>{this.logTransportError(n,"Failed to send retransmission of ACK to 2xx response.")});return}return}break;case R.Completed:if(t>=300&&t<=699){this.ack(e);return}break;case R.Terminated:break;default:throw new Error(`Invalid state ${this.state}`)}const r=`Received unexpected ${t} response while in state ${this.state}.`;this.logger.warn(r)}onTransportError(e){this.user.onTransportError&&this.user.onTransportError(e),this.stateTransition(R.Terminated,!0)}typeToString(){return"INVITE client transaction"}ack(e){const t=this.request.ruri,r=this.request.callId,i=this.request.cseq,n=this.request.getHeader("from"),a=e.getHeader("to"),o=this.request.getHeader("via"),d=this.request.getHeader("route");if(!n)throw new Error("From undefined.");if(!a)throw new Error("To undefined.");if(!o)throw new Error("Via undefined.");let c=`ACK ${t} SIP/2.0\r
|
|
56
|
+
`;d&&(c+=`Route: ${d}\r
|
|
57
|
+
`),c+=`Via: ${o}\r
|
|
58
|
+
`,c+=`To: ${a}\r
|
|
59
|
+
`,c+=`From: ${n}\r
|
|
60
|
+
`,c+=`Call-ID: ${r}\r
|
|
61
|
+
`,c+=`CSeq: ${i} ACK\r
|
|
62
|
+
`,c+=`Max-Forwards: 70\r
|
|
63
|
+
`,c+=`Content-Length: 0\r
|
|
64
|
+
\r
|
|
65
|
+
`,this.send(c).catch(l=>{this.logTransportError(l,"Failed to send ACK to non-2xx response.")})}stateTransition(e,t=!1){const r=()=>{throw new Error(`Invalid state transition from ${this.state} to ${e}`)};switch(e){case R.Calling:r();break;case R.Proceeding:this.state!==R.Calling&&r();break;case R.Accepted:case R.Completed:this.state!==R.Calling&&this.state!==R.Proceeding&&r();break;case R.Terminated:this.state!==R.Calling&&this.state!==R.Accepted&&this.state!==R.Completed&&(t||r());break;default:r()}this.B&&(clearTimeout(this.B),this.B=void 0),R.Proceeding,e===R.Completed&&(this.D=setTimeout(()=>this.timerD(),Re.TIMER_D)),e===R.Accepted&&(this.M=setTimeout(()=>this.timerM(),Re.TIMER_M)),e===R.Terminated&&this.dispose(),this.setState(e)}timerA(){}timerB(){this.logger.debug(`Timer B expired for INVITE client transaction ${this.id}.`),this.state===R.Calling&&(this.onRequestTimeout(),this.stateTransition(R.Terminated))}timerD(){this.logger.debug(`Timer D expired for INVITE client transaction ${this.id}.`),this.state===R.Completed&&this.stateTransition(R.Terminated)}timerM(){this.logger.debug(`Timer M expired for INVITE client transaction ${this.id}.`),this.state===R.Accepted&&this.stateTransition(R.Terminated)}}class $e{constructor(e,t,r,i){this.transactionConstructor=e,this.core=t,this.message=r,this.delegate=i,this.challenged=!1,this.stale=!1,this.logger=this.loggerFactory.getLogger("sip.user-agent-client"),this.init()}dispose(){this.transaction.dispose()}get loggerFactory(){return this.core.loggerFactory}get transaction(){if(!this._transaction)throw new Error("Transaction undefined.");return this._transaction}cancel(e,t={}){if(!this.transaction)throw new Error("Transaction undefined.");if(!this.message.to)throw new Error("To undefined.");if(!this.message.from)throw new Error("From undefined.");const r=this.core.makeOutgoingRequestMessage(j.CANCEL,this.message.ruri,this.message.from.uri,this.message.to.uri,{toTag:this.message.toTag,fromTag:this.message.fromTag,callId:this.message.callId,cseq:this.message.cseq},t.extraHeaders);return r.branch=this.message.branch,this.message.headers.Route&&(r.headers.Route=this.message.headers.Route),e&&r.setHeader("Reason",e),this.transaction.state===R.Proceeding?new $e(Ve,this.core,r):this.transaction.addStateChangeListener(()=>{this.transaction&&this.transaction.state===R.Proceeding&&new $e(Ve,this.core,r)},{once:!0}),r}authenticationGuard(e,t){const r=e.statusCode;if(!r)throw new Error("Response status code undefined.");if(r!==401&&r!==407)return!0;let i,n;if(r===401?(i=e.parseHeader("www-authenticate"),n="authorization"):(i=e.parseHeader("proxy-authenticate"),n="proxy-authorization"),!i)return this.logger.warn(r+" with wrong or missing challenge, cannot authenticate"),!0;if(this.challenged&&(this.stale||i.stale!==!0))return this.logger.warn(r+" apparently in authentication loop, cannot authenticate"),!0;if(!this.credentials&&(this.credentials=this.core.configuration.authenticationFactory(),!this.credentials))return this.logger.warn("Unable to obtain credentials, cannot authenticate"),!0;if(!this.credentials.authenticate(this.message,i))return!0;this.challenged=!0,i.stale&&(this.stale=!0);let a=this.message.cseq+=1;return t&&t.localSequenceNumber&&(t.incrementLocalSequenceNumber(),a=this.message.cseq=t.localSequenceNumber),this.message.setHeader("cseq",a+" "+this.message.method),this.message.setHeader(n,this.credentials.toString()),this.init(),!1}onRequestTimeout(){this.logger.warn("User agent client request timed out. Generating internal 408 Request Timeout.");const e=new Ht;e.statusCode=408,e.reasonPhrase="Request Timeout",this.receiveResponse(e)}onTransportError(e){this.logger.error(e.message),this.logger.error("User agent client request transport error. Generating internal 503 Service Unavailable.");const t=new Ht;t.statusCode=503,t.reasonPhrase="Service Unavailable",this.receiveResponse(t)}receiveResponse(e){if(!this.authenticationGuard(e))return;const t=e.statusCode?e.statusCode.toString():"";if(!t)throw new Error("Response status code undefined.");switch(!0){case/^100$/.test(t):this.delegate&&this.delegate.onTrying&&this.delegate.onTrying({message:e});break;case/^1[0-9]{2}$/.test(t):this.delegate&&this.delegate.onProgress&&this.delegate.onProgress({message:e});break;case/^2[0-9]{2}$/.test(t):this.delegate&&this.delegate.onAccept&&this.delegate.onAccept({message:e});break;case/^3[0-9]{2}$/.test(t):this.delegate&&this.delegate.onRedirect&&this.delegate.onRedirect({message:e});break;case/^[4-6][0-9]{2}$/.test(t):this.delegate&&this.delegate.onReject&&this.delegate.onReject({message:e});break;default:throw new Error(`Invalid status code ${t}`)}}init(){const e={loggerFactory:this.loggerFactory,onRequestTimeout:()=>this.onRequestTimeout(),onStateChange:i=>{i===R.Terminated&&(this.core.userAgentClients.delete(r),t===this._transaction&&this.dispose())},onTransportError:i=>this.onTransportError(i),receiveResponse:i=>this.receiveResponse(i)},t=new this.transactionConstructor(this.message,this.core.transport,e);this._transaction=t;const r=t.id+t.request.method;this.core.userAgentClients.set(r,this)}}class qo extends $e{constructor(e,t,r){const i=e.createOutgoingRequestMessage(j.BYE,r);super(Ve,e.userAgentCore,i,t),e.dispose()}}class Ge extends kn{constructor(e,t,r){super(e,t,r,R.Trying,"sip.transaction.nist")}dispose(){this.J&&(clearTimeout(this.J),this.J=void 0),super.dispose()}get kind(){return"nist"}receiveRequest(e){switch(this.state){case R.Trying:break;case R.Proceeding:if(!this.lastResponse)throw new Error("Last response undefined.");this.send(this.lastResponse).catch(t=>{this.logTransportError(t,"Failed to send retransmission of provisional response.")});break;case R.Completed:if(!this.lastResponse)throw new Error("Last response undefined.");this.send(this.lastResponse).catch(t=>{this.logTransportError(t,"Failed to send retransmission of final response.")});break;case R.Terminated:break;default:throw new Error(`Invalid state ${this.state}`)}}receiveResponse(e,t){if(e<100||e>699)throw new Error(`Invalid status code ${e}`);if(e>100&&e<=199)throw new Error("Provisional response other than 100 not allowed.");switch(this.state){case R.Trying:if(this.lastResponse=t,e>=100&&e<200){this.stateTransition(R.Proceeding),this.send(t).catch(i=>{this.logTransportError(i,"Failed to send provisional response.")});return}if(e>=200&&e<=699){this.stateTransition(R.Completed),this.send(t).catch(i=>{this.logTransportError(i,"Failed to send final response.")});return}break;case R.Proceeding:if(this.lastResponse=t,e>=200&&e<=699){this.stateTransition(R.Completed),this.send(t).catch(i=>{this.logTransportError(i,"Failed to send final response.")});return}break;case R.Completed:return;case R.Terminated:break;default:throw new Error(`Invalid state ${this.state}`)}const r=`Non-INVITE server transaction received unexpected ${e} response from TU while in state ${this.state}.`;throw this.logger.error(r),new Error(r)}onTransportError(e){this.user.onTransportError&&this.user.onTransportError(e),this.stateTransition(R.Terminated,!0)}typeToString(){return"non-INVITE server transaction"}stateTransition(e,t=!1){const r=()=>{throw new Error(`Invalid state transition from ${this.state} to ${e}`)};switch(e){case R.Trying:r();break;case R.Proceeding:this.state!==R.Trying&&r();break;case R.Completed:this.state!==R.Trying&&this.state!==R.Proceeding&&r();break;case R.Terminated:this.state!==R.Proceeding&&this.state!==R.Completed&&(t||r());break;default:r()}e===R.Completed&&(this.J=setTimeout(()=>this.timerJ(),Re.TIMER_J)),e===R.Terminated&&this.dispose(),this.setState(e)}timerJ(){this.logger.debug(`Timer J expired for NON-INVITE server transaction ${this.id}.`),this.state===R.Completed&&this.stateTransition(R.Terminated)}}class ft{constructor(e,t,r,i){this.transactionConstructor=e,this.core=t,this.message=r,this.delegate=i,this.logger=this.loggerFactory.getLogger("sip.user-agent-server"),this.toTag=r.toTag?r.toTag:es(),this.init()}dispose(){this.transaction.dispose()}get loggerFactory(){return this.core.loggerFactory}get transaction(){if(!this._transaction)throw new Error("Transaction undefined.");return this._transaction}accept(e={statusCode:200}){if(!this.acceptable)throw new Pt(`${this.message.method} not acceptable in state ${this.transaction.state}.`);const t=e.statusCode;if(t<200||t>299)throw new TypeError(`Invalid statusCode: ${t}`);return this.reply(e)}progress(e={statusCode:180}){if(!this.progressable)throw new Pt(`${this.message.method} not progressable in state ${this.transaction.state}.`);const t=e.statusCode;if(t<101||t>199)throw new TypeError(`Invalid statusCode: ${t}`);return this.reply(e)}redirect(e,t={statusCode:302}){if(!this.redirectable)throw new Pt(`${this.message.method} not redirectable in state ${this.transaction.state}.`);const r=t.statusCode;if(r<300||r>399)throw new TypeError(`Invalid statusCode: ${r}`);const i=new Array;return e.forEach(a=>i.push(`Contact: ${a.toString()}`)),t.extraHeaders=(t.extraHeaders||[]).concat(i),this.reply(t)}reject(e={statusCode:480}){if(!this.rejectable)throw new Pt(`${this.message.method} not rejectable in state ${this.transaction.state}.`);const t=e.statusCode;if(t<400||t>699)throw new TypeError(`Invalid statusCode: ${t}`);return this.reply(e)}trying(e){if(!this.tryingable)throw new Pt(`${this.message.method} not tryingable in state ${this.transaction.state}.`);return this.reply({statusCode:100})}receiveCancel(e){this.delegate&&this.delegate.onCancel&&this.delegate.onCancel(e)}get acceptable(){if(this.transaction instanceof je)return this.transaction.state===R.Proceeding||this.transaction.state===R.Accepted;if(this.transaction instanceof Ge)return this.transaction.state===R.Trying||this.transaction.state===R.Proceeding;throw new Error("Unknown transaction type.")}get progressable(){if(this.transaction instanceof je)return this.transaction.state===R.Proceeding;if(this.transaction instanceof Ge)return!1;throw new Error("Unknown transaction type.")}get redirectable(){if(this.transaction instanceof je)return this.transaction.state===R.Proceeding;if(this.transaction instanceof Ge)return this.transaction.state===R.Trying||this.transaction.state===R.Proceeding;throw new Error("Unknown transaction type.")}get rejectable(){if(this.transaction instanceof je)return this.transaction.state===R.Proceeding;if(this.transaction instanceof Ge)return this.transaction.state===R.Trying||this.transaction.state===R.Proceeding;throw new Error("Unknown transaction type.")}get tryingable(){if(this.transaction instanceof je)return this.transaction.state===R.Proceeding;if(this.transaction instanceof Ge)return this.transaction.state===R.Trying;throw new Error("Unknown transaction type.")}reply(e){!e.toTag&&e.statusCode!==100&&(e.toTag=this.toTag),e.userAgent=e.userAgent||this.core.configuration.userAgentHeaderFieldValue,e.supported=e.supported||this.core.configuration.supportedOptionTagsResponse;const t=Fn(this.message,e);return this.transaction.receiveResponse(e.statusCode,t.message),t}init(){const e={loggerFactory:this.loggerFactory,onStateChange:i=>{i===R.Terminated&&(this.core.userAgentServers.delete(r),this.dispose())},onTransportError:i=>{this.logger.error(i.message),this.delegate&&this.delegate.onTransportError?this.delegate.onTransportError(i):this.logger.error("User agent server response transport error.")}},t=new this.transactionConstructor(this.message,this.core.transport,e);this._transaction=t;const r=t.id;this.core.userAgentServers.set(t.id,this)}}class Uo extends ft{constructor(e,t,r){super(Ge,e.userAgentCore,t,r)}}class Lo extends $e{constructor(e,t,r){const i=e.createOutgoingRequestMessage(j.INFO,r);super(Ve,e.userAgentCore,i,t)}}class jo extends ft{constructor(e,t,r){super(Ge,e.userAgentCore,t,r)}}class In extends $e{constructor(e,t,r){super(Ve,e,t,r)}}class $n extends ft{constructor(e,t,r){super(Ge,e,t,r)}}class Yo extends $e{constructor(e,t,r){const i=e.createOutgoingRequestMessage(j.NOTIFY,r);super(Ve,e.userAgentCore,i,t)}}function Wo(s){return s.userAgentCore!==void 0}class is extends ft{constructor(e,t,r){const i=Wo(e)?e.userAgentCore:e;super(Ge,i,t,r)}}class Vo extends $e{constructor(e,t,r){const i=e.createOutgoingRequestMessage(j.PRACK,r);super(Ve,e.userAgentCore,i,t),e.signalingStateTransition(i)}}class Go extends ft{constructor(e,t,r){super(Ge,e.userAgentCore,t,r),e.signalingStateTransition(t),this.dialog=e}accept(e={statusCode:200}){return e.body&&this.dialog.signalingStateTransition(e.body),super.accept(e)}}class zo extends $e{constructor(e,t,r){const i=e.createOutgoingRequestMessage(j.INVITE,r);super(Nt,e.userAgentCore,i,t),this.delegate=t,e.signalingStateTransition(i),e.reinviteUserAgentClient=this,this.dialog=e}receiveResponse(e){if(!this.authenticationGuard(e,this.dialog))return;const t=e.statusCode?e.statusCode.toString():"";if(!t)throw new Error("Response status code undefined.");switch(!0){case/^100$/.test(t):this.delegate&&this.delegate.onTrying&&this.delegate.onTrying({message:e});break;case/^1[0-9]{2}$/.test(t):this.delegate&&this.delegate.onProgress&&this.delegate.onProgress({message:e,session:this.dialog,prack:r=>{throw new Error("Unimplemented.")}});break;case/^2[0-9]{2}$/.test(t):this.dialog.signalingStateTransition(e),this.delegate&&this.delegate.onAccept&&this.delegate.onAccept({message:e,session:this.dialog,ack:r=>this.dialog.ack(r)});break;case/^3[0-9]{2}$/.test(t):this.dialog.signalingStateRollback(),this.dialog.reinviteUserAgentClient=void 0,this.delegate&&this.delegate.onRedirect&&this.delegate.onRedirect({message:e});break;case/^[4-6][0-9]{2}$/.test(t):this.dialog.signalingStateRollback(),this.dialog.reinviteUserAgentClient=void 0,this.delegate&&this.delegate.onReject&&this.delegate.onReject({message:e});break;default:throw new Error(`Invalid status code ${t}`)}}}class Ko extends ft{constructor(e,t,r){super(je,e.userAgentCore,t,r),e.reinviteUserAgentServer=this,this.dialog=e}accept(e={statusCode:200}){e.extraHeaders=e.extraHeaders||[],e.extraHeaders=e.extraHeaders.concat(this.dialog.routeSet.map(n=>`Record-Route: ${n}`));const t=super.accept(e),r=this.dialog,i=Object.assign(Object.assign({},t),{session:r});return e.body&&this.dialog.signalingStateTransition(e.body),this.dialog.reConfirm(),i}progress(e={statusCode:180}){const t=super.progress(e),r=this.dialog,i=Object.assign(Object.assign({},t),{session:r});return e.body&&this.dialog.signalingStateTransition(e.body),i}redirect(e,t={statusCode:302}){throw this.dialog.signalingStateRollback(),this.dialog.reinviteUserAgentServer=void 0,new Error("Unimplemented.")}reject(e={statusCode:488}){return this.dialog.signalingStateRollback(),this.dialog.reinviteUserAgentServer=void 0,super.reject(e)}}class Zo extends $e{constructor(e,t,r){const i=e.createOutgoingRequestMessage(j.REFER,r);super(Ve,e.userAgentCore,i,t)}}function Jo(s){return s.userAgentCore!==void 0}class Hn extends ft{constructor(e,t,r){const i=Jo(e)?e.userAgentCore:e;super(Ge,i,t,r)}}class ns extends gr{constructor(e,t,r,i){super(t,r),this.initialTransaction=e,this._signalingState=U.Initial,this.ackWait=!1,this.ackProcessing=!1,this.delegate=i,e instanceof je&&(this.ackWait=!0),this.early||this.start2xxRetransmissionTimer(),this.signalingStateTransition(e.request),this.logger=t.loggerFactory.getLogger("sip.invite-dialog"),this.logger.log(`INVITE dialog ${this.id} constructed`)}dispose(){super.dispose(),this._signalingState=U.Closed,this._offer=void 0,this._answer=void 0,this.invite2xxTimer&&(clearTimeout(this.invite2xxTimer),this.invite2xxTimer=void 0),this.logger.log(`INVITE dialog ${this.id} destroyed`)}get sessionState(){return this.early?Je.Early:this.ackWait?Je.AckWait:this._signalingState===U.Closed?Je.Terminated:Je.Confirmed}get signalingState(){return this._signalingState}get offer(){return this._offer}get answer(){return this._answer}confirm(){this.early&&this.start2xxRetransmissionTimer(),super.confirm()}reConfirm(){this.reinviteUserAgentServer&&this.startReInvite2xxRetransmissionTimer()}ack(e={}){this.logger.log(`INVITE dialog ${this.id} sending ACK request`);let t;if(this.reinviteUserAgentClient){if(!(this.reinviteUserAgentClient.transaction instanceof Nt))throw new Error("Transaction not instance of InviteClientTransaction.");t=this.reinviteUserAgentClient.transaction,this.reinviteUserAgentClient=void 0}else{if(!(this.initialTransaction instanceof Nt))throw new Error("Initial transaction not instance of InviteClientTransaction.");t=this.initialTransaction}const r=this.createOutgoingRequestMessage(j.ACK,{cseq:t.request.cseq,extraHeaders:e.extraHeaders,body:e.body});return t.ackResponse(r),this.signalingStateTransition(r),{message:r}}bye(e,t){if(this.logger.log(`INVITE dialog ${this.id} sending BYE request`),this.initialTransaction instanceof je){if(this.early)throw new Error("UAS MUST NOT send a BYE on early dialogs.");if(this.ackWait&&this.initialTransaction.state!==R.Terminated)throw new Error("UAS MUST NOT send a BYE on a confirmed dialog until it has received an ACK for its 2xx response or until the server transaction times out.")}return new qo(this,e,t)}info(e,t){if(this.logger.log(`INVITE dialog ${this.id} sending INFO request`),this.early)throw new Error("Dialog not confirmed.");return new Lo(this,e,t)}invite(e,t){if(this.logger.log(`INVITE dialog ${this.id} sending INVITE request`),this.early)throw new Error("Dialog not confirmed.");if(this.reinviteUserAgentClient)throw new Error("There is an ongoing re-INVITE client transaction.");if(this.reinviteUserAgentServer)throw new Error("There is an ongoing re-INVITE server transaction.");return new zo(this,e,t)}message(e,t){if(this.logger.log(`INVITE dialog ${this.id} sending MESSAGE request`),this.early)throw new Error("Dialog not confirmed.");const r=this.createOutgoingRequestMessage(j.MESSAGE,t);return new In(this.core,r,e)}notify(e,t){if(this.logger.log(`INVITE dialog ${this.id} sending NOTIFY request`),this.early)throw new Error("Dialog not confirmed.");return new Yo(this,e,t)}prack(e,t){return this.logger.log(`INVITE dialog ${this.id} sending PRACK request`),new Vo(this,e,t)}refer(e,t){if(this.logger.log(`INVITE dialog ${this.id} sending REFER request`),this.early)throw new Error("Dialog not confirmed.");return new Zo(this,e,t)}receiveRequest(e){if(this.logger.log(`INVITE dialog ${this.id} received ${e.method} request`),e.method===j.ACK){if(this.ackWait){if(this.initialTransaction instanceof Nt){this.logger.warn(`INVITE dialog ${this.id} received unexpected ${e.method} request, dropping.`);return}if(this.initialTransaction.request.cseq!==e.cseq){this.logger.warn(`INVITE dialog ${this.id} received unexpected ${e.method} request, dropping.`);return}this.ackWait=!1}else{if(!this.reinviteUserAgentServer){this.logger.warn(`INVITE dialog ${this.id} received unexpected ${e.method} request, dropping.`);return}if(this.reinviteUserAgentServer.transaction.request.cseq!==e.cseq){this.logger.warn(`INVITE dialog ${this.id} received unexpected ${e.method} request, dropping.`);return}this.reinviteUserAgentServer=void 0}if(this.signalingStateTransition(e),this.delegate&&this.delegate.onAck){const t=this.delegate.onAck({message:e});t instanceof Promise&&(this.ackProcessing=!0,t.then(()=>this.ackProcessing=!1).catch(()=>this.ackProcessing=!1))}return}if(!this.sequenceGuard(e)){this.logger.log(`INVITE dialog ${this.id} rejected out of order ${e.method} request.`);return}if(super.receiveRequest(e),e.method===j.INVITE){const t=()=>{const n=this.ackWait?"waiting for initial ACK":"processing initial ACK";this.logger.warn(`INVITE dialog ${this.id} received re-INVITE while ${n}`);let a="RFC 5407 suggests the following to avoid this race condition... ";a+=" Note: Implementation issues are outside the scope of this document,",a+=" but the following tip is provided for avoiding race conditions of",a+=" this type. The caller can delay sending re-INVITE F6 for some period",a+=" of time (2 seconds, perhaps), after which the caller can reasonably",a+=" assume that its ACK has been received. Implementors can decouple the",a+=" actions of the user (e.g., pressing the hold button) from the actions",a+=" of the protocol (the sending of re-INVITE F6), so that the UA can",a+=" behave like this. In this case, it is the implementor's choice as to",a+=" how long to wait. In most cases, such an implementation may be",a+=" useful to prevent the type of race condition shown in this section.",a+=" This document expresses no preference about whether or not they",a+=" should wait for an ACK to be delivered. After considering the impact",a+=" on user experience, implementors should decide whether or not to wait",a+=" for a while, because the user experience depends on the",a+=" implementation and has no direct bearing on protocol behavior.",this.logger.warn(a)},i=[`Retry-After: ${Math.floor(Math.random()*10)+1}`];if(this.ackProcessing){this.core.replyStateless(e,{statusCode:500,extraHeaders:i}),t();return}if(this.ackWait&&this.signalingState!==U.Stable){this.core.replyStateless(e,{statusCode:500,extraHeaders:i}),t();return}if(this.reinviteUserAgentServer){this.core.replyStateless(e,{statusCode:500,extraHeaders:i});return}if(this.reinviteUserAgentClient){this.core.replyStateless(e,{statusCode:491});return}}if(e.method===j.INVITE){const t=e.parseHeader("contact");if(!t)throw new Error("Contact undefined.");if(!(t instanceof Le))throw new Error("Contact not instance of NameAddrHeader.");this.dialogState.remoteTarget=t.uri}switch(e.method){case j.BYE:{const t=new Uo(this,e);this.delegate&&this.delegate.onBye?this.delegate.onBye(t):t.accept(),this.dispose()}break;case j.INFO:{const t=new jo(this,e);this.delegate&&this.delegate.onInfo?this.delegate.onInfo(t):t.reject({statusCode:469,extraHeaders:["Recv-Info:"]})}break;case j.INVITE:{const t=new Ko(this,e);this.signalingStateTransition(e),this.delegate&&this.delegate.onInvite?this.delegate.onInvite(t):t.reject({statusCode:488})}break;case j.MESSAGE:{const t=new $n(this.core,e);this.delegate&&this.delegate.onMessage?this.delegate.onMessage(t):t.accept()}break;case j.NOTIFY:{const t=new is(this,e);this.delegate&&this.delegate.onNotify?this.delegate.onNotify(t):t.accept()}break;case j.PRACK:{const t=new Go(this,e);this.delegate&&this.delegate.onPrack?this.delegate.onPrack(t):t.accept()}break;case j.REFER:{const t=new Hn(this,e);this.delegate&&this.delegate.onRefer?this.delegate.onRefer(t):t.reject()}break;default:this.logger.log(`INVITE dialog ${this.id} received unimplemented ${e.method} request`),this.core.replyStateless(e,{statusCode:501});break}}reliableSequenceGuard(e){const t=e.statusCode;if(!t)throw new Error("Status code undefined");if(t>100&&t<200){const r=e.getHeader("require"),i=e.getHeader("rseq"),n=r&&r.includes("100rel")&&i?Number(i):void 0;if(n){if(this.rseq&&this.rseq+1!==n)return!1;this.rseq=this.rseq?this.rseq+1:n}}return!0}signalingStateRollback(){(this._signalingState===U.HaveLocalOffer||this.signalingState===U.HaveRemoteOffer)&&this._rollbackOffer&&this._rollbackAnswer&&(this._signalingState=U.Stable,this._offer=this._rollbackOffer,this._answer=this._rollbackAnswer)}signalingStateTransition(e){const t=$r(e);if(!(!t||t.contentDisposition!=="session")){if(this._signalingState===U.Stable&&(this._rollbackOffer=this._offer,this._rollbackAnswer=this._answer),e instanceof fr)switch(this._signalingState){case U.Initial:case U.Stable:this._signalingState=U.HaveRemoteOffer,this._offer=t,this._answer=void 0;break;case U.HaveLocalOffer:this._signalingState=U.Stable,this._answer=t;break;case U.HaveRemoteOffer:break;case U.Closed:break;default:throw new Error("Unexpected signaling state.")}if(e instanceof Ht)switch(this._signalingState){case U.Initial:case U.Stable:this._signalingState=U.HaveRemoteOffer,this._offer=t,this._answer=void 0;break;case U.HaveLocalOffer:this._signalingState=U.Stable,this._answer=t;break;case U.HaveRemoteOffer:break;case U.Closed:break;default:throw new Error("Unexpected signaling state.")}if(e instanceof Xt)switch(this._signalingState){case U.Initial:case U.Stable:this._signalingState=U.HaveLocalOffer,this._offer=t,this._answer=void 0;break;case U.HaveLocalOffer:break;case U.HaveRemoteOffer:this._signalingState=U.Stable,this._answer=t;break;case U.Closed:break;default:throw new Error("Unexpected signaling state.")}if(bn(e))switch(this._signalingState){case U.Initial:case U.Stable:this._signalingState=U.HaveLocalOffer,this._offer=t,this._answer=void 0;break;case U.HaveLocalOffer:break;case U.HaveRemoteOffer:this._signalingState=U.Stable,this._answer=t;break;case U.Closed:break;default:throw new Error("Unexpected signaling state.")}}}start2xxRetransmissionTimer(){if(this.initialTransaction instanceof je){const e=this.initialTransaction;let t=Re.T1;const r=()=>{if(!this.ackWait){this.invite2xxTimer=void 0;return}this.logger.log("No ACK for 2xx response received, attempting retransmission"),e.retransmitAcceptedResponse(),t=Math.min(t*2,Re.T2),this.invite2xxTimer=setTimeout(r,t)};this.invite2xxTimer=setTimeout(r,t);const i=()=>{e.state===R.Terminated&&(e.removeStateChangeListener(i),this.invite2xxTimer&&(clearTimeout(this.invite2xxTimer),this.invite2xxTimer=void 0),this.ackWait&&(this.delegate&&this.delegate.onAckTimeout?this.delegate.onAckTimeout():this.bye()))};e.addStateChangeListener(i)}}startReInvite2xxRetransmissionTimer(){if(this.reinviteUserAgentServer&&this.reinviteUserAgentServer.transaction instanceof je){const e=this.reinviteUserAgentServer.transaction;let t=Re.T1;const r=()=>{if(!this.reinviteUserAgentServer){this.invite2xxTimer=void 0;return}this.logger.log("No ACK for 2xx response received, attempting retransmission"),e.retransmitAcceptedResponse(),t=Math.min(t*2,Re.T2),this.invite2xxTimer=setTimeout(r,t)};this.invite2xxTimer=setTimeout(r,t);const i=()=>{e.state===R.Terminated&&(e.removeStateChangeListener(i),this.invite2xxTimer&&(clearTimeout(this.invite2xxTimer),this.invite2xxTimer=void 0),this.reinviteUserAgentServer)};e.addStateChangeListener(i)}}}class Xo extends $e{constructor(e,t,r){super(Nt,e,t,r),this.confirmedDialogAcks=new Map,this.confirmedDialogs=new Map,this.earlyDialogs=new Map,this.delegate=r}dispose(){this.earlyDialogs.forEach(e=>e.dispose()),this.earlyDialogs.clear(),super.dispose()}onTransportError(e){if(this.transaction.state===R.Calling)return super.onTransportError(e);this.logger.error(e.message),this.logger.error("User agent client request transport error while sending ACK.")}receiveResponse(e){if(!this.authenticationGuard(e))return;const t=e.statusCode?e.statusCode.toString():"";if(!t)throw new Error("Response status code undefined.");switch(!0){case/^100$/.test(t):this.delegate&&this.delegate.onTrying&&this.delegate.onTrying({message:e});return;case/^1[0-9]{2}$/.test(t):{if(!e.toTag){this.logger.warn("Non-100 1xx INVITE response received without a to tag, dropping.");return}if(!e.parseHeader("contact")){this.logger.error("Non-100 1xx INVITE response received without a Contact header field, dropping.");return}const i=gr.initialDialogStateForUserAgentClient(this.message,e);let n=this.earlyDialogs.get(i.id);if(!n){const o=this.transaction;if(!(o instanceof Nt))throw new Error("Transaction not instance of InviteClientTransaction.");n=new ns(o,this.core,i),this.earlyDialogs.set(n.id,n)}if(!n.reliableSequenceGuard(e)){this.logger.warn("1xx INVITE reliable response received out of order or is a retransmission, dropping.");return}(n.signalingState===U.Initial||n.signalingState===U.HaveLocalOffer)&&n.signalingStateTransition(e);const a=n;this.delegate&&this.delegate.onProgress&&this.delegate.onProgress({message:e,session:a,prack:o=>a.prack(void 0,o)})}return;case/^2[0-9]{2}$/.test(t):{if(!e.toTag){this.logger.error("2xx INVITE response received without a to tag, dropping.");return}if(!e.parseHeader("contact")){this.logger.error("2xx INVITE response received without a Contact header field, dropping.");return}const i=gr.initialDialogStateForUserAgentClient(this.message,e);let n=this.confirmedDialogs.get(i.id);if(n){const o=this.confirmedDialogAcks.get(i.id);if(o){const d=this.transaction;if(!(d instanceof Nt))throw new Error("Client transaction not instance of InviteClientTransaction.");d.ackResponse(o.message)}return}if(n=this.earlyDialogs.get(i.id),n)n.confirm(),n.recomputeRouteSet(e),this.earlyDialogs.delete(n.id),this.confirmedDialogs.set(n.id,n);else{const o=this.transaction;if(!(o instanceof Nt))throw new Error("Transaction not instance of InviteClientTransaction.");n=new ns(o,this.core,i),this.confirmedDialogs.set(n.id,n)}(n.signalingState===U.Initial||n.signalingState===U.HaveLocalOffer)&&n.signalingStateTransition(e);const a=n;if(this.delegate&&this.delegate.onAccept)this.delegate.onAccept({message:e,session:a,ack:o=>{const d=a.ack(o);return this.confirmedDialogAcks.set(a.id,d),d}});else{const o=a.ack();this.confirmedDialogAcks.set(a.id,o)}}return;case/^3[0-9]{2}$/.test(t):this.earlyDialogs.forEach(r=>r.dispose()),this.earlyDialogs.clear(),this.delegate&&this.delegate.onRedirect&&this.delegate.onRedirect({message:e});return;case/^[4-6][0-9]{2}$/.test(t):this.earlyDialogs.forEach(r=>r.dispose()),this.earlyDialogs.clear(),this.delegate&&this.delegate.onReject&&this.delegate.onReject({message:e});return;default:throw new Error(`Invalid status code ${t}`)}}}class Gs extends ft{constructor(e,t,r){super(je,e,t,r),this.core=e}dispose(){this.earlyDialog&&this.earlyDialog.dispose(),super.dispose()}accept(e={statusCode:200}){if(!this.acceptable)throw new Pt(`${this.message.method} not acceptable in state ${this.transaction.state}.`);if(!this.confirmedDialog)if(this.earlyDialog)this.earlyDialog.confirm(),this.confirmedDialog=this.earlyDialog,this.earlyDialog=void 0;else{const d=this.transaction;if(!(d instanceof je))throw new Error("Transaction not instance of InviteClientTransaction.");const c=gr.initialDialogStateForUserAgentServer(this.message,this.toTag);this.confirmedDialog=new ns(d,this.core,c)}const t=this.message.getHeaders("record-route").map(d=>`Record-Route: ${d}`),r=`Contact: ${this.core.configuration.contact.toString()}`,i="Allow: "+Ot.toString();if(!e.body){if(this.confirmedDialog.signalingState===U.Stable)e.body=this.confirmedDialog.answer;else if(this.confirmedDialog.signalingState===U.Initial||this.confirmedDialog.signalingState===U.HaveRemoteOffer)throw new Error("Response must have a body.")}e.statusCode=e.statusCode||200,e.extraHeaders=e.extraHeaders||[],e.extraHeaders=e.extraHeaders.concat(t),e.extraHeaders.push(i),e.extraHeaders.push(r);const n=super.accept(e),a=this.confirmedDialog,o=Object.assign(Object.assign({},n),{session:a});return e.body&&this.confirmedDialog.signalingState!==U.Stable&&this.confirmedDialog.signalingStateTransition(e.body),o}progress(e={statusCode:180}){if(!this.progressable)throw new Pt(`${this.message.method} not progressable in state ${this.transaction.state}.`);if(!this.earlyDialog){const o=this.transaction;if(!(o instanceof je))throw new Error("Transaction not instance of InviteClientTransaction.");const d=gr.initialDialogStateForUserAgentServer(this.message,this.toTag,!0);this.earlyDialog=new ns(o,this.core,d)}const t=this.message.getHeaders("record-route").map(o=>`Record-Route: ${o}`),r=`Contact: ${this.core.configuration.contact}`;e.extraHeaders=e.extraHeaders||[],e.extraHeaders=e.extraHeaders.concat(t),e.extraHeaders.push(r);const i=super.progress(e),n=this.earlyDialog,a=Object.assign(Object.assign({},i),{session:n});return e.body&&this.earlyDialog.signalingState!==U.Stable&&this.earlyDialog.signalingStateTransition(e.body),a}redirect(e,t={statusCode:302}){return super.redirect(e,t)}reject(e={statusCode:486}){return super.reject(e)}}class Qo extends $e{constructor(e,t,r){super(Ve,e,t,r)}}class e0 extends $e{constructor(e,t,r){super(Ve,e,t,r)}}class t0 extends ft{constructor(e,t,r){super(Ge,e,t,r),this.core=e}}class r0 extends $e{constructor(e,t,r){const i=e.createOutgoingRequestMessage(j.SUBSCRIBE,r);super(Ve,e.userAgentCore,i,t),this.dialog=e}waitNotifyStop(){}receiveResponse(e){if(e.statusCode&&e.statusCode>=200&&e.statusCode<300){const t=e.getHeader("Expires");if(!t)this.logger.warn("Expires header missing in a 200-class response to SUBSCRIBE");else{const r=Number(t);this.dialog.subscriptionExpires>r&&(this.dialog.subscriptionExpires=r)}}e.statusCode&&e.statusCode>=400&&e.statusCode<700&&[404,405,410,416,480,481,482,483,484,485,489,501,604].includes(e.statusCode)&&this.dialog.terminate(),super.receiveResponse(e)}}class Pn extends gr{constructor(e,t,r,i,n,a){super(i,n),this.delegate=a,this._autoRefresh=!1,this._subscriptionEvent=e,this._subscriptionExpires=t,this._subscriptionExpiresInitial=t,this._subscriptionExpiresLastSet=Math.floor(Date.now()/1e3),this._subscriptionRefresh=void 0,this._subscriptionRefreshLastSet=void 0,this._subscriptionState=r,this.logger=i.loggerFactory.getLogger("sip.subscribe-dialog"),this.logger.log(`SUBSCRIBE dialog ${this.id} constructed`)}static initialDialogStateForSubscription(e,t){const i=t.getHeaders("record-route"),n=t.parseHeader("contact");if(!n)throw new Error("Contact undefined.");if(!(n instanceof Le))throw new Error("Contact not instance of NameAddrHeader.");const a=n.uri,o=e.cseq,d=void 0,c=e.callId,l=e.fromTag,g=t.fromTag;if(!c)throw new Error("Call id undefined.");if(!l)throw new Error("From tag undefined.");if(!g)throw new Error("To tag undefined.");if(!e.from)throw new Error("From undefined.");if(!e.to)throw new Error("To undefined.");const u=e.from.uri,y=e.to.uri;return{id:c+l+g,early:!1,callId:c,localTag:l,remoteTag:g,localSequenceNumber:o,remoteSequenceNumber:d,localURI:u,remoteURI:y,remoteTarget:a,routeSet:i,secure:!1}}dispose(){super.dispose(),this.N&&(clearTimeout(this.N),this.N=void 0),this.refreshTimerClear(),this.logger.log(`SUBSCRIBE dialog ${this.id} destroyed`)}get autoRefresh(){return this._autoRefresh}set autoRefresh(e){this._autoRefresh=!0,this.refreshTimerSet()}get subscriptionEvent(){return this._subscriptionEvent}get subscriptionExpires(){const e=Math.floor(Date.now()/1e3)-this._subscriptionExpiresLastSet,t=this._subscriptionExpires-e;return Math.max(t,0)}set subscriptionExpires(e){if(e<0)throw new Error("Expires must be greater than or equal to zero.");if(this._subscriptionExpires=e,this._subscriptionExpiresLastSet=Math.floor(Date.now()/1e3),this.autoRefresh){const t=this.subscriptionRefresh;(t===void 0||t>=e)&&this.refreshTimerSet()}}get subscriptionExpiresInitial(){return this._subscriptionExpiresInitial}get subscriptionRefresh(){if(this._subscriptionRefresh===void 0||this._subscriptionRefreshLastSet===void 0)return;const e=Math.floor(Date.now()/1e3)-this._subscriptionRefreshLastSet,t=this._subscriptionRefresh-e;return Math.max(t,0)}get subscriptionState(){return this._subscriptionState}receiveRequest(e){if(this.logger.log(`SUBSCRIBE dialog ${this.id} received ${e.method} request`),!this.sequenceGuard(e)){this.logger.log(`SUBSCRIBE dialog ${this.id} rejected out of order ${e.method} request.`);return}switch(super.receiveRequest(e),e.method){case j.NOTIFY:this.onNotify(e);break;default:this.logger.log(`SUBSCRIBE dialog ${this.id} received unimplemented ${e.method} request`),this.core.replyStateless(e,{statusCode:501});break}}refresh(){const e="Allow: "+Ot.toString(),t={};return t.extraHeaders=(t.extraHeaders||[]).slice(),t.extraHeaders.push(e),t.extraHeaders.push("Event: "+this.subscriptionEvent),t.extraHeaders.push("Expires: "+this.subscriptionExpiresInitial),t.extraHeaders.push("Contact: "+this.core.configuration.contact.toString()),this.subscribe(void 0,t)}subscribe(e,t={}){var r;if(this.subscriptionState!==oe.Pending&&this.subscriptionState!==oe.Active)throw new Error(`Invalid state ${this.subscriptionState}. May only re-subscribe while in state "pending" or "active".`);this.logger.log(`SUBSCRIBE dialog ${this.id} sending SUBSCRIBE request`);const i=new r0(this,e,t);return this.N&&(clearTimeout(this.N),this.N=void 0),!((r=t.extraHeaders)===null||r===void 0)&&r.includes("Expires: 0")||(this.N=setTimeout(()=>this.timerN(),Re.TIMER_N)),i}terminate(){this.stateTransition(oe.Terminated),this.onTerminated()}unsubscribe(){const e="Allow: "+Ot.toString(),t={};return t.extraHeaders=(t.extraHeaders||[]).slice(),t.extraHeaders.push(e),t.extraHeaders.push("Event: "+this.subscriptionEvent),t.extraHeaders.push("Expires: 0"),t.extraHeaders.push("Contact: "+this.core.configuration.contact.toString()),this.subscribe(void 0,t)}onNotify(e){const t=e.parseHeader("Event").event;if(!t||t!==this.subscriptionEvent){this.core.replyStateless(e,{statusCode:489});return}this.N&&(clearTimeout(this.N),this.N=void 0);const r=e.parseHeader("Subscription-State");if(!r||!r.state){this.core.replyStateless(e,{statusCode:489});return}const i=r.state,n=r.expires?Math.max(r.expires,0):void 0;switch(i){case"pending":this.stateTransition(oe.Pending,n);break;case"active":this.stateTransition(oe.Active,n);break;case"terminated":this.stateTransition(oe.Terminated,n);break;default:this.logger.warn("Unrecognized subscription state.");break}const a=new is(this,e);this.delegate&&this.delegate.onNotify?this.delegate.onNotify(a):a.accept()}onRefresh(e){this.delegate&&this.delegate.onRefresh&&this.delegate.onRefresh(e)}onTerminated(){this.delegate&&this.delegate.onTerminated&&this.delegate.onTerminated()}refreshTimerClear(){this.refreshTimer&&(clearTimeout(this.refreshTimer),this.refreshTimer=void 0)}refreshTimerSet(){if(this.refreshTimerClear(),this.autoRefresh&&this.subscriptionExpires>0){const e=this.subscriptionExpires*900;this._subscriptionRefresh=Math.floor(e/1e3),this._subscriptionRefreshLastSet=Math.floor(Date.now()/1e3),this.refreshTimer=setTimeout(()=>{this.refreshTimer=void 0,this._subscriptionRefresh=void 0,this._subscriptionRefreshLastSet=void 0,this.onRefresh(this.refresh())},e)}}stateTransition(e,t){const r=()=>{this.logger.warn(`Invalid subscription state transition from ${this.subscriptionState} to ${e}`)};switch(e){case oe.Initial:r();return;case oe.NotifyWait:r();return;case oe.Pending:if(this.subscriptionState!==oe.NotifyWait&&this.subscriptionState!==oe.Pending){r();return}break;case oe.Active:if(this.subscriptionState!==oe.NotifyWait&&this.subscriptionState!==oe.Pending&&this.subscriptionState!==oe.Active){r();return}break;case oe.Terminated:if(this.subscriptionState!==oe.NotifyWait&&this.subscriptionState!==oe.Pending&&this.subscriptionState!==oe.Active){r();return}break;default:r();return}e===oe.Pending&&t&&(this.subscriptionExpires=t),e===oe.Active&&t&&(this.subscriptionExpires=t),e===oe.Terminated&&this.dispose(),this._subscriptionState=e}timerN(){this.logger.warn("Timer N expired for SUBSCRIBE dialog. Timed out waiting for NOTIFY."),this.subscriptionState!==oe.Terminated&&(this.stateTransition(oe.Terminated),this.onTerminated())}}class s0 extends $e{constructor(e,t,r){const i=t.getHeader("Event");if(!i)throw new Error("Event undefined");const n=t.getHeader("Expires");if(!n)throw new Error("Expires undefined");super(Ve,e,t,r),this.delegate=r,this.subscriberId=t.callId+t.fromTag+i,this.subscriptionExpiresRequested=this.subscriptionExpires=Number(n),this.subscriptionEvent=i,this.subscriptionState=oe.NotifyWait,this.waitNotifyStart()}dispose(){super.dispose()}onNotify(e){const t=e.message.parseHeader("Event").event;if(!t||t!==this.subscriptionEvent){this.logger.warn("Failed to parse event."),e.reject({statusCode:489});return}const r=e.message.parseHeader("Subscription-State");if(!r||!r.state){this.logger.warn("Failed to parse subscription state."),e.reject({statusCode:489});return}const i=r.state;switch(i){case"pending":break;case"active":break;case"terminated":break;default:this.logger.warn(`Invalid subscription state ${i}`),e.reject({statusCode:489});return}if(i!=="terminated"&&!e.message.parseHeader("contact")){this.logger.warn("Failed to parse contact."),e.reject({statusCode:489});return}if(this.dialog)throw new Error("Dialog already created. This implementation only supports install of single subscriptions.");switch(this.waitNotifyStop(),this.subscriptionExpires=r.expires?Math.min(this.subscriptionExpires,Math.max(r.expires,0)):this.subscriptionExpires,i){case"pending":this.subscriptionState=oe.Pending;break;case"active":this.subscriptionState=oe.Active;break;case"terminated":this.subscriptionState=oe.Terminated;break;default:throw new Error(`Unrecognized state ${i}.`)}if(this.subscriptionState!==oe.Terminated){const n=Pn.initialDialogStateForSubscription(this.message,e.message);this.dialog=new Pn(this.subscriptionEvent,this.subscriptionExpires,this.subscriptionState,this.core,n)}if(this.delegate&&this.delegate.onNotify){const n=e,a=this.dialog;this.delegate.onNotify({request:n,subscription:a})}else e.accept()}waitNotifyStart(){this.N||(this.core.subscribers.set(this.subscriberId,this),this.N=setTimeout(()=>this.timerN(),Re.TIMER_N))}waitNotifyStop(){this.N&&(this.core.subscribers.delete(this.subscriberId),clearTimeout(this.N),this.N=void 0)}receiveResponse(e){if(this.authenticationGuard(e)){if(e.statusCode&&e.statusCode>=200&&e.statusCode<300){const t=e.getHeader("Expires");if(!t)this.logger.warn("Expires header missing in a 200-class response to SUBSCRIBE");else{const r=Number(t);r>this.subscriptionExpiresRequested&&this.logger.warn("Expires header in a 200-class response to SUBSCRIBE with a higher value than the one in the request"),r<this.subscriptionExpires&&(this.subscriptionExpires=r)}this.dialog&&this.dialog.subscriptionExpires>this.subscriptionExpires&&(this.dialog.subscriptionExpires=this.subscriptionExpires)}e.statusCode&&e.statusCode>=300&&e.statusCode<700&&this.waitNotifyStop(),super.receiveResponse(e)}}timerN(){this.logger.warn("Timer N expired for SUBSCRIBE user agent client. Timed out waiting for NOTIFY."),this.waitNotifyStop(),this.delegate&&this.delegate.onNotifyTimeout&&this.delegate.onNotifyTimeout()}}class i0 extends ft{constructor(e,t,r){super(Ge,e,t,r),this.core=e}}const On=["application/sdp","application/dtmf-relay"];class n0{constructor(e,t={}){this.userAgentClients=new Map,this.userAgentServers=new Map,this.configuration=e,this.delegate=t,this.dialogs=new Map,this.subscribers=new Map,this.logger=e.loggerFactory.getLogger("sip.user-agent-core")}dispose(){this.reset()}reset(){this.dialogs.forEach(e=>e.dispose()),this.dialogs.clear(),this.subscribers.forEach(e=>e.dispose()),this.subscribers.clear(),this.userAgentClients.forEach(e=>e.dispose()),this.userAgentClients.clear(),this.userAgentServers.forEach(e=>e.dispose()),this.userAgentServers.clear()}get loggerFactory(){return this.configuration.loggerFactory}get transport(){const e=this.configuration.transportAccessor();if(!e)throw new Error("Transport undefined.");return e}invite(e,t){return new Xo(this,e,t)}message(e,t){return new In(this,e,t)}publish(e,t){return new Qo(this,e,t)}register(e,t){return new e0(this,e,t)}subscribe(e,t){return new s0(this,e,t)}request(e,t){return new $e(Ve,this,e,t)}makeOutgoingRequestMessage(e,t,r,i,n,a,o){const d=this.configuration.sipjsId,c=this.configuration.displayName,l=this.configuration.viaForceRport,g=this.configuration.hackViaTcp,u=this.configuration.supportedOptionTags.slice();e===j.REGISTER&&u.push("path","gruu"),e===j.INVITE&&(this.configuration.contact.pubGruu||this.configuration.contact.tempGruu)&&u.push("gruu");const y=this.configuration.routeSet,v=this.configuration.userAgentHeaderFieldValue,C=this.configuration.viaHost,x=Object.assign(Object.assign({},{callIdPrefix:d,forceRport:l,fromDisplayName:c,hackViaTcp:g,optionTags:u,routeSet:y,userAgentString:v,viaHost:C}),n);return new Xt(e,t,r,i,x,a,o)}receiveIncomingRequestFromTransport(e){this.receiveRequestFromTransport(e)}receiveIncomingResponseFromTransport(e){this.receiveResponseFromTransport(e)}replyStateless(e,t){const r=this.configuration.userAgentHeaderFieldValue,i=this.configuration.supportedOptionTagsResponse;t=Object.assign(Object.assign({},t),{userAgent:r,supported:i});const n=Fn(e,t);return this.transport.send(n.message).catch(a=>{a instanceof Error&&this.logger.error(a.message),this.logger.error(`Transport error occurred sending stateless reply to ${e.method} request.`)}),n}receiveRequestFromTransport(e){const t=e.viaBranch,r=this.userAgentServers.get(t);if(e.method===j.ACK&&r&&r.transaction.state===R.Accepted&&r instanceof Gs){this.logger.warn(`Discarding out of dialog ACK after 2xx response sent on transaction ${t}.`);return}if(e.method===j.CANCEL){r?(this.replyStateless(e,{statusCode:200}),r.transaction instanceof je&&r.transaction.state===R.Proceeding&&r instanceof Gs&&r.receiveCancel(e)):this.replyStateless(e,{statusCode:481});return}if(r){r.transaction.receiveRequest(e);return}this.receiveRequest(e)}receiveRequest(e){if(!Ot.includes(e.method)){const i="Allow: "+Ot.toString();this.replyStateless(e,{statusCode:405,extraHeaders:[i]});return}if(!e.ruri)throw new Error("Request-URI undefined.");if(e.ruri.scheme!=="sip"){this.replyStateless(e,{statusCode:416});return}const t=e.ruri,r=i=>!!i&&i.user===t.user;if(!r(this.configuration.aor)&&!(r(this.configuration.contact.uri)||r(this.configuration.contact.pubGruu)||r(this.configuration.contact.tempGruu))){this.logger.warn("Request-URI does not point to us."),e.method!==j.ACK&&this.replyStateless(e,{statusCode:404});return}if(e.method===j.INVITE&&!e.hasHeader("Contact")){this.replyStateless(e,{statusCode:400,reasonPhrase:"Missing Contact Header"});return}if(!e.toTag){const i=e.viaBranch;if(!this.userAgentServers.has(i)&&Array.from(this.userAgentServers.values()).some(a=>a.transaction.request.fromTag===e.fromTag&&a.transaction.request.callId===e.callId&&a.transaction.request.cseq===e.cseq)){this.replyStateless(e,{statusCode:482});return}}e.toTag?this.receiveInsideDialogRequest(e):this.receiveOutsideDialogRequest(e)}receiveInsideDialogRequest(e){if(e.method===j.NOTIFY){const i=e.parseHeader("Event");if(!i||!i.event){this.replyStateless(e,{statusCode:489});return}const n=e.callId+e.toTag+i.event,a=this.subscribers.get(n);if(a){const o=new is(this,e);a.onNotify(o);return}}const t=e.callId+e.toTag+e.fromTag,r=this.dialogs.get(t);if(r){if(e.method===j.OPTIONS){const i="Allow: "+Ot.toString(),n="Accept: "+On.toString();this.replyStateless(e,{statusCode:200,extraHeaders:[i,n]});return}r.receiveRequest(e);return}e.method!==j.ACK&&this.replyStateless(e,{statusCode:481})}receiveOutsideDialogRequest(e){switch(e.method){case j.ACK:break;case j.BYE:this.replyStateless(e,{statusCode:481});break;case j.CANCEL:throw new Error(`Unexpected out of dialog request method ${e.method}.`);case j.INFO:this.replyStateless(e,{statusCode:405});break;case j.INVITE:{const t=new Gs(this,e);this.delegate.onInvite?this.delegate.onInvite(t):t.reject()}break;case j.MESSAGE:{const t=new $n(this,e);this.delegate.onMessage?this.delegate.onMessage(t):t.accept()}break;case j.NOTIFY:{const t=new is(this,e);this.delegate.onNotify?this.delegate.onNotify(t):t.reject({statusCode:405})}break;case j.OPTIONS:{const t="Allow: "+Ot.toString(),r="Accept: "+On.toString();this.replyStateless(e,{statusCode:200,extraHeaders:[t,r]})}break;case j.REFER:{const t=new Hn(this,e);this.delegate.onRefer?this.delegate.onRefer(t):t.reject({statusCode:405})}break;case j.REGISTER:{const t=new t0(this,e);this.delegate.onRegister?this.delegate.onRegister(t):t.reject({statusCode:405})}break;case j.SUBSCRIBE:{const t=new i0(this,e);this.delegate.onSubscribe?this.delegate.onSubscribe(t):t.reject({statusCode:480})}break;default:throw new Error(`Unexpected out of dialog request method ${e.method}.`)}}receiveResponseFromTransport(e){if(e.getHeaders("via").length>1){this.logger.warn("More than one Via header field present in the response, dropping");return}const t=e.viaBranch+e.method,r=this.userAgentClients.get(t);r?r.transaction.receiveResponse(e):this.logger.warn(`Discarding unmatched ${e.statusCode} response to ${e.method} ${t}.`)}}function a0(){return s=>!s.audio&&!s.video?Promise.resolve(new MediaStream):navigator.mediaDevices===void 0?Promise.reject(new Error("Media devices not available in insecure contexts.")):navigator.mediaDevices.getUserMedia.call(navigator.mediaDevices,s)}function o0(){return{bundlePolicy:"balanced",certificates:void 0,iceCandidatePoolSize:0,iceServers:[{urls:"stun:stun.l.google.com:19302"}],iceTransportPolicy:"all",rtcpMuxPolicy:"require"}}class wt{constructor(e,t,r){e.debug("SessionDescriptionHandler.constructor"),this.logger=e,this.mediaStreamFactory=t,this.sessionDescriptionHandlerConfiguration=r,this._localMediaStream=new MediaStream,this._remoteMediaStream=new MediaStream,this._peerConnection=new RTCPeerConnection(r==null?void 0:r.peerConnectionConfiguration),this.initPeerConnectionEventHandlers()}get localMediaStream(){return this._localMediaStream}get remoteMediaStream(){return this._remoteMediaStream}get dataChannel(){return this._dataChannel}get peerConnection(){return this._peerConnection}get peerConnectionDelegate(){return this._peerConnectionDelegate}set peerConnectionDelegate(e){this._peerConnectionDelegate=e}static dispatchAddTrackEvent(e,t){e.dispatchEvent(new MediaStreamTrackEvent("addtrack",{track:t}))}static dispatchRemoveTrackEvent(e,t){e.dispatchEvent(new MediaStreamTrackEvent("removetrack",{track:t}))}close(){this.logger.debug("SessionDescriptionHandler.close"),this._peerConnection!==void 0&&(this._peerConnection.getReceivers().forEach(e=>{e.track&&e.track.stop()}),this._peerConnection.getSenders().forEach(e=>{e.track&&e.track.stop()}),this._dataChannel&&this._dataChannel.close(),this._peerConnection.close(),this._peerConnection=void 0)}enableReceiverTracks(e){const t=this.peerConnection;if(!t)throw new Error("Peer connection closed.");t.getReceivers().forEach(r=>{r.track&&(r.track.enabled=e)})}enableSenderTracks(e){const t=this.peerConnection;if(!t)throw new Error("Peer connection closed.");t.getSenders().forEach(r=>{r.track&&(r.track.enabled=e)})}getDescription(e,t){var r,i;if(this.logger.debug("SessionDescriptionHandler.getDescription"),this._peerConnection===void 0)return Promise.reject(new Error("Peer connection closed."));this.onDataChannel=e==null?void 0:e.onDataChannel;const n=(r=e==null?void 0:e.offerOptions)===null||r===void 0?void 0:r.iceRestart,a=(e==null?void 0:e.iceGatheringTimeout)===void 0?(i=this.sessionDescriptionHandlerConfiguration)===null||i===void 0?void 0:i.iceGatheringTimeout:e==null?void 0:e.iceGatheringTimeout;return this.getLocalMediaStream(e).then(()=>this.updateDirection(e)).then(()=>this.createDataChannel(e)).then(()=>this.createLocalOfferOrAnswer(e)).then(o=>this.applyModifiers(o,t)).then(o=>this.setLocalSessionDescription(o)).then(()=>this.waitForIceGatheringComplete(n,a)).then(()=>this.getLocalSessionDescription()).then(o=>({body:o.sdp,contentType:"application/sdp"})).catch(o=>{throw this.logger.error("SessionDescriptionHandler.getDescription failed - "+o),o})}hasDescription(e){return this.logger.debug("SessionDescriptionHandler.hasDescription"),e==="application/sdp"}iceGatheringComplete(){this.logger.debug("SessionDescriptionHandler.iceGatheringComplete"),this.iceGatheringCompleteTimeoutId!==void 0&&(this.logger.debug("SessionDescriptionHandler.iceGatheringComplete - clearing timeout"),clearTimeout(this.iceGatheringCompleteTimeoutId),this.iceGatheringCompleteTimeoutId=void 0),this.iceGatheringCompletePromise!==void 0&&(this.logger.debug("SessionDescriptionHandler.iceGatheringComplete - resolving promise"),this.iceGatheringCompleteResolve&&this.iceGatheringCompleteResolve(),this.iceGatheringCompletePromise=void 0,this.iceGatheringCompleteResolve=void 0,this.iceGatheringCompleteReject=void 0)}sendDtmf(e,t){if(this.logger.debug("SessionDescriptionHandler.sendDtmf"),this._peerConnection===void 0)return this.logger.error("SessionDescriptionHandler.sendDtmf failed - peer connection closed"),!1;const r=this._peerConnection.getSenders();if(r.length===0)return this.logger.error("SessionDescriptionHandler.sendDtmf failed - no senders"),!1;const i=r[0].dtmf;if(!i)return this.logger.error("SessionDescriptionHandler.sendDtmf failed - no DTMF sender"),!1;const n=t==null?void 0:t.duration,a=t==null?void 0:t.interToneGap;try{i.insertDTMF(e,n,a)}catch(o){return this.logger.error(o.toString()),!1}return this.logger.log("SessionDescriptionHandler.sendDtmf sent via RTP: "+e.toString()),!0}setDescription(e,t,r){if(this.logger.debug("SessionDescriptionHandler.setDescription"),this._peerConnection===void 0)return Promise.reject(new Error("Peer connection closed."));this.onDataChannel=t==null?void 0:t.onDataChannel;const i=this._peerConnection.signalingState==="have-local-offer"?"answer":"offer";return this.getLocalMediaStream(t).then(()=>this.applyModifiers({sdp:e,type:i},r)).then(n=>this.setRemoteSessionDescription(n)).catch(n=>{throw this.logger.error("SessionDescriptionHandler.setDescription failed - "+n),n})}applyModifiers(e,t){return this.logger.debug("SessionDescriptionHandler.applyModifiers"),!t||t.length===0?Promise.resolve(e):t.reduce((r,i)=>r.then(i),Promise.resolve(e)).then(r=>{if(this.logger.debug("SessionDescriptionHandler.applyModifiers - modified sdp"),!r.sdp||!r.type)throw new Error("Invalid SDP.");return{sdp:r.sdp,type:r.type}})}createDataChannel(e){if(this._peerConnection===void 0)return Promise.reject(new Error("Peer connection closed."));if((e==null?void 0:e.dataChannel)!==!0||this._dataChannel)return Promise.resolve();switch(this._peerConnection.signalingState){case"stable":this.logger.debug("SessionDescriptionHandler.createDataChannel - creating data channel");try{return this._dataChannel=this._peerConnection.createDataChannel((e==null?void 0:e.dataChannelLabel)||"",e==null?void 0:e.dataChannelOptions),this.onDataChannel&&this.onDataChannel(this._dataChannel),Promise.resolve()}catch(t){return Promise.reject(t)}case"have-remote-offer":return Promise.resolve();case"have-local-offer":case"have-local-pranswer":case"have-remote-pranswer":case"closed":default:return Promise.reject(new Error("Invalid signaling state "+this._peerConnection.signalingState))}}createLocalOfferOrAnswer(e){if(this._peerConnection===void 0)return Promise.reject(new Error("Peer connection closed."));switch(this._peerConnection.signalingState){case"stable":return this.logger.debug("SessionDescriptionHandler.createLocalOfferOrAnswer - creating SDP offer"),this._peerConnection.createOffer(e==null?void 0:e.offerOptions);case"have-remote-offer":return this.logger.debug("SessionDescriptionHandler.createLocalOfferOrAnswer - creating SDP answer"),this._peerConnection.createAnswer(e==null?void 0:e.answerOptions);case"have-local-offer":case"have-local-pranswer":case"have-remote-pranswer":case"closed":default:return Promise.reject(new Error("Invalid signaling state "+this._peerConnection.signalingState))}}getLocalMediaStream(e){if(this.logger.debug("SessionDescriptionHandler.getLocalMediaStream"),this._peerConnection===void 0)return Promise.reject(new Error("Peer connection closed."));let t=Object.assign({},e==null?void 0:e.constraints);if(this.localMediaStreamConstraints){if(t.audio=t.audio||this.localMediaStreamConstraints.audio,t.video=t.video||this.localMediaStreamConstraints.video,JSON.stringify(this.localMediaStreamConstraints.audio)===JSON.stringify(t.audio)&&JSON.stringify(this.localMediaStreamConstraints.video)===JSON.stringify(t.video))return Promise.resolve()}else t.audio===void 0&&t.video===void 0&&(t={audio:!0});return this.localMediaStreamConstraints=t,this.mediaStreamFactory(t,this,e).then(r=>this.setLocalMediaStream(r))}setLocalMediaStream(e){if(this.logger.debug("SessionDescriptionHandler.setLocalMediaStream"),!this._peerConnection)throw new Error("Peer connection undefined.");const t=this._peerConnection,r=this._localMediaStream,i=[],n=d=>{const c=d.kind;if(c!=="audio"&&c!=="video")throw new Error(`Unknown new track kind ${c}.`);const l=t.getSenders().find(g=>g.track&&g.track.kind===c);l?i.push(new Promise(g=>{this.logger.debug(`SessionDescriptionHandler.setLocalMediaStream - replacing sender ${c} track`),g()}).then(()=>l.replaceTrack(d).then(()=>{const g=r.getTracks().find(u=>u.kind===c);g&&(g.stop(),r.removeTrack(g),wt.dispatchRemoveTrackEvent(r,g)),r.addTrack(d),wt.dispatchAddTrackEvent(r,d)}).catch(g=>{throw this.logger.error(`SessionDescriptionHandler.setLocalMediaStream - failed to replace sender ${c} track`),g}))):i.push(new Promise(g=>{this.logger.debug(`SessionDescriptionHandler.setLocalMediaStream - adding sender ${c} track`),g()}).then(()=>{try{t.addTrack(d,r)}catch(g){throw this.logger.error(`SessionDescriptionHandler.setLocalMediaStream - failed to add sender ${c} track`),g}r.addTrack(d),wt.dispatchAddTrackEvent(r,d)}))},a=e.getAudioTracks();a.length&&n(a[0]);const o=e.getVideoTracks();return o.length&&n(o[0]),i.reduce((d,c)=>d.then(()=>c),Promise.resolve())}getLocalSessionDescription(){if(this.logger.debug("SessionDescriptionHandler.getLocalSessionDescription"),this._peerConnection===void 0)return Promise.reject(new Error("Peer connection closed."));const e=this._peerConnection.localDescription;return e?Promise.resolve(e):Promise.reject(new Error("Failed to get local session description"))}setLocalSessionDescription(e){return this.logger.debug("SessionDescriptionHandler.setLocalSessionDescription"),this._peerConnection===void 0?Promise.reject(new Error("Peer connection closed.")):this._peerConnection.setLocalDescription(e)}setRemoteSessionDescription(e){if(this.logger.debug("SessionDescriptionHandler.setRemoteSessionDescription"),this._peerConnection===void 0)return Promise.reject(new Error("Peer connection closed."));const t=e.sdp;let r;switch(this._peerConnection.signalingState){case"stable":r="offer";break;case"have-local-offer":r="answer";break;case"have-local-pranswer":case"have-remote-offer":case"have-remote-pranswer":case"closed":default:return Promise.reject(new Error("Invalid signaling state "+this._peerConnection.signalingState))}return t?this._peerConnection.setRemoteDescription({sdp:t,type:r}):(this.logger.error("SessionDescriptionHandler.setRemoteSessionDescription failed - cannot set null sdp"),Promise.reject(new Error("SDP is undefined")))}setRemoteTrack(e){this.logger.debug("SessionDescriptionHandler.setRemoteTrack");const t=this._remoteMediaStream;t.getTrackById(e.id)?this.logger.debug(`SessionDescriptionHandler.setRemoteTrack - have remote ${e.kind} track`):e.kind==="audio"?(this.logger.debug(`SessionDescriptionHandler.setRemoteTrack - adding remote ${e.kind} track`),t.getAudioTracks().forEach(r=>{r.stop(),t.removeTrack(r),wt.dispatchRemoveTrackEvent(t,r)}),t.addTrack(e),wt.dispatchAddTrackEvent(t,e)):e.kind==="video"&&(this.logger.debug(`SessionDescriptionHandler.setRemoteTrack - adding remote ${e.kind} track`),t.getVideoTracks().forEach(r=>{r.stop(),t.removeTrack(r),wt.dispatchRemoveTrackEvent(t,r)}),t.addTrack(e),wt.dispatchAddTrackEvent(t,e))}updateDirection(e){if(this._peerConnection===void 0)return Promise.reject(new Error("Peer connection closed."));switch(this._peerConnection.signalingState){case"stable":this.logger.debug("SessionDescriptionHandler.updateDirection - setting offer direction");{const t=r=>{switch(r){case"inactive":return e!=null&&e.hold?"inactive":"recvonly";case"recvonly":return e!=null&&e.hold?"inactive":"recvonly";case"sendonly":return e!=null&&e.hold?"sendonly":"sendrecv";case"sendrecv":return e!=null&&e.hold?"sendonly":"sendrecv";case"stopped":return"stopped";default:throw new Error("Should never happen")}};this._peerConnection.getTransceivers().forEach(r=>{if(r.direction){const i=t(r.direction);r.direction!==i&&(r.direction=i)}})}break;case"have-remote-offer":this.logger.debug("SessionDescriptionHandler.updateDirection - setting answer direction");{const t=(()=>{const i=this._peerConnection.remoteDescription;if(!i)throw new Error("Failed to read remote offer");const n=/a=sendrecv\r\n|a=sendonly\r\n|a=recvonly\r\n|a=inactive\r\n/.exec(i.sdp);if(n)switch(n[0]){case`a=inactive\r
|
|
66
|
+
`:return"inactive";case`a=recvonly\r
|
|
67
|
+
`:return"recvonly";case`a=sendonly\r
|
|
68
|
+
`:return"sendonly";case`a=sendrecv\r
|
|
69
|
+
`:return"sendrecv";default:throw new Error("Should never happen")}return"sendrecv"})(),r=(()=>{switch(t){case"inactive":return"inactive";case"recvonly":return"sendonly";case"sendonly":return e!=null&&e.hold?"inactive":"recvonly";case"sendrecv":return e!=null&&e.hold?"sendonly":"sendrecv";default:throw new Error("Should never happen")}})();this._peerConnection.getTransceivers().forEach(i=>{i.direction&&i.direction!=="stopped"&&i.direction!==r&&(i.direction=r)})}break;case"have-local-offer":case"have-local-pranswer":case"have-remote-pranswer":case"closed":default:return Promise.reject(new Error("Invalid signaling state "+this._peerConnection.signalingState))}return Promise.resolve()}waitForIceGatheringComplete(e=!1,t=0){return this.logger.debug("SessionDescriptionHandler.waitForIceGatheringToComplete"),this._peerConnection===void 0?Promise.reject("Peer connection closed."):!e&&this._peerConnection.iceGatheringState==="complete"?(this.logger.debug("SessionDescriptionHandler.waitForIceGatheringToComplete - already complete"),Promise.resolve()):(this.iceGatheringCompletePromise!==void 0&&(this.logger.debug("SessionDescriptionHandler.waitForIceGatheringToComplete - rejecting prior waiting promise"),this.iceGatheringCompleteReject&&this.iceGatheringCompleteReject(new Error("Promise superseded.")),this.iceGatheringCompletePromise=void 0,this.iceGatheringCompleteResolve=void 0,this.iceGatheringCompleteReject=void 0),this.iceGatheringCompletePromise=new Promise((r,i)=>{this.iceGatheringCompleteResolve=r,this.iceGatheringCompleteReject=i,t>0&&(this.logger.debug("SessionDescriptionHandler.waitForIceGatheringToComplete - timeout in "+t),this.iceGatheringCompleteTimeoutId=setTimeout(()=>{this.logger.debug("SessionDescriptionHandler.waitForIceGatheringToComplete - timeout"),this.iceGatheringComplete()},t))}),this.iceGatheringCompletePromise)}initPeerConnectionEventHandlers(){if(this.logger.debug("SessionDescriptionHandler.initPeerConnectionEventHandlers"),!this._peerConnection)throw new Error("Peer connection undefined.");const e=this._peerConnection;e.onconnectionstatechange=t=>{var r;const i=e.connectionState;this.logger.debug(`SessionDescriptionHandler.onconnectionstatechange ${i}`),!((r=this._peerConnectionDelegate)===null||r===void 0)&&r.onconnectionstatechange&&this._peerConnectionDelegate.onconnectionstatechange(t)},e.ondatachannel=t=>{var r;this.logger.debug("SessionDescriptionHandler.ondatachannel"),this._dataChannel=t.channel,this.onDataChannel&&this.onDataChannel(this._dataChannel),!((r=this._peerConnectionDelegate)===null||r===void 0)&&r.ondatachannel&&this._peerConnectionDelegate.ondatachannel(t)},e.onicecandidate=t=>{var r;this.logger.debug("SessionDescriptionHandler.onicecandidate"),!((r=this._peerConnectionDelegate)===null||r===void 0)&&r.onicecandidate&&this._peerConnectionDelegate.onicecandidate(t)},e.onicecandidateerror=t=>{var r;this.logger.debug("SessionDescriptionHandler.onicecandidateerror"),!((r=this._peerConnectionDelegate)===null||r===void 0)&&r.onicecandidateerror&&this._peerConnectionDelegate.onicecandidateerror(t)},e.oniceconnectionstatechange=t=>{var r;const i=e.iceConnectionState;this.logger.debug(`SessionDescriptionHandler.oniceconnectionstatechange ${i}`),!((r=this._peerConnectionDelegate)===null||r===void 0)&&r.oniceconnectionstatechange&&this._peerConnectionDelegate.oniceconnectionstatechange(t)},e.onicegatheringstatechange=t=>{var r;const i=e.iceGatheringState;this.logger.debug(`SessionDescriptionHandler.onicegatheringstatechange ${i}`),i==="complete"&&this.iceGatheringComplete(),!((r=this._peerConnectionDelegate)===null||r===void 0)&&r.onicegatheringstatechange&&this._peerConnectionDelegate.onicegatheringstatechange(t)},e.onnegotiationneeded=t=>{var r;this.logger.debug("SessionDescriptionHandler.onnegotiationneeded"),!((r=this._peerConnectionDelegate)===null||r===void 0)&&r.onnegotiationneeded&&this._peerConnectionDelegate.onnegotiationneeded(t)},e.onsignalingstatechange=t=>{var r;const i=e.signalingState;this.logger.debug(`SessionDescriptionHandler.onsignalingstatechange ${i}`),!((r=this._peerConnectionDelegate)===null||r===void 0)&&r.onsignalingstatechange&&this._peerConnectionDelegate.onsignalingstatechange(t)},e.ontrack=t=>{var r;const i=t.track.kind,n=t.track.enabled?"enabled":"disabled";this.logger.debug(`SessionDescriptionHandler.ontrack ${i} ${n}`),this.setRemoteTrack(t.track),!((r=this._peerConnectionDelegate)===null||r===void 0)&&r.ontrack&&this._peerConnectionDelegate.ontrack(t)}}}function c0(s){return(e,t)=>{s===void 0&&(s=a0());const i={iceGatheringTimeout:(t==null?void 0:t.iceGatheringTimeout)!==void 0?t==null?void 0:t.iceGatheringTimeout:5e3,peerConnectionConfiguration:Object.assign(Object.assign({},o0()),t==null?void 0:t.peerConnectionConfiguration)},n=e.userAgent.getLogger("sip.SessionDescriptionHandler");return new wt(n,s,i)}}class as{constructor(e,t){if(this._state=K.Disconnected,this.transitioningState=!1,this._stateEventEmitter=new kr,this.logger=e,t){const n=t,a=n==null?void 0:n.wsServers,o=n==null?void 0:n.maxReconnectionAttempts;a!==void 0&&this.logger.warn('The transport option "wsServers" as has apparently been specified and has been deprecated. It will no longer be available starting with SIP.js release 0.16.0. Please update accordingly.'),o!==void 0&&this.logger.warn('The transport option "maxReconnectionAttempts" as has apparently been specified and has been deprecated. It will no longer be available starting with SIP.js release 0.16.0. Please update accordingly.'),a&&!t.server&&(typeof a=="string"&&(t.server=a),a instanceof Array&&(t.server=a[0]))}this.configuration=Object.assign(Object.assign({},as.defaultOptions),t);const r=this.configuration.server,i=Ae.parse(r,"absoluteURI");if(i===-1)throw this.logger.error(`Invalid WebSocket Server URL "${r}"`),new Error("Invalid WebSocket Server URL");if(!["wss","ws","udp"].includes(i.scheme))throw this.logger.error(`Invalid scheme in WebSocket Server URL "${r}"`),new Error("Invalid scheme in WebSocket Server URL");this._protocol=i.scheme.toUpperCase()}dispose(){return this.disconnect()}get protocol(){return this._protocol}get server(){return this.configuration.server}get state(){return this._state}get stateChange(){return this._stateEventEmitter}get ws(){return this._ws}connect(){return this._connect()}disconnect(){return this._disconnect()}isConnected(){return this.state===K.Connected}send(e){return this._send(e)}_connect(){switch(this.logger.log(`Connecting ${this.server}`),this.state){case K.Connecting:if(this.transitioningState)return Promise.reject(this.transitionLoopDetectedError(K.Connecting));if(!this.connectPromise)throw new Error("Connect promise must be defined.");return this.connectPromise;case K.Connected:if(this.transitioningState)return Promise.reject(this.transitionLoopDetectedError(K.Connecting));if(this.connectPromise)throw new Error("Connect promise must not be defined.");return Promise.resolve();case K.Disconnecting:if(this.connectPromise)throw new Error("Connect promise must not be defined.");try{this.transitionState(K.Connecting)}catch(t){if(t instanceof Br)return Promise.reject(t);throw t}break;case K.Disconnected:if(this.connectPromise)throw new Error("Connect promise must not be defined.");try{this.transitionState(K.Connecting)}catch(t){if(t instanceof Br)return Promise.reject(t);throw t}break;default:throw new Error("Unknown state")}let e;try{e=new WebSocket(this.server,"sip"),e.binaryType="arraybuffer",e.addEventListener("close",t=>this.onWebSocketClose(t,e)),e.addEventListener("error",t=>this.onWebSocketError(t,e)),e.addEventListener("open",t=>this.onWebSocketOpen(t,e)),e.addEventListener("message",t=>this.onWebSocketMessage(t,e)),this._ws=e}catch(t){return this._ws=void 0,this.logger.error("WebSocket construction failed."),this.logger.error(t.toString()),new Promise((r,i)=>{this.connectResolve=r,this.connectReject=i,this.transitionState(K.Disconnected,t)})}return this.connectPromise=new Promise((t,r)=>{this.connectResolve=t,this.connectReject=r,this.connectTimeout=setTimeout(()=>{this.logger.warn("Connect timed out. Exceeded time set in configuration.connectionTimeout: "+this.configuration.connectionTimeout+"s."),e.close(1e3)},this.configuration.connectionTimeout*1e3)}),this.connectPromise}_disconnect(){switch(this.logger.log(`Disconnecting ${this.server}`),this.state){case K.Connecting:if(this.disconnectPromise)throw new Error("Disconnect promise must not be defined.");try{this.transitionState(K.Disconnecting)}catch(t){if(t instanceof Br)return Promise.reject(t);throw t}break;case K.Connected:if(this.disconnectPromise)throw new Error("Disconnect promise must not be defined.");try{this.transitionState(K.Disconnecting)}catch(t){if(t instanceof Br)return Promise.reject(t);throw t}break;case K.Disconnecting:if(this.transitioningState)return Promise.reject(this.transitionLoopDetectedError(K.Disconnecting));if(!this.disconnectPromise)throw new Error("Disconnect promise must be defined.");return this.disconnectPromise;case K.Disconnected:if(this.transitioningState)return Promise.reject(this.transitionLoopDetectedError(K.Disconnecting));if(this.disconnectPromise)throw new Error("Disconnect promise must not be defined.");return Promise.resolve();default:throw new Error("Unknown state")}if(!this._ws)throw new Error("WebSocket must be defined.");const e=this._ws;return this.disconnectPromise=new Promise((t,r)=>{this.disconnectResolve=t,this.disconnectReject=r;try{e.close(1e3)}catch(i){throw this.logger.error("WebSocket close failed."),this.logger.error(i.toString()),i}}),this.disconnectPromise}_send(e){if(this.configuration.traceSip===!0&&this.logger.log(`Sending WebSocket message:
|
|
70
|
+
|
|
71
|
+
`+e+`
|
|
72
|
+
`),this._state!==K.Connected)return Promise.reject(new Error("Not connected."));if(!this._ws)throw new Error("WebSocket undefined.");try{this._ws.send(e)}catch(t){return t instanceof Error?Promise.reject(t):Promise.reject(new Error("WebSocket send failed."))}return Promise.resolve()}onWebSocketClose(e,t){if(t!==this._ws)return;const r=`WebSocket closed ${this.server} (code: ${e.code})`,i=this.disconnectPromise?void 0:new Error(r);i&&this.logger.warn("WebSocket closed unexpectedly"),this.logger.log(r),this._ws=void 0,this.transitionState(K.Disconnected,i)}onWebSocketError(e,t){t===this._ws&&this.logger.error("WebSocket error occurred.")}onWebSocketMessage(e,t){if(t!==this._ws)return;const r=e.data;let i;if(/^(\r\n)+$/.test(r)){this.clearKeepAliveTimeout(),this.configuration.traceSip===!0&&this.logger.log("Received WebSocket message with CRLF Keep Alive response");return}if(!r){this.logger.warn("Received empty message, discarding...");return}if(typeof r!="string"){try{i=new TextDecoder().decode(new Uint8Array(r))}catch(n){this.logger.error(n.toString()),this.logger.error("Received WebSocket binary message failed to be converted into string, message discarded");return}this.configuration.traceSip===!0&&this.logger.log(`Received WebSocket binary message:
|
|
73
|
+
|
|
74
|
+
`+i+`
|
|
75
|
+
`)}else i=r,this.configuration.traceSip===!0&&this.logger.log(`Received WebSocket text message:
|
|
76
|
+
|
|
77
|
+
`+i+`
|
|
78
|
+
`);if(this.state!==K.Connected){this.logger.warn("Received message while not connected, discarding...");return}if(this.onMessage)try{this.onMessage(i)}catch(n){throw this.logger.error(n.toString()),this.logger.error("Exception thrown by onMessage callback"),n}}onWebSocketOpen(e,t){t===this._ws&&this._state===K.Connecting&&(this.logger.log(`WebSocket opened ${this.server}`),this.transitionState(K.Connected))}transitionLoopDetectedError(e){let t="A state transition loop has been detected.";return t+=` An attempt to transition from ${this._state} to ${e} before the prior transition completed.`,t+=" Perhaps you are synchronously calling connect() or disconnect() from a callback or state change handler?",this.logger.error(t),new Br("Loop detected.")}transitionState(e,t){const r=()=>{throw new Error(`Invalid state transition from ${this._state} to ${e}`)};if(this.transitioningState)throw this.transitionLoopDetectedError(e);switch(this.transitioningState=!0,this._state){case K.Connecting:e!==K.Connected&&e!==K.Disconnecting&&e!==K.Disconnected&&r();break;case K.Connected:e!==K.Disconnecting&&e!==K.Disconnected&&r();break;case K.Disconnecting:e!==K.Connecting&&e!==K.Disconnected&&r();break;case K.Disconnected:e!==K.Connecting&&r();break;default:throw new Error("Unknown state.")}const i=this._state;this._state=e;const n=this.connectResolve,a=this.connectReject;i===K.Connecting&&(this.connectPromise=void 0,this.connectResolve=void 0,this.connectReject=void 0);const o=this.disconnectResolve,d=this.disconnectReject;if(i===K.Disconnecting&&(this.disconnectPromise=void 0,this.disconnectResolve=void 0,this.disconnectReject=void 0),this.connectTimeout&&(clearTimeout(this.connectTimeout),this.connectTimeout=void 0),this.logger.log(`Transitioned from ${i} to ${this._state}`),this._stateEventEmitter.emit(this._state),e===K.Connected&&(this.startSendingKeepAlives(),this.onConnect))try{this.onConnect()}catch(c){throw this.logger.error(c.toString()),this.logger.error("Exception thrown by onConnect callback"),c}if(i===K.Connected&&(this.stopSendingKeepAlives(),this.onDisconnect))try{t?this.onDisconnect(t):this.onDisconnect()}catch(c){throw this.logger.error(c.toString()),this.logger.error("Exception thrown by onDisconnect callback"),c}if(i===K.Connecting){if(!n)throw new Error("Connect resolve undefined.");if(!a)throw new Error("Connect reject undefined.");e===K.Connected?n():a(t||new Error("Connect aborted."))}if(i===K.Disconnecting){if(!o)throw new Error("Disconnect resolve undefined.");if(!d)throw new Error("Disconnect reject undefined.");e===K.Disconnected?o():d(t||new Error("Disconnect aborted."))}this.transitioningState=!1}clearKeepAliveTimeout(){this.keepAliveDebounceTimeout&&clearTimeout(this.keepAliveDebounceTimeout),this.keepAliveDebounceTimeout=void 0}sendKeepAlive(){return this.keepAliveDebounceTimeout?Promise.resolve():(this.keepAliveDebounceTimeout=setTimeout(()=>{this.clearKeepAliveTimeout()},this.configuration.keepAliveDebounce*1e3),this.send(`\r
|
|
79
|
+
\r
|
|
80
|
+
`))}startSendingKeepAlives(){const e=t=>{const r=t*.8;return 1e3*(Math.random()*(t-r)+r)};this.configuration.keepAliveInterval&&!this.keepAliveInterval&&(this.keepAliveInterval=setInterval(()=>{this.sendKeepAlive(),this.startSendingKeepAlives()},e(this.configuration.keepAliveInterval)))}stopSendingKeepAlives(){this.keepAliveInterval&&clearInterval(this.keepAliveInterval),this.keepAliveDebounceTimeout&&clearTimeout(this.keepAliveDebounceTimeout),this.keepAliveInterval=void 0,this.keepAliveDebounceTimeout=void 0}}as.defaultOptions={server:"",connectionTimeout:5,keepAliveInterval:0,keepAliveDebounce:10,traceSip:!0};class Qt{constructor(e={}){if(this._publishers={},this._registerers={},this._sessions={},this._subscriptions={},this._state=Ie.Stopped,this._stateEventEmitter=new kr,this.delegate=e.delegate,this.options=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},Qt.defaultOptions()),{sipjsId:Jt(5)}),{uri:new lt("sip","anonymous."+Jt(6),"anonymous.invalid")}),{viaHost:Jt(12)+".invalid"}),Qt.stripUndefinedProperties(e)),this.options.hackIpInContact)if(typeof this.options.hackIpInContact=="boolean"&&this.options.hackIpInContact){const i=Math.floor(Math.random()*254+1);this.options.viaHost="192.0.2."+i}else this.options.hackIpInContact&&(this.options.viaHost=this.options.hackIpInContact);switch(this.loggerFactory=new No,this.logger=this.loggerFactory.getLogger("sip.UserAgent"),this.loggerFactory.builtinEnabled=this.options.logBuiltinEnabled,this.loggerFactory.connector=this.options.logConnector,this.options.logLevel){case"error":this.loggerFactory.level=Fe.error;break;case"warn":this.loggerFactory.level=Fe.warn;break;case"log":this.loggerFactory.level=Fe.log;break;case"debug":this.loggerFactory.level=Fe.debug;break}if(this.options.logConfiguration&&(this.logger.log("Configuration:"),Object.keys(this.options).forEach(t=>{const r=this.options[t];switch(t){case"uri":case"sessionDescriptionHandlerFactory":this.logger.log("· "+t+": "+r);break;case"authorizationPassword":this.logger.log("· "+t+": NOT SHOWN");break;case"transportConstructor":this.logger.log("· "+t+": "+r.name);break;default:this.logger.log("· "+t+": "+JSON.stringify(r))}})),this.options.transportOptions){const t=this.options.transportOptions,r=t.maxReconnectionAttempts,i=t.reconnectionTimeout;r!==void 0&&this.logger.warn('The transport option "maxReconnectionAttempts" as has apparently been specified and has been deprecated. It will no longer be available starting with SIP.js release 0.16.0. Please update accordingly.'),i!==void 0&&this.logger.warn('The transport option "reconnectionTimeout" as has apparently been specified and has been deprecated. It will no longer be available starting with SIP.js release 0.16.0. Please update accordingly.'),e.reconnectionDelay===void 0&&i!==void 0&&(this.options.reconnectionDelay=i),e.reconnectionAttempts===void 0&&r!==void 0&&(this.options.reconnectionAttempts=r)}if(e.reconnectionDelay!==void 0&&this.logger.warn('The user agent option "reconnectionDelay" as has apparently been specified and has been deprecated. It will no longer be available starting with SIP.js release 0.16.0. Please update accordingly.'),e.reconnectionAttempts!==void 0&&this.logger.warn('The user agent option "reconnectionAttempts" as has apparently been specified and has been deprecated. It will no longer be available starting with SIP.js release 0.16.0. Please update accordingly.'),this._transport=new this.options.transportConstructor(this.getLogger("sip.Transport"),this.options.transportOptions),this.initTransportCallbacks(),this._contact=this.initContact(),this._instanceId=this.options.instanceId?this.options.instanceId:Qt.newUUID(),Ae.parse(this._instanceId,"uuid")===-1)throw new Error("Invalid instanceId.");this._userAgentCore=this.initCore()}static makeURI(e){return Ae.URIParse(e)}static defaultOptions(){return{allowLegacyNotifications:!1,authorizationHa1:"",authorizationPassword:"",authorizationUsername:"",delegate:{},contactName:"",contactParams:{transport:"ws"},displayName:"",forceRport:!1,gracefulShutdown:!0,hackAllowUnregisteredOptionTags:!1,hackIpInContact:!1,hackViaTcp:!1,instanceId:"",instanceIdAlwaysAdded:!1,logBuiltinEnabled:!0,logConfiguration:!0,logConnector:()=>{},logLevel:"log",noAnswerTimeout:60,preloadedRouteSet:[],reconnectionAttempts:0,reconnectionDelay:4,sendInitialProvisionalResponse:!0,sessionDescriptionHandlerFactory:c0(),sessionDescriptionHandlerFactoryOptions:{},sipExtension100rel:rt.Unsupported,sipExtensionReplaces:rt.Unsupported,sipExtensionExtraSupported:[],sipjsId:"",transportConstructor:as,transportOptions:{},uri:new lt("sip","anonymous","anonymous.invalid"),userAgentString:"SIP.js/"+bo,viaHost:""}}static newUUID(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,t=>{const r=Math.floor(Math.random()*16);return(t==="x"?r:r%4+8).toString(16)})}static stripUndefinedProperties(e){return Object.keys(e).reduce((t,r)=>(e[r]!==void 0&&(t[r]=e[r]),t),{})}get configuration(){return this.options}get contact(){return this._contact}get instanceId(){return this._instanceId}get state(){return this._state}get stateChange(){return this._stateEventEmitter}get transport(){return this._transport}get userAgentCore(){return this._userAgentCore}getLogger(e,t){return this.loggerFactory.getLogger(e,t)}getLoggerFactory(){return this.loggerFactory}isConnected(){return this.transport.isConnected()}reconnect(){return this.state===Ie.Stopped?Promise.reject(new Error("User agent stopped.")):Promise.resolve().then(()=>this.transport.connect())}start(){return this.state===Ie.Started?(this.logger.warn("User agent already started"),Promise.resolve()):(this.logger.log(`Starting ${this.configuration.uri}`),this.transitionState(Ie.Started),this.transport.connect())}async stop(){if(this.state===Ie.Stopped)return this.logger.warn("User agent already stopped"),Promise.resolve();if(this.logger.log(`Stopping ${this.configuration.uri}`),!this.options.gracefulShutdown)return this.logger.log("Dispose of transport"),this.transport.dispose().catch(o=>{throw this.logger.error(o.message),o}),this.logger.log("Dispose of core"),this.userAgentCore.dispose(),this._publishers={},this._registerers={},this._sessions={},this._subscriptions={},this.transitionState(Ie.Stopped),Promise.resolve();const e=Object.assign({},this._publishers),t=Object.assign({},this._registerers),r=Object.assign({},this._sessions),i=Object.assign({},this._subscriptions),n=this.transport,a=this.userAgentCore;this.logger.log("Dispose of registerers");for(const o in t)t[o]&&await t[o].dispose().catch(d=>{throw this.logger.error(d.message),delete this._registerers[o],d});this.logger.log("Dispose of sessions");for(const o in r)r[o]&&await r[o].dispose().catch(d=>{throw this.logger.error(d.message),delete this._sessions[o],d});this.logger.log("Dispose of subscriptions");for(const o in i)i[o]&&await i[o].dispose().catch(d=>{throw this.logger.error(d.message),delete this._subscriptions[o],d});this.logger.log("Dispose of publishers");for(const o in e)e[o]&&await e[o].dispose().catch(d=>{throw this.logger.error(d.message),delete this._publishers[o],d});this.logger.log("Dispose of transport"),await n.dispose().catch(o=>{throw this.logger.error(o.message),o}),this.logger.log("Dispose of core"),a.dispose(),this.transitionState(Ie.Stopped)}_makeInviter(e,t){return new Sn(this,e,t)}attemptReconnection(e=1){const t=this.options.reconnectionAttempts,r=this.options.reconnectionDelay;if(e>t){this.logger.log("Maximum reconnection attempts reached");return}this.logger.log(`Reconnection attempt ${e} of ${t} - trying`),setTimeout(()=>{this.reconnect().then(()=>{this.logger.log(`Reconnection attempt ${e} of ${t} - succeeded`)}).catch(i=>{this.logger.error(i.message),this.logger.log(`Reconnection attempt ${e} of ${t} - failed`),this.attemptReconnection(++e)})},e===1?0:r*1e3)}initContact(){const e=this.options.contactName!==""?this.options.contactName:Jt(8),t=this.options.contactParams;return{pubGruu:void 0,tempGruu:void 0,uri:new lt("sip",e,this.options.viaHost,void 0,t),toString:(i={})=>{const n=i.anonymous||!1,a=i.outbound||!1,o=i.register||!1;let d="<";return n?d+=this.contact.tempGruu||`sip:anonymous@anonymous.invalid;transport=${t.transport?t.transport:"ws"}`:o?d+=this.contact.uri:d+=this.contact.pubGruu||this.contact.uri,a&&(d+=";ob"),d+=">",this.options.instanceIdAlwaysAdded&&(d+=';+sip.instance="<urn:uuid:'+this._instanceId+'>"'),d}}}initCore(){let e=[];e.push("outbound"),this.options.sipExtension100rel===rt.Supported&&e.push("100rel"),this.options.sipExtensionReplaces===rt.Supported&&e.push("replaces"),this.options.sipExtensionExtraSupported&&e.push(...this.options.sipExtensionExtraSupported),this.options.hackAllowUnregisteredOptionTags||(e=e.filter(n=>Po[n])),e=Array.from(new Set(e));const t=e.slice();(this.contact.pubGruu||this.contact.tempGruu)&&t.push("gruu");const r={aor:this.options.uri,contact:this.contact,displayName:this.options.displayName,loggerFactory:this.loggerFactory,hackViaTcp:this.options.hackViaTcp,routeSet:this.options.preloadedRouteSet,supportedOptionTags:e,supportedOptionTagsResponse:t,sipjsId:this.options.sipjsId,userAgentHeaderFieldValue:this.options.userAgentString,viaForceRport:this.options.forceRport,viaHost:this.options.viaHost,authenticationFactory:()=>{const n=this.options.authorizationUsername?this.options.authorizationUsername:this.options.uri.user,a=this.options.authorizationPassword?this.options.authorizationPassword:void 0,o=this.options.authorizationHa1?this.options.authorizationHa1:void 0;return new Mo(this.getLoggerFactory(),o,n,a)},transportAccessor:()=>this.transport},i={onInvite:n=>{var a;const o=new Oo(this,n);if(n.delegate={onCancel:d=>{o._onCancel(d)},onTransportError:d=>{this.logger.error("A transport error has occurred while handling an incoming INVITE request.")}},n.trying(),this.options.sipExtensionReplaces!==rt.Unsupported){const c=n.message.parseHeader("replaces");if(c){const l=c.call_id;if(typeof l!="string")throw new Error("Type of call id is not string");const g=c.replaces_to_tag;if(typeof g!="string")throw new Error("Type of to tag is not string");const u=c.replaces_from_tag;if(typeof u!="string")throw new Error("type of from tag is not string");const y=l+g+u,v=this.userAgentCore.dialogs.get(y);if(!v){o.reject({statusCode:481});return}if(!v.early&&c.early_only===!0){o.reject({statusCode:486});return}const C=this._sessions[l+u]||this._sessions[l+g]||void 0;if(!C)throw new Error("Session does not exist.");o._replacee=C}}if(!((a=this.delegate)===null||a===void 0)&&a.onInvite){if(o.autoSendAnInitialProvisionalResponse){o.progress().then(()=>{var d;if(((d=this.delegate)===null||d===void 0?void 0:d.onInvite)===void 0)throw new Error("onInvite undefined.");this.delegate.onInvite(o)});return}this.delegate.onInvite(o);return}o.reject({statusCode:486})},onMessage:n=>{if(this.delegate&&this.delegate.onMessage){const a=new Tn(n);this.delegate.onMessage(a)}else n.accept()},onNotify:n=>{if(this.delegate&&this.delegate.onNotify){const a=new Ws(n);this.delegate.onNotify(a)}else this.options.allowLegacyNotifications?n.accept():n.reject({statusCode:481})},onRefer:n=>{this.logger.warn("Received an out of dialog REFER request"),this.delegate&&this.delegate.onReferRequest?this.delegate.onReferRequest(n):n.reject({statusCode:405})},onRegister:n=>{this.logger.warn("Received an out of dialog REGISTER request"),this.delegate&&this.delegate.onRegisterRequest?this.delegate.onRegisterRequest(n):n.reject({statusCode:405})},onSubscribe:n=>{this.logger.warn("Received an out of dialog SUBSCRIBE request"),this.delegate&&this.delegate.onSubscribeRequest?this.delegate.onSubscribeRequest(n):n.reject({statusCode:405})}};return new n0(r,i)}initTransportCallbacks(){this.transport.onConnect=()=>this.onTransportConnect(),this.transport.onDisconnect=e=>this.onTransportDisconnect(e),this.transport.onMessage=e=>this.onTransportMessage(e)}onTransportConnect(){this.state!==Ie.Stopped&&this.delegate&&this.delegate.onConnect&&this.delegate.onConnect()}onTransportDisconnect(e){this.state!==Ie.Stopped&&(this.delegate&&this.delegate.onDisconnect&&this.delegate.onDisconnect(e),e&&this.options.reconnectionAttempts>0&&this.attemptReconnection())}onTransportMessage(e){const t=rs.parseMessage(e,this.getLogger("sip.Parser"));if(!t){this.logger.warn("Failed to parse incoming message. Dropping.");return}if(this.state===Ie.Stopped&&t instanceof fr){this.logger.warn(`Received ${t.method} request while stopped. Dropping.`);return}const r=()=>{const i=["from","to","call_id","cseq","via"];for(const n of i)if(!t.hasHeader(n))return this.logger.warn(`Missing mandatory header field : ${n}.`),!1;return!0};if(t instanceof fr){if(!r()){this.logger.warn("Request missing mandatory header field. Dropping.");return}if(!t.toTag&&t.callId.substr(0,5)===this.options.sipjsId){this.userAgentCore.replyStateless(t,{statusCode:482});return}const i=Ir(t.body),n=t.getHeader("content-length");if(n&&i<Number(n)){this.userAgentCore.replyStateless(t,{statusCode:400});return}}if(t instanceof Ht){if(!r()){this.logger.warn("Response missing mandatory header field. Dropping.");return}if(t.getHeaders("via").length>1){this.logger.warn("More than one Via header field present in the response. Dropping.");return}if(t.via.host!==this.options.viaHost||t.via.port!==void 0){this.logger.warn("Via sent-by in the response does not match UA Via host value. Dropping.");return}const i=Ir(t.body),n=t.getHeader("content-length");if(n&&i<Number(n)){this.logger.warn("Message body length is lower than the value in Content-Length header field. Dropping.");return}}if(t instanceof fr){this.userAgentCore.receiveIncomingRequestFromTransport(t);return}if(t instanceof Ht){this.userAgentCore.receiveIncomingResponseFromTransport(t);return}throw new Error("Invalid message type.")}transitionState(e,t){const r=()=>{throw new Error(`Invalid state transition from ${this._state} to ${e}`)};switch(this._state){case Ie.Started:e!==Ie.Stopped&&r();break;case Ie.Stopped:e!==Ie.Started&&r();break;default:throw new Error("Unknown state.")}this.logger.log(`Transitioned from ${this._state} to ${e}`),this._state=e,this._stateEventEmitter.emit(this._state)}}var Mn={exports:{}};function d0(s){throw new Error('Could not dynamically require "'+s+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var zs={exports:{}};const l0=Co(Object.freeze(Object.defineProperty({__proto__:null,default:{}},Symbol.toStringTag,{value:"Module"})));var Nn;function re(){return Nn||(Nn=1,function(s,e){(function(t,r){s.exports=r()})(Q,function(){var t=t||function(r,i){var n;if(typeof window<"u"&&window.crypto&&(n=window.crypto),typeof self<"u"&&self.crypto&&(n=self.crypto),typeof globalThis<"u"&&globalThis.crypto&&(n=globalThis.crypto),!n&&typeof window<"u"&&window.msCrypto&&(n=window.msCrypto),!n&&typeof Q<"u"&&Q.crypto&&(n=Q.crypto),!n&&typeof d0=="function")try{n=l0}catch{}var a=function(){if(n){if(typeof n.getRandomValues=="function")try{return n.getRandomValues(new Uint32Array(1))[0]}catch{}if(typeof n.randomBytes=="function")try{return n.randomBytes(4).readInt32LE()}catch{}}throw new Error("Native crypto module could not be used to get secure random number.")},o=Object.create||function(){function p(){}return function(E){var b;return p.prototype=E,b=new p,p.prototype=null,b}}(),d={},c=d.lib={},l=c.Base=function(){return{extend:function(p){var E=o(this);return p&&E.mixIn(p),(!E.hasOwnProperty("init")||this.init===E.init)&&(E.init=function(){E.$super.init.apply(this,arguments)}),E.init.prototype=E,E.$super=this,E},create:function(){var p=this.extend();return p.init.apply(p,arguments),p},init:function(){},mixIn:function(p){for(var E in p)p.hasOwnProperty(E)&&(this[E]=p[E]);p.hasOwnProperty("toString")&&(this.toString=p.toString)},clone:function(){return this.init.prototype.extend(this)}}}(),g=c.WordArray=l.extend({init:function(p,E){p=this.words=p||[],E!=i?this.sigBytes=E:this.sigBytes=p.length*4},toString:function(p){return(p||y).stringify(this)},concat:function(p){var E=this.words,b=p.words,S=this.sigBytes,T=p.sigBytes;if(this.clamp(),S%4)for(var F=0;F<T;F++){var h=b[F>>>2]>>>24-F%4*8&255;E[S+F>>>2]|=h<<24-(S+F)%4*8}else for(var M=0;M<T;M+=4)E[S+M>>>2]=b[M>>>2];return this.sigBytes+=T,this},clamp:function(){var p=this.words,E=this.sigBytes;p[E>>>2]&=4294967295<<32-E%4*8,p.length=r.ceil(E/4)},clone:function(){var p=l.clone.call(this);return p.words=this.words.slice(0),p},random:function(p){for(var E=[],b=0;b<p;b+=4)E.push(a());return new g.init(E,p)}}),u=d.enc={},y=u.Hex={stringify:function(p){for(var E=p.words,b=p.sigBytes,S=[],T=0;T<b;T++){var F=E[T>>>2]>>>24-T%4*8&255;S.push((F>>>4).toString(16)),S.push((F&15).toString(16))}return S.join("")},parse:function(p){for(var E=p.length,b=[],S=0;S<E;S+=2)b[S>>>3]|=parseInt(p.substr(S,2),16)<<24-S%8*4;return new g.init(b,E/2)}},v=u.Latin1={stringify:function(p){for(var E=p.words,b=p.sigBytes,S=[],T=0;T<b;T++){var F=E[T>>>2]>>>24-T%4*8&255;S.push(String.fromCharCode(F))}return S.join("")},parse:function(p){for(var E=p.length,b=[],S=0;S<E;S++)b[S>>>2]|=(p.charCodeAt(S)&255)<<24-S%4*8;return new g.init(b,E)}},C=u.Utf8={stringify:function(p){try{return decodeURIComponent(escape(v.stringify(p)))}catch{throw new Error("Malformed UTF-8 data")}},parse:function(p){return v.parse(unescape(encodeURIComponent(p)))}},_=c.BufferedBlockAlgorithm=l.extend({reset:function(){this._data=new g.init,this._nDataBytes=0},_append:function(p){typeof p=="string"&&(p=C.parse(p)),this._data.concat(p),this._nDataBytes+=p.sigBytes},_process:function(p){var E,b=this._data,S=b.words,T=b.sigBytes,F=this.blockSize,h=F*4,M=T/h;p?M=r.ceil(M):M=r.max((M|0)-this._minBufferSize,0);var A=M*F,f=r.min(A*4,T);if(A){for(var w=0;w<A;w+=F)this._doProcessBlock(S,w);E=S.splice(0,A),b.sigBytes-=f}return new g.init(E,f)},clone:function(){var p=l.clone.call(this);return p._data=this._data.clone(),p},_minBufferSize:0});c.Hasher=_.extend({cfg:l.extend(),init:function(p){this.cfg=this.cfg.extend(p),this.reset()},reset:function(){_.reset.call(this),this._doReset()},update:function(p){return this._append(p),this._process(),this},finalize:function(p){p&&this._append(p);var E=this._doFinalize();return E},blockSize:16,_createHelper:function(p){return function(E,b){return new p.init(b).finalize(E)}},_createHmacHelper:function(p){return function(E,b){return new x.HMAC.init(p,b).finalize(E)}}});var x=d.algo={};return d}(Math);return t})}(zs)),zs.exports}var Ks={exports:{}},qn;function os(){return qn||(qn=1,function(s,e){(function(t,r){s.exports=r(re())})(Q,function(t){return function(r){var i=t,n=i.lib,a=n.Base,o=n.WordArray,d=i.x64={};d.Word=a.extend({init:function(c,l){this.high=c,this.low=l}}),d.WordArray=a.extend({init:function(c,l){c=this.words=c||[],l!=r?this.sigBytes=l:this.sigBytes=c.length*8},toX32:function(){for(var c=this.words,l=c.length,g=[],u=0;u<l;u++){var y=c[u];g.push(y.high),g.push(y.low)}return o.create(g,this.sigBytes)},clone:function(){for(var c=a.clone.call(this),l=c.words=this.words.slice(0),g=l.length,u=0;u<g;u++)l[u]=l[u].clone();return c}})}(),t})}(Ks)),Ks.exports}var Zs={exports:{}},Un;function h0(){return Un||(Un=1,function(s,e){(function(t,r){s.exports=r(re())})(Q,function(t){return function(){if(typeof ArrayBuffer=="function"){var r=t,i=r.lib,n=i.WordArray,a=n.init,o=n.init=function(d){if(d instanceof ArrayBuffer&&(d=new Uint8Array(d)),(d instanceof Int8Array||typeof Uint8ClampedArray<"u"&&d instanceof Uint8ClampedArray||d instanceof Int16Array||d instanceof Uint16Array||d instanceof Int32Array||d instanceof Uint32Array||d instanceof Float32Array||d instanceof Float64Array)&&(d=new Uint8Array(d.buffer,d.byteOffset,d.byteLength)),d instanceof Uint8Array){for(var c=d.byteLength,l=[],g=0;g<c;g++)l[g>>>2]|=d[g]<<24-g%4*8;a.call(this,l,c)}else a.apply(this,arguments)};o.prototype=n}}(),t.lib.WordArray})}(Zs)),Zs.exports}var Js={exports:{}},Ln;function u0(){return Ln||(Ln=1,function(s,e){(function(t,r){s.exports=r(re())})(Q,function(t){return function(){var r=t,i=r.lib,n=i.WordArray,a=r.enc;a.Utf16=a.Utf16BE={stringify:function(d){for(var c=d.words,l=d.sigBytes,g=[],u=0;u<l;u+=2){var y=c[u>>>2]>>>16-u%4*8&65535;g.push(String.fromCharCode(y))}return g.join("")},parse:function(d){for(var c=d.length,l=[],g=0;g<c;g++)l[g>>>1]|=d.charCodeAt(g)<<16-g%2*16;return n.create(l,c*2)}},a.Utf16LE={stringify:function(d){for(var c=d.words,l=d.sigBytes,g=[],u=0;u<l;u+=2){var y=o(c[u>>>2]>>>16-u%4*8&65535);g.push(String.fromCharCode(y))}return g.join("")},parse:function(d){for(var c=d.length,l=[],g=0;g<c;g++)l[g>>>1]|=o(d.charCodeAt(g)<<16-g%2*16);return n.create(l,c*2)}};function o(d){return d<<8&4278255360|d>>>8&16711935}}(),t.enc.Utf16})}(Js)),Js.exports}var Xs={exports:{}},jn;function er(){return jn||(jn=1,function(s,e){(function(t,r){s.exports=r(re())})(Q,function(t){return function(){var r=t,i=r.lib,n=i.WordArray,a=r.enc;a.Base64={stringify:function(d){var c=d.words,l=d.sigBytes,g=this._map;d.clamp();for(var u=[],y=0;y<l;y+=3)for(var v=c[y>>>2]>>>24-y%4*8&255,C=c[y+1>>>2]>>>24-(y+1)%4*8&255,_=c[y+2>>>2]>>>24-(y+2)%4*8&255,x=v<<16|C<<8|_,p=0;p<4&&y+p*.75<l;p++)u.push(g.charAt(x>>>6*(3-p)&63));var E=g.charAt(64);if(E)for(;u.length%4;)u.push(E);return u.join("")},parse:function(d){var c=d.length,l=this._map,g=this._reverseMap;if(!g){g=this._reverseMap=[];for(var u=0;u<l.length;u++)g[l.charCodeAt(u)]=u}var y=l.charAt(64);if(y){var v=d.indexOf(y);v!==-1&&(c=v)}return o(d,c,g)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="};function o(d,c,l){for(var g=[],u=0,y=0;y<c;y++)if(y%4){var v=l[d.charCodeAt(y-1)]<<y%4*2,C=l[d.charCodeAt(y)]>>>6-y%4*2,_=v|C;g[u>>>2]|=_<<24-u%4*8,u++}return n.create(g,u)}}(),t.enc.Base64})}(Xs)),Xs.exports}var Qs={exports:{}},Yn;function f0(){return Yn||(Yn=1,function(s,e){(function(t,r){s.exports=r(re())})(Q,function(t){return function(){var r=t,i=r.lib,n=i.WordArray,a=r.enc;a.Base64url={stringify:function(d,c){c===void 0&&(c=!0);var l=d.words,g=d.sigBytes,u=c?this._safe_map:this._map;d.clamp();for(var y=[],v=0;v<g;v+=3)for(var C=l[v>>>2]>>>24-v%4*8&255,_=l[v+1>>>2]>>>24-(v+1)%4*8&255,x=l[v+2>>>2]>>>24-(v+2)%4*8&255,p=C<<16|_<<8|x,E=0;E<4&&v+E*.75<g;E++)y.push(u.charAt(p>>>6*(3-E)&63));var b=u.charAt(64);if(b)for(;y.length%4;)y.push(b);return y.join("")},parse:function(d,c){c===void 0&&(c=!0);var l=d.length,g=c?this._safe_map:this._map,u=this._reverseMap;if(!u){u=this._reverseMap=[];for(var y=0;y<g.length;y++)u[g.charCodeAt(y)]=y}var v=g.charAt(64);if(v){var C=d.indexOf(v);C!==-1&&(l=C)}return o(d,l,u)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",_safe_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"};function o(d,c,l){for(var g=[],u=0,y=0;y<c;y++)if(y%4){var v=l[d.charCodeAt(y-1)]<<y%4*2,C=l[d.charCodeAt(y)]>>>6-y%4*2,_=v|C;g[u>>>2]|=_<<24-u%4*8,u++}return n.create(g,u)}}(),t.enc.Base64url})}(Qs)),Qs.exports}var ei={exports:{}},Wn;function tr(){return Wn||(Wn=1,function(s,e){(function(t,r){s.exports=r(re())})(Q,function(t){return function(r){var i=t,n=i.lib,a=n.WordArray,o=n.Hasher,d=i.algo,c=[];(function(){for(var C=0;C<64;C++)c[C]=r.abs(r.sin(C+1))*4294967296|0})();var l=d.MD5=o.extend({_doReset:function(){this._hash=new a.init([1732584193,4023233417,2562383102,271733878])},_doProcessBlock:function(C,_){for(var x=0;x<16;x++){var p=_+x,E=C[p];C[p]=(E<<8|E>>>24)&16711935|(E<<24|E>>>8)&4278255360}var b=this._hash.words,S=C[_+0],T=C[_+1],F=C[_+2],h=C[_+3],M=C[_+4],A=C[_+5],f=C[_+6],w=C[_+7],m=C[_+8],q=C[_+9],N=C[_+10],z=C[_+11],V=C[_+12],ie=C[_+13],he=C[_+14],ue=C[_+15],k=b[0],$=b[1],H=b[2],I=b[3];k=g(k,$,H,I,S,7,c[0]),I=g(I,k,$,H,T,12,c[1]),H=g(H,I,k,$,F,17,c[2]),$=g($,H,I,k,h,22,c[3]),k=g(k,$,H,I,M,7,c[4]),I=g(I,k,$,H,A,12,c[5]),H=g(H,I,k,$,f,17,c[6]),$=g($,H,I,k,w,22,c[7]),k=g(k,$,H,I,m,7,c[8]),I=g(I,k,$,H,q,12,c[9]),H=g(H,I,k,$,N,17,c[10]),$=g($,H,I,k,z,22,c[11]),k=g(k,$,H,I,V,7,c[12]),I=g(I,k,$,H,ie,12,c[13]),H=g(H,I,k,$,he,17,c[14]),$=g($,H,I,k,ue,22,c[15]),k=u(k,$,H,I,T,5,c[16]),I=u(I,k,$,H,f,9,c[17]),H=u(H,I,k,$,z,14,c[18]),$=u($,H,I,k,S,20,c[19]),k=u(k,$,H,I,A,5,c[20]),I=u(I,k,$,H,N,9,c[21]),H=u(H,I,k,$,ue,14,c[22]),$=u($,H,I,k,M,20,c[23]),k=u(k,$,H,I,q,5,c[24]),I=u(I,k,$,H,he,9,c[25]),H=u(H,I,k,$,h,14,c[26]),$=u($,H,I,k,m,20,c[27]),k=u(k,$,H,I,ie,5,c[28]),I=u(I,k,$,H,F,9,c[29]),H=u(H,I,k,$,w,14,c[30]),$=u($,H,I,k,V,20,c[31]),k=y(k,$,H,I,A,4,c[32]),I=y(I,k,$,H,m,11,c[33]),H=y(H,I,k,$,z,16,c[34]),$=y($,H,I,k,he,23,c[35]),k=y(k,$,H,I,T,4,c[36]),I=y(I,k,$,H,M,11,c[37]),H=y(H,I,k,$,w,16,c[38]),$=y($,H,I,k,N,23,c[39]),k=y(k,$,H,I,ie,4,c[40]),I=y(I,k,$,H,S,11,c[41]),H=y(H,I,k,$,h,16,c[42]),$=y($,H,I,k,f,23,c[43]),k=y(k,$,H,I,q,4,c[44]),I=y(I,k,$,H,V,11,c[45]),H=y(H,I,k,$,ue,16,c[46]),$=y($,H,I,k,F,23,c[47]),k=v(k,$,H,I,S,6,c[48]),I=v(I,k,$,H,w,10,c[49]),H=v(H,I,k,$,he,15,c[50]),$=v($,H,I,k,A,21,c[51]),k=v(k,$,H,I,V,6,c[52]),I=v(I,k,$,H,h,10,c[53]),H=v(H,I,k,$,N,15,c[54]),$=v($,H,I,k,T,21,c[55]),k=v(k,$,H,I,m,6,c[56]),I=v(I,k,$,H,ue,10,c[57]),H=v(H,I,k,$,f,15,c[58]),$=v($,H,I,k,ie,21,c[59]),k=v(k,$,H,I,M,6,c[60]),I=v(I,k,$,H,z,10,c[61]),H=v(H,I,k,$,F,15,c[62]),$=v($,H,I,k,q,21,c[63]),b[0]=b[0]+k|0,b[1]=b[1]+$|0,b[2]=b[2]+H|0,b[3]=b[3]+I|0},_doFinalize:function(){var C=this._data,_=C.words,x=this._nDataBytes*8,p=C.sigBytes*8;_[p>>>5]|=128<<24-p%32;var E=r.floor(x/4294967296),b=x;_[(p+64>>>9<<4)+15]=(E<<8|E>>>24)&16711935|(E<<24|E>>>8)&4278255360,_[(p+64>>>9<<4)+14]=(b<<8|b>>>24)&16711935|(b<<24|b>>>8)&4278255360,C.sigBytes=(_.length+1)*4,this._process();for(var S=this._hash,T=S.words,F=0;F<4;F++){var h=T[F];T[F]=(h<<8|h>>>24)&16711935|(h<<24|h>>>8)&4278255360}return S},clone:function(){var C=o.clone.call(this);return C._hash=this._hash.clone(),C}});function g(C,_,x,p,E,b,S){var T=C+(_&x|~_&p)+E+S;return(T<<b|T>>>32-b)+_}function u(C,_,x,p,E,b,S){var T=C+(_&p|x&~p)+E+S;return(T<<b|T>>>32-b)+_}function y(C,_,x,p,E,b,S){var T=C+(_^x^p)+E+S;return(T<<b|T>>>32-b)+_}function v(C,_,x,p,E,b,S){var T=C+(x^(_|~p))+E+S;return(T<<b|T>>>32-b)+_}i.MD5=o._createHelper(l),i.HmacMD5=o._createHmacHelper(l)}(Math),t.MD5})}(ei)),ei.exports}var ti={exports:{}},Vn;function Gn(){return Vn||(Vn=1,function(s,e){(function(t,r){s.exports=r(re())})(Q,function(t){return function(){var r=t,i=r.lib,n=i.WordArray,a=i.Hasher,o=r.algo,d=[],c=o.SHA1=a.extend({_doReset:function(){this._hash=new n.init([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(l,g){for(var u=this._hash.words,y=u[0],v=u[1],C=u[2],_=u[3],x=u[4],p=0;p<80;p++){if(p<16)d[p]=l[g+p]|0;else{var E=d[p-3]^d[p-8]^d[p-14]^d[p-16];d[p]=E<<1|E>>>31}var b=(y<<5|y>>>27)+x+d[p];p<20?b+=(v&C|~v&_)+1518500249:p<40?b+=(v^C^_)+1859775393:p<60?b+=(v&C|v&_|C&_)-1894007588:b+=(v^C^_)-899497514,x=_,_=C,C=v<<30|v>>>2,v=y,y=b}u[0]=u[0]+y|0,u[1]=u[1]+v|0,u[2]=u[2]+C|0,u[3]=u[3]+_|0,u[4]=u[4]+x|0},_doFinalize:function(){var l=this._data,g=l.words,u=this._nDataBytes*8,y=l.sigBytes*8;return g[y>>>5]|=128<<24-y%32,g[(y+64>>>9<<4)+14]=Math.floor(u/4294967296),g[(y+64>>>9<<4)+15]=u,l.sigBytes=g.length*4,this._process(),this._hash},clone:function(){var l=a.clone.call(this);return l._hash=this._hash.clone(),l}});r.SHA1=a._createHelper(c),r.HmacSHA1=a._createHmacHelper(c)}(),t.SHA1})}(ti)),ti.exports}var ri={exports:{}},zn;function si(){return zn||(zn=1,function(s,e){(function(t,r){s.exports=r(re())})(Q,function(t){return function(r){var i=t,n=i.lib,a=n.WordArray,o=n.Hasher,d=i.algo,c=[],l=[];(function(){function y(x){for(var p=r.sqrt(x),E=2;E<=p;E++)if(!(x%E))return!1;return!0}function v(x){return(x-(x|0))*4294967296|0}for(var C=2,_=0;_<64;)y(C)&&(_<8&&(c[_]=v(r.pow(C,1/2))),l[_]=v(r.pow(C,1/3)),_++),C++})();var g=[],u=d.SHA256=o.extend({_doReset:function(){this._hash=new a.init(c.slice(0))},_doProcessBlock:function(y,v){for(var C=this._hash.words,_=C[0],x=C[1],p=C[2],E=C[3],b=C[4],S=C[5],T=C[6],F=C[7],h=0;h<64;h++){if(h<16)g[h]=y[v+h]|0;else{var M=g[h-15],A=(M<<25|M>>>7)^(M<<14|M>>>18)^M>>>3,f=g[h-2],w=(f<<15|f>>>17)^(f<<13|f>>>19)^f>>>10;g[h]=A+g[h-7]+w+g[h-16]}var m=b&S^~b&T,q=_&x^_&p^x&p,N=(_<<30|_>>>2)^(_<<19|_>>>13)^(_<<10|_>>>22),z=(b<<26|b>>>6)^(b<<21|b>>>11)^(b<<7|b>>>25),V=F+z+m+l[h]+g[h],ie=N+q;F=T,T=S,S=b,b=E+V|0,E=p,p=x,x=_,_=V+ie|0}C[0]=C[0]+_|0,C[1]=C[1]+x|0,C[2]=C[2]+p|0,C[3]=C[3]+E|0,C[4]=C[4]+b|0,C[5]=C[5]+S|0,C[6]=C[6]+T|0,C[7]=C[7]+F|0},_doFinalize:function(){var y=this._data,v=y.words,C=this._nDataBytes*8,_=y.sigBytes*8;return v[_>>>5]|=128<<24-_%32,v[(_+64>>>9<<4)+14]=r.floor(C/4294967296),v[(_+64>>>9<<4)+15]=C,y.sigBytes=v.length*4,this._process(),this._hash},clone:function(){var y=o.clone.call(this);return y._hash=this._hash.clone(),y}});i.SHA256=o._createHelper(u),i.HmacSHA256=o._createHmacHelper(u)}(Math),t.SHA256})}(ri)),ri.exports}var ii={exports:{}},Kn;function g0(){return Kn||(Kn=1,function(s,e){(function(t,r,i){s.exports=r(re(),si())})(Q,function(t){return function(){var r=t,i=r.lib,n=i.WordArray,a=r.algo,o=a.SHA256,d=a.SHA224=o.extend({_doReset:function(){this._hash=new n.init([3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428])},_doFinalize:function(){var c=o._doFinalize.call(this);return c.sigBytes-=4,c}});r.SHA224=o._createHelper(d),r.HmacSHA224=o._createHmacHelper(d)}(),t.SHA224})}(ii)),ii.exports}var ni={exports:{}},Zn;function Jn(){return Zn||(Zn=1,function(s,e){(function(t,r,i){s.exports=r(re(),os())})(Q,function(t){return function(){var r=t,i=r.lib,n=i.Hasher,a=r.x64,o=a.Word,d=a.WordArray,c=r.algo;function l(){return o.create.apply(o,arguments)}var g=[l(1116352408,3609767458),l(1899447441,602891725),l(3049323471,3964484399),l(3921009573,2173295548),l(961987163,4081628472),l(1508970993,3053834265),l(2453635748,2937671579),l(2870763221,3664609560),l(3624381080,2734883394),l(310598401,1164996542),l(607225278,1323610764),l(1426881987,3590304994),l(1925078388,4068182383),l(2162078206,991336113),l(2614888103,633803317),l(3248222580,3479774868),l(3835390401,2666613458),l(4022224774,944711139),l(264347078,2341262773),l(604807628,2007800933),l(770255983,1495990901),l(1249150122,1856431235),l(1555081692,3175218132),l(1996064986,2198950837),l(2554220882,3999719339),l(2821834349,766784016),l(2952996808,2566594879),l(3210313671,3203337956),l(3336571891,1034457026),l(3584528711,2466948901),l(113926993,3758326383),l(338241895,168717936),l(666307205,1188179964),l(773529912,1546045734),l(1294757372,1522805485),l(1396182291,2643833823),l(1695183700,2343527390),l(1986661051,1014477480),l(2177026350,1206759142),l(2456956037,344077627),l(2730485921,1290863460),l(2820302411,3158454273),l(3259730800,3505952657),l(3345764771,106217008),l(3516065817,3606008344),l(3600352804,1432725776),l(4094571909,1467031594),l(275423344,851169720),l(430227734,3100823752),l(506948616,1363258195),l(659060556,3750685593),l(883997877,3785050280),l(958139571,3318307427),l(1322822218,3812723403),l(1537002063,2003034995),l(1747873779,3602036899),l(1955562222,1575990012),l(2024104815,1125592928),l(2227730452,2716904306),l(2361852424,442776044),l(2428436474,593698344),l(2756734187,3733110249),l(3204031479,2999351573),l(3329325298,3815920427),l(3391569614,3928383900),l(3515267271,566280711),l(3940187606,3454069534),l(4118630271,4000239992),l(116418474,1914138554),l(174292421,2731055270),l(289380356,3203993006),l(460393269,320620315),l(685471733,587496836),l(852142971,1086792851),l(1017036298,365543100),l(1126000580,2618297676),l(1288033470,3409855158),l(1501505948,4234509866),l(1607167915,987167468),l(1816402316,1246189591)],u=[];(function(){for(var v=0;v<80;v++)u[v]=l()})();var y=c.SHA512=n.extend({_doReset:function(){this._hash=new d.init([new o.init(1779033703,4089235720),new o.init(3144134277,2227873595),new o.init(1013904242,4271175723),new o.init(2773480762,1595750129),new o.init(1359893119,2917565137),new o.init(2600822924,725511199),new o.init(528734635,4215389547),new o.init(1541459225,327033209)])},_doProcessBlock:function(v,C){for(var _=this._hash.words,x=_[0],p=_[1],E=_[2],b=_[3],S=_[4],T=_[5],F=_[6],h=_[7],M=x.high,A=x.low,f=p.high,w=p.low,m=E.high,q=E.low,N=b.high,z=b.low,V=S.high,ie=S.low,he=T.high,ue=T.low,k=F.high,$=F.low,H=h.high,I=h.low,me=M,fe=A,ke=f,J=w,Bt=m,ct=q,Gr=N,Yt=z,Ke=V,Ne=ie,kt=he,dt=ue,cr=k,Wt=$,Vt=H,dr=I,Ze=0;Ze<80;Ze++){var Pe,vt,br=u[Ze];if(Ze<16)vt=br.high=v[C+Ze*2]|0,Pe=br.low=v[C+Ze*2+1]|0;else{var zr=u[Ze-15],It=zr.high,Gt=zr.low,hn=(It>>>1|Gt<<31)^(It>>>8|Gt<<24)^It>>>7,Kr=(Gt>>>1|It<<31)^(Gt>>>8|It<<24)^(Gt>>>7|It<<25),Zr=u[Ze-2],zt=Zr.high,lr=Zr.low,un=(zt>>>19|lr<<13)^(zt<<3|lr>>>29)^zt>>>6,Fs=(lr>>>19|zt<<13)^(lr<<3|zt>>>29)^(lr>>>6|zt<<26),Bs=u[Ze-7],fn=Bs.high,gn=Bs.low,Ar=u[Ze-16],ks=Ar.high,$t=Ar.low;Pe=Kr+gn,vt=hn+fn+(Pe>>>0<Kr>>>0?1:0),Pe=Pe+Fs,vt=vt+un+(Pe>>>0<Fs>>>0?1:0),Pe=Pe+$t,vt=vt+ks+(Pe>>>0<$t>>>0?1:0),br.high=vt,br.low=Pe}var Jr=Ke&kt^~Ke&cr,Tr=Ne&dt^~Ne&Wt,Is=me&ke^me&Bt^ke&Bt,xn=fe&J^fe&ct^J&ct,$s=(me>>>28|fe<<4)^(me<<30|fe>>>2)^(me<<25|fe>>>7),Hs=(fe>>>28|me<<4)^(fe<<30|me>>>2)^(fe<<25|me>>>7),Ps=(Ke>>>14|Ne<<18)^(Ke>>>18|Ne<<14)^(Ke<<23|Ne>>>9),Os=(Ne>>>14|Ke<<18)^(Ne>>>18|Ke<<14)^(Ne<<23|Ke>>>9),Ms=g[Ze],pn=Ms.high,Xr=Ms.low,Oe=dr+Os,Et=Vt+Ps+(Oe>>>0<dr>>>0?1:0),Oe=Oe+Tr,Et=Et+Jr+(Oe>>>0<Tr>>>0?1:0),Oe=Oe+Xr,Et=Et+pn+(Oe>>>0<Xr>>>0?1:0),Oe=Oe+Pe,Et=Et+vt+(Oe>>>0<Pe>>>0?1:0),Ns=Hs+xn,mn=$s+Is+(Ns>>>0<Hs>>>0?1:0);Vt=cr,dr=Wt,cr=kt,Wt=dt,kt=Ke,dt=Ne,Ne=Yt+Oe|0,Ke=Gr+Et+(Ne>>>0<Yt>>>0?1:0)|0,Gr=Bt,Yt=ct,Bt=ke,ct=J,ke=me,J=fe,fe=Oe+Ns|0,me=Et+mn+(fe>>>0<Oe>>>0?1:0)|0}A=x.low=A+fe,x.high=M+me+(A>>>0<fe>>>0?1:0),w=p.low=w+J,p.high=f+ke+(w>>>0<J>>>0?1:0),q=E.low=q+ct,E.high=m+Bt+(q>>>0<ct>>>0?1:0),z=b.low=z+Yt,b.high=N+Gr+(z>>>0<Yt>>>0?1:0),ie=S.low=ie+Ne,S.high=V+Ke+(ie>>>0<Ne>>>0?1:0),ue=T.low=ue+dt,T.high=he+kt+(ue>>>0<dt>>>0?1:0),$=F.low=$+Wt,F.high=k+cr+($>>>0<Wt>>>0?1:0),I=h.low=I+dr,h.high=H+Vt+(I>>>0<dr>>>0?1:0)},_doFinalize:function(){var v=this._data,C=v.words,_=this._nDataBytes*8,x=v.sigBytes*8;C[x>>>5]|=128<<24-x%32,C[(x+128>>>10<<5)+30]=Math.floor(_/4294967296),C[(x+128>>>10<<5)+31]=_,v.sigBytes=C.length*4,this._process();var p=this._hash.toX32();return p},clone:function(){var v=n.clone.call(this);return v._hash=this._hash.clone(),v},blockSize:1024/32});r.SHA512=n._createHelper(y),r.HmacSHA512=n._createHmacHelper(y)}(),t.SHA512})}(ni)),ni.exports}var ai={exports:{}},Xn;function x0(){return Xn||(Xn=1,function(s,e){(function(t,r,i){s.exports=r(re(),os(),Jn())})(Q,function(t){return function(){var r=t,i=r.x64,n=i.Word,a=i.WordArray,o=r.algo,d=o.SHA512,c=o.SHA384=d.extend({_doReset:function(){this._hash=new a.init([new n.init(3418070365,3238371032),new n.init(1654270250,914150663),new n.init(2438529370,812702999),new n.init(355462360,4144912697),new n.init(1731405415,4290775857),new n.init(2394180231,1750603025),new n.init(3675008525,1694076839),new n.init(1203062813,3204075428)])},_doFinalize:function(){var l=d._doFinalize.call(this);return l.sigBytes-=16,l}});r.SHA384=d._createHelper(c),r.HmacSHA384=d._createHmacHelper(c)}(),t.SHA384})}(ai)),ai.exports}var oi={exports:{}},Qn;function p0(){return Qn||(Qn=1,function(s,e){(function(t,r,i){s.exports=r(re(),os())})(Q,function(t){return function(r){var i=t,n=i.lib,a=n.WordArray,o=n.Hasher,d=i.x64,c=d.Word,l=i.algo,g=[],u=[],y=[];(function(){for(var _=1,x=0,p=0;p<24;p++){g[_+5*x]=(p+1)*(p+2)/2%64;var E=x%5,b=(2*_+3*x)%5;_=E,x=b}for(var _=0;_<5;_++)for(var x=0;x<5;x++)u[_+5*x]=x+(2*_+3*x)%5*5;for(var S=1,T=0;T<24;T++){for(var F=0,h=0,M=0;M<7;M++){if(S&1){var A=(1<<M)-1;A<32?h^=1<<A:F^=1<<A-32}S&128?S=S<<1^113:S<<=1}y[T]=c.create(F,h)}})();var v=[];(function(){for(var _=0;_<25;_++)v[_]=c.create()})();var C=l.SHA3=o.extend({cfg:o.cfg.extend({outputLength:512}),_doReset:function(){for(var _=this._state=[],x=0;x<25;x++)_[x]=new c.init;this.blockSize=(1600-2*this.cfg.outputLength)/32},_doProcessBlock:function(_,x){for(var p=this._state,E=this.blockSize/2,b=0;b<E;b++){var S=_[x+2*b],T=_[x+2*b+1];S=(S<<8|S>>>24)&16711935|(S<<24|S>>>8)&4278255360,T=(T<<8|T>>>24)&16711935|(T<<24|T>>>8)&4278255360;var F=p[b];F.high^=T,F.low^=S}for(var h=0;h<24;h++){for(var M=0;M<5;M++){for(var A=0,f=0,w=0;w<5;w++){var F=p[M+5*w];A^=F.high,f^=F.low}var m=v[M];m.high=A,m.low=f}for(var M=0;M<5;M++)for(var q=v[(M+4)%5],N=v[(M+1)%5],z=N.high,V=N.low,A=q.high^(z<<1|V>>>31),f=q.low^(V<<1|z>>>31),w=0;w<5;w++){var F=p[M+5*w];F.high^=A,F.low^=f}for(var ie=1;ie<25;ie++){var A,f,F=p[ie],he=F.high,ue=F.low,k=g[ie];k<32?(A=he<<k|ue>>>32-k,f=ue<<k|he>>>32-k):(A=ue<<k-32|he>>>64-k,f=he<<k-32|ue>>>64-k);var $=v[u[ie]];$.high=A,$.low=f}var H=v[0],I=p[0];H.high=I.high,H.low=I.low;for(var M=0;M<5;M++)for(var w=0;w<5;w++){var ie=M+5*w,F=p[ie],me=v[ie],fe=v[(M+1)%5+5*w],ke=v[(M+2)%5+5*w];F.high=me.high^~fe.high&ke.high,F.low=me.low^~fe.low&ke.low}var F=p[0],J=y[h];F.high^=J.high,F.low^=J.low}},_doFinalize:function(){var _=this._data,x=_.words;this._nDataBytes*8;var p=_.sigBytes*8,E=this.blockSize*32;x[p>>>5]|=1<<24-p%32,x[(r.ceil((p+1)/E)*E>>>5)-1]|=128,_.sigBytes=x.length*4,this._process();for(var b=this._state,S=this.cfg.outputLength/8,T=S/8,F=[],h=0;h<T;h++){var M=b[h],A=M.high,f=M.low;A=(A<<8|A>>>24)&16711935|(A<<24|A>>>8)&4278255360,f=(f<<8|f>>>24)&16711935|(f<<24|f>>>8)&4278255360,F.push(f),F.push(A)}return new a.init(F,S)},clone:function(){for(var _=o.clone.call(this),x=_._state=this._state.slice(0),p=0;p<25;p++)x[p]=x[p].clone();return _}});i.SHA3=o._createHelper(C),i.HmacSHA3=o._createHmacHelper(C)}(Math),t.SHA3})}(oi)),oi.exports}var ci={exports:{}},ea;function m0(){return ea||(ea=1,function(s,e){(function(t,r){s.exports=r(re())})(Q,function(t){/** @preserve
|
|
81
|
+
(c) 2012 by Cédric Mesnil. All rights reserved.
|
|
82
|
+
|
|
83
|
+
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
|
84
|
+
|
|
85
|
+
- Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
|
86
|
+
- Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
|
|
87
|
+
|
|
88
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
89
|
+
*/return function(r){var i=t,n=i.lib,a=n.WordArray,o=n.Hasher,d=i.algo,c=a.create([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13]),l=a.create([5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11]),g=a.create([11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6]),u=a.create([8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11]),y=a.create([0,1518500249,1859775393,2400959708,2840853838]),v=a.create([1352829926,1548603684,1836072691,2053994217,0]),C=d.RIPEMD160=o.extend({_doReset:function(){this._hash=a.create([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(T,F){for(var h=0;h<16;h++){var M=F+h,A=T[M];T[M]=(A<<8|A>>>24)&16711935|(A<<24|A>>>8)&4278255360}var f=this._hash.words,w=y.words,m=v.words,q=c.words,N=l.words,z=g.words,V=u.words,ie,he,ue,k,$,H,I,me,fe,ke;H=ie=f[0],I=he=f[1],me=ue=f[2],fe=k=f[3],ke=$=f[4];for(var J,h=0;h<80;h+=1)J=ie+T[F+q[h]]|0,h<16?J+=_(he,ue,k)+w[0]:h<32?J+=x(he,ue,k)+w[1]:h<48?J+=p(he,ue,k)+w[2]:h<64?J+=E(he,ue,k)+w[3]:J+=b(he,ue,k)+w[4],J=J|0,J=S(J,z[h]),J=J+$|0,ie=$,$=k,k=S(ue,10),ue=he,he=J,J=H+T[F+N[h]]|0,h<16?J+=b(I,me,fe)+m[0]:h<32?J+=E(I,me,fe)+m[1]:h<48?J+=p(I,me,fe)+m[2]:h<64?J+=x(I,me,fe)+m[3]:J+=_(I,me,fe)+m[4],J=J|0,J=S(J,V[h]),J=J+ke|0,H=ke,ke=fe,fe=S(me,10),me=I,I=J;J=f[1]+ue+fe|0,f[1]=f[2]+k+ke|0,f[2]=f[3]+$+H|0,f[3]=f[4]+ie+I|0,f[4]=f[0]+he+me|0,f[0]=J},_doFinalize:function(){var T=this._data,F=T.words,h=this._nDataBytes*8,M=T.sigBytes*8;F[M>>>5]|=128<<24-M%32,F[(M+64>>>9<<4)+14]=(h<<8|h>>>24)&16711935|(h<<24|h>>>8)&4278255360,T.sigBytes=(F.length+1)*4,this._process();for(var A=this._hash,f=A.words,w=0;w<5;w++){var m=f[w];f[w]=(m<<8|m>>>24)&16711935|(m<<24|m>>>8)&4278255360}return A},clone:function(){var T=o.clone.call(this);return T._hash=this._hash.clone(),T}});function _(T,F,h){return T^F^h}function x(T,F,h){return T&F|~T&h}function p(T,F,h){return(T|~F)^h}function E(T,F,h){return T&h|F&~h}function b(T,F,h){return T^(F|~h)}function S(T,F){return T<<F|T>>>32-F}i.RIPEMD160=o._createHelper(C),i.HmacRIPEMD160=o._createHmacHelper(C)}(),t.RIPEMD160})}(ci)),ci.exports}var di={exports:{}},ta;function li(){return ta||(ta=1,function(s,e){(function(t,r){s.exports=r(re())})(Q,function(t){(function(){var r=t,i=r.lib,n=i.Base,a=r.enc,o=a.Utf8,d=r.algo;d.HMAC=n.extend({init:function(c,l){c=this._hasher=new c.init,typeof l=="string"&&(l=o.parse(l));var g=c.blockSize,u=g*4;l.sigBytes>u&&(l=c.finalize(l)),l.clamp();for(var y=this._oKey=l.clone(),v=this._iKey=l.clone(),C=y.words,_=v.words,x=0;x<g;x++)C[x]^=1549556828,_[x]^=909522486;y.sigBytes=v.sigBytes=u,this.reset()},reset:function(){var c=this._hasher;c.reset(),c.update(this._iKey)},update:function(c){return this._hasher.update(c),this},finalize:function(c){var l=this._hasher,g=l.finalize(c);l.reset();var u=l.finalize(this._oKey.clone().concat(g));return u}})})()})}(di)),di.exports}var hi={exports:{}},ra;function v0(){return ra||(ra=1,function(s,e){(function(t,r,i){s.exports=r(re(),si(),li())})(Q,function(t){return function(){var r=t,i=r.lib,n=i.Base,a=i.WordArray,o=r.algo,d=o.SHA256,c=o.HMAC,l=o.PBKDF2=n.extend({cfg:n.extend({keySize:128/32,hasher:d,iterations:25e4}),init:function(g){this.cfg=this.cfg.extend(g)},compute:function(g,u){for(var y=this.cfg,v=c.create(y.hasher,g),C=a.create(),_=a.create([1]),x=C.words,p=_.words,E=y.keySize,b=y.iterations;x.length<E;){var S=v.update(u).finalize(_);v.reset();for(var T=S.words,F=T.length,h=S,M=1;M<b;M++){h=v.finalize(h),v.reset();for(var A=h.words,f=0;f<F;f++)T[f]^=A[f]}C.concat(S),p[0]++}return C.sigBytes=E*4,C}});r.PBKDF2=function(g,u,y){return l.create(y).compute(g,u)}}(),t.PBKDF2})}(hi)),hi.exports}var ui={exports:{}},sa;function qt(){return sa||(sa=1,function(s,e){(function(t,r,i){s.exports=r(re(),Gn(),li())})(Q,function(t){return function(){var r=t,i=r.lib,n=i.Base,a=i.WordArray,o=r.algo,d=o.MD5,c=o.EvpKDF=n.extend({cfg:n.extend({keySize:128/32,hasher:d,iterations:1}),init:function(l){this.cfg=this.cfg.extend(l)},compute:function(l,g){for(var u,y=this.cfg,v=y.hasher.create(),C=a.create(),_=C.words,x=y.keySize,p=y.iterations;_.length<x;){u&&v.update(u),u=v.update(l).finalize(g),v.reset();for(var E=1;E<p;E++)u=v.finalize(u),v.reset();C.concat(u)}return C.sigBytes=x*4,C}});r.EvpKDF=function(l,g,u){return c.create(u).compute(l,g)}}(),t.EvpKDF})}(ui)),ui.exports}var fi={exports:{}},ia;function Be(){return ia||(ia=1,function(s,e){(function(t,r,i){s.exports=r(re(),qt())})(Q,function(t){t.lib.Cipher||function(r){var i=t,n=i.lib,a=n.Base,o=n.WordArray,d=n.BufferedBlockAlgorithm,c=i.enc;c.Utf8;var l=c.Base64,g=i.algo,u=g.EvpKDF,y=n.Cipher=d.extend({cfg:a.extend(),createEncryptor:function(A,f){return this.create(this._ENC_XFORM_MODE,A,f)},createDecryptor:function(A,f){return this.create(this._DEC_XFORM_MODE,A,f)},init:function(A,f,w){this.cfg=this.cfg.extend(w),this._xformMode=A,this._key=f,this.reset()},reset:function(){d.reset.call(this),this._doReset()},process:function(A){return this._append(A),this._process()},finalize:function(A){A&&this._append(A);var f=this._doFinalize();return f},keySize:128/32,ivSize:128/32,_ENC_XFORM_MODE:1,_DEC_XFORM_MODE:2,_createHelper:function(){function A(f){return typeof f=="string"?M:T}return function(f){return{encrypt:function(w,m,q){return A(m).encrypt(f,w,m,q)},decrypt:function(w,m,q){return A(m).decrypt(f,w,m,q)}}}}()});n.StreamCipher=y.extend({_doFinalize:function(){var A=this._process(!0);return A},blockSize:1});var v=i.mode={},C=n.BlockCipherMode=a.extend({createEncryptor:function(A,f){return this.Encryptor.create(A,f)},createDecryptor:function(A,f){return this.Decryptor.create(A,f)},init:function(A,f){this._cipher=A,this._iv=f}}),_=v.CBC=function(){var A=C.extend();A.Encryptor=A.extend({processBlock:function(w,m){var q=this._cipher,N=q.blockSize;f.call(this,w,m,N),q.encryptBlock(w,m),this._prevBlock=w.slice(m,m+N)}}),A.Decryptor=A.extend({processBlock:function(w,m){var q=this._cipher,N=q.blockSize,z=w.slice(m,m+N);q.decryptBlock(w,m),f.call(this,w,m,N),this._prevBlock=z}});function f(w,m,q){var N,z=this._iv;z?(N=z,this._iv=r):N=this._prevBlock;for(var V=0;V<q;V++)w[m+V]^=N[V]}return A}(),x=i.pad={},p=x.Pkcs7={pad:function(A,f){for(var w=f*4,m=w-A.sigBytes%w,q=m<<24|m<<16|m<<8|m,N=[],z=0;z<m;z+=4)N.push(q);var V=o.create(N,m);A.concat(V)},unpad:function(A){var f=A.words[A.sigBytes-1>>>2]&255;A.sigBytes-=f}};n.BlockCipher=y.extend({cfg:y.cfg.extend({mode:_,padding:p}),reset:function(){var A;y.reset.call(this);var f=this.cfg,w=f.iv,m=f.mode;this._xformMode==this._ENC_XFORM_MODE?A=m.createEncryptor:(A=m.createDecryptor,this._minBufferSize=1),this._mode&&this._mode.__creator==A?this._mode.init(this,w&&w.words):(this._mode=A.call(m,this,w&&w.words),this._mode.__creator=A)},_doProcessBlock:function(A,f){this._mode.processBlock(A,f)},_doFinalize:function(){var A,f=this.cfg.padding;return this._xformMode==this._ENC_XFORM_MODE?(f.pad(this._data,this.blockSize),A=this._process(!0)):(A=this._process(!0),f.unpad(A)),A},blockSize:128/32});var E=n.CipherParams=a.extend({init:function(A){this.mixIn(A)},toString:function(A){return(A||this.formatter).stringify(this)}}),b=i.format={},S=b.OpenSSL={stringify:function(A){var f,w=A.ciphertext,m=A.salt;return m?f=o.create([1398893684,1701076831]).concat(m).concat(w):f=w,f.toString(l)},parse:function(A){var f,w=l.parse(A),m=w.words;return m[0]==1398893684&&m[1]==1701076831&&(f=o.create(m.slice(2,4)),m.splice(0,4),w.sigBytes-=16),E.create({ciphertext:w,salt:f})}},T=n.SerializableCipher=a.extend({cfg:a.extend({format:S}),encrypt:function(A,f,w,m){m=this.cfg.extend(m);var q=A.createEncryptor(w,m),N=q.finalize(f),z=q.cfg;return E.create({ciphertext:N,key:w,iv:z.iv,algorithm:A,mode:z.mode,padding:z.padding,blockSize:A.blockSize,formatter:m.format})},decrypt:function(A,f,w,m){m=this.cfg.extend(m),f=this._parse(f,m.format);var q=A.createDecryptor(w,m).finalize(f.ciphertext);return q},_parse:function(A,f){return typeof A=="string"?f.parse(A,this):A}}),F=i.kdf={},h=F.OpenSSL={execute:function(A,f,w,m,q){if(m||(m=o.random(64/8)),q)var N=u.create({keySize:f+w,hasher:q}).compute(A,m);else var N=u.create({keySize:f+w}).compute(A,m);var z=o.create(N.words.slice(f),w*4);return N.sigBytes=f*4,E.create({key:N,iv:z,salt:m})}},M=n.PasswordBasedCipher=T.extend({cfg:T.cfg.extend({kdf:h}),encrypt:function(A,f,w,m){m=this.cfg.extend(m);var q=m.kdf.execute(w,A.keySize,A.ivSize,m.salt,m.hasher);m.iv=q.iv;var N=T.encrypt.call(this,A,f,q.key,m);return N.mixIn(q),N},decrypt:function(A,f,w,m){m=this.cfg.extend(m),f=this._parse(f,m.format);var q=m.kdf.execute(w,A.keySize,A.ivSize,f.salt,m.hasher);m.iv=q.iv;var N=T.decrypt.call(this,A,f,q.key,m);return N}})}()})}(fi)),fi.exports}var gi={exports:{}},na;function E0(){return na||(na=1,function(s,e){(function(t,r,i){s.exports=r(re(),Be())})(Q,function(t){return t.mode.CFB=function(){var r=t.lib.BlockCipherMode.extend();r.Encryptor=r.extend({processBlock:function(n,a){var o=this._cipher,d=o.blockSize;i.call(this,n,a,d,o),this._prevBlock=n.slice(a,a+d)}}),r.Decryptor=r.extend({processBlock:function(n,a){var o=this._cipher,d=o.blockSize,c=n.slice(a,a+d);i.call(this,n,a,d,o),this._prevBlock=c}});function i(n,a,o,d){var c,l=this._iv;l?(c=l.slice(0),this._iv=void 0):c=this._prevBlock,d.encryptBlock(c,0);for(var g=0;g<o;g++)n[a+g]^=c[g]}return r}(),t.mode.CFB})}(gi)),gi.exports}var xi={exports:{}},aa;function y0(){return aa||(aa=1,function(s,e){(function(t,r,i){s.exports=r(re(),Be())})(Q,function(t){return t.mode.CTR=function(){var r=t.lib.BlockCipherMode.extend(),i=r.Encryptor=r.extend({processBlock:function(n,a){var o=this._cipher,d=o.blockSize,c=this._iv,l=this._counter;c&&(l=this._counter=c.slice(0),this._iv=void 0);var g=l.slice(0);o.encryptBlock(g,0),l[d-1]=l[d-1]+1|0;for(var u=0;u<d;u++)n[a+u]^=g[u]}});return r.Decryptor=i,r}(),t.mode.CTR})}(xi)),xi.exports}var pi={exports:{}},oa;function w0(){return oa||(oa=1,function(s,e){(function(t,r,i){s.exports=r(re(),Be())})(Q,function(t){/** @preserve
|
|
90
|
+
* Counter block mode compatible with Dr Brian Gladman fileenc.c
|
|
91
|
+
* derived from CryptoJS.mode.CTR
|
|
92
|
+
* Jan Hruby jhruby.web@gmail.com
|
|
93
|
+
*/return t.mode.CTRGladman=function(){var r=t.lib.BlockCipherMode.extend();function i(o){if((o>>24&255)===255){var d=o>>16&255,c=o>>8&255,l=o&255;d===255?(d=0,c===255?(c=0,l===255?l=0:++l):++c):++d,o=0,o+=d<<16,o+=c<<8,o+=l}else o+=1<<24;return o}function n(o){return(o[0]=i(o[0]))===0&&(o[1]=i(o[1])),o}var a=r.Encryptor=r.extend({processBlock:function(o,d){var c=this._cipher,l=c.blockSize,g=this._iv,u=this._counter;g&&(u=this._counter=g.slice(0),this._iv=void 0),n(u);var y=u.slice(0);c.encryptBlock(y,0);for(var v=0;v<l;v++)o[d+v]^=y[v]}});return r.Decryptor=a,r}(),t.mode.CTRGladman})}(pi)),pi.exports}var mi={exports:{}},ca;function C0(){return ca||(ca=1,function(s,e){(function(t,r,i){s.exports=r(re(),Be())})(Q,function(t){return t.mode.OFB=function(){var r=t.lib.BlockCipherMode.extend(),i=r.Encryptor=r.extend({processBlock:function(n,a){var o=this._cipher,d=o.blockSize,c=this._iv,l=this._keystream;c&&(l=this._keystream=c.slice(0),this._iv=void 0),o.encryptBlock(l,0);for(var g=0;g<d;g++)n[a+g]^=l[g]}});return r.Decryptor=i,r}(),t.mode.OFB})}(mi)),mi.exports}var vi={exports:{}},da;function _0(){return da||(da=1,function(s,e){(function(t,r,i){s.exports=r(re(),Be())})(Q,function(t){return t.mode.ECB=function(){var r=t.lib.BlockCipherMode.extend();return r.Encryptor=r.extend({processBlock:function(i,n){this._cipher.encryptBlock(i,n)}}),r.Decryptor=r.extend({processBlock:function(i,n){this._cipher.decryptBlock(i,n)}}),r}(),t.mode.ECB})}(vi)),vi.exports}var Ei={exports:{}},la;function D0(){return la||(la=1,function(s,e){(function(t,r,i){s.exports=r(re(),Be())})(Q,function(t){return t.pad.AnsiX923={pad:function(r,i){var n=r.sigBytes,a=i*4,o=a-n%a,d=n+o-1;r.clamp(),r.words[d>>>2]|=o<<24-d%4*8,r.sigBytes+=o},unpad:function(r){var i=r.words[r.sigBytes-1>>>2]&255;r.sigBytes-=i}},t.pad.Ansix923})}(Ei)),Ei.exports}var yi={exports:{}},ha;function b0(){return ha||(ha=1,function(s,e){(function(t,r,i){s.exports=r(re(),Be())})(Q,function(t){return t.pad.Iso10126={pad:function(r,i){var n=i*4,a=n-r.sigBytes%n;r.concat(t.lib.WordArray.random(a-1)).concat(t.lib.WordArray.create([a<<24],1))},unpad:function(r){var i=r.words[r.sigBytes-1>>>2]&255;r.sigBytes-=i}},t.pad.Iso10126})}(yi)),yi.exports}var wi={exports:{}},ua;function A0(){return ua||(ua=1,function(s,e){(function(t,r,i){s.exports=r(re(),Be())})(Q,function(t){return t.pad.Iso97971={pad:function(r,i){r.concat(t.lib.WordArray.create([2147483648],1)),t.pad.ZeroPadding.pad(r,i)},unpad:function(r){t.pad.ZeroPadding.unpad(r),r.sigBytes--}},t.pad.Iso97971})}(wi)),wi.exports}var Ci={exports:{}},fa;function T0(){return fa||(fa=1,function(s,e){(function(t,r,i){s.exports=r(re(),Be())})(Q,function(t){return t.pad.ZeroPadding={pad:function(r,i){var n=i*4;r.clamp(),r.sigBytes+=n-(r.sigBytes%n||n)},unpad:function(r){for(var i=r.words,n=r.sigBytes-1,n=r.sigBytes-1;n>=0;n--)if(i[n>>>2]>>>24-n%4*8&255){r.sigBytes=n+1;break}}},t.pad.ZeroPadding})}(Ci)),Ci.exports}var _i={exports:{}},ga;function S0(){return ga||(ga=1,function(s,e){(function(t,r,i){s.exports=r(re(),Be())})(Q,function(t){return t.pad.NoPadding={pad:function(){},unpad:function(){}},t.pad.NoPadding})}(_i)),_i.exports}var Di={exports:{}},xa;function R0(){return xa||(xa=1,function(s,e){(function(t,r,i){s.exports=r(re(),Be())})(Q,function(t){return function(r){var i=t,n=i.lib,a=n.CipherParams,o=i.enc,d=o.Hex,c=i.format;c.Hex={stringify:function(l){return l.ciphertext.toString(d)},parse:function(l){var g=d.parse(l);return a.create({ciphertext:g})}}}(),t.format.Hex})}(Di)),Di.exports}var bi={exports:{}},pa;function F0(){return pa||(pa=1,function(s,e){(function(t,r,i){s.exports=r(re(),er(),tr(),qt(),Be())})(Q,function(t){return function(){var r=t,i=r.lib,n=i.BlockCipher,a=r.algo,o=[],d=[],c=[],l=[],g=[],u=[],y=[],v=[],C=[],_=[];(function(){for(var E=[],b=0;b<256;b++)b<128?E[b]=b<<1:E[b]=b<<1^283;for(var S=0,T=0,b=0;b<256;b++){var F=T^T<<1^T<<2^T<<3^T<<4;F=F>>>8^F&255^99,o[S]=F,d[F]=S;var h=E[S],M=E[h],A=E[M],f=E[F]*257^F*16843008;c[S]=f<<24|f>>>8,l[S]=f<<16|f>>>16,g[S]=f<<8|f>>>24,u[S]=f;var f=A*16843009^M*65537^h*257^S*16843008;y[F]=f<<24|f>>>8,v[F]=f<<16|f>>>16,C[F]=f<<8|f>>>24,_[F]=f,S?(S=h^E[E[E[A^h]]],T^=E[E[T]]):S=T=1}})();var x=[0,1,2,4,8,16,32,64,128,27,54],p=a.AES=n.extend({_doReset:function(){var E;if(!(this._nRounds&&this._keyPriorReset===this._key)){for(var b=this._keyPriorReset=this._key,S=b.words,T=b.sigBytes/4,F=this._nRounds=T+6,h=(F+1)*4,M=this._keySchedule=[],A=0;A<h;A++)A<T?M[A]=S[A]:(E=M[A-1],A%T?T>6&&A%T==4&&(E=o[E>>>24]<<24|o[E>>>16&255]<<16|o[E>>>8&255]<<8|o[E&255]):(E=E<<8|E>>>24,E=o[E>>>24]<<24|o[E>>>16&255]<<16|o[E>>>8&255]<<8|o[E&255],E^=x[A/T|0]<<24),M[A]=M[A-T]^E);for(var f=this._invKeySchedule=[],w=0;w<h;w++){var A=h-w;if(w%4)var E=M[A];else var E=M[A-4];w<4||A<=4?f[w]=E:f[w]=y[o[E>>>24]]^v[o[E>>>16&255]]^C[o[E>>>8&255]]^_[o[E&255]]}}},encryptBlock:function(E,b){this._doCryptBlock(E,b,this._keySchedule,c,l,g,u,o)},decryptBlock:function(E,b){var S=E[b+1];E[b+1]=E[b+3],E[b+3]=S,this._doCryptBlock(E,b,this._invKeySchedule,y,v,C,_,d);var S=E[b+1];E[b+1]=E[b+3],E[b+3]=S},_doCryptBlock:function(E,b,S,T,F,h,M,A){for(var f=this._nRounds,w=E[b]^S[0],m=E[b+1]^S[1],q=E[b+2]^S[2],N=E[b+3]^S[3],z=4,V=1;V<f;V++){var ie=T[w>>>24]^F[m>>>16&255]^h[q>>>8&255]^M[N&255]^S[z++],he=T[m>>>24]^F[q>>>16&255]^h[N>>>8&255]^M[w&255]^S[z++],ue=T[q>>>24]^F[N>>>16&255]^h[w>>>8&255]^M[m&255]^S[z++],k=T[N>>>24]^F[w>>>16&255]^h[m>>>8&255]^M[q&255]^S[z++];w=ie,m=he,q=ue,N=k}var ie=(A[w>>>24]<<24|A[m>>>16&255]<<16|A[q>>>8&255]<<8|A[N&255])^S[z++],he=(A[m>>>24]<<24|A[q>>>16&255]<<16|A[N>>>8&255]<<8|A[w&255])^S[z++],ue=(A[q>>>24]<<24|A[N>>>16&255]<<16|A[w>>>8&255]<<8|A[m&255])^S[z++],k=(A[N>>>24]<<24|A[w>>>16&255]<<16|A[m>>>8&255]<<8|A[q&255])^S[z++];E[b]=ie,E[b+1]=he,E[b+2]=ue,E[b+3]=k},keySize:256/32});r.AES=n._createHelper(p)}(),t.AES})}(bi)),bi.exports}var Ai={exports:{}},ma;function B0(){return ma||(ma=1,function(s,e){(function(t,r,i){s.exports=r(re(),er(),tr(),qt(),Be())})(Q,function(t){return function(){var r=t,i=r.lib,n=i.WordArray,a=i.BlockCipher,o=r.algo,d=[57,49,41,33,25,17,9,1,58,50,42,34,26,18,10,2,59,51,43,35,27,19,11,3,60,52,44,36,63,55,47,39,31,23,15,7,62,54,46,38,30,22,14,6,61,53,45,37,29,21,13,5,28,20,12,4],c=[14,17,11,24,1,5,3,28,15,6,21,10,23,19,12,4,26,8,16,7,27,20,13,2,41,52,31,37,47,55,30,40,51,45,33,48,44,49,39,56,34,53,46,42,50,36,29,32],l=[1,2,4,6,8,10,12,14,15,17,19,21,23,25,27,28],g=[{0:8421888,268435456:32768,536870912:8421378,805306368:2,1073741824:512,1342177280:8421890,1610612736:8389122,1879048192:8388608,2147483648:514,2415919104:8389120,2684354560:33280,2952790016:8421376,3221225472:32770,3489660928:8388610,3758096384:0,4026531840:33282,134217728:0,402653184:8421890,671088640:33282,939524096:32768,1207959552:8421888,1476395008:512,1744830464:8421378,2013265920:2,2281701376:8389120,2550136832:33280,2818572288:8421376,3087007744:8389122,3355443200:8388610,3623878656:32770,3892314112:514,4160749568:8388608,1:32768,268435457:2,536870913:8421888,805306369:8388608,1073741825:8421378,1342177281:33280,1610612737:512,1879048193:8389122,2147483649:8421890,2415919105:8421376,2684354561:8388610,2952790017:33282,3221225473:514,3489660929:8389120,3758096385:32770,4026531841:0,134217729:8421890,402653185:8421376,671088641:8388608,939524097:512,1207959553:32768,1476395009:8388610,1744830465:2,2013265921:33282,2281701377:32770,2550136833:8389122,2818572289:514,3087007745:8421888,3355443201:8389120,3623878657:0,3892314113:33280,4160749569:8421378},{0:1074282512,16777216:16384,33554432:524288,50331648:1074266128,67108864:1073741840,83886080:1074282496,100663296:1073758208,117440512:16,134217728:540672,150994944:1073758224,167772160:1073741824,184549376:540688,201326592:524304,218103808:0,234881024:16400,251658240:1074266112,8388608:1073758208,25165824:540688,41943040:16,58720256:1073758224,75497472:1074282512,92274688:1073741824,109051904:524288,125829120:1074266128,142606336:524304,159383552:0,176160768:16384,192937984:1074266112,209715200:1073741840,226492416:540672,243269632:1074282496,260046848:16400,268435456:0,285212672:1074266128,301989888:1073758224,318767104:1074282496,335544320:1074266112,352321536:16,369098752:540688,385875968:16384,402653184:16400,419430400:524288,436207616:524304,452984832:1073741840,469762048:540672,486539264:1073758208,503316480:1073741824,520093696:1074282512,276824064:540688,293601280:524288,310378496:1074266112,327155712:16384,343932928:1073758208,360710144:1074282512,377487360:16,394264576:1073741824,411041792:1074282496,427819008:1073741840,444596224:1073758224,461373440:524304,478150656:0,494927872:16400,511705088:1074266128,528482304:540672},{0:260,1048576:0,2097152:67109120,3145728:65796,4194304:65540,5242880:67108868,6291456:67174660,7340032:67174400,8388608:67108864,9437184:67174656,10485760:65792,11534336:67174404,12582912:67109124,13631488:65536,14680064:4,15728640:256,524288:67174656,1572864:67174404,2621440:0,3670016:67109120,4718592:67108868,5767168:65536,6815744:65540,7864320:260,8912896:4,9961472:256,11010048:67174400,12058624:65796,13107200:65792,14155776:67109124,15204352:67174660,16252928:67108864,16777216:67174656,17825792:65540,18874368:65536,19922944:67109120,20971520:256,22020096:67174660,23068672:67108868,24117248:0,25165824:67109124,26214400:67108864,27262976:4,28311552:65792,29360128:67174400,30408704:260,31457280:65796,32505856:67174404,17301504:67108864,18350080:260,19398656:67174656,20447232:0,21495808:65540,22544384:67109120,23592960:256,24641536:67174404,25690112:65536,26738688:67174660,27787264:65796,28835840:67108868,29884416:67109124,30932992:67174400,31981568:4,33030144:65792},{0:2151682048,65536:2147487808,131072:4198464,196608:2151677952,262144:0,327680:4198400,393216:2147483712,458752:4194368,524288:2147483648,589824:4194304,655360:64,720896:2147487744,786432:2151678016,851968:4160,917504:4096,983040:2151682112,32768:2147487808,98304:64,163840:2151678016,229376:2147487744,294912:4198400,360448:2151682112,425984:0,491520:2151677952,557056:4096,622592:2151682048,688128:4194304,753664:4160,819200:2147483648,884736:4194368,950272:4198464,1015808:2147483712,1048576:4194368,1114112:4198400,1179648:2147483712,1245184:0,1310720:4160,1376256:2151678016,1441792:2151682048,1507328:2147487808,1572864:2151682112,1638400:2147483648,1703936:2151677952,1769472:4198464,1835008:2147487744,1900544:4194304,1966080:64,2031616:4096,1081344:2151677952,1146880:2151682112,1212416:0,1277952:4198400,1343488:4194368,1409024:2147483648,1474560:2147487808,1540096:64,1605632:2147483712,1671168:4096,1736704:2147487744,1802240:2151678016,1867776:4160,1933312:2151682048,1998848:4194304,2064384:4198464},{0:128,4096:17039360,8192:262144,12288:536870912,16384:537133184,20480:16777344,24576:553648256,28672:262272,32768:16777216,36864:537133056,40960:536871040,45056:553910400,49152:553910272,53248:0,57344:17039488,61440:553648128,2048:17039488,6144:553648256,10240:128,14336:17039360,18432:262144,22528:537133184,26624:553910272,30720:536870912,34816:537133056,38912:0,43008:553910400,47104:16777344,51200:536871040,55296:553648128,59392:16777216,63488:262272,65536:262144,69632:128,73728:536870912,77824:553648256,81920:16777344,86016:553910272,90112:537133184,94208:16777216,98304:553910400,102400:553648128,106496:17039360,110592:537133056,114688:262272,118784:536871040,122880:0,126976:17039488,67584:553648256,71680:16777216,75776:17039360,79872:537133184,83968:536870912,88064:17039488,92160:128,96256:553910272,100352:262272,104448:553910400,108544:0,112640:553648128,116736:16777344,120832:262144,124928:537133056,129024:536871040},{0:268435464,256:8192,512:270532608,768:270540808,1024:268443648,1280:2097152,1536:2097160,1792:268435456,2048:0,2304:268443656,2560:2105344,2816:8,3072:270532616,3328:2105352,3584:8200,3840:270540800,128:270532608,384:270540808,640:8,896:2097152,1152:2105352,1408:268435464,1664:268443648,1920:8200,2176:2097160,2432:8192,2688:268443656,2944:270532616,3200:0,3456:270540800,3712:2105344,3968:268435456,4096:268443648,4352:270532616,4608:270540808,4864:8200,5120:2097152,5376:268435456,5632:268435464,5888:2105344,6144:2105352,6400:0,6656:8,6912:270532608,7168:8192,7424:268443656,7680:270540800,7936:2097160,4224:8,4480:2105344,4736:2097152,4992:268435464,5248:268443648,5504:8200,5760:270540808,6016:270532608,6272:270540800,6528:270532616,6784:8192,7040:2105352,7296:2097160,7552:0,7808:268435456,8064:268443656},{0:1048576,16:33555457,32:1024,48:1049601,64:34604033,80:0,96:1,112:34603009,128:33555456,144:1048577,160:33554433,176:34604032,192:34603008,208:1025,224:1049600,240:33554432,8:34603009,24:0,40:33555457,56:34604032,72:1048576,88:33554433,104:33554432,120:1025,136:1049601,152:33555456,168:34603008,184:1048577,200:1024,216:34604033,232:1,248:1049600,256:33554432,272:1048576,288:33555457,304:34603009,320:1048577,336:33555456,352:34604032,368:1049601,384:1025,400:34604033,416:1049600,432:1,448:0,464:34603008,480:33554433,496:1024,264:1049600,280:33555457,296:34603009,312:1,328:33554432,344:1048576,360:1025,376:34604032,392:33554433,408:34603008,424:0,440:34604033,456:1049601,472:1024,488:33555456,504:1048577},{0:134219808,1:131072,2:134217728,3:32,4:131104,5:134350880,6:134350848,7:2048,8:134348800,9:134219776,10:133120,11:134348832,12:2080,13:0,14:134217760,15:133152,2147483648:2048,2147483649:134350880,2147483650:134219808,2147483651:134217728,2147483652:134348800,2147483653:133120,2147483654:133152,2147483655:32,2147483656:134217760,2147483657:2080,2147483658:131104,2147483659:134350848,2147483660:0,2147483661:134348832,2147483662:134219776,2147483663:131072,16:133152,17:134350848,18:32,19:2048,20:134219776,21:134217760,22:134348832,23:131072,24:0,25:131104,26:134348800,27:134219808,28:134350880,29:133120,30:2080,31:134217728,2147483664:131072,2147483665:2048,2147483666:134348832,2147483667:133152,2147483668:32,2147483669:134348800,2147483670:134217728,2147483671:134219808,2147483672:134350880,2147483673:134217760,2147483674:134219776,2147483675:0,2147483676:133120,2147483677:2080,2147483678:131104,2147483679:134350848}],u=[4160749569,528482304,33030144,2064384,129024,8064,504,2147483679],y=o.DES=a.extend({_doReset:function(){for(var x=this._key,p=x.words,E=[],b=0;b<56;b++){var S=d[b]-1;E[b]=p[S>>>5]>>>31-S%32&1}for(var T=this._subKeys=[],F=0;F<16;F++){for(var h=T[F]=[],M=l[F],b=0;b<24;b++)h[b/6|0]|=E[(c[b]-1+M)%28]<<31-b%6,h[4+(b/6|0)]|=E[28+(c[b+24]-1+M)%28]<<31-b%6;h[0]=h[0]<<1|h[0]>>>31;for(var b=1;b<7;b++)h[b]=h[b]>>>(b-1)*4+3;h[7]=h[7]<<5|h[7]>>>27}for(var A=this._invSubKeys=[],b=0;b<16;b++)A[b]=T[15-b]},encryptBlock:function(x,p){this._doCryptBlock(x,p,this._subKeys)},decryptBlock:function(x,p){this._doCryptBlock(x,p,this._invSubKeys)},_doCryptBlock:function(x,p,E){this._lBlock=x[p],this._rBlock=x[p+1],v.call(this,4,252645135),v.call(this,16,65535),C.call(this,2,858993459),C.call(this,8,16711935),v.call(this,1,1431655765);for(var b=0;b<16;b++){for(var S=E[b],T=this._lBlock,F=this._rBlock,h=0,M=0;M<8;M++)h|=g[M][((F^S[M])&u[M])>>>0];this._lBlock=F,this._rBlock=T^h}var A=this._lBlock;this._lBlock=this._rBlock,this._rBlock=A,v.call(this,1,1431655765),C.call(this,8,16711935),C.call(this,2,858993459),v.call(this,16,65535),v.call(this,4,252645135),x[p]=this._lBlock,x[p+1]=this._rBlock},keySize:64/32,ivSize:64/32,blockSize:64/32});function v(x,p){var E=(this._lBlock>>>x^this._rBlock)&p;this._rBlock^=E,this._lBlock^=E<<x}function C(x,p){var E=(this._rBlock>>>x^this._lBlock)&p;this._lBlock^=E,this._rBlock^=E<<x}r.DES=a._createHelper(y);var _=o.TripleDES=a.extend({_doReset:function(){var x=this._key,p=x.words;if(p.length!==2&&p.length!==4&&p.length<6)throw new Error("Invalid key length - 3DES requires the key length to be 64, 128, 192 or >192.");var E=p.slice(0,2),b=p.length<4?p.slice(0,2):p.slice(2,4),S=p.length<6?p.slice(0,2):p.slice(4,6);this._des1=y.createEncryptor(n.create(E)),this._des2=y.createEncryptor(n.create(b)),this._des3=y.createEncryptor(n.create(S))},encryptBlock:function(x,p){this._des1.encryptBlock(x,p),this._des2.decryptBlock(x,p),this._des3.encryptBlock(x,p)},decryptBlock:function(x,p){this._des3.decryptBlock(x,p),this._des2.encryptBlock(x,p),this._des1.decryptBlock(x,p)},keySize:192/32,ivSize:64/32,blockSize:64/32});r.TripleDES=a._createHelper(_)}(),t.TripleDES})}(Ai)),Ai.exports}var Ti={exports:{}},va;function k0(){return va||(va=1,function(s,e){(function(t,r,i){s.exports=r(re(),er(),tr(),qt(),Be())})(Q,function(t){return function(){var r=t,i=r.lib,n=i.StreamCipher,a=r.algo,o=a.RC4=n.extend({_doReset:function(){for(var l=this._key,g=l.words,u=l.sigBytes,y=this._S=[],v=0;v<256;v++)y[v]=v;for(var v=0,C=0;v<256;v++){var _=v%u,x=g[_>>>2]>>>24-_%4*8&255;C=(C+y[v]+x)%256;var p=y[v];y[v]=y[C],y[C]=p}this._i=this._j=0},_doProcessBlock:function(l,g){l[g]^=d.call(this)},keySize:256/32,ivSize:0});function d(){for(var l=this._S,g=this._i,u=this._j,y=0,v=0;v<4;v++){g=(g+1)%256,u=(u+l[g])%256;var C=l[g];l[g]=l[u],l[u]=C,y|=l[(l[g]+l[u])%256]<<24-v*8}return this._i=g,this._j=u,y}r.RC4=n._createHelper(o);var c=a.RC4Drop=o.extend({cfg:o.cfg.extend({drop:192}),_doReset:function(){o._doReset.call(this);for(var l=this.cfg.drop;l>0;l--)d.call(this)}});r.RC4Drop=n._createHelper(c)}(),t.RC4})}(Ti)),Ti.exports}var Si={exports:{}},Ea;function I0(){return Ea||(Ea=1,function(s,e){(function(t,r,i){s.exports=r(re(),er(),tr(),qt(),Be())})(Q,function(t){return function(){var r=t,i=r.lib,n=i.StreamCipher,a=r.algo,o=[],d=[],c=[],l=a.Rabbit=n.extend({_doReset:function(){for(var u=this._key.words,y=this.cfg.iv,v=0;v<4;v++)u[v]=(u[v]<<8|u[v]>>>24)&16711935|(u[v]<<24|u[v]>>>8)&4278255360;var C=this._X=[u[0],u[3]<<16|u[2]>>>16,u[1],u[0]<<16|u[3]>>>16,u[2],u[1]<<16|u[0]>>>16,u[3],u[2]<<16|u[1]>>>16],_=this._C=[u[2]<<16|u[2]>>>16,u[0]&4294901760|u[1]&65535,u[3]<<16|u[3]>>>16,u[1]&4294901760|u[2]&65535,u[0]<<16|u[0]>>>16,u[2]&4294901760|u[3]&65535,u[1]<<16|u[1]>>>16,u[3]&4294901760|u[0]&65535];this._b=0;for(var v=0;v<4;v++)g.call(this);for(var v=0;v<8;v++)_[v]^=C[v+4&7];if(y){var x=y.words,p=x[0],E=x[1],b=(p<<8|p>>>24)&16711935|(p<<24|p>>>8)&4278255360,S=(E<<8|E>>>24)&16711935|(E<<24|E>>>8)&4278255360,T=b>>>16|S&4294901760,F=S<<16|b&65535;_[0]^=b,_[1]^=T,_[2]^=S,_[3]^=F,_[4]^=b,_[5]^=T,_[6]^=S,_[7]^=F;for(var v=0;v<4;v++)g.call(this)}},_doProcessBlock:function(u,y){var v=this._X;g.call(this),o[0]=v[0]^v[5]>>>16^v[3]<<16,o[1]=v[2]^v[7]>>>16^v[5]<<16,o[2]=v[4]^v[1]>>>16^v[7]<<16,o[3]=v[6]^v[3]>>>16^v[1]<<16;for(var C=0;C<4;C++)o[C]=(o[C]<<8|o[C]>>>24)&16711935|(o[C]<<24|o[C]>>>8)&4278255360,u[y+C]^=o[C]},blockSize:128/32,ivSize:64/32});function g(){for(var u=this._X,y=this._C,v=0;v<8;v++)d[v]=y[v];y[0]=y[0]+1295307597+this._b|0,y[1]=y[1]+3545052371+(y[0]>>>0<d[0]>>>0?1:0)|0,y[2]=y[2]+886263092+(y[1]>>>0<d[1]>>>0?1:0)|0,y[3]=y[3]+1295307597+(y[2]>>>0<d[2]>>>0?1:0)|0,y[4]=y[4]+3545052371+(y[3]>>>0<d[3]>>>0?1:0)|0,y[5]=y[5]+886263092+(y[4]>>>0<d[4]>>>0?1:0)|0,y[6]=y[6]+1295307597+(y[5]>>>0<d[5]>>>0?1:0)|0,y[7]=y[7]+3545052371+(y[6]>>>0<d[6]>>>0?1:0)|0,this._b=y[7]>>>0<d[7]>>>0?1:0;for(var v=0;v<8;v++){var C=u[v]+y[v],_=C&65535,x=C>>>16,p=((_*_>>>17)+_*x>>>15)+x*x,E=((C&4294901760)*C|0)+((C&65535)*C|0);c[v]=p^E}u[0]=c[0]+(c[7]<<16|c[7]>>>16)+(c[6]<<16|c[6]>>>16)|0,u[1]=c[1]+(c[0]<<8|c[0]>>>24)+c[7]|0,u[2]=c[2]+(c[1]<<16|c[1]>>>16)+(c[0]<<16|c[0]>>>16)|0,u[3]=c[3]+(c[2]<<8|c[2]>>>24)+c[1]|0,u[4]=c[4]+(c[3]<<16|c[3]>>>16)+(c[2]<<16|c[2]>>>16)|0,u[5]=c[5]+(c[4]<<8|c[4]>>>24)+c[3]|0,u[6]=c[6]+(c[5]<<16|c[5]>>>16)+(c[4]<<16|c[4]>>>16)|0,u[7]=c[7]+(c[6]<<8|c[6]>>>24)+c[5]|0}r.Rabbit=n._createHelper(l)}(),t.Rabbit})}(Si)),Si.exports}var Ri={exports:{}},ya;function $0(){return ya||(ya=1,function(s,e){(function(t,r,i){s.exports=r(re(),er(),tr(),qt(),Be())})(Q,function(t){return function(){var r=t,i=r.lib,n=i.StreamCipher,a=r.algo,o=[],d=[],c=[],l=a.RabbitLegacy=n.extend({_doReset:function(){var u=this._key.words,y=this.cfg.iv,v=this._X=[u[0],u[3]<<16|u[2]>>>16,u[1],u[0]<<16|u[3]>>>16,u[2],u[1]<<16|u[0]>>>16,u[3],u[2]<<16|u[1]>>>16],C=this._C=[u[2]<<16|u[2]>>>16,u[0]&4294901760|u[1]&65535,u[3]<<16|u[3]>>>16,u[1]&4294901760|u[2]&65535,u[0]<<16|u[0]>>>16,u[2]&4294901760|u[3]&65535,u[1]<<16|u[1]>>>16,u[3]&4294901760|u[0]&65535];this._b=0;for(var _=0;_<4;_++)g.call(this);for(var _=0;_<8;_++)C[_]^=v[_+4&7];if(y){var x=y.words,p=x[0],E=x[1],b=(p<<8|p>>>24)&16711935|(p<<24|p>>>8)&4278255360,S=(E<<8|E>>>24)&16711935|(E<<24|E>>>8)&4278255360,T=b>>>16|S&4294901760,F=S<<16|b&65535;C[0]^=b,C[1]^=T,C[2]^=S,C[3]^=F,C[4]^=b,C[5]^=T,C[6]^=S,C[7]^=F;for(var _=0;_<4;_++)g.call(this)}},_doProcessBlock:function(u,y){var v=this._X;g.call(this),o[0]=v[0]^v[5]>>>16^v[3]<<16,o[1]=v[2]^v[7]>>>16^v[5]<<16,o[2]=v[4]^v[1]>>>16^v[7]<<16,o[3]=v[6]^v[3]>>>16^v[1]<<16;for(var C=0;C<4;C++)o[C]=(o[C]<<8|o[C]>>>24)&16711935|(o[C]<<24|o[C]>>>8)&4278255360,u[y+C]^=o[C]},blockSize:128/32,ivSize:64/32});function g(){for(var u=this._X,y=this._C,v=0;v<8;v++)d[v]=y[v];y[0]=y[0]+1295307597+this._b|0,y[1]=y[1]+3545052371+(y[0]>>>0<d[0]>>>0?1:0)|0,y[2]=y[2]+886263092+(y[1]>>>0<d[1]>>>0?1:0)|0,y[3]=y[3]+1295307597+(y[2]>>>0<d[2]>>>0?1:0)|0,y[4]=y[4]+3545052371+(y[3]>>>0<d[3]>>>0?1:0)|0,y[5]=y[5]+886263092+(y[4]>>>0<d[4]>>>0?1:0)|0,y[6]=y[6]+1295307597+(y[5]>>>0<d[5]>>>0?1:0)|0,y[7]=y[7]+3545052371+(y[6]>>>0<d[6]>>>0?1:0)|0,this._b=y[7]>>>0<d[7]>>>0?1:0;for(var v=0;v<8;v++){var C=u[v]+y[v],_=C&65535,x=C>>>16,p=((_*_>>>17)+_*x>>>15)+x*x,E=((C&4294901760)*C|0)+((C&65535)*C|0);c[v]=p^E}u[0]=c[0]+(c[7]<<16|c[7]>>>16)+(c[6]<<16|c[6]>>>16)|0,u[1]=c[1]+(c[0]<<8|c[0]>>>24)+c[7]|0,u[2]=c[2]+(c[1]<<16|c[1]>>>16)+(c[0]<<16|c[0]>>>16)|0,u[3]=c[3]+(c[2]<<8|c[2]>>>24)+c[1]|0,u[4]=c[4]+(c[3]<<16|c[3]>>>16)+(c[2]<<16|c[2]>>>16)|0,u[5]=c[5]+(c[4]<<8|c[4]>>>24)+c[3]|0,u[6]=c[6]+(c[5]<<16|c[5]>>>16)+(c[4]<<16|c[4]>>>16)|0,u[7]=c[7]+(c[6]<<8|c[6]>>>24)+c[5]|0}r.RabbitLegacy=n._createHelper(l)}(),t.RabbitLegacy})}(Ri)),Ri.exports}var Fi={exports:{}},wa;function H0(){return wa||(wa=1,function(s,e){(function(t,r,i){s.exports=r(re(),er(),tr(),qt(),Be())})(Q,function(t){return function(){var r=t,i=r.lib,n=i.BlockCipher,a=r.algo;const o=16,d=[608135816,2242054355,320440878,57701188,2752067618,698298832,137296536,3964562569,1160258022,953160567,3193202383,887688300,3232508343,3380367581,1065670069,3041331479,2450970073,2306472731],c=[[3509652390,2564797868,805139163,3491422135,3101798381,1780907670,3128725573,4046225305,614570311,3012652279,134345442,2240740374,1667834072,1901547113,2757295779,4103290238,227898511,1921955416,1904987480,2182433518,2069144605,3260701109,2620446009,720527379,3318853667,677414384,3393288472,3101374703,2390351024,1614419982,1822297739,2954791486,3608508353,3174124327,2024746970,1432378464,3864339955,2857741204,1464375394,1676153920,1439316330,715854006,3033291828,289532110,2706671279,2087905683,3018724369,1668267050,732546397,1947742710,3462151702,2609353502,2950085171,1814351708,2050118529,680887927,999245976,1800124847,3300911131,1713906067,1641548236,4213287313,1216130144,1575780402,4018429277,3917837745,3693486850,3949271944,596196993,3549867205,258830323,2213823033,772490370,2760122372,1774776394,2652871518,566650946,4142492826,1728879713,2882767088,1783734482,3629395816,2517608232,2874225571,1861159788,326777828,3124490320,2130389656,2716951837,967770486,1724537150,2185432712,2364442137,1164943284,2105845187,998989502,3765401048,2244026483,1075463327,1455516326,1322494562,910128902,469688178,1117454909,936433444,3490320968,3675253459,1240580251,122909385,2157517691,634681816,4142456567,3825094682,3061402683,2540495037,79693498,3249098678,1084186820,1583128258,426386531,1761308591,1047286709,322548459,995290223,1845252383,2603652396,3431023940,2942221577,3202600964,3727903485,1712269319,422464435,3234572375,1170764815,3523960633,3117677531,1434042557,442511882,3600875718,1076654713,1738483198,4213154764,2393238008,3677496056,1014306527,4251020053,793779912,2902807211,842905082,4246964064,1395751752,1040244610,2656851899,3396308128,445077038,3742853595,3577915638,679411651,2892444358,2354009459,1767581616,3150600392,3791627101,3102740896,284835224,4246832056,1258075500,768725851,2589189241,3069724005,3532540348,1274779536,3789419226,2764799539,1660621633,3471099624,4011903706,913787905,3497959166,737222580,2514213453,2928710040,3937242737,1804850592,3499020752,2949064160,2386320175,2390070455,2415321851,4061277028,2290661394,2416832540,1336762016,1754252060,3520065937,3014181293,791618072,3188594551,3933548030,2332172193,3852520463,3043980520,413987798,3465142937,3030929376,4245938359,2093235073,3534596313,375366246,2157278981,2479649556,555357303,3870105701,2008414854,3344188149,4221384143,3956125452,2067696032,3594591187,2921233993,2428461,544322398,577241275,1471733935,610547355,4027169054,1432588573,1507829418,2025931657,3646575487,545086370,48609733,2200306550,1653985193,298326376,1316178497,3007786442,2064951626,458293330,2589141269,3591329599,3164325604,727753846,2179363840,146436021,1461446943,4069977195,705550613,3059967265,3887724982,4281599278,3313849956,1404054877,2845806497,146425753,1854211946],[1266315497,3048417604,3681880366,3289982499,290971e4,1235738493,2632868024,2414719590,3970600049,1771706367,1449415276,3266420449,422970021,1963543593,2690192192,3826793022,1062508698,1531092325,1804592342,2583117782,2714934279,4024971509,1294809318,4028980673,1289560198,2221992742,1669523910,35572830,157838143,1052438473,1016535060,1802137761,1753167236,1386275462,3080475397,2857371447,1040679964,2145300060,2390574316,1461121720,2956646967,4031777805,4028374788,33600511,2920084762,1018524850,629373528,3691585981,3515945977,2091462646,2486323059,586499841,988145025,935516892,3367335476,2599673255,2839830854,265290510,3972581182,2759138881,3795373465,1005194799,847297441,406762289,1314163512,1332590856,1866599683,4127851711,750260880,613907577,1450815602,3165620655,3734664991,3650291728,3012275730,3704569646,1427272223,778793252,1343938022,2676280711,2052605720,1946737175,3164576444,3914038668,3967478842,3682934266,1661551462,3294938066,4011595847,840292616,3712170807,616741398,312560963,711312465,1351876610,322626781,1910503582,271666773,2175563734,1594956187,70604529,3617834859,1007753275,1495573769,4069517037,2549218298,2663038764,504708206,2263041392,3941167025,2249088522,1514023603,1998579484,1312622330,694541497,2582060303,2151582166,1382467621,776784248,2618340202,3323268794,2497899128,2784771155,503983604,4076293799,907881277,423175695,432175456,1378068232,4145222326,3954048622,3938656102,3820766613,2793130115,2977904593,26017576,3274890735,3194772133,1700274565,1756076034,4006520079,3677328699,720338349,1533947780,354530856,688349552,3973924725,1637815568,332179504,3949051286,53804574,2852348879,3044236432,1282449977,3583942155,3416972820,4006381244,1617046695,2628476075,3002303598,1686838959,431878346,2686675385,1700445008,1080580658,1009431731,832498133,3223435511,2605976345,2271191193,2516031870,1648197032,4164389018,2548247927,300782431,375919233,238389289,3353747414,2531188641,2019080857,1475708069,455242339,2609103871,448939670,3451063019,1395535956,2413381860,1841049896,1491858159,885456874,4264095073,4001119347,1565136089,3898914787,1108368660,540939232,1173283510,2745871338,3681308437,4207628240,3343053890,4016749493,1699691293,1103962373,3625875870,2256883143,3830138730,1031889488,3479347698,1535977030,4236805024,3251091107,2132092099,1774941330,1199868427,1452454533,157007616,2904115357,342012276,595725824,1480756522,206960106,497939518,591360097,863170706,2375253569,3596610801,1814182875,2094937945,3421402208,1082520231,3463918190,2785509508,435703966,3908032597,1641649973,2842273706,3305899714,1510255612,2148256476,2655287854,3276092548,4258621189,236887753,3681803219,274041037,1734335097,3815195456,3317970021,1899903192,1026095262,4050517792,356393447,2410691914,3873677099,3682840055],[3913112168,2491498743,4132185628,2489919796,1091903735,1979897079,3170134830,3567386728,3557303409,857797738,1136121015,1342202287,507115054,2535736646,337727348,3213592640,1301675037,2528481711,1895095763,1721773893,3216771564,62756741,2142006736,835421444,2531993523,1442658625,3659876326,2882144922,676362277,1392781812,170690266,3921047035,1759253602,3611846912,1745797284,664899054,1329594018,3901205900,3045908486,2062866102,2865634940,3543621612,3464012697,1080764994,553557557,3656615353,3996768171,991055499,499776247,1265440854,648242737,3940784050,980351604,3713745714,1749149687,3396870395,4211799374,3640570775,1161844396,3125318951,1431517754,545492359,4268468663,3499529547,1437099964,2702547544,3433638243,2581715763,2787789398,1060185593,1593081372,2418618748,4260947970,69676912,2159744348,86519011,2512459080,3838209314,1220612927,3339683548,133810670,1090789135,1078426020,1569222167,845107691,3583754449,4072456591,1091646820,628848692,1613405280,3757631651,526609435,236106946,48312990,2942717905,3402727701,1797494240,859738849,992217954,4005476642,2243076622,3870952857,3732016268,765654824,3490871365,2511836413,1685915746,3888969200,1414112111,2273134842,3281911079,4080962846,172450625,2569994100,980381355,4109958455,2819808352,2716589560,2568741196,3681446669,3329971472,1835478071,660984891,3704678404,4045999559,3422617507,3040415634,1762651403,1719377915,3470491036,2693910283,3642056355,3138596744,1364962596,2073328063,1983633131,926494387,3423689081,2150032023,4096667949,1749200295,3328846651,309677260,2016342300,1779581495,3079819751,111262694,1274766160,443224088,298511866,1025883608,3806446537,1145181785,168956806,3641502830,3584813610,1689216846,3666258015,3200248200,1692713982,2646376535,4042768518,1618508792,1610833997,3523052358,4130873264,2001055236,3610705100,2202168115,4028541809,2961195399,1006657119,2006996926,3186142756,1430667929,3210227297,1314452623,4074634658,4101304120,2273951170,1399257539,3367210612,3027628629,1190975929,2062231137,2333990788,2221543033,2438960610,1181637006,548689776,2362791313,3372408396,3104550113,3145860560,296247880,1970579870,3078560182,3769228297,1714227617,3291629107,3898220290,166772364,1251581989,493813264,448347421,195405023,2709975567,677966185,3703036547,1463355134,2715995803,1338867538,1343315457,2802222074,2684532164,233230375,2599980071,2000651841,3277868038,1638401717,4028070440,3237316320,6314154,819756386,300326615,590932579,1405279636,3267499572,3150704214,2428286686,3959192993,3461946742,1862657033,1266418056,963775037,2089974820,2263052895,1917689273,448879540,3550394620,3981727096,150775221,3627908307,1303187396,508620638,2975983352,2726630617,1817252668,1876281319,1457606340,908771278,3720792119,3617206836,2455994898,1729034894,1080033504],[976866871,3556439503,2881648439,1522871579,1555064734,1336096578,3548522304,2579274686,3574697629,3205460757,3593280638,3338716283,3079412587,564236357,2993598910,1781952180,1464380207,3163844217,3332601554,1699332808,1393555694,1183702653,3581086237,1288719814,691649499,2847557200,2895455976,3193889540,2717570544,1781354906,1676643554,2592534050,3230253752,1126444790,2770207658,2633158820,2210423226,2615765581,2414155088,3127139286,673620729,2805611233,1269405062,4015350505,3341807571,4149409754,1057255273,2012875353,2162469141,2276492801,2601117357,993977747,3918593370,2654263191,753973209,36408145,2530585658,25011837,3520020182,2088578344,530523599,2918365339,1524020338,1518925132,3760827505,3759777254,1202760957,3985898139,3906192525,674977740,4174734889,2031300136,2019492241,3983892565,4153806404,3822280332,352677332,2297720250,60907813,90501309,3286998549,1016092578,2535922412,2839152426,457141659,509813237,4120667899,652014361,1966332200,2975202805,55981186,2327461051,676427537,3255491064,2882294119,3433927263,1307055953,942726286,933058658,2468411793,3933900994,4215176142,1361170020,2001714738,2830558078,3274259782,1222529897,1679025792,2729314320,3714953764,1770335741,151462246,3013232138,1682292957,1483529935,471910574,1539241949,458788160,3436315007,1807016891,3718408830,978976581,1043663428,3165965781,1927990952,4200891579,2372276910,3208408903,3533431907,1412390302,2931980059,4132332400,1947078029,3881505623,4168226417,2941484381,1077988104,1320477388,886195818,18198404,3786409e3,2509781533,112762804,3463356488,1866414978,891333506,18488651,661792760,1628790961,3885187036,3141171499,876946877,2693282273,1372485963,791857591,2686433993,3759982718,3167212022,3472953795,2716379847,445679433,3561995674,3504004811,3574258232,54117162,3331405415,2381918588,3769707343,4154350007,1140177722,4074052095,668550556,3214352940,367459370,261225585,2610173221,4209349473,3468074219,3265815641,314222801,3066103646,3808782860,282218597,3406013506,3773591054,379116347,1285071038,846784868,2669647154,3771962079,3550491691,2305946142,453669953,1268987020,3317592352,3279303384,3744833421,2610507566,3859509063,266596637,3847019092,517658769,3462560207,3443424879,370717030,4247526661,2224018117,4143653529,4112773975,2788324899,2477274417,1456262402,2901442914,1517677493,1846949527,2295493580,3734397586,2176403920,1280348187,1908823572,3871786941,846861322,1172426758,3287448474,3383383037,1655181056,3139813346,901632758,1897031941,2986607138,3066810236,3447102507,1393639104,373351379,950779232,625454576,3124240540,4148612726,2007998917,544563296,2244738638,2330496472,2058025392,1291430526,424198748,50039436,29584100,3605783033,2429876329,2791104160,1057563949,3255363231,3075367218,3463963227,1469046755,985887462]];var l={pbox:[],sbox:[]};function g(_,x){let p=x>>24&255,E=x>>16&255,b=x>>8&255,S=x&255,T=_.sbox[0][p]+_.sbox[1][E];return T=T^_.sbox[2][b],T=T+_.sbox[3][S],T}function u(_,x,p){let E=x,b=p,S;for(let T=0;T<o;++T)E=E^_.pbox[T],b=g(_,E)^b,S=E,E=b,b=S;return S=E,E=b,b=S,b=b^_.pbox[o],E=E^_.pbox[o+1],{left:E,right:b}}function y(_,x,p){let E=x,b=p,S;for(let T=o+1;T>1;--T)E=E^_.pbox[T],b=g(_,E)^b,S=E,E=b,b=S;return S=E,E=b,b=S,b=b^_.pbox[1],E=E^_.pbox[0],{left:E,right:b}}function v(_,x,p){for(let F=0;F<4;F++){_.sbox[F]=[];for(let h=0;h<256;h++)_.sbox[F][h]=c[F][h]}let E=0;for(let F=0;F<o+2;F++)_.pbox[F]=d[F]^x[E],E++,E>=p&&(E=0);let b=0,S=0,T=0;for(let F=0;F<o+2;F+=2)T=u(_,b,S),b=T.left,S=T.right,_.pbox[F]=b,_.pbox[F+1]=S;for(let F=0;F<4;F++)for(let h=0;h<256;h+=2)T=u(_,b,S),b=T.left,S=T.right,_.sbox[F][h]=b,_.sbox[F][h+1]=S;return!0}var C=a.Blowfish=n.extend({_doReset:function(){if(this._keyPriorReset!==this._key){var _=this._keyPriorReset=this._key,x=_.words,p=_.sigBytes/4;v(l,x,p)}},encryptBlock:function(_,x){var p=u(l,_[x],_[x+1]);_[x]=p.left,_[x+1]=p.right},decryptBlock:function(_,x){var p=y(l,_[x],_[x+1]);_[x]=p.left,_[x+1]=p.right},blockSize:64/32,keySize:128/32,ivSize:64/32});r.Blowfish=n._createHelper(C)}(),t.Blowfish})}(Fi)),Fi.exports}(function(s,e){(function(t,r,i){s.exports=r(re(),os(),h0(),u0(),er(),f0(),tr(),Gn(),si(),g0(),Jn(),x0(),p0(),m0(),li(),v0(),qt(),Be(),E0(),y0(),w0(),C0(),_0(),D0(),b0(),A0(),T0(),S0(),R0(),F0(),B0(),k0(),I0(),$0(),H0())})(Q,function(t){return t})})(Mn);var P0=Mn.exports;const rr=wo(P0);class O0{constructor(){this.listeners={}}on(e,t){return this.listeners[e]||(this.listeners[e]=[]),this.listeners[e].push(t),()=>this.off(e,t)}off(e,t){this.listeners[e]&&(this.listeners[e]=this.listeners[e].filter(r=>r!==t))}emitLocal(e,t){this.listeners[e]&&this.listeners[e].forEach(r=>{try{r(t)}catch(i){console.error(`Error in event listener for ${e}:`,i)}})}emitToParent(e,t){this.emitLocal(e,t)}}const se=new O0;let st=null,we=null,xr=null;const sr={setConfig(s){st=s},getConfig(){return st},decrypt(s,e=null,t=null){var r,i;try{const n=e||((r=st==null?void 0:st.env)==null?void 0:r.DECODE_IV)||"default_iv_1234",a=t||((i=st==null?void 0:st.env)==null?void 0:i.DECODE_KEY)||"default_key_1234",o=rr.enc.Base64.parse(s),d=rr.enc.Utf8.parse(a),c=rr.enc.Utf8.parse(n);return rr.AES.decrypt({ciphertext:o},d,{iv:c,mode:rr.mode.CTR,padding:rr.pad.NoPadding}).toString(rr.enc.Utf8)}catch(n){return console.log("ERROR ===> failed decrypt:",n),!1}},pushSound(){try{xr&&clearInterval(xr);const s=()=>{try{(!we||we.state==="closed")&&(we=new(window.AudioContext||window.webkitAudioContext)),we.state==="suspended"&&we.resume();const e=we.createOscillator(),t=we.createOscillator(),r=we.createGain();e.type="sine",t.type="sine",e.frequency.setValueAtTime(400,we.currentTime),t.frequency.setValueAtTime(450,we.currentTime);const i=we.createOscillator(),n=we.createGain();i.frequency.value=25,n.gain.value=15,i.connect(n),n.connect(e.frequency),n.connect(t.frequency),e.connect(r),t.connect(r),r.connect(we.destination),r.gain.setValueAtTime(0,we.currentTime),r.gain.linearRampToValueAtTime(.08,we.currentTime+.05),r.gain.setValueAtTime(.08,we.currentTime+1.2),r.gain.linearRampToValueAtTime(0,we.currentTime+1.3),i.start(),e.start(),t.start(),i.stop(we.currentTime+1.4),e.stop(we.currentTime+1.4),t.stop(we.currentTime+1.4)}catch(e){console.warn("Failed to play synthesized tone:",e)}};s(),xr=setInterval(s,3e3)}catch(s){console.warn("AudioContext initialization failed:",s)}},stopSound(){xr&&(clearInterval(xr),xr=null),we&&(we.close().catch(()=>{}),we=null)},pushNotification(s){se.emitToParent("show_notification",{message:s})},toHHMMSS(s){const e=parseInt(s,10),t=Math.floor(e/3600),r=Math.floor(e/60)%60,i=e%60;return[t,r,i].map(n=>n<10?"0"+n:n).filter((n,a)=>n!=="00"||a>0).join(":")},mute(s,e,t,r){s?e?s.unmute():s.mute():r&&(e?r.unmuteAudio():r.muteAudio()),t(!e)},hold(s,e,t,r){s?e?s.unhold():s.hold():r&&(e?r.unhold():r.hold()),t(!e)},async hangup(s,e,t,r,i,n,a,o){r&&await r(!1),i&&i(!1),n&&n(0),s&&s.current&&clearInterval(s.current),e?(await(e==null?void 0:e.terminate("hangup")),a&&a(!1),se.emitLocal("yeastarSession",!1)):t&&(await(t==null?void 0:t.hangup()),o&&o(!1),se.emitLocal("flashphonerCall",!1))},attachRemoteAudio(s){if(!s)return;let e=document.getElementById("ys-remote-audio");e||(e=document.createElement("audio"),e.id="ys-remote-audio",e.autoplay=!0,e.playsInline=!0,e.hidden=!0,document.body.appendChild(e)),e.srcObject=s,e.play().catch(()=>{console.warn("User gesture needed to play audio"),se.emitLocal("needUserGestureToPlay",!0)})},getContactName(s){return s&&((st==null?void 0:st.contacts)||{1001:"John Doe",1002:"Jane Smith","08123456789":"Alice Johnson",123:"Customer Support"})[s]||null}};//! moment.js
|
|
94
|
+
//! version : 2.30.1
|
|
95
|
+
//! authors : Tim Wood, Iskren Chernev, Moment.js contributors
|
|
96
|
+
//! license : MIT
|
|
97
|
+
//! momentjs.com
|
|
98
|
+
var Ca;function L(){return Ca.apply(null,arguments)}function M0(s){Ca=s}function it(s){return s instanceof Array||Object.prototype.toString.call(s)==="[object Array]"}function ir(s){return s!=null&&Object.prototype.toString.call(s)==="[object Object]"}function ce(s,e){return Object.prototype.hasOwnProperty.call(s,e)}function Bi(s){if(Object.getOwnPropertyNames)return Object.getOwnPropertyNames(s).length===0;var e;for(e in s)if(ce(s,e))return!1;return!0}function Ye(s){return s===void 0}function Ct(s){return typeof s=="number"||Object.prototype.toString.call(s)==="[object Number]"}function Pr(s){return s instanceof Date||Object.prototype.toString.call(s)==="[object Date]"}function _a(s,e){var t=[],r,i=s.length;for(r=0;r<i;++r)t.push(e(s[r],r));return t}function Ut(s,e){for(var t in e)ce(e,t)&&(s[t]=e[t]);return ce(e,"toString")&&(s.toString=e.toString),ce(e,"valueOf")&&(s.valueOf=e.valueOf),s}function gt(s,e,t,r){return Za(s,e,t,r,!0).utc()}function N0(){return{empty:!1,unusedTokens:[],unusedInput:[],overflow:-2,charsLeftOver:0,nullInput:!1,invalidEra:null,invalidMonth:null,invalidFormat:!1,userInvalidated:!1,iso:!1,parsedDateParts:[],era:null,meridiem:null,rfc2822:!1,weekdayMismatch:!1}}function X(s){return s._pf==null&&(s._pf=N0()),s._pf}var ki;Array.prototype.some?ki=Array.prototype.some:ki=function(s){var e=Object(this),t=e.length>>>0,r;for(r=0;r<t;r++)if(r in e&&s.call(this,e[r],r,e))return!0;return!1};function Ii(s){var e=null,t=!1,r=s._d&&!isNaN(s._d.getTime());if(r&&(e=X(s),t=ki.call(e.parsedDateParts,function(i){return i!=null}),r=e.overflow<0&&!e.empty&&!e.invalidEra&&!e.invalidMonth&&!e.invalidWeekday&&!e.weekdayMismatch&&!e.nullInput&&!e.invalidFormat&&!e.userInvalidated&&(!e.meridiem||e.meridiem&&t),s._strict&&(r=r&&e.charsLeftOver===0&&e.unusedTokens.length===0&&e.bigHour===void 0)),Object.isFrozen==null||!Object.isFrozen(s))s._isValid=r;else return r;return s._isValid}function cs(s){var e=gt(NaN);return s!=null?Ut(X(e),s):X(e).userInvalidated=!0,e}var Da=L.momentProperties=[],$i=!1;function Hi(s,e){var t,r,i,n=Da.length;if(Ye(e._isAMomentObject)||(s._isAMomentObject=e._isAMomentObject),Ye(e._i)||(s._i=e._i),Ye(e._f)||(s._f=e._f),Ye(e._l)||(s._l=e._l),Ye(e._strict)||(s._strict=e._strict),Ye(e._tzm)||(s._tzm=e._tzm),Ye(e._isUTC)||(s._isUTC=e._isUTC),Ye(e._offset)||(s._offset=e._offset),Ye(e._pf)||(s._pf=X(e)),Ye(e._locale)||(s._locale=e._locale),n>0)for(t=0;t<n;t++)r=Da[t],i=e[r],Ye(i)||(s[r]=i);return s}function Or(s){Hi(this,s),this._d=new Date(s._d!=null?s._d.getTime():NaN),this.isValid()||(this._d=new Date(NaN)),$i===!1&&($i=!0,L.updateOffset(this),$i=!1)}function nt(s){return s instanceof Or||s!=null&&s._isAMomentObject!=null}function ba(s){L.suppressDeprecationWarnings===!1&&typeof console<"u"&&console.warn&&console.warn("Deprecation warning: "+s)}function Xe(s,e){var t=!0;return Ut(function(){if(L.deprecationHandler!=null&&L.deprecationHandler(null,s),t){var r=[],i,n,a,o=arguments.length;for(n=0;n<o;n++){if(i="",typeof arguments[n]=="object"){i+=`
|
|
99
|
+
[`+n+"] ";for(a in arguments[0])ce(arguments[0],a)&&(i+=a+": "+arguments[0][a]+", ");i=i.slice(0,-2)}else i=arguments[n];r.push(i)}ba(s+`
|
|
100
|
+
Arguments: `+Array.prototype.slice.call(r).join("")+`
|
|
101
|
+
`+new Error().stack),t=!1}return e.apply(this,arguments)},e)}var Aa={};function Ta(s,e){L.deprecationHandler!=null&&L.deprecationHandler(s,e),Aa[s]||(ba(e),Aa[s]=!0)}L.suppressDeprecationWarnings=!1,L.deprecationHandler=null;function xt(s){return typeof Function<"u"&&s instanceof Function||Object.prototype.toString.call(s)==="[object Function]"}function q0(s){var e,t;for(t in s)ce(s,t)&&(e=s[t],xt(e)?this[t]=e:this["_"+t]=e);this._config=s,this._dayOfMonthOrdinalParseLenient=new RegExp((this._dayOfMonthOrdinalParse.source||this._ordinalParse.source)+"|"+/\d{1,2}/.source)}function Pi(s,e){var t=Ut({},s),r;for(r in e)ce(e,r)&&(ir(s[r])&&ir(e[r])?(t[r]={},Ut(t[r],s[r]),Ut(t[r],e[r])):e[r]!=null?t[r]=e[r]:delete t[r]);for(r in s)ce(s,r)&&!ce(e,r)&&ir(s[r])&&(t[r]=Ut({},t[r]));return t}function Oi(s){s!=null&&this.set(s)}var Mi;Object.keys?Mi=Object.keys:Mi=function(s){var e,t=[];for(e in s)ce(s,e)&&t.push(e);return t};var U0={sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[Last] dddd [at] LT",sameElse:"L"};function L0(s,e,t){var r=this._calendar[s]||this._calendar.sameElse;return xt(r)?r.call(e,t):r}function pt(s,e,t){var r=""+Math.abs(s),i=e-r.length,n=s>=0;return(n?t?"+":"":"-")+Math.pow(10,Math.max(0,i)).toString().substr(1)+r}var Ni=/(\[[^\[]*\])|(\\)?([Hh]mm(ss)?|Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Qo?|N{1,5}|YYYYYY|YYYYY|YYYY|YY|y{2,4}|yo?|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|kk?|mm?|ss?|S{1,9}|x|X|zz?|ZZ?|.)/g,ds=/(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g,qi={},pr={};function G(s,e,t,r){var i=r;typeof r=="string"&&(i=function(){return this[r]()}),s&&(pr[s]=i),e&&(pr[e[0]]=function(){return pt(i.apply(this,arguments),e[1],e[2])}),t&&(pr[t]=function(){return this.localeData().ordinal(i.apply(this,arguments),s)})}function j0(s){return s.match(/\[[\s\S]/)?s.replace(/^\[|\]$/g,""):s.replace(/\\/g,"")}function Y0(s){var e=s.match(Ni),t,r;for(t=0,r=e.length;t<r;t++)pr[e[t]]?e[t]=pr[e[t]]:e[t]=j0(e[t]);return function(i){var n="",a;for(a=0;a<r;a++)n+=xt(e[a])?e[a].call(i,s):e[a];return n}}function ls(s,e){return s.isValid()?(e=Sa(e,s.localeData()),qi[e]=qi[e]||Y0(e),qi[e](s)):s.localeData().invalidDate()}function Sa(s,e){var t=5;function r(i){return e.longDateFormat(i)||i}for(ds.lastIndex=0;t>=0&&ds.test(s);)s=s.replace(ds,r),ds.lastIndex=0,t-=1;return s}var W0={LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"};function V0(s){var e=this._longDateFormat[s],t=this._longDateFormat[s.toUpperCase()];return e||!t?e:(this._longDateFormat[s]=t.match(Ni).map(function(r){return r==="MMMM"||r==="MM"||r==="DD"||r==="dddd"?r.slice(1):r}).join(""),this._longDateFormat[s])}var G0="Invalid date";function z0(){return this._invalidDate}var K0="%d",Z0=/\d{1,2}/;function J0(s){return this._ordinal.replace("%d",s)}var X0={future:"in %s",past:"%s ago",s:"a few seconds",ss:"%d seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",w:"a week",ww:"%d weeks",M:"a month",MM:"%d months",y:"a year",yy:"%d years"};function Q0(s,e,t,r){var i=this._relativeTime[t];return xt(i)?i(s,e,t,r):i.replace(/%d/i,s)}function ec(s,e){var t=this._relativeTime[s>0?"future":"past"];return xt(t)?t(e):t.replace(/%s/i,e)}var Ra={D:"date",dates:"date",date:"date",d:"day",days:"day",day:"day",e:"weekday",weekdays:"weekday",weekday:"weekday",E:"isoWeekday",isoweekdays:"isoWeekday",isoweekday:"isoWeekday",DDD:"dayOfYear",dayofyears:"dayOfYear",dayofyear:"dayOfYear",h:"hour",hours:"hour",hour:"hour",ms:"millisecond",milliseconds:"millisecond",millisecond:"millisecond",m:"minute",minutes:"minute",minute:"minute",M:"month",months:"month",month:"month",Q:"quarter",quarters:"quarter",quarter:"quarter",s:"second",seconds:"second",second:"second",gg:"weekYear",weekyears:"weekYear",weekyear:"weekYear",GG:"isoWeekYear",isoweekyears:"isoWeekYear",isoweekyear:"isoWeekYear",w:"week",weeks:"week",week:"week",W:"isoWeek",isoweeks:"isoWeek",isoweek:"isoWeek",y:"year",years:"year",year:"year"};function Qe(s){return typeof s=="string"?Ra[s]||Ra[s.toLowerCase()]:void 0}function Ui(s){var e={},t,r;for(r in s)ce(s,r)&&(t=Qe(r),t&&(e[t]=s[r]));return e}var tc={date:9,day:11,weekday:11,isoWeekday:11,dayOfYear:4,hour:13,millisecond:16,minute:14,month:8,quarter:7,second:15,weekYear:1,isoWeekYear:1,week:5,isoWeek:5,year:1};function rc(s){var e=[],t;for(t in s)ce(s,t)&&e.push({unit:t,priority:tc[t]});return e.sort(function(r,i){return r.priority-i.priority}),e}var Fa=/\d/,ze=/\d\d/,Ba=/\d{3}/,Li=/\d{4}/,hs=/[+-]?\d{6}/,ve=/\d\d?/,ka=/\d\d\d\d?/,Ia=/\d\d\d\d\d\d?/,us=/\d{1,3}/,ji=/\d{1,4}/,fs=/[+-]?\d{1,6}/,mr=/\d+/,gs=/[+-]?\d+/,sc=/Z|[+-]\d\d:?\d\d/gi,xs=/Z|[+-]\d\d(?::?\d\d)?/gi,ic=/[+-]?\d+(\.\d{1,3})?/,Mr=/[0-9]{0,256}['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFF07\uFF10-\uFFEF]{1,256}|[\u0600-\u06FF\/]{1,256}(\s*?[\u0600-\u06FF]{1,256}){1,2}/i,vr=/^[1-9]\d?/,Yi=/^([1-9]\d|\d)/,ps;ps={};function W(s,e,t){ps[s]=xt(e)?e:function(r,i){return r&&t?t:e}}function nc(s,e){return ce(ps,s)?ps[s](e._strict,e._locale):new RegExp(ac(s))}function ac(s){return _t(s.replace("\\","").replace(/\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g,function(e,t,r,i,n){return t||r||i||n}))}function _t(s){return s.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")}function et(s){return s<0?Math.ceil(s)||0:Math.floor(s)}function ee(s){var e=+s,t=0;return e!==0&&isFinite(e)&&(t=et(e)),t}var Wi={};function xe(s,e){var t,r=e,i;for(typeof s=="string"&&(s=[s]),Ct(e)&&(r=function(n,a){a[e]=ee(n)}),i=s.length,t=0;t<i;t++)Wi[s[t]]=r}function Nr(s,e){xe(s,function(t,r,i,n){i._w=i._w||{},e(t,i._w,i,n)})}function oc(s,e,t){e!=null&&ce(Wi,s)&&Wi[s](e,t._a,t,s)}function ms(s){return s%4===0&&s%100!==0||s%400===0}var He=0,Dt=1,mt=2,Te=3,at=4,bt=5,nr=6,cc=7,dc=8;G("Y",0,0,function(){var s=this.year();return s<=9999?pt(s,4):"+"+s}),G(0,["YY",2],0,function(){return this.year()%100}),G(0,["YYYY",4],0,"year"),G(0,["YYYYY",5],0,"year"),G(0,["YYYYYY",6,!0],0,"year"),W("Y",gs),W("YY",ve,ze),W("YYYY",ji,Li),W("YYYYY",fs,hs),W("YYYYYY",fs,hs),xe(["YYYYY","YYYYYY"],He),xe("YYYY",function(s,e){e[He]=s.length===2?L.parseTwoDigitYear(s):ee(s)}),xe("YY",function(s,e){e[He]=L.parseTwoDigitYear(s)}),xe("Y",function(s,e){e[He]=parseInt(s,10)});function qr(s){return ms(s)?366:365}L.parseTwoDigitYear=function(s){return ee(s)+(ee(s)>68?1900:2e3)};var $a=Er("FullYear",!0);function lc(){return ms(this.year())}function Er(s,e){return function(t){return t!=null?(Ha(this,s,t),L.updateOffset(this,e),this):Ur(this,s)}}function Ur(s,e){if(!s.isValid())return NaN;var t=s._d,r=s._isUTC;switch(e){case"Milliseconds":return r?t.getUTCMilliseconds():t.getMilliseconds();case"Seconds":return r?t.getUTCSeconds():t.getSeconds();case"Minutes":return r?t.getUTCMinutes():t.getMinutes();case"Hours":return r?t.getUTCHours():t.getHours();case"Date":return r?t.getUTCDate():t.getDate();case"Day":return r?t.getUTCDay():t.getDay();case"Month":return r?t.getUTCMonth():t.getMonth();case"FullYear":return r?t.getUTCFullYear():t.getFullYear();default:return NaN}}function Ha(s,e,t){var r,i,n,a,o;if(!(!s.isValid()||isNaN(t))){switch(r=s._d,i=s._isUTC,e){case"Milliseconds":return void(i?r.setUTCMilliseconds(t):r.setMilliseconds(t));case"Seconds":return void(i?r.setUTCSeconds(t):r.setSeconds(t));case"Minutes":return void(i?r.setUTCMinutes(t):r.setMinutes(t));case"Hours":return void(i?r.setUTCHours(t):r.setHours(t));case"Date":return void(i?r.setUTCDate(t):r.setDate(t));case"FullYear":break;default:return}n=t,a=s.month(),o=s.date(),o=o===29&&a===1&&!ms(n)?28:o,i?r.setUTCFullYear(n,a,o):r.setFullYear(n,a,o)}}function hc(s){return s=Qe(s),xt(this[s])?this[s]():this}function uc(s,e){if(typeof s=="object"){s=Ui(s);var t=rc(s),r,i=t.length;for(r=0;r<i;r++)this[t[r].unit](s[t[r].unit])}else if(s=Qe(s),xt(this[s]))return this[s](e);return this}function fc(s,e){return(s%e+e)%e}var Ce;Array.prototype.indexOf?Ce=Array.prototype.indexOf:Ce=function(s){var e;for(e=0;e<this.length;++e)if(this[e]===s)return e;return-1};function Vi(s,e){if(isNaN(s)||isNaN(e))return NaN;var t=fc(e,12);return s+=(e-t)/12,t===1?ms(s)?29:28:31-t%7%2}G("M",["MM",2],"Mo",function(){return this.month()+1}),G("MMM",0,0,function(s){return this.localeData().monthsShort(this,s)}),G("MMMM",0,0,function(s){return this.localeData().months(this,s)}),W("M",ve,vr),W("MM",ve,ze),W("MMM",function(s,e){return e.monthsShortRegex(s)}),W("MMMM",function(s,e){return e.monthsRegex(s)}),xe(["M","MM"],function(s,e){e[Dt]=ee(s)-1}),xe(["MMM","MMMM"],function(s,e,t,r){var i=t._locale.monthsParse(s,r,t._strict);i!=null?e[Dt]=i:X(t).invalidMonth=s});var gc="January_February_March_April_May_June_July_August_September_October_November_December".split("_"),Pa="Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_"),Oa=/D[oD]?(\[[^\[\]]*\]|\s)+MMMM?/,xc=Mr,pc=Mr;function mc(s,e){return s?it(this._months)?this._months[s.month()]:this._months[(this._months.isFormat||Oa).test(e)?"format":"standalone"][s.month()]:it(this._months)?this._months:this._months.standalone}function vc(s,e){return s?it(this._monthsShort)?this._monthsShort[s.month()]:this._monthsShort[Oa.test(e)?"format":"standalone"][s.month()]:it(this._monthsShort)?this._monthsShort:this._monthsShort.standalone}function Ec(s,e,t){var r,i,n,a=s.toLocaleLowerCase();if(!this._monthsParse)for(this._monthsParse=[],this._longMonthsParse=[],this._shortMonthsParse=[],r=0;r<12;++r)n=gt([2e3,r]),this._shortMonthsParse[r]=this.monthsShort(n,"").toLocaleLowerCase(),this._longMonthsParse[r]=this.months(n,"").toLocaleLowerCase();return t?e==="MMM"?(i=Ce.call(this._shortMonthsParse,a),i!==-1?i:null):(i=Ce.call(this._longMonthsParse,a),i!==-1?i:null):e==="MMM"?(i=Ce.call(this._shortMonthsParse,a),i!==-1?i:(i=Ce.call(this._longMonthsParse,a),i!==-1?i:null)):(i=Ce.call(this._longMonthsParse,a),i!==-1?i:(i=Ce.call(this._shortMonthsParse,a),i!==-1?i:null))}function yc(s,e,t){var r,i,n;if(this._monthsParseExact)return Ec.call(this,s,e,t);for(this._monthsParse||(this._monthsParse=[],this._longMonthsParse=[],this._shortMonthsParse=[]),r=0;r<12;r++){if(i=gt([2e3,r]),t&&!this._longMonthsParse[r]&&(this._longMonthsParse[r]=new RegExp("^"+this.months(i,"").replace(".","")+"$","i"),this._shortMonthsParse[r]=new RegExp("^"+this.monthsShort(i,"").replace(".","")+"$","i")),!t&&!this._monthsParse[r]&&(n="^"+this.months(i,"")+"|^"+this.monthsShort(i,""),this._monthsParse[r]=new RegExp(n.replace(".",""),"i")),t&&e==="MMMM"&&this._longMonthsParse[r].test(s))return r;if(t&&e==="MMM"&&this._shortMonthsParse[r].test(s))return r;if(!t&&this._monthsParse[r].test(s))return r}}function Ma(s,e){if(!s.isValid())return s;if(typeof e=="string"){if(/^\d+$/.test(e))e=ee(e);else if(e=s.localeData().monthsParse(e),!Ct(e))return s}var t=e,r=s.date();return r=r<29?r:Math.min(r,Vi(s.year(),t)),s._isUTC?s._d.setUTCMonth(t,r):s._d.setMonth(t,r),s}function Na(s){return s!=null?(Ma(this,s),L.updateOffset(this,!0),this):Ur(this,"Month")}function wc(){return Vi(this.year(),this.month())}function Cc(s){return this._monthsParseExact?(ce(this,"_monthsRegex")||qa.call(this),s?this._monthsShortStrictRegex:this._monthsShortRegex):(ce(this,"_monthsShortRegex")||(this._monthsShortRegex=xc),this._monthsShortStrictRegex&&s?this._monthsShortStrictRegex:this._monthsShortRegex)}function _c(s){return this._monthsParseExact?(ce(this,"_monthsRegex")||qa.call(this),s?this._monthsStrictRegex:this._monthsRegex):(ce(this,"_monthsRegex")||(this._monthsRegex=pc),this._monthsStrictRegex&&s?this._monthsStrictRegex:this._monthsRegex)}function qa(){function s(d,c){return c.length-d.length}var e=[],t=[],r=[],i,n,a,o;for(i=0;i<12;i++)n=gt([2e3,i]),a=_t(this.monthsShort(n,"")),o=_t(this.months(n,"")),e.push(a),t.push(o),r.push(o),r.push(a);e.sort(s),t.sort(s),r.sort(s),this._monthsRegex=new RegExp("^("+r.join("|")+")","i"),this._monthsShortRegex=this._monthsRegex,this._monthsStrictRegex=new RegExp("^("+t.join("|")+")","i"),this._monthsShortStrictRegex=new RegExp("^("+e.join("|")+")","i")}function Dc(s,e,t,r,i,n,a){var o;return s<100&&s>=0?(o=new Date(s+400,e,t,r,i,n,a),isFinite(o.getFullYear())&&o.setFullYear(s)):o=new Date(s,e,t,r,i,n,a),o}function Lr(s){var e,t;return s<100&&s>=0?(t=Array.prototype.slice.call(arguments),t[0]=s+400,e=new Date(Date.UTC.apply(null,t)),isFinite(e.getUTCFullYear())&&e.setUTCFullYear(s)):e=new Date(Date.UTC.apply(null,arguments)),e}function vs(s,e,t){var r=7+e-t,i=(7+Lr(s,0,r).getUTCDay()-e)%7;return-i+r-1}function Ua(s,e,t,r,i){var n=(7+t-r)%7,a=vs(s,r,i),o=1+7*(e-1)+n+a,d,c;return o<=0?(d=s-1,c=qr(d)+o):o>qr(s)?(d=s+1,c=o-qr(s)):(d=s,c=o),{year:d,dayOfYear:c}}function jr(s,e,t){var r=vs(s.year(),e,t),i=Math.floor((s.dayOfYear()-r-1)/7)+1,n,a;return i<1?(a=s.year()-1,n=i+At(a,e,t)):i>At(s.year(),e,t)?(n=i-At(s.year(),e,t),a=s.year()+1):(a=s.year(),n=i),{week:n,year:a}}function At(s,e,t){var r=vs(s,e,t),i=vs(s+1,e,t);return(qr(s)-r+i)/7}G("w",["ww",2],"wo","week"),G("W",["WW",2],"Wo","isoWeek"),W("w",ve,vr),W("ww",ve,ze),W("W",ve,vr),W("WW",ve,ze),Nr(["w","ww","W","WW"],function(s,e,t,r){e[r.substr(0,1)]=ee(s)});function bc(s){return jr(s,this._week.dow,this._week.doy).week}var Ac={dow:0,doy:6};function Tc(){return this._week.dow}function Sc(){return this._week.doy}function Rc(s){var e=this.localeData().week(this);return s==null?e:this.add((s-e)*7,"d")}function Fc(s){var e=jr(this,1,4).week;return s==null?e:this.add((s-e)*7,"d")}G("d",0,"do","day"),G("dd",0,0,function(s){return this.localeData().weekdaysMin(this,s)}),G("ddd",0,0,function(s){return this.localeData().weekdaysShort(this,s)}),G("dddd",0,0,function(s){return this.localeData().weekdays(this,s)}),G("e",0,0,"weekday"),G("E",0,0,"isoWeekday"),W("d",ve),W("e",ve),W("E",ve),W("dd",function(s,e){return e.weekdaysMinRegex(s)}),W("ddd",function(s,e){return e.weekdaysShortRegex(s)}),W("dddd",function(s,e){return e.weekdaysRegex(s)}),Nr(["dd","ddd","dddd"],function(s,e,t,r){var i=t._locale.weekdaysParse(s,r,t._strict);i!=null?e.d=i:X(t).invalidWeekday=s}),Nr(["d","e","E"],function(s,e,t,r){e[r]=ee(s)});function Bc(s,e){return typeof s!="string"?s:isNaN(s)?(s=e.weekdaysParse(s),typeof s=="number"?s:null):parseInt(s,10)}function kc(s,e){return typeof s=="string"?e.weekdaysParse(s)%7||7:isNaN(s)?null:s}function Gi(s,e){return s.slice(e,7).concat(s.slice(0,e))}var Ic="Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),La="Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),$c="Su_Mo_Tu_We_Th_Fr_Sa".split("_"),Hc=Mr,Pc=Mr,Oc=Mr;function Mc(s,e){var t=it(this._weekdays)?this._weekdays:this._weekdays[s&&s!==!0&&this._weekdays.isFormat.test(e)?"format":"standalone"];return s===!0?Gi(t,this._week.dow):s?t[s.day()]:t}function Nc(s){return s===!0?Gi(this._weekdaysShort,this._week.dow):s?this._weekdaysShort[s.day()]:this._weekdaysShort}function qc(s){return s===!0?Gi(this._weekdaysMin,this._week.dow):s?this._weekdaysMin[s.day()]:this._weekdaysMin}function Uc(s,e,t){var r,i,n,a=s.toLocaleLowerCase();if(!this._weekdaysParse)for(this._weekdaysParse=[],this._shortWeekdaysParse=[],this._minWeekdaysParse=[],r=0;r<7;++r)n=gt([2e3,1]).day(r),this._minWeekdaysParse[r]=this.weekdaysMin(n,"").toLocaleLowerCase(),this._shortWeekdaysParse[r]=this.weekdaysShort(n,"").toLocaleLowerCase(),this._weekdaysParse[r]=this.weekdays(n,"").toLocaleLowerCase();return t?e==="dddd"?(i=Ce.call(this._weekdaysParse,a),i!==-1?i:null):e==="ddd"?(i=Ce.call(this._shortWeekdaysParse,a),i!==-1?i:null):(i=Ce.call(this._minWeekdaysParse,a),i!==-1?i:null):e==="dddd"?(i=Ce.call(this._weekdaysParse,a),i!==-1||(i=Ce.call(this._shortWeekdaysParse,a),i!==-1)?i:(i=Ce.call(this._minWeekdaysParse,a),i!==-1?i:null)):e==="ddd"?(i=Ce.call(this._shortWeekdaysParse,a),i!==-1||(i=Ce.call(this._weekdaysParse,a),i!==-1)?i:(i=Ce.call(this._minWeekdaysParse,a),i!==-1?i:null)):(i=Ce.call(this._minWeekdaysParse,a),i!==-1||(i=Ce.call(this._weekdaysParse,a),i!==-1)?i:(i=Ce.call(this._shortWeekdaysParse,a),i!==-1?i:null))}function Lc(s,e,t){var r,i,n;if(this._weekdaysParseExact)return Uc.call(this,s,e,t);for(this._weekdaysParse||(this._weekdaysParse=[],this._minWeekdaysParse=[],this._shortWeekdaysParse=[],this._fullWeekdaysParse=[]),r=0;r<7;r++){if(i=gt([2e3,1]).day(r),t&&!this._fullWeekdaysParse[r]&&(this._fullWeekdaysParse[r]=new RegExp("^"+this.weekdays(i,"").replace(".","\\.?")+"$","i"),this._shortWeekdaysParse[r]=new RegExp("^"+this.weekdaysShort(i,"").replace(".","\\.?")+"$","i"),this._minWeekdaysParse[r]=new RegExp("^"+this.weekdaysMin(i,"").replace(".","\\.?")+"$","i")),this._weekdaysParse[r]||(n="^"+this.weekdays(i,"")+"|^"+this.weekdaysShort(i,"")+"|^"+this.weekdaysMin(i,""),this._weekdaysParse[r]=new RegExp(n.replace(".",""),"i")),t&&e==="dddd"&&this._fullWeekdaysParse[r].test(s))return r;if(t&&e==="ddd"&&this._shortWeekdaysParse[r].test(s))return r;if(t&&e==="dd"&&this._minWeekdaysParse[r].test(s))return r;if(!t&&this._weekdaysParse[r].test(s))return r}}function jc(s){if(!this.isValid())return s!=null?this:NaN;var e=Ur(this,"Day");return s!=null?(s=Bc(s,this.localeData()),this.add(s-e,"d")):e}function Yc(s){if(!this.isValid())return s!=null?this:NaN;var e=(this.day()+7-this.localeData()._week.dow)%7;return s==null?e:this.add(s-e,"d")}function Wc(s){if(!this.isValid())return s!=null?this:NaN;if(s!=null){var e=kc(s,this.localeData());return this.day(this.day()%7?e:e-7)}else return this.day()||7}function Vc(s){return this._weekdaysParseExact?(ce(this,"_weekdaysRegex")||zi.call(this),s?this._weekdaysStrictRegex:this._weekdaysRegex):(ce(this,"_weekdaysRegex")||(this._weekdaysRegex=Hc),this._weekdaysStrictRegex&&s?this._weekdaysStrictRegex:this._weekdaysRegex)}function Gc(s){return this._weekdaysParseExact?(ce(this,"_weekdaysRegex")||zi.call(this),s?this._weekdaysShortStrictRegex:this._weekdaysShortRegex):(ce(this,"_weekdaysShortRegex")||(this._weekdaysShortRegex=Pc),this._weekdaysShortStrictRegex&&s?this._weekdaysShortStrictRegex:this._weekdaysShortRegex)}function zc(s){return this._weekdaysParseExact?(ce(this,"_weekdaysRegex")||zi.call(this),s?this._weekdaysMinStrictRegex:this._weekdaysMinRegex):(ce(this,"_weekdaysMinRegex")||(this._weekdaysMinRegex=Oc),this._weekdaysMinStrictRegex&&s?this._weekdaysMinStrictRegex:this._weekdaysMinRegex)}function zi(){function s(l,g){return g.length-l.length}var e=[],t=[],r=[],i=[],n,a,o,d,c;for(n=0;n<7;n++)a=gt([2e3,1]).day(n),o=_t(this.weekdaysMin(a,"")),d=_t(this.weekdaysShort(a,"")),c=_t(this.weekdays(a,"")),e.push(o),t.push(d),r.push(c),i.push(o),i.push(d),i.push(c);e.sort(s),t.sort(s),r.sort(s),i.sort(s),this._weekdaysRegex=new RegExp("^("+i.join("|")+")","i"),this._weekdaysShortRegex=this._weekdaysRegex,this._weekdaysMinRegex=this._weekdaysRegex,this._weekdaysStrictRegex=new RegExp("^("+r.join("|")+")","i"),this._weekdaysShortStrictRegex=new RegExp("^("+t.join("|")+")","i"),this._weekdaysMinStrictRegex=new RegExp("^("+e.join("|")+")","i")}function Ki(){return this.hours()%12||12}function Kc(){return this.hours()||24}G("H",["HH",2],0,"hour"),G("h",["hh",2],0,Ki),G("k",["kk",2],0,Kc),G("hmm",0,0,function(){return""+Ki.apply(this)+pt(this.minutes(),2)}),G("hmmss",0,0,function(){return""+Ki.apply(this)+pt(this.minutes(),2)+pt(this.seconds(),2)}),G("Hmm",0,0,function(){return""+this.hours()+pt(this.minutes(),2)}),G("Hmmss",0,0,function(){return""+this.hours()+pt(this.minutes(),2)+pt(this.seconds(),2)});function ja(s,e){G(s,0,0,function(){return this.localeData().meridiem(this.hours(),this.minutes(),e)})}ja("a",!0),ja("A",!1);function Ya(s,e){return e._meridiemParse}W("a",Ya),W("A",Ya),W("H",ve,Yi),W("h",ve,vr),W("k",ve,vr),W("HH",ve,ze),W("hh",ve,ze),W("kk",ve,ze),W("hmm",ka),W("hmmss",Ia),W("Hmm",ka),W("Hmmss",Ia),xe(["H","HH"],Te),xe(["k","kk"],function(s,e,t){var r=ee(s);e[Te]=r===24?0:r}),xe(["a","A"],function(s,e,t){t._isPm=t._locale.isPM(s),t._meridiem=s}),xe(["h","hh"],function(s,e,t){e[Te]=ee(s),X(t).bigHour=!0}),xe("hmm",function(s,e,t){var r=s.length-2;e[Te]=ee(s.substr(0,r)),e[at]=ee(s.substr(r)),X(t).bigHour=!0}),xe("hmmss",function(s,e,t){var r=s.length-4,i=s.length-2;e[Te]=ee(s.substr(0,r)),e[at]=ee(s.substr(r,2)),e[bt]=ee(s.substr(i)),X(t).bigHour=!0}),xe("Hmm",function(s,e,t){var r=s.length-2;e[Te]=ee(s.substr(0,r)),e[at]=ee(s.substr(r))}),xe("Hmmss",function(s,e,t){var r=s.length-4,i=s.length-2;e[Te]=ee(s.substr(0,r)),e[at]=ee(s.substr(r,2)),e[bt]=ee(s.substr(i))});function Zc(s){return(s+"").toLowerCase().charAt(0)==="p"}var Jc=/[ap]\.?m?\.?/i,Xc=Er("Hours",!0);function Qc(s,e,t){return s>11?t?"pm":"PM":t?"am":"AM"}var Wa={calendar:U0,longDateFormat:W0,invalidDate:G0,ordinal:K0,dayOfMonthOrdinalParse:Z0,relativeTime:X0,months:gc,monthsShort:Pa,week:Ac,weekdays:Ic,weekdaysMin:$c,weekdaysShort:La,meridiemParse:Jc},ye={},Yr={},Wr;function ed(s,e){var t,r=Math.min(s.length,e.length);for(t=0;t<r;t+=1)if(s[t]!==e[t])return t;return r}function Va(s){return s&&s.toLowerCase().replace("_","-")}function td(s){for(var e=0,t,r,i,n;e<s.length;){for(n=Va(s[e]).split("-"),t=n.length,r=Va(s[e+1]),r=r?r.split("-"):null;t>0;){if(i=Es(n.slice(0,t).join("-")),i)return i;if(r&&r.length>=t&&ed(n,r)>=t-1)break;t--}e++}return Wr}function rd(s){return!!(s&&s.match("^[^/\\\\]*$"))}function Es(s){var e=null,t;if(ye[s]===void 0&&typeof module<"u"&&module&&module.exports&&rd(s))try{e=Wr._abbr,t=require,t("./locale/"+s),Lt(e)}catch{ye[s]=null}return ye[s]}function Lt(s,e){var t;return s&&(Ye(e)?t=Tt(s):t=Zi(s,e),t?Wr=t:typeof console<"u"&&console.warn&&console.warn("Locale "+s+" not found. Did you forget to load it?")),Wr._abbr}function Zi(s,e){if(e!==null){var t,r=Wa;if(e.abbr=s,ye[s]!=null)Ta("defineLocaleOverride","use moment.updateLocale(localeName, config) to change an existing locale. moment.defineLocale(localeName, config) should only be used for creating a new locale See http://momentjs.com/guides/#/warnings/define-locale/ for more info."),r=ye[s]._config;else if(e.parentLocale!=null)if(ye[e.parentLocale]!=null)r=ye[e.parentLocale]._config;else if(t=Es(e.parentLocale),t!=null)r=t._config;else return Yr[e.parentLocale]||(Yr[e.parentLocale]=[]),Yr[e.parentLocale].push({name:s,config:e}),null;return ye[s]=new Oi(Pi(r,e)),Yr[s]&&Yr[s].forEach(function(i){Zi(i.name,i.config)}),Lt(s),ye[s]}else return delete ye[s],null}function sd(s,e){if(e!=null){var t,r,i=Wa;ye[s]!=null&&ye[s].parentLocale!=null?ye[s].set(Pi(ye[s]._config,e)):(r=Es(s),r!=null&&(i=r._config),e=Pi(i,e),r==null&&(e.abbr=s),t=new Oi(e),t.parentLocale=ye[s],ye[s]=t),Lt(s)}else ye[s]!=null&&(ye[s].parentLocale!=null?(ye[s]=ye[s].parentLocale,s===Lt()&&Lt(s)):ye[s]!=null&&delete ye[s]);return ye[s]}function Tt(s){var e;if(s&&s._locale&&s._locale._abbr&&(s=s._locale._abbr),!s)return Wr;if(!it(s)){if(e=Es(s),e)return e;s=[s]}return td(s)}function id(){return Mi(ye)}function Ji(s){var e,t=s._a;return t&&X(s).overflow===-2&&(e=t[Dt]<0||t[Dt]>11?Dt:t[mt]<1||t[mt]>Vi(t[He],t[Dt])?mt:t[Te]<0||t[Te]>24||t[Te]===24&&(t[at]!==0||t[bt]!==0||t[nr]!==0)?Te:t[at]<0||t[at]>59?at:t[bt]<0||t[bt]>59?bt:t[nr]<0||t[nr]>999?nr:-1,X(s)._overflowDayOfYear&&(e<He||e>mt)&&(e=mt),X(s)._overflowWeeks&&e===-1&&(e=cc),X(s)._overflowWeekday&&e===-1&&(e=dc),X(s).overflow=e),s}var nd=/^\s*((?:[+-]\d{6}|\d{4})-(?:\d\d-\d\d|W\d\d-\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?::\d\d(?::\d\d(?:[.,]\d+)?)?)?)([+-]\d\d(?::?\d\d)?|\s*Z)?)?$/,ad=/^\s*((?:[+-]\d{6}|\d{4})(?:\d\d\d\d|W\d\d\d|W\d\d|\d\d\d|\d\d|))(?:(T| )(\d\d(?:\d\d(?:\d\d(?:[.,]\d+)?)?)?)([+-]\d\d(?::?\d\d)?|\s*Z)?)?$/,od=/Z|[+-]\d\d(?::?\d\d)?/,ys=[["YYYYYY-MM-DD",/[+-]\d{6}-\d\d-\d\d/],["YYYY-MM-DD",/\d{4}-\d\d-\d\d/],["GGGG-[W]WW-E",/\d{4}-W\d\d-\d/],["GGGG-[W]WW",/\d{4}-W\d\d/,!1],["YYYY-DDD",/\d{4}-\d{3}/],["YYYY-MM",/\d{4}-\d\d/,!1],["YYYYYYMMDD",/[+-]\d{10}/],["YYYYMMDD",/\d{8}/],["GGGG[W]WWE",/\d{4}W\d{3}/],["GGGG[W]WW",/\d{4}W\d{2}/,!1],["YYYYDDD",/\d{7}/],["YYYYMM",/\d{6}/,!1],["YYYY",/\d{4}/,!1]],Xi=[["HH:mm:ss.SSSS",/\d\d:\d\d:\d\d\.\d+/],["HH:mm:ss,SSSS",/\d\d:\d\d:\d\d,\d+/],["HH:mm:ss",/\d\d:\d\d:\d\d/],["HH:mm",/\d\d:\d\d/],["HHmmss.SSSS",/\d\d\d\d\d\d\.\d+/],["HHmmss,SSSS",/\d\d\d\d\d\d,\d+/],["HHmmss",/\d\d\d\d\d\d/],["HHmm",/\d\d\d\d/],["HH",/\d\d/]],cd=/^\/?Date\((-?\d+)/i,dd=/^(?:(Mon|Tue|Wed|Thu|Fri|Sat|Sun),?\s)?(\d{1,2})\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s(\d{2,4})\s(\d\d):(\d\d)(?::(\d\d))?\s(?:(UT|GMT|[ECMP][SD]T)|([Zz])|([+-]\d{4}))$/,ld={UT:0,GMT:0,EDT:-4*60,EST:-5*60,CDT:-5*60,CST:-6*60,MDT:-6*60,MST:-7*60,PDT:-7*60,PST:-8*60};function Ga(s){var e,t,r=s._i,i=nd.exec(r)||ad.exec(r),n,a,o,d,c=ys.length,l=Xi.length;if(i){for(X(s).iso=!0,e=0,t=c;e<t;e++)if(ys[e][1].exec(i[1])){a=ys[e][0],n=ys[e][2]!==!1;break}if(a==null){s._isValid=!1;return}if(i[3]){for(e=0,t=l;e<t;e++)if(Xi[e][1].exec(i[3])){o=(i[2]||" ")+Xi[e][0];break}if(o==null){s._isValid=!1;return}}if(!n&&o!=null){s._isValid=!1;return}if(i[4])if(od.exec(i[4]))d="Z";else{s._isValid=!1;return}s._f=a+(o||"")+(d||""),en(s)}else s._isValid=!1}function hd(s,e,t,r,i,n){var a=[ud(s),Pa.indexOf(e),parseInt(t,10),parseInt(r,10),parseInt(i,10)];return n&&a.push(parseInt(n,10)),a}function ud(s){var e=parseInt(s,10);return e<=49?2e3+e:e<=999?1900+e:e}function fd(s){return s.replace(/\([^()]*\)|[\n\t]/g," ").replace(/(\s\s+)/g," ").replace(/^\s\s*/,"").replace(/\s\s*$/,"")}function gd(s,e,t){if(s){var r=La.indexOf(s),i=new Date(e[0],e[1],e[2]).getDay();if(r!==i)return X(t).weekdayMismatch=!0,t._isValid=!1,!1}return!0}function xd(s,e,t){if(s)return ld[s];if(e)return 0;var r=parseInt(t,10),i=r%100,n=(r-i)/100;return n*60+i}function za(s){var e=dd.exec(fd(s._i)),t;if(e){if(t=hd(e[4],e[3],e[2],e[5],e[6],e[7]),!gd(e[1],t,s))return;s._a=t,s._tzm=xd(e[8],e[9],e[10]),s._d=Lr.apply(null,s._a),s._d.setUTCMinutes(s._d.getUTCMinutes()-s._tzm),X(s).rfc2822=!0}else s._isValid=!1}function pd(s){var e=cd.exec(s._i);if(e!==null){s._d=new Date(+e[1]);return}if(Ga(s),s._isValid===!1)delete s._isValid;else return;if(za(s),s._isValid===!1)delete s._isValid;else return;s._strict?s._isValid=!1:L.createFromInputFallback(s)}L.createFromInputFallback=Xe("value provided is not in a recognized RFC2822 or ISO format. moment construction falls back to js Date(), which is not reliable across all browsers and versions. Non RFC2822/ISO date formats are discouraged. Please refer to http://momentjs.com/guides/#/warnings/js-date/ for more info.",function(s){s._d=new Date(s._i+(s._useUTC?" UTC":""))});function yr(s,e,t){return s??e??t}function md(s){var e=new Date(L.now());return s._useUTC?[e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate()]:[e.getFullYear(),e.getMonth(),e.getDate()]}function Qi(s){var e,t,r=[],i,n,a;if(!s._d){for(i=md(s),s._w&&s._a[mt]==null&&s._a[Dt]==null&&vd(s),s._dayOfYear!=null&&(a=yr(s._a[He],i[He]),(s._dayOfYear>qr(a)||s._dayOfYear===0)&&(X(s)._overflowDayOfYear=!0),t=Lr(a,0,s._dayOfYear),s._a[Dt]=t.getUTCMonth(),s._a[mt]=t.getUTCDate()),e=0;e<3&&s._a[e]==null;++e)s._a[e]=r[e]=i[e];for(;e<7;e++)s._a[e]=r[e]=s._a[e]==null?e===2?1:0:s._a[e];s._a[Te]===24&&s._a[at]===0&&s._a[bt]===0&&s._a[nr]===0&&(s._nextDay=!0,s._a[Te]=0),s._d=(s._useUTC?Lr:Dc).apply(null,r),n=s._useUTC?s._d.getUTCDay():s._d.getDay(),s._tzm!=null&&s._d.setUTCMinutes(s._d.getUTCMinutes()-s._tzm),s._nextDay&&(s._a[Te]=24),s._w&&typeof s._w.d<"u"&&s._w.d!==n&&(X(s).weekdayMismatch=!0)}}function vd(s){var e,t,r,i,n,a,o,d,c;e=s._w,e.GG!=null||e.W!=null||e.E!=null?(n=1,a=4,t=yr(e.GG,s._a[He],jr(Ee(),1,4).year),r=yr(e.W,1),i=yr(e.E,1),(i<1||i>7)&&(d=!0)):(n=s._locale._week.dow,a=s._locale._week.doy,c=jr(Ee(),n,a),t=yr(e.gg,s._a[He],c.year),r=yr(e.w,c.week),e.d!=null?(i=e.d,(i<0||i>6)&&(d=!0)):e.e!=null?(i=e.e+n,(e.e<0||e.e>6)&&(d=!0)):i=n),r<1||r>At(t,n,a)?X(s)._overflowWeeks=!0:d!=null?X(s)._overflowWeekday=!0:(o=Ua(t,r,i,n,a),s._a[He]=o.year,s._dayOfYear=o.dayOfYear)}L.ISO_8601=function(){},L.RFC_2822=function(){};function en(s){if(s._f===L.ISO_8601){Ga(s);return}if(s._f===L.RFC_2822){za(s);return}s._a=[],X(s).empty=!0;var e=""+s._i,t,r,i,n,a,o=e.length,d=0,c,l;for(i=Sa(s._f,s._locale).match(Ni)||[],l=i.length,t=0;t<l;t++)n=i[t],r=(e.match(nc(n,s))||[])[0],r&&(a=e.substr(0,e.indexOf(r)),a.length>0&&X(s).unusedInput.push(a),e=e.slice(e.indexOf(r)+r.length),d+=r.length),pr[n]?(r?X(s).empty=!1:X(s).unusedTokens.push(n),oc(n,r,s)):s._strict&&!r&&X(s).unusedTokens.push(n);X(s).charsLeftOver=o-d,e.length>0&&X(s).unusedInput.push(e),s._a[Te]<=12&&X(s).bigHour===!0&&s._a[Te]>0&&(X(s).bigHour=void 0),X(s).parsedDateParts=s._a.slice(0),X(s).meridiem=s._meridiem,s._a[Te]=Ed(s._locale,s._a[Te],s._meridiem),c=X(s).era,c!==null&&(s._a[He]=s._locale.erasConvertYear(c,s._a[He])),Qi(s),Ji(s)}function Ed(s,e,t){var r;return t==null?e:s.meridiemHour!=null?s.meridiemHour(e,t):(s.isPM!=null&&(r=s.isPM(t),r&&e<12&&(e+=12),!r&&e===12&&(e=0)),e)}function yd(s){var e,t,r,i,n,a,o=!1,d=s._f.length;if(d===0){X(s).invalidFormat=!0,s._d=new Date(NaN);return}for(i=0;i<d;i++)n=0,a=!1,e=Hi({},s),s._useUTC!=null&&(e._useUTC=s._useUTC),e._f=s._f[i],en(e),Ii(e)&&(a=!0),n+=X(e).charsLeftOver,n+=X(e).unusedTokens.length*10,X(e).score=n,o?n<r&&(r=n,t=e):(r==null||n<r||a)&&(r=n,t=e,a&&(o=!0));Ut(s,t||e)}function wd(s){if(!s._d){var e=Ui(s._i),t=e.day===void 0?e.date:e.day;s._a=_a([e.year,e.month,t,e.hour,e.minute,e.second,e.millisecond],function(r){return r&&parseInt(r,10)}),Qi(s)}}function Cd(s){var e=new Or(Ji(Ka(s)));return e._nextDay&&(e.add(1,"d"),e._nextDay=void 0),e}function Ka(s){var e=s._i,t=s._f;return s._locale=s._locale||Tt(s._l),e===null||t===void 0&&e===""?cs({nullInput:!0}):(typeof e=="string"&&(s._i=e=s._locale.preparse(e)),nt(e)?new Or(Ji(e)):(Pr(e)?s._d=e:it(t)?yd(s):t?en(s):_d(s),Ii(s)||(s._d=null),s))}function _d(s){var e=s._i;Ye(e)?s._d=new Date(L.now()):Pr(e)?s._d=new Date(e.valueOf()):typeof e=="string"?pd(s):it(e)?(s._a=_a(e.slice(0),function(t){return parseInt(t,10)}),Qi(s)):ir(e)?wd(s):Ct(e)?s._d=new Date(e):L.createFromInputFallback(s)}function Za(s,e,t,r,i){var n={};return(e===!0||e===!1)&&(r=e,e=void 0),(t===!0||t===!1)&&(r=t,t=void 0),(ir(s)&&Bi(s)||it(s)&&s.length===0)&&(s=void 0),n._isAMomentObject=!0,n._useUTC=n._isUTC=i,n._l=t,n._i=s,n._f=e,n._strict=r,Cd(n)}function Ee(s,e,t,r){return Za(s,e,t,r,!1)}var Dd=Xe("moment().min is deprecated, use moment.max instead. http://momentjs.com/guides/#/warnings/min-max/",function(){var s=Ee.apply(null,arguments);return this.isValid()&&s.isValid()?s<this?this:s:cs()}),bd=Xe("moment().max is deprecated, use moment.min instead. http://momentjs.com/guides/#/warnings/min-max/",function(){var s=Ee.apply(null,arguments);return this.isValid()&&s.isValid()?s>this?this:s:cs()});function Ja(s,e){var t,r;if(e.length===1&&it(e[0])&&(e=e[0]),!e.length)return Ee();for(t=e[0],r=1;r<e.length;++r)(!e[r].isValid()||e[r][s](t))&&(t=e[r]);return t}function Ad(){var s=[].slice.call(arguments,0);return Ja("isBefore",s)}function Td(){var s=[].slice.call(arguments,0);return Ja("isAfter",s)}var Sd=function(){return Date.now?Date.now():+new Date},Vr=["year","quarter","month","week","day","hour","minute","second","millisecond"];function Rd(s){var e,t=!1,r,i=Vr.length;for(e in s)if(ce(s,e)&&!(Ce.call(Vr,e)!==-1&&(s[e]==null||!isNaN(s[e]))))return!1;for(r=0;r<i;++r)if(s[Vr[r]]){if(t)return!1;parseFloat(s[Vr[r]])!==ee(s[Vr[r]])&&(t=!0)}return!0}function Fd(){return this._isValid}function Bd(){return ot(NaN)}function ws(s){var e=Ui(s),t=e.year||0,r=e.quarter||0,i=e.month||0,n=e.week||e.isoWeek||0,a=e.day||0,o=e.hour||0,d=e.minute||0,c=e.second||0,l=e.millisecond||0;this._isValid=Rd(e),this._milliseconds=+l+c*1e3+d*6e4+o*1e3*60*60,this._days=+a+n*7,this._months=+i+r*3+t*12,this._data={},this._locale=Tt(),this._bubble()}function Cs(s){return s instanceof ws}function tn(s){return s<0?Math.round(-1*s)*-1:Math.round(s)}function kd(s,e,t){var r=Math.min(s.length,e.length),i=Math.abs(s.length-e.length),n=0,a;for(a=0;a<r;a++)ee(s[a])!==ee(e[a])&&n++;return n+i}function Xa(s,e){G(s,0,0,function(){var t=this.utcOffset(),r="+";return t<0&&(t=-t,r="-"),r+pt(~~(t/60),2)+e+pt(~~t%60,2)})}Xa("Z",":"),Xa("ZZ",""),W("Z",xs),W("ZZ",xs),xe(["Z","ZZ"],function(s,e,t){t._useUTC=!0,t._tzm=rn(xs,s)});var Id=/([\+\-]|\d\d)/gi;function rn(s,e){var t=(e||"").match(s),r,i,n;return t===null?null:(r=t[t.length-1]||[],i=(r+"").match(Id)||["-",0,0],n=+(i[1]*60)+ee(i[2]),n===0?0:i[0]==="+"?n:-n)}function sn(s,e){var t,r;return e._isUTC?(t=e.clone(),r=(nt(s)||Pr(s)?s.valueOf():Ee(s).valueOf())-t.valueOf(),t._d.setTime(t._d.valueOf()+r),L.updateOffset(t,!1),t):Ee(s).local()}function nn(s){return-Math.round(s._d.getTimezoneOffset())}L.updateOffset=function(){};function $d(s,e,t){var r=this._offset||0,i;if(!this.isValid())return s!=null?this:NaN;if(s!=null){if(typeof s=="string"){if(s=rn(xs,s),s===null)return this}else Math.abs(s)<16&&!t&&(s=s*60);return!this._isUTC&&e&&(i=nn(this)),this._offset=s,this._isUTC=!0,i!=null&&this.add(i,"m"),r!==s&&(!e||this._changeInProgress?ro(this,ot(s-r,"m"),1,!1):this._changeInProgress||(this._changeInProgress=!0,L.updateOffset(this,!0),this._changeInProgress=null)),this}else return this._isUTC?r:nn(this)}function Hd(s,e){return s!=null?(typeof s!="string"&&(s=-s),this.utcOffset(s,e),this):-this.utcOffset()}function Pd(s){return this.utcOffset(0,s)}function Od(s){return this._isUTC&&(this.utcOffset(0,s),this._isUTC=!1,s&&this.subtract(nn(this),"m")),this}function Md(){if(this._tzm!=null)this.utcOffset(this._tzm,!1,!0);else if(typeof this._i=="string"){var s=rn(sc,this._i);s!=null?this.utcOffset(s):this.utcOffset(0,!0)}return this}function Nd(s){return this.isValid()?(s=s?Ee(s).utcOffset():0,(this.utcOffset()-s)%60===0):!1}function qd(){return this.utcOffset()>this.clone().month(0).utcOffset()||this.utcOffset()>this.clone().month(5).utcOffset()}function Ud(){if(!Ye(this._isDSTShifted))return this._isDSTShifted;var s={},e;return Hi(s,this),s=Ka(s),s._a?(e=s._isUTC?gt(s._a):Ee(s._a),this._isDSTShifted=this.isValid()&&kd(s._a,e.toArray())>0):this._isDSTShifted=!1,this._isDSTShifted}function Ld(){return this.isValid()?!this._isUTC:!1}function jd(){return this.isValid()?this._isUTC:!1}function Qa(){return this.isValid()?this._isUTC&&this._offset===0:!1}var Yd=/^(-|\+)?(?:(\d*)[. ])?(\d+):(\d+)(?::(\d+)(\.\d*)?)?$/,Wd=/^(-|\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/;function ot(s,e){var t=s,r=null,i,n,a;return Cs(s)?t={ms:s._milliseconds,d:s._days,M:s._months}:Ct(s)||!isNaN(+s)?(t={},e?t[e]=+s:t.milliseconds=+s):(r=Yd.exec(s))?(i=r[1]==="-"?-1:1,t={y:0,d:ee(r[mt])*i,h:ee(r[Te])*i,m:ee(r[at])*i,s:ee(r[bt])*i,ms:ee(tn(r[nr]*1e3))*i}):(r=Wd.exec(s))?(i=r[1]==="-"?-1:1,t={y:ar(r[2],i),M:ar(r[3],i),w:ar(r[4],i),d:ar(r[5],i),h:ar(r[6],i),m:ar(r[7],i),s:ar(r[8],i)}):t==null?t={}:typeof t=="object"&&("from"in t||"to"in t)&&(a=Vd(Ee(t.from),Ee(t.to)),t={},t.ms=a.milliseconds,t.M=a.months),n=new ws(t),Cs(s)&&ce(s,"_locale")&&(n._locale=s._locale),Cs(s)&&ce(s,"_isValid")&&(n._isValid=s._isValid),n}ot.fn=ws.prototype,ot.invalid=Bd;function ar(s,e){var t=s&&parseFloat(s.replace(",","."));return(isNaN(t)?0:t)*e}function eo(s,e){var t={};return t.months=e.month()-s.month()+(e.year()-s.year())*12,s.clone().add(t.months,"M").isAfter(e)&&--t.months,t.milliseconds=+e-+s.clone().add(t.months,"M"),t}function Vd(s,e){var t;return s.isValid()&&e.isValid()?(e=sn(e,s),s.isBefore(e)?t=eo(s,e):(t=eo(e,s),t.milliseconds=-t.milliseconds,t.months=-t.months),t):{milliseconds:0,months:0}}function to(s,e){return function(t,r){var i,n;return r!==null&&!isNaN(+r)&&(Ta(e,"moment()."+e+"(period, number) is deprecated. Please use moment()."+e+"(number, period). See http://momentjs.com/guides/#/warnings/add-inverted-param/ for more info."),n=t,t=r,r=n),i=ot(t,r),ro(this,i,s),this}}function ro(s,e,t,r){var i=e._milliseconds,n=tn(e._days),a=tn(e._months);s.isValid()&&(r=r??!0,a&&Ma(s,Ur(s,"Month")+a*t),n&&Ha(s,"Date",Ur(s,"Date")+n*t),i&&s._d.setTime(s._d.valueOf()+i*t),r&&L.updateOffset(s,n||a))}var Gd=to(1,"add"),zd=to(-1,"subtract");function so(s){return typeof s=="string"||s instanceof String}function Kd(s){return nt(s)||Pr(s)||so(s)||Ct(s)||Jd(s)||Zd(s)||s===null||s===void 0}function Zd(s){var e=ir(s)&&!Bi(s),t=!1,r=["years","year","y","months","month","M","days","day","d","dates","date","D","hours","hour","h","minutes","minute","m","seconds","second","s","milliseconds","millisecond","ms"],i,n,a=r.length;for(i=0;i<a;i+=1)n=r[i],t=t||ce(s,n);return e&&t}function Jd(s){var e=it(s),t=!1;return e&&(t=s.filter(function(r){return!Ct(r)&&so(s)}).length===0),e&&t}function Xd(s){var e=ir(s)&&!Bi(s),t=!1,r=["sameDay","nextDay","lastDay","nextWeek","lastWeek","sameElse"],i,n;for(i=0;i<r.length;i+=1)n=r[i],t=t||ce(s,n);return e&&t}function Qd(s,e){var t=s.diff(e,"days",!0);return t<-6?"sameElse":t<-1?"lastWeek":t<0?"lastDay":t<1?"sameDay":t<2?"nextDay":t<7?"nextWeek":"sameElse"}function el(s,e){arguments.length===1&&(arguments[0]?Kd(arguments[0])?(s=arguments[0],e=void 0):Xd(arguments[0])&&(e=arguments[0],s=void 0):(s=void 0,e=void 0));var t=s||Ee(),r=sn(t,this).startOf("day"),i=L.calendarFormat(this,r)||"sameElse",n=e&&(xt(e[i])?e[i].call(this,t):e[i]);return this.format(n||this.localeData().calendar(i,this,Ee(t)))}function tl(){return new Or(this)}function rl(s,e){var t=nt(s)?s:Ee(s);return this.isValid()&&t.isValid()?(e=Qe(e)||"millisecond",e==="millisecond"?this.valueOf()>t.valueOf():t.valueOf()<this.clone().startOf(e).valueOf()):!1}function sl(s,e){var t=nt(s)?s:Ee(s);return this.isValid()&&t.isValid()?(e=Qe(e)||"millisecond",e==="millisecond"?this.valueOf()<t.valueOf():this.clone().endOf(e).valueOf()<t.valueOf()):!1}function il(s,e,t,r){var i=nt(s)?s:Ee(s),n=nt(e)?e:Ee(e);return this.isValid()&&i.isValid()&&n.isValid()?(r=r||"()",(r[0]==="("?this.isAfter(i,t):!this.isBefore(i,t))&&(r[1]===")"?this.isBefore(n,t):!this.isAfter(n,t))):!1}function nl(s,e){var t=nt(s)?s:Ee(s),r;return this.isValid()&&t.isValid()?(e=Qe(e)||"millisecond",e==="millisecond"?this.valueOf()===t.valueOf():(r=t.valueOf(),this.clone().startOf(e).valueOf()<=r&&r<=this.clone().endOf(e).valueOf())):!1}function al(s,e){return this.isSame(s,e)||this.isAfter(s,e)}function ol(s,e){return this.isSame(s,e)||this.isBefore(s,e)}function cl(s,e,t){var r,i,n;if(!this.isValid())return NaN;if(r=sn(s,this),!r.isValid())return NaN;switch(i=(r.utcOffset()-this.utcOffset())*6e4,e=Qe(e),e){case"year":n=_s(this,r)/12;break;case"month":n=_s(this,r);break;case"quarter":n=_s(this,r)/3;break;case"second":n=(this-r)/1e3;break;case"minute":n=(this-r)/6e4;break;case"hour":n=(this-r)/36e5;break;case"day":n=(this-r-i)/864e5;break;case"week":n=(this-r-i)/6048e5;break;default:n=this-r}return t?n:et(n)}function _s(s,e){if(s.date()<e.date())return-_s(e,s);var t=(e.year()-s.year())*12+(e.month()-s.month()),r=s.clone().add(t,"months"),i,n;return e-r<0?(i=s.clone().add(t-1,"months"),n=(e-r)/(r-i)):(i=s.clone().add(t+1,"months"),n=(e-r)/(i-r)),-(t+n)||0}L.defaultFormat="YYYY-MM-DDTHH:mm:ssZ",L.defaultFormatUtc="YYYY-MM-DDTHH:mm:ss[Z]";function dl(){return this.clone().locale("en").format("ddd MMM DD YYYY HH:mm:ss [GMT]ZZ")}function ll(s){if(!this.isValid())return null;var e=s!==!0,t=e?this.clone().utc():this;return t.year()<0||t.year()>9999?ls(t,e?"YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]":"YYYYYY-MM-DD[T]HH:mm:ss.SSSZ"):xt(Date.prototype.toISOString)?e?this.toDate().toISOString():new Date(this.valueOf()+this.utcOffset()*60*1e3).toISOString().replace("Z",ls(t,"Z")):ls(t,e?"YYYY-MM-DD[T]HH:mm:ss.SSS[Z]":"YYYY-MM-DD[T]HH:mm:ss.SSSZ")}function hl(){if(!this.isValid())return"moment.invalid(/* "+this._i+" */)";var s="moment",e="",t,r,i,n;return this.isLocal()||(s=this.utcOffset()===0?"moment.utc":"moment.parseZone",e="Z"),t="["+s+'("]',r=0<=this.year()&&this.year()<=9999?"YYYY":"YYYYYY",i="-MM-DD[T]HH:mm:ss.SSS",n=e+'[")]',this.format(t+r+i+n)}function ul(s){s||(s=this.isUtc()?L.defaultFormatUtc:L.defaultFormat);var e=ls(this,s);return this.localeData().postformat(e)}function fl(s,e){return this.isValid()&&(nt(s)&&s.isValid()||Ee(s).isValid())?ot({to:this,from:s}).locale(this.locale()).humanize(!e):this.localeData().invalidDate()}function gl(s){return this.from(Ee(),s)}function xl(s,e){return this.isValid()&&(nt(s)&&s.isValid()||Ee(s).isValid())?ot({from:this,to:s}).locale(this.locale()).humanize(!e):this.localeData().invalidDate()}function pl(s){return this.to(Ee(),s)}function io(s){var e;return s===void 0?this._locale._abbr:(e=Tt(s),e!=null&&(this._locale=e),this)}var no=Xe("moment().lang() is deprecated. Instead, use moment().localeData() to get the language configuration. Use moment().locale() to change languages.",function(s){return s===void 0?this.localeData():this.locale(s)});function ao(){return this._locale}var Ds=1e3,wr=60*Ds,bs=60*wr,oo=(365*400+97)*24*bs;function Cr(s,e){return(s%e+e)%e}function co(s,e,t){return s<100&&s>=0?new Date(s+400,e,t)-oo:new Date(s,e,t).valueOf()}function lo(s,e,t){return s<100&&s>=0?Date.UTC(s+400,e,t)-oo:Date.UTC(s,e,t)}function ml(s){var e,t;if(s=Qe(s),s===void 0||s==="millisecond"||!this.isValid())return this;switch(t=this._isUTC?lo:co,s){case"year":e=t(this.year(),0,1);break;case"quarter":e=t(this.year(),this.month()-this.month()%3,1);break;case"month":e=t(this.year(),this.month(),1);break;case"week":e=t(this.year(),this.month(),this.date()-this.weekday());break;case"isoWeek":e=t(this.year(),this.month(),this.date()-(this.isoWeekday()-1));break;case"day":case"date":e=t(this.year(),this.month(),this.date());break;case"hour":e=this._d.valueOf(),e-=Cr(e+(this._isUTC?0:this.utcOffset()*wr),bs);break;case"minute":e=this._d.valueOf(),e-=Cr(e,wr);break;case"second":e=this._d.valueOf(),e-=Cr(e,Ds);break}return this._d.setTime(e),L.updateOffset(this,!0),this}function vl(s){var e,t;if(s=Qe(s),s===void 0||s==="millisecond"||!this.isValid())return this;switch(t=this._isUTC?lo:co,s){case"year":e=t(this.year()+1,0,1)-1;break;case"quarter":e=t(this.year(),this.month()-this.month()%3+3,1)-1;break;case"month":e=t(this.year(),this.month()+1,1)-1;break;case"week":e=t(this.year(),this.month(),this.date()-this.weekday()+7)-1;break;case"isoWeek":e=t(this.year(),this.month(),this.date()-(this.isoWeekday()-1)+7)-1;break;case"day":case"date":e=t(this.year(),this.month(),this.date()+1)-1;break;case"hour":e=this._d.valueOf(),e+=bs-Cr(e+(this._isUTC?0:this.utcOffset()*wr),bs)-1;break;case"minute":e=this._d.valueOf(),e+=wr-Cr(e,wr)-1;break;case"second":e=this._d.valueOf(),e+=Ds-Cr(e,Ds)-1;break}return this._d.setTime(e),L.updateOffset(this,!0),this}function El(){return this._d.valueOf()-(this._offset||0)*6e4}function yl(){return Math.floor(this.valueOf()/1e3)}function wl(){return new Date(this.valueOf())}function Cl(){var s=this;return[s.year(),s.month(),s.date(),s.hour(),s.minute(),s.second(),s.millisecond()]}function _l(){var s=this;return{years:s.year(),months:s.month(),date:s.date(),hours:s.hours(),minutes:s.minutes(),seconds:s.seconds(),milliseconds:s.milliseconds()}}function Dl(){return this.isValid()?this.toISOString():null}function bl(){return Ii(this)}function Al(){return Ut({},X(this))}function Tl(){return X(this).overflow}function Sl(){return{input:this._i,format:this._f,locale:this._locale,isUTC:this._isUTC,strict:this._strict}}G("N",0,0,"eraAbbr"),G("NN",0,0,"eraAbbr"),G("NNN",0,0,"eraAbbr"),G("NNNN",0,0,"eraName"),G("NNNNN",0,0,"eraNarrow"),G("y",["y",1],"yo","eraYear"),G("y",["yy",2],0,"eraYear"),G("y",["yyy",3],0,"eraYear"),G("y",["yyyy",4],0,"eraYear"),W("N",an),W("NN",an),W("NNN",an),W("NNNN",Nl),W("NNNNN",ql),xe(["N","NN","NNN","NNNN","NNNNN"],function(s,e,t,r){var i=t._locale.erasParse(s,r,t._strict);i?X(t).era=i:X(t).invalidEra=s}),W("y",mr),W("yy",mr),W("yyy",mr),W("yyyy",mr),W("yo",Ul),xe(["y","yy","yyy","yyyy"],He),xe(["yo"],function(s,e,t,r){var i;t._locale._eraYearOrdinalRegex&&(i=s.match(t._locale._eraYearOrdinalRegex)),t._locale.eraYearOrdinalParse?e[He]=t._locale.eraYearOrdinalParse(s,i):e[He]=parseInt(s,10)});function Rl(s,e){var t,r,i,n=this._eras||Tt("en")._eras;for(t=0,r=n.length;t<r;++t){switch(typeof n[t].since){case"string":i=L(n[t].since).startOf("day"),n[t].since=i.valueOf();break}switch(typeof n[t].until){case"undefined":n[t].until=1/0;break;case"string":i=L(n[t].until).startOf("day").valueOf(),n[t].until=i.valueOf();break}}return n}function Fl(s,e,t){var r,i,n=this.eras(),a,o,d;for(s=s.toUpperCase(),r=0,i=n.length;r<i;++r)if(a=n[r].name.toUpperCase(),o=n[r].abbr.toUpperCase(),d=n[r].narrow.toUpperCase(),t)switch(e){case"N":case"NN":case"NNN":if(o===s)return n[r];break;case"NNNN":if(a===s)return n[r];break;case"NNNNN":if(d===s)return n[r];break}else if([a,o,d].indexOf(s)>=0)return n[r]}function Bl(s,e){var t=s.since<=s.until?1:-1;return e===void 0?L(s.since).year():L(s.since).year()+(e-s.offset)*t}function kl(){var s,e,t,r=this.localeData().eras();for(s=0,e=r.length;s<e;++s)if(t=this.clone().startOf("day").valueOf(),r[s].since<=t&&t<=r[s].until||r[s].until<=t&&t<=r[s].since)return r[s].name;return""}function Il(){var s,e,t,r=this.localeData().eras();for(s=0,e=r.length;s<e;++s)if(t=this.clone().startOf("day").valueOf(),r[s].since<=t&&t<=r[s].until||r[s].until<=t&&t<=r[s].since)return r[s].narrow;return""}function $l(){var s,e,t,r=this.localeData().eras();for(s=0,e=r.length;s<e;++s)if(t=this.clone().startOf("day").valueOf(),r[s].since<=t&&t<=r[s].until||r[s].until<=t&&t<=r[s].since)return r[s].abbr;return""}function Hl(){var s,e,t,r,i=this.localeData().eras();for(s=0,e=i.length;s<e;++s)if(t=i[s].since<=i[s].until?1:-1,r=this.clone().startOf("day").valueOf(),i[s].since<=r&&r<=i[s].until||i[s].until<=r&&r<=i[s].since)return(this.year()-L(i[s].since).year())*t+i[s].offset;return this.year()}function Pl(s){return ce(this,"_erasNameRegex")||on.call(this),s?this._erasNameRegex:this._erasRegex}function Ol(s){return ce(this,"_erasAbbrRegex")||on.call(this),s?this._erasAbbrRegex:this._erasRegex}function Ml(s){return ce(this,"_erasNarrowRegex")||on.call(this),s?this._erasNarrowRegex:this._erasRegex}function an(s,e){return e.erasAbbrRegex(s)}function Nl(s,e){return e.erasNameRegex(s)}function ql(s,e){return e.erasNarrowRegex(s)}function Ul(s,e){return e._eraYearOrdinalRegex||mr}function on(){var s=[],e=[],t=[],r=[],i,n,a,o,d,c=this.eras();for(i=0,n=c.length;i<n;++i)a=_t(c[i].name),o=_t(c[i].abbr),d=_t(c[i].narrow),e.push(a),s.push(o),t.push(d),r.push(a),r.push(o),r.push(d);this._erasRegex=new RegExp("^("+r.join("|")+")","i"),this._erasNameRegex=new RegExp("^("+e.join("|")+")","i"),this._erasAbbrRegex=new RegExp("^("+s.join("|")+")","i"),this._erasNarrowRegex=new RegExp("^("+t.join("|")+")","i")}G(0,["gg",2],0,function(){return this.weekYear()%100}),G(0,["GG",2],0,function(){return this.isoWeekYear()%100});function As(s,e){G(0,[s,s.length],0,e)}As("gggg","weekYear"),As("ggggg","weekYear"),As("GGGG","isoWeekYear"),As("GGGGG","isoWeekYear"),W("G",gs),W("g",gs),W("GG",ve,ze),W("gg",ve,ze),W("GGGG",ji,Li),W("gggg",ji,Li),W("GGGGG",fs,hs),W("ggggg",fs,hs),Nr(["gggg","ggggg","GGGG","GGGGG"],function(s,e,t,r){e[r.substr(0,2)]=ee(s)}),Nr(["gg","GG"],function(s,e,t,r){e[r]=L.parseTwoDigitYear(s)});function Ll(s){return ho.call(this,s,this.week(),this.weekday()+this.localeData()._week.dow,this.localeData()._week.dow,this.localeData()._week.doy)}function jl(s){return ho.call(this,s,this.isoWeek(),this.isoWeekday(),1,4)}function Yl(){return At(this.year(),1,4)}function Wl(){return At(this.isoWeekYear(),1,4)}function Vl(){var s=this.localeData()._week;return At(this.year(),s.dow,s.doy)}function Gl(){var s=this.localeData()._week;return At(this.weekYear(),s.dow,s.doy)}function ho(s,e,t,r,i){var n;return s==null?jr(this,r,i).year:(n=At(s,r,i),e>n&&(e=n),zl.call(this,s,e,t,r,i))}function zl(s,e,t,r,i){var n=Ua(s,e,t,r,i),a=Lr(n.year,0,n.dayOfYear);return this.year(a.getUTCFullYear()),this.month(a.getUTCMonth()),this.date(a.getUTCDate()),this}G("Q",0,"Qo","quarter"),W("Q",Fa),xe("Q",function(s,e){e[Dt]=(ee(s)-1)*3});function Kl(s){return s==null?Math.ceil((this.month()+1)/3):this.month((s-1)*3+this.month()%3)}G("D",["DD",2],"Do","date"),W("D",ve,vr),W("DD",ve,ze),W("Do",function(s,e){return s?e._dayOfMonthOrdinalParse||e._ordinalParse:e._dayOfMonthOrdinalParseLenient}),xe(["D","DD"],mt),xe("Do",function(s,e){e[mt]=ee(s.match(ve)[0])});var uo=Er("Date",!0);G("DDD",["DDDD",3],"DDDo","dayOfYear"),W("DDD",us),W("DDDD",Ba),xe(["DDD","DDDD"],function(s,e,t){t._dayOfYear=ee(s)});function Zl(s){var e=Math.round((this.clone().startOf("day")-this.clone().startOf("year"))/864e5)+1;return s==null?e:this.add(s-e,"d")}G("m",["mm",2],0,"minute"),W("m",ve,Yi),W("mm",ve,ze),xe(["m","mm"],at);var Jl=Er("Minutes",!1);G("s",["ss",2],0,"second"),W("s",ve,Yi),W("ss",ve,ze),xe(["s","ss"],bt);var Xl=Er("Seconds",!1);G("S",0,0,function(){return~~(this.millisecond()/100)}),G(0,["SS",2],0,function(){return~~(this.millisecond()/10)}),G(0,["SSS",3],0,"millisecond"),G(0,["SSSS",4],0,function(){return this.millisecond()*10}),G(0,["SSSSS",5],0,function(){return this.millisecond()*100}),G(0,["SSSSSS",6],0,function(){return this.millisecond()*1e3}),G(0,["SSSSSSS",7],0,function(){return this.millisecond()*1e4}),G(0,["SSSSSSSS",8],0,function(){return this.millisecond()*1e5}),G(0,["SSSSSSSSS",9],0,function(){return this.millisecond()*1e6}),W("S",us,Fa),W("SS",us,ze),W("SSS",us,Ba);var jt,fo;for(jt="SSSS";jt.length<=9;jt+="S")W(jt,mr);function Ql(s,e){e[nr]=ee(("0."+s)*1e3)}for(jt="S";jt.length<=9;jt+="S")xe(jt,Ql);fo=Er("Milliseconds",!1),G("z",0,0,"zoneAbbr"),G("zz",0,0,"zoneName");function eh(){return this._isUTC?"UTC":""}function th(){return this._isUTC?"Coordinated Universal Time":""}var O=Or.prototype;O.add=Gd,O.calendar=el,O.clone=tl,O.diff=cl,O.endOf=vl,O.format=ul,O.from=fl,O.fromNow=gl,O.to=xl,O.toNow=pl,O.get=hc,O.invalidAt=Tl,O.isAfter=rl,O.isBefore=sl,O.isBetween=il,O.isSame=nl,O.isSameOrAfter=al,O.isSameOrBefore=ol,O.isValid=bl,O.lang=no,O.locale=io,O.localeData=ao,O.max=bd,O.min=Dd,O.parsingFlags=Al,O.set=uc,O.startOf=ml,O.subtract=zd,O.toArray=Cl,O.toObject=_l,O.toDate=wl,O.toISOString=ll,O.inspect=hl,typeof Symbol<"u"&&Symbol.for!=null&&(O[Symbol.for("nodejs.util.inspect.custom")]=function(){return"Moment<"+this.format()+">"}),O.toJSON=Dl,O.toString=dl,O.unix=yl,O.valueOf=El,O.creationData=Sl,O.eraName=kl,O.eraNarrow=Il,O.eraAbbr=$l,O.eraYear=Hl,O.year=$a,O.isLeapYear=lc,O.weekYear=Ll,O.isoWeekYear=jl,O.quarter=O.quarters=Kl,O.month=Na,O.daysInMonth=wc,O.week=O.weeks=Rc,O.isoWeek=O.isoWeeks=Fc,O.weeksInYear=Vl,O.weeksInWeekYear=Gl,O.isoWeeksInYear=Yl,O.isoWeeksInISOWeekYear=Wl,O.date=uo,O.day=O.days=jc,O.weekday=Yc,O.isoWeekday=Wc,O.dayOfYear=Zl,O.hour=O.hours=Xc,O.minute=O.minutes=Jl,O.second=O.seconds=Xl,O.millisecond=O.milliseconds=fo,O.utcOffset=$d,O.utc=Pd,O.local=Od,O.parseZone=Md,O.hasAlignedHourOffset=Nd,O.isDST=qd,O.isLocal=Ld,O.isUtcOffset=jd,O.isUtc=Qa,O.isUTC=Qa,O.zoneAbbr=eh,O.zoneName=th,O.dates=Xe("dates accessor is deprecated. Use date instead.",uo),O.months=Xe("months accessor is deprecated. Use month instead",Na),O.years=Xe("years accessor is deprecated. Use year instead",$a),O.zone=Xe("moment().zone is deprecated, use moment().utcOffset instead. http://momentjs.com/guides/#/warnings/zone/",Hd),O.isDSTShifted=Xe("isDSTShifted is deprecated. See http://momentjs.com/guides/#/warnings/dst-shifted/ for more information",Ud);function rh(s){return Ee(s*1e3)}function sh(){return Ee.apply(null,arguments).parseZone()}function go(s){return s}var de=Oi.prototype;de.calendar=L0,de.longDateFormat=V0,de.invalidDate=z0,de.ordinal=J0,de.preparse=go,de.postformat=go,de.relativeTime=Q0,de.pastFuture=ec,de.set=q0,de.eras=Rl,de.erasParse=Fl,de.erasConvertYear=Bl,de.erasAbbrRegex=Ol,de.erasNameRegex=Pl,de.erasNarrowRegex=Ml,de.months=mc,de.monthsShort=vc,de.monthsParse=yc,de.monthsRegex=_c,de.monthsShortRegex=Cc,de.week=bc,de.firstDayOfYear=Sc,de.firstDayOfWeek=Tc,de.weekdays=Mc,de.weekdaysMin=qc,de.weekdaysShort=Nc,de.weekdaysParse=Lc,de.weekdaysRegex=Vc,de.weekdaysShortRegex=Gc,de.weekdaysMinRegex=zc,de.isPM=Zc,de.meridiem=Qc;function Ts(s,e,t,r){var i=Tt(),n=gt().set(r,e);return i[t](n,s)}function xo(s,e,t){if(Ct(s)&&(e=s,s=void 0),s=s||"",e!=null)return Ts(s,e,t,"month");var r,i=[];for(r=0;r<12;r++)i[r]=Ts(s,r,t,"month");return i}function cn(s,e,t,r){typeof s=="boolean"?(Ct(e)&&(t=e,e=void 0),e=e||""):(e=s,t=e,s=!1,Ct(e)&&(t=e,e=void 0),e=e||"");var i=Tt(),n=s?i._week.dow:0,a,o=[];if(t!=null)return Ts(e,(t+n)%7,r,"day");for(a=0;a<7;a++)o[a]=Ts(e,(a+n)%7,r,"day");return o}function ih(s,e){return xo(s,e,"months")}function nh(s,e){return xo(s,e,"monthsShort")}function ah(s,e,t){return cn(s,e,t,"weekdays")}function oh(s,e,t){return cn(s,e,t,"weekdaysShort")}function ch(s,e,t){return cn(s,e,t,"weekdaysMin")}Lt("en",{eras:[{since:"0001-01-01",until:1/0,offset:1,name:"Anno Domini",narrow:"AD",abbr:"AD"},{since:"0000-12-31",until:-1/0,offset:1,name:"Before Christ",narrow:"BC",abbr:"BC"}],dayOfMonthOrdinalParse:/\d{1,2}(th|st|nd|rd)/,ordinal:function(s){var e=s%10,t=ee(s%100/10)===1?"th":e===1?"st":e===2?"nd":e===3?"rd":"th";return s+t}}),L.lang=Xe("moment.lang is deprecated. Use moment.locale instead.",Lt),L.langData=Xe("moment.langData is deprecated. Use moment.localeData instead.",Tt);var St=Math.abs;function dh(){var s=this._data;return this._milliseconds=St(this._milliseconds),this._days=St(this._days),this._months=St(this._months),s.milliseconds=St(s.milliseconds),s.seconds=St(s.seconds),s.minutes=St(s.minutes),s.hours=St(s.hours),s.months=St(s.months),s.years=St(s.years),this}function po(s,e,t,r){var i=ot(e,t);return s._milliseconds+=r*i._milliseconds,s._days+=r*i._days,s._months+=r*i._months,s._bubble()}function lh(s,e){return po(this,s,e,1)}function hh(s,e){return po(this,s,e,-1)}function mo(s){return s<0?Math.floor(s):Math.ceil(s)}function uh(){var s=this._milliseconds,e=this._days,t=this._months,r=this._data,i,n,a,o,d;return s>=0&&e>=0&&t>=0||s<=0&&e<=0&&t<=0||(s+=mo(dn(t)+e)*864e5,e=0,t=0),r.milliseconds=s%1e3,i=et(s/1e3),r.seconds=i%60,n=et(i/60),r.minutes=n%60,a=et(n/60),r.hours=a%24,e+=et(a/24),d=et(vo(e)),t+=d,e-=mo(dn(d)),o=et(t/12),t%=12,r.days=e,r.months=t,r.years=o,this}function vo(s){return s*4800/146097}function dn(s){return s*146097/4800}function fh(s){if(!this.isValid())return NaN;var e,t,r=this._milliseconds;if(s=Qe(s),s==="month"||s==="quarter"||s==="year")switch(e=this._days+r/864e5,t=this._months+vo(e),s){case"month":return t;case"quarter":return t/3;case"year":return t/12}else switch(e=this._days+Math.round(dn(this._months)),s){case"week":return e/7+r/6048e5;case"day":return e+r/864e5;case"hour":return e*24+r/36e5;case"minute":return e*1440+r/6e4;case"second":return e*86400+r/1e3;case"millisecond":return Math.floor(e*864e5)+r;default:throw new Error("Unknown unit "+s)}}function Rt(s){return function(){return this.as(s)}}var Eo=Rt("ms"),gh=Rt("s"),xh=Rt("m"),ph=Rt("h"),mh=Rt("d"),vh=Rt("w"),Eh=Rt("M"),yh=Rt("Q"),wh=Rt("y"),Ch=Eo;function _h(){return ot(this)}function Dh(s){return s=Qe(s),this.isValid()?this[s+"s"]():NaN}function or(s){return function(){return this.isValid()?this._data[s]:NaN}}var bh=or("milliseconds"),Ah=or("seconds"),Th=or("minutes"),Sh=or("hours"),Rh=or("days"),Fh=or("months"),Bh=or("years");function kh(){return et(this.days()/7)}var Ft=Math.round,_r={ss:44,s:45,m:45,h:22,d:26,w:null,M:11};function Ih(s,e,t,r,i){return i.relativeTime(e||1,!!t,s,r)}function $h(s,e,t,r){var i=ot(s).abs(),n=Ft(i.as("s")),a=Ft(i.as("m")),o=Ft(i.as("h")),d=Ft(i.as("d")),c=Ft(i.as("M")),l=Ft(i.as("w")),g=Ft(i.as("y")),u=n<=t.ss&&["s",n]||n<t.s&&["ss",n]||a<=1&&["m"]||a<t.m&&["mm",a]||o<=1&&["h"]||o<t.h&&["hh",o]||d<=1&&["d"]||d<t.d&&["dd",d];return t.w!=null&&(u=u||l<=1&&["w"]||l<t.w&&["ww",l]),u=u||c<=1&&["M"]||c<t.M&&["MM",c]||g<=1&&["y"]||["yy",g],u[2]=e,u[3]=+s>0,u[4]=r,Ih.apply(null,u)}function Hh(s){return s===void 0?Ft:typeof s=="function"?(Ft=s,!0):!1}function Ph(s,e){return _r[s]===void 0?!1:e===void 0?_r[s]:(_r[s]=e,s==="s"&&(_r.ss=e-1),!0)}function Oh(s,e){if(!this.isValid())return this.localeData().invalidDate();var t=!1,r=_r,i,n;return typeof s=="object"&&(e=s,s=!1),typeof s=="boolean"&&(t=s),typeof e=="object"&&(r=Object.assign({},_r,e),e.s!=null&&e.ss==null&&(r.ss=e.s-1)),i=this.localeData(),n=$h(this,!t,r,i),t&&(n=i.pastFuture(+this,n)),i.postformat(n)}var ln=Math.abs;function Dr(s){return(s>0)-(s<0)||+s}function Ss(){if(!this.isValid())return this.localeData().invalidDate();var s=ln(this._milliseconds)/1e3,e=ln(this._days),t=ln(this._months),r,i,n,a,o=this.asSeconds(),d,c,l,g;return o?(r=et(s/60),i=et(r/60),s%=60,r%=60,n=et(t/12),t%=12,a=s?s.toFixed(3).replace(/\.?0+$/,""):"",d=o<0?"-":"",c=Dr(this._months)!==Dr(o)?"-":"",l=Dr(this._days)!==Dr(o)?"-":"",g=Dr(this._milliseconds)!==Dr(o)?"-":"",d+"P"+(n?c+n+"Y":"")+(t?c+t+"M":"")+(e?l+e+"D":"")+(i||r||s?"T":"")+(i?g+i+"H":"")+(r?g+r+"M":"")+(s?g+a+"S":"")):"P0D"}var ne=ws.prototype;ne.isValid=Fd,ne.abs=dh,ne.add=lh,ne.subtract=hh,ne.as=fh,ne.asMilliseconds=Eo,ne.asSeconds=gh,ne.asMinutes=xh,ne.asHours=ph,ne.asDays=mh,ne.asWeeks=vh,ne.asMonths=Eh,ne.asQuarters=yh,ne.asYears=wh,ne.valueOf=Ch,ne._bubble=uh,ne.clone=_h,ne.get=Dh,ne.milliseconds=bh,ne.seconds=Ah,ne.minutes=Th,ne.hours=Sh,ne.days=Rh,ne.weeks=kh,ne.months=Fh,ne.years=Bh,ne.humanize=Oh,ne.toISOString=Ss,ne.toString=Ss,ne.toJSON=Ss,ne.locale=io,ne.localeData=ao,ne.toIsoString=Xe("toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)",Ss),ne.lang=no,G("X",0,0,"unix"),G("x",0,0,"valueOf"),W("x",gs),W("X",ic),xe("X",function(s,e,t){t._d=new Date(parseFloat(s)*1e3)}),xe("x",function(s,e,t){t._d=new Date(ee(s))});//! moment.js
|
|
102
|
+
L.version="2.30.1",M0(Ee),L.fn=O,L.min=Ad,L.max=Td,L.now=Sd,L.utc=gt,L.unix=rh,L.months=ih,L.isDate=Pr,L.locale=Lt,L.invalid=cs,L.duration=ot,L.isMoment=nt,L.weekdays=ah,L.parseZone=sh,L.localeData=Tt,L.isDuration=Cs,L.monthsShort=nh,L.weekdaysMin=ch,L.defineLocale=Zi,L.updateLocale=sd,L.locales=id,L.weekdaysShort=oh,L.normalizeUnits=Qe,L.relativeTimeRounding=Hh,L.relativeTimeThreshold=Ph,L.calendarFormat=Qd,L.prototype=O,L.HTML5_FMT={DATETIME_LOCAL:"YYYY-MM-DDTHH:mm",DATETIME_LOCAL_SECONDS:"YYYY-MM-DDTHH:mm:ss",DATETIME_LOCAL_MS:"YYYY-MM-DDTHH:mm:ss.SSS",DATE:"YYYY-MM-DD",TIME:"HH:mm",TIME_SECONDS:"HH:mm:ss",TIME_MS:"HH:mm:ss.SSS",WEEK:"GGGG-[W]WW",MONTH:"YYYY-MM"};let Rs=null,Se=null,yo=null;const Mh=()=>{se.on("incoming_call",()=>{sr.pushSound()}),se.on("local_dial",({number:s})=>{if(Rs){const e=Qt.makeURI(`sip:${s}@${Rs.configuration.uri.domain}`),t=new Sn(Rs,e);t.stateChange.addListener(r=>{r===B.Establishing?se.emitLocal("call_status","Calling..."):r===B.Established?(Se=t,se.emitLocal("call_status","InCall")):r===B.Terminated&&(se.emitLocal("call_status","Idle"),Se=null)}),t.invite()}}),se.on("local_hangup",()=>{sr.stopSound(),Se&&(Se.state===B.Established?Se.bye():typeof Se.reject=="function"?Se.reject():Se.cancel()),se.emitLocal("call_status","Idle"),se.emitLocal("call_duration","00:00"),se.emitToParent("sync_call_ended")}),se.on("local_answer",()=>{sr.stopSound(),Se&&Se.accept()}),se.on("local_toggle_mute",({muted:s})=>{}),se.on("local_toggle_hold",({hold:s})=>{Se&&typeof Se.hold=="function"&&(s?Se.hold():Se.unhold())}),se.on("local_dtmf",({key:s})=>{Se&&Se.sessionDescriptionHandler&&Se.sessionDescriptionHandler.sendDtmf(s)})},Nh=async s=>{var a,o;window.__sipjsEventsBound||(Mh(),window.__sipjsEventsBound=!0);const{auth:e}=s;if(!e)return;const t=e.user_pbx||e.username,r=e.pwd_pbx||e.secret,i=((o=(a=e.pabx_host)==null?void 0:a.replace("http://",""))==null?void 0:o.replace("https://",""))||e.pbxurl,n=e.port||8089;if(!(!t||!i))try{const d=Qt.makeURI(`sip:${t}@${i}`);if(!d)throw new Error("Failed to create SIP URI");const c=`wss://${i}:${n}`,l=new Qt({uri:d,transportOptions:{server:c},authorizationUsername:t,authorizationPassword:r,sessionDescriptionHandlerFactoryOptions:{peerConnectionConfiguration:{iceServers:[]},constraints:{audio:!0,video:!1}},logLevel:"warn"});Rs=l;const g=new ut(l);g.stateChange.addListener(u=>{u===le.Registered?se.emitLocal("register_status","REGISTERED"):(u===le.Unregistered||u===le.Terminated)&&se.emitLocal("register_status",{status:"FAILED",reason:"SIP Unregistered or Terminated"})}),l.delegate={onInvite(u){let y=!1;Se=u,se.emitLocal("sipjsSession",u),sr.pushSound(),sr.pushNotification(`New incoming call from ${u.remoteIdentity.uri.user}`),se.emitLocal("incoming_call",u),se.emitToParent("sync_incoming_call",u),u.stateChange.addListener(v=>{if(v===B.Established){y=!0,se.emitLocal("call_status","InCall"),se.emitToParent("sync_call_answered");const C=L();yo=setInterval(()=>{const _=L.duration(L().diff(C));se.emitLocal("call_duration",sr.toHHMMSS(_.asSeconds()))},1e3)}else v===B.Terminated&&(clearInterval(yo),sr.stopSound(),se.emitLocal("call_duration","00:00"),se.emitLocal("call_status","Idle"),y?se.emitToParent("sync_call_ended"):se.emitToParent("sync_call_unanswered"),Se=null)})}},await l.start(),await g.register()}catch(d){console.error("SipJS init error:",d),se.emitLocal("register_status",{status:"FAILED",reason:d.message||"Failed to connect to SIP server"})}},qh=({onSubmit:s})=>{const[e,t]=Ue.useState(""),[r,i]=Ue.useState(""),[n,a]=Ue.useState(""),o=d=>{d.preventDefault(),e&&r&&n&&s({username:e,password:r,host:n})};return Me.jsxs("div",{className:"w-full max-w-sm mx-auto p-6 bg-white/90 backdrop-blur-md rounded-2xl shadow-xl border border-gray-100",children:[Me.jsx("h2",{className:"text-2xl font-bold text-center text-primary mb-6",children:"Voice Login"}),Me.jsxs("form",{onSubmit:o,className:"space-y-4",children:[Me.jsxs("div",{children:[Me.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"SIP Username"}),Me.jsx("input",{type:"text",required:!0,className:"w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-primary focus:border-primary outline-none transition-all",placeholder:"e.g. 1001",value:e,onChange:d=>t(d.target.value)})]}),Me.jsxs("div",{children:[Me.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"SIP Password"}),Me.jsx("input",{type:"password",required:!0,className:"w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-primary focus:border-primary outline-none transition-all",placeholder:"••••••••",value:r,onChange:d=>i(d.target.value)})]}),Me.jsxs("div",{children:[Me.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"SIP Domain / Host"}),Me.jsx("input",{type:"text",required:!0,className:"w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-primary focus:border-primary outline-none transition-all",placeholder:"e.g. sip.example.com",value:n,onChange:d=>a(d.target.value)})]}),Me.jsx("button",{type:"submit",className:"w-full py-2.5 px-4 bg-primary hover:bg-primary-hover text-white font-semibold rounded-lg shadow-md transition-colors active:scale-95 mt-4",children:"Connect"})]})]})};function Uh({config:s,onIncomingCall:e,onCallAnswered:t,onCallEnded:r,onCallUnanswered:i,onRegisterStatus:n}){var y;const[a,o]=Ue.useState(!1),[d,c]=Ue.useState(s);Ue.useEffect(()=>{c(s)},[s]),Ue.useEffect(()=>{var C;const v=(d==null?void 0:d.auth)||((C=d==null?void 0:d.pabxConfig)==null?void 0:C.auth)||{};!a&&(v.username||v.user_pbx)&&(v.pwd_pbx||v.secret)&&(v.pabx_host||v.host)&&(Nh({auth:v}),o(!0))},[d,a]);const l=v=>{const C={...d,auth:{...d==null?void 0:d.auth,username:v.username,user_pbx:v.username,pwd_pbx:v.password,secret:v.password,pabx_host:v.host}};c(C)};Ue.useEffect(()=>{const v=se.on("sync_incoming_call",E=>e&&e(E)),C=se.on("sync_call_answered",E=>t&&t(E)),_=se.on("sync_call_ended",E=>r&&r(E)),x=se.on("sync_call_unanswered",E=>i&&i(E)),p=se.on("register_status",E=>{E==="REGISTERED"?n&&n("REGISTERED"):(E==null?void 0:E.status)==="FAILED"&&n&&n("FAILED")});return()=>{v(),C(),_(),x(),p()}},[e,t,r,i,n]);const g=(d==null?void 0:d.auth)||((y=d==null?void 0:d.pabxConfig)==null?void 0:y.auth)||{};return!!((g.username||g.user_pbx)&&(g.pwd_pbx||g.secret))||d!=null&&d.accessToken?null:Me.jsx("div",{className:"fixed inset-0 z-[9999] bg-black/50 backdrop-blur-sm flex items-center justify-center p-4",children:Me.jsx(qh,{onSubmit:l})})}Kt.OmnixVoiceWidget=Uh,Object.defineProperty(Kt,Symbol.toStringTag,{value:"Module"})});
|