PageSourceSearch

https://petstory.ru/product-finder/_nuxt/CG8ebSDV.js

js petstory.ru collected 2026-09-24 09:08:06 UTC 3,843 bytes, 1 lines download raw bytes

1import{q as N,f as D}from"./BC6ytVF3.js";import{u as G}from"./eXsjguUg.js";import{w as X,o as Y,z as _,X as j,r as J,n as K}from"./BmBKTJoK.js";const Q=4,Z="stale",$=100;function L(t,p){return t.replace(/\D/g,"").slice(0,p)}function ee(){return typeof window<"u"&&"OTPCredential"in window&&typeof navigator.credentials?.get=="function"}function te(){return typeof navigator<"u"&&navigator.maxTouchPoints>0}function re(){return!!D().public.petstoryUi?.smsOtpAutofill}async function ue(t,p,y){const o=N();o.setSmsOtpSendError(""),t(p),await K(),o.markSmsOtpSent();try{const r=await y();return o.markSmsOtpSent(),r}catch(r){const c=r instanceof Error&&r.message?r.message:"Произошла ошибка";throw o.setSmsOtpSendError(c),r}}function ae(t){const p=D(),{isMobileOrTablet:y}=G(),o=t.codeLength??Q;let r=null,c=null,g="",C=!1,a=!1,S=!1,d=null;const u=J("unknown"),s=_(()=>{const e=!!p.public.petstoryUi?.smsOtpAutofill,i=t.enabled===void 0||!!j(t.enabled),n=!!y||te();return e&&i&&n}),B=_(()=>s.value?{autocomplete:"one-time-code",inputmode:"numeric",type:"text",pattern:"[0-9]*",maxlength:String(o)}:{inputmode:"numeric",type:"text"});function h(){c&&(clearInterval(c),c=null)}function w(){r?.abort(),r=null}function T(){w(),h()}function b(){T(),M()}function M(){d&&typeof document<"u"&&(document.removeEventListener("visibilitychange",d),d=null)}function I(){d||a||typeof document>"u"||(d=()=>{a||!s.value||document.visibilityState!=="visible"||(l(),O()&&f())},document.addEventListener("visibilitychange",d))}function z(){f(),l()}function U(){return L(t.inputRef.value?.value??"",o)}function V(e){if(!e)return u.value;const i=e,n=i.inputType||"";if(S||n==="insertFromPaste")return S=!1,"paste";if(n==="insertReplacementText")return"autofill";const v=L(i.data??"",o);return n==="insertText"&&v.length===o?"autofill":n.startsWith("insert")||n.startsWith("delete")?"manual":"unknown"}function R(){S=!0}function O(){return!!(t.inputRef.value&&typeof document<"u"&&document.activeElement===t.inputRef.value)}function f(){h(),!(a||!s.value||!O())&&(c=setInterval(()=>{E(),O()||h()},$))}async function P(e,i=u.value){const n=L(e,o);if(!(n.length!==o||n===g||C)){g=n,C=!0,u.value=i,h(),t.onCodeChange?.(n);try{const v=await t.onCodeComplete(n,i);if(a||v===Z)return;if(v===!1){l(),f();return}b()}catch{a||(l(),f())}finally{C=!1}}}function E(e){const i=U(),n=V(e);if((n!=="unknown"||u.value==="unknown")&&(u.value=n),s.value&&t.inputRef.value&&t.inputRef.value.value!==i&&(t.inputRef.value.value=i),t.onCodeChange?.(i),i.length<o){g="";return}P(i,u.value)}async function l(){if(a||!s.value||!ee())return;w();const e=new AbortController;r=e;try{const i=await navigator.credentials.get({otp:{transport:["sms"]},signal:e.signal});if(!i?.code||e.signal.aborted||!s.value)return;const n=L(i.code,o);u.value="autofill",t.inputRef.value&&(t.inputRef.value.value=n),await P(n,"autofill")}catch{return}finally{r===e&&(r=null)}}function q(){a||(g="",u.value="unknown",T(),I(),l(),f())}return X(()=>[t.inputRef.value,s.value],([e,i],n,v)=>{if(b(),g="",!e||!i)return;const m=H=>E(H),k=()=>R(),F=()=>z(),A=()=>h(),x=e.closest("form"),W=()=>w();e.addEventListener("input",m),e.addEventListener("paste",k),e.addEventListener("change",m),e.addEventListener("keyup",m),e.addEventListener("focus",F),e.addEventListener("blur",A),x?.addEventListener("submit",W),I(),l(),f(),v(()=>{e.removeEventListener("input",m),e.removeEventListener("paste",k),e.removeEventListener("change",m),e.removeEventListener("keyup",m),e.removeEventListener("focus",F),e.removeEventListener("blur",A),x?.removeEventListener("submit",W),b()})},{immediate:!0,flush:"post"}),Y(()=>{a=!0,b()}),{isFeatureEnabled:s,currentCodeMethod:u,otpInputAttributes:B,startListening:l,cancelListening:b,restartListening:q,syncFromInput:E,handlePaste:R}}export{Q as D,Z as S,ue as a,re as i,ae as u};

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